wallet

package
v0.0.0-...-fc6107d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCoinTxn

func CreateCoinTxn(inputs []Inputs, outputs map[string]*big.Float, symbol, baseFeeID, baseFeeAmountParts string, contractFeeID, contractFeeAmountParts *string) (*pb.CoinTXN, error)

CreateCoinTxn creates a CoinTXN protobuf message for a given set of inputs and outputs Inputs: [Key] = address, [Value] = Inputs struct Outputs: [Key] = address, [Value] = amount of whole coins (not parts) symbol: contract symbol to send (ex $ZRA+0000) baseFeeID: fee id for the base fee (ex $ZRA+0000) baseFeeAmountParts: fee amount for the base fee in *parts* (ex 1000000000 = 1 ZRA) contractFeeID: fee id for the contract fee (ex $ZRA+0000) contractFeeAmountParts: fee amount for the contract fee in *parts* (ex 1000000000 = 1 ZRA)

func GetNonce

func GetNonce(address string) uint64

Gets the nonce from ZV indexer, ignores ssl cert in case its self signed or a non-official service to get nonce

func SendCoinTXN

func SendCoinTXN(txn *pb.CoinTXN) (*emptypb.Empty, error)

func Sign

func Sign(privateKeyBase58 string, payload []byte, keyType KeyType) ([]byte, error)

SignTransaction signs a transaction payload using the Ed25519 private key.

func Verify

func Verify(publicKeyBase58 string, payload []byte, signature []byte) (bool, error)

Verify verifies the signature of a transaction payload using the public key and the key type.

Types

type HashType

type HashType int16
const (
	BLAKE3   HashType = 1
	SHA3_256 HashType = 2
	SHA3_512 HashType = 3
)

type Inputs

type Inputs struct {
	B58Address         string
	KeyType            KeyType
	PublicKey          string     // Base 58 encoded
	PrivateKey         string     // Base 58 encoded
	Amount             *big.Float // full coins (not parts)
	FeePercent         float32    // 0-100 max 6 digits of precision
	ContractFeePercent *float32   // 0-100 max 6 digits of precision
}

type KeyType

type KeyType int16
const (
	ED25519 KeyType = 1
	ED448   KeyType = 2
)

type NetworkClient

type NetworkClient struct {
	// contains filtered or unexported fields
}

struct for client implementation of grpcs

func NewNetworkClient

func NewNetworkClient(conn *grpc.ClientConn) *NetworkClient

constructor for client implementation of grpcs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL