Documentation ¶
Index ¶
- func AddressStoreKey(addr sdk.AccAddress) []byte
- func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder
- func InitGenesis(ctx sdk.Context, keeper FeeCollectionKeeper, data GenesisState)
- func NewAnteHandler(am AccountKeeper, fck FeeCollectionKeeper) sdk.AnteHandler
- func RegisterBaseAccount(cdc *codec.Codec)
- func RegisterCodec(cdc *codec.Codec)
- func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, msgs []sdk.Msg, ...) []byte
- func WithSigners(ctx types.Context, accounts []Account) types.Context
- type Account
- type AccountDecoder
- type AccountKeeper
- func (am AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) Account
- func (am AccountKeeper) GetNextAccountNumber(ctx sdk.Context) uint64
- func (am AccountKeeper) GetPubKey(ctx sdk.Context, addr sdk.AccAddress) (crypto.PubKey, sdk.Error)
- func (am AccountKeeper) GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint64, sdk.Error)
- func (am AccountKeeper) IterateAccounts(ctx sdk.Context, process func(Account) (stop bool))
- func (am AccountKeeper) NewAccount(ctx sdk.Context, acc Account) Account
- func (am AccountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) Account
- func (am AccountKeeper) RemoveAccount(ctx sdk.Context, acc Account)
- func (am AccountKeeper) SetAccount(ctx sdk.Context, acc Account)
- type BaseAccount
- func (acc *BaseAccount) GetAccountNumber() uint64
- func (acc BaseAccount) GetAddress() sdk.AccAddress
- func (acc *BaseAccount) GetCoins() sdk.Coins
- func (acc BaseAccount) GetPubKey() crypto.PubKey
- func (acc *BaseAccount) GetSequence() uint64
- func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
- func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error
- func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
- func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
- func (acc *BaseAccount) SetSequence(seq uint64) error
- type FeeCollectionKeeper
- type GenesisState
- type StdFee
- type StdSignDoc
- type StdSignature
- type StdTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressStoreKey ¶ added in v0.26.0
func AddressStoreKey(addr sdk.AccAddress) []byte
Turn an address to key used to get it from the account store
func DefaultTxDecoder ¶ added in v0.26.0
logic for standard transaction decoding
func InitGenesis ¶ added in v0.26.0
func InitGenesis(ctx sdk.Context, keeper FeeCollectionKeeper, data GenesisState)
Init store state from genesis data
func NewAnteHandler ¶
func NewAnteHandler(am AccountKeeper, fck FeeCollectionKeeper) sdk.AnteHandler
NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.
func RegisterBaseAccount ¶
Most users shouldn't use this, but this comes in handy for tests.
func RegisterCodec ¶ added in v0.26.0
Register concrete types on codec codec for default AppAccount
Types ¶
type Account ¶ added in v0.26.0
type Account interface { GetAddress() sdk.AccAddress SetAddress(sdk.AccAddress) error // errors if already set. GetPubKey() crypto.PubKey // can return nil. SetPubKey(crypto.PubKey) error GetAccountNumber() uint64 SetAccountNumber(uint64) error GetSequence() uint64 SetSequence(uint64) error GetCoins() sdk.Coins SetCoins(sdk.Coins) error }
Account is an interface used to store coins at a given address within state. It presumes a notion of sequence numbers for replay protection, a notion of account numbers for replay protection for previously pruned accounts, and a pubkey for authentication purposes.
Many complex conditions can be used in the concrete struct which implements Account.
func ProtoBaseAccount ¶ added in v0.26.0
func ProtoBaseAccount() Account
Prototype function for BaseAccount
type AccountDecoder ¶ added in v0.26.0
AccountDecoder unmarshals account bytes
type AccountKeeper ¶ added in v0.26.0
type AccountKeeper struct {
// contains filtered or unexported fields
}
This AccountKeeper encodes/decodes accounts using the go-amino (binary) encoding/decoding library.
func NewAccountKeeper ¶ added in v0.26.0
NewAccountKeeper returns a new sdk.AccountKeeper that uses go-amino to (binary) encode and decode concrete sdk.Accounts. nolint
func (AccountKeeper) GetAccount ¶ added in v0.26.0
func (am AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) Account
Implements sdk.AccountKeeper.
func (AccountKeeper) GetNextAccountNumber ¶ added in v0.26.0
func (am AccountKeeper) GetNextAccountNumber(ctx sdk.Context) uint64
Returns and increments the global account number counter
func (AccountKeeper) GetPubKey ¶ added in v0.26.0
func (am AccountKeeper) GetPubKey(ctx sdk.Context, addr sdk.AccAddress) (crypto.PubKey, sdk.Error)
Returns the PubKey of the account at address
func (AccountKeeper) GetSequence ¶ added in v0.26.0
func (am AccountKeeper) GetSequence(ctx sdk.Context, addr sdk.AccAddress) (uint64, sdk.Error)
Returns the Sequence of the account at address
func (AccountKeeper) IterateAccounts ¶ added in v0.26.0
func (am AccountKeeper) IterateAccounts(ctx sdk.Context, process func(Account) (stop bool))
Implements sdk.AccountKeeper.
func (AccountKeeper) NewAccount ¶ added in v0.26.0
func (am AccountKeeper) NewAccount(ctx sdk.Context, acc Account) Account
New Account
func (AccountKeeper) NewAccountWithAddress ¶ added in v0.26.0
func (am AccountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) Account
Implaements sdk.AccountKeeper.
func (AccountKeeper) RemoveAccount ¶ added in v0.26.0
func (am AccountKeeper) RemoveAccount(ctx sdk.Context, acc Account)
RemoveAccount removes an account for the account mapper store.
func (AccountKeeper) SetAccount ¶ added in v0.26.0
func (am AccountKeeper) SetAccount(ctx sdk.Context, acc Account)
Implements sdk.AccountKeeper.
type BaseAccount ¶
type BaseAccount struct { Address sdk.AccAddress `json:"address"` Coins sdk.Coins `json:"coins"` PubKey crypto.PubKey `json:"public_key"` AccountNumber uint64 `json:"account_number"` Sequence uint64 `json:"sequence"` }
BaseAccount - a base account structure. This can be extended by embedding within in your AppAccount. There are examples of this in: examples/basecoin/types/account.go. However one doesn't have to use BaseAccount as long as your struct implements Account.
func NewBaseAccountWithAddress ¶
func NewBaseAccountWithAddress(addr sdk.AccAddress) BaseAccount
func (*BaseAccount) GetAccountNumber ¶ added in v0.26.0
func (acc *BaseAccount) GetAccountNumber() uint64
Implements Account
func (BaseAccount) GetAddress ¶
func (acc BaseAccount) GetAddress() sdk.AccAddress
Implements sdk.Account.
func (BaseAccount) GetPubKey ¶
func (acc BaseAccount) GetPubKey() crypto.PubKey
Implements sdk.Account.
func (*BaseAccount) GetSequence ¶
func (acc *BaseAccount) GetSequence() uint64
Implements sdk.Account.
func (*BaseAccount) SetAccountNumber ¶ added in v0.26.0
func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
Implements Account
func (*BaseAccount) SetAddress ¶
func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error
Implements sdk.Account.
func (*BaseAccount) SetCoins ¶
func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
Implements sdk.Account.
func (*BaseAccount) SetPubKey ¶
func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
Implements sdk.Account.
func (*BaseAccount) SetSequence ¶
func (acc *BaseAccount) SetSequence(seq uint64) error
Implements sdk.Account.
type FeeCollectionKeeper ¶ added in v0.26.0
type FeeCollectionKeeper struct {
// contains filtered or unexported fields
}
This FeeCollectionKeeper handles collection of fees in the anteHandler and setting of MinFees for different fee tokens
func NewFeeCollectionKeeper ¶ added in v0.26.0
func NewFeeCollectionKeeper(cdc *codec.Codec, key sdk.StoreKey) FeeCollectionKeeper
func (FeeCollectionKeeper) AddCollectedFees ¶ added in v0.26.0
add to the fee pool
func (FeeCollectionKeeper) ClearCollectedFees ¶ added in v0.26.0
func (fck FeeCollectionKeeper) ClearCollectedFees(ctx sdk.Context)
clear the fee pool
func (FeeCollectionKeeper) GetCollectedFees ¶ added in v0.26.0
func (fck FeeCollectionKeeper) GetCollectedFees(ctx sdk.Context) sdk.Coins
retrieves the collected fee pool
type GenesisState ¶ added in v0.26.0
GenesisState - all auth state that must be provided at genesis
func DefaultGenesisState ¶ added in v0.26.0
func DefaultGenesisState() GenesisState
Return a default genesis state
func ExportGenesis ¶ added in v0.26.0
func ExportGenesis(ctx sdk.Context, keeper FeeCollectionKeeper) GenesisState
ExportGenesis returns a GenesisState for a given context and keeper
func NewGenesisState ¶ added in v0.26.0
func NewGenesisState(collectedFees sdk.Coins) GenesisState
Create a new genesis state
type StdFee ¶ added in v0.26.0
StdFee includes the amount of coins paid in fees and the maximum gas to be used by the transaction. The ratio yields an effective "gasprice", which must be above some miminum to be accepted into the mempool.
type StdSignDoc ¶ added in v0.26.0
type StdSignDoc struct { AccountNumber uint64 `json:"account_number"` ChainID string `json:"chain_id"` Fee json.RawMessage `json:"fee"` Memo string `json:"memo"` Msgs []json.RawMessage `json:"msgs"` Sequence uint64 `json:"sequence"` }
StdSignDoc is replay-prevention structure. It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Sequence numbers for each signature (prevent inchain replay and enforce tx ordering per account).
type StdSignature ¶ added in v0.26.0
type StdSignature struct { crypto.PubKey `json:"pub_key"` // optional Signature []byte `json:"signature"` AccountNumber uint64 `json:"account_number"` Sequence uint64 `json:"sequence"` }
Standard Signature
type StdTx ¶ added in v0.26.0
type StdTx struct { Msgs []sdk.Msg `json:"msg"` Fee StdFee `json:"fee"` Signatures []StdSignature `json:"signatures"` Memo string `json:"memo"` }
StdTx is a standard way to wrap a Msg with Fee and Signatures. NOTE: the first signature is the fee payer (Signatures must not be nil).
func (StdTx) GetSignatures ¶ added in v0.26.0
func (tx StdTx) GetSignatures() []StdSignature
Signatures returns the signature of signers who signed the Msg. GetSignatures returns the signature of signers who signed the Msg. CONTRACT: Length returned is same as length of pubkeys returned from MsgKeySigners, and the order matches. CONTRACT: If the signature is missing (ie the Msg is invalid), then the corresponding signature is .Empty().
func (StdTx) GetSigners ¶ added in v0.26.0
func (tx StdTx) GetSigners() []sdk.AccAddress
GetSigners returns the addresses that must sign the transaction. Addresses are returned in a deterministic order. They are accumulated from the GetSigners method for each Msg in the order they appear in tx.GetMsgs(). Duplicate addresses will be omitted.
func (StdTx) ValidateBasic ¶
ValidateBasic does a simple and lightweight validation check that doesn't require access to any other information.