chain

package
v0.179.11 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestsOverLimit = fmt.Errorf("number of requests over limit")
)

Functions

This section is empty.

Types

type BatchCallClient added in v0.167.2

type BatchCallClient interface {
	BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
}

type ClientInterface added in v0.166.1

type ClientInterface interface {
	BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	CallBlockHashByTransaction(ctx context.Context, blockNumber *big.Int, index uint) (common.Hash, error)
	GetBaseFeeFromBlock(ctx context.Context, blockNumber *big.Int) (string, error)
	NetworkID() uint64
	ToBigInt() *big.Int
	CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
	CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
	GetWalletNotifier() func(chainId uint64, message string)
	SetWalletNotifier(notifier func(chainId uint64, message string))
	TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
	BlockNumber(ctx context.Context) (uint64, error)
	SetIsConnected(value bool)
	GetIsConnected() bool
	bind.ContractCaller
	bind.ContractTransactor
	bind.ContractFilterer
}

type ClientWithFallback

type ClientWithFallback struct {
	ChainID uint64

	WalletNotifier func(chainId uint64, message string)

	IsConnected     bool
	IsConnectedLock sync.RWMutex
	LastCheckedAt   int64
	// contains filtered or unexported fields
}

func NewClient

func NewClient(mainLimiter *RPCLimiter, main *rpc.Client, fallbackLimiter *RPCLimiter, fallback *rpc.Client, chainID uint64) *ClientWithFallback

func NewSimpleClient

func NewSimpleClient(mainLimiter *RPCLimiter, main *rpc.Client, chainID uint64) *ClientWithFallback

func (*ClientWithFallback) BalanceAt

func (c *ClientWithFallback) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)

func (*ClientWithFallback) BatchCallContext added in v0.166.1

func (c *ClientWithFallback) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error

func (*ClientWithFallback) BlockByHash

func (c *ClientWithFallback) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*ClientWithFallback) BlockByNumber

func (c *ClientWithFallback) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*ClientWithFallback) BlockNumber

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

func (*ClientWithFallback) CallBlockHashByTransaction added in v0.175.3

func (c *ClientWithFallback) CallBlockHashByTransaction(ctx context.Context, blockNumber *big.Int, index uint) (common.Hash, error)

go-ethereum's `Transaction` items drop the blkHash obtained during the RPC call. This function preserves the additional data. This is the cheapest way to obtain the block hash for a given block number.

func (*ClientWithFallback) CallContext

func (c *ClientWithFallback) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error

func (*ClientWithFallback) CallContract

func (c *ClientWithFallback) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)

func (*ClientWithFallback) CallContractAtHash

func (c *ClientWithFallback) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)

func (*ClientWithFallback) Close

func (c *ClientWithFallback) Close()

func (*ClientWithFallback) CodeAt

func (c *ClientWithFallback) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*ClientWithFallback) EstimateGas

func (c *ClientWithFallback) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

func (*ClientWithFallback) FeeHistory

func (c *ClientWithFallback) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)

func (*ClientWithFallback) FilterLogs

func (c *ClientWithFallback) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)

func (*ClientWithFallback) GetBaseFeeFromBlock

func (c *ClientWithFallback) GetBaseFeeFromBlock(ctx context.Context, blockNumber *big.Int) (string, error)

func (*ClientWithFallback) GetIsConnected added in v0.167.5

func (c *ClientWithFallback) GetIsConnected() bool

func (*ClientWithFallback) GetWalletNotifier added in v0.167.5

func (c *ClientWithFallback) GetWalletNotifier() func(chainId uint64, message string)

func (*ClientWithFallback) HeaderByHash

func (c *ClientWithFallback) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*ClientWithFallback) HeaderByNumber

func (c *ClientWithFallback) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*ClientWithFallback) NetworkID

func (c *ClientWithFallback) NetworkID() uint64

func (*ClientWithFallback) NonceAt

func (c *ClientWithFallback) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)

func (*ClientWithFallback) PeerCount

func (c *ClientWithFallback) PeerCount(ctx context.Context) (uint64, error)

func (*ClientWithFallback) PendingBalanceAt

func (c *ClientWithFallback) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

func (*ClientWithFallback) PendingCallContract

func (c *ClientWithFallback) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

func (*ClientWithFallback) PendingCodeAt

func (c *ClientWithFallback) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

func (*ClientWithFallback) PendingNonceAt

func (c *ClientWithFallback) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*ClientWithFallback) PendingStorageAt

func (c *ClientWithFallback) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)

func (*ClientWithFallback) PendingTransactionCount

func (c *ClientWithFallback) PendingTransactionCount(ctx context.Context) (uint, error)

func (*ClientWithFallback) SendTransaction

func (c *ClientWithFallback) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*ClientWithFallback) SetIsConnected added in v0.142.9

func (c *ClientWithFallback) SetIsConnected(value bool)

func (*ClientWithFallback) SetWalletNotifier added in v0.167.5

func (c *ClientWithFallback) SetWalletNotifier(notifier func(chainId uint64, message string))

func (*ClientWithFallback) StorageAt

func (c *ClientWithFallback) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)

func (*ClientWithFallback) SubscribeFilterLogs

func (c *ClientWithFallback) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*ClientWithFallback) SubscribeNewHead

func (c *ClientWithFallback) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

func (*ClientWithFallback) SuggestGasPrice

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

func (*ClientWithFallback) SuggestGasTipCap

func (c *ClientWithFallback) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

func (*ClientWithFallback) SyncProgress

func (c *ClientWithFallback) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

func (*ClientWithFallback) ToBigInt

func (c *ClientWithFallback) ToBigInt() *big.Int

func (*ClientWithFallback) TransactionByHash

func (c *ClientWithFallback) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)

func (*ClientWithFallback) TransactionCount

func (c *ClientWithFallback) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

func (*ClientWithFallback) TransactionInBlock

func (c *ClientWithFallback) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)

func (*ClientWithFallback) TransactionReceipt

func (c *ClientWithFallback) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*ClientWithFallback) TransactionSender

func (c *ClientWithFallback) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)

type CommandResult added in v0.142.2

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

type FullTransaction added in v0.156.1

type FullTransaction struct {
	Tx *types.Transaction
	TxExtraInfo
}

The code below is mostly copied from go-ethereum/ethclient (see TransactionInBlock), to keep the exact same behavior as the normal Transaction items, but exposing the additional data obtained in the `rpcTransaction` struct`. Unfortunately, the functions and classes used are not exposed outside of the package.

func (*FullTransaction) UnmarshalJSON added in v0.156.1

func (tx *FullTransaction) UnmarshalJSON(msg []byte) error

type RPCLimiter added in v0.176.3

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

func NewRPCLimiter added in v0.176.3

func NewRPCLimiter() *RPCLimiter

func (*RPCLimiter) ReduceLimit added in v0.176.3

func (rl *RPCLimiter) ReduceLimit()

func (*RPCLimiter) Stop added in v0.176.3

func (rl *RPCLimiter) Stop()

func (*RPCLimiter) WaitForRequestsAvailability added in v0.176.3

func (rl *RPCLimiter) WaitForRequestsAvailability(requests int) error

type TxExtraInfo added in v0.156.1

type TxExtraInfo struct {
	BlockNumber *hexutil.Big    `json:"blockNumber,omitempty"`
	BlockHash   *common.Hash    `json:"blockHash,omitempty"`
	From        *common.Address `json:"from,omitempty"`
}

Jump to

Keyboard shortcuts

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