Documentation ¶
Overview ¶
nolint noalias
Index ¶
- Constants
- Variables
- func AddressStoreKey(addr sdk.Address) []byte
- func CountSubKeys(pub crypto.PubKey) int
- func DefaultTxDecoder(cdc *codec.Codec) sdk.TxDecoder
- func DefaultTxEncoder(cdc *codec.Codec) sdk.TxEncoder
- func NewTestTx(ctx sdk.Ctx, msgs []sdk.Msg, privs []crypto.PrivateKey, entropy int64, ...) sdk.Tx
- func ParamKeyTable() sdk.KeyTable
- func ProtoBaseAccount() exported.Account
- func RegisterCodec(cdc *codec.Codec)
- func StdSignBytes(chainID string, entropy int64, fee sdk.Coins, msgs []sdk.Msg, memo string) []byte
- func ValidateGenesis(data GenesisState) error
- type AccountRetriever
- type Accounts
- type BaseAccount
- func (acc BaseAccount) GetAddress() sdk.Address
- func (acc *BaseAccount) GetCoins() sdk.Coins
- func (acc BaseAccount) GetPubKey() crypto.PublicKey
- func (acc BaseAccount) MarshalYAML() (interface{}, error)
- func (acc *BaseAccount) SetAddress(addr sdk.Address) error
- func (acc *BaseAccount) SetCoins(coins sdk.Coins) error
- func (acc *BaseAccount) SetPubKey(pubKey crypto.PublicKey) error
- func (acc *BaseAccount) SpendableCoins(_ time.Time) sdk.Coins
- func (acc BaseAccount) String() string
- type GenesisState
- type MultiSigAccount
- func (m MultiSigAccount) GetAddress() sdk.Address
- func (m MultiSigAccount) GetCoins() sdk.Coins
- func (m MultiSigAccount) GetMultiPubKey() crypto.PublicKeyMultiSig
- func (m MultiSigAccount) GetPubKey() crypto.PublicKey
- func (m *MultiSigAccount) SetAddress(_ sdk.Address) error
- func (m *MultiSigAccount) SetCoins(c sdk.Coins) error
- func (m MultiSigAccount) SetPubKey(pk crypto.PublicKey) error
- func (m MultiSigAccount) SpendableCoins(blockTime time.Time) sdk.Coins
- func (m MultiSigAccount) String() string
- type NodeQuerier
- type Params
- type QueryAccountParams
- type StdSignDoc
- type StdSignature
- type StdTx
- type SupplyKeeper
- type TxBuilder
- func (bldr TxBuilder) BuildAndSign(address sdk.Address, privateKey crypto.PrivateKey, msgs []sdk.Msg) ([]byte, error)
- func (bldr TxBuilder) BuildAndSignMultisigTransaction(address sdk.Address, publicKey crypto.PublicKeyMultiSig, m sdk.Msg, ...) (signedTx []byte, err error)
- func (bldr TxBuilder) BuildAndSignWithKeyBase(address sdk.Address, passphrase string, msgs []sdk.Msg) ([]byte, error)
- func (bldr TxBuilder) ChainID() string
- func (bldr TxBuilder) Fees() sdk.Coins
- func (bldr TxBuilder) Keybase() crkeys.Keybase
- func (bldr TxBuilder) Memo() string
- func (bldr TxBuilder) SignMultisigTransaction(address sdk.Address, keys []crypto.PublicKey, passphrase string, ...) (signedTx []byte, err error)
- func (bldr TxBuilder) TxDecoder() sdk.TxDecoder
- func (bldr TxBuilder) TxEncoder() sdk.TxEncoder
- func (bldr TxBuilder) WithChainID(chainID string) TxBuilder
- func (bldr TxBuilder) WithFees(fees string) TxBuilder
- func (bldr TxBuilder) WithKeybase(keybase crkeys.Keybase) TxBuilder
- func (bldr TxBuilder) WithMemo(memo string) 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 )
const ( DefaultMaxMemoCharacters uint64 = 256 DefaultTxSigLimit uint64 = 7 DefaultTxSizeCostPerByte uint64 = 10 )
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 ( KeyMaxMemoCharacters = []byte("MaxMemoCharacters") KeyTxSigLimit = []byte("TxSigLimit") KeyTxSizeCostPerByte = []byte("TxSizeCostPerByte") )
Parameter keys
var ( // AddressStoreKeyPrefix prefix for account-by-address store AddressStoreKeyPrefix = []byte{0x01} )
var ModuleCdc *codec.Codec
module wide codec
Functions ¶
func AddressStoreKey ¶
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 ProtoBaseAccount ¶
ProtoBaseAccount - a prototype function for BaseAccount
func RegisterCodec ¶
RegisterCodec registers concrete types on the codec
func StdSignBytes ¶
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.Address) error
EnsureExists returns an error if no account exists for the given address else nil.
func (AccountRetriever) GetAccount ¶
GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.
func (AccountRetriever) GetAccountWithHeight ¶
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.Address `json:"address" yaml:"address"` Coins sdk.Coins `json:"coins" yaml:"coins"` PubKey crypto.PublicKey `json:"public_key" yaml:"public_key"` }
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 ¶
NewBaseAccount creates a new BaseAccount object
func NewBaseAccountWithAddress ¶
func NewBaseAccountWithAddress(addr sdk.Address) BaseAccount
NewBaseAccountWithAddress - returns a new base account with a given address
func (BaseAccount) GetAddress ¶
func (acc BaseAccount) GetAddress() sdk.Address
GetAddress - Implements sdk.Account.
func (*BaseAccount) GetCoins ¶
func (acc *BaseAccount) GetCoins() sdk.Coins
GetCoins - Implements sdk.Account.
func (BaseAccount) GetPubKey ¶
func (acc BaseAccount) GetPubKey() crypto.PublicKey
GetPubKey - Implements sdk.Account.
func (BaseAccount) MarshalYAML ¶
func (acc BaseAccount) MarshalYAML() (interface{}, error)
MarshalYAML returns the YAML representation of an account.
func (*BaseAccount) SetAddress ¶
func (acc *BaseAccount) SetAddress(addr sdk.Address) error
SetAddress - 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.PublicKey) error
SetPubKey - 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 GenesisState ¶
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, accounts Accounts) GenesisState
NewGenesisState - Create a new genesis state
type MultiSigAccount ¶
type MultiSigAccount struct { Address sdk.Address `json:"address"` PublicKey crypto.PublicKeyMultiSig `json:"public_key_multi_sig"` Coins sdk.Coins `json:"coins"` }
func NewMultiSigAccount ¶
func NewMultiSigAccount(publicKey crypto.PublicKeyMultiSig, coins sdk.Coins) *MultiSigAccount
func (MultiSigAccount) GetAddress ¶
func (m MultiSigAccount) GetAddress() sdk.Address
func (MultiSigAccount) GetCoins ¶
func (m MultiSigAccount) GetCoins() sdk.Coins
func (MultiSigAccount) GetMultiPubKey ¶
func (m MultiSigAccount) GetMultiPubKey() crypto.PublicKeyMultiSig
func (MultiSigAccount) GetPubKey ¶
func (m MultiSigAccount) GetPubKey() crypto.PublicKey
func (*MultiSigAccount) SetAddress ¶
func (m *MultiSigAccount) SetAddress(_ sdk.Address) error
func (MultiSigAccount) SpendableCoins ¶
func (m MultiSigAccount) SpendableCoins(blockTime time.Time) sdk.Coins
func (MultiSigAccount) String ¶
func (m MultiSigAccount) String() string
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"` }
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() sdk.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint
type QueryAccountParams ¶
QueryAccountParams defines the params for querying accounts.
func NewQueryAccountParams ¶
func NewQueryAccountParams(addr sdk.Address) QueryAccountParams
NewQueryAccountParams creates a new instance of QueryAccountParams.
type StdSignDoc ¶
type StdSignDoc struct { 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"` Entropy int64 `json:"entropy" yaml:"entropy"` }
StdSignDoc is replay-prevention structure. It includes the result of msg.GetSignBytes(), as well as the ChainID (prevent cross chain replay) and the Entropy numbers for each signature (prevent inchain replay and enforce tx ordering per account).
type StdSignature ¶
type StdSignature struct { posCrypto.PublicKey `json:"pub_key" yaml:"pub_key"` // optional Signature []byte `json:"signature" yaml:"signature"` }
StdSignature represents a sig
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 sdk.Coins `json:"fee" yaml:"fee"` Signatures []StdSignature `json:"signatures" yaml:"signatures"` Memo string `json:"memo" yaml:"memo"` Entropy int64 `json:"entropy" yaml:"entropy"` }
StdTx is a standard way to wrap a Msg with Fee and Sigs. NOTE: the first signature is the fee payer (Sigs must not be nil).
func (StdTx) GetSignatures ¶
func (tx StdTx) GetSignatures() []StdSignature
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 ¶
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.Ctx, senderAddr sdk.Address, recipientModule string, amt sdk.Coins) sdk.Error GetModuleAccount(ctx sdk.Ctx, moduleName string) exported.ModuleAccountI GetModuleAddress(moduleName string) sdk.Address }
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, txDecoder sdk.TxDecoder, chainID, memo string, fees sdk.Coins) TxBuilder
NewTxBuilder returns a new initialized TxBuilder.
func (TxBuilder) BuildAndSign ¶
func (bldr TxBuilder) BuildAndSign(address sdk.Address, privateKey crypto.PrivateKey, msgs []sdk.Msg) ([]byte, error)
BuildAndSign builds a single message to be signed, and signs a transaction with the built message given a address, private key, and a set of messages.
func (TxBuilder) BuildAndSignMultisigTransaction ¶
func (TxBuilder) BuildAndSignWithKeyBase ¶
func (bldr TxBuilder) BuildAndSignWithKeyBase(address sdk.Address, passphrase string, msgs []sdk.Msg) ([]byte, error)
BuildAndSignWithKeyBase builds a single message to be signed, and signs a transaction with the built message given a address, passphrase, and a set of messages.
func (TxBuilder) SignMultisigTransaction ¶
func (TxBuilder) WithChainID ¶
WithChainID returns a copy of the context with an updated chainID.
func (TxBuilder) WithKeybase ¶
WithKeybase returns a copy of the context with updated keybase.