ethereum

package
v0.0.0-...-eb609b0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const ChainName = "Ethereum"

Variables

This section is empty.

Functions

func IsURLAvailable

func IsURLAvailable(address string) bool

func NewChainAdaptor

func NewChainAdaptor(conf *config.Config) (chain.IChainAdaptor, error)

Types

type ChainAdaptor

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

func (ChainAdaptor) BuildSignedTransaction

func (ChainAdaptor) ConvertAddress

func (ChainAdaptor) CreateUnSignTransaction

func (ChainAdaptor) DecodeTransaction

func (ChainAdaptor) GetAccount

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 (*ChainAdaptor) GetBlockHeaderByHash

func (c *ChainAdaptor) GetBlockHeaderByHash(req *account.BlockHeaderHashRequest) (*account.BlockHeaderResponse, error)

func (ChainAdaptor) GetBlockHeaderByNumber

func (ChainAdaptor) GetExtraData

func (ChainAdaptor) GetFee

func (ChainAdaptor) GetSupportChains

func (ChainAdaptor) GetTxByAddress

func (ChainAdaptor) GetTxByHash

func (ChainAdaptor) SendTx

func (ChainAdaptor) ValidAddress

func (ChainAdaptor) VerifySignedTransaction

type EthClient

type EthClient interface {
	BlockHeaderByNumber(*big.Int) (*types.Header, error)

	BlockByNumber(*big.Int) (*RpcBlock, error)
	BlockByHash(common.Hash) (*RpcBlock, error)
	LatestSafeBlockHeader() (*types.Header, error)
	LatestFinalizedBlockHeader() (*types.Header, error)
	BlockHeaderByHash(common.Hash) (*types.Header, error)
	BlockHeadersByRange(*big.Int, *big.Int, uint) ([]types.Header, error)

	TxByHash(common.Hash) (*types.Transaction, error)
	TxReceiptByHash(common.Hash) (*types.Receipt, error)

	StorageHash(common.Address, *big.Int) (common.Hash, error)
	FilterLogs(filterQuery ethereum.FilterQuery, chainId uint) (Logs, error)

	TxCountByAddress(common.Address) (hexutil.Uint64, error)

	SendRawTransaction(rawTx string) error

	SuggestGasPrice() (*big.Int, error)
	SuggestGasTipCap() (*big.Int, error)

	Close()
}

func DialEthClient

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

创建以太坊客户端

type EthData

type EthData struct {
	EthDataCli *etherscan.ChainExplorerAdaptor
}

func NewEthDataClient

func NewEthDataClient(baseUrl, apiKey string, timeout time.Duration) (*EthData, error)

func (*EthData) GetTxByAddress

func (ss *EthData) GetTxByAddress(page, pagesize uint64, address string, action account.ActionType) (*account.TransactionResponse[account.AccountTxResponse], error)

type Logs

type Logs struct {
	Logs          []types.Log
	ToBlockHeader *types.Header
}

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

type RpcBlock

type RpcBlock struct {
	Hash         common.Hash       `json:"hash"`
	Transactions []TransactionList `json:"transactions"`
	BaseFee      string            `json:"baseFeePerGas"`
}

type TransactionList

type TransactionList struct {
	To   string `json:"to"`
	Hash string `json:"hash"`
}

Jump to

Keyboard shortcuts

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