Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateNewSeed(Read func(buf []byte) (n int, err error)) ([]byte, error)
- type KeysJSON
- type Wallet
- func LoadFromFile(netPrefix byte, db *database.DB, password string, seedFile string) (*Wallet, error)
- func LoadFromSeed(netPrefix byte, db *database.DB, password, seedFile string, keysJSON KeysJSON) (*Wallet, error)
- func New(seed []byte, netPrefix byte, db *database.DB, password, seedFile string, ...) (*Wallet, error)
Constants ¶
const DUSK = uint64(10000000000)
DUSK is one whole unit of DUSK.
Variables ¶
var ErrSeedFileExists = fmt.Errorf("wallet seed file already exists")
ErrSeedFileExists is returned if the seed file already exists.
Functions ¶
Types ¶
type KeysJSON ¶ added in v0.4.0
type KeysJSON struct { Seed []byte `json:"seed"` SecretKeyBLS []byte `json:"secret_key_bls"` PublicKeyBLS []byte `json:"public_key_bls"` SecretKey []byte `json:"secret_key"` PublicKey keys.PublicKey `json:"public_key"` ViewKey keys.ViewKey `json:"view_key"` }
KeysJSON is a struct used to marshal / unmarshal fields to a encrypted file.
type Wallet ¶
type Wallet struct { PublicKey keys.PublicKey ViewKey keys.ViewKey SecretKey keys.SecretKey // contains filtered or unexported fields }
Wallet encapsulates the wallet.
func LoadFromFile ¶
func LoadFromFile(netPrefix byte, db *database.DB, password string, seedFile string) (*Wallet, error)
LoadFromFile loads a wallet from a .dat file.
func LoadFromSeed ¶
func LoadFromSeed(netPrefix byte, db *database.DB, password, seedFile string, keysJSON KeysJSON) (*Wallet, error)
LoadFromSeed loads a wallet from the seed.
func New ¶
func New(seed []byte, netPrefix byte, db *database.DB, password, seedFile string, secretKey *keys.SecretKey) (*Wallet, error)
New creates a wallet instance.
func (*Wallet) ClearDatabase ¶
ClearDatabase will remove all info from the database.
func (*Wallet) FetchTxHistory ¶
FetchTxHistory will return a slice containing information about all transactions made and received with this wallet.
func (*Wallet) ToKey ¶ added in v0.4.0
ToKey gets a string as public address and returns a PublicKey FIXME: this is used within the cmd/wallet transferDusk function. Not clear if still needed. Old implementation can be find here (https://github.com/dusk-network/dusk-wallet/blob/master/v2/key/publickey.go#L26).