wallet

package
v1.12.0-RC2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Balance

func Balance(ctx context.Context) (int64, error)

Balance responds balance of the wallet that used.

NOTE: for using Balance you must set wallet info by running zcncore.SetWalletInfo.

func SetupZCNSDK

func SetupZCNSDK(cfg Config) error

SetupZCNSDK runs zcncore.SetLogFile, zcncore.SetLogLevel and zcncore.InitZCNSDK using provided Config.

If an error occurs during execution, the program terminates with code 2 and the error will be written in os.Stderr.

SetupZCNSDK should be used only once while application is starting.

Types

type Config

type Config interface {
	// LogDir returns directory to store logs.
	LogDir() string

	// LogLvl returns level of logs.
	LogLvl() string

	// BlockWorker returns address of dns server.
	BlockWorker() string

	// SignatureScheme returns signature scheme.
	SignatureScheme() string
}

Config represents config interface used for setup wallet.

type Wallet

type Wallet struct {
	ZCNWallet *zcncrypto.Wallet
}

Wallet represents a wallet that stores keys and additional info.

func New

func New(publicKey, privateKey []byte) *Wallet

New creates initialized Wallet.

func (*Wallet) ID

func (w *Wallet) ID() string

ID returns the client id.

NOTE: client id represents hex encoded SHA3-256 hash of the raw public key.

func (*Wallet) PublicKey

func (w *Wallet) PublicKey() string

PublicKey returns the public key.

func (*Wallet) StringJSON

func (w *Wallet) StringJSON() (string, error)

StringJSON returns marshalled to JSON string Wallet.ZCNWallet.

Jump to

Keyboard shortcuts

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