Help us shape the future of Go! Take the 2026 Go Developer Survey

query

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: AGPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DryCallOption

type DryCallOption func(v *View) error

DryRunOption captures a options to be applied before the execution of a dry call.

func WithExtraPrecompiledContracts

func WithExtraPrecompiledContracts(pcs []types.PrecompiledContract) DryCallOption

WithExtraPrecompiledContracts constructs a dry call option that allows adding the precompiled contracts while executing the dry-call.

this method can be used with remote PC caller for cadence arch calls

func WithStateOverrideBalance

func WithStateOverrideBalance(
	addr gethCommon.Address,
	balance *big.Int,
) DryCallOption

WithStateOverrideBalance constructs a dry call option that replaces the balance of an address before the execution a dry call.

func WithStateOverrideCode

func WithStateOverrideCode(
	addr gethCommon.Address,
	code []byte,
) DryCallOption

WithStateOverrideCode constructs a dry call option that replaces the code of an address before the dry call.

func WithStateOverrideNonce

func WithStateOverrideNonce(
	addr gethCommon.Address,
	nonce uint64,
) DryCallOption

WithStateOverrideNonce constructs a dry call option that replaces the nonce of an address before the execution a dry call.

func WithStateOverrideState

func WithStateOverrideState(
	addr gethCommon.Address,
	slots map[gethCommon.Hash]gethCommon.Hash,
) DryCallOption

WithStateOverrideState constructs a dry call option that overrides all slots in the account storage before executing the call.

func WithStateOverrideStateDiff

func WithStateOverrideStateDiff(
	addr gethCommon.Address,
	slots map[gethCommon.Hash]gethCommon.Hash,
) DryCallOption

WithStateOverrideStateDiff constructs a dry call option that overrides slots of an account before executing the call.

func WithTracer

func WithTracer(
	tracer *gethTracers.Tracer,
) DryCallOption

WithTracer constructs a dry call option that allows running the dry call with the custom tracer.

type View

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

View provides query capabilities over an specific state of the EVM chain.

func NewView

func NewView(
	chainID flow.ChainID,
	rootAddr flow.Address,
	storage *storage.EphemeralStorage,
	blockSnapshot types.BlockSnapshot,
	maxCallGasLimit uint64,
) *View

NewView constructs a new view.

func (*View) DryCall

func (v *View) DryCall(
	from gethCommon.Address,
	to gethCommon.Address,
	data []byte,
	authList []gethTypes.SetCodeAuthorization,
	value *big.Int,
	gasLimit uint64,
	opts ...DryCallOption,
) (*types.Result, error)

DryCall runs a call off-chain and returns the results accepts override storage and precompiled call options as well as custom tracer.

func (*View) GetBalance

func (v *View) GetBalance(addr gethCommon.Address) (*big.Int, error)

GetBalance returns the balance for the given address can be used for the `eth_getBalance` endpoint

func (*View) GetCode

func (v *View) GetCode(addr gethCommon.Address) ([]byte, error)

GetCode returns the code for the given address can be used for the `eth_getCode` endpoint

func (*View) GetCodeHash

func (v *View) GetCodeHash(addr gethCommon.Address) (gethCommon.Hash, error)

GetCodeHash returns the codehash for the given address

func (*View) GetNonce

func (v *View) GetNonce(addr gethCommon.Address) (uint64, error)

GetNonce returns the nonce for the given address can be used for the `eth_getTransactionCount` endpoint

func (*View) GetSlab

func (v *View) GetSlab(addr gethCommon.Address, key gethCommon.Hash) (gethCommon.Hash, error)

GetSlab returns the slab for the given address and key can be used for the `eth_getStorageAt` endpoint

type ViewProvider

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

ViewProvider constructs views based on the requirements

func NewViewProvider

func NewViewProvider(
	chainID flow.ChainID,
	rootAddr flow.Address,
	sp types.StorageProvider,
	bp types.BlockSnapshotProvider,
	maxCallGasLimit uint64,
) *ViewProvider

NewViewProvider constructs a new ViewProvider

func (*ViewProvider) GetBlockView

func (evp *ViewProvider) GetBlockView(height uint64) (*View, error)

GetBlockView returns the block view for the given height (at the end of a block!) The `GetSnapshotAt` function of `storageProvider`, will return the block state at its start, before any transaction executions. This is the intended functionality, when replaying & verifying blocks. However, when reading the state from a block, we are interested in its end state, after all transaction executions. That is why we fetch the block snapshot at the next height.

Jump to

Keyboard shortcuts

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