blockchain

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Balance(chainCode int64, address string, tag string) (string, error)
	Token(chainCode int64, contractAddr string, abi string, eip string) (string, error)
	TokenBalance(chainCode int64, address string, contractAddr string, abi string) (string, error)
	Nonce(chainCode int64, address string, tag string) (string, error)
	LatestBlock(chainCode int64) (string, error)

	SendRawTransaction(chainCode int64, signedTx string) (string, error)

	GetBlockByHash(chainCode int64, hash string, flag bool) (string, error)
	GetBlockByNumber(chainCode int64, number string, flag bool) (string, error)
	GetTxByHash(chainCode int64, hash string) (string, error)

	SendJsonRpc(chainCode int64, req string) (string, error)

	GetBlockReceiptByBlockNumber(chainCode int64, number string) (string, error)
	GetBlockReceiptByBlockHash(chainCode int64, hash string) (string, error)
	GetTransactionReceiptByHash(chainCode int64, hash string) (string, error)

	SubscribePendingTx(chainCode int64, receiverCh chan string, sendCh chan string) (string, error)
	SubscribeLogs(chainCode int64, address string, topics []string, receiverCh chan string, sendCh chan string) (string, error)
	UnSubscribe(chainCode int64, subId string) (string, error)

	// GetAddressType 0x1:外部账户,0x2:合约地址
	GetAddressType(chainCode int64, address string) (string, error)
	GetCode(chainCode int64, address string) (string, error)

	StartWDT()
	MonitorCluster() any
}

type ChainCluster

type ChainCluster interface {
	BalanceCluster(trace bool) *config.NodeCluster
}

type ChainConn added in v0.5.1

type ChainConn interface {
	SendRequestToChain(host string, token string, query string) (string, error)
	SendRequestToChainByHttp(host string, token string, query string) (string, error)
	Subscribe(host string, token string) (string, error)
	UnSubscribe(host string, token string) (string, error)
	GetToken20(host string, token string, contractAddress string, userAddress string) (map[string]interface{}, error)
	GetToken20ByHttp(host string, token string, contractAddress string, userAddress string) (map[string]interface{}, error)
	GetToken721(host string, token string, contractAddress string, userAddress string) (map[string]interface{}, error)
	GetToken1155(host string, token string, contractAddress string, userAddress string) (map[string]interface{}, error)
}

type ChainNet

type ChainNet interface {
	SendReq(blockChain int64, reqBody string, trace bool) (string, error)
	SendReqByWs(blockChain int64, receiverCh chan string, sendCh chan string) (string, error)
}

type ExApi added in v0.5.3

type ExApi interface {
	GasPrice(chainCode int64) (string, error)
	TraceTransaction(chainCode int64, hash string) (string, error)
	EstimateGas(chainCode int64, from, to, data string) (string, error)
	EstimateGasForTron(chainCode int64, from, to, functionSelector, parameter string) (string, error)
	GetAccountResourceForTron(chainCode int64, address string) (string, error)
}

type InterTx added in v0.5.3

type InterTx struct {
	Result struct {
		Output  string `json:"output" gorm:"column:output"`
		GasUsed string `json:"gasUsed" gorm:"column:gasUsed"`
	} `json:"-" gorm:"column:result"`
	BlockHash           string `json:"blockHash" gorm:"column:blockHash"`
	TransactionPosition int    `json:"-" gorm:"column:transactionPosition"`
	BlockNumber         int    `json:"blockNumber" gorm:"column:blockNumber"`
	TraceAddress        []int  `json:"-" gorm:"column:traceAddress"`
	Action              struct {
		Input    string `json:"-" gorm:"column:input"`
		Gas      string `json:"gas" gorm:"column:gas"`
		From     string `json:"from" gorm:"column:from"`
		To       string `json:"to" gorm:"column:to"`
		Value    string `json:"value" gorm:"column:value"`
		CallType string `json:"callType" gorm:"column:callType"`
	} `json:"action" gorm:"column:action"`
	Type            string `json:"-" gorm:"column:type"`
	Subtraces       int    `json:"-" gorm:"column:subtraces"`
	TransactionHash string `json:"transactionHash" gorm:"column:transactionHash"`
}

type NFT added in v0.5.1

type NFT interface {
	TokenURI(host string, key string, contractAddress string, tokenId string, eip int64) (string, error)
	BalanceOf(host string, key string, contractAddress string, address string, tokenId string, eip int64) (string, error)
	OwnerOf(host string, key string, contractAddress string, tokenId string, eip int64) (string, error)
	TotalSupply(host string, key string, contractAddress string, eip int64) (string, error)
}

type NftApi added in v0.5.1

type NftApi interface {
	TokenURI(chainCode int64, contractAddress string, tokenId string, eip int64) (string, error)
	BalanceOf(chainCode int64, contractAddress string, address string, tokenId string, eip int64) (string, error)
	OwnerOf(chainCode int64, contractAddress string, tokenId string, eip int64) (string, error)
	TotalSupply(chainCode int64, contractAddress string, eip int64) (string, error)
}

type WsReqMessage

type WsReqMessage struct {
	Id     int64
	Code   int64
	Params map[string]string
}

type WsRespMessage

type WsRespMessage struct {
	Id     int64
	Code   int64
	Status int //0:成功 1:失败
	Err    string
	Params map[string]string
	Resp   interface{}
}

Directories

Path Synopsis
bnb
btc
xrp
bnb
btc
xrp

Jump to

Keyboard shortcuts

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