Documentation ¶
Index ¶
- Constants
- func NewChainAdaptor(conf *config.Config) (chain.IChainAdaptor, error)
- type BlockResponse
- type ChainAdaptor
- func (c *ChainAdaptor) BuildSignedTransaction(req *account.SignedTransactionRequest) (*account.SignedTransactionResponse, error)
- func (c *ChainAdaptor) ConvertAddress(req *account.ConvertAddressRequest) (*account.ConvertAddressResponse, error)
- func (c *ChainAdaptor) CreateUnSignTransaction(req *account.UnSignTransactionRequest) (*account.UnSignTransactionResponse, error)
- func (c *ChainAdaptor) DecodeTransaction(req *account.DecodeTransactionRequest) (*account.DecodeTransactionResponse, error)
- func (c *ChainAdaptor) GetAccount(req *account.AccountRequest) (*account.AccountResponse, error)
- func (c *ChainAdaptor) GetBlockByHash(req *account.BlockHashRequest) (*account.BlockResponse, error)
- func (c *ChainAdaptor) GetBlockByNumber(req *account.BlockNumberRequest) (*account.BlockResponse, error)
- func (c *ChainAdaptor) GetBlockByRange(req *account.BlockByRangeRequest) (*account.BlockByRangeResponse, error)
- func (c *ChainAdaptor) GetBlockHeaderByHash(req *account.BlockHeaderHashRequest) (*account.BlockHeaderResponse, error)
- func (c *ChainAdaptor) GetBlockHeaderByNumber(req *account.BlockHeaderNumberRequest) (*account.BlockHeaderResponse, error)
- func (c *ChainAdaptor) GetExtraData(req *account.ExtraDataRequest) (*account.ExtraDataResponse, error)
- func (c *ChainAdaptor) GetFee(req *account.FeeRequest) (*account.FeeResponse, error)
- func (c *ChainAdaptor) GetSupportChains(req *account.SupportChainsRequest) (*account.SupportChainsResponse, error)
- func (c *ChainAdaptor) GetTxByAddress(req *account.TxAddressRequest) (*account.TxAddressResponse, error)
- func (c *ChainAdaptor) GetTxByHash(req *account.TxHashRequest) (*account.TxHashResponse, error)
- func (c *ChainAdaptor) SendTx(req *account.SendTxRequest) (*account.SendTxResponse, error)
- func (c *ChainAdaptor) ValidAddress(req *account.ValidAddressRequest) (*account.ValidAddressResponse, error)
- func (c *ChainAdaptor) VerifySignedTransaction(req *account.VerifyTransactionRequest) (*account.VerifyTransactionResponse, error)
- type CosmosClient
- func (c *CosmosClient) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)
- func (c *CosmosClient) BroadcastTx(txByte []byte) (*sdktx.BroadcastTxResponse, error)
- func (c *CosmosClient) Close() error
- func (c *CosmosClient) DecodeBlockTx(restURL string, block *BlockResponse) ([]*account.BlockInfoTransactionList, error)
- func (c *CosmosClient) GetAccount(addr string) (*authv1beta1.QueryAccountResponse, error)
- func (c *CosmosClient) GetAddressFromPubKey(key []byte) string
- func (c *CosmosClient) GetBalance(coin, addr string) (*sdk.Coin, error)
- func (c *CosmosClient) GetBlock(restURL string, height int64) (*BlockResponse, error)
- func (c *CosmosClient) GetBlockByHash(hash []byte) (*ctypes.ResultBlock, error)
- func (c *CosmosClient) GetHeaderByHash(hash []byte) (*ctypes.ResultHeader, error)
- func (c *CosmosClient) GetHeaderByHeight(height *int64) (*ctypes.ResultHeader, error)
- func (c *CosmosClient) GetTxByEvent(event []string, page, limit uint64) (*sdktx.GetTxsEventResponse, error)
- func (c *CosmosClient) GetTxByHash(restURL, hash string) (*TxResponse, error)
- func (c *CosmosClient) SendTx(fromAddr, toAddr, coin string, amount int64) (*banktypes.MsgSendResponse, error)
- func (c *CosmosClient) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)
- type DecodeTxRequest
- type DecodeTxResponse
- type TxEvent
- type TxEventAttribute
- type TxResponse
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 ChainAdaptor ¶
type ChainAdaptor struct {
// contains filtered or unexported fields
}
func (*ChainAdaptor) BuildSignedTransaction ¶
func (c *ChainAdaptor) BuildSignedTransaction(req *account.SignedTransactionRequest) (*account.SignedTransactionResponse, error)
func (*ChainAdaptor) ConvertAddress ¶
func (c *ChainAdaptor) ConvertAddress(req *account.ConvertAddressRequest) (*account.ConvertAddressResponse, error)
func (*ChainAdaptor) CreateUnSignTransaction ¶
func (c *ChainAdaptor) CreateUnSignTransaction(req *account.UnSignTransactionRequest) (*account.UnSignTransactionResponse, error)
func (*ChainAdaptor) DecodeTransaction ¶
func (c *ChainAdaptor) DecodeTransaction(req *account.DecodeTransactionRequest) (*account.DecodeTransactionResponse, error)
func (*ChainAdaptor) GetAccount ¶
func (c *ChainAdaptor) GetAccount(req *account.AccountRequest) (*account.AccountResponse, error)
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 (c *ChainAdaptor) GetBlockByRange(req *account.BlockByRangeRequest) (*account.BlockByRangeResponse, error)
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 (c *ChainAdaptor) GetExtraData(req *account.ExtraDataRequest) (*account.ExtraDataResponse, error)
func (*ChainAdaptor) GetFee ¶
func (c *ChainAdaptor) GetFee(req *account.FeeRequest) (*account.FeeResponse, error)
func (*ChainAdaptor) GetSupportChains ¶
func (c *ChainAdaptor) GetSupportChains(req *account.SupportChainsRequest) (*account.SupportChainsResponse, error)
func (*ChainAdaptor) GetTxByAddress ¶
func (c *ChainAdaptor) GetTxByAddress(req *account.TxAddressRequest) (*account.TxAddressResponse, error)
func (*ChainAdaptor) GetTxByHash ¶
func (c *ChainAdaptor) GetTxByHash(req *account.TxHashRequest) (*account.TxHashResponse, error)
func (*ChainAdaptor) SendTx ¶
func (c *ChainAdaptor) SendTx(req *account.SendTxRequest) (*account.SendTxResponse, error)
func (*ChainAdaptor) ValidAddress ¶
func (c *ChainAdaptor) ValidAddress(req *account.ValidAddressRequest) (*account.ValidAddressResponse, error)
func (*ChainAdaptor) VerifySignedTransaction ¶
func (c *ChainAdaptor) VerifySignedTransaction(req *account.VerifyTransactionRequest) (*account.VerifyTransactionResponse, error)
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) GetBlock ¶
func (c *CosmosClient) GetBlock(restURL string, height int64) (*BlockResponse, error)
https://cosmos-rest.publicnode.com/cosmos/tx/v1beta1/txs/block/22879895
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)
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 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"` }
Click to show internal directories.
Click to hide internal directories.