Documentation ¶
Index ¶
- func ErrInvalidAccount(addr sdk.AccAddress) error
- func ErrVerifyCommit(height int64) error
- func GetAccountDecoder(cdc *codec.Codec) auth.AccountDecoder
- func GetFromFields(from string) (sdk.AccAddress, string, error)
- type CLIContext
- func (ctx CLIContext) BroadcastTx(txBytes []byte) (res sdk.TxResponse, err error)
- func (ctx CLIContext) BroadcastTxAndAwaitCommit(tx []byte) (sdk.TxResponse, error)
- func (ctx CLIContext) BroadcastTxAsync(tx []byte) (sdk.TxResponse, error)
- func (ctx CLIContext) BroadcastTxSync(tx []byte) (sdk.TxResponse, error)
- func (ctx CLIContext) EnsureAccountExists() error
- func (ctx CLIContext) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error
- func (ctx CLIContext) GetAccount(address []byte) (auth.Account, error)
- func (ctx CLIContext) GetAccountNumber(address []byte) (uint64, error)
- func (ctx CLIContext) GetAccountSequence(address []byte) (uint64, error)
- func (ctx CLIContext) GetFromAddress() sdk.AccAddress
- func (ctx CLIContext) GetFromName() string
- func (ctx CLIContext) GetNode() (rpcclient.Client, error)
- func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error)
- func (ctx CLIContext) Query(path string, data cmn.HexBytes) (res []byte, err error)
- func (ctx CLIContext) QueryStore(key cmn.HexBytes, storeName string) (res []byte, err error)
- func (ctx CLIContext) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, err error)
- func (ctx CLIContext) QueryWithData(path string, data []byte) (res []byte, err error)
- func (ctx CLIContext) Verify(height int64) (tmtypes.SignedHeader, error)
- func (ctx CLIContext) WithAccountDecoder(cdc *codec.Codec) CLIContext
- func (ctx CLIContext) WithAccountStore(accountStore string) CLIContext
- func (ctx CLIContext) WithClient(client rpcclient.Client) CLIContext
- func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext
- func (ctx CLIContext) WithFrom(from string) CLIContext
- func (ctx CLIContext) WithFromAddress(addr sdk.AccAddress) CLIContext
- func (ctx CLIContext) WithFromName(name string) CLIContext
- func (ctx CLIContext) WithGenerateOnly(generateOnly bool) CLIContext
- func (ctx CLIContext) WithNodeURI(nodeURI string) CLIContext
- func (ctx CLIContext) WithOutput(w io.Writer) CLIContext
- func (ctx CLIContext) WithSimulation(simulate bool) CLIContext
- func (ctx CLIContext) WithTrustNode(trustNode bool) CLIContext
- func (ctx CLIContext) WithUseLedger(useLedger bool) CLIContext
- func (ctx CLIContext) WithVerifier(verifier tmlite.Verifier) CLIContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidAccount ¶
func ErrInvalidAccount(addr sdk.AccAddress) error
ErrInvalidAccount returns a standardized error reflecting that a given account address does not exist.
func ErrVerifyCommit ¶
ErrVerifyCommit returns a common error reflecting that the blockchain commit at a given height can't be verified. The reason is that the base checkpoint of the certifier is newer than the given height
func GetAccountDecoder ¶ added in v0.27.0
func GetAccountDecoder(cdc *codec.Codec) auth.AccountDecoder
GetAccountDecoder gets the account decoder for auth.DefaultAccount.
func GetFromFields ¶
func GetFromFields(from string) (sdk.AccAddress, string, error)
GetFromFields returns a from account address and Keybase name given either an address or key name.
Types ¶
type CLIContext ¶
type CLIContext struct { Codec *codec.Codec AccDecoder auth.AccountDecoder Client rpcclient.Client Keybase cryptokeys.Keybase Output io.Writer OutputFormat string Height int64 NodeURI string From string AccountStore string TrustNode bool UseLedger bool Async bool PrintResponse bool Verifier tmlite.Verifier VerifierHome string Simulate bool GenerateOnly bool FromAddress sdk.AccAddress FromName string Indent bool SkipConfirm bool }
CLIContext implements a typical CLI context created in SDK modules for transaction handling and queries.
func NewCLIContext ¶
func NewCLIContext() CLIContext
NewCLIContext returns a new initialized CLIContext with parameters from the command line using Viper.
func (CLIContext) BroadcastTx ¶
func (ctx CLIContext) BroadcastTx(txBytes []byte) (res sdk.TxResponse, err error)
BroadcastTx broadcasts a transactions either synchronously or asynchronously based on the context parameters. The result of the broadcast is parsed into an intermediate structure which is logged if the context has a logger defined.
func (CLIContext) BroadcastTxAndAwaitCommit ¶ added in v0.25.0
func (ctx CLIContext) BroadcastTxAndAwaitCommit(tx []byte) (sdk.TxResponse, error)
BroadcastTxAndAwaitCommit broadcasts transaction bytes to a Tendermint node and waits for a commit.
func (CLIContext) BroadcastTxAsync ¶
func (ctx CLIContext) BroadcastTxAsync(tx []byte) (sdk.TxResponse, error)
BroadcastTxAsync broadcasts transaction bytes to a Tendermint node asynchronously.
func (CLIContext) BroadcastTxSync ¶
func (ctx CLIContext) BroadcastTxSync(tx []byte) (sdk.TxResponse, error)
BroadcastTxSync broadcasts transaction bytes to a Tendermint node synchronously.
func (CLIContext) EnsureAccountExists ¶ added in v0.24.0
func (ctx CLIContext) EnsureAccountExists() error
EnsureAccountExists ensures that an account exists for a given context. An error is returned if it does not.
func (CLIContext) EnsureAccountExistsFromAddr ¶ added in v0.24.0
func (ctx CLIContext) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error
EnsureAccountExistsFromAddr ensures that an account exists for a given address. Instead of using the context's from name, a direct address is given. An error is returned if it does not.
func (CLIContext) GetAccount ¶ added in v0.24.0
func (ctx CLIContext) GetAccount(address []byte) (auth.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 (CLIContext) GetAccountNumber ¶ added in v0.24.0
func (ctx CLIContext) GetAccountNumber(address []byte) (uint64, error)
GetAccountNumber returns the next account number for the given account address.
func (CLIContext) GetAccountSequence ¶ added in v0.24.0
func (ctx CLIContext) GetAccountSequence(address []byte) (uint64, error)
GetAccountSequence returns the sequence number for the given account address.
func (CLIContext) GetFromAddress ¶
func (ctx CLIContext) GetFromAddress() sdk.AccAddress
GetFromAddress returns the from address from the context's name.
func (CLIContext) GetFromName ¶
func (ctx CLIContext) GetFromName() string
GetFromName returns the key name for the current context.
func (CLIContext) GetNode ¶
func (ctx CLIContext) GetNode() (rpcclient.Client, error)
GetNode returns an RPC client. If the context's client is not defined, an error is returned.
func (CLIContext) PrintOutput ¶
func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error)
PrintOutput prints output while respecting output and indent flags NOTE: pass in marshalled structs that have been unmarshaled because this function will panic on marshaling errors
func (CLIContext) QueryStore ¶
QueryStore performs a query from a Tendermint node with the provided key and store name.
func (CLIContext) QuerySubspace ¶
func (ctx CLIContext) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, err error)
QuerySubspace performs a query from a Tendermint node with the provided store name and subspace.
func (CLIContext) QueryWithData ¶
func (ctx CLIContext) QueryWithData(path string, data []byte) (res []byte, err error)
Query information about the connected node with a data payload
func (CLIContext) Verify ¶
func (ctx CLIContext) Verify(height int64) (tmtypes.SignedHeader, error)
Verify verifies the consensus proof at given height.
func (CLIContext) WithAccountDecoder ¶ added in v0.24.0
func (ctx CLIContext) WithAccountDecoder(cdc *codec.Codec) CLIContext
WithAccountDecoder returns a copy of the context with an updated account decoder.
func (CLIContext) WithAccountStore ¶ added in v0.24.0
func (ctx CLIContext) WithAccountStore(accountStore string) CLIContext
WithAccountStore returns a copy of the context with an updated AccountStore.
func (CLIContext) WithClient ¶
func (ctx CLIContext) WithClient(client rpcclient.Client) CLIContext
WithClient returns a copy of the context with an updated RPC client instance.
func (CLIContext) WithCodec ¶
func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext
WithCodec returns a copy of the context with an updated codec.
func (CLIContext) WithFrom ¶
func (ctx CLIContext) WithFrom(from string) CLIContext
WithFrom returns a copy of the context with an updated from address or name.
func (CLIContext) WithFromAddress ¶
func (ctx CLIContext) WithFromAddress(addr sdk.AccAddress) CLIContext
WithFromAddress returns a copy of the context with an updated from account address.
func (CLIContext) WithFromName ¶
func (ctx CLIContext) WithFromName(name string) CLIContext
WithFromName returns a copy of the context with an updated from account name.
func (CLIContext) WithGenerateOnly ¶
func (ctx CLIContext) WithGenerateOnly(generateOnly bool) CLIContext
WithGenerateOnly returns a copy of the context with updated GenerateOnly value
func (CLIContext) WithNodeURI ¶
func (ctx CLIContext) WithNodeURI(nodeURI string) CLIContext
WithNodeURI returns a copy of the context with an updated node URI.
func (CLIContext) WithOutput ¶
func (ctx CLIContext) WithOutput(w io.Writer) CLIContext
WithOutput returns a copy of the context with an updated output writer (e.g. stdout).
func (CLIContext) WithSimulation ¶
func (ctx CLIContext) WithSimulation(simulate bool) CLIContext
WithSimulation returns a copy of the context with updated Simulate value
func (CLIContext) WithTrustNode ¶
func (ctx CLIContext) WithTrustNode(trustNode bool) CLIContext
WithTrustNode returns a copy of the context with an updated TrustNode flag.
func (CLIContext) WithUseLedger ¶
func (ctx CLIContext) WithUseLedger(useLedger bool) CLIContext
WithUseLedger returns a copy of the context with an updated UseLedger flag.
func (CLIContext) WithVerifier ¶
func (ctx CLIContext) WithVerifier(verifier tmlite.Verifier) CLIContext
WithVerifier - return a copy of the context with an updated Verifier