Documentation ¶
Overview ¶
nolint noalias
Index ¶
- Constants
- Variables
- func AddressStoreKey(addr sdk.AccAddress) []byte
- func CountSubKeys(pub crypto.PubKey) int
- func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder
- func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder
- func KeyTestPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress)
- func NewTestCoins() sdk.Coins
- func NewTestMsg(addrs ...sdk.AccAddress) *sdk.TestMsg
- func NewTestTx(ctx sdk.Context, msgs []sdk.Msg, privs []crypto.PrivKey, accNums []uint64, ...) sdk.Tx
- func NewTestTxWithMemo(ctx sdk.Context, msgs []sdk.Msg, privs []crypto.PrivKey, accNums []uint64, ...) sdk.Tx
- func NewTestTxWithSignBytes(msgs []sdk.Msg, privs []crypto.PrivKey, accNums []uint64, seqs []uint64, ...) sdk.Tx
- func ParamKeyTable() subspace.KeyTable
- func ProtoBaseAccount() exported.Account
- func RegisterCodec(cdc *codec.Codec)
- func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, msgs []sdk.Msg, ...) []byte
- func ValidateGenesis(data GenesisState) error
- type AccountRetriever
- func (ar AccountRetriever) EnsureExists(addr sdk.AccAddress) error
- func (ar AccountRetriever) GetAccount(addr sdk.AccAddress) (exported.Account, error)
- func (ar AccountRetriever) GetAccountNumberSequence(addr sdk.AccAddress) (uint64, uint64, error)
- func (ar AccountRetriever) GetAccountWithHeight(addr sdk.AccAddress) (exported.Account, int64, error)
- type BaseAccount
- func (acc *BaseAccount) Balance() sdk.Int
- func (acc *BaseAccount) GetAccountNumber() uint64
- func (acc BaseAccount) GetAddress() sdk.AccAddress
- func (acc *BaseAccount) GetCodeHash() []byte
- func (acc *BaseAccount) GetCoins() sdk.Coins
- func (acc BaseAccount) GetPubKey() crypto.PubKey
- func (acc *BaseAccount) GetSequence() uint64
- func (acc BaseAccount) MarshalYAML() (interface{}, error)
- func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
- func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error
- func (acc *BaseAccount) SetBalance(amt sdk.Int)
- func (acc *BaseAccount) SetCodeHash(codeHash []byte)
- func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
- func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
- func (acc *BaseAccount) SetSequence(seq uint64) error
- func (acc *BaseAccount) SpendableCoins(_ time.Time) sdk.Coins
- func (acc BaseAccount) String() string
- type BaseVestingAccount
- type ContinuousVestingAccount
- func (cva *ContinuousVestingAccount) GetEndTime() int64
- func (cva *ContinuousVestingAccount) GetStartTime() int64
- func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
- func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
- func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins
- func (cva ContinuousVestingAccount) String() string
- func (cva *ContinuousVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins)
- type DelayedVestingAccount
- func (dva *DelayedVestingAccount) GetEndTime() int64
- func (dva *DelayedVestingAccount) GetStartTime() int64
- func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
- func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
- func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins
- func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins)
- type GenesisState
- type NodeQuerier
- type Params
- type QueryAccountParams
- type StdFee
- type StdSignDoc
- type StdSignMsg
- type StdSignature
- type StdTx
- func (tx StdTx) FeePayer() sdk.AccAddress
- func (tx StdTx) GetFee() sdk.Coins
- func (tx StdTx) GetGas() uint64
- func (tx StdTx) GetMemo() string
- func (tx StdTx) GetMsgs() []sdk.Msg
- func (tx StdTx) GetPubKeys() []crypto.PubKey
- func (tx StdTx) GetSignBytes(ctx sdk.Context, acc exported.Account) []byte
- func (tx StdTx) GetSignatures() [][]byte
- func (tx StdTx) GetSigners() []sdk.AccAddress
- func (tx StdTx) ValidateBasic() error
- type SupplyKeeper
- type TxBuilder
- func (bldr TxBuilder) AccountNumber() uint64
- func (bldr TxBuilder) BuildAndSign(name, passphrase string, msgs []sdk.Msg) ([]byte, error)
- func (bldr TxBuilder) BuildSignMsg(msgs []sdk.Msg) (StdSignMsg, error)
- func (bldr TxBuilder) BuildTxForSim(msgs []sdk.Msg) ([]byte, error)
- func (bldr TxBuilder) ChainID() string
- func (bldr TxBuilder) Fees() sdk.Coins
- func (bldr TxBuilder) Gas() uint64
- func (bldr TxBuilder) GasAdjustment() float64
- func (bldr TxBuilder) GasPrices() sdk.DecCoins
- func (bldr TxBuilder) Keybase() crkeys.Keybase
- func (bldr TxBuilder) Memo() string
- func (bldr TxBuilder) Sequence() uint64
- func (bldr TxBuilder) Sign(name, passphrase string, msg StdSignMsg) ([]byte, error)
- func (bldr TxBuilder) SignStdTx(name, passphrase string, stdTx StdTx, appendSig bool) (signedStdTx StdTx, err error)
- func (bldr TxBuilder) SimulateAndExecute() bool
- func (bldr TxBuilder) TxEncoder() sdk.TxEncoder
- func (bldr TxBuilder) WithAccountNumber(accnum uint64) TxBuilder
- func (bldr TxBuilder) WithChainID(chainID string) TxBuilder
- func (bldr TxBuilder) WithFees(fees string) TxBuilder
- func (bldr TxBuilder) WithGas(gas uint64) TxBuilder
- func (bldr TxBuilder) WithGasPrices(gasPrices string) TxBuilder
- func (bldr TxBuilder) WithKeybase(keybase crkeys.Keybase) TxBuilder
- func (bldr TxBuilder) WithMemo(memo string) TxBuilder
- func (bldr TxBuilder) WithSequence(sequence uint64) TxBuilder
- func (bldr TxBuilder) WithTxEncoder(txEncoder sdk.TxEncoder) TxBuilder
Constants ¶
const ( // module name ModuleName = "auth" // StoreKey is string representation of the store key for auth StoreKey = "acc" // FeeCollectorName the root string for the fee collector account address FeeCollectorName = "fee_collector" // QuerierRoute is the querier route for acc QuerierRoute = StoreKey RefundKey = "refund_fee" )
const ( DefaultMaxMemoCharacters uint64 = 256 DefaultTxSigLimit uint64 = 7 DefaultTxSizeCostPerByte uint64 = 10 DefaultSigVerifyCostED25519 uint64 = 590 DefaultSigVerifyCostSecp256k1 uint64 = 1000 )
Default parameter values
const DefaultParamspace = ModuleName
DefaultParamspace defines the default auth module parameter subspace
const (
QueryAccount = "account"
)
query endpoints supported by the auth Querier
Variables ¶
var ( // AddressStoreKeyPrefix prefix for account-by-address store AddressStoreKeyPrefix = []byte{0x01} // param key for global account number GlobalAccountNumberKey = []byte("globalAccountNumber") )
var ( KeyMaxMemoCharacters = []byte("MaxMemoCharacters") KeyTxSigLimit = []byte("TxSigLimit") KeyTxSizeCostPerByte = []byte("TxSizeCostPerByte") KeySigVerifyCostED25519 = []byte("SigVerifyCostED25519") KeySigVerifyCostSecp256k1 = []byte("SigVerifyCostSecp256k1") )
Parameter keys
var ModuleCdc *codec.Codec
module wide codec
Functions ¶
func AddressStoreKey ¶
func AddressStoreKey(addr sdk.AccAddress) []byte
AddressStoreKey turn an address to key used to get it from the account store
func CountSubKeys ¶
CountSubKeys counts the total number of keys for a multi-sig public key.
func DefaultTxDecoder ¶
DefaultTxDecoder logic for standard transaction decoding
func DefaultTxEncoder ¶
DefaultTxEncoder logic for standard transaction encoding
func KeyTestPubAddr ¶
func NewTestMsg ¶
func NewTestMsg(addrs ...sdk.AccAddress) *sdk.TestMsg
func NewTestTxWithMemo ¶
func NewTestTxWithSignBytes ¶
func ProtoBaseAccount ¶
ProtoBaseAccount - a prototype function for BaseAccount
func RegisterCodec ¶
RegisterCodec registers concrete types on the codec
func StdSignBytes ¶
func StdSignBytes(chainID string, accnum uint64, sequence uint64, fee StdFee, msgs []sdk.Msg, memo string) []byte
StdSignBytes returns the bytes to sign for a transaction.
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis performs basic validation of auth genesis data returning an error for any failed validation criteria.
Types ¶
type AccountRetriever ¶
type AccountRetriever struct {
// contains filtered or unexported fields
}
AccountRetriever defines the properties of a type that can be used to retrieve accounts.
func NewAccountRetriever ¶
func NewAccountRetriever(querier NodeQuerier) AccountRetriever
NewAccountRetriever initialises a new AccountRetriever instance.
func (AccountRetriever) EnsureExists ¶
func (ar AccountRetriever) EnsureExists(addr sdk.AccAddress) error
EnsureExists returns an error if no account exists for the given address else nil.
func (AccountRetriever) GetAccount ¶
func (ar AccountRetriever) GetAccount(addr sdk.AccAddress) (exported.Account, error)
GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.
func (AccountRetriever) GetAccountNumberSequence ¶
func (ar AccountRetriever) GetAccountNumberSequence(addr sdk.AccAddress) (uint64, uint64, error)
GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.
func (AccountRetriever) GetAccountWithHeight ¶
func (ar AccountRetriever) GetAccountWithHeight(addr sdk.AccAddress) (exported.Account, int64, error)
GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.
type BaseAccount ¶
type BaseAccount struct { Address sdk.AccAddress `json:"address" yaml:"address"` Coins sdk.Coins `json:"coins" yaml:"coins"` PubKey crypto.PubKey `json:"public_key" yaml:"public_key"` AccountNumber uint64 `json:"account_number" yaml:"account_number"` Sequence uint64 `json:"sequence" yaml:"sequence"` // contract code hash CodeHash []byte }
BaseAccount - a base account structure. This can be extended by embedding within in your AppAccount. However one doesn't have to use BaseAccount as long as your struct implements Account.
func NewBaseAccount ¶
func NewBaseAccount(address sdk.AccAddress, coins sdk.Coins, pubKey crypto.PubKey, accountNumber uint64, sequence uint64) *BaseAccount
NewBaseAccount creates a new BaseAccount object
func NewBaseAccountWithAddress ¶
func NewBaseAccountWithAddress(addr sdk.AccAddress) BaseAccount
NewBaseAccountWithAddress - returns a new base account with a given address
func (*BaseAccount) Balance ¶ added in v1.0.12
func (acc *BaseAccount) Balance() sdk.Int
Balance returns the balance of an account
func (*BaseAccount) GetAccountNumber ¶
func (acc *BaseAccount) GetAccountNumber() uint64
GetAccountNumber - Implements Account
func (BaseAccount) GetAddress ¶
func (acc BaseAccount) GetAddress() sdk.AccAddress
GetAddress - Implements sdk.Account.
func (*BaseAccount) GetCodeHash ¶ added in v1.0.12
func (acc *BaseAccount) GetCodeHash() []byte
GetCodeHash - Implements sdk.Account.
func (*BaseAccount) GetCoins ¶
func (acc *BaseAccount) GetCoins() sdk.Coins
GetCoins - Implements sdk.Account.
func (BaseAccount) GetPubKey ¶
func (acc BaseAccount) GetPubKey() crypto.PubKey
GetPubKey - Implements sdk.Account.
func (*BaseAccount) GetSequence ¶
func (acc *BaseAccount) GetSequence() uint64
GetSequence - Implements sdk.Account.
func (BaseAccount) MarshalYAML ¶
func (acc BaseAccount) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of an account.
func (*BaseAccount) SetAccountNumber ¶
func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error
SetAccountNumber - Implements Account
func (*BaseAccount) SetAddress ¶
func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error
SetAddress - Implements sdk.Account.
func (*BaseAccount) SetBalance ¶ added in v1.0.12
func (acc *BaseAccount) SetBalance(amt sdk.Int)
SetBalance sets an account's balance of native token
func (*BaseAccount) SetCodeHash ¶ added in v1.0.12
func (acc *BaseAccount) SetCodeHash(codeHash []byte)
SetCodeHash - Implements sdk.Account.
func (*BaseAccount) SetCoins ¶
func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
SetCoins - Implements sdk.Account.
func (*BaseAccount) SetPubKey ¶
func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error
SetPubKey - Implements sdk.Account.
func (*BaseAccount) SetSequence ¶
func (acc *BaseAccount) SetSequence(seq uint64) error
SetSequence - Implements sdk.Account.
func (*BaseAccount) SpendableCoins ¶
func (acc *BaseAccount) SpendableCoins(_ time.Time) sdk.Coins
SpendableCoins returns the total set of spendable coins. For a base account, this is simply the base coins.
type BaseVestingAccount ¶
type BaseVestingAccount struct { *BaseAccount OriginalVesting sdk.Coins `json:"original_vesting"` // coins in account upon initialization DelegatedFree sdk.Coins `json:"delegated_free"` // coins that are vested and delegated DelegatedVesting sdk.Coins `json:"delegated_vesting"` // coins that vesting and delegated EndTime int64 `json:"end_time"` // when the coins become unlocked }
BaseVestingAccount implements the VestingAccount interface. It contains all the necessary fields needed for any vesting account implementation.
func NewBaseVestingAccount ¶
func NewBaseVestingAccount(baseAccount *BaseAccount, originalVesting sdk.Coins, delegatedFree sdk.Coins, delegatedVesting sdk.Coins, endTime int64) *BaseVestingAccount
NewBaseVestingAccount creates a new BaseVestingAccount object
func (BaseVestingAccount) GetDelegatedFree ¶
func (bva BaseVestingAccount) GetDelegatedFree() sdk.Coins
GetDelegatedFree returns a vesting account's delegation amount that is not vesting.
func (BaseVestingAccount) GetDelegatedVesting ¶
func (bva BaseVestingAccount) GetDelegatedVesting() sdk.Coins
GetDelegatedVesting returns a vesting account's delegation amount that is still vesting.
func (BaseVestingAccount) GetOriginalVesting ¶
func (bva BaseVestingAccount) GetOriginalVesting() sdk.Coins
GetOriginalVesting returns a vesting account's original vesting amount
func (BaseVestingAccount) String ¶
func (bva BaseVestingAccount) String() string
String implements fmt.Stringer
func (*BaseVestingAccount) TrackUndelegation ¶
func (bva *BaseVestingAccount) TrackUndelegation(amount sdk.Coins)
TrackUndelegation tracks an undelegation amount by setting the necessary values by which delegated vesting and delegated vesting need to decrease and by which amount the base coins need to increase. The resulting base coins are returned.
NOTE: The undelegation (bond refund) amount may exceed the delegated vesting (bond) amount due to the way undelegation truncates the bond refund, which can increase the validator's exchange rate (tokens/shares) slightly if the undelegated tokens are non-integral.
CONTRACT: The account's coins and undelegation coins must be sorted.
type ContinuousVestingAccount ¶
type ContinuousVestingAccount struct { *BaseVestingAccount StartTime int64 `json:"start_time"` // when the coins start to vest }
ContinuousVestingAccount implements the VestingAccount interface. It continuously vests by unlocking coins linearly with respect to time.
func NewContinuousVestingAccount ¶
func NewContinuousVestingAccount( baseAcc *BaseAccount, StartTime, EndTime int64, ) *ContinuousVestingAccount
NewContinuousVestingAccount returns a new ContinuousVestingAccount
func NewContinuousVestingAccountRaw ¶
func NewContinuousVestingAccountRaw(bva *BaseVestingAccount, startTime int64) *ContinuousVestingAccount
NewContinuousVestingAccountRaw creates a new ContinuousVestingAccount object from BaseVestingAccount
func (*ContinuousVestingAccount) GetEndTime ¶
func (cva *ContinuousVestingAccount) GetEndTime() int64
GetEndTime returns the time when vesting ends for a continuous vesting account.
func (*ContinuousVestingAccount) GetStartTime ¶
func (cva *ContinuousVestingAccount) GetStartTime() int64
GetStartTime returns the time when vesting starts for a continuous vesting account.
func (ContinuousVestingAccount) GetVestedCoins ¶
func (cva ContinuousVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
GetVestedCoins returns the total number of vested coins. If no coins are vested, nil is returned.
func (ContinuousVestingAccount) GetVestingCoins ¶
func (cva ContinuousVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
GetVestingCoins returns the total number of vesting coins. If no coins are vesting, nil is returned.
func (ContinuousVestingAccount) SpendableCoins ¶
func (cva ContinuousVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins
SpendableCoins returns the total number of spendable coins per denom for a continuous vesting account.
func (ContinuousVestingAccount) String ¶
func (cva ContinuousVestingAccount) String() string
func (*ContinuousVestingAccount) TrackDelegation ¶
func (cva *ContinuousVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins)
TrackDelegation tracks a desired delegation amount by setting the appropriate values for the amount of delegated vesting, delegated free, and reducing the overall amount of base coins.
type DelayedVestingAccount ¶
type DelayedVestingAccount struct {
*BaseVestingAccount
}
DelayedVestingAccount implements the VestingAccount interface. It vests all coins after a specific time, but non prior. In other words, it keeps them locked until a specified time.
func NewDelayedVestingAccount ¶
func NewDelayedVestingAccount(baseAcc *BaseAccount, EndTime int64) *DelayedVestingAccount
NewDelayedVestingAccount returns a DelayedVestingAccount
func NewDelayedVestingAccountRaw ¶
func NewDelayedVestingAccountRaw(bva *BaseVestingAccount) *DelayedVestingAccount
NewDelayedVestingAccountRaw creates a new DelayedVestingAccount object from BaseVestingAccount
func (*DelayedVestingAccount) GetEndTime ¶
func (dva *DelayedVestingAccount) GetEndTime() int64
GetEndTime returns the time when vesting ends for a delayed vesting account.
func (*DelayedVestingAccount) GetStartTime ¶
func (dva *DelayedVestingAccount) GetStartTime() int64
GetStartTime returns zero since a delayed vesting account has no start time.
func (DelayedVestingAccount) GetVestedCoins ¶
func (dva DelayedVestingAccount) GetVestedCoins(blockTime time.Time) sdk.Coins
GetVestedCoins returns the total amount of vested coins for a delayed vesting account. All coins are only vested once the schedule has elapsed.
func (DelayedVestingAccount) GetVestingCoins ¶
func (dva DelayedVestingAccount) GetVestingCoins(blockTime time.Time) sdk.Coins
GetVestingCoins returns the total number of vesting coins for a delayed vesting account.
func (DelayedVestingAccount) SpendableCoins ¶
func (dva DelayedVestingAccount) SpendableCoins(blockTime time.Time) sdk.Coins
SpendableCoins returns the total number of spendable coins for a delayed vesting account.
func (*DelayedVestingAccount) TrackDelegation ¶
func (dva *DelayedVestingAccount) TrackDelegation(blockTime time.Time, amount sdk.Coins)
TrackDelegation tracks a desired delegation amount by setting the appropriate values for the amount of delegated vesting, delegated free, and reducing the overall amount of base coins.
type GenesisState ¶
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
}
GenesisState - all auth state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState - Return a default genesis state
func NewGenesisState ¶
func NewGenesisState(params Params) GenesisState
NewGenesisState - Create a new genesis state
type NodeQuerier ¶
type NodeQuerier interface { // QueryWithData performs a query to a Tendermint node with the provided path // and a data payload. It returns the result and height of the query upon success // or an error if the query fails. QueryWithData(path string, data []byte) ([]byte, int64, error) }
NodeQuerier is an interface that is satisfied by types that provide the QueryWithData method
type Params ¶
type Params struct { MaxMemoCharacters uint64 `json:"max_memo_characters" yaml:"max_memo_characters"` TxSigLimit uint64 `json:"tx_sig_limit" yaml:"tx_sig_limit"` TxSizeCostPerByte uint64 `json:"tx_size_cost_per_byte" yaml:"tx_size_cost_per_byte"` SigVerifyCostED25519 uint64 `json:"sig_verify_cost_ed25519" yaml:"sig_verify_cost_ed25519"` SigVerifyCostSecp256k1 uint64 `json:"sig_verify_cost_secp256k1" yaml:"sig_verify_cost_secp256k1"` }
Params defines the parameters for the auth module.
func NewParams ¶
func NewParams(maxMemoCharacters, txSigLimit, txSizeCostPerByte, sigVerifyCostED25519, sigVerifyCostSecp256k1 uint64) Params
NewParams creates a new Params object
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() subspace.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint
type QueryAccountParams ¶
type QueryAccountParams struct {
Address sdk.AccAddress
}
QueryAccountParams defines the params for querying accounts.
func NewQueryAccountParams ¶
func NewQueryAccountParams(addr sdk.AccAddress) QueryAccountParams
NewQueryAccountParams creates a new instance of QueryAccountParams.
type StdFee ¶
type StdFee struct { Amount sdk.Coins `json:"amount" yaml:"amount"` Gas uint64 `json:"gas" yaml:"gas"` }
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.
func NewTestStdFee ¶
func NewTestStdFee() StdFee
type StdSignDoc ¶
type StdSignDoc struct { AccountNumber uint64 `json:"account_number" yaml:"account_number"` ChainID string `json:"chain_id" yaml:"chain_id"` Fee json.RawMessage `json:"fee" yaml:"fee"` Memo string `json:"memo" yaml:"memo"` Msgs []json.RawMessage `json:"msgs" yaml:"msgs"` Sequence uint64 `json:"sequence" yaml:"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 StdSignMsg ¶
type StdSignMsg struct { ChainID string `json:"chain_id" yaml:"chain_id"` AccountNumber uint64 `json:"account_number" yaml:"account_number"` Sequence uint64 `json:"sequence" yaml:"sequence"` Fee StdFee `json:"fee" yaml:"fee"` Msgs []sdk.Msg `json:"msgs" yaml:"msgs"` Memo string `json:"memo" yaml:"memo"` }
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" yaml:"pub_key"` // optional Signature []byte `json:"signature" yaml:"signature"` }
StdSignature represents a sig
func MakeSignature ¶
func MakeSignature(keybase crkeys.Keybase, name, passphrase string, msg StdSignMsg) (sig StdSignature, err error)
MakeSignature builds a StdSignature given keybase, key name, passphrase, and a StdSignMsg.
func (StdSignature) MarshalYAML ¶
func (ss StdSignature) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of the signature.
type StdTx ¶
type StdTx struct { Msgs []sdk.Msg `json:"msg" yaml:"msg"` Fee StdFee `json:"fee" yaml:"fee"` Signatures []StdSignature `json:"signatures" yaml:"signatures"` Memo string `json:"memo" yaml:"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) FeePayer ¶ added in v1.0.14
func (tx StdTx) FeePayer() sdk.AccAddress
FeePayer returns the address that is responsible for paying fee StdTx returns the first signer as the fee payer If no signers for tx, return empty address
func (StdTx) GetPubKeys ¶ added in v1.0.14
GetPubkeys returns the pubkeys of signers if the pubkey is included in the signature If pubkey is not included in the signature, then nil is in the slice instead
func (StdTx) GetSignBytes ¶ added in v1.0.14
GetSignBytes returns the signBytes of the tx for a given signer
func (StdTx) GetSignatures ¶
GetSignatures 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 ¶
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.
type SupplyKeeper ¶
type SupplyKeeper interface { SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error GetModuleAccount(ctx sdk.Context, moduleName string) exported.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress }
SupplyKeeper defines the expected supply Keeper (noalias)
type TxBuilder ¶
type TxBuilder struct {
// contains filtered or unexported fields
}
TxBuilder implements a transaction context created in SDK modules.
func NewTxBuilder ¶
func NewTxBuilder( txEncoder sdk.TxEncoder, accNumber, seq, gas uint64, gasAdj float64, simulateAndExecute bool, chainID, memo string, fees sdk.Coins, gasPrices sdk.DecCoins, ) TxBuilder
NewTxBuilder returns a new initialized TxBuilder.
func NewTxBuilderFromCLI ¶
func NewTxBuilderFromCLI() TxBuilder
NewTxBuilderFromCLI returns a new initialized TxBuilder with parameters from the command line using Viper.
func (TxBuilder) AccountNumber ¶
AccountNumber returns the account number
func (TxBuilder) BuildAndSign ¶
BuildAndSign builds a single message to be signed, and signs a transaction with the built message given a name, passphrase, and a set of messages.
func (TxBuilder) BuildSignMsg ¶
func (bldr TxBuilder) BuildSignMsg(msgs []sdk.Msg) (StdSignMsg, error)
BuildSignMsg builds a single message to be signed from a TxBuilder given a set of messages. It returns an error if a fee is supplied but cannot be parsed.
func (TxBuilder) BuildTxForSim ¶
BuildTxForSim creates a StdSignMsg and encodes a transaction with the StdSignMsg with a single empty StdSignature for tx simulation.
func (TxBuilder) GasAdjustment ¶
GasAdjustment returns the gas adjustment
func (TxBuilder) Sign ¶
func (bldr TxBuilder) Sign(name, passphrase string, msg StdSignMsg) ([]byte, error)
Sign signs a transaction given a name, passphrase, and a single message to signed. An error is returned if signing fails.
func (TxBuilder) SignStdTx ¶
func (bldr TxBuilder) SignStdTx(name, passphrase string, stdTx StdTx, appendSig bool) (signedStdTx StdTx, err error)
SignStdTx appends a signature to a StdTx and returns a copy of it. If append is false, it replaces the signatures already attached with the new signature.
func (TxBuilder) SimulateAndExecute ¶
SimulateAndExecute returns the option to simulate and then execute the transaction using the gas from the simulation results
func (TxBuilder) WithAccountNumber ¶
WithAccountNumber returns a copy of the context with an account number.
func (TxBuilder) WithChainID ¶
WithChainID returns a copy of the context with an updated chainID.
func (TxBuilder) WithGasPrices ¶
WithGasPrices returns a copy of the context with updated gas prices.
func (TxBuilder) WithKeybase ¶
WithKeybase returns a copy of the context with updated keybase.
func (TxBuilder) WithSequence ¶
WithSequence returns a copy of the context with an updated sequence number.