Documentation ¶
Index ¶
- Constants
- Variables
- type BatchCallClient
- type ChainInterface
- type ClientInterface
- type ClientWithFallback
- func (c *ClientWithFallback) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *ClientWithFallback) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (c *ClientWithFallback) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (c *ClientWithFallback) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (c *ClientWithFallback) BlockNumber(ctx context.Context) (uint64, error)
- func (c *ClientWithFallback) CallBlockHashByTransaction(ctx context.Context, blockNumber *big.Int, index uint) (common.Hash, error)
- func (c *ClientWithFallback) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
- func (c *ClientWithFallback) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *ClientWithFallback) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
- func (c *ClientWithFallback) Close()
- func (c *ClientWithFallback) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *ClientWithFallback) DeepCopyTag() Tagger
- func (c *ClientWithFallback) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (c *ClientWithFallback) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (*ethereum.FeeHistory, error)
- func (c *ClientWithFallback) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
- func (c *ClientWithFallback) GetBaseFeeFromBlock(ctx context.Context, blockNumber *big.Int) (string, error)
- func (c *ClientWithFallback) GetLimiter() RequestLimiter
- func (c *ClientWithFallback) GetWalletNotifier() func(chainId uint64, message string)
- func (c *ClientWithFallback) GroupTag() string
- func (c *ClientWithFallback) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (c *ClientWithFallback) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (c *ClientWithFallback) IsConnected() bool
- func (c *ClientWithFallback) NetworkID() uint64
- func (c *ClientWithFallback) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (c *ClientWithFallback) PeerCount(ctx context.Context) (uint64, error)
- func (c *ClientWithFallback) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (c *ClientWithFallback) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
- func (c *ClientWithFallback) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *ClientWithFallback) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *ClientWithFallback) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (c *ClientWithFallback) PendingTransactionCount(ctx context.Context) (uint, error)
- func (c *ClientWithFallback) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (c *ClientWithFallback) SetGroupTag(tag string)
- func (c *ClientWithFallback) SetIsConnected(value bool)
- func (c *ClientWithFallback) SetLimiter(limiter RequestLimiter)
- func (c *ClientWithFallback) SetTag(tag string)
- func (c *ClientWithFallback) SetWalletNotifier(notifier func(chainId uint64, message string))
- func (c *ClientWithFallback) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (c *ClientWithFallback) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)
- func (c *ClientWithFallback) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (c *ClientWithFallback) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *ClientWithFallback) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (c *ClientWithFallback) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (c *ClientWithFallback) Tag() string
- func (c *ClientWithFallback) ToBigInt() *big.Int
- func (c *ClientWithFallback) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)
- func (c *ClientWithFallback) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (c *ClientWithFallback) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (c *ClientWithFallback) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (c *ClientWithFallback) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
- type EthClient
- type FullTransaction
- type InMemRequestsMapStorage
- type LimitData
- type LimitsDBStorage
- type LimitsStorage
- type RPCLimiterDB
- type RPCRequestLimiter
- type RPCRpsLimiter
- type RequestLimiter
- type Tagger
- type TxExtraInfo
Constants ¶
const (
LimitInfinitely = 0
)
Variables ¶
var (
ErrRequestsOverLimit = errors.New("number of requests over limit")
)
Functions ¶
This section is empty.
Types ¶
type BatchCallClient ¶ added in v0.167.2
type ChainInterface ¶ added in v0.179.24
type ChainInterface interface { BatchCallClient 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 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) }
type ClientInterface ¶ added in v0.166.1
type ClientInterface interface { ChainInterface GetWalletNotifier() func(chainId uint64, message string) SetWalletNotifier(notifier func(chainId uint64, message string)) connection.Connectable bind.ContractCaller bind.ContractTransactor bind.ContractFilterer GetLimiter() RequestLimiter SetLimiter(RequestLimiter) }
func ClientWithTag ¶ added in v0.179.24
func ClientWithTag(chainClient ClientInterface, tag, groupTag string) ClientInterface
Shallow copy of the client with a deep copy of tag and group tag To avoid passing tags as parameter to every chain call, it is sufficient for now to set the tag and group tag once on the client
type ClientWithFallback ¶
type ClientWithFallback struct { ChainID uint64 WalletNotifier func(chainId uint64, message string) LastCheckedAt int64 // contains filtered or unexported fields }
func NewClient ¶
func NewClient(ethClients []*EthClient, chainID uint64) *ClientWithFallback
func NewSimpleClient ¶
func NewSimpleClient(ethClient EthClient, chainID uint64) *ClientWithFallback
func (*ClientWithFallback) BatchCallContext ¶ added in v0.166.1
func (*ClientWithFallback) BlockByHash ¶
func (*ClientWithFallback) BlockByNumber ¶
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 (*ClientWithFallback) CallContractAtHash ¶
func (*ClientWithFallback) Close ¶
func (c *ClientWithFallback) Close()
func (*ClientWithFallback) DeepCopyTag ¶ added in v0.179.24
func (c *ClientWithFallback) DeepCopyTag() Tagger
func (*ClientWithFallback) EstimateGas ¶
func (c *ClientWithFallback) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
func (*ClientWithFallback) FeeHistory ¶
func (*ClientWithFallback) FilterLogs ¶
func (*ClientWithFallback) GetBaseFeeFromBlock ¶
func (*ClientWithFallback) GetLimiter ¶ added in v0.179.24
func (c *ClientWithFallback) GetLimiter() RequestLimiter
func (*ClientWithFallback) GetWalletNotifier ¶ added in v0.167.5
func (c *ClientWithFallback) GetWalletNotifier() func(chainId uint64, message string)
func (*ClientWithFallback) GroupTag ¶ added in v0.179.24
func (c *ClientWithFallback) GroupTag() string
func (*ClientWithFallback) HeaderByHash ¶
func (*ClientWithFallback) HeaderByNumber ¶
func (*ClientWithFallback) IsConnected ¶
func (c *ClientWithFallback) IsConnected() bool
func (*ClientWithFallback) NetworkID ¶
func (c *ClientWithFallback) NetworkID() uint64
func (*ClientWithFallback) PeerCount ¶
func (c *ClientWithFallback) PeerCount(ctx context.Context) (uint64, error)
func (*ClientWithFallback) PendingBalanceAt ¶
func (*ClientWithFallback) PendingCallContract ¶
func (c *ClientWithFallback) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
func (*ClientWithFallback) PendingCodeAt ¶
func (*ClientWithFallback) PendingNonceAt ¶
func (*ClientWithFallback) PendingStorageAt ¶
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) SetGroupTag ¶ added in v0.179.24
func (c *ClientWithFallback) SetGroupTag(tag string)
func (*ClientWithFallback) SetIsConnected ¶ added in v0.142.9
func (c *ClientWithFallback) SetIsConnected(value bool)
func (*ClientWithFallback) SetLimiter ¶ added in v0.179.24
func (c *ClientWithFallback) SetLimiter(limiter RequestLimiter)
func (*ClientWithFallback) SetTag ¶ added in v0.179.24
func (c *ClientWithFallback) SetTag(tag string)
func (*ClientWithFallback) SetWalletNotifier ¶ added in v0.167.5
func (c *ClientWithFallback) SetWalletNotifier(notifier func(chainId uint64, message string))
func (*ClientWithFallback) SubscribeFilterLogs ¶
func (*ClientWithFallback) SubscribeNewHead ¶
func (*ClientWithFallback) SuggestGasPrice ¶
func (*ClientWithFallback) SuggestGasTipCap ¶
func (*ClientWithFallback) SyncProgress ¶
func (c *ClientWithFallback) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
func (*ClientWithFallback) Tag ¶ added in v0.179.24
func (c *ClientWithFallback) Tag() string
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 (*ClientWithFallback) TransactionInBlock ¶
func (c *ClientWithFallback) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
func (*ClientWithFallback) TransactionReceipt ¶
func (*ClientWithFallback) TransactionSender ¶
type EthClient ¶ added in v0.181.34
type EthClient struct {
// contains filtered or unexported fields
}
func NewEthClient ¶ added in v0.181.34
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 InMemRequestsMapStorage ¶ added in v0.179.24
type InMemRequestsMapStorage struct {
// contains filtered or unexported fields
}
func NewInMemRequestsMapStorage ¶ added in v0.179.24
func NewInMemRequestsMapStorage() *InMemRequestsMapStorage
func (*InMemRequestsMapStorage) Delete ¶ added in v0.180.31
func (s *InMemRequestsMapStorage) Delete(tag string) error
func (*InMemRequestsMapStorage) Get ¶ added in v0.179.24
func (s *InMemRequestsMapStorage) Get(tag string) (*LimitData, error)
func (*InMemRequestsMapStorage) Set ¶ added in v0.179.24
func (s *InMemRequestsMapStorage) Set(data *LimitData) error
type LimitsDBStorage ¶ added in v0.179.24
type LimitsDBStorage struct {
// contains filtered or unexported fields
}
func NewLimitsDBStorage ¶ added in v0.179.24
func NewLimitsDBStorage(db *sql.DB) *LimitsDBStorage
func (*LimitsDBStorage) Delete ¶ added in v0.180.31
func (s *LimitsDBStorage) Delete(tag string) error
func (*LimitsDBStorage) Get ¶ added in v0.179.24
func (s *LimitsDBStorage) Get(tag string) (*LimitData, error)
func (*LimitsDBStorage) Set ¶ added in v0.179.24
func (s *LimitsDBStorage) Set(data *LimitData) error
type LimitsStorage ¶ added in v0.179.24
type RPCLimiterDB ¶ added in v0.179.24
type RPCLimiterDB struct {
// contains filtered or unexported fields
}
func NewRPCLimiterDB ¶ added in v0.179.24
func NewRPCLimiterDB(db *sql.DB) *RPCLimiterDB
func (*RPCLimiterDB) CreateRPCLimit ¶ added in v0.179.24
func (r *RPCLimiterDB) CreateRPCLimit(limit LimitData) error
func (*RPCLimiterDB) DeleteRPCLimit ¶ added in v0.179.24
func (r *RPCLimiterDB) DeleteRPCLimit(tag string) error
func (*RPCLimiterDB) GetRPCLimit ¶ added in v0.179.24
func (r *RPCLimiterDB) GetRPCLimit(tag string) (*LimitData, error)
func (*RPCLimiterDB) UpdateRPCLimit ¶ added in v0.179.24
func (r *RPCLimiterDB) UpdateRPCLimit(limit LimitData) error
type RPCRequestLimiter ¶ added in v0.179.24
type RPCRequestLimiter struct {
// contains filtered or unexported fields
}
func NewRequestLimiter ¶ added in v0.179.24
func NewRequestLimiter(storage LimitsStorage) *RPCRequestLimiter
func (*RPCRequestLimiter) Allow ¶ added in v0.179.24
func (rl *RPCRequestLimiter) Allow(tag string) (bool, error)
func (*RPCRequestLimiter) DeleteLimit ¶ added in v0.180.31
func (rl *RPCRequestLimiter) DeleteLimit(tag string) error
type RPCRpsLimiter ¶ added in v0.179.24
type RPCRpsLimiter struct {
// contains filtered or unexported fields
}
func NewRPCRpsLimiter ¶ added in v0.179.24
func NewRPCRpsLimiter() *RPCRpsLimiter
func (*RPCRpsLimiter) ReduceLimit ¶ added in v0.179.24
func (rl *RPCRpsLimiter) ReduceLimit()
func (*RPCRpsLimiter) Stop ¶ added in v0.179.24
func (rl *RPCRpsLimiter) Stop()
func (*RPCRpsLimiter) WaitForRequestsAvailability ¶ added in v0.179.24
func (rl *RPCRpsLimiter) WaitForRequestsAvailability(requests int) error