client

package
v1.12.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 63 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMsgs = errors.New("no tx msgs")
View Source
var ErrNoTxIncludeWithdraw = fmt.Errorf("no tx include withdraw")

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

cosmos client

func NewClient

func NewClient(k keyring.Keyring, fromName, gasPrice, accountPrefix string, endPointList []string, logger log.Logger) (*Client, error)

func (*Client) AssembleMultiSigTx

func (c *Client) AssembleMultiSigTx(rawTx []byte, signatures [][]byte, threshold uint32) (txHash, txBts []byte, err error)

assemble multiSig tx bytes for broadcast

func (*Client) BroadcastTx

func (c *Client) BroadcastTx(tx []byte) (string, error)

func (*Client) CalculateGas added in v1.0.1

func (c *Client) CalculateGas(txf clientTx.Factory, msgs ...types.Msg) (uint64, error)

func (*Client) ChangeEndpoint added in v1.0.0

func (c *Client) ChangeEndpoint()

func (*Client) ConstructAndSignTx

func (c *Client) ConstructAndSignTx(msgs ...types.Msg) ([]byte, error)

func (*Client) Ctx

func (c *Client) Ctx() client.Context

func (*Client) CurrentEndpointIndex added in v1.8.8

func (c *Client) CurrentEndpointIndex() int

func (*Client) GenBatchTransferMsg added in v1.6.0

func (c *Client) GenBatchTransferMsg(poolAddr types.AccAddress, outs []xBankTypes.Output) (types.Msg, error)

only support one type coin

func (*Client) GenDelegateMsgs added in v1.6.0

func (c *Client) GenDelegateMsgs(delAddr types.AccAddress, valAddrs []types.ValAddress, totalAmount types.Coin) ([]types.Msg, error)

generate unsigned delegate tx

func (*Client) GenMultiSigRawBatchTransferTx

func (c *Client) GenMultiSigRawBatchTransferTx(poolAddr types.AccAddress, outs []xBankTypes.Output) ([]byte, error)

only support one type coin

func (*Client) GenMultiSigRawBatchTransferTxWithMemo added in v1.4.0

func (c *Client) GenMultiSigRawBatchTransferTxWithMemo(poolAddr types.AccAddress, outs []xBankTypes.Output, memo string) ([]byte, error)

only support one type coin

func (*Client) GenMultiSigRawDeleRewardTxWithRewardsWithMemo added in v1.4.0

func (c *Client) GenMultiSigRawDeleRewardTxWithRewardsWithMemo(delAddr types.AccAddress, height int64, rewards map[string]types.Coin, memo string) ([]byte, error)

generate unsigned delegate reward tx

func (*Client) GenMultiSigRawDelegateTx

func (c *Client) GenMultiSigRawDelegateTx(delAddr types.AccAddress, valAddrs []types.ValAddress, amount types.Coin) ([]byte, error)

generate unsigned delegate tx

func (*Client) GenMultiSigRawDelegateTxWithMemo added in v1.4.0

func (c *Client) GenMultiSigRawDelegateTxWithMemo(delAddr types.AccAddress, valAddrs []types.ValAddress, amount types.Coin, memo string) ([]byte, error)

generate unsigned delegate tx

func (*Client) GenMultiSigRawReDelegateTxWithMemo added in v1.5.0

func (c *Client) GenMultiSigRawReDelegateTxWithMemo(delAddr types.AccAddress, valSrcAddr, valDstAddr types.ValAddress, amount types.Coin, memo string) ([]byte, error)

generate unsigned reDelegate tx

func (*Client) GenMultiSigRawReDelegateTxWithMultiSrc added in v1.5.0

func (c *Client) GenMultiSigRawReDelegateTxWithMultiSrc(delAddr types.AccAddress, valSrcAddrs map[string]types.Coin, valDstAddr types.ValAddress) ([]byte, error)

generate unsigned reDelegate tx

func (*Client) GenMultiSigRawTransferTx

func (c *Client) GenMultiSigRawTransferTx(toAddr types.AccAddress, amount types.Coins) ([]byte, error)

c.clientCtx.FromAddress must be multi sig address

func (*Client) GenMultiSigRawTx

func (c *Client) GenMultiSigRawTx(msgs ...types.Msg) ([]byte, error)

c.clientCtx.FromAddress must be multi sig address,no need sequence

func (*Client) GenMultiSigRawTxWithMemo added in v1.4.0

func (c *Client) GenMultiSigRawTxWithMemo(memo string, msgs ...types.Msg) ([]byte, error)

c.clientCtx.FromAddress must be multi sig address,no need sequence

func (*Client) GenMultiSigRawUnDelegateTx

func (c *Client) GenMultiSigRawUnDelegateTx(delAddr types.AccAddress, valAddrs []types.ValAddress,
	amounts map[string]types.Int) ([]byte, error)

generate unsigned unDelegate tx

func (*Client) GenMultiSigRawUnDelegateWithdrawTxWithMemo added in v1.4.0

func (c *Client) GenMultiSigRawUnDelegateWithdrawTxWithMemo(delAddr types.AccAddress, valAddrs []types.ValAddress,
	amounts map[string]types.Int, withdrawValAddress []types.ValAddress, memo string) ([]byte, error)

generate unsigned unDelegate+withdraw tx

func (*Client) GenMultiSigRawWithdrawAllRewardTxWithMemo added in v1.4.0

func (c *Client) GenMultiSigRawWithdrawAllRewardTxWithMemo(delAddr types.AccAddress, height int64, memo string) ([]byte, error)

generate unsigned withdraw all reward tx

func (*Client) GenMultiSigRawWithdrawDelegatorRewardTx added in v1.5.0

func (c *Client) GenMultiSigRawWithdrawDelegatorRewardTx(delAddr types.AccAddress, valAddr types.ValAddress) ([]byte, error)

generate unsigned withdraw delegate reward tx

func (*Client) GenReDelegateMsgs added in v1.6.0

func (c *Client) GenReDelegateMsgs(delAddr types.AccAddress, valSrcAddr, valDstAddr types.ValAddress, amount types.Coin) ([]types.Msg, error)

generate unsigned reDelegate tx

func (*Client) GenUnDelegateWithdrawMsgs added in v1.6.0

func (c *Client) GenUnDelegateWithdrawMsgs(delAddr types.AccAddress, valAddrs []types.ValAddress,
	amounts map[string]types.Int, withdrawValAddress []types.ValAddress) ([]types.Msg, error)

generate unsigned unDelegate+withdraw tx

func (*Client) GenWithdrawAllRewardMsgs added in v1.6.0

func (c *Client) GenWithdrawAllRewardMsgs(delAddr types.AccAddress, height int64) ([]types.Msg, error)

generate unsigned withdraw all reward tx

func (*Client) GetAccount

func (c *Client) GetAccount() (client.Account, error)

func (*Client) GetAccountNoLock added in v1.7.3

func (c *Client) GetAccountNoLock() (client.Account, error)

func (*Client) GetAccountPrefix

func (c *Client) GetAccountPrefix() string

func (*Client) GetBlockResults added in v1.2.0

func (c *Client) GetBlockResults(height int64) (*ctypes.ResultBlockResults, error)

func (*Client) GetBlockResultsNoLock added in v1.7.3

func (c *Client) GetBlockResultsNoLock(height int64) (*ctypes.ResultBlockResults, error)

func (*Client) GetBlockTxs

func (c *Client) GetBlockTxs(height int64) ([]*types.TxResponse, error)

func (*Client) GetBlockTxsNoLock added in v1.7.3

func (c *Client) GetBlockTxsNoLock(height int64) ([]*types.TxResponse, error)

func (*Client) GetBlockTxsWithParseErrSkip added in v0.0.3

func (c *Client) GetBlockTxsWithParseErrSkip(height int64) ([]*types.TxResponse, error)

will skip txs that parse failed

func (*Client) GetBlockTxsWithParseErrSkipNoLock added in v1.7.3

func (c *Client) GetBlockTxsWithParseErrSkipNoLock(height int64) ([]*types.TxResponse, error)

will skip txs that parse failed

func (*Client) GetChainId

func (c *Client) GetChainId() (string, error)

func (*Client) GetChainIdNoLock added in v1.7.3

func (c *Client) GetChainIdNoLock() (string, error)

func (*Client) GetCurrentBLockAndTimestamp

func (c *Client) GetCurrentBLockAndTimestamp() (int64, int64, error)

func (*Client) GetCurrentBLockAndTimestampNoLock added in v1.7.3

func (c *Client) GetCurrentBLockAndTimestampNoLock() (int64, int64, error)

func (*Client) GetCurrentBlockHeight

func (c *Client) GetCurrentBlockHeight() (int64, error)

func (*Client) GetCurrentBlockHeightNoLock added in v1.7.3

func (c *Client) GetCurrentBlockHeightNoLock() (int64, error)

func (*Client) GetDenom

func (c *Client) GetDenom() string

func (*Client) GetFromAddress

func (c *Client) GetFromAddress() types.AccAddress

func (*Client) GetFromName

func (c *Client) GetFromName() string

func (*Client) GetHeightByEra

func (c *Client) GetHeightByEra(era uint32, eraSeconds, offset int64) (int64, error)

func (*Client) GetHeightByTimestamp added in v1.9.7

func (c *Client) GetHeightByTimestamp(targetTimestamp int64) (int64, error)

func (*Client) GetLastTxIncludeWithdraw added in v0.0.2

func (c *Client) GetLastTxIncludeWithdraw(delegatorAddr string) (string, string, int64, error)

func (*Client) GetLastTxIncludeWithdrawNoLock added in v1.7.3

func (c *Client) GetLastTxIncludeWithdrawNoLock(delegatorAddr string) (string, string, int64, error)

func (*Client) GetLegacyAmino

func (c *Client) GetLegacyAmino() *codec.LegacyAmino

func (*Client) GetRpcClient

func (c *Client) GetRpcClient() *rpcClient.Client

func (*Client) GetSequence

func (c *Client) GetSequence(height int64, addr types.AccAddress) (uint64, error)

func (*Client) GetSequenceNoLock added in v1.7.3

func (c *Client) GetSequenceNoLock(height int64, addr types.AccAddress) (uint64, error)

func (*Client) GetTxConfig

func (c *Client) GetTxConfig() client.TxConfig

func (*Client) GetTxMemo

func (c *Client) GetTxMemo(txBts []byte) (string, error)

func (*Client) GetTxs

func (c *Client) GetTxs(events []string, page, limit int, orderBy string) (*types.SearchTxsResult, error)

func (*Client) GetTxsNoLock added in v1.7.3

func (c *Client) GetTxsNoLock(events []string, page, limit int, orderBy string) (*types.SearchTxsResult, error)

func (*Client) GetTxsWithParseErrSkip

func (c *Client) GetTxsWithParseErrSkip(events []string, page, limit int, orderBy string) (*types.SearchTxsResult, int, error)

func (*Client) GetTxsWithParseErrSkipNoLock added in v1.7.3

func (c *Client) GetTxsWithParseErrSkipNoLock(events []string, page, limit int, orderBy string) (*types.SearchTxsResult, error)

func (*Client) QueryAccount

func (c *Client) QueryAccount(addr types.AccAddress) (client.Account, error)

func (*Client) QueryAccountNoLock added in v1.7.3

func (c *Client) QueryAccountNoLock(addr types.AccAddress) (client.Account, error)

func (*Client) QueryAllRedelegations added in v1.5.1

func (c *Client) QueryAllRedelegations(delegator string, height int64) (*xStakeTypes.QueryRedelegationsResponse, error)

func (*Client) QueryAllRedelegationsNoLock added in v1.7.3

func (c *Client) QueryAllRedelegationsNoLock(delegator string, height int64) (*xStakeTypes.QueryRedelegationsResponse, error)

func (*Client) QueryBalance

func (c *Client) QueryBalance(addr types.AccAddress, denom string, height int64) (*xBankTypes.QueryBalanceResponse, error)

func (*Client) QueryBalanceNoLock added in v1.7.3

func (c *Client) QueryBalanceNoLock(addr types.AccAddress, denom string, height int64) (*xBankTypes.QueryBalanceResponse, error)

func (*Client) QueryBlock

func (c *Client) QueryBlock(height int64) (*ctypes.ResultBlock, error)

func (*Client) QueryBlockNoLock added in v1.7.3

func (c *Client) QueryBlockNoLock(height int64) (*ctypes.ResultBlock, error)

func (*Client) QueryBondedDenom

func (c *Client) QueryBondedDenom() (*xStakeTypes.QueryParamsResponse, error)

func (*Client) QueryBondedDenomNoLock added in v1.7.3

func (c *Client) QueryBondedDenomNoLock() (*xStakeTypes.QueryParamsResponse, error)

func (*Client) QueryDelegation

func (c *Client) QueryDelegation(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xStakeTypes.QueryDelegationResponse, error)

func (*Client) QueryDelegationNoLock added in v1.7.3

func (c *Client) QueryDelegationNoLock(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xStakeTypes.QueryDelegationResponse, error)

func (*Client) QueryDelegationRewards

func (c *Client) QueryDelegationRewards(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xDistriTypes.QueryDelegationRewardsResponse, error)

func (*Client) QueryDelegationRewardsNoLock added in v1.7.3

func (c *Client) QueryDelegationRewardsNoLock(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xDistriTypes.QueryDelegationRewardsResponse, error)

func (*Client) QueryDelegationTotalRewards

func (c *Client) QueryDelegationTotalRewards(delegatorAddr types.AccAddress, height int64) (*xDistriTypes.QueryDelegationTotalRewardsResponse, error)

func (*Client) QueryDelegationTotalRewardsNoLock added in v1.7.3

func (c *Client) QueryDelegationTotalRewardsNoLock(delegatorAddr types.AccAddress, height int64) (*xDistriTypes.QueryDelegationTotalRewardsResponse, error)

func (*Client) QueryDelegations

func (c *Client) QueryDelegations(delegatorAddr types.AccAddress, height int64) (*xStakeTypes.QueryDelegatorDelegationsResponse, error)

func (*Client) QueryDelegationsNoLock added in v1.7.3

func (c *Client) QueryDelegationsNoLock(delegatorAddr types.AccAddress, height int64) (*xStakeTypes.QueryDelegatorDelegationsResponse, error)

func (*Client) QueryPool added in v1.11.6

func (c *Client) QueryPool(height int64) (*xStakeTypes.QueryPoolResponse, error)

func (*Client) QueryReDelegations added in v1.4.0

func (c *Client) QueryReDelegations(delegatorAddr, src, dst string, height int64) (*xStakeTypes.QueryRedelegationsResponse, error)

func (*Client) QueryReDelegationsNoLock added in v1.7.3

func (c *Client) QueryReDelegationsNoLock(delegatorAddr, src, dst string, height int64) (*xStakeTypes.QueryRedelegationsResponse, error)

func (*Client) QuerySigningInfo added in v1.5.1

func (c *Client) QuerySigningInfo(consAddr string, height int64) (*xSlashingTypes.QuerySigningInfoResponse, error)

func (*Client) QuerySigningInfoNoLock added in v1.7.3

func (c *Client) QuerySigningInfoNoLock(consAddr string, height int64) (*xSlashingTypes.QuerySigningInfoResponse, error)

func (*Client) QueryStakingParams added in v1.11.6

func (c *Client) QueryStakingParams() (*xStakeTypes.QueryParamsResponse, error)

func (*Client) QueryTxByHash

func (c *Client) QueryTxByHash(hashHexStr string) (*types.TxResponse, error)

no 0x prefix

func (*Client) QueryTxByHashNoLock added in v1.7.3

func (c *Client) QueryTxByHashNoLock(hashHexStr string) (*types.TxResponse, error)

no 0x prefix

func (*Client) QueryUnbondingDelegation

func (c *Client) QueryUnbondingDelegation(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xStakeTypes.QueryUnbondingDelegationResponse, error)

func (*Client) QueryUnbondingDelegationNoLock added in v1.7.3

func (c *Client) QueryUnbondingDelegationNoLock(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xStakeTypes.QueryUnbondingDelegationResponse, error)

func (*Client) QueryValidator added in v1.5.1

func (c *Client) QueryValidator(validator string, height int64) (*xStakeTypes.QueryValidatorResponse, error)

func (*Client) QueryValidatorNoLock added in v1.7.3

func (c *Client) QueryValidatorNoLock(validator string, height int64) (*xStakeTypes.QueryValidatorResponse, error)

func (*Client) QueryValidatorSlashes added in v1.3.0

func (c *Client) QueryValidatorSlashes(validator types.ValAddress, startHeight, endHeight int64) (*xDistriTypes.QueryValidatorSlashesResponse, error)

func (*Client) QueryValidatorSlashesNoLock added in v1.7.3

func (c *Client) QueryValidatorSlashesNoLock(validator types.ValAddress, startHeight, endHeight int64) (*xDistriTypes.QueryValidatorSlashesResponse, error)

func (*Client) QueryValidators added in v1.1.0

func (c *Client) QueryValidators(height int64) (*xStakeTypes.QueryValidatorsResponse, error)

func (*Client) QueryValidatorsNoLock added in v1.7.3

func (c *Client) QueryValidatorsNoLock(height int64) (*xStakeTypes.QueryValidatorsResponse, error)

func (*Client) QueryVotes added in v1.7.0

func (c *Client) QueryVotes(proposalId uint64, height int64, page, limit uint64, countTotal bool) (*xGovTypes.QueryVotesResponse, error)

func (*Client) QueryVotesNoLock added in v1.7.3

func (c *Client) QueryVotesNoLock(proposalId uint64, height int64, page, limit uint64, countTotal bool) (*xGovTypes.QueryVotesResponse, error)

func (*Client) Retry added in v1.0.0

func (c *Client) Retry(f func() (interface{}, error)) (interface{}, error)

func (*Client) SetAccountPrefix

func (c *Client) SetAccountPrefix(prefix string)

func (*Client) SetFromName

func (c *Client) SetFromName(fromName string) error

update clientCtx.FromName and clientCtx.FromAddress

func (*Client) SetGasPrice

func (c *Client) SetGasPrice(gasPrice string) error

func (*Client) Sign

func (c *Client) Sign(fromName string, toBeSigned []byte) ([]byte, cryptoTypes.PubKey, error)

func (*Client) SignMultiSigRawTxWithSeq

func (c *Client) SignMultiSigRawTxWithSeq(sequence uint64, rawTx []byte, fromSubKey string) (signature []byte, err error)

c.clientCtx.FromAddress must be multi sig address

func (*Client) SingleTransferTo

func (c *Client) SingleTransferTo(toAddr types.AccAddress, amount types.Coins) error

func (*Client) TokenizeShareRecordByDenom added in v1.11.6

func (c *Client) TokenizeShareRecordByDenom(shareDenom string, height int64) (*xStakeTypes.QueryTokenizeShareRecordByDenomResponse, error)

func (*Client) TotalLiquidStaked added in v1.11.6

func (c *Client) TotalLiquidStaked(height int64) (*xStakeTypes.QueryTotalLiquidStakedResponse, error)

func (*Client) VerifyMultiSigTxForTest added in v1.11.23

func (c *Client) VerifyMultiSigTxForTest(rawTx []byte, signatures [][]byte, threshold uint32, accountNumber uint64) (err error)

type EncodingConfig

type EncodingConfig struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

EncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.

func MakeEncodingConfig

func MakeEncodingConfig() EncodingConfig

MakeEncodingConfig creates an EncodingConfig for testing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL