Documentation ¶
Index ¶
- Constants
- Variables
- func ErrInvalidAccount(addr sdk.AccAddress) error
- func ErrVerifyCommit(height int64) error
- func GetFromFields(from string, home string) (sdk.AccAddress, string, error)
- type Context
- func (ctx Context) BroadcastTx(txBytes []byte) (res sdk.TxResponse, err error)
- func (ctx Context) BroadcastTxAsync(txBytes []byte) (sdk.TxResponse, error)
- func (ctx Context) BroadcastTxCommit(txBytes []byte) (sdk.TxResponse, error)
- func (ctx Context) BroadcastTxSync(txBytes []byte) (sdk.TxResponse, error)
- func (ctx Context) EnsureAccountExists() error
- func (ctx Context) EnsureAccountExistsFromAddr(addr sdk.AccAddress) error
- func (ctx Context) GetFromAddress() sdk.AccAddress
- func (ctx Context) GetFromName() string
- func (ctx Context) GetNode() (rpcclient.Client, error)
- func (ctx *Context) GetVerifier() tmlite.Verifier
- func (ctx *Context) PrintOutput(toPrint fmt.Stringer) (err error)
- func (ctx Context) Query(path string, data cmn.HexBytes) ([]byte, int64, error)
- func (ctx Context) QueryStore(key cmn.HexBytes, storeName string) ([]byte, int64, error)
- func (ctx Context) QuerySubspace(subspace []byte, storeName string) (res []sdk.KVPair, err error)
- func (ctx Context) QueryWithData(path string, data []byte) ([]byte, int64, error)
- func (ctx *Context) Verify(height int64) (tmtypes.SignedHeader, error)
- func (ctx *Context) WithAccountStore(accountStore string) *Context
- func (ctx *Context) WithBroadcastMode(mode string) *Context
- func (ctx *Context) WithClient(client rpcclient.Client) *Context
- func (ctx *Context) WithCodec(cdc *codec.Codec) *Context
- func (ctx *Context) WithFrom(from string) *Context
- func (ctx *Context) WithFromAddress(addr sdk.AccAddress) *Context
- func (ctx *Context) WithFromName(name string) *Context
- func (ctx *Context) WithGenerateOnly(generateOnly bool) *Context
- func (ctx *Context) WithHeight(height int64) *Context
- func (ctx *Context) WithHome(home string) *Context
- func (ctx *Context) WithNodeURI(nodeURI string) *Context
- func (ctx *Context) WithOutput(w io.Writer) *Context
- func (ctx *Context) WithPassphrase(passphrase string) *Context
- func (ctx *Context) WithPrivKey(privKey crypto.PrivKey) *Context
- func (ctx *Context) WithSimulation(simulate bool) *Context
- func (ctx *Context) WithTrustNode(trustNode bool) *Context
- func (ctx *Context) WithUseLedger(useLedger bool) *Context
- func (ctx *Context) WithVerifier(verifier tmlite.Verifier) *Context
- type QueryAccountParams
Constants ¶
const ( BroadcastSync = "sync" BroadcastAsync = "async" BroadcastBlock = "block" AccountStoreKey = "acc" )
Variables ¶
var (
ErrInvalidSigner = errors.New("Invalid signer")
)
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 GetFromFields ¶
GetFromFields returns a from account address and Keybase name given either an address or key name. If genOnly is true, only a valid Bech32 cosmos address is returned.
Types ¶
type Context ¶
type Context struct { Codec *codec.Codec Client rpcclient.Client Keybase cryptokeys.Keybase Output io.Writer OutputFormat string Height int64 NodeURI string From string AccountStore string TrustNode bool UseLedger bool BroadcastMode string PrintResponse bool VerifierHome string Simulate bool GenerateOnly bool FromAddress sdk.AccAddress FromName string Indent bool SkipConfirm bool Home string Passphrase string PrivKey crypto.PrivKey // contains filtered or unexported fields }
Context implements a typical CLI context created in SDK modules for transaction handling and queries.
func NewContext ¶
NewContext returns a new initialized Context
func NewContextWithDelay ¶
func (Context) BroadcastTx ¶
func (ctx Context) 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 (Context) BroadcastTxAsync ¶
func (ctx Context) BroadcastTxAsync(txBytes []byte) (sdk.TxResponse, error)
BroadcastTxAsync broadcasts transaction bytes to a Tendermint node asynchronously (i.e. returns immediately).
func (Context) BroadcastTxCommit ¶
func (ctx Context) BroadcastTxCommit(txBytes []byte) (sdk.TxResponse, error)
BroadcastTxCommit broadcasts transaction bytes to a Tendermint node and waits for a commit.
NOTE: This should ideally not be used as the request may timeout but the tx may still be included in a block. Use BroadcastTxAsync or BroadcastTxSync instead.
func (Context) BroadcastTxSync ¶
func (ctx Context) BroadcastTxSync(txBytes []byte) (sdk.TxResponse, error)
BroadcastTxSync broadcasts transaction bytes to a Tendermint node synchronously (i.e. returns after CheckTx execution).
func (Context) EnsureAccountExists ¶
EnsureAccountExists ensures that an account exists for a given context. An error is returned if it does not.
func (Context) EnsureAccountExistsFromAddr ¶
func (ctx Context) 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 (Context) GetFromAddress ¶
func (ctx Context) GetFromAddress() sdk.AccAddress
GetFromAddress returns the from address from the context's name.
func (Context) GetFromName ¶
GetFromName returns the key name for the current context.
func (Context) GetNode ¶
GetNode returns an RPC client. If the context's client is not defined, an error is returned.
func (*Context) GetVerifier ¶
func (*Context) PrintOutput ¶
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 (Context) QueryStore ¶
QueryStore performs a query from a Tendermint node with the provided key and store name.
func (Context) QuerySubspace ¶
QuerySubspace performs a query from a Tendermint node with the provided store name and subspace.
func (Context) QueryWithData ¶
Query information about the connected node with a data payload
func (*Context) Verify ¶
func (ctx *Context) Verify(height int64) (tmtypes.SignedHeader, error)
Verify verifies the consensus proof at given height.
func (*Context) WithAccountStore ¶
WithAccountStore returns a copy of the context with an updated AccountStore.
func (*Context) WithBroadcastMode ¶
WithBroadcastMode returns a copy of the context with an updated broadcast mode.
func (*Context) WithClient ¶
WithClient returns a copy of the context with an updated RPC client instance.
func (*Context) WithFrom ¶
WithFrom returns a copy of the context with an updated from address or name.
func (*Context) WithFromAddress ¶
func (ctx *Context) WithFromAddress(addr sdk.AccAddress) *Context
WithFromAddress returns a copy of the context with an updated from account address.
func (*Context) WithFromName ¶
WithFromName returns a copy of the context with an updated from account name.
func (*Context) WithGenerateOnly ¶
WithGenerateOnly returns a copy of the context with updated GenerateOnly value
func (*Context) WithHeight ¶
WithHeight returns a copy of the context with an updated height.
func (*Context) WithNodeURI ¶
WithNodeURI returns a copy of the context with an updated node URI.
func (*Context) WithOutput ¶
WithOutput returns a copy of the context with an updated output writer (e.g. stdout).
func (*Context) WithPassphrase ¶
WithPassphrase returns a copy of the context with an passphrase for signing tx.
func (*Context) WithPrivKey ¶
WithPassphrase returns a copy of the context with an private key for signing tx.
func (*Context) WithSimulation ¶
WithSimulation returns a copy of the context with updated Simulate value
func (*Context) WithTrustNode ¶
WithTrustNode returns a copy of the context with an updated TrustNode flag.
func (*Context) WithUseLedger ¶
WithUseLedger returns a copy of the context with an updated UseLedger flag.
type QueryAccountParams ¶
type QueryAccountParams struct {
Address sdk.AccAddress
}