Documentation ¶
Index ¶
- Variables
- type Balance
- type TxDetail
- type Validator
- type WalletDB
- func (w *WalletDB) AddTx(txd *TxDetail) error
- func (w *WalletDB) AddValidator(val *Validator) error
- func (w *WalletDB) Close()
- func (w *WalletDB) GetAccount() []byte
- func (w *WalletDB) GetBalance() (*Balance, error)
- func (w *WalletDB) GetID() uuid.UUID
- func (w *WalletDB) GetLastFinalizeHash() chainhash.Hash
- func (w *WalletDB) GetLastScanHash() chainhash.Hash
- func (w *WalletDB) GetMnemonic() string
- func (w *WalletDB) GetNonce() (uint64, error)
- func (w *WalletDB) GetPasshash() chainhash.Hash
- func (w *WalletDB) GetTxs() []*TxDetail
- func (w *WalletDB) GetValidators() []*Validator
- func (w *WalletDB) ProcessBlock(block *primitives.Block)
- func (w *WalletDB) RemoveValidator(pubkey [48]byte) error
- func (w *WalletDB) SetBalance(b *Balance) error
- func (w *WalletDB) SetLastFinalizeHash(hash chainhash.Hash) error
- func (w *WalletDB) SetLastScanHash(hash chainhash.Hash) error
- func (w *WalletDB) SetNonce(nonce uint64) error
- type WalletMan
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorNotInitialized is returned when the database buckets are not created correctly ErrorNotInitialized = errors.New("database is not initialized") )
Functions ¶
This section is empty.
Types ¶
type Balance ¶
Balance is an struct to show the user balance
type TxDetail ¶
TxDetail is a transaction that contains user readable data
type Validator ¶
type Validator struct {
PubKey [48]byte
}
Validator is a struct that shows the user its validator information
type WalletDB ¶
type WalletDB struct {
// contains filtered or unexported fields
}
WalletDB is a wrapper around a boltdb to store information to disk and track it on memory.
func CreateWallet ¶
CreateWallet creates and loads a new wallet using the password passed
func OpenWallet ¶
OpenWallet loads the wallet information
func (*WalletDB) AddValidator ¶
AddValidator stores a Validator on the memory map and database
func (*WalletDB) GetAccount ¶
GetAccount returns the wallet account public key
func (*WalletDB) GetBalance ¶
GetBalance returns current loaded balance
func (*WalletDB) GetLastFinalizeHash ¶
GetLastFinalizeHash returns the last loaded finalized hash
func (*WalletDB) GetLastScanHash ¶
GetLastScanHash returns the last loaded hash from which the wallet scanned
func (*WalletDB) GetMnemonic ¶
GetMnemonic returns the loaded mnemonic phrase
func (*WalletDB) GetPasshash ¶
GetPasshash returns the loaded password hash for fast verify password usage
func (*WalletDB) GetValidators ¶
GetValidators returns a slice of Validator
func (*WalletDB) ProcessBlock ¶
func (w *WalletDB) ProcessBlock(block *primitives.Block)
func (*WalletDB) RemoveValidator ¶
RemoveValidator removes a Validator pubkey from the memory map and database
func (*WalletDB) SetBalance ¶
SetBalance stores the balance to the memory and database
func (*WalletDB) SetLastFinalizeHash ¶
SetLastFinalizeHash sets the last finalized hash from which the wallet scanned to the memory and database
func (*WalletDB) SetLastScanHash ¶
SetLastScanHash sets the last hash from which the wallet scanned to the memory and database
type WalletMan ¶
type WalletMan struct { Wallets map[uuid.UUID]*WalletDB CurrentWallet *WalletDB // contains filtered or unexported fields }
WalletMan is a wallet manager that will track multiple wallets against the chain.
func NewWalletMan ¶
NewWalletMan creates a new wallets manager for multiple wallets tracking
func (*WalletMan) LoadWallets ¶
LoadWallets tries to load all files specified on the datapath as wallets and add id to the manager.
func (*WalletMan) ProcessBlock ¶
func (w *WalletMan) ProcessBlock(block *primitives.Block)
ProcessBlock checks the block information to update all wallets being tracked