Documentation
¶
Index ¶
- Variables
- type AccountKey
- type BlockProcessor
- type Builder
- type Config
- type KeyHashes
- type Keys
- type Wallet
- func (w *Wallet) GetMaxBlockNumber() (uint64, error)
- func (w *Wallet) SendTransaction(tx *txsystem.Transaction) (*txsystem.TransactionResponse, error)
- func (w *Wallet) Shutdown()
- func (w *Wallet) Sync(ctx context.Context, blockNumber uint64) error
- func (w *Wallet) SyncToMaxBlockNumber(ctx context.Context, blockNumber uint64) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrWalletAlreadySynchronizing = errors.New("wallet is already synchronizing")
)
Functions ¶
This section is empty.
Types ¶
type AccountKey ¶
type AccountKey struct {
PubKey []byte `json:"pubKey"` // compressed secp256k1 key 33 bytes
PrivKey []byte `json:"privKey"`
PubKeyHash *KeyHashes `json:"pubKeyHash"`
DerivationPath []byte `json:"derivationPath"`
}
func NewAccountKey ¶
func NewAccountKey(masterKey *hdkeychain.ExtendedKey, derivationPath string) (*AccountKey, error)
NewAccountKey generates new account key from given master key and derivation path
type BlockProcessor ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) SetABClientConf ¶
func (b *Builder) SetABClientConf(abcConf client.AlphabillClientConfig) *Builder
func (*Builder) SetBlockProcessor ¶
func (b *Builder) SetBlockProcessor(bp BlockProcessor) *Builder
type Config ¶
type Config struct {
// Configuration options for connecting to alphabill nodes.
AlphabillClientConfig client.AlphabillClientConfig
}
Config configuration options for creating and loading a wallet.
type Keys ¶
type Keys struct {
Mnemonic string
MasterKey *hdkeychain.ExtendedKey
AccountKey *AccountKey
}
type Wallet ¶
Wallet To synchronize wallet with a node call Sync. Shutdown needs to be called to release resources used by wallet.
func (*Wallet) GetMaxBlockNumber ¶
GetMaxBlockNumber queries the node for latest block number
func (*Wallet) SendTransaction ¶
func (w *Wallet) SendTransaction(tx *txsystem.Transaction) (*txsystem.TransactionResponse, error)
SendTransaction broadcasts transaction to configured node.
func (*Wallet) Shutdown ¶
func (w *Wallet) Shutdown()
Shutdown terminates connection to alphabill node, closes wallet db, cancels dust collector job and any background goroutines.
func (*Wallet) Sync ¶
Sync synchronises wallet from the last known block number with the given alphabill node. The function blocks forever or until alphabill connection is terminated. Returns error if wallet is already synchronizing or any error occured during syncrohronization, otherwise returns nil.
func (*Wallet) SyncToMaxBlockNumber ¶
SyncToMaxBlockNumber synchronises wallet from the last known block number with the given alphabill node. The function blocks until maximum block height, calculated at the start of the process, is reached. Returns error if wallet is already synchronizing or any error occured during syncrohronization, otherwise returns nil.