Documentation ¶
Index ¶
- func BurnFeeHandler(_ sdk.Context, _ sdk.Tx, _ sdk.Coins)
- func FeePayer(tx sdk.Tx) sdk.Address
- func NewAnteHandler(am AccountMapper, fck FeeCollectionKeeper) sdk.AnteHandler
- func NewHandler(am AccountMapper) sdk.Handler
- func RegisterBaseAccount(cdc *wire.Codec)
- func RegisterWire(cdc *wire.Codec)
- func StdSignBytes(chainID string, sequences []int64, fee StdFee, msg sdk.Msg) []byte
- func WithSigners(ctx types.Context, accounts []Account) types.Context
- type Account
- type AccountDecoder
- type AccountMapper
- func (am AccountMapper) GetAccount(ctx sdk.Context, addr sdk.Address) Account
- func (am AccountMapper) GetPubKey(ctx sdk.Context, addr sdk.Address) (crypto.PubKey, sdk.Error)
- func (am AccountMapper) GetSequence(ctx sdk.Context, addr sdk.Address) (int64, sdk.Error)
- func (am AccountMapper) IterateAccounts(ctx sdk.Context, process func(Account) (stop bool))
- func (am AccountMapper) NewAccountWithAddress(ctx sdk.Context, addr sdk.Address) Account
- func (am AccountMapper) SetAccount(ctx sdk.Context, acc Account)
- func (am AccountMapper) SetPubKey(ctx sdk.Context, addr sdk.Address, newPubKey crypto.PubKey) sdk.Error
- type BaseAccount
- func (acc BaseAccount) GetAddress() sdk.Address
- func (acc *BaseAccount) GetCoins() sdk.Coins
- func (acc BaseAccount) GetPubKey() crypto.PubKey
- func (acc *BaseAccount) GetSequence() int64
- func (acc *BaseAccount) SetAddress(addr sdk.Address) error
- func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
- func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
- func (acc *BaseAccount) SetSequence(seq int64) error
- type FeeCollectionKeeper
- type MsgChangeKey
- type StdFee
- type StdSignDoc
- type StdSignMsg
- type StdSignature
- type StdTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BurnFeeHandler ¶ added in v0.15.0
BurnFeeHandler burns all fees (decreasing total supply)
func FeePayer ¶ added in v0.18.0
FeePayer returns the address responsible for paying the fees for the transactions. It's the first address returned by msg.GetSigners(). If GetSigners() is empty, this panics.
func NewAnteHandler ¶
func NewAnteHandler(am AccountMapper, fck FeeCollectionKeeper) sdk.AnteHandler
NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures, and deducts fees from the first signer.
func NewHandler ¶ added in v0.18.0
func NewHandler(am AccountMapper) sdk.Handler
NewHandler returns a handler for "baseaccount" type messages.
func RegisterBaseAccount ¶ added in v0.15.0
Most users shouldn't use this, but this comes handy for tests.
func RegisterWire ¶ added in v0.16.0
Register concrete types on wire codec for default AppAccount
func StdSignBytes ¶
StdSignBytes returns the bytes to sign for a transaction. TODO: change the API to just take a chainID and StdTx ?
Types ¶
type Account ¶ added in v0.18.0
type Account interface { GetAddress() sdk.Address SetAddress(sdk.Address) error // errors if already set. GetPubKey() crypto.PubKey // can return nil. SetPubKey(crypto.PubKey) error GetSequence() int64 SetSequence(int64) error GetCoins() sdk.Coins SetCoins(sdk.Coins) error }
Account is a standard account using a sequence number for replay protection and a pubkey for authentication.
func GetSigners ¶ added in v0.2.0
get the signers from the context
type AccountDecoder ¶ added in v0.18.0
AccountDecoder unmarshals account bytes
type AccountMapper ¶ added in v0.18.0
type AccountMapper struct {
// contains filtered or unexported fields
}
This AccountMapper encodes/decodes accounts using the go-amino (binary) encoding/decoding library.
func NewAccountMapper ¶ added in v0.2.0
NewAccountMapper returns a new sdk.AccountMapper that uses go-amino to (binary) encode and decode concrete sdk.Accounts. nolint
func (AccountMapper) GetAccount ¶ added in v0.18.0
Implements sdk.AccountMapper.
func (AccountMapper) GetSequence ¶ added in v0.18.0
Returns the Sequence of the account at address
func (AccountMapper) IterateAccounts ¶ added in v0.18.0
func (am AccountMapper) IterateAccounts(ctx sdk.Context, process func(Account) (stop bool))
Implements sdk.AccountMapper.
func (AccountMapper) NewAccountWithAddress ¶ added in v0.18.0
Implaements sdk.AccountMapper.
func (AccountMapper) SetAccount ¶ added in v0.18.0
func (am AccountMapper) SetAccount(ctx sdk.Context, acc Account)
Implements sdk.AccountMapper.
type BaseAccount ¶
type BaseAccount struct { Address sdk.Address `json:"address"` Coins sdk.Coins `json:"coins"` PubKey crypto.PubKey `json:"public_key"` Sequence int64 `json:"sequence"` }
BaseAccount - base account structure. Extend this by embedding this in your AppAccount. See the examples/basecoin/types/account.go for an example.
func NewBaseAccountWithAddress ¶
func NewBaseAccountWithAddress(addr sdk.Address) BaseAccount
func (BaseAccount) GetAddress ¶ added in v0.2.0
func (acc BaseAccount) GetAddress() sdk.Address
Implements sdk.Account.
func (*BaseAccount) GetCoins ¶ added in v0.2.0
func (acc *BaseAccount) GetCoins() sdk.Coins
Implements sdk.Account.
func (BaseAccount) GetPubKey ¶ added in v0.2.0
func (acc BaseAccount) GetPubKey() crypto.PubKey
Implements sdk.Account.
func (*BaseAccount) GetSequence ¶ added in v0.2.0
func (acc *BaseAccount) GetSequence() int64
Implements sdk.Account.
func (*BaseAccount) SetAddress ¶ added in v0.2.0
func (acc *BaseAccount) SetAddress(addr sdk.Address) error
Implements sdk.Account.
func (*BaseAccount) SetCoins ¶ added in v0.2.0
func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
Implements sdk.Account.
func (*BaseAccount) SetPubKey ¶ added in v0.2.0
func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
Implements sdk.Account.
func (*BaseAccount) SetSequence ¶ added in v0.2.0
func (acc *BaseAccount) SetSequence(seq int64) error
Implements sdk.Account.
type FeeCollectionKeeper ¶ added in v0.18.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.18.0
func NewFeeCollectionKeeper(cdc *wire.Codec, key sdk.StoreKey) FeeCollectionKeeper
NewFeeKeeper returns a new FeeKeeper
func (FeeCollectionKeeper) ClearCollectedFees ¶ added in v0.18.0
func (fck FeeCollectionKeeper) ClearCollectedFees(ctx sdk.Context)
Clears the collected Fee Pool
func (FeeCollectionKeeper) GetCollectedFees ¶ added in v0.18.0
func (fck FeeCollectionKeeper) GetCollectedFees(ctx sdk.Context) sdk.Coins
Adds to Collected Fee Pool
type MsgChangeKey ¶ added in v0.18.0
type MsgChangeKey struct { Address sdk.Address `json:"address"` NewPubKey crypto.PubKey `json:"public_key"` }
MsgChangeKey - high level transaction of the auth module
func NewMsgChangeKey ¶ added in v0.18.0
func NewMsgChangeKey(addr sdk.Address, pubkey crypto.PubKey) MsgChangeKey
NewMsgChangeKey - msg to claim an account and set the PubKey
func (MsgChangeKey) GetSignBytes ¶ added in v0.18.0
func (msg MsgChangeKey) GetSignBytes() []byte
Implements Msg.
func (MsgChangeKey) GetSigners ¶ added in v0.18.0
func (msg MsgChangeKey) GetSigners() []sdk.Address
Implements Msg.
func (MsgChangeKey) ValidateBasic ¶ added in v0.18.0
func (msg MsgChangeKey) ValidateBasic() sdk.Error
Implements Msg.
type StdFee ¶
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 ¶
type StdSignDoc struct { ChainID string `json:"chain_id"` Sequences []int64 `json:"sequences"` FeeBytes []byte `json:"fee_bytes"` MsgBytes []byte `json:"msg_bytes"` AltBytes []byte `json:"alt_bytes"` }
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 StdSignMsg ¶
StdSignMsg is a convenience structure for passing along a Msg with the other requirements for a StdSignDoc before it is signed. For use in the CLI.
type StdSignature ¶
type StdSignature struct { crypto.PubKey `json:"pub_key"` // optional crypto.Signature `json:"signature"` Sequence int64 `json:"sequence"` }
Standard Signature
type StdTx ¶
type StdTx struct { Msg sdk.Msg `json:"msg"` Fee StdFee `json:"fee"` Signatures []StdSignature `json:"signatures"` }
StdTx is a standard way to wrap a Msg with Fee and Signatures. NOTE: the first signature is the FeePayer (Signatures must not be nil).
func (StdTx) GetSignatures ¶ added in v0.18.0
func (tx StdTx) GetSignatures() []StdSignature
Signatures 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().