Documentation
¶
Index ¶
- Variables
- func GetDecryptedKeyFromStorage(wallet *ent.Wallet, key string) (string, error)
- func SetDecryptedKeyToStorage(wallet *ent.Wallet, key string, seed string) error
- type NanoWallet
- func (w *NanoWallet) AccountCreate(wallet *ent.Wallet, index *int) (*ent.Account, error)
- func (w *NanoWallet) AccountExists(wallet *ent.Wallet, address string) (bool, error)
- func (w *NanoWallet) AccountsCreate(wallet *ent.Wallet, count int) ([]*ent.Account, error)
- func (w *NanoWallet) AccountsList(wallet *ent.Wallet, limit int) ([]*ent.Account, []string, error)
- func (w *NanoWallet) AdhocAccountCreate(wallet *ent.Wallet, privKey ed25519.PrivateKey) (*ent.Account, error)
- func (w *NanoWallet) CreateAndPublishChangeBlock(wallet *ent.Wallet, address string, representative string, work *string, ...) (string, error)
- func (w *NanoWallet) CreateAndPublishReceiveBlock(wallet *ent.Wallet, source string, hash string, work *string, bpowKey *string) (string, error)
- func (w *NanoWallet) CreateAndPublishSendBlock(wallet *ent.Wallet, amount string, source string, destination string, ...) (string, error)
- func (w *NanoWallet) EncryptWallet(wallet *ent.Wallet, password string) (bool, error)
- func (w *NanoWallet) GetAccount(wallet *ent.Wallet, address string) (*ent.Account, error)
- func (w *NanoWallet) GetAccountByAddress(address string) (*ent.Account, error)
- func (w *NanoWallet) GetBlockFromDatabase(wallet *ent.Wallet, address string, sendID string) (*ent.Block, error)
- func (w *NanoWallet) GetWallet(walletID string) (*ent.Wallet, error)
- func (w *NanoWallet) GetWallets() ([]*ent.Wallet, error)
- func (w *NanoWallet) LockWallet(wallet *ent.Wallet) error
- func (w *NanoWallet) ReceiveAllBlocks(wallet *ent.Wallet, source string, bpowKey *string) (int, error)
- func (w *NanoWallet) UnlockWallet(wallet *ent.Wallet, password string) (bool, error)
- func (w *NanoWallet) WalletChangeSeed(wallet *ent.Wallet, newSeed string) (*ent.Account, error)
- func (w *NanoWallet) WalletCreate(seed string) (*ent.Wallet, error)
- func (w *NanoWallet) WalletDestroy(wallet *ent.Wallet) error
- func (w *NanoWallet) WalletInfo(wallet *ent.Wallet) (*models.WalletInfo, error)
- func (w *NanoWallet) WalletRepresentativeSet(wallet *ent.Wallet, representative string, changeExisting bool, ...) error
Constants ¶
This section is empty.
Variables ¶
var ErrAccountExists = errors.New("account already exists")
var ErrAccountNotFound = errors.New("account not found")
var ErrBadPassword = errors.New("bad password")
var ErrBlockNotFound = errors.New("block not found")
var ErrInsufficientBalance = errors.New("insufficient balance")
var ErrInvalidAccount = errors.New("invalid account")
var ErrInvalidAccountCount = errors.New("invalid count")
var ErrInvalidPrivKey = errors.New("invalid private key")
var ErrInvalidSeed = errors.New("invalid seed")
var ErrInvalidWallet = errors.New("invalid wallet")
var ErrSameRepresentative = errors.New("same representative")
var ErrUnableToCreateAccount = errors.New("unable to create account")
var ErrWalletLocked = errors.New("wallet is locked")
var ErrWalletNotFound = errors.New("wallet not found")
var ErrWalletNotLocked = errors.New("wallet not locked")
Functions ¶
func GetDecryptedKeyFromStorage ¶
Retrieve decrypted key from storage if it exists
Types ¶
type NanoWallet ¶
type NanoWallet struct {
DB *ent.Client
Ctx context.Context
RpcClient *nanorpc.RPCClient
WorkClient *pow.PippinPow
Config *config.PippinConfig
Banano bool
}
func (*NanoWallet) AccountCreate ¶
Create the next account in sequence, or at index
func (*NanoWallet) AccountExists ¶
func (*NanoWallet) AccountsCreate ¶
func (*NanoWallet) AccountsList ¶
Retrieve list of accounts on a wallet, if not locked
func (*NanoWallet) AdhocAccountCreate ¶
func (w *NanoWallet) AdhocAccountCreate(wallet *ent.Wallet, privKey ed25519.PrivateKey) (*ent.Account, error)
Create an adhoc account. Returns adhocaccount or account if already exists Already existing account may be adhoc or non-adhoc
func (*NanoWallet) CreateAndPublishChangeBlock ¶
func (*NanoWallet) CreateAndPublishReceiveBlock ¶
func (w *NanoWallet) CreateAndPublishReceiveBlock(wallet *ent.Wallet, source string, hash string, work *string, bpowKey *string) (string, error)
Receive single block
func (*NanoWallet) CreateAndPublishSendBlock ¶
func (*NanoWallet) EncryptWallet ¶
Encrypt entrypoint If password is a blank string, we disable encryption for the wallet If password is not a blank string, we enable encryption for the wallet
func (*NanoWallet) GetAccount ¶
Retrieve an account or adhoc account for a wallet
func (*NanoWallet) GetAccountByAddress ¶
func (w *NanoWallet) GetAccountByAddress(address string) (*ent.Account, error)
func (*NanoWallet) GetBlockFromDatabase ¶
func (w *NanoWallet) GetBlockFromDatabase(wallet *ent.Wallet, address string, sendID string) (*ent.Block, error)
Retrieve a block for an account or adhoc account, error if it doesn't exist Intended to retrieve a block with a particular send ID, to see if it's already been created
func (*NanoWallet) GetWallet ¶
func (w *NanoWallet) GetWallet(walletID string) (*ent.Wallet, error)
Retrieves wallet
func (*NanoWallet) GetWallets ¶
func (w *NanoWallet) GetWallets() ([]*ent.Wallet, error)
func (*NanoWallet) LockWallet ¶
func (w *NanoWallet) LockWallet(wallet *ent.Wallet) error
func (*NanoWallet) ReceiveAllBlocks ¶
func (w *NanoWallet) ReceiveAllBlocks(wallet *ent.Wallet, source string, bpowKey *string) (int, error)
Receive all blocks in all accounts on wallet, respecting receive minimum
func (*NanoWallet) UnlockWallet ¶
func (*NanoWallet) WalletChangeSeed ¶
Change the seed of the wallet, will decrypt it if encrypted Will return the newest account of the changed wallet (the one with the highest index)
func (*NanoWallet) WalletCreate ¶
func (w *NanoWallet) WalletCreate(seed string) (*ent.Wallet, error)
Creates a new wallet with provided seed
func (*NanoWallet) WalletDestroy ¶
func (w *NanoWallet) WalletDestroy(wallet *ent.Wallet) error
func (*NanoWallet) WalletInfo ¶
func (w *NanoWallet) WalletInfo(wallet *ent.Wallet) (*models.WalletInfo, error)