common

package
v0.0.0-...-9b21dcb Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateGas

func EstimateGas(ctx *gin.Context, msg any) (uint64, error)

func Fail

func Fail(ctx *gin.Context, data gin.H, msg string)

func GetBalanceAt

func GetBalanceAt(ctx *gin.Context, address string, blockNumber *big.Int) (*big.Int, error)

func GetBlockByNumber

func GetBlockByNumber(ctx *gin.Context, number *big.Int) (any, error)

func GetBlockNumber

func GetBlockNumber(ctx *gin.Context) (uint64, error)

func GetEIP155RawTx

func GetEIP155RawTx(ctx *gin.Context, gas uint64, private, to string, value *big.Int) (string, error)

func GetEIP155SignedTx

func GetEIP155SignedTx(ctx *gin.Context, gas uint64, private, to string, value *big.Int) (*types.Transaction, error)

func GetEIP155SignedTxData

func GetEIP155SignedTxData(ctx *gin.Context, gas uint64, private, to string, value *big.Int) (string, error)

func GetGasPrice

func GetGasPrice(ctx *gin.Context) (*big.Int, error)

func GetNonceAt

func GetNonceAt(ctx *gin.Context, address string, blockNumber *big.Int) (uint64, error)

func GetPendingNonceAt

func GetPendingNonceAt(ctx *gin.Context, address string) (uint64, error)

func GetReceiptByHash

func GetReceiptByHash(ctx *gin.Context, txHash string) (receipt any, err error)

func GetTransactionByHash

func GetTransactionByHash(ctx *gin.Context, txHash string) (tx any, isPending bool, err error)

func Response

func Response(ctx *gin.Context, httpStatus int, code int, data gin.H, msg string)

func SendRawedTransaction

func SendRawedTransaction(ctx *gin.Context, rawTx string, tx *types.Transaction) error

func SendSignedTransaction

func SendSignedTransaction(ctx *gin.Context, sign string, tx *types.Transaction) error

func Success

func Success(ctx *gin.Context, data gin.H, msg string)

Types

type EvmClient

type EvmClient interface {
	BlockNumber(ctx context.Context) (uint64, error)
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	BalanceAt(ctx context.Context, account string, blockNumber *big.Int) (*big.Int, error)
	NonceAt(ctx context.Context, account string, blockNumber *big.Int) (uint64, error)
	PendingNonceAt(ctx context.Context, account string) (uint64, error)
	NetworkID(ctx context.Context) (*big.Int, error)
	EstimateGas(ctx context.Context, msg any) (uint64, error)
	SendTransaction(ctx context.Context, tx any) error
	BlockByNumber(ctx context.Context, number *big.Int) (any, error)
	TransactionByHash(ctx context.Context, txHash string) (tx any, isPending bool, err error)
	TransactionReceipt(ctx context.Context, txHash string) (any, error)
}

type EvmClientImpl

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

func NewEVMClient

func NewEVMClient(url string) (*EvmClientImpl, error)

func (*EvmClientImpl) BalanceAt

func (c *EvmClientImpl) BalanceAt(ctx context.Context, address string, blockNumber *big.Int) (*big.Int, error)

func (*EvmClientImpl) BlockByNumber

func (c *EvmClientImpl) BlockByNumber(ctx context.Context, number *big.Int) (interface{}, error)

func (*EvmClientImpl) BlockNumber

func (c *EvmClientImpl) BlockNumber(ctx context.Context) (uint64, error)

func (*EvmClientImpl) EstimateGas

func (c *EvmClientImpl) EstimateGas(ctx context.Context, msg any) (uint64, error)

func (*EvmClientImpl) NetworkID

func (c *EvmClientImpl) NetworkID(ctx context.Context) (*big.Int, error)

func (*EvmClientImpl) NonceAt

func (c *EvmClientImpl) NonceAt(ctx context.Context, address string, blockNumber *big.Int) (uint64, error)

func (*EvmClientImpl) PendingNonceAt

func (c *EvmClientImpl) PendingNonceAt(ctx context.Context, address string) (uint64, error)

func (*EvmClientImpl) SendTransaction

func (c *EvmClientImpl) SendTransaction(ctx context.Context, tx any) error

func (*EvmClientImpl) SuggestGasPrice

func (c *EvmClientImpl) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*EvmClientImpl) TransactionByHash

func (c *EvmClientImpl) TransactionByHash(ctx context.Context, txHash string) (tx any, isPending bool, err error)

func (*EvmClientImpl) TransactionReceipt

func (c *EvmClientImpl) TransactionReceipt(ctx context.Context, txHash string) (any, error)

type ResponseMsg

type ResponseMsg struct {
	Code int    `json:"code"`
	Data any    `json:"data"`
	Msg  string `json:"msg"`
}

Jump to

Keyboard shortcuts

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