cosmos

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const ChainName = "Cosmos"
View Source
const NetWork = "mainnet"

Variables

This section is empty.

Functions

func NewChainAdaptor

func NewChainAdaptor(conf *config.Config) (chain.IChainAdaptor, error)

Types

type BlockResponse

type BlockResponse struct {
	BlockId struct {
		Hash string `json:"hash"`
	} `json:"block_id"`
	Block struct {
		Header struct {
			Height string `json:"height"`
			Time   string `json:"time"`
		} `json:"header"`
		Data struct {
			Txs []string `json:"txs"`
		} `json:"data"`
	} `json:"block"`
}

type ChainAdaptor

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

func (*ChainAdaptor) BuildSignedTransaction

func (*ChainAdaptor) ConvertAddress

func (*ChainAdaptor) CreateUnSignTransaction

func (*ChainAdaptor) DecodeTransaction

func (*ChainAdaptor) GetAccount

func (*ChainAdaptor) GetBlockByHash

func (c *ChainAdaptor) GetBlockByHash(req *account.BlockHashRequest) (*account.BlockResponse, error)

func (*ChainAdaptor) GetBlockByNumber

func (c *ChainAdaptor) GetBlockByNumber(req *account.BlockNumberRequest) (*account.BlockResponse, error)

func (*ChainAdaptor) GetBlockByRange

func (*ChainAdaptor) GetBlockHeaderByHash

func (c *ChainAdaptor) GetBlockHeaderByHash(req *account.BlockHeaderHashRequest) (*account.BlockHeaderResponse, error)

func (*ChainAdaptor) GetBlockHeaderByNumber

func (c *ChainAdaptor) GetBlockHeaderByNumber(req *account.BlockHeaderNumberRequest) (*account.BlockHeaderResponse, error)

func (*ChainAdaptor) GetExtraData

func (*ChainAdaptor) GetFee

func (*ChainAdaptor) GetSupportChains

func (*ChainAdaptor) GetTxByAddress

func (*ChainAdaptor) GetTxByHash

func (c *ChainAdaptor) GetTxByHash(req *account.TxHashRequest) (*account.TxHashResponse, error)

func (*ChainAdaptor) SendTx

func (*ChainAdaptor) ValidAddress

func (*ChainAdaptor) VerifySignedTransaction

type CosmosClient

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

func DialCosmosClient

func DialCosmosClient(ctx context.Context, nodeUrl string) (*CosmosClient, error)

func (*CosmosClient) BlockchainInfo

func (c *CosmosClient) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

func (*CosmosClient) BroadcastTx

func (c *CosmosClient) BroadcastTx(txByte []byte) (*sdktx.BroadcastTxResponse, error)

func (*CosmosClient) Close

func (c *CosmosClient) Close() error

func (*CosmosClient) DecodeBlockTx

func (c *CosmosClient) DecodeBlockTx(restURL string, block *BlockResponse) ([]*account.BlockInfoTransactionList, error)

func (*CosmosClient) GetAccount

func (c *CosmosClient) GetAccount(addr string) (*authv1beta1.QueryAccountResponse, error)

func (*CosmosClient) GetAddressFromPubKey

func (c *CosmosClient) GetAddressFromPubKey(key []byte) string

func (*CosmosClient) GetBalance

func (c *CosmosClient) GetBalance(coin, addr string) (*sdk.Coin, error)

func (*CosmosClient) GetBlockByHash

func (c *CosmosClient) GetBlockByHash(hash []byte) (*ctypes.ResultBlock, error)

func (*CosmosClient) GetHeaderByHash

func (c *CosmosClient) GetHeaderByHash(hash []byte) (*ctypes.ResultHeader, error)

func (*CosmosClient) GetHeaderByHeight

func (c *CosmosClient) GetHeaderByHeight(height *int64) (*ctypes.ResultHeader, error)

func (*CosmosClient) GetTxByEvent

func (c *CosmosClient) GetTxByEvent(event []string, page, limit uint64) (*sdktx.GetTxsEventResponse, error)

func (*CosmosClient) GetTxByHash

func (c *CosmosClient) GetTxByHash(restURL, hash string) (*TxResponse, error)

func (*CosmosClient) SendTx

func (c *CosmosClient) SendTx(fromAddr, toAddr, coin string, amount int64) (*banktypes.MsgSendResponse, error)

func (*CosmosClient) Tx

func (c *CosmosClient) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)

type DecodeTxRequest

type DecodeTxRequest struct {
	Tx string `json:"tx_bytes"`
}

type DecodeTxResponse

type DecodeTxResponse struct {
	Tx struct {
		Body struct {
			Messages []banktypes.MsgSend `json:"messages"`
		} `json:"body"`
	} `json:"tx"`
	Response struct {
		Height    string `json:"height"`
		Txhash    string `json:"txhash"`
		GasWanted string `json:"gas_wanted"`
		GasUsed   string `json:"gas_used"`
	} `json:"tx_response"`
}

type TxEvent

type TxEvent struct {
	Type       string              `json:"type"`
	Attributes []*TxEventAttribute `json:"attributes"`
}

type TxEventAttribute

type TxEventAttribute struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type TxResponse

type TxResponse struct {
	//Tx struct {
	//	Body struct {
	//		Messages []string `json:"messages"`
	//	} `json:"body"`
	//} `json:"tx"`
	Response struct {
		Height    string     `json:"height"`
		Txhash    string     `json:"txhash"`
		GasWanted string     `json:"gas_wanted"`
		GasUsed   string     `json:"gas_used"`
		Events    []*TxEvent `json:"events"`
		Timestamp string     `json:"timestamp"`
	} `json:"tx_response"`
}

Jump to

Keyboard shortcuts

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