Documentation ¶
Index ¶
- func ErrInvalidAccount(addr sdk.AccAddress) error
- func ErrInvalidBaseTx(errMsg string) error
- func ErrVerifyCommit(height int64) error
- type CLIContext
- func (cliCtx CLIContext) BroadcastTx(txBytes []byte) (*ctypes.ResultBroadcastTxCommit, error)
- func (cliCtx CLIContext) BroadcastTxAndAwaitCommit(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
- func (cliCtx CLIContext) BroadcastTxAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
- func (cliCtx CLIContext) BroadcastTxSync(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
- func (cliCtx CLIContext) ConvertCoinToMainUnit(coinsStr string) (coins []string, err error)
- func (cliCtx CLIContext) EnsureAccountExists() error
- func (cliCtx CLIContext) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error
- func (cliCtx CLIContext) GetAccount(address []byte) (account auth.BaseAccount, err error)
- func (cliCtx CLIContext) GetAccountNumber(address []byte) (uint64, error)
- func (cliCtx CLIContext) GetAccountSequence(address []byte) (uint64, error)
- func (cliCtx CLIContext) GetCoinType(coinName string) (sdk.CoinType, error)
- func (cliCtx CLIContext) GetFromAddress() (sdk.AccAddress, error)
- func (cliCtx CLIContext) GetFromName() (string, error)
- func (cliCtx CLIContext) GetLatestHeight() (int64, error)
- func (cliCtx CLIContext) GetNode() (rpcclient.Client, error)
- func (cliCtx CLIContext) NetInfo() (*ctypes.ResultNetInfo, error)
- func (cliCtx CLIContext) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
- func (cliCtx CLIContext) ParseCoin(coinStr string) (sdk.Coin, error)
- func (cliCtx CLIContext) ParseCoins(coinsStr string) (coins sdk.Coins, err error)
- func (ctx CLIContext) PrintOutput(toPrint fmt.Stringer) (err error)
- func (cliCtx CLIContext) Query(path string, data cmn.HexBytes) (res []byte, err error)
- func (cliCtx CLIContext) QueryStore(key cmn.HexBytes, storeName string) (res []byte, err error)
- func (cliCtx CLIContext) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, err error)
- func (cliCtx CLIContext) QueryWithData(path string, data []byte) (res []byte, err error)
- func (cliCtx CLIContext) Verify(height int64) (tmtypes.SignedHeader, error)
- func (ctx CLIContext) WithAccountDecoder(decoder auth.AccountDecoder) CLIContext
- func (ctx CLIContext) WithAccountStore(accountStore string) CLIContext
- func (ctx CLIContext) WithCertifier(verifier tmlite.Verifier) CLIContext
- func (ctx CLIContext) WithClient(client rpcclient.Client) CLIContext
- func (ctx CLIContext) WithCodec(cdc *codec.Codec) CLIContext
- func (ctx CLIContext) WithHeight(height int64) CLIContext
- func (ctx CLIContext) WithLogger(w io.Writer) CLIContext
- func (ctx CLIContext) WithNodeURI(nodeURI string) CLIContext
- func (ctx CLIContext) WithTrustNode(trustNode bool) CLIContext
- func (ctx CLIContext) WithUseLedger(useLedger bool) CLIContext
- type ReadableTag
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 ErrInvalidBaseTx ¶
ErrInvalidBaseTx returns a common error reflecting the failed BaseTx verification result
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
Types ¶
type CLIContext ¶
type CLIContext struct { Codec *codec.Codec AccDecoder auth.AccountDecoder Client rpcclient.Client Logger io.Writer OutputFormat string Height int64 NodeURI string AccountStore string TrustNode bool UseLedger bool Commit bool Async bool JSON bool PrintResponse bool Verifier tmlite.Verifier GenerateOnly bool Indent bool DryRun bool // contains filtered or unexported fields }
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 (cliCtx CLIContext) BroadcastTx(txBytes []byte) (*ctypes.ResultBroadcastTxCommit, 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.7.0
func (cliCtx CLIContext) BroadcastTxAndAwaitCommit(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTxAndAwaitCommit broadcasts transaction bytes to a Tendermint node and waits for a commit.
func (CLIContext) BroadcastTxAsync ¶
func (cliCtx CLIContext) BroadcastTxAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
BroadcastTxAsync broadcasts transaction bytes to a Tendermint node asynchronously.
func (CLIContext) BroadcastTxSync ¶ added in v0.7.0
func (cliCtx CLIContext) BroadcastTxSync(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTxSync broadcasts transaction bytes to a Tendermint node synchronously.
func (CLIContext) ConvertCoinToMainUnit ¶
func (cliCtx CLIContext) ConvertCoinToMainUnit(coinsStr string) (coins []string, err error)
func (CLIContext) EnsureAccountExists ¶
func (cliCtx CLIContext) EnsureAccountExists() error
EnsureAccountExists ensures that an account exists for a given context. An error is returned if it does not.
func (CLIContext) EnsureAccountExistsFromAddr ¶
func (cliCtx 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 ¶
func (cliCtx CLIContext) GetAccount(address []byte) (account auth.BaseAccount, err 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 ¶
func (cliCtx CLIContext) GetAccountNumber(address []byte) (uint64, error)
GetAccountNumber returns the next account number for the given account address.
func (CLIContext) GetAccountSequence ¶
func (cliCtx CLIContext) GetAccountSequence(address []byte) (uint64, error)
GetAccountSequence returns the sequence number for the given account address.
func (CLIContext) GetCoinType ¶
func (cliCtx CLIContext) GetCoinType(coinName string) (sdk.CoinType, error)
func (CLIContext) GetFromAddress ¶
func (cliCtx CLIContext) GetFromAddress() (sdk.AccAddress, error)
GetFromAddress returns the from address from the context's name.
func (CLIContext) GetFromName ¶ added in v0.7.0
func (cliCtx CLIContext) GetFromName() (string, error)
GetFromName returns the key name for the current context.
func (CLIContext) GetLatestHeight ¶ added in v0.10.0
func (cliCtx CLIContext) GetLatestHeight() (int64, error)
func (CLIContext) GetNode ¶
func (cliCtx CLIContext) GetNode() (rpcclient.Client, error)
GetNode returns an RPC client. If the context's client is not defined, an error is returned.
func (CLIContext) NetInfo ¶
func (cliCtx CLIContext) NetInfo() (*ctypes.ResultNetInfo, error)
func (CLIContext) NumUnconfirmedTxs ¶
func (cliCtx CLIContext) NumUnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error)
func (CLIContext) ParseCoins ¶
func (cliCtx CLIContext) ParseCoins(coinsStr string) (coins sdk.Coins, err error)
func (CLIContext) PrintOutput ¶ added in v0.14.0
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 (cliCtx 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 ¶ added in v0.7.0
func (cliCtx CLIContext) QueryWithData(path string, data []byte) (res []byte, err error)
Query information about the connected node with a data payload
func (CLIContext) Verify ¶ added in v0.7.0
func (cliCtx CLIContext) Verify(height int64) (tmtypes.SignedHeader, error)
Verify verifies the consensus proof at given height.
func (CLIContext) WithAccountDecoder ¶
func (ctx CLIContext) WithAccountDecoder(decoder auth.AccountDecoder) CLIContext
WithAccountDecoder returns a copy of the context with an updated account decoder.
func (CLIContext) WithAccountStore ¶
func (ctx CLIContext) WithAccountStore(accountStore string) CLIContext
WithAccountStore returns a copy of the context with an updated AccountStore.
func (CLIContext) WithCertifier ¶
func (ctx CLIContext) WithCertifier(verifier tmlite.Verifier) CLIContext
WithCertifier - return a copy of the context with an updated Certifier
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) WithHeight ¶ added in v0.10.0
func (ctx CLIContext) WithHeight(height int64) CLIContext
WithHeight returns a copy of the context with an updated height.
func (CLIContext) WithLogger ¶
func (ctx CLIContext) WithLogger(w io.Writer) CLIContext
WithLogger returns a copy of the context with an updated logger.
func (CLIContext) WithNodeURI ¶
func (ctx CLIContext) WithNodeURI(nodeURI string) CLIContext
WithNodeURI returns a copy of the context with an updated node URI.
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.