wallet

package module
v0.0.0-...-a191d20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 22 Imported by: 3

README

Wallet

The core wallet module, it provides APIs for creating wallets, accounts, blocks, etc.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountExists = errors.New("account already exists")
View Source
var ErrAccountNotFound = errors.New("account not found")
View Source
var ErrBadPassword = errors.New("bad password")
View Source
var ErrBlockNotFound = errors.New("block not found")
View Source
var ErrInsufficientBalance = errors.New("insufficient balance")
View Source
var ErrInvalidAccount = errors.New("invalid account")
View Source
var ErrInvalidAccountCount = errors.New("invalid count")
View Source
var ErrInvalidPrivKey = errors.New("invalid private key")
View Source
var ErrInvalidSeed = errors.New("invalid seed")
View Source
var ErrInvalidWallet = errors.New("invalid wallet")
View Source
var ErrSameRepresentative = errors.New("same representative")
View Source
var ErrUnableToCreateAccount = errors.New("unable to create account")
View Source
var ErrWalletLocked = errors.New("wallet is locked")
View Source
var ErrWalletNotFound = errors.New("wallet not found")
View Source
var ErrWalletNotLocked = errors.New("wallet not locked")

Functions

func GetDecryptedKeyFromStorage

func GetDecryptedKeyFromStorage(wallet *ent.Wallet, key string) (string, error)

Retrieve decrypted key from storage if it exists

func SetDecryptedKeyToStorage

func SetDecryptedKeyToStorage(wallet *ent.Wallet, key string, seed string) error

Set decrypted key to storage

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

func (w *NanoWallet) AccountCreate(wallet *ent.Wallet, index *int) (*ent.Account, error)

Create the next account in sequence, or at index

func (*NanoWallet) AccountExists

func (w *NanoWallet) AccountExists(wallet *ent.Wallet, address string) (bool, error)

func (*NanoWallet) AccountsCreate

func (w *NanoWallet) AccountsCreate(wallet *ent.Wallet, count int) ([]*ent.Account, error)

func (*NanoWallet) AccountsList

func (w *NanoWallet) AccountsList(wallet *ent.Wallet, limit int) ([]*ent.Account, []string, error)

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 (w *NanoWallet) CreateAndPublishChangeBlock(wallet *ent.Wallet, address string, representative string, work *string, bpowKey *string, onlyIfDifferent bool) (string, error)

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 (w *NanoWallet) CreateAndPublishSendBlock(wallet *ent.Wallet, amount string, source string, destination string, id *string, work *string, bpowKey *string) (string, error)

func (*NanoWallet) EncryptWallet

func (w *NanoWallet) EncryptWallet(wallet *ent.Wallet, password string) (bool, error)

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

func (w *NanoWallet) GetAccount(wallet *ent.Wallet, address string) (*ent.Account, error)

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 (w *NanoWallet) UnlockWallet(wallet *ent.Wallet, password string) (bool, error)

func (*NanoWallet) WalletChangeSeed

func (w *NanoWallet) WalletChangeSeed(wallet *ent.Wallet, newSeed string) (*ent.Account, error)

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)

func (*NanoWallet) WalletRepresentativeSet

func (w *NanoWallet) WalletRepresentativeSet(wallet *ent.Wallet, representative string, changeExisting bool, bpowKey *string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址