Documentation ¶
Index ¶
- func CreateOnChainAccount(ctx context.Context, t *testing.T, keyringUID string, keyRing keyring.Keyring, ...) cosmostypes.AccAddress
- func GetSigningKeyFromAddress(t *testing.T, bech32 string, keyRing keyring.Keyring) ringtypes.Scalar
- type AccountKeeper
- type PreGeneratedAccount
- func (pga *PreGeneratedAccount) AddToAccountKeeper(ctx context.Context, keeper AccountKeeper) error
- func (pga *PreGeneratedAccount) AddToKeyring(keyRing keyring.Keyring, uid string) error
- func (pga *PreGeneratedAccount) Marshal() (string, error)
- func (pga *PreGeneratedAccount) UnmarshalString(encodedAccountStr string) error
- type PreGeneratedAccountIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOnChainAccount ¶ added in v0.0.3
func CreateOnChainAccount( ctx context.Context, t *testing.T, keyringUID string, keyRing keyring.Keyring, accountKeeper AccountKeeper, preGeneratedAccts *PreGeneratedAccountIterator, ) cosmostypes.AccAddress
CreateOnChainAccount creates a new account with the given address keyring UID and stores it in the given keyring and account keeper. It returns the cosmostypes.AccAddress of the created account.
Types ¶
type AccountKeeper ¶ added in v0.0.3
type AccountKeeper interface { GetAccount(context.Context, types.AccAddress) types.AccountI SetAccount(context.Context, types.AccountI) // Return a new account with the next account number and the specified address. Does not save the new account to the store. NewAccountWithAddress(context.Context, types.AccAddress) types.AccountI // Fetch the next account number, and increment the internal counter. NextAccountNumber(context.Context) uint64 }
AccountKeeper defines the expected interface for the Account module.
type PreGeneratedAccount ¶
type PreGeneratedAccount struct { Address cosmostypes.AccAddress `json:"address"` Mnemonic string `json:"mnemonic"` }
PreGeneratedAccount holds the address and mnemonic of an account which was pre-generated by the `gen_accounts` package. It is intended to be used ONLY in tests. It is useful for scenarios where it is necessary to know the address of a specific key in a separate context from that of keyring and/or module genesis state construction.
func CreatePreGeneratedKeyringAccounts ¶
func CreatePreGeneratedKeyringAccounts( t *testing.T, kr keyring.Keyring, limit int, ) []*PreGeneratedAccount
CreatePreGeneratedKeyringAccounts uses the mnemonic from limit number of pre-generated accounts to populated the provided keyring, kr. It then returns the pre-generated accounts which were used.
TODO_TECHDEBT: Returning a new PreGeneratedAccountIterator instead of the slice of accounts could be more idiomatic. It would only contain keys which are known to be in the keyring.
func MustPreGeneratedAccountAtIndex ¶
func MustPreGeneratedAccountAtIndex(index uint32) *PreGeneratedAccount
MustPreGeneratedAccountAtIndex returns the pre-generated account at the given index. It panics on error; i.e. if the index is out of range.
func PreGeneratedAccountAtIndex ¶
func PreGeneratedAccountAtIndex(index uint32) (_ *PreGeneratedAccount, ok bool)
PreGeneratedAccountAtIndex returns the pre-generated account at the given index. It returns nil and false if the index is out of range.
func (*PreGeneratedAccount) AddToAccountKeeper ¶ added in v0.0.3
func (pga *PreGeneratedAccount) AddToAccountKeeper( ctx context.Context, keeper AccountKeeper, ) error
AddToAccountKeeper creates a new account in the given account module keeper from this PreGeneratedAccount.
func (*PreGeneratedAccount) AddToKeyring ¶ added in v0.0.3
func (pga *PreGeneratedAccount) AddToKeyring(keyRing keyring.Keyring, uid string) error
AddToKeyring creates a new account in the given keyring with the given UID from this PreGeneratedAccount.
func (*PreGeneratedAccount) Marshal ¶
func (pga *PreGeneratedAccount) Marshal() (string, error)
Marshal returns the base64 and JSON encoded account string.
func (*PreGeneratedAccount) UnmarshalString ¶
func (pga *PreGeneratedAccount) UnmarshalString(encodedAccountStr string) error
UnmarshalString parses the given base64 and JSON encoded account string into the PreGeneratedAccount receiver.
type PreGeneratedAccountIterator ¶
type PreGeneratedAccountIterator struct {
// contains filtered or unexported fields
}
PreGeneratedAccountIterator is an iterator over the pre-generated accounts. A new iterator populated with existing pre-generated accounts can be created with the PreGeneratedAccounts function. Alternatively, a new iterator can be created with the NewPreGeneratedAccountIterator function, to which a list of pre-generated accounts to be iterated over must be provided.
func NewPreGeneratedAccountIterator ¶
func NewPreGeneratedAccountIterator(accounts ...*PreGeneratedAccount) *PreGeneratedAccountIterator
NewPreGeneratedAccountIterator returns a new PreGeneratedAccountIterator with the given accounts. It is primarily used by the generated code to initially construct the preGeneratedAccounts variable.
func PreGeneratedAccounts ¶
func PreGeneratedAccounts() *PreGeneratedAccountIterator
PreGeneratedAccounts returns a new PreGeneratedAccountIterator with the accounts which were pre-generated by the `gen_accounts` package (i.e. accounts_table.go).
func (*PreGeneratedAccountIterator) Clone ¶
func (iter *PreGeneratedAccountIterator) Clone() *PreGeneratedAccountIterator
Clone returns a new PreGeneratedAccountIterator with the same accounts as the receiver but with its nextIndex reset to 0.
func (*PreGeneratedAccountIterator) Next ¶
func (iter *PreGeneratedAccountIterator) Next() (_ *PreGeneratedAccount, ok bool)
Next returns the next account in the iterator. It is safe to call concurrently and is guaranteed to return a unique account on each call. If the iterator index goes out of range, it returns nil and false.