Documentation ¶
Index ¶
- type AnvilContainer
- type CurrentBlockResponse
- type GethContainer
- type RPCClient
- func (m *RPCClient) AnvilAutoImpersonate(b bool) error
- func (m *RPCClient) AnvilDropTransaction(params []interface{}) error
- func (m *RPCClient) AnvilMine(params []interface{}) error
- func (m *RPCClient) AnvilSetAutoMine(flag bool) error
- func (m *RPCClient) AnvilSetBlockGasLimit(params []interface{}) error
- func (m *RPCClient) AnvilSetMinGasPrice(params []interface{}) error
- func (m *RPCClient) AnvilSetNextBlockBaseFeePerGas(params []interface{}) error
- func (m *RPCClient) AnvilSetStorageAt(params []interface{}) error
- func (m *RPCClient) AnvilTxPoolStatus(params []interface{}) (*TxStatusResponse, error)
- func (m *RPCClient) BlockNumber() (int64, error)
- func (m *RPCClient) GethSetHead(blocksBack int) error
- func (m *RPCClient) ModulateBaseFeeOverDuration(lggr zerolog.Logger, startingBaseFee int64, percentage float64, ...) error
- type RemoteAnvilMiner
- type TxStatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnvilContainer ¶
type AnvilContainer struct { testcontainers.Container URL string }
func StartAnvil ¶
func StartAnvil(params []string) (*AnvilContainer, error)
type CurrentBlockResponse ¶
type CurrentBlockResponse struct {
Result string `json:"result"`
}
type GethContainer ¶
type GethContainer struct { testcontainers.Container URL string }
type RPCClient ¶
type RPCClient struct { URL string // contains filtered or unexported fields }
RPCClient is an RPC client for various node simulators API Reference https://book.getfoundry.sh/reference/anvil/
func New ¶
New creates new RPC client that can be used with Geth or Anvil this is a high level wrapper for common calls we use
func (*RPCClient) AnvilAutoImpersonate ¶
AnvilAutoImpersonate sets auto impersonification to true or false
func (*RPCClient) AnvilDropTransaction ¶
AnvilDropTransaction removes transaction from tx pool API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilMine ¶
AnvilMine calls "evm_mine", mines one or more blocks, see the reference on RPCClient API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetAutoMine ¶
AnvilSetAutoMine calls "evm_setAutomine", turns automatic mining on, see the reference on RPCClient API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetBlockGasLimit ¶
AnvilSetBlockGasLimit sets next block gas limit API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetMinGasPrice ¶
AnvilSetMinGasPrice sets min gas price (pre-EIP-1559 anvil is required) API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetNextBlockBaseFeePerGas ¶
AnvilSetNextBlockBaseFeePerGas sets next block base fee per gas value API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilSetStorageAt ¶
AnvilSetStorageAt sets storage at address API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) AnvilTxPoolStatus ¶
func (m *RPCClient) AnvilTxPoolStatus(params []interface{}) (*TxStatusResponse, error)
AnvilTxPoolStatus calls "txpool_status", returns txpool status, see the reference on RPCClient API Reference https://book.getfoundry.sh/reference/anvil/
func (*RPCClient) BlockNumber ¶
Call "eth_blockNumber" to get the current block number
func (*RPCClient) GethSetHead ¶
func (*RPCClient) ModulateBaseFeeOverDuration ¶
func (m *RPCClient) ModulateBaseFeeOverDuration(lggr zerolog.Logger, startingBaseFee int64, percentage float64, duration time.Duration, spike bool) error
ModulateBaseFeeOverDuration will cause the gas price to rise or drop to a certain percentage of the starting gas price over the duration specified. Minimum duration is 1 s if spike is true, the gas price will rise to the target price if spike is false, the gas price will drop to the target price
type RemoteAnvilMiner ¶
type RemoteAnvilMiner struct { Client *RPCClient // contains filtered or unexported fields }
RemoteAnvilMiner is a remote miner for Anvil node Allows to control blocks emission more precisely to mimic real networks workload
func NewRemoteAnvilMiner ¶
func NewRemoteAnvilMiner(url string, headers http.Header) *RemoteAnvilMiner
NewRemoteAnvilMiner creates a new remote miner client
func (*RemoteAnvilMiner) MineBatch ¶
func (m *RemoteAnvilMiner) MineBatch(capacity int64, checkInterval time.Duration, sendInterval time.Duration)
MineBatch checks the pending transactions in the pool, if threshold is reached mines the block and repeat the process
func (*RemoteAnvilMiner) MinePeriodically ¶
func (m *RemoteAnvilMiner) MinePeriodically(interval time.Duration)
MinePeriodically mines blocks with a specified interval should be used when Anvil mining is off
type TxStatusResponse ¶
type TxStatusResponse struct { Result struct { Pending string `json:"pending"` } `json:"result"` }
TxStatusResponse common RPC response body