Documentation ¶
Overview ¶
Package client provides a common interface for eth-based clients used with chain It defines the minimum necessary methods to create a chain and implements a rate limiter and metrics around client usage- useful for monitoring and debugging.
Index ¶
- Constants
- Variables
- func ConfigFromID(id *big.Int) *params.ChainConfig
- func UsesLondon(config *params.ChainConfig, currentBlock uint64) bool
- type Config
- type EVMClient
- type LifecycleClient
- func (m LifecycleClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (balance *big.Int, err error)
- func (m LifecycleClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
- func (m LifecycleClient) BatchContext(ctx context.Context, calls ...w3types.Caller) error
- func (m LifecycleClient) BlockByHash(ctx context.Context, hash common.Hash) (block *types.Block, err error)
- func (m LifecycleClient) BlockByNumber(ctx context.Context, number *big.Int) (block *types.Block, err error)
- func (m LifecycleClient) BlockNumber(ctx context.Context) (_ uint64, err error)
- func (m LifecycleClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) (err error)
- func (m LifecycleClient) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) (contractResponse []byte, err error)
- func (m LifecycleClient) ChainConfig() *params.ChainConfig
- func (m LifecycleClient) ChainID(ctx context.Context) (chainID *big.Int, err error)
- func (m LifecycleClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) (codeAt []byte, err error)
- func (m LifecycleClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
- func (m LifecycleClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (*ethereum.FeeHistory, error)
- func (m LifecycleClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) (logs []types.Log, err error)
- func (m LifecycleClient) HeaderByHash(ctx context.Context, hash common.Hash) (header *types.Header, err error)
- func (m LifecycleClient) HeaderByNumber(ctx context.Context, number *big.Int) (header *types.Header, err error)
- func (m LifecycleClient) NetworkID(ctx context.Context) (id *big.Int, err error)
- func (m LifecycleClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (nonce uint64, err error)
- func (m LifecycleClient) PendingBalanceAt(ctx context.Context, account common.Address) (pendingBalance *big.Int, err error)
- func (m LifecycleClient) PendingCallContract(ctx context.Context, call ethereum.CallMsg) (contractResponse []byte, err error)
- func (m LifecycleClient) PendingCodeAt(ctx context.Context, account common.Address) (codeResponse []byte, err error)
- func (m LifecycleClient) PendingNonceAt(ctx context.Context, account common.Address) (pendingNonce uint64, err error)
- func (m LifecycleClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) (pendingStorage []byte, err error)
- func (m LifecycleClient) PendingTransactionCount(ctx context.Context) (count uint, err error)
- func (m LifecycleClient) SendTransaction(ctx context.Context, tx *types.Transaction) (err error)
- func (m LifecycleClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) (storage []byte, err error)
- func (m LifecycleClient) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (sub ethereum.Subscription, err error)
- func (m LifecycleClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (sub ethereum.Subscription, err error)
- func (m LifecycleClient) SuggestGasPrice(ctx context.Context) (gasPrice *big.Int, err error)
- func (m LifecycleClient) SuggestGasTipCap(ctx context.Context) (tip *big.Int, err error)
- func (m LifecycleClient) SyncProgress(ctx context.Context) (syncProgress *ethereum.SyncProgress, err error)
- func (m LifecycleClient) TransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (m LifecycleClient) TransactionCount(ctx context.Context, blockHash common.Hash) (txCount uint, err error)
- func (m LifecycleClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (tx *types.Transaction, err error)
- func (m LifecycleClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (receipt *types.Receipt, err error)
- type MeteredEVMClient
- type Permitter
Constants ¶
const ConcurrencyGaugeMetricName = "request_concurrency"
ConcurrencyGaugeMetricName is the name of the metric which gauges request concurrency.
const RequestCountMetricName = "request_count_total"
RequestCountMetricName is the name of the metric which counts requests.
Variables ¶
var ( // BSCChainConfig bsc mainnet config. BSCChainConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(56), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // ChapelChainConfig bsc testnet config. ChapelChainConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(97), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // RialtoChainConfig rial config. RialtoChainConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(1417), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // SimulatedConfig is the simulated config backend. SimulatedConfig = params.AllEthashProtocolChanges // MaticMumbaiConfig is the matic config. MaticMumbaiConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(80001), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // MaticMainnetConfig is the matic mainnet config. MaticMainnetConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(137), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // AvalancheMainnetChainConfig is the configuration for Avalanche Main Network // TODO: this and other avalanche configs should be imported directly from https://github.com/ava-labs/coreth/blob/master/params/config.go AvalancheMainnetChainConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(43114), HomesteadBlock: big.NewInt(0), DAOForkBlock: big.NewInt(0), DAOForkSupport: true, EIP150Block: big.NewInt(0), EIP150Hash: ethCommon.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), } // AvalancheLocalChainConfig is the configuration for the Avalanche Local Network. AvalancheLocalChainConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(43112), HomesteadBlock: big.NewInt(0), DAOForkBlock: big.NewInt(0), DAOForkSupport: true, EIP150Block: big.NewInt(0), EIP150Hash: ethCommon.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), BerlinBlock: big.NewInt(0), } // ArbitrumMainnetConfig is the arbitrum mainnet config. ArbitrumMainnetConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(42161), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // FtmMainnetConfig contains the fantom mainnet config. FtmMainnetConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(250), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // HarmonyConfig contains the chain config for harmony // note: this is shard 0 only HarmonyConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(1666600000), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // BobaConfig contains the chain config for boba. BobaConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(288), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // MoonBeamConfig contains the configuration for moonriver. MoonBeamConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(1284), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // MoonRiverConfig contains the configuration for moonriver. MoonRiverConfig = ¶ms.ChainConfig{ ChainID: big.NewInt(1285), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // OptimisticEthereum contains the configuration for optimism. OptimisticEthereum = ¶ms.ChainConfig{ ChainID: big.NewInt(10), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // AuroraMainnet contains the configuration for aurora. AuroraMainnet = ¶ms.ChainConfig{ ChainID: big.NewInt(1313161554), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // CronosMainnet is the cronos mainnet chain config. CronosMainnet = ¶ms.ChainConfig{ ChainID: big.NewInt(25), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // MetisMainnet is the metis mainnet config. MetisMainnet = ¶ms.ChainConfig{ ChainID: big.NewInt(1088), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: nil, } // DFKMainnet is the dfk mainnet contract. DFKMainnet = ¶ms.ChainConfig{ ChainID: big.NewInt(53935), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: big.NewInt(0), } // DFKTestnet is the dfk testnet config. DFKTestnet = ¶ms.ChainConfig{ ChainID: big.NewInt(335), HomesteadBlock: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: big.NewInt(0), PetersburgBlock: big.NewInt(0), IstanbulBlock: big.NewInt(0), MuirGlacierBlock: big.NewInt(0), LondonBlock: big.NewInt(0), } )
Functions ¶
func ConfigFromID ¶
func ConfigFromID(id *big.Int) *params.ChainConfig
ConfigFromID gets the chain config from the id.
func UsesLondon ¶
func UsesLondon(config *params.ChainConfig, currentBlock uint64) bool
UsesLondon termines whether or not a chain uses london.
Types ¶
type Config ¶
type Config struct { // RPCUrl is the rpc websocket url to use // note: this is called 'WSUrl' for historical reasons and will be updated in a future version RPCUrl []string `toml:"WSUrl"` // ChainID - name of the current chain ChainID int `toml:"ChainID"` // Type is the chain type Type string `toml:"Type"` // RequiredConfirmations is the number of confirmations required until // a block is considered "finalized" RequiredConfirmations uint `toml:"Confirmations"` // BridgeAddress is the address of the bridge on the chain BridgeAddress string `toml:"BridgeAddress"` // StartHeight is the start height for a given contract. This is a workaround for https://github.com/synapsecns/synapse-contracts/issues/20 // where in the start height is always returned as 0. This can be removed after version 6 of the contracts StartHeight uint64 `toml:"StartHeight"` *rate.LimiterConfig }
Config contains the configuration needed to connect to the chain.
func (*Config) GetEthBridgeAddress ¶
GetEthBridgeAddress gets the bridge address cast to a ethCommon.address.
func (*Config) SetEthBridgeAddress ¶
SetEthBridgeAddress mutates the config to set a bridge address.
type EVMClient ¶
type EVMClient interface { // ContractBackend defines the methods needed to work with contracts on a read-write basis. // this is used for deploying an interacting with contracts bind.ContractBackend // ChainReader ethereum.ChainReader for getting transactions ethereum.ChainReader // TransactionReader is used for reading txes by hash ethereum.TransactionReader // ChainStateReader gets the chain state reader ethereum.ChainStateReader // PendingStateReader handles pending state calls ethereum.PendingStateReader // ChainSyncReader tracks state head ethereum.ChainSyncReader // PendingContractCaller tracks pending contract calls ethereum.PendingContractCaller // FeeHistory gets the fee history for a given block FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error) // NetworkID returns the network ID (also known as the chain ID) for this chain. NetworkID(ctx context.Context) (*big.Int, error) // ChainID gets the chain id from the rpc server ChainID(ctx context.Context) (*big.Int, error) // CallContext is used for manual overrides CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error // BatchCallContext is used for manual overrides BatchCallContext(ctx context.Context, b []rpc.BatchElem) error // BlockNumber gets the latest block number BlockNumber(ctx context.Context) (uint64, error) // BatchContext uses w3 as a helper method for batch calls BatchContext(ctx context.Context, calls ...w3types.Caller) error }
EVMClient is the chain client. It defines everything necessary to create a Chain.
type LifecycleClient ¶
type LifecycleClient struct { Permitter // contains filtered or unexported fields }
LifecycleClient is an evm client that acquires a permit upon request start and releases after the request. this logic can be implemented however the caller needs.
func NewLifecycleClient ¶
func NewLifecycleClient(client EVMClient, chainID *big.Int, permitter Permitter, requestTimeout time.Duration) LifecycleClient
NewLifecycleClient creates a new lifecyle client from an underlying client and a permitter. requestTimeout is the maximum amount of time to wait for any request. This does not include the acquirePermit/releasePermit time.
func (LifecycleClient) BalanceAt ¶
func (m LifecycleClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (balance *big.Int, err error)
BalanceAt calls BalanceAt on the underlying client
func (LifecycleClient) BatchCallContext ¶
BatchCallContext calls BatchCallContext on the underlying client. Note: this will bypass the rate-limiter.
func (LifecycleClient) BatchContext ¶ added in v0.0.20
BatchContext calls BatchContext on the underlying client
func (LifecycleClient) BlockByHash ¶
func (m LifecycleClient) BlockByHash(ctx context.Context, hash common.Hash) (block *types.Block, err error)
BlockByHash calls BlockByHash on the underlying client
func (LifecycleClient) BlockByNumber ¶
func (m LifecycleClient) BlockByNumber(ctx context.Context, number *big.Int) (block *types.Block, err error)
BlockByNumber calls BlockByNumber on the underlying client
func (LifecycleClient) BlockNumber ¶
func (m LifecycleClient) BlockNumber(ctx context.Context) (_ uint64, err error)
BlockNumber gets the latest block number
func (LifecycleClient) CallContext ¶
func (m LifecycleClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) (err error)
CallContext calls CallContext on the underlying client. Note: this will bypass the rate-limiter.
func (LifecycleClient) CallContract ¶
func (m LifecycleClient) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) (contractResponse []byte, err error)
CallContract calls contract on the underlying client
func (LifecycleClient) ChainConfig ¶
func (m LifecycleClient) ChainConfig() *params.ChainConfig
ChainConfig calls ChainConfig on the underlying client
func (LifecycleClient) CodeAt ¶
func (m LifecycleClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) (codeAt []byte, err error)
CodeAt calls CodeAt on the underlying client
func (LifecycleClient) EstimateGas ¶
func (m LifecycleClient) EstimateGas(ctx context.Context, call ethereum.CallMsg) (gas uint64, err error)
EstimateGas calls EstimateGas on the underlying client
func (LifecycleClient) FeeHistory ¶ added in v0.0.21
func (m LifecycleClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64) (*ethereum.FeeHistory, error)
FeeHistory calls FeeHistory on the underlying client
func (LifecycleClient) FilterLogs ¶
func (m LifecycleClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) (logs []types.Log, err error)
FilterLogs calls FilterLogs on the underlying client
func (LifecycleClient) HeaderByHash ¶
func (m LifecycleClient) HeaderByHash(ctx context.Context, hash common.Hash) (header *types.Header, err error)
HeaderByHash calls HeaderByHash on the underlying client
func (LifecycleClient) HeaderByNumber ¶
func (m LifecycleClient) HeaderByNumber(ctx context.Context, number *big.Int) (header *types.Header, err error)
HeaderByNumber calls HeaderByNumber on the underlying client
func (LifecycleClient) NetworkID ¶ added in v0.0.21
NetworkID calls NetworkID on the underlying client
func (LifecycleClient) NonceAt ¶
func (m LifecycleClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (nonce uint64, err error)
NonceAt calls NonceAt on the underlying client
func (LifecycleClient) PendingBalanceAt ¶ added in v0.0.21
func (m LifecycleClient) PendingBalanceAt(ctx context.Context, account common.Address) (pendingBalance *big.Int, err error)
PendingBalanceAt calls PendingBalanceAt on the underlying client
func (LifecycleClient) PendingCallContract ¶ added in v0.0.21
func (m LifecycleClient) PendingCallContract(ctx context.Context, call ethereum.CallMsg) (contractResponse []byte, err error)
PendingCallContract calls contract on the underlying client
func (LifecycleClient) PendingCodeAt ¶
func (m LifecycleClient) PendingCodeAt(ctx context.Context, account common.Address) (codeResponse []byte, err error)
PendingCodeAt calls PendingCodeAt on the underlying client
func (LifecycleClient) PendingNonceAt ¶
func (m LifecycleClient) PendingNonceAt(ctx context.Context, account common.Address) (pendingNonce uint64, err error)
PendingNonceAt calls PendingNonceAt on the underlying client
func (LifecycleClient) PendingStorageAt ¶ added in v0.0.21
func (m LifecycleClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) (pendingStorage []byte, err error)
PendingStorageAt calls PendingStorageAt on the underlying client
func (LifecycleClient) PendingTransactionCount ¶ added in v0.0.21
func (m LifecycleClient) PendingTransactionCount(ctx context.Context) (count uint, err error)
PendingTransactionCount calls PendingTransactionCount on the underlying client
func (LifecycleClient) SendTransaction ¶
func (m LifecycleClient) SendTransaction(ctx context.Context, tx *types.Transaction) (err error)
SendTransaction calls SendTransaction on the underlying client
func (LifecycleClient) StorageAt ¶
func (m LifecycleClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) (storage []byte, err error)
StorageAt calls StorageAt on the underlying client
func (LifecycleClient) SubscribeFilterLogs ¶
func (m LifecycleClient) SubscribeFilterLogs(ctx context.Context, query ethereum.FilterQuery, ch chan<- types.Log) (sub ethereum.Subscription, err error)
SubscribeFilterLogs calls SubscribeFilterLogs on the underlying client
func (LifecycleClient) SubscribeNewHead ¶
func (m LifecycleClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (sub ethereum.Subscription, err error)
SubscribeNewHead calls SubscribeNewHead on the underlying client
func (LifecycleClient) SuggestGasPrice ¶
SuggestGasPrice calls SuggestGasPrice on the underlying client
func (LifecycleClient) SuggestGasTipCap ¶
SuggestGasTipCap gets the suggested gas tip for a chain.
func (LifecycleClient) SyncProgress ¶ added in v0.0.21
func (m LifecycleClient) SyncProgress(ctx context.Context) (syncProgress *ethereum.SyncProgress, err error)
SyncProgress calls SyncProgress on the underlying client
func (LifecycleClient) TransactionByHash ¶
func (m LifecycleClient) TransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
TransactionByHash calls TransactionByHash on the underlying client
func (LifecycleClient) TransactionCount ¶
func (m LifecycleClient) TransactionCount(ctx context.Context, blockHash common.Hash) (txCount uint, err error)
TransactionCount calls TransactionCount on the underlying client
func (LifecycleClient) TransactionInBlock ¶
func (m LifecycleClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (tx *types.Transaction, err error)
TransactionInBlock calls TransactionInBlock on the underlying client
func (LifecycleClient) TransactionReceipt ¶
func (m LifecycleClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (receipt *types.Receipt, err error)
TransactionReceipt calls TransactionReceipt on the underlying client
type MeteredEVMClient ¶
type MeteredEVMClient interface { EVMClient // RequestCount gets the request count from the metered evm client RequestCount() int64 // ConcurrencyCount gets the request concurrency on the meterd client ConcurrencyCount() int32 // ClientID is a unique identifier for the client. // // note: this is not guaranteed to be unique - it's set by the caller. ClientID() string // AttemptReconnect attempts to reconnect // TODO: replace with https://github.com/ethereum/go-ethereum/issues/22266 AttemptReconnect() bool }
MeteredEVMClient is a metered client that exposes a counter metric for evm requests sent through the client.
func NewMeteredClient ¶
func NewMeteredClient(client EVMClient, chainID *big.Int, clientID string, config *keepRate.LimiterConfig) MeteredEVMClient
NewMeteredClient wraps an evm client in a keepRate limiter and creates a metric handler with some standard metrics. It also implements a ChainConfig() method to get the chainconfig for a given chain by id. This will return nil if no chain config is found.
type Permitter ¶
type Permitter interface { AcquirePermit(ctx context.Context) (err error) // ReleasePermit releases a permit ReleasePermit() }
Permitter handles permit acquires/releases for a lifecycle client. this is useful for implementing generic pre/post request logic on different kinds of clients that conform to the evm client.