Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCreateAccountCmd ¶
NewCreateAccountCmd creates a new Cobra command for creating a new account with the given options. It returns the created command.
func NewDeleteAccountCmd ¶
NewDeleteAccountCmd returns a new cobra command for deleting an account. option is used to pass in common.Options.
Types ¶
type Account ¶
type Account struct { Address string `json:"address"` PrivateKey []byte `json:"privKey"` // contains filtered or unexported fields }
Account represents a user account with an address and private key
func NewAccount ¶
NewAccount generates a new account with a new public-private key pair Returns a new account and an error if the key generation fails
func (*Account) GenerateAndSignMessage ¶
GenerateAndSignMessage generates a context.Message and signs it with the account's signer. args is a variadic parameter that can take multiple strings. Returns the base64-encoded string representation of the message and an error, if any.
type AccountPrinter ¶
type AccountPrinter string
func (AccountPrinter) GetByHeader ¶
func (a AccountPrinter) GetByHeader(h string) string
type LocalWallet ¶
type LocalWallet struct {
// contains filtered or unexported fields
}
func NewLocalWallet ¶
func NewLocalWallet(home string) (LocalWallet, error)
NewLocalWallet creates a new LocalWallet instance with the given home directory. If the directory does not exist, it will be created. The function returns a LocalWallet instance and an error if the directory creation fails.
func (*LocalWallet) DeleteAccounts ¶
func (localWallet *LocalWallet) DeleteAccounts(accAddrs ...string) error
DeleteAccounts deletes the accounts with the given addresses from the local wallet.
func (*LocalWallet) GetAccount ¶
func (localWallet *LocalWallet) GetAccount(accAddr string) (*Account, error)
GetAccount retrieves an account by its address.
func (*LocalWallet) ListAccounts ¶
func (localWallet *LocalWallet) ListAccounts() ([]string, error)
ListAccounts returns a slice of account addresses stored in the local wallet directory. Each account address is represented as a string. An error is returned if the directory cannot be read.
func (*LocalWallet) StoreAccount ¶
func (localWallet *LocalWallet) StoreAccount(account *Account) error
StoreAccount stores the account information in a file with the address as the filename