Documentation ¶
Index ¶
- Constants
- Variables
- func BuildSimTx(info *keyring.Record, txf tx.Factory, msgs ...sdk.Msg) ([]byte, error)
- func DefaultPageRequest() *query.PageRequest
- func GetHeightFromMetadata(md metadata.MD) (int64, error)
- func GetProveFromMetadata(md metadata.MD) (bool, error)
- func NewRPCClient(addr string, timeout time.Duration) (*rpchttp.HTTP, error)
- func SetHeightOnContext(ctx context.Context, height int64) context.Context
- func SetProveOnContext(ctx context.Context, prove bool) context.Context
- type ChainClientConfig
- type Client
- func (cc *Client) BroadcastTx(ctx context.Context, tx []byte) (*sdk.TxResponse, error)
- func (cc *Client) CalculateGas(ctx context.Context, txf tx.Factory, msgs ...sdk.Msg) (txtypes.SimulateResponse, uint64, error)
- func (cc *Client) DecodeBech32AccAddr(addr string) (sdk.AccAddress, error)
- func (cc *Client) DecodeBech32AccPub(addr string) (sdk.AccAddress, error)
- func (cc *Client) DecodeBech32ConsAddr(addr string) (sdk.AccAddress, error)
- func (cc *Client) DecodeBech32ConsPub(addr string) (sdk.AccAddress, error)
- func (cc *Client) DecodeBech32ValAddr(addr string) (sdk.ValAddress, error)
- func (cc *Client) DecodeBech32ValPub(addr string) (sdk.AccAddress, error)
- func (cc *Client) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error)
- func (cc *Client) EncodeBech32AccPub(addr sdk.AccAddress) (string, error)
- func (cc *Client) EncodeBech32ConsAddr(addr sdk.AccAddress) (string, error)
- func (cc *Client) EncodeBech32ConsPub(addr sdk.AccAddress) (string, error)
- func (cc *Client) EncodeBech32ValAddr(addr sdk.ValAddress) (string, error)
- func (cc *Client) EncodeBech32ValPub(addr sdk.AccAddress) (string, error)
- func (cc *Client) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error
- func (cc *Client) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.Account, error)
- func (cc *Client) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)
- func (cc *Client) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)
- func (cc *Client) GetKeyAddress() (addr sdk.AccAddress, err error)
- func (c *Client) GetKeybase() keyring.Keyring
- func (cc *Client) HandleAndPrintMsgSend(res *sdk.TxResponse, err error) error
- func (cc *Client) Invoke(ctx context.Context, method string, req, reply interface{}, ...) (err error)
- func (cc *Client) MarshalProto(res proto.Message) ([]byte, error)
- func (cc *Client) MustEncodeAccAddr(addr sdk.AccAddress) string
- func (cc *Client) MustEncodeValAddr(addr sdk.ValAddress) string
- func (cc *Client) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error)
- func (cc *Client) PrepareFactory(txf tx.Factory) (tx.Factory, error)
- func (cc *Client) PrintObject(res interface{}) error
- func (cc *Client) PrintTxResponse(res *sdk.TxResponse) error
- func (cc *Client) QueryABCI(ctx context.Context, req abci.RequestQuery) (abci.ResponseQuery, error)
- func (cc *Client) QueryAccount(ctx context.Context, address sdk.AccAddress) (authtypes.AccountI, error)
- func (cc *Client) QueryBalanceWithDenomTraces(ctx context.Context, address sdk.AccAddress, pageReq *query.PageRequest) (sdk.Coins, error)
- func (cc *Client) QueryDelegatorValidators(ctx context.Context, address sdk.AccAddress) ([]string, error)
- func (cc *Client) QueryDenomsMetadata(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryDenomsMetadataResponse, error)
- func (cc *Client) QueryDistributionCommission(ctx context.Context, address sdk.ValAddress) (sdk.DecCoins, error)
- func (cc *Client) QueryDistributionCommunityPool(ctx context.Context) (sdk.DecCoins, error)
- func (cc *Client) QueryDistributionParams(ctx context.Context) (*distTypes.Params, error)
- func (cc *Client) QueryDistributionRewards(ctx context.Context, delegatorAddress sdk.AccAddress, ...) (sdk.DecCoins, error)
- func (cc *Client) QueryDistributionSlashes(ctx context.Context, validatorAddress sdk.ValAddress, ...) (*distTypes.QueryValidatorSlashesResponse, error)
- func (cc *Client) QueryDistributionValidatorRewards(ctx context.Context, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)
- func (cc *Client) QueryTotalSupply(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryTotalSupplyResponse, error)
- func (cc *Client) QueryTx(ctx context.Context, hashHex string, prove bool) (*ctypes.ResultTx, error)
- func (cc *Client) QueryTxs(ctx context.Context, page, limit int, events []string) ([]*ctypes.ResultTx, error)
- func (cc *Client) RunGRPCQuery(ctx context.Context, method string, req interface{}, md metadata.MD) (abci.ResponseQuery, metadata.MD, error)
- func (cc *Client) SendMsg(ctx context.Context, msg sdk.Msg, memo string, opts ...SendMsgOption) (*sdk.TxResponse, error)
- func (cc *Client) SendMsgs(ctx context.Context, msgs []sdk.Msg, memo string, opts ...SendMsgOption) (*sdk.TxResponse, error)
- func (cc *Client) SetSDKContext() func()
- func (cc *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error)
- func (cc *Client) TxFactory() tx.Factory
- func (cc *Client) TxServiceBroadcast(ctx context.Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error)
- func (c *Client) UnpackAny(any *types.Any, iface interface{}) error
- type Codec
- type SendMsgOption
Constants ¶
const ( ErrTimeoutAfterWaitingForTxBroadcast _err = "timed out after waiting for tx to get included in the block" ErrUnexpectedNonZeroCode _err = "node returned unexpected code" )
Variables ¶
var ( // Variables used for retries RtyAttNum = uint(5) RtyAtt = retry.Attempts(RtyAttNum) RtyDel = retry.Delay(time.Millisecond * 400) RtyErr = retry.LastErrorOnly(true) )
var ModuleBasics = []module.AppModuleBasic{ auth.AppModuleBasic{}, authz.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, gov.NewAppModuleBasic( []client.ProposalHandler{ paramsclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler, }, ), crisis.AppModuleBasic{}, distribution.AppModuleBasic{}, feegrant.AppModuleBasic{}, mint.AppModuleBasic{}, params.AppModuleBasic{}, slashing.AppModuleBasic{}, staking.AppModuleBasic{}, upgrade.AppModuleBasic{}, transfer.AppModuleBasic{}, ibc.AppModuleBasic{}, }
Functions ¶
func BuildSimTx ¶
BuildSimTx creates an unsigned tx with an empty single signature and returns the encoded transaction or an error if the unsigned transaction cannot be built.
func DefaultPageRequest ¶
func DefaultPageRequest() *query.PageRequest
func SetHeightOnContext ¶
Types ¶
type ChainClientConfig ¶
type ChainClientConfig struct { BlockTimeout string `json:"block-timeout" yaml:"block-timeout"` OutputFormat string `json:"output-format" yaml:"output-format"` KeyDirectory string `json:"key-directory" yaml:"key-directory"` GRPCAddr string `json:"grpc-addr" yaml:"grpc-addr"` AccountPrefix string `json:"account-prefix" yaml:"account-prefix"` KeyringBackend string `json:"keyring-backend" yaml:"keyring-backend"` SignModeStr string `json:"sign-mode" yaml:"sign-mode"` GasPrices string `json:"gas-prices" yaml:"gas-prices"` RPCAddr string `json:"rpc-addr" yaml:"rpc-addr"` ChainID string `json:"chain-id" yaml:"chain-id"` Timeout string `json:"timeout" yaml:"timeout"` Key string `json:"key" yaml:"key"` ExtraCodecs []string `json:"extra-codecs" yaml:"extra-codecs"` Modules []module.AppModuleBasic `json:"-" yaml:"-"` Slip44 int `json:"slip44" yaml:"slip44"` GasAdjustment float64 `json:"gas-adjustment" yaml:"gas-adjustment"` MinGasAmount uint64 `json:"min-gas-amount" yaml:"min-gas-amount"` Debug bool `json:"debug" yaml:"debug"` }
func (*ChainClientConfig) SignMode ¶
func (ccc *ChainClientConfig) SignMode() signing.SignMode
type Client ¶
type Client struct { Codec Codec Keybase keyring.Keyring RPCClient rpcclient.Client LightProvider provtypes.Provider Input io.Reader Output io.Writer Config *ChainClientConfig KeyringOptions []keyring.Option }
func (*Client) BroadcastTx ¶
func (*Client) CalculateGas ¶
func (*Client) DecodeBech32AccAddr ¶
func (cc *Client) DecodeBech32AccAddr(addr string) (sdk.AccAddress, error)
func (*Client) DecodeBech32AccPub ¶
func (cc *Client) DecodeBech32AccPub(addr string) (sdk.AccAddress, error)
func (*Client) DecodeBech32ConsAddr ¶
func (cc *Client) DecodeBech32ConsAddr(addr string) (sdk.AccAddress, error)
func (*Client) DecodeBech32ConsPub ¶
func (cc *Client) DecodeBech32ConsPub(addr string) (sdk.AccAddress, error)
func (*Client) DecodeBech32ValAddr ¶
func (cc *Client) DecodeBech32ValAddr(addr string) (sdk.ValAddress, error)
func (*Client) DecodeBech32ValPub ¶
func (cc *Client) DecodeBech32ValPub(addr string) (sdk.AccAddress, error)
func (*Client) EncodeBech32AccAddr ¶
func (cc *Client) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error)
func (*Client) EncodeBech32AccPub ¶
func (cc *Client) EncodeBech32AccPub(addr sdk.AccAddress) (string, error)
func (*Client) EncodeBech32ConsAddr ¶
func (cc *Client) EncodeBech32ConsAddr(addr sdk.AccAddress) (string, error)
func (*Client) EncodeBech32ConsPub ¶
func (cc *Client) EncodeBech32ConsPub(addr sdk.AccAddress) (string, error)
func (*Client) EncodeBech32ValAddr ¶
func (cc *Client) EncodeBech32ValAddr(addr sdk.ValAddress) (string, error)
func (*Client) EncodeBech32ValPub ¶
func (cc *Client) EncodeBech32ValPub(addr sdk.AccAddress) (string, error)
func (*Client) EnsureExists ¶
EnsureExists returns an error if no account exists for the given address else nil.
func (*Client) GetAccount ¶
GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.
func (*Client) GetAccountNumberSequence ¶
func (cc *Client) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)
GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.
func (*Client) GetAccountWithHeight ¶
func (cc *Client) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)
GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.
func (*Client) GetKeyAddress ¶
func (cc *Client) GetKeyAddress() (addr sdk.AccAddress, err error)
func (*Client) GetKeybase ¶
func (*Client) HandleAndPrintMsgSend ¶
func (cc *Client) HandleAndPrintMsgSend(res *sdk.TxResponse, err error) error
func (*Client) Invoke ¶
func (cc *Client) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)
Invoke implements the grpc ClientConn.Invoke method
func (*Client) MustEncodeAccAddr ¶
func (cc *Client) MustEncodeAccAddr(addr sdk.AccAddress) string
func (*Client) MustEncodeValAddr ¶
func (cc *Client) MustEncodeValAddr(addr sdk.ValAddress) string
func (*Client) NewStream ¶
func (cc *Client) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error)
NewStream implements the grpc ClientConn.NewStream method
func (*Client) PrepareFactory ¶
func (*Client) PrintObject ¶
func (*Client) PrintTxResponse ¶
func (cc *Client) PrintTxResponse(res *sdk.TxResponse) error
TODO: actually do something different here have a couple of levels of verbosity
func (*Client) QueryABCI ¶
func (cc *Client) QueryABCI(ctx context.Context, req abci.RequestQuery) (abci.ResponseQuery, error)
func (*Client) QueryAccount ¶
func (*Client) QueryBalanceWithDenomTraces ¶
func (cc *Client) QueryBalanceWithDenomTraces(ctx context.Context, address sdk.AccAddress, pageReq *query.PageRequest) (sdk.Coins, error)
QueryBalanceWithDenomTraces is a helper function for query balance
func (*Client) QueryDelegatorValidators ¶
func (*Client) QueryDenomsMetadata ¶
func (cc *Client) QueryDenomsMetadata(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryDenomsMetadataResponse, error)
func (*Client) QueryDistributionCommission ¶
func (*Client) QueryDistributionCommunityPool ¶
func (*Client) QueryDistributionParams ¶
func (*Client) QueryDistributionRewards ¶
func (cc *Client) QueryDistributionRewards(ctx context.Context, delegatorAddress sdk.AccAddress, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)
func (*Client) QueryDistributionSlashes ¶
func (cc *Client) QueryDistributionSlashes(ctx context.Context, validatorAddress sdk.ValAddress, startHeight, endHeight uint64, pageReq *query.PageRequest) (*distTypes.QueryValidatorSlashesResponse, error)
QueryDistributionSlashes returns all slashes of a validator, optionally pass the start and end height
func (*Client) QueryDistributionValidatorRewards ¶
func (cc *Client) QueryDistributionValidatorRewards(ctx context.Context, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)
QueryDistributionValidatorRewards returns all the validator distribution rewards from a given height
func (*Client) QueryTotalSupply ¶
func (cc *Client) QueryTotalSupply(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryTotalSupplyResponse, error)
QueryTotalSupply returns the total supply of coins on a chain
func (*Client) QueryTx ¶
func (cc *Client) QueryTx(ctx context.Context, hashHex string, prove bool) (*ctypes.ResultTx, error)
QueryTx takes a hex encoded tx hash and decodes it before attempting to query the tx via the RPCClient.
func (*Client) QueryTxs ¶
func (cc *Client) QueryTxs(ctx context.Context, page, limit int, events []string) ([]*ctypes.ResultTx, error)
QueryTxs returns an array of transactions related to the specified event search criteria.
func (*Client) RunGRPCQuery ¶
func (cc *Client) RunGRPCQuery(ctx context.Context, method string, req interface{}, md metadata.MD) (abci.ResponseQuery, metadata.MD, error)
RunGRPCQuery runs a gRPC query from the clientCtx, given all necessary arguments for the gRPC method, and returns the ABCI response. It is used to factorize code between client (Invoke) and server (RegisterGRPCServer) gRPC handlers.
func (*Client) SendMsg ¶
func (cc *Client) SendMsg(ctx context.Context, msg sdk.Msg, memo string, opts ...SendMsgOption) (*sdk.TxResponse, error)
func (*Client) SendMsgs ¶
func (cc *Client) SendMsgs(ctx context.Context, msgs []sdk.Msg, memo string, opts ...SendMsgOption) (*sdk.TxResponse, error)
SendMsgs wraps the msgs in a StdTx, signs and sends it. An error is returned if there was an issue sending the transaction. A successfully sent, but failed transaction will not return an error. If a transaction is successfully sent, the result of the execution of that transaction will be logged. A boolean indicating if a transaction was successfully sent and executed successfully is returned.
func (*Client) SetSDKContext ¶
func (cc *Client) SetSDKContext() func()
SetSDKConfig sets the SDK config to the proper bech32 prefixes Don't use this unless you know what you're doing. if lens is successful, this can be eliminated TODO: :dagger: :knife: :chainsaw: remove this function
func (*Client) TxServiceBroadcast ¶
func (cc *Client) TxServiceBroadcast(ctx context.Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error)
TxServiceBroadcast is a helper function to broadcast a Tx with the correct gRPC types from the tx service. Calls `clientCtx.BroadcastTx` under the hood.
type Codec ¶
type Codec struct { InterfaceRegistry types.InterfaceRegistry Marshaler codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino }
type SendMsgOption ¶
func WithFeeGranter ¶
func WithFeeGranter(address sdk.AccAddress) SendMsgOption