client

package
v0.0.0-...-4591d79 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: GPL-3.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const AccountPrefix = "cosmos"

Variables

View Source
var ErrNoMsgs = errors.New("no tx msgs")

Functions

func Retry

func Retry(f func() (interface{}, error)) (interface{}, error)

Types

type Client

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

cosmos client

func NewClient

func NewClient(k keyring.Keyring, chainId, fromName, gasPrice, denom, endPoint string) (*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) ConstructAndSignTx

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

func (*Client) Ctx

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

func (*Client) GenMultiSigRawBatchTransferTx

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

only support one type coin

func (*Client) GenMultiSigRawDeleRewardTx

func (c *Client) GenMultiSigRawDeleRewardTx(delAddr types.AccAddress, height int64) ([]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) 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

func (c *Client) GenMultiSigRawTx(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, 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) GetAccount

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

func (*Client) GetBlockTxs

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

func (*Client) GetCurrentBLockAndTimestamp

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

func (*Client) GetCurrentBlockHeight

func (c *Client) GetCurrentBlockHeight() (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) 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) GetTxConfig

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

func (*Client) GetTxs

func (c *Client) GetTxs(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) 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

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

update clientCtx.FromName and clientCtx.FromAddress

func (*Client) Sign

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

func (*Client) SignMultiSigRawTx

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

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

func (c *Client) SingleTransferTo(toAddr types.AccAddress, amount types.Coins) 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