Documentation
¶
Index ¶
- func DeliverTxMarshalIndentJSON(dtx abci.ResponseDeliverTx) ([]byte, error)
- func ErrInvalidAccount(addr sdk.AccAddress) error
- func ErrInvalidBaseTx(errMsg string) error
- func ErrVerifyCommit(height int64) error
- type BaseTx
- type CLIContext
- func (cliCtx CLIContext) BroadcastTx(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
- func (cliCtx CLIContext) BroadcastTxAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
- func (cliCtx CLIContext) Certify(height int64) (lite.Commit, 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) EnsureBroadcastTx(txBytes []byte) error
- func (cliCtx CLIContext) GetAccount(address []byte) (auth.Account, error)
- func (cliCtx CLIContext) GetAccountNumber(address []byte) (int64, error)
- func (cliCtx CLIContext) GetAccountSequence(address []byte) (int64, error)
- func (cliCtx CLIContext) GetCoinType(coinName string) (types.CoinType, error)
- func (cliCtx CLIContext) GetFromAddress() (from sdk.AccAddress, err 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 (cliCtx CLIContext) Query(path string) (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 (ctx CLIContext) WithAccountDecoder(decoder auth.AccountDecoder) CLIContext
- func (ctx CLIContext) WithAccountStore(accountStore string) CLIContext
- func (ctx CLIContext) WithCertifier(certifier tmlite.Certifier) 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
- type TxContext
- func (txCtx TxContext) Build(msgs []sdk.Msg) (auth.StdSignMsg, error)
- func (txCtx TxContext) BuildAndSign(name, passphrase string, msgs []sdk.Msg) ([]byte, error)
- func (txCtx TxContext) Sign(name, passphrase string, msg auth.StdSignMsg) ([]byte, error)
- func (txCtx TxContext) WithAccountNumber(accnum int64) TxContext
- func (txCtx TxContext) WithChainID(chainID string) TxContext
- func (txCtx TxContext) WithCliCtx(cliCtx CLIContext) TxContext
- func (txCtx TxContext) WithCodec(cdc *wire.Codec) TxContext
- func (txCtx TxContext) WithFee(fee string) TxContext
- func (txCtx TxContext) WithGas(gas int64) TxContext
- func (txCtx TxContext) WithMemo(memo string) TxContext
- func (txCtx TxContext) WithSequence(sequence int64) TxContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeliverTxMarshalIndentJSON ¶
func DeliverTxMarshalIndentJSON(dtx abci.ResponseDeliverTx) ([]byte, error)
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 BaseTx ¶
type BaseTx struct {
LocalAccountName string `json:"name"`
Password string `json:"password"`
ChainID string `json:"chain_id"`
AccountNumber int64 `json:"account_number"`
Sequence int64 `json:"sequence"`
Gas int64 `json:"gas"`
Fees string `json:"fee"`
Memo string `json:"memo"`
}
func (BaseTx) Validate ¶
func (baseTx BaseTx) Validate(cliCtx CLIContext) error
type CLIContext ¶
type CLIContext struct {
Codec *wire.Codec
AccDecoder auth.AccountDecoder
Client rpcclient.Client
Logger io.Writer
Height int64
NodeURI string
FromAddressName string
//If GenerateOnly is true and FromAddressName is not specified, the signer is required for building msg
SignerAddr string
AccountStore string
TrustNode bool
UseLedger bool
Async bool
JSON bool
PrintResponse bool
Certifier tmlite.Certifier
GenerateOnly 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 (cliCtx CLIContext) BroadcastTx(tx []byte) (*ctypes.ResultBroadcastTxCommit, error)
BroadcastTx broadcasts transaction bytes to a Tendermint node.
func (CLIContext) BroadcastTxAsync ¶
func (cliCtx CLIContext) BroadcastTxAsync(tx []byte) (*ctypes.ResultBroadcastTx, error)
BroadcastTxAsync broadcasts transaction bytes to a Tendermint node asynchronously.
func (CLIContext) Certify ¶
func (cliCtx CLIContext) Certify(height int64) (lite.Commit, error)
Certify verifies the consensus proof at given height
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) EnsureBroadcastTx ¶
func (cliCtx 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 ¶
func (cliCtx 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 ¶
func (cliCtx CLIContext) GetAccountNumber(address []byte) (int64, error)
GetAccountNumber returns the next account number for the given account address.
func (CLIContext) GetAccountSequence ¶
func (cliCtx CLIContext) GetAccountSequence(address []byte) (int64, error)
GetAccountSequence returns the sequence number for the given account address.
func (CLIContext) GetCoinType ¶
func (cliCtx CLIContext) GetCoinType(coinName string) (types.CoinType, error)
func (CLIContext) GetFromAddress ¶
func (cliCtx CLIContext) GetFromAddress() (from sdk.AccAddress, err error)
GetFromAddress returns the from address from the context's name.
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) Query ¶
func (cliCtx CLIContext) Query(path string) (res []byte, err error)
Query performs a query for information about the connected node.
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) 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(certifier tmlite.Certifier) 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 *wire.Codec) CLIContext
WithCodec returns a copy of the context with an updated codec.
func (CLIContext) WithFromAddressName ¶
func (ctx CLIContext) WithFromAddressName(addrName string) CLIContext
WithFromAddressName returns a copy of the context with an updated from address.
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.
type TxContext ¶
type TxContext struct {
Codec *wire.Codec
AccountNumber int64
Sequence int64
Gas int64
ChainID string
Memo string
Fee string
// contains filtered or unexported fields
}
TxContext implements a transaction context created in SDK modules.
func NewTxContextFromBaseTx ¶
func NewTxContextFromCLI ¶
func NewTxContextFromCLI() TxContext
NewTxContextFromCLI returns a new initialized TxContext with parameters from the command line using Viper.
func (TxContext) Build ¶
Build builds a single message to be signed from a TxContext given a set of messages. It returns an error if a fee is supplied but cannot be parsed.
func (TxContext) BuildAndSign ¶
BuildAndSign builds a single message to be signed, and signs a transaction with the built message given a name, passphrase, and a set of messages.
func (TxContext) Sign ¶
Sign signs a transaction given a name, passphrase, and a single message to signed. An error is returned if signing fails.
func (TxContext) WithAccountNumber ¶
WithAccountNumber returns a copy of the context with an account number.
func (TxContext) WithChainID ¶
WithChainID returns a copy of the context with an updated chainID.
func (TxContext) WithCliCtx ¶
func (txCtx TxContext) WithCliCtx(cliCtx CLIContext) TxContext
WithCliCtx returns a copy of the context with a CLIContext
func (TxContext) WithSequence ¶
WithSequence returns a copy of the context with an updated sequence number.