client

package module
v0.0.0-...-e0eb0d4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventQuery = tmquery.MustParse("tm.event='Tx'").String()

	AndContractQueryParamTmpl = " AND wasm._contract_address='%s'"
)

Functions

func ToHex

func ToHex(b []byte) string

Types

type BalanceResp

type BalanceResp struct {
	Balance string
}

type ChainSignersRequest

type ChainSignersRequest struct{}

type CosBridgeSignersUpdated

type CosBridgeSignersUpdated struct {
	Signers []ec.Address
	Powers  []*big.Int
}

func (CosBridgeSignersUpdated) String

func (s CosBridgeSignersUpdated) String() interface{}

type CosClient

type CosClient struct {
	ChainID    uint64
	RawChainID string // the original cosmos chain id
	Cc         *lens.ChainClient

	BridgeAddr    string // cosmos canonical hex addr
	VaultAddr     string // cosmos canonical hex addr
	PegBridgeAddr string // cosmos canonical hex addr

	MsgPackage string // if provided, with replace the package of the Any typeUrl of the sdk.Msg
}

all in one helper to do everything about cosmos chain

func NewCosClient

func NewCosClient(cfg *CosConfig) *CosClient

func (*CosClient) DelayTransferExist

func (c *CosClient) DelayTransferExist(id ec.Hash, contractCanonicalAddr string) (bool, error)

func (*CosClient) ExecuteDelay

func (c *CosClient) ExecuteDelay(id ec.Hash, contractCanonicalAddr string) (string, error)

func (*CosClient) ExecutePegBridgeDelay

func (c *CosClient) ExecutePegBridgeDelay(id ec.Hash) (string, error)

func (*CosClient) ExecuteVaultDelay

func (c *CosClient) ExecuteVaultDelay(id ec.Hash) (string, error)

func (*CosClient) GetBlockTs

func (c *CosClient) GetBlockTs() (time.Time, error)

func (*CosClient) GetContractHumanAddress

func (c *CosClient) GetContractHumanAddress(contractCanonicalAddr string) (string, error)

func (*CosClient) GetDelayPeriod

func (c *CosClient) GetDelayPeriod(contractCanonicalAddr string) (uint64, error)

func (*CosClient) GetDelayThreshold

func (c *CosClient) GetDelayThreshold(contractCanonicalAddr, tokenCanonicalAddr string) (string, error)

func (*CosClient) GetPegBridgeDelayPeriod

func (c *CosClient) GetPegBridgeDelayPeriod() (uint64, error)

func (*CosClient) GetPegBridgeDelayThreshold

func (c *CosClient) GetPegBridgeDelayThreshold(tokenCanonicalAddr string) (string, error)

func (*CosClient) GetVaultDelayPeriod

func (c *CosClient) GetVaultDelayPeriod() (uint64, error)

func (*CosClient) GetVaultDelayThreshold

func (c *CosClient) GetVaultDelayThreshold(tokenCanonicalAddr string) (string, error)

func (*CosClient) IsPaused

func (c *CosClient) IsPaused(contractCanonicalAddr string) (bool, error)

func (*CosClient) IsPegBridgePaused

func (c *CosClient) IsPegBridgePaused() (bool, error)

func (*CosClient) IsVaultPaused

func (c *CosClient) IsVaultPaused() (bool, error)

func (*CosClient) MonOTV

func (c *CosClient) MonOTV(depositCallback, withdrawCallback, dtExectutedCallback func(events map[string][]string, chid uint64))

func (*CosClient) MonPTB

func (c *CosClient) MonPTB(burnCallback, mintCallback, dtExecutedCallback func(events map[string][]string, chid uint64))

func (*CosClient) Monitor

func (c *CosClient) Monitor(eventQuery string, handleEvents func(events map[string][]string), outCapacity ...int) error

func (*CosClient) Pause

func (c *CosClient) Pause(contractCanonicalAddr string) (string, error)

func (*CosClient) PausePegBridge

func (c *CosClient) PausePegBridge() (string, error)

func (*CosClient) PauseVault

func (c *CosClient) PauseVault() (string, error)

func (*CosClient) PegBridgeDelayTransferExist

func (c *CosClient) PegBridgeDelayTransferExist(id ec.Hash) (bool, error)

func (*CosClient) QueryCW20Balance

func (c *CosClient) QueryCW20Balance(tokenCanonicalAddr, balancerCanonicalAddr string) (*BalanceResp, error)

func (*CosClient) QueryEpochVolumeCap

func (c *CosClient) QueryEpochVolumeCap(token string, contractCanonicalAddr string) (*big.Int, error)

func (*CosClient) QueryNativeToken

func (c *CosClient) QueryNativeToken(balancerCanonicalAddr string) (*cosmostypes.Coin, error)

func (*CosClient) QueryPegBridgeRecordExist

func (c *CosClient) QueryPegBridgeRecordExist(id ec.Hash, isBurn bool) (bool, error)

func (*CosClient) QueryPegBridgeTokenVolume

func (c *CosClient) QueryPegBridgeTokenVolume(tokenCanonicalAddr string) (*big.Int, error)

func (*CosClient) QueryPegBridgeVolumeEpochLength

func (c *CosClient) QueryPegBridgeVolumeEpochLength() (uint64, error)

func (*CosClient) QueryPegBridgeVolumeLastOpTimestamp

func (c *CosClient) QueryPegBridgeVolumeLastOpTimestamp(token string) (uint64, error)

func (*CosClient) QueryPegTokenBalance

func (c *CosClient) QueryPegTokenBalance(tokenCanonicalAddr, balancerCanonicalAddr string) (*BalanceResp, error)

func (*CosClient) QueryPegTokenSupply

func (c *CosClient) QueryPegTokenSupply(tokenCanonicalAddr string) (*big.Int, error)

func (*CosClient) QueryPegbridgeEpochVolumeCap

func (c *CosClient) QueryPegbridgeEpochVolumeCap(token string) (*big.Int, error)

func (*CosClient) QueryTokenTotalSupply

func (c *CosClient) QueryTokenTotalSupply(tokenCanonicalAddr string) (*PegTokenInfo, error)

func (*CosClient) QueryTokenVolume

func (c *CosClient) QueryTokenVolume(tokenCanonicalAddr string, contractCanonicalAddr string) (*big.Int, error)

func (*CosClient) QueryTxGasCost

func (c *CosClient) QueryTxGasCost(txHash ec.Hash) (*big.Int, error)

func (*CosClient) QueryVaultBalance

func (c *CosClient) QueryVaultBalance(token string) (*big.Int, error)

func (*CosClient) QueryVaultEpochVolumeCap

func (c *CosClient) QueryVaultEpochVolumeCap(token string) (*big.Int, error)

func (*CosClient) QueryVaultRecordExist

func (c *CosClient) QueryVaultRecordExist(id ec.Hash, isDeposit bool) (bool, error)

func (*CosClient) QueryVaultTokenVolume

func (c *CosClient) QueryVaultTokenVolume(tokenCanonicalAddr string) (*big.Int, error)

func (*CosClient) QueryVaultVolumeEpochLength

func (c *CosClient) QueryVaultVolumeEpochLength() (uint64, error)

func (*CosClient) QueryVaultVolumeLastOpTimestamp

func (c *CosClient) QueryVaultVolumeLastOpTimestamp(token string) (uint64, error)

func (*CosClient) QueryVolumeEpochLength

func (c *CosClient) QueryVolumeEpochLength(contractCanonicalAddr string) (uint64, error)

func (*CosClient) QueryVolumeLastOpTimestamp

func (c *CosClient) QueryVolumeLastOpTimestamp(token string, contractCanonicalAddr string) (uint64, error)

func (*CosClient) Unpause

func (c *CosClient) Unpause(contractCanonicalAddr string) (string, error)

func (*CosClient) UnpausePegBridge

func (c *CosClient) UnpausePegBridge() (string, error)

func (*CosClient) UnpauseVault

func (c *CosClient) UnpauseVault() (string, error)

func (*CosClient) VaultDelayTransferExist

func (c *CosClient) VaultDelayTransferExist(id ec.Hash) (bool, error)

type CosConfig

type CosConfig struct {
	ChainId              uint64
	RawChainID           string
	Key                  string
	AccountPrefix        string
	Endpoint             string
	BridgeAddr           string
	VaultBridgeAddr      string
	PegBridgeAddr        string
	MsgPackage           string
	KeyringBackend       string
	TransactorPassphrase string
	GasAdjustment        float64
	GasPrices            string
	Timeout              string
	HomeDir              string
}

type CosEventLog

type CosEventLog struct {
	TxHash ec.Hash `json:"tx_hash"`
	Height uint64  `json:"height"`
	Type   string  `json:"type"`
	Data   []byte  `json:"data"`
}

type CosPegBridgeBurn

type CosPegBridgeBurn struct {
	BurnId    ec.Hash  `json:"burn_id"`
	Burner    []byte   `json:"burner"`
	Token     []byte   `json:"token"`
	Amount    *big.Int `json:"amount"`
	ToChainId uint64   `json:"to_chain_id"`
	ToAccount []byte   `json:"to_acct"`
}

type CosPegBridgeMint

type CosPegBridgeMint struct {
	MintId     ec.Hash  `json:"mint_id"`
	Receiver   []byte   `json:"receiver"`
	Token      []byte   `json:"token"`
	Amount     *big.Int `json:"amount"`
	RefChainId uint64   `json:"ref_chain_id"`
	RefId      ec.Hash  `json:"ref_id"`
	Depositor  []byte   `json:"depositor"`
}

type CosVaultDeposited

type CosVaultDeposited struct {
	DepositId   ec.Hash  `json:"dep_id"`
	Depositor   []byte   `json:"depositor"`
	Token       []byte   `json:"token"`
	Amount      *big.Int `json:"amount"`
	MintChainId uint64   `json:"mint_chain_id"`
	MintAccount []byte   `json:"mint_acct"`
}

type CosVaultWithdrawn

type CosVaultWithdrawn struct {
	WithdrawId  ec.Hash  `json:"wd_id"`
	Receiver    []byte   `json:"receiver"`
	Token       []byte   `json:"token"`
	Amount      *big.Int `json:"amount"`
	RefChainId  uint64   `json:"ref_chain_id"`
	RefId       ec.Hash  `json:"ref_od"`
	BurnAccount []byte   `json:"burn_acct"`
}

type OTVRecord

type OTVRecord struct {
	Id        string `json:"id"`
	IsDeposit bool   `json:"is_deposit"`
}

type PTBRecord

type PTBRecord struct {
	Id     string `json:"id"`
	IsBurn bool   `json:"is_burn"`
}

type PegTokenInfo

type PegTokenInfo struct {
	Name        string
	Symbol      string
	Decimals    uint64
	TotalSupply string `json:"total_supply"`
}

type WasmExecuteMsgMint

type WasmExecuteMsgMint struct {
	Mint WasmExecuteMsgMintBody `json:"mint"`
}

type WasmExecuteMsgMintBody

type WasmExecuteMsgMintBody struct {
	Pbmsg string   `json:"pbmsg"` //base64 encoded string
	Sigs  []string `json:"sigs"`  //base64 encoded string
}

type WasmExecuteMsgUpdateSigners

type WasmExecuteMsgUpdateSigners struct {
	UpdateSigners WasmExecuteMsgUpdateSignersBody `json:"update_signers"`
}

type WasmExecuteMsgUpdateSignersBody

type WasmExecuteMsgUpdateSignersBody struct {
	TriggerTime uint64
	Signers     []ec.Address
	Powers      []*big.Int
	Sigs        [][]byte
}

type WasmExecuteMsgWithdraw

type WasmExecuteMsgWithdraw struct {
	Withdraw WasmExecuteMsgWithdrawBody `json:"withdraw"`
}

type WasmExecuteMsgWithdrawBody

type WasmExecuteMsgWithdrawBody struct {
	Pbmsg string   `json:"pbmsg"` //base64 encoded string
	Sigs  []string `json:"sigs"`  //base64 encoded string
}

type WasmQueryOTVRecordRequest

type WasmQueryOTVRecordRequest struct {
	Record OTVRecord `json:"record"`
}

type WasmQueryOTVRecordResponse

type WasmQueryOTVRecordResponse bool

type WasmQueryPTBRecordRequest

type WasmQueryPTBRecordRequest struct {
	Record PTBRecord `json:"record"`
}

type WasmQueryPTBRecordResponse

type WasmQueryPTBRecordResponse bool

type WasmQueryRequestSigners

type WasmQueryRequestSigners struct {
	ChainSigners ChainSignersRequest `json:"chain_signers"`
}

type WasmQueryResponseSigners

type WasmQueryResponseSigners struct {
	Signers [][]byte `json:"signers"`
	Powers  []string `json:"powers"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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