Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(data []byte, passphrase string) []byte
- func Encrypt(data []byte, passphrase string) []byte
- func GeneratePath(testnet bool, name string) (string, error)
- func GetLoader(testnet bool, name string) (*wallet.Loader, error)
- func GetNetwork(testNet bool) netparams.Params
- func ValidatePhrase(phrase string) bool
- type AccountManager
- type AddressManager
- type HDWallet
- type WalletAuth
Constants ¶
const ( DefaultWalletDirectory = "wallets" DefaultPrivateDataName = "private.key" ErrorPrivateKeyCreating = "Can't create private data in %v" StatusSuccessfullyCreated = "Wallet created successfully." )
Variables ¶
var (
AccountNamespaceKey = []byte("waddrmgr")
)
var AvailableCoinTypes = []string{"BTC", "LTC", "ETH"}
Functions ¶
func GetNetwork ¶
func ValidatePhrase ¶
Validating seed phrase. The seed phrase must contain only letters and spaces
The seed phrase must contain [12,24] words
Types ¶
type AccountManager ¶
type AccountManager struct { WalletAuth AccountName string `short:"a" long:"account" description:"Account name" json:"account"` }
func (AccountManager) NewAccount ¶
func (generator AccountManager) NewAccount(wallet btcWallet.Wallet) (uint32, error)
This function creates a new account based on wallet and already specified name For first you nedd to unlock the wallet with passpriv If any error caused during this process , the function will return 0 and an error
type AddressManager ¶
type AddressManager struct { Account string `short:"a" long:"account" description:"Account name" json:"account"` WalletAuth Level int `short:"l" long:"level" description:"Address generation level"` Index int `short:"i" long:"index" description:"Address generation index"` // contains filtered or unexported fields }
func (*AddressManager) NewAddress ¶
func (am *AddressManager) NewAddress() (addresses []string, err error)
This function generates a new address based an account and the wallet Also considering coin type
func (*AddressManager) SetWallet ¶
func (am *AddressManager) SetWallet(wallet *btcdWallet.Wallet)
This function will set the wallet in AddressManager If the wallet doesn't set than will be empty wallet instead
type HDWallet ¶
type HDWallet struct { SeedPhrase string `json:"seed" short:"s" long:"seed" description:"Seed phrase of the wallet"` WalletAuth }
type WalletAuth ¶
type WalletAuth struct { WalletName string `short:"n" long:"name" description:"Name of the wallet" json:"wallet"` Password string `short:"p" long:"password" description:"Password of the wallet" json:"password"` Coin uint32 `short:"c" long:"coin" description:"Coin type" json:"coin"` TestNet bool `short:"t" long:"testnet" description:"TesNet network" json:"testnet"` }
func (*WalletAuth) Authorize ¶
func (wallet *WalletAuth) Authorize() (*btcwallet.Wallet, error)
This function will authorize wallet based on name and password If the loader can't find the wallet will be returned an error Else the function will be return an existing wallet
func (*WalletAuth) GetKeyScope ¶
func (wallet *WalletAuth) GetKeyScope() waddrmgr.KeyScope
This function return kyscope data based on BIP and coin id ( we are always uisng BIP44 )
func (WalletAuth) Path ¶
func (wallet WalletAuth) Path()