service

package
v0.0.0-...-a79b478 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS = 0
	FAIL    = 1
)

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)
	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) (string, error)
	GetBlockByNumber(chainCode int64, number string) (string, error)
	GetTxByHash(chainCode int64, hash string) (string, error)
	SendJsonRpc(chainCode int64, req string) (string, error)
}

func NewEth

func NewEth(cluster map[int64][]*config.NodeCluster, xlog *xlog.XLog) API

func NewTron

func NewTron(cluster map[int64][]*config.NodeCluster, xlog *xlog.XLog) API

type Ether

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

func (*Ether) Balance

func (e *Ether) Balance(chainCode int64, address string, tag string) (string, error)

func (*Ether) BalanceCluster

func (e *Ether) BalanceCluster(blockChain int64) *config.NodeCluster

func (*Ether) GetBlockByHash

func (e *Ether) GetBlockByHash(chainCode int64, hash string) (string, error)

func (*Ether) GetBlockByNumber

func (e *Ether) GetBlockByNumber(chainCode int64, number string) (string, error)

func (*Ether) GetTxByHash

func (e *Ether) GetTxByHash(chainCode int64, hash string) (string, error)

func (*Ether) LatestBlock

func (e *Ether) LatestBlock(chainCode int64) (string, error)

func (*Ether) Nonce

func (e *Ether) Nonce(chainCode int64, address string, tag string) (string, error)

func (*Ether) SendEthReq

func (e *Ether) SendEthReq(blockChain int64, reqBody string) (string, error)

func (*Ether) SendJsonRpc

func (e *Ether) SendJsonRpc(chainCode int64, req string) (string, error)

func (*Ether) SendRawTransaction

func (e *Ether) SendRawTransaction(chainCode int64, signedTx string) (string, error)

func (*Ether) TokenBalance

func (e *Ether) TokenBalance(chainCode int64, address string, contractAddr string, abi string) (string, error)

type HttpHandler

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

func NewHttpHandler

func NewHttpHandler(cluster map[int64][]*config.NodeCluster, xlog *xlog.XLog) *HttpHandler

func (*HttpHandler) Error

func (h *HttpHandler) Error(c *gin.Context, req string, path string, err string)

func (*HttpHandler) GetBalance

func (h *HttpHandler) GetBalance(ctx *gin.Context)

func (*HttpHandler) GetBlockByHash

func (h *HttpHandler) GetBlockByHash(ctx *gin.Context)

func (*HttpHandler) GetBlockByNumber

func (h *HttpHandler) GetBlockByNumber(ctx *gin.Context)

func (*HttpHandler) GetLatestBlock

func (h *HttpHandler) GetLatestBlock(ctx *gin.Context)

func (*HttpHandler) GetNonce

func (h *HttpHandler) GetNonce(ctx *gin.Context)

GetNonce todo 仅适用于 ether,tron 暂不支持

func (*HttpHandler) GetTokenBalance

func (h *HttpHandler) GetTokenBalance(ctx *gin.Context)

GetTokenBalance ERC20协议代币余额,后期补充

func (*HttpHandler) GetTxByHash

func (h *HttpHandler) GetTxByHash(ctx *gin.Context)

func (*HttpHandler) HandlerReq

func (h *HttpHandler) HandlerReq(ctx *gin.Context)

HandlerReq 有用户自定义请求内容,然后直接发送到节点 ,和eth_call 函数无关

func (*HttpHandler) SendRawTx

func (h *HttpHandler) SendRawTx(ctx *gin.Context)

func (*HttpHandler) Success

func (h *HttpHandler) Success(c *gin.Context, req string, resp interface{}, path string)

type Tron

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

func (*Tron) Balance

func (t *Tron) Balance(chainCode int64, address string, tag string) (string, error)

func (*Tron) BalanceCluster

func (t *Tron) BalanceCluster(blockChain int64) *config.NodeCluster

func (*Tron) GetBlockByHash

func (t *Tron) GetBlockByHash(chainCode int64, hash string) (string, error)

func (*Tron) GetBlockByNumber

func (t *Tron) GetBlockByNumber(chainCode int64, number string) (string, error)

func (*Tron) GetTxByHash

func (t *Tron) GetTxByHash(chainCode int64, hash string) (string, error)

func (*Tron) LatestBlock

func (t *Tron) LatestBlock(chainCode int64) (string, error)

func (*Tron) Nonce

func (t *Tron) Nonce(chainCode int64, address string, tag string) (string, error)

func (*Tron) SendJsonRpc

func (t *Tron) SendJsonRpc(chainCode int64, req string) (string, error)

func (*Tron) SendRawTransaction

func (t *Tron) SendRawTransaction(chainCode int64, signedTx string) (string, error)

func (*Tron) SendReq

func (t *Tron) SendReq(blockChain int64, reqBody string, url string) (string, error)

func (*Tron) TokenBalance

func (t *Tron) TokenBalance(chainCode int64, address string, contractAddr string, abi string) (string, error)

type WsHandler

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

func NewWsHandler

func NewWsHandler(cluster map[int64][]*config.NodeCluster, xlog *xlog.XLog) *WsHandler

func (*WsHandler) Start

func (s *WsHandler) Start(w http.ResponseWriter, r *http.Request)

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{}
}

Jump to

Keyboard shortcuts

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