Documentation ¶
Index ¶
- func BlockByNumber(number *big.Int) w3types.CallerFactory[RPCBlock]
- func BlockNumberArg(blockNumber *big.Int) string
- func GetCallTraceCaller(msg *w3types.Message, blockNumber *big.Int, config *CallTracerConfig, ...) w3types.CallerFactory[CallTrace]
- func GetPrestateTraceCaller(msg *w3types.Message, blockNumber *big.Int, config *PrestateTracerConfig, ...) w3types.CallerFactory[PrestateTrace]
- func NewRPCFetcher(client *w3.Client, blockNumber *big.Int) *rpcFetcher
- func NewStreamingFetcher(client *w3.Client) w3vm.Fetcher
- func TraceCaller[TC, TT any](method string, msg *w3types.Message, blockNumber *big.Int, ...) w3types.CallerFactory[TT]
- type Account
- type ArgsWrapperFunc
- type CallTrace
- type CallTracerConfig
- type Factory
- func GetPrestateTraceBlockCaller(blockNumber *types.NumberOrBlockTag, config *PrestateTracerConfig, ...) *Factory[TraceBlock[PrestateTrace]]
- func NewFactory[T any](method string, args []any, opts ...Option[T]) *Factory[T]
- func TraceBlockCaller[TC, TT any](method string, blockNumber *types.NumberOrBlockTag, ...) *Factory[TT]
- type Fetcher
- type Option
- type OverrideAccount
- type PrestateTrace
- type PrestateTracerConfig
- type RPCBlock
- type RPCTransaction
- type RetWrapperFunc
- type State
- type StateOverride
- type StateUpdate
- type StreamingFetcher
- func (*StreamingFetcher) Balance(common.Address) (*big.Int, error)
- func (*StreamingFetcher) Code(common.Address) ([]byte, error)
- func (*StreamingFetcher) HeaderHash(*big.Int) (common.Hash, error)
- func (*StreamingFetcher) Nonce(common.Address) (uint64, error)
- func (*StreamingFetcher) StorageAt(common.Address, common.Hash) (common.Hash, error)
- type TraceBlock
- type TraceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockByNumber ¶
func BlockByNumber(number *big.Int) w3types.CallerFactory[RPCBlock]
BlockByNumber requests the block with the given number with full transactions. If number is nil, the latest block is requested.
func BlockNumberArg ¶
func GetCallTraceCaller ¶
func GetCallTraceCaller(msg *w3types.Message, blockNumber *big.Int, config *CallTracerConfig, stateOverrides StateOverride) w3types.CallerFactory[CallTrace]
func GetPrestateTraceCaller ¶
func GetPrestateTraceCaller(msg *w3types.Message, blockNumber *big.Int, config *PrestateTracerConfig, stateOverrides StateOverride) w3types.CallerFactory[PrestateTrace]
func NewRPCFetcher ¶
NewRPCFetcher returns a new Fetcher that fetches account state from the given RPC client for the given block number.
Note, that the returned state for a given block number is the state after the execution of that block.
func TraceCaller ¶
func TraceCaller[TC, TT any](method string, msg *w3types.Message, blockNumber *big.Int, tracerConfig *TraceConfig[TC]) w3types.CallerFactory[TT]
CallTraceCall requests the call trace of the given message.
Types ¶
type Account ¶
type ArgsWrapperFunc ¶
type CallTrace ¶
type CallTrace struct { From common.Address `json:"from"` To common.Address `json:"to"` Type string `json:"type"` Gas hexutil.Uint64 `json:"gas"` GasUsed hexutil.Uint64 `json:"gasUsed"` Value *hexutil.Big `json:"value"` Input hexutil.Bytes `json:"input"` Output hexutil.Bytes `json:"output"` Error string `json:"error"` Calls []*CallTrace `json:"calls"` }
type CallTracerConfig ¶
type Factory ¶
type Factory[T any] struct { // contains filtered or unexported fields }
func GetPrestateTraceBlockCaller ¶
func GetPrestateTraceBlockCaller(blockNumber *types.NumberOrBlockTag, config *PrestateTracerConfig, stateOverrides StateOverride) *Factory[TraceBlock[PrestateTrace]]
func TraceBlockCaller ¶
func TraceBlockCaller[TC, TT any](method string, blockNumber *types.NumberOrBlockTag, tracerConfig *TraceConfig[TC]) *Factory[TT]
type Fetcher ¶
type Fetcher interface { // Nonce fetches the nonce of the given address. Nonce(common.Address) (uint64, error) // Balance fetches the balance of the given address. Balance(common.Address) (*big.Int, error) // Code fetches the code of the given address. Code(common.Address) ([]byte, error) // StorageAt fetches the state of the given address and storage slot. StorageAt(common.Address, common.Hash) (common.Hash, error) // HeaderHash fetches the hash of the header with the given number. HeaderHash(*big.Int) (common.Hash, error) }
Fetcher is the interface to access account state of a blockchain.
type Option ¶
the following is borrowed from w3
func WithArgsWrapper ¶
func WithArgsWrapper[T any](fn ArgsWrapperFunc) Option[T]
func WithRetWrapper ¶
func WithRetWrapper[T any](fn RetWrapperFunc[T]) Option[T]
type OverrideAccount ¶
type OverrideAccount struct { Nonce *hexutil.Uint64 `json:"nonce,omitempty"` Code *hexutil.Bytes `json:"code,omitempty"` Balance *hexutil.Big `json:"balance,omitempty"` State map[common.Hash]common.Hash `json:"state,omitempty"` StateDiff map[common.Hash]common.Hash `json:"stateDiff,omitempty"` }
OverrideAccount indicates the overriding fields of account during the execution of a message call. Note, state and stateDiff can't be specified at the same time. If state is set, message execution will only use the data in the given state. Otherwise if statDiff is set, all diff will be applied first and then execute the call message.
type PrestateTrace ¶
type PrestateTracerConfig ¶
type PrestateTracerConfig struct {
DiffMode bool `json:"diffMode"` // If true, this tracer will return state modifications
}
type RPCBlock ¶
type RPCBlock struct { ParentHash common.Hash `json:"parentHash"` UncleHash common.Hash `json:"sha3Uncles"` Coinbase common.Address `json:"miner"` Root common.Hash `json:"stateRoot"` TxHash common.Hash `json:"transactionsRoot"` ReceiptHash common.Hash `json:"receiptsRoot"` Bloom ethTypes.Bloom `json:"logsBloom"` Difficulty *hexutil.Big `json:"difficulty"` Number *hexutil.Big `json:"number"` GasLimit hexutil.Uint64 `json:"gasLimit"` GasUsed hexutil.Uint64 `json:"gasUsed"` Time hexutil.Uint64 `json:"timestamp"` Extra hexutil.Bytes `json:"extraData"` MixDigest common.Hash `json:"mixHash"` Nonce ethTypes.BlockNonce `json:"nonce"` Transactions []*RPCTransaction `json:"transactions"` // added ChainID *hexutil.Big `json:"chainId,omitempty"` // non standard BaseFee *hexutil.Big `json:"baseFeePerGas,omitempty" rlp:"optional"` // BaseFee was added by EIP-1559 and is ignored in legacy headers. WithdrawalsHash *common.Hash `json:"withdrawalsRoot,omitempty" rlp:"optional"` // WithdrawalsHash was added by EIP-4895 and is ignored in legacy headers. ExcessDataGas *hexutil.Big `json:"excessDataGas,omitempty" rlp:"optional"` // ExcessDataGas was added by EIP-4844 and is ignored in legacy headers. }
type RPCTransaction ¶
type RPCTransaction struct { Type hexutil.Uint64 `json:"type"` ChainID *hexutil.Big `json:"chainId,omitempty"` Nonce hexutil.Uint64 `json:"nonce"` To *common.Address `json:"to"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxFeePerBlobGas *hexutil.Big `json:"maxFeePerBlobGas,omitempty"` Value *hexutil.Big `json:"value"` Input *hexutil.Bytes `json:"input"` AccessList *ethTypes.AccessList `json:"accessList,omitempty"` BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` YParity *hexutil.Uint64 `json:"yParity,omitempty"` // Arbitrum fields: From *common.Address `json:"from,omitempty"` // Contract SubmitRetryable Unsigned Retry RequestId *common.Hash `json:"requestId,omitempty"` // Contract SubmitRetryable Deposit TicketId *common.Hash `json:"ticketId,omitempty"` // Retry MaxRefund *hexutil.Big `json:"maxRefund,omitempty"` // Retry SubmissionFeeRefund *hexutil.Big `json:"submissionFeeRefund,omitempty"` // Retry RefundTo *common.Address `json:"refundTo,omitempty"` // SubmitRetryable Retry L1BaseFee *hexutil.Big `json:"l1BaseFee,omitempty"` // SubmitRetryable DepositValue *hexutil.Big `json:"depositValue,omitempty"` // SubmitRetryable RetryTo *common.Address `json:"retryTo,omitempty"` // SubmitRetryable RetryValue *hexutil.Big `json:"retryValue,omitempty"` // SubmitRetryable RetryData *hexutil.Bytes `json:"retryData,omitempty"` // SubmitRetryable Beneficiary *common.Address `json:"beneficiary,omitempty"` // SubmitRetryable MaxSubmissionFee *hexutil.Big `json:"maxSubmissionFee,omitempty"` // SubmitRetryable EffectiveGasPrice *hexutil.Uint64 `json:"effectiveGasPrice,omitempty"` // ArbLegacy L1BlockNumber *hexutil.Uint64 `json:"l1BlockNumber,omitempty"` // ArbLegacy // Only used for encoding: Hash common.Hash `json:"hash"` }
func (*RPCTransaction) ToW3Message ¶
func (tx *RPCTransaction) ToW3Message() *w3types.Message
type RetWrapperFunc ¶
type StateOverride ¶
type StateOverride map[common.Address]OverrideAccount
StateOverride is the collection of overridden accounts.
type StateUpdate ¶
type StateUpdate struct { TraceBlock TraceBlock[PrestateTrace] Block *ethTypes.Block }
type StreamingFetcher ¶
type StreamingFetcher struct {
// contains filtered or unexported fields
}
func (*StreamingFetcher) Code ¶
func (*StreamingFetcher) Code(common.Address) ([]byte, error)
Code implements w3vm.Fetcher.
func (*StreamingFetcher) HeaderHash ¶
HeaderHash implements w3vm.Fetcher.
type TraceBlock ¶
type TraceBlock[TC any] []*txTraceResult[TC]
type TraceConfig ¶
type TraceConfig[TC any] struct { Tracer string `json:"tracer"` TracerConfig *TC `json:"tracerConfig,omitempty"` StateOverrides StateOverride `json:"stateOverrides,omitempty"` }