Documentation ¶
Index ¶
- func ErrInvalidAccount(addr sdk.AccAddress) error
- type CLIContext
- func (ctx CLIContext) BroadcastTx(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
- func (ctx CLIContext) BroadcastTxAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
- func (ctx CLIContext) EnsureAccountExists() error
- func (ctx CLIContext) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error
- func (ctx CLIContext) EnsureBroadcastTx(txBytes []byte) error
- func (ctx CLIContext) GetAccount(address []byte) (auth.Account, error)
- func (ctx CLIContext) GetAccountNumber(address []byte) (int64, error)
- func (ctx CLIContext) GetAccountSequence(address []byte) (int64, error)
- func (ctx CLIContext) GetFromAddress() (from sdk.AccAddress, err error)
- func (ctx CLIContext) GetNode() (rpcclient.Client, error)
- func (ctx CLIContext) Query(path string) (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) WithAccountDecoder(decoder auth.AccountDecoder) CLIContext
- func (ctx CLIContext) WithAccountStore(accountStore string) CLIContext
- func (ctx CLIContext) WithClient(client rpcclient.Client) CLIContext
- func (ctx CLIContext) WithCodec(cdc *wire.Codec) CLIContext
- func (ctx CLIContext) WithFromAddressName(addrName string) 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidAccount ¶ added in v0.24.0
func ErrInvalidAccount(addr sdk.AccAddress) error
ErrInvalidAccount returns a standardized error reflecting that a given account address does not exist.
Types ¶
type CLIContext ¶ added in v0.24.0
type CLIContext struct { Codec *wire.Codec AccDecoder auth.AccountDecoder Client rpcclient.Client Logger io.Writer Height int64 NodeURI string FromAddressName string AccountStore string TrustNode bool UseLedger bool Async bool JSON bool PrintResponse bool }
CLIContext implements a typical CLI context created in SDK modules for transaction handling and queries.
func NewCLIContext ¶ added in v0.24.0
func NewCLIContext() CLIContext
NewCLIContext returns a new initialized CLIContext with parameters from the command line using Viper.
func (CLIContext) BroadcastTx ¶ added in v0.24.0
func (ctx CLIContext) BroadcastTx(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTx broadcasts transaction bytes to a Tendermint node.
func (CLIContext) BroadcastTxAsync ¶ added in v0.24.0
func (ctx CLIContext) BroadcastTxAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
BroadcastTxAsync broadcasts transaction bytes to a Tendermint node asynchronously.
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) EnsureBroadcastTx ¶ added in v0.24.0
func (ctx CLIContext) EnsureBroadcastTx(txBytes []byte) error
EnsureBroadcastTx 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) 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) (int64, 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) (int64, error)
GetAccountSequence returns the sequence number for the given account address.
func (CLIContext) GetFromAddress ¶ added in v0.24.0
func (ctx CLIContext) GetFromAddress() (from sdk.AccAddress, err error)
GetFromAddress returns the from address from the context's name.
func (CLIContext) GetNode ¶ added in v0.24.0
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) Query ¶ added in v0.24.0
func (ctx CLIContext) Query(path string) (res []byte, err error)
Query performs a query for information about the connected node.
func (CLIContext) QueryStore ¶ added in v0.24.0
QueryStore performs a query from a Tendermint node with the provided key and store name.
func (CLIContext) QuerySubspace ¶ added in v0.24.0
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) WithAccountDecoder ¶ added in v0.24.0
func (ctx CLIContext) WithAccountDecoder(decoder auth.AccountDecoder) 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 ¶ added in v0.24.0
func (ctx CLIContext) WithClient(client rpcclient.Client) CLIContext
WithClient returns a copy of the context with an updated RPC client instance.
func (CLIContext) WithCodec ¶ added in v0.24.0
func (ctx CLIContext) WithCodec(cdc *wire.Codec) CLIContext
WithCodec returns a copy of the context with an updated codec.
func (CLIContext) WithFromAddressName ¶ added in v0.24.0
func (ctx CLIContext) WithFromAddressName(addrName string) CLIContext
WithFromAddressName returns a copy of the context with an updated from address.
func (CLIContext) WithLogger ¶ added in v0.24.0
func (ctx CLIContext) WithLogger(w io.Writer) CLIContext
WithLogger returns a copy of the context with an updated logger.
func (CLIContext) WithNodeURI ¶ added in v0.24.0
func (ctx CLIContext) WithNodeURI(nodeURI string) CLIContext
WithNodeURI returns a copy of the context with an updated node URI.
func (CLIContext) WithTrustNode ¶ added in v0.24.0
func (ctx CLIContext) WithTrustNode(trustNode bool) CLIContext
WithTrustNode returns a copy of the context with an updated TrustNode flag.
func (CLIContext) WithUseLedger ¶ added in v0.24.0
func (ctx CLIContext) WithUseLedger(useLedger bool) CLIContext
WithUseLedger returns a copy of the context with an updated UseLedger flag.