client

package
v0.0.0-...-dcc78f7 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChunkSize defines the chuck size to get balances from geth
	ChunkSize = 1000
)

Variables

View Source
var (
	ErrInvalidTDFormat = errors.New("invalid td format")
)

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	// BalanceOf returns the balances of ETH and multiple erc20 tokens for multiple accounts
	BalanceOf(context.Context, ethCommon.Hash, map[ethCommon.Address]map[ethCommon.Address]*big.Int) error
}

Balancer is a wrapper interface to batch get balances

type EthClient

type EthClient interface {
	Balancer

	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	UncleByBlockHashAndPosition(ctx context.Context, hash common.Hash, position uint) (*types.Header, error)
	UnclesByBlockHash(ctx context.Context, blockHash common.Hash) ([]*types.Header, error)
	GetERC20(ctx context.Context, addr common.Address) (*model.ERC20, error)
	GetTotalDifficulty(ctx context.Context, hash common.Hash) (*big.Int, error)
	GetBlockReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)
	// Get ETH transfer logs
	GetTransferLogs(ctx context.Context, hash common.Hash) ([]*types.TransferLog, error)
	BatchBalanceAt(ctx context.Context, accounts []common.Address, blockHash common.Hash) ([]*big.Int, error)
	BatchCallContract(ctx context.Context, msgs []*ethereum.CallMsg, blockHash common.Hash) ([][]byte, error)
	Close()
}

func NewClient

func NewClient(c *rpc.Client) EthClient

type Subscriber

type Subscriber interface {
	RPCClients() []*rpc.Client
	SubscribeNewHead(ctx context.Context, ch chan<- *multiclient.Header) (ethereum.Subscription, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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