Skip to main content

keepers

Keepers

The auth module only exposes one keeper, the account keeper, which can be used to read and write accounts.

Account Keeper

Presently only one fully-permissioned account keeper is exposed, which has the ability to both read and write all fields of all accounts, and to iterate over all stored accounts.

// AccountKeeperI is the interface contract that x/auth's keeper implements.
type AccountKeeperI interface {
// Return a new account with the next account number and the specified address. Does not save the new account to the store.
NewAccountWithAddress(sdk.Context, sdk.AccAddress) types.AccountI

// Return a new account with the next account number. Does not save the new account to the store.
NewAccount(sdk.Context, types.AccountI) types.AccountI

// Check if an account exists in the store.
HasAccount(sdk.Context, sdk.AccAddress) bool

// Retrieve an account from the store.
GetAccount(sdk.Context, sdk.AccAddress) types.AccountI

// Set an account in the store.
SetAccount(sdk.Context, types.AccountI)

// Remove an account from the store.
RemoveAccount(sdk.Context, types.AccountI)

// Iterate over all accounts, calling the provided function. Stop iteration when it returns true.
IterateAccounts(sdk.Context, func(types.AccountI) bool)

// Fetch the public key of an account at a specified address
GetPubKey(sdk.Context, sdk.AccAddress) (crypto.PubKey, error)

// Fetch the sequence of an account at a specified address.
GetSequence(sdk.Context, sdk.AccAddress) (uint64, error)

// Fetch the next account number, and increment the internal counter.
GetNextAccountNumber(sdk.Context) uint64
}