rpc

package
v1.20.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DepositContract              = "DEPOSIT_CONTRACT_ADDRESS"
	ConsolidationRequestContract = "CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS"
	WithdrawalRequestContract    = "WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS"
)

Variables

This section is empty.

Functions

func CallTraceCallValue added in v1.20.3

func CallTraceCallValue(c *CallTraceCall) uint256.Int

CallTraceCallValue returns the big.Int value from a CallTraceCall, or zero if nil.

func CallTypeFromString added in v1.20.3

func CallTypeFromString(s string) uint8

CallTypeFromString converts a callTracer type string to a numeric call type. Returns: 0=CALL, 1=STATICCALL, 2=DELEGATECALL, 3=CREATE, 4=CREATE2, 5=SELFDESTRUCT.

Types

type BlockFilterId

type BlockFilterId string

type CallTraceCall added in v1.20.3

type CallTraceCall struct {
	Type    string          `json:"type"`
	From    common.Address  `json:"from"`
	To      common.Address  `json:"to"`
	Value   *hexutil.Big    `json:"value,omitempty"`
	Gas     hexutil.Uint64  `json:"gas"`
	GasUsed hexutil.Uint64  `json:"gasUsed"`
	Input   hexutil.Bytes   `json:"input"`
	Output  hexutil.Bytes   `json:"output"`
	Error   string          `json:"error,omitempty"`
	Calls   []CallTraceCall `json:"calls,omitempty"`

	// Revert reason (some clients include this separately)
	RevertReason LenientHexBytes `json:"revertReason,omitempty"`
}

CallTraceCall is a single call frame in the callTracer output.

type CallTraceResult added in v1.20.3

type CallTraceResult struct {
	TxHash common.Hash    `json:"txHash"`
	Result *CallTraceCall `json:"result"`
}

CallTraceResult is the JSON result for one transaction from debug_traceBlockByHash with the callTracer.

type CallTracerConfig added in v1.20.3

type CallTracerConfig struct {
	Tracer string `json:"tracer"`
}

CallTracerConfig is the configuration for the callTracer.

type ChainSpec

type ChainSpec struct {
	ChainID string
}

func (*ChainSpec) CheckMismatch

func (chain *ChainSpec) CheckMismatch(chain2 *ChainSpec) []string

type EthConfig added in v1.19.0

type EthConfig struct {
	Current *EthConfigFork `json:"current"`
	Next    *EthConfigFork `json:"next"`
	Last    *EthConfigFork `json:"last"`
}

type EthConfigBlobSchedule added in v1.19.0

type EthConfigBlobSchedule struct {
	Max                   uint64 `json:"max"`
	Target                uint64 `json:"target"`
	BaseFeeUpdateFraction uint64 `json:"baseFeeUpdateFraction"`
}

type EthConfigFork added in v1.19.0

type EthConfigFork struct {
	ActivationTime  uint64                    `json:"activationTime"`
	ChainID         string                    `json:"chainId"`
	ForkID          string                    `json:"forkId"`
	BlobSchedule    EthConfigBlobSchedule     `json:"blobSchedule"`
	Precompiles     map[string]common.Address `json:"precompiles"`
	SystemContracts map[string]common.Address `json:"systemContracts"`
}

func (*EthConfigFork) CheckMismatch added in v1.19.0

func (f *EthConfigFork) CheckMismatch(f2 *EthConfigFork) []string

func (*EthConfigFork) GetActivationTime added in v1.19.0

func (f *EthConfigFork) GetActivationTime() time.Time

GetActivationTime returns the activation time as a time.Time

func (*EthConfigFork) GetSystemContractAddress added in v1.19.0

func (f *EthConfigFork) GetSystemContractAddress(contractType string) *common.Address

GetSystemContractAddress returns the address of a specific system contract

type ExecutionClient

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

func NewExecutionClient

func NewExecutionClient(name, endpoint string, headers map[string]string, sshcfg *sshtunnel.SshConfig, logger logrus.FieldLogger) (*ExecutionClient, error)

NewExecutionClient is used to create a new execution client

func (*ExecutionClient) GetAdminNodeInfo

func (ec *ExecutionClient) GetAdminNodeInfo(ctx context.Context) (*p2p.NodeInfo, error)

func (*ExecutionClient) GetAdminPeers

func (ec *ExecutionClient) GetAdminPeers(ctx context.Context) ([]*p2p.PeerInfo, error)

func (*ExecutionClient) GetBalanceAt

func (ec *ExecutionClient) GetBalanceAt(ctx context.Context, wallet common.Address, blockNumber *big.Int) (*big.Int, error)

func (*ExecutionClient) GetBlockByHash

func (ec *ExecutionClient) GetBlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*ExecutionClient) GetChainSpec

func (ec *ExecutionClient) GetChainSpec(ctx context.Context) (*ChainSpec, error)

func (*ExecutionClient) GetClientVersion

func (ec *ExecutionClient) GetClientVersion(ctx context.Context) (string, error)

func (*ExecutionClient) GetEthClient

func (ec *ExecutionClient) GetEthClient() *ethclient.Client

func (*ExecutionClient) GetEthConfig added in v1.19.0

func (ec *ExecutionClient) GetEthConfig(ctx context.Context) (*EthConfig, error)

func (*ExecutionClient) GetFilterChanges

func (ec *ExecutionClient) GetFilterChanges(ctx context.Context, filterId BlockFilterId) ([]string, error)

func (*ExecutionClient) GetHeaderByHash

func (ec *ExecutionClient) GetHeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*ExecutionClient) GetHeaderByNumber

func (ec *ExecutionClient) GetHeaderByNumber(ctx context.Context, number uint64) (*types.Header, error)

func (*ExecutionClient) GetLatestBlock

func (ec *ExecutionClient) GetLatestBlock(ctx context.Context) (*types.Block, error)

func (*ExecutionClient) GetLatestHeader

func (ec *ExecutionClient) GetLatestHeader(ctx context.Context) (*types.Header, error)

func (*ExecutionClient) GetNodeSyncing

func (ec *ExecutionClient) GetNodeSyncing(ctx context.Context) (*SyncStatus, error)

func (*ExecutionClient) GetNonceAt

func (ec *ExecutionClient) GetNonceAt(ctx context.Context, wallet common.Address, blockNumber *big.Int) (uint64, error)

func (*ExecutionClient) GetTransactionReceipt

func (ec *ExecutionClient) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*ExecutionClient) Initialize

func (ec *ExecutionClient) Initialize(ctx context.Context) error

func (*ExecutionClient) NewBlockFilter

func (ec *ExecutionClient) NewBlockFilter(ctx context.Context) (BlockFilterId, error)

func (*ExecutionClient) SendTransaction

func (ec *ExecutionClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

func (*ExecutionClient) TraceBlockByHash added in v1.20.3

func (ec *ExecutionClient) TraceBlockByHash(
	ctx context.Context,
	blockHash common.Hash,
) ([]CallTraceResult, error)

TraceBlockByHash calls debug_traceBlockByHash with the callTracer configuration. Returns one CallTraceResult per transaction in the block. Uses streaming JSON decoding to avoid buffering the entire (potentially hundreds of MB) response as an intermediate json.RawMessage.

func (*ExecutionClient) TraceBlockStateDiffsByHash added in v1.20.3

func (ec *ExecutionClient) TraceBlockStateDiffsByHash(
	ctx context.Context,
	blockHash common.Hash,
) ([]StateDiffResult, error)

TraceBlockStateDiffsByHash calls debug_traceBlockByHash with prestateTracer in diffMode, returning one diff result per transaction. Uses streaming JSON decoding to avoid buffering the entire (potentially hundreds of MB) response as an intermediate json.RawMessage.

func (*ExecutionClient) UninstallBlockFilter

func (ec *ExecutionClient) UninstallBlockFilter(ctx context.Context, filterId BlockFilterId) (bool, error)

type LenientHexBytes added in v1.20.3

type LenientHexBytes []byte

LenientHexBytes is like hexutil.Bytes, but accepts hex strings with or without a 0x prefix (some clients return revertReason without 0x) and also accepts plain-text strings (some clients return revertReason as human-readable text).

func (*LenientHexBytes) UnmarshalJSON added in v1.20.3

func (b *LenientHexBytes) UnmarshalJSON(input []byte) error

type LenientUint64 added in v1.20.3

type LenientUint64 uint64

LenientUint64 accepts either a JSON number (e.g. 1) or a JSON string (e.g. "0x1" or "1") and decodes it into a uint64.

func (*LenientUint64) UnmarshalJSON added in v1.20.3

func (u *LenientUint64) UnmarshalJSON(input []byte) error

type PrestateAccount added in v1.20.3

type PrestateAccount struct {
	Balance *hexutil.Big               `json:"balance,omitempty"`
	Nonce   *LenientUint64             `json:"nonce,omitempty"`
	Code    LenientHexBytes            `json:"code,omitempty"`
	Storage map[string]LenientHexBytes `json:"storage,omitempty"` // slot -> 32-byte value
}

PrestateAccount is a single account snapshot from the prestateTracer output. Note: JSON keys for account/storage maps are hex strings.

type PrestateTracerConfig added in v1.20.3

type PrestateTracerConfig struct {
	Tracer       string                    `json:"tracer"`
	TracerConfig PrestateTracerConfigInner `json:"tracerConfig"`
}

PrestateTracerConfig config for debug_traceBlockByHash with prestateTracer.

type PrestateTracerConfigInner added in v1.20.3

type PrestateTracerConfigInner struct {
	DiffMode bool `json:"diffMode"`
}

type StateDiff added in v1.20.3

type StateDiff struct {
	Pre  map[string]PrestateAccount `json:"pre,omitempty"`
	Post map[string]PrestateAccount `json:"post,omitempty"`
}

StateDiff is the diffMode output: two maps of touched accounts (pre and post).

type StateDiffResult added in v1.20.3

type StateDiffResult struct {
	TxHash common.Hash `json:"txHash"`
	Result *StateDiff  `json:"result"`
}

StateDiffResult is the debug_traceBlockByHash result wrapper for one tx.

type SyncStatus

type SyncStatus struct {
	IsSyncing     bool
	StartingBlock uint64
	CurrentBlock  uint64
	HighestBlock  uint64
}

func (*SyncStatus) Percent

func (s *SyncStatus) Percent() float64

Jump to

Keyboard shortcuts

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