Documentation
¶
Index ¶
- func BuildSimTx(txf tx.Factory, msgs ...sdk.Msg) ([]byte, error)
- func CheckTendermintError(err error, tx tmtypes.Tx) *sdk.TxResponse
- func CreateMnemonic() (string, error)
- func DefaultPageRequest() *querytypes.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 ChainClient
- func (cc *ChainClient) AddKey(name string) (output *KeyOutput, err error)
- func (cc *ChainClient) BroadcastTx(ctx context.Context, tx []byte) (res *sdk.TxResponse, err error)
- func (cc *ChainClient) CalculateGas(txf tx.Factory, msgs ...sdk.Msg) (txtypes.SimulateResponse, uint64, error)
- func (cc *ChainClient) CreateKeystore(path string) error
- func (cc *ChainClient) DecodeBech32AccAddr(addr string) (sdk.AccAddress, error)
- func (cc *ChainClient) DecodeBech32AccPub(addr string) (sdk.AccAddress, error)
- func (cc *ChainClient) DecodeBech32ConsAddr(addr string) (sdk.AccAddress, error)
- func (cc *ChainClient) DecodeBech32ConsPub(addr string) (sdk.AccAddress, error)
- func (cc *ChainClient) DecodeBech32ValAddr(addr string) (sdk.AccAddress, error)
- func (cc *ChainClient) DecodeBech32ValPub(addr string) (sdk.AccAddress, error)
- func (cc *ChainClient) DeleteKey(name string) error
- func (cc *ChainClient) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error)
- func (cc *ChainClient) EncodeBech32AccPub(addr sdk.AccAddress) (string, error)
- func (cc *ChainClient) EncodeBech32ConsAddr(addr sdk.AccAddress) (string, error)
- func (cc *ChainClient) EncodeBech32ConsPub(addr sdk.AccAddress) (string, error)
- func (cc *ChainClient) EncodeBech32ValAddr(addr sdk.AccAddress) (string, error)
- func (cc *ChainClient) EncodeBech32ValPub(addr sdk.AccAddress) (string, error)
- func (cc *ChainClient) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error
- func (cc *ChainClient) ExportPrivKeyArmor(keyName string) (armor string, err error)
- func (cc *ChainClient) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.Account, error)
- func (cc *ChainClient) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)
- func (cc *ChainClient) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)
- func (cc *ChainClient) GetKeyAddress() (sdk.AccAddress, error)
- func (cc *ChainClient) Invoke(ctx context.Context, method string, req, reply interface{}, ...) (err error)
- func (cc *ChainClient) KeyAddOrRestore(keyName string, coinType uint32, mnemonic ...string) (*KeyOutput, error)
- func (cc *ChainClient) KeyExists(name string) bool
- func (cc *ChainClient) KeystoreCreated(path string) bool
- func (cc *ChainClient) ListAddresses() (map[string]string, error)
- func (cc *ChainClient) MarshalProto(res proto.Message) ([]byte, error)
- func (cc *ChainClient) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error)
- func (cc *ChainClient) PrepareFactory(txf tx.Factory) (tx.Factory, error)
- func (cc *ChainClient) PrintObject(res interface{}) error
- func (cc *ChainClient) PrintTxResponse(res *sdk.TxResponse) error
- func (cc *ChainClient) QueryABCI(req abci.RequestQuery) (abci.ResponseQuery, error)
- func (cc *ChainClient) QueryAccount(address sdk.AccAddress) (authtypes.AccountI, error)
- func (cc *ChainClient) QueryBalance(address sdk.AccAddress, showDenoms bool) (sdk.Coins, error)
- func (cc *ChainClient) QueryBalanceWithAddress(address sdk.AccAddress, pageReq *query.PageRequest) (sdk.Coins, error)
- func (cc *ChainClient) QueryDelegatorValidators(address sdk.AccAddress) ([]string, error)
- func (cc *ChainClient) QueryDenomTraces(pageReq *querytypes.PageRequest, height int64) (*transfertypes.QueryDenomTracesResponse, error)
- func (cc *ChainClient) QueryDistributionCommission(address string) (*distTypes.ValidatorAccumulatedCommission, error)
- func (cc *ChainClient) QueryDistributionCommunityPool() (sdk.DecCoins, error)
- func (cc *ChainClient) QueryDistributionParams() (*distTypes.Params, error)
- func (cc *ChainClient) QueryDistributionRewards(delegatorAddress string, validatorAddress string) (sdk.DecCoins, error)
- func (cc *ChainClient) QueryDistributionSlashes(validatorAddress string, startHeight, endHeight uint64, ...) ([]distTypes.ValidatorSlashEvent, error)
- func (cc *ChainClient) QueryDistributionValidatorRewards(validatorAddress string) (*distTypes.ValidatorOutstandingRewards, error)
- func (cc *ChainClient) QueryLatestHeight() (int64, error)
- func (cc *ChainClient) RestoreKey(name, mnemonic string) (address string, err error)
- func (cc *ChainClient) RunGRPCQuery(ctx context.Context, method string, req interface{}, md metadata.MD) (abci.ResponseQuery, metadata.MD, error)
- func (cc *ChainClient) SendMsg(ctx context.Context, msg sdk.Msg) (*sdk.TxResponse, bool, error)
- func (cc *ChainClient) SendMsgs(ctx context.Context, msgs []sdk.Msg) (*sdk.TxResponse, bool, error)
- func (cc *ChainClient) SetSDKContext() func()
- func (cc *ChainClient) ShowAddress(name string) (address string, err error)
- func (cc *ChainClient) TxFactory() tx.Factory
- func (cc *ChainClient) TxServiceBroadcast(ctx context.Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error)
- type ChainClientConfig
- type Codec
- type KeyOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 CheckTendermintError ¶
func CheckTendermintError(err error, tx tmtypes.Tx) *sdk.TxResponse
CheckTendermintError checks if the error returned from BroadcastTx is a Tendermint error that is returned before the tx is submitted due to precondition checks that failed. If an Tendermint error is detected, this function returns the correct code back in TxResponse.
TODO: Avoid brittle string matching in favor of error matching. This requires a change to Tendermint's RPCError type to allow retrieval or matching against a concrete error type.
func DefaultPageRequest ¶
func DefaultPageRequest() *querytypes.PageRequest
func SetHeightOnContext ¶
Types ¶
type ChainClient ¶
type ChainClient struct { Config *ChainClientConfig Keybase keyring.Keyring KeyringOptions []keyring.Option RPCClient rpcclient.Client LightProvider provtypes.Provider Input io.Reader Output io.Writer Codec Codec Logger log.Logger }
func GetTestClient ¶
func GetTestClient() *ChainClient
func NewChainClient ¶
func NewChainClient(ccc *ChainClientConfig, input io.Reader, output io.Writer, kro ...keyring.Option) (*ChainClient, error)
func (*ChainClient) AddKey ¶
func (cc *ChainClient) AddKey(name string) (output *KeyOutput, err error)
func (*ChainClient) BroadcastTx ¶
func (cc *ChainClient) BroadcastTx(ctx context.Context, tx []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 (*ChainClient) CalculateGas ¶
func (cc *ChainClient) CalculateGas(txf tx.Factory, msgs ...sdk.Msg) (txtypes.SimulateResponse, uint64, error)
func (*ChainClient) CreateKeystore ¶
func (cc *ChainClient) CreateKeystore(path string) error
func (*ChainClient) DecodeBech32AccAddr ¶
func (cc *ChainClient) DecodeBech32AccAddr(addr string) (sdk.AccAddress, error)
func (*ChainClient) DecodeBech32AccPub ¶
func (cc *ChainClient) DecodeBech32AccPub(addr string) (sdk.AccAddress, error)
func (*ChainClient) DecodeBech32ConsAddr ¶
func (cc *ChainClient) DecodeBech32ConsAddr(addr string) (sdk.AccAddress, error)
func (*ChainClient) DecodeBech32ConsPub ¶
func (cc *ChainClient) DecodeBech32ConsPub(addr string) (sdk.AccAddress, error)
func (*ChainClient) DecodeBech32ValAddr ¶
func (cc *ChainClient) DecodeBech32ValAddr(addr string) (sdk.AccAddress, error)
func (*ChainClient) DecodeBech32ValPub ¶
func (cc *ChainClient) DecodeBech32ValPub(addr string) (sdk.AccAddress, error)
func (*ChainClient) DeleteKey ¶
func (cc *ChainClient) DeleteKey(name string) error
func (*ChainClient) EncodeBech32AccAddr ¶
func (cc *ChainClient) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error)
func (*ChainClient) EncodeBech32AccPub ¶
func (cc *ChainClient) EncodeBech32AccPub(addr sdk.AccAddress) (string, error)
func (*ChainClient) EncodeBech32ConsAddr ¶
func (cc *ChainClient) EncodeBech32ConsAddr(addr sdk.AccAddress) (string, error)
func (*ChainClient) EncodeBech32ConsPub ¶
func (cc *ChainClient) EncodeBech32ConsPub(addr sdk.AccAddress) (string, error)
func (*ChainClient) EncodeBech32ValAddr ¶
func (cc *ChainClient) EncodeBech32ValAddr(addr sdk.AccAddress) (string, error)
func (*ChainClient) EncodeBech32ValPub ¶
func (cc *ChainClient) EncodeBech32ValPub(addr sdk.AccAddress) (string, error)
func (*ChainClient) EnsureExists ¶
func (cc *ChainClient) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error
EnsureExists returns an error if no account exists for the given address else nil.
func (*ChainClient) ExportPrivKeyArmor ¶
func (cc *ChainClient) ExportPrivKeyArmor(keyName string) (armor string, err error)
func (*ChainClient) GetAccount ¶
func (cc *ChainClient) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.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 (*ChainClient) GetAccountNumberSequence ¶
func (cc *ChainClient) 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 (*ChainClient) GetAccountWithHeight ¶
func (cc *ChainClient) 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 (*ChainClient) GetKeyAddress ¶
func (cc *ChainClient) GetKeyAddress() (sdk.AccAddress, error)
func (*ChainClient) Invoke ¶
func (cc *ChainClient) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)
Invoke implements the grpc ClientConn.Invoke method
func (*ChainClient) KeyAddOrRestore ¶
func (*ChainClient) KeyExists ¶
func (cc *ChainClient) KeyExists(name string) bool
func (*ChainClient) KeystoreCreated ¶
func (cc *ChainClient) KeystoreCreated(path string) bool
func (*ChainClient) ListAddresses ¶
func (cc *ChainClient) ListAddresses() (map[string]string, error)
func (*ChainClient) MarshalProto ¶
func (cc *ChainClient) MarshalProto(res proto.Message) ([]byte, error)
func (*ChainClient) NewStream ¶
func (cc *ChainClient) NewStream(context.Context, *grpc.StreamDesc, string, ...grpc.CallOption) (grpc.ClientStream, error)
NewStream implements the grpc ClientConn.NewStream method
func (*ChainClient) PrepareFactory ¶
func (*ChainClient) PrintObject ¶
func (cc *ChainClient) PrintObject(res interface{}) error
func (*ChainClient) PrintTxResponse ¶
func (cc *ChainClient) PrintTxResponse(res *sdk.TxResponse) error
TODO: actually do something different here have a couple of levels of verbosity
func (*ChainClient) QueryABCI ¶
func (cc *ChainClient) QueryABCI(req abci.RequestQuery) (abci.ResponseQuery, error)
func (*ChainClient) QueryAccount ¶
func (cc *ChainClient) QueryAccount(address sdk.AccAddress) (authtypes.AccountI, error)
func (*ChainClient) QueryBalance ¶
func (cc *ChainClient) QueryBalance(address sdk.AccAddress, showDenoms bool) (sdk.Coins, error)
QueryBalance is a helper function for query balance
func (*ChainClient) QueryBalanceWithAddress ¶
func (cc *ChainClient) QueryBalanceWithAddress(address sdk.AccAddress, pageReq *query.PageRequest) (sdk.Coins, error)
QueryBalanceWithAddress returns the amount of coins in the relayer account with address as input
func (*ChainClient) QueryDelegatorValidators ¶
func (cc *ChainClient) QueryDelegatorValidators(address sdk.AccAddress) ([]string, error)
func (*ChainClient) QueryDenomTraces ¶
func (cc *ChainClient) QueryDenomTraces(pageReq *querytypes.PageRequest, height int64) (*transfertypes.QueryDenomTracesResponse, error)
QueryDenomTraces returns all the denom traces from a given chain
func (*ChainClient) QueryDistributionCommission ¶
func (cc *ChainClient) QueryDistributionCommission(address string) (*distTypes.ValidatorAccumulatedCommission, error)
func (*ChainClient) QueryDistributionCommunityPool ¶
func (cc *ChainClient) QueryDistributionCommunityPool() (sdk.DecCoins, error)
func (*ChainClient) QueryDistributionParams ¶
func (cc *ChainClient) QueryDistributionParams() (*distTypes.Params, error)
func (*ChainClient) QueryDistributionRewards ¶
func (*ChainClient) QueryDistributionSlashes ¶
func (cc *ChainClient) QueryDistributionSlashes(validatorAddress string, startHeight, endHeight uint64, pageReq *querytypes.PageRequest) ([]distTypes.ValidatorSlashEvent, error)
func (*ChainClient) QueryDistributionValidatorRewards ¶
func (cc *ChainClient) QueryDistributionValidatorRewards(validatorAddress string) (*distTypes.ValidatorOutstandingRewards, error)
func (*ChainClient) QueryLatestHeight ¶
func (cc *ChainClient) QueryLatestHeight() (int64, error)
func (*ChainClient) RestoreKey ¶
func (cc *ChainClient) RestoreKey(name, mnemonic string) (address string, err error)
func (*ChainClient) RunGRPCQuery ¶
func (cc *ChainClient) 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 (*ChainClient) SendMsg ¶
func (cc *ChainClient) SendMsg(ctx context.Context, msg sdk.Msg) (*sdk.TxResponse, bool, error)
func (*ChainClient) SendMsgs ¶
func (cc *ChainClient) SendMsgs(ctx context.Context, msgs []sdk.Msg) (*sdk.TxResponse, bool, 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 (*ChainClient) SetSDKContext ¶
func (cc *ChainClient) 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 (*ChainClient) ShowAddress ¶
func (cc *ChainClient) ShowAddress(name string) (address string, err error)
func (*ChainClient) TxFactory ¶
func (cc *ChainClient) TxFactory() tx.Factory
func (*ChainClient) TxServiceBroadcast ¶
func (cc *ChainClient) 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 ChainClientConfig ¶
type ChainClientConfig struct { Key string `json:"key" yaml:"key"` ChainID string `json:"chain-id" yaml:"chain-id"` RPCAddr string `json:"rpc-addr" yaml:"rpc-addr"` GRPCAddr string `json:"grpc-addr" yaml:"grpc-addr"` AccountPrefix string `json:"account-prefix" yaml:"account-prefix"` KeyringBackend string `json:"keyring-backend" yaml:"keyring-backend"` GasAdjustment float64 `json:"gas-adjustment" yaml:"gas-adjustment"` GasPrices string `json:"gas-prices" yaml:"gas-prices"` KeyDirectory string `json:"key-directory" yaml:"key-directory"` Debug bool `json:"debug" yaml:"debug"` Timeout string `json:"timeout" yaml:"timeout"` OutputFormat string `json:"output-format" yaml:"output-format"` SignModeStr string `json:"sign-mode" yaml:"sign-mode"` Modules []module.AppModuleBasic `json:"-" yaml:"-"` }
func GetCosmosHubConfig ¶
func GetCosmosHubConfig(keyHome string, debug bool) *ChainClientConfig
func GetOsmosisConfig ¶
func GetOsmosisConfig(keyHome string, debug bool) *ChainClientConfig
func (*ChainClientConfig) SignMode ¶
func (ccc *ChainClientConfig) SignMode() signing.SignMode
func (*ChainClientConfig) Validate ¶
func (ccc *ChainClientConfig) Validate() error
type Codec ¶
type Codec struct { InterfaceRegistry types.InterfaceRegistry Marshaler codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino }
func MakeCodec ¶
func MakeCodec(moduleBasics []module.AppModuleBasic) Codec
func MakeCodecConfig ¶
func MakeCodecConfig() Codec