wallet

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileModeUserReadWriteOnly = 0o600
)

Variables

View Source
var (
	ErrAddressNotUnique  = errors.New("this account address already exists")
	ErrNicknameNotUnique = errors.New("this account nickname already exists")
)
View Source
var (
	ErrPersistingAccount = errors.New("error persisting account")
	AccountNotFoundError = errors.New("account not found")
)
View Source
var ErrUnmarshalAccount = errors.New("unmarshaling account")

Functions

func ClearAccounts added in v0.2.9

func ClearAccounts(t *testing.T, walletPath string)

func Filename

func Filename(nickname string) string

filename returns the wallet filename based on the given nickname.

func GetWorkDir

func GetWorkDir() (string, error)

func Path added in v0.2.9

func Path() (string, error)

Path returns the path where the account yaml file are stored.

Types

type Wallet

type Wallet struct {
	InvalidAccountNicknames []string // List of invalid account nicknames
	WalletPath              string
	// contains filtered or unexported fields
}

func New added in v0.2.9

func New(walletPath string) (*Wallet, error)

New creates a new wallet instance. If walletPath is empty, it will use the default wallet path.

func (*Wallet) AccountPath added in v0.2.9

func (w *Wallet) AccountPath(nickname string) (string, error)

func (*Wallet) AddAccount added in v0.2.9

func (w *Wallet) AddAccount(acc *account.Account, persist bool, force bool) error

Add an account into the wallet

func (*Wallet) AddressIsUnique added in v0.2.9

func (w *Wallet) AddressIsUnique(address *types.Address) error

func (*Wallet) AllAccounts added in v0.2.9

func (w *Wallet) AllAccounts() []*account.Account

func (*Wallet) DeleteAccount added in v0.2.9

func (w *Wallet) DeleteAccount(nickname string) error

Delete an account from the wallet

func (*Wallet) Discover added in v0.2.9

func (w *Wallet) Discover() error

func (*Wallet) GenerateAccount added in v0.2.9

func (w *Wallet) GenerateAccount(password *memguard.LockedBuffer, nickname string) (*account.Account, error)

GenerateAccount generates a new account and adds it to the wallet. It returns the generated account. It destroys the password.

func (*Wallet) GetAccount added in v0.2.9

func (w *Wallet) GetAccount(nickname string) (*account.Account, error)

Get an account from the wallet by nickname

func (*Wallet) GetAccountCount added in v0.2.9

func (w *Wallet) GetAccountCount() int

Get the number of accounts in the wallet

func (*Wallet) GetAccountFromAddress added in v0.2.9

func (w *Wallet) GetAccountFromAddress(needle string) (*account.Account, error)

func (*Wallet) Load added in v0.2.9

func (w *Wallet) Load(filePath string) (*account.Account, error)

func (*Wallet) MigrateWallet added in v0.2.9

func (w *Wallet) MigrateWallet() error

MigrateWallet moves the wallet from the old location (executable file) to the new one (user config).

func (*Wallet) NicknameIsUnique added in v0.2.9

func (w *Wallet) NicknameIsUnique(nickname string) error

func (*Wallet) Persist

func (w *Wallet) Persist(acc account.Account) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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