node

package
v0.0.0-...-8700dda Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EthClient

type EthClient interface {
	//BlockHeaderByNumber 通过块儿id获取块儿头信息
	BlockHeaderByNumber(context.Context, *big.Int) (*types.Header, error)
	//BlockByNumber 通过块儿id获取块儿信息
	BlockByNumber(context.Context, *big.Int) (*WalletTypes.RpcBlock, error)
	//SafeBlockHeaderByNumber 最新Safe块儿的头信息
	SafeBlockHeaderByNumber(context.Context) (*types.Header, error)
	FinalizedBlockHeaderByNumber(context.Context) (*types.Header, error)
	BlockHeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	BlockHeadersByRange(ctx context.Context, start *big.Int, end *big.Int, chainId uint) ([]types.Header, error)

	TxByHash(context.Context, common.Hash) (*types.Transaction, error)
	TxReceiptByHash(context.Context, common.Hash) (*types.Receipt, error)
	// StorageHash 获取指定账户地址在特定区块的 存储根哈希值用于验证账户存储数据的完整性
	StorageHash(context.Context, common.Address, *big.Int) (common.Hash, error)
	// GetAddressNonce 获取地址的nonce
	GetAddressNonce(ctx context.Context, address common.Address) (hexutil.Uint64, error)
	// SendRawTransaction 发送交易到链上
	SendRawTransaction(ctx context.Context, rawTx string) error

	// 合约事件的监听
	FilterLogs(filterQuery ethereum.FilterQuery, chainID *big.Int) (WalletTypes.Logs, error)

	// gasPrice获取
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	// 获取当前网络上建议的 优先费
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)
}

func DailEthClient

func DailEthClient(ctx context.Context, rpcUrl string) (EthClient, error)

type RPC

type RPC interface {
	Close()
	CallContext(ctx context.Context, result any, method string, args ...any) error
	BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
}

func NewRPC

func NewRPC(client *rpc.Client) RPC

Jump to

Keyboard shortcuts

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