client

package
v0.0.0-...-cc9b5da Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const TimeoutInBlocks = 10_000

At roughly 5s/block this is a ~12 hour timeout.

Variables

This section is empty.

Functions

func DecodeEventAttributes

func DecodeEventAttributes(attrs []comettypes.EventAttribute)

func ReplaceIncompatiableCosmosResponses

func ReplaceIncompatiableCosmosResponses(body []byte) []byte

Types

type Client

type Client struct {
	Asset xc.ITask
	Ctx   client.Context

	Prefix string
	// contains filtered or unexported fields
}

Client for Cosmos

func NewClient

func NewClient(cfgI xc.ITask) (*Client, error)

NewClient returns a new Client

func NewClientFrom

func NewClientFrom(chain xc.NativeAsset, chainId string, chainPrefix string, rpcUrl string) (*Client, error)

func (*Client) BuildReferenceTransfer

func (client *Client) BuildReferenceTransfer(gasLimit uint64) (*tx.Tx, error)

There is no way to estimate gas on cosmos chains. Every RPC node and validator has the ability to see their own min price. The only way currently to determine this price is to try to submit a tx for free and look at the error log.

func (*Client) EstimateGasPrice

func (client *Client) EstimateGasPrice(ctx context.Context) (float64, error)

EstimateGas estimates gas price for a Cosmos chain

func (*Client) FetchBalance

func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

FetchBalance fetches balance for input asset for a Cosmos address

func (*Client) FetchBaseTxInput

func (client *Client) FetchBaseTxInput(ctx context.Context, from xc.Address) (*tx_input.TxInput, error)

func (*Client) FetchCw20Balance

func (client *Client) FetchCw20Balance(ctx context.Context, address xc.Address, contract string) (xc.AmountBlockchain, error)

func (*Client) FetchDecimals

func (client *Client) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)

func (*Client) FetchLegacyTxInfo

func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHash xc.TxHash) (xc.LegacyTxInfo, error)

FetchLegacyTxInfo returns tx info for a Cosmos tx

func (*Client) FetchLegacyTxInput

func (client *Client) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)

func (*Client) FetchNativeBalance

func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

FetchNativeBalance fetches account balance for a Cosmos address

func (*Client) FetchStakeBalance

func (client *Client) FetchStakeBalance(ctx context.Context, args xclient.StakedBalanceArgs) ([]*xclient.StakedBalance, error)

func (*Client) FetchStakingInput

func (client *Client) FetchStakingInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.StakeTxInput, error)

func (*Client) FetchTransferInput

func (client *Client) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)

func (*Client) FetchTxInfo

func (client *Client) FetchTxInfo(ctx context.Context, txHashStr xc.TxHash) (xclient.TxInfo, error)

func (*Client) FetchUnstakingInput

func (client *Client) FetchUnstakingInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.UnstakeTxInput, error)

func (*Client) FetchWithdrawInput

func (client *Client) FetchWithdrawInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.WithdrawTxInput, error)

func (*Client) GetAccount

func (client *Client) GetAccount(ctx context.Context, address xc.Address) (client.Account, error)

GetAccount returns a Cosmos account Equivalent to client.Ctx.AccountRetriever.GetAccount(), but doesn't rely GetConfig()

func (*Client) SubmitTx

func (client *Client) SubmitTx(ctx context.Context, tx1 xc.Tx) error

SubmitTx submits a Cosmos tx

type DelegateEvent

type DelegateEvent struct {
	Validator string
	Delegator string
	Amount    xc.AmountBlockchain
	Contract  string
}

type ParsedEvents

type ParsedEvents struct {
	Transfers []TransferEvent
	// Every withdraw event also has a transfer event; so far we can ignore these
	Withdraws []WithdrawRewardsEvent
	Delegates []DelegateEvent
	Unbonds   []UnbondEvent
}

func ParseEvents

func ParseEvents(events []comettypes.Event) ParsedEvents

type TransferEvent

type TransferEvent struct {
	Recipient string
	Sender    string
	Amount    xc.AmountBlockchain
	Contract  string
}

type UnbondEvent

type UnbondEvent struct {
	Validator string
	Delegator string
	Amount    xc.AmountBlockchain
	Contract  string
}

type WithdrawRewardsEvent

type WithdrawRewardsEvent struct {
	Validator string
	Delegator string
	Amount    xc.AmountBlockchain
	Contract  string
}

Jump to

Keyboard shortcuts

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