Documentation ¶
Index ¶
- Constants
- Variables
- func Retry(f func() (interface{}, error)) (interface{}, error)
- type Client
- func (c *Client) AssembleMultiSigTx(rawTx []byte, signatures [][]byte, threshold uint32) (txHash, txBts []byte, err error)
- func (c *Client) BroadcastTx(tx []byte) (string, error)
- func (c *Client) ConstructAndSignTx(msgs ...types.Msg) ([]byte, error)
- func (c *Client) Ctx() client.Context
- func (c *Client) GenMultiSigRawBatchTransferTx(poolAddr types.AccAddress, outs []xBankTypes.Output) ([]byte, error)
- func (c *Client) GenMultiSigRawDeleRewardTx(delAddr types.AccAddress, height int64) ([]byte, error)
- func (c *Client) GenMultiSigRawDelegateTx(delAddr types.AccAddress, valAddrs []types.ValAddress, amount types.Coin) ([]byte, error)
- func (c *Client) GenMultiSigRawReDelegateTx(delAddr types.AccAddress, valSrcAddr, valDstAddr types.ValAddress, ...) ([]byte, error)
- func (c *Client) GenMultiSigRawReDelegateTxWithTarget(delAddr types.AccAddress, valSrcAddrs map[string]types.Coin, ...) ([]byte, error)
- func (c *Client) GenMultiSigRawTransferTx(toAddr types.AccAddress, amount types.Coins) ([]byte, error)
- func (c *Client) GenMultiSigRawTx(msgs ...types.Msg) ([]byte, error)
- func (c *Client) GenMultiSigRawUnDelegateTx(delAddr types.AccAddress, valAddrs []types.ValAddress, amount types.Coin) ([]byte, error)
- func (c *Client) GenMultiSigRawUnDelegateTxV2(delAddr types.AccAddress, valAddrs []types.ValAddress, ...) ([]byte, error)
- func (c *Client) GenMultiSigRawWithdrawAllRewardThenDeleTx(delAddr types.AccAddress, height int64) ([]byte, error)
- func (c *Client) GenMultiSigRawWithdrawAllRewardTx(delAddr types.AccAddress, height int64) ([]byte, error)
- func (c *Client) GenMultiSigRawWithdrawDeleRewardTx(delAddr types.AccAddress, valAddr types.ValAddress) ([]byte, error)
- func (c *Client) GenMultiSigRawWithdrawRewardThenDeleTx(delAddr types.AccAddress, valAddr types.ValAddress, amount types.Coin) ([]byte, error)
- func (c *Client) GetAccount() (client.Account, error)
- func (c *Client) GetBlockTxs(height int64) ([]*types.TxResponse, error)
- func (c *Client) GetCurrentBLockAndTimestamp() (int64, int64, error)
- func (c *Client) GetCurrentBlockHeight() (int64, error)
- func (c *Client) GetDenom() string
- func (c *Client) GetFromAddress() types.AccAddress
- func (c *Client) GetFromName() string
- func (c *Client) GetLegacyAmino() *codec.LegacyAmino
- func (c *Client) GetRpcClient() *rpcClient.Client
- func (c *Client) GetSequence(height int64, addr types.AccAddress) (uint64, error)
- func (c *Client) GetTxConfig() client.TxConfig
- func (c *Client) GetTxs(events []string, page, limit int, orderBy string) (*types.SearchTxsResult, error)
- func (c *Client) QueryAccount(addr types.AccAddress) (client.Account, error)
- func (c *Client) QueryBalance(addr types.AccAddress, denom string, height int64) (*xBankTypes.QueryBalanceResponse, error)
- func (c *Client) QueryBlock(height int64) (*ctypes.ResultBlock, error)
- func (c *Client) QueryDelegation(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xStakeTypes.QueryDelegationResponse, error)
- func (c *Client) QueryDelegationRewards(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xDistriTypes.QueryDelegationRewardsResponse, error)
- func (c *Client) QueryDelegationTotalRewards(delegatorAddr types.AccAddress, height int64) (*xDistriTypes.QueryDelegationTotalRewardsResponse, error)
- func (c *Client) QueryDelegations(delegatorAddr types.AccAddress, height int64) (*xStakeTypes.QueryDelegatorDelegationsResponse, error)
- func (c *Client) QueryTxByHash(hashHexStr string) (*types.TxResponse, error)
- func (c *Client) QueryUnbondingDelegation(delegatorAddr types.AccAddress, validatorAddr types.ValAddress, height int64) (*xStakeTypes.QueryUnbondingDelegationResponse, error)
- func (c *Client) SetFromName(fromName string) error
- func (c *Client) Sign(fromName string, toBeSigned []byte) ([]byte, cryptoTypes.PubKey, error)
- func (c *Client) SignMultiSigRawTx(rawTx []byte, fromSubKey string) (signature []byte, err error)
- func (c *Client) SignMultiSigRawTxWithSeq(sequence uint64, rawTx []byte, fromSubKey string) (signature []byte, err error)
- func (c *Client) SingleTransferTo(toAddr types.AccAddress, amount types.Coins) error
- type EncodingConfig
Constants ¶
const AccountPrefix = "cosmos"
Variables ¶
var ErrNoMsgs = errors.New("no tx msgs")
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
cosmos client
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) ConstructAndSignTx ¶
func (*Client) GenMultiSigRawBatchTransferTx ¶
func (c *Client) GenMultiSigRawBatchTransferTx(poolAddr types.AccAddress, outs []xBankTypes.Output) ([]byte, error)
only support one type coin
func (*Client) GenMultiSigRawDeleRewardTx ¶
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) GenMultiSigRawReDelegateTx ¶
func (c *Client) GenMultiSigRawReDelegateTx(delAddr types.AccAddress, valSrcAddr, valDstAddr types.ValAddress, amount types.Coin) ([]byte, error)
generate unsigned reDelegate tx
func (*Client) GenMultiSigRawReDelegateTxWithTarget ¶
func (c *Client) GenMultiSigRawReDelegateTxWithTarget(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 ¶
c.clientCtx.FromAddress must be multi sig address,no need sequence
func (*Client) GenMultiSigRawUnDelegateTx ¶
func (c *Client) GenMultiSigRawUnDelegateTx(delAddr types.AccAddress, valAddrs []types.ValAddress, amount types.Coin) ([]byte, error)
generate unsigned unDelegate tx
func (*Client) GenMultiSigRawUnDelegateTxV2 ¶
func (c *Client) GenMultiSigRawUnDelegateTxV2(delAddr types.AccAddress, valAddrs []types.ValAddress, amounts map[string]types.Int) ([]byte, error)
generate unsigned unDelegate tx
func (*Client) GenMultiSigRawWithdrawAllRewardThenDeleTx ¶
func (c *Client) GenMultiSigRawWithdrawAllRewardThenDeleTx(delAddr types.AccAddress, height int64) ([]byte, error)
generate unsigned withdraw all reward then delegate reward tx
func (*Client) GenMultiSigRawWithdrawAllRewardTx ¶
func (c *Client) GenMultiSigRawWithdrawAllRewardTx(delAddr types.AccAddress, height int64) ([]byte, error)
generate unsigned withdraw all reward then delegate reward tx
func (*Client) GenMultiSigRawWithdrawDeleRewardTx ¶
func (c *Client) GenMultiSigRawWithdrawDeleRewardTx(delAddr types.AccAddress, valAddr types.ValAddress) ([]byte, error)
generate unsigned withdraw delegate reward tx
func (*Client) GenMultiSigRawWithdrawRewardThenDeleTx ¶
func (c *Client) GenMultiSigRawWithdrawRewardThenDeleTx(delAddr types.AccAddress, valAddr types.ValAddress, amount types.Coin) ([]byte, error)
generate unsigned withdraw reward then delegate reward tx
func (*Client) GetBlockTxs ¶
func (c *Client) GetBlockTxs(height int64) ([]*types.TxResponse, error)
func (*Client) GetCurrentBLockAndTimestamp ¶
func (*Client) GetCurrentBlockHeight ¶
func (*Client) GetFromAddress ¶
func (c *Client) GetFromAddress() types.AccAddress
func (*Client) GetFromName ¶
func (*Client) GetLegacyAmino ¶
func (c *Client) GetLegacyAmino() *codec.LegacyAmino
func (*Client) GetRpcClient ¶
func (*Client) GetSequence ¶
func (*Client) GetTxConfig ¶
func (*Client) QueryAccount ¶
func (*Client) QueryBalance ¶
func (c *Client) QueryBalance(addr types.AccAddress, denom string, height int64) (*xBankTypes.QueryBalanceResponse, error)
func (*Client) QueryBlock ¶
func (c *Client) QueryBlock(height int64) (*ctypes.ResultBlock, error)
func (*Client) QueryDelegation ¶
func (c *Client) QueryDelegation(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) QueryDelegationTotalRewards ¶
func (c *Client) QueryDelegationTotalRewards(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) QueryTxByHash ¶
func (c *Client) QueryTxByHash(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) SetFromName ¶
update clientCtx.FromName and clientCtx.FromAddress
func (*Client) SignMultiSigRawTx ¶
c.clientCtx.FromAddress must be multi sig address
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 ¶
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