jsonrpc

package
v2.0.3-0...-45cb04b Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0 Imports: 69 Imported by: 0

Documentation

Overview

Package jsonrpc contains the implementation of the JSONRPC service which is called by Ethereum clients (e.g. Metamask).

The most relevant types in this package are:

  • EthService, NetService, DebugService, etc. which contain the implementations for the `eth_*`, `net_*`, `debug_*`, etc., JSONRPC endpoints. Each endpoint corresponds to a public receiver with the same name. For example, `eth_getTransactionCount` corresponds to EthService.GetTransactionCount.
  • EVMChain, which provides common functionality to interact with the EVM state.
  • ChainBackend, which provides access to the underlying ISC chain, and has two implementations:
  • [WaspEVMBackend] for the production environment.
  • [solo.jsonRPCSoloBackend] for Solo tests.

Package jsonrpc implements JSON-RPC endpoints according to https://eth.wiki/json-rpc/API

Index

Constants

View Source
const StatusUpdateBlockInterval = 10000

Variables

This section is empty.

Functions

func MemoryPtr

func MemoryPtr(m []byte, offset, size int64) []byte

MemoryPtr returns a pointer to a slice of memory.

func NewEngineAPI

func NewEngineAPI(evmChain *EVMChain, accountManager *AccountManager, metrics *metrics.ChainWebAPIMetrics, params *Parameters) (*rpc.Server, error)

NewEngineAPI is strictly for Hive EIP testing, and should not be included into our regular RPC endpoint.

func NewServer

func NewServer(
	evmChain *EVMChain,
	accountManager *AccountManager,
	metrics *metrics.ChainWebAPIMetrics,
	params *Parameters,
) (*rpc.Server, error)

func RPCMarshalBlock

func RPCMarshalBlock(block *types.Block, inclTx, fullTx bool) (map[string]any, error)

RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.

func RPCMarshalHeader

func RPCMarshalHeader(head *types.Header) map[string]any

RPCMarshalHeader converts the given header to the RPC output .

func RPCMarshalReceipt

func RPCMarshalReceipt(r *types.Receipt, tx *types.Transaction, effectiveGasPrice *big.Int) map[string]any

func StackBack

func StackBack(st []uint256.Int, n int) *uint256.Int

StackBack returns the n'th item in stack

Types

type AccountManager

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

func NewAccountManager

func NewAccountManager(accounts []*ecdsa.PrivateKey) *AccountManager

func (*AccountManager) Add

func (a *AccountManager) Add(keyPair *ecdsa.PrivateKey)

func (*AccountManager) Addresses

func (a *AccountManager) Addresses() []common.Address

func (*AccountManager) Get

type CallFrame

type CallFrame struct {
	Type         OpCodeJSON      `json:"type"`
	From         common.Address  `json:"from"`
	Gas          hexutil.Uint64  `json:"gas"`
	GasUsed      hexutil.Uint64  `json:"gasUsed"`
	To           *common.Address `json:"to,omitempty" rlp:"optional"`
	Input        hexutil.Bytes   `json:"input" rlp:"optional"`
	Output       hexutil.Bytes   `json:"output,omitempty" rlp:"optional"`
	Error        string          `json:"error,omitempty" rlp:"optional"`
	RevertReason string          `json:"revertReason,omitempty"`
	Calls        []CallFrame     `json:"calls,omitempty" rlp:"optional"`
	Logs         []CallLog       `json:"logs,omitempty" rlp:"optional"`
	// Placed at end on purpose. The RLP will be decoded to 0 instead of
	// nil if there are non-empty elements after in the struct.
	Value hexutil.Big `json:"value,omitempty" rlp:"optional"`
	// contains filtered or unexported fields
}

CallFrame contains the result of a trace with "callTracer". Code is 100% copied from go-ethereum (since the type is unexported there)

func (CallFrame) TypeString

func (f CallFrame) TypeString() string

type CallLog

type CallLog struct {
	Address common.Address `json:"address"`
	Topics  []common.Hash  `json:"topics"`
	Data    hexutil.Bytes  `json:"data"`
	// Position of the log relative to subcalls within the same trace
	// See https://github.com/ethereum/go-ethereum/pull/28389 for details
	Position hexutil.Uint `json:"position"`
}

type CallTraceAction

type CallTraceAction struct {
	From     *common.Address `json:"from"`
	CallType string          `json:"callType"`
	Gas      hexutil.Uint64  `json:"gas"`
	Input    hexutil.Bytes   `json:"input"`
	To       *common.Address `json:"to"`
	Value    hexutil.Big     `json:"value"`
}

type ChainBackend

type ChainBackend interface {
	EVMSendTransaction(tx *types.Transaction) error
	EVMCall(anchor *isc.StateAnchor, callMsg ethereum.CallMsg, l1Params *parameters.L1Params) ([]byte, error)
	EVMEstimateGas(anchor *isc.StateAnchor, callMsg ethereum.CallMsg, l1Params *parameters.L1Params) (uint64, error)
	EVMTrace(
		anchor *isc.StateAnchor,
		blockTime time.Time,
		entropy hashing.HashValue,
		iscRequestsInBlock []isc.Request,
		enforceGasBurned []vm.EnforceGasBurned,
		tracer *tracers.Tracer,
		l1Params *parameters.L1Params,
	) error
	FeePolicy(blockIndex uint32) (*gas.FeePolicy, error)
	ISCChainID() *isc.ChainID
	ISCCallView(chainState state.State, msg isc.Message) (isc.CallArguments, error)
	ISCLatestState() (*isc.StateAnchor, state.State, error)
	ISCStateByBlockIndex(blockIndex uint32) (state.State, error)
	ISCStateByTrieRoot(trieRoot trie.Hash) (state.State, error)
	TakeSnapshot() (int, error)
	RevertToSnapshot(int) error
}

ChainBackend provides access to the underlying ISC chain.

type Checkpoint

type Checkpoint struct {
	StartBlock uint32
	EndBlock   uint32
	TrieRoot   trie.Hash
}

type CreateTraceAction

type CreateTraceAction struct {
	From  *common.Address `json:"from"`
	Gas   hexutil.Uint64  `json:"gas"`
	Init  hexutil.Bytes   `json:"init"`
	Value hexutil.Big     `json:"value"`
}

type CreateTraceResult

type CreateTraceResult struct {
	Address *common.Address `json:"address,omitempty"`
	Code    hexutil.Bytes   `json:"code"`
	GasUsed hexutil.Uint64  `json:"gasUsed"`
}

type DebugService

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

func NewDebugService

func NewDebugService(evmChain *EVMChain, metrics *metrics.ChainWebAPIMetrics) *DebugService

func (*DebugService) GetRawBlock

func (d *DebugService) GetRawBlock(blockNrOrHash rpc.BlockNumberOrHash) (any, error)

func (*DebugService) TraceBlockByHash

func (d *DebugService) TraceBlockByHash(blockHash common.Hash, config *tracers.TraceConfig) (any, error)

func (*DebugService) TraceBlockByNumber

func (d *DebugService) TraceBlockByNumber(blockNumber hexutil.Uint64, config *tracers.TraceConfig) (any, error)

func (*DebugService) TraceTransaction

func (d *DebugService) TraceTransaction(txHash common.Hash, config *tracers.TraceConfig) (any, error)

type EVMChain

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

EVMChain provides common functionality to interact with the EVM state.

func NewEVMChain

func NewEVMChain(
	backend ChainBackend,
	pub *publisher.Publisher,
	isArchiveNode bool,
	indexDBEngine hivedb.Engine,
	indexDBPath string,
	log log.Logger,
) *EVMChain

func (*EVMChain) Balance

func (e *EVMChain) Balance(address common.Address, blockNumberOrHash *rpc.BlockNumberOrHash) (*big.Int, error)

func (*EVMChain) BlockByHash

func (e *EVMChain) BlockByHash(hash common.Hash) *types.Block

func (*EVMChain) BlockByNumber

func (e *EVMChain) BlockByNumber(blockNumber *big.Int) (*types.Block, error)

func (*EVMChain) BlockNumber

func (e *EVMChain) BlockNumber() *big.Int

func (*EVMChain) BlockTransactionCountByHash

func (e *EVMChain) BlockTransactionCountByHash(blockHash common.Hash) uint64

func (*EVMChain) BlockTransactionCountByNumber

func (e *EVMChain) BlockTransactionCountByNumber(blockNumber *big.Int) (uint64, error)

func (*EVMChain) CallContract

func (e *EVMChain) CallContract(callMsg ethereum.CallMsg, blockNumberOrHash *rpc.BlockNumberOrHash) ([]byte, error)

func (*EVMChain) ChainID

func (e *EVMChain) ChainID() uint16

func (*EVMChain) Code

func (e *EVMChain) Code(address common.Address, blockNumberOrHash *rpc.BlockNumberOrHash) ([]byte, error)

func (*EVMChain) EstimateGas

func (e *EVMChain) EstimateGas(callMsg ethereum.CallMsg, blockNumberOrHash *rpc.BlockNumberOrHash) (uint64, error)

func (*EVMChain) GasFeePolicy

func (e *EVMChain) GasFeePolicy() *gas.FeePolicy

func (*EVMChain) GasPrice

func (e *EVMChain) GasPrice() *big.Int

func (*EVMChain) GetBlockReceipts

func (e *EVMChain) GetBlockReceipts(blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, []*types.Transaction, error)

func (*EVMChain) GetRawBlock

func (e *EVMChain) GetRawBlock(blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*EVMChain) Logs

func (e *EVMChain) Logs(query *ethereum.FilterQuery, params *LogsLimits) ([]*types.Log, error)

Logs executes a log filter operation, blocking during execution and returning all the results in one batch.

func (*EVMChain) SendTransaction

func (e *EVMChain) SendTransaction(tx *types.Transaction) error

func (*EVMChain) Signer

func (e *EVMChain) Signer() (types.Signer, error)

func (*EVMChain) StorageAt

func (e *EVMChain) StorageAt(address common.Address, key common.Hash, blockNumberOrHash *rpc.BlockNumberOrHash) (common.Hash, error)

func (*EVMChain) SubscribeLogs

func (e *EVMChain) SubscribeLogs(q *ethereum.FilterQuery, ch chan<- []*types.Log) (unsubscribe func())

func (*EVMChain) SubscribeNewHeads

func (e *EVMChain) SubscribeNewHeads(ch chan<- *types.Header) (unsubscribe func())

func (*EVMChain) TraceBlock

func (e *EVMChain) TraceBlock(bn rpc.BlockNumber) (any, error)

func (*EVMChain) TraceBlockByHash

func (e *EVMChain) TraceBlockByHash(blockHash common.Hash, config *tracers.TraceConfig) (any, error)

func (*EVMChain) TraceBlockByNumber

func (e *EVMChain) TraceBlockByNumber(blockNumber uint64, config *tracers.TraceConfig) (any, error)

func (*EVMChain) TraceTransaction

func (e *EVMChain) TraceTransaction(txHash common.Hash, config *tracers.TraceConfig) (any, error)

func (*EVMChain) TransactionByBlockHashAndIndex

func (e *EVMChain) TransactionByBlockHashAndIndex(hash common.Hash, index uint64) (tx *types.Transaction, blockNumber uint64, err error)

func (*EVMChain) TransactionByBlockNumberAndIndex

func (e *EVMChain) TransactionByBlockNumberAndIndex(blockNumber *big.Int, index uint64) (tx *types.Transaction, blockHash common.Hash, blockNumberRet uint64, err error)

func (*EVMChain) TransactionByHash

func (e *EVMChain) TransactionByHash(hash common.Hash) (tx *types.Transaction, blockHash common.Hash, blockNumber, txIndex uint64, err error)

func (*EVMChain) TransactionCount

func (e *EVMChain) TransactionCount(address common.Address, blockNumberOrHash *rpc.BlockNumberOrHash) (uint64, error)

func (*EVMChain) TransactionReceipt

func (e *EVMChain) TransactionReceipt(txHash common.Hash) *types.Receipt

func (*EVMChain) ViewCaller

func (e *EVMChain) ViewCaller(chainState state.State) vmerrors.ViewCaller

type EVMService

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

func NewEVMService

func NewEVMService(evmChain *EVMChain) *EVMService

func (*EVMService) Revert

func (e *EVMService) Revert(snapshot hexutil.Uint) error

func (*EVMService) Snapshot

func (e *EVMService) Snapshot() (hexutil.Uint, error)

type EngineService

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

func NewEngineService

func NewEngineService(evmChain *EVMChain, metrics *metrics.ChainWebAPIMetrics, accounts *AccountManager, params *Parameters) *EngineService

func (*EngineService) EnqueueTransactions

func (e *EngineService) EnqueueTransactions(block *types.Block, blockHash common.Hash) (*engine.PayloadStatusV1, error)

func (*EngineService) ForkchoiceUpdatedV1

func (e *EngineService) ForkchoiceUpdatedV1(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

func (*EngineService) ForkchoiceUpdatedV2

func (e *EngineService) ForkchoiceUpdatedV2(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

func (*EngineService) ForkchoiceUpdatedV3

func (e *EngineService) ForkchoiceUpdatedV3(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

func (*EngineService) ForkchoiceUpdatedV4

func (e *EngineService) ForkchoiceUpdatedV4(update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

func (*EngineService) NewPayloadV1

func (e *EngineService) NewPayloadV1(params engine.ExecutableData) (engine.PayloadStatusV1, error)

func (*EngineService) NewPayloadV2

func (e *EngineService) NewPayloadV2(params engine.ExecutableData) (engine.PayloadStatusV1, error)

func (*EngineService) NewPayloadV3

func (e *EngineService) NewPayloadV3(params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (engine.PayloadStatusV1, error)

func (*EngineService) NewPayloadV4

func (e *EngineService) NewPayloadV4(params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (engine.PayloadStatusV1, error)

type EthService

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

EthService contains the implementations for the `eth_*` JSONRPC endpoints.

Each endpoint corresponds to a public receiver with the same name. For example, `eth_getTransactionCount` corresponds to EthService.GetTransactionCount.

func NewEthService

func NewEthService(
	evmChain *EVMChain,
	accounts *AccountManager,
	metrics *metrics.ChainWebAPIMetrics,
	params *Parameters,
) *EthService

func (*EthService) Accounts

func (e *EthService) Accounts() []common.Address

func (*EthService) BlockNumber

func (e *EthService) BlockNumber() (*hexutil.Big, error)

func (*EthService) Call

func (e *EthService) Call(args *RPCCallArgs, blockNumberOrHash *rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*EthService) ChainId

func (e *EthService) ChainId() (hexutil.Uint, error)

ChainId implements the eth_chainId method according to https://eips.ethereum.org/EIPS/eip-695

func (*EthService) Coinbase

func (e *EthService) Coinbase() common.Address

func (*EthService) EstimateGas

func (e *EthService) EstimateGas(args *RPCCallArgs, blockNumberOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)

func (*EthService) GasPrice

func (e *EthService) GasPrice() (*hexutil.Big, error)

func (*EthService) GetBalance

func (e *EthService) GetBalance(address common.Address, blockNumberOrHash *rpc.BlockNumberOrHash) (*hexutil.Big, error)

func (*EthService) GetBlockByHash

func (e *EthService) GetBlockByHash(hash common.Hash, full bool) (map[string]any, error)

func (*EthService) GetBlockByNumber

func (e *EthService) GetBlockByNumber(blockNumber rpc.BlockNumber, full bool) (map[string]any, error)

func (*EthService) GetBlockReceipts

func (e *EthService) GetBlockReceipts(blockNumber rpc.BlockNumberOrHash) ([]map[string]any, error)

func (*EthService) GetBlockTransactionCountByHash

func (e *EthService) GetBlockTransactionCountByHash(blockHash common.Hash) (hexutil.Uint, error)

func (*EthService) GetBlockTransactionCountByNumber

func (e *EthService) GetBlockTransactionCountByNumber(blockNumber rpc.BlockNumber) (hexutil.Uint, error)

func (*EthService) GetCode

func (e *EthService) GetCode(address common.Address, blockNumberOrHash *rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*EthService) GetCompilers

func (e *EthService) GetCompilers() []string

func (*EthService) GetLogs

func (e *EthService) GetLogs(q *RPCFilterQuery) ([]*types.Log, error)

func (*EthService) GetStorageAt

func (e *EthService) GetStorageAt(address common.Address, key string, blockNumberOrHash *rpc.BlockNumberOrHash) (hexutil.Bytes, error)

func (*EthService) GetTransactionByBlockHashAndIndex

func (e *EthService) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (*RPCTransaction, error)

func (*EthService) GetTransactionByBlockNumberAndIndex

func (e *EthService) GetTransactionByBlockNumberAndIndex(blockNumberOrTag rpc.BlockNumber, index hexutil.Uint) (*RPCTransaction, error)

func (*EthService) GetTransactionByHash

func (e *EthService) GetTransactionByHash(hash common.Hash) (*RPCTransaction, error)

func (*EthService) GetTransactionCount

func (e *EthService) GetTransactionCount(address common.Address, blockNumberOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)

func (*EthService) GetTransactionReceipt

func (e *EthService) GetTransactionReceipt(txHash common.Hash) (map[string]any, error)

func (*EthService) GetUncleByBlockHashAndIndex

func (e *EthService) GetUncleByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) map[string]any

func (*EthService) GetUncleByBlockNumberAndIndex

func (e *EthService) GetUncleByBlockNumberAndIndex(blockNumberOrTag rpc.BlockNumber, index hexutil.Uint) map[string]any

func (*EthService) GetUncleCountByBlockHash

func (e *EthService) GetUncleCountByBlockHash(blockHash common.Hash) hexutil.Uint

func (*EthService) GetUncleCountByBlockNumber

func (e *EthService) GetUncleCountByBlockNumber(blockNumber rpc.BlockNumber) hexutil.Uint

func (*EthService) Hashrate

func (e *EthService) Hashrate() float64

func (*EthService) Logs

func (*EthService) Mining

func (e *EthService) Mining() bool

func (*EthService) NewHeads

func (e *EthService) NewHeads(ctx context.Context) (*rpc.Subscription, error)

func (*EthService) ProtocolVersion

func (e *EthService) ProtocolVersion() hexutil.Uint

func (*EthService) SendRawTransaction

func (e *EthService) SendRawTransaction(txBytes hexutil.Bytes) (common.Hash, error)

func (*EthService) SendTransaction

func (e *EthService) SendTransaction(args *SendTxArgs) (common.Hash, error)

func (*EthService) Sign

func (e *EthService) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error)

func (*EthService) SignTransaction

func (e *EthService) SignTransaction(args *SendTxArgs) (hexutil.Bytes, error)

func (*EthService) Syncing

func (e *EthService) Syncing() bool

type Index

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

Index allows efficient retrieval of EVM blocks and transactions given the block number. The indexed information is stored in a database (either persisted or in-memory).

func NewIndex

func NewIndex(
	stateByTrieRoot func(trieRoot trie.Hash) (state.State, error),
	indexDBEngine hivedb.Engine,
	indexDBPath string,
) *Index

func (*Index) BlockByHash

func (c *Index) BlockByHash(hash common.Hash) *types.Block

func (*Index) BlockByNumber

func (c *Index) BlockByNumber(n *big.Int) *types.Block

func (*Index) BlockTrieRootByIndex

func (c *Index) BlockTrieRootByIndex(n uint32) *trie.Hash

func (*Index) GetReceiptByTxHash

func (c *Index) GetReceiptByTxHash(hash common.Hash) *types.Receipt

func (*Index) IndexAllBlocksInParallel

func (c *Index) IndexAllBlocksInParallel(log log.Logger, store func() indexedstore.IndexedStore, trieRoot trie.Hash, workers uint8) error

IndexAllBlocksInParallel is meant to be used by external tooling, not by the EVM Indexer itself It relies on private methods, so it's stored here. Don't ever call this function inside the Indexer itself.

func (*Index) IndexBlock

func (c *Index) IndexBlock(trieRoot trie.Hash) error

IndexBlock is called only in an archive node, whenever a block is published.

It walks back following the previous trie root until the latest cached block, associating the EVM block and transaction hashes with the corresponding block index.

func (*Index) TxByBlockHashAndIndex

func (c *Index) TxByBlockHashAndIndex(blockHash common.Hash, txIndex uint64) (tx *types.Transaction, blockNumber uint64)

func (*Index) TxByBlockNumberAndIndex

func (c *Index) TxByBlockNumberAndIndex(blockNumber *big.Int, txIndex uint64) (tx *types.Transaction, blockHash common.Hash)

func (*Index) TxByHash

func (c *Index) TxByHash(hash common.Hash) (tx *types.Transaction, blockHash common.Hash, blockNumber, txIndex uint64)

func (*Index) TxsByBlockNumber

func (c *Index) TxsByBlockNumber(blockNumber *big.Int) types.Transactions

type LogsLimits

type LogsLimits struct {
	MaxBlocksInLogsFilterRange int
	MaxLogsInResult            int
}

type NetService

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

func NewNetService

func NewNetService(chainID int) *NetService

func (*NetService) Listening

func (s *NetService) Listening() bool

func (*NetService) PeerCount

func (s *NetService) PeerCount() hexutil.Uint

func (*NetService) Version

func (s *NetService) Version() string

type NewBlockEvent

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

type OpCodeJSON

type OpCodeJSON struct {
	vm.OpCode
}

func NewOpCodeJSON

func NewOpCodeJSON(code vm.OpCode) OpCodeJSON

func (OpCodeJSON) MarshalJSON

func (o OpCodeJSON) MarshalJSON() ([]byte, error)

func (*OpCodeJSON) UnmarshalJSON

func (o *OpCodeJSON) UnmarshalJSON(data []byte) error

type Parameters

type Parameters struct {
	Logs                                LogsLimits
	WebsocketRateLimitMessagesPerSecond int
	WebsocketRateLimitBurst             int
	WebsocketRateLimitEnabled           bool
	WebsocketConnectionCleanupDuration  time.Duration
	WebsocketClientBlockDuration        time.Duration
}

func NewParameters

func NewParameters(
	maxBlocksInLogsFilterRange int,
	maxLogsInResult int,
	websocketRateLimitMessagesPerSecond int,
	websocketRateLimitBurst int,
	websocketConnectionCleanupDuration time.Duration,
	websocketClientBlockDuration time.Duration,
	websocketRateLimitEnabled bool,
) *Parameters

func ParametersDefault

func ParametersDefault() *Parameters

type PrestateAccount

type PrestateAccount struct {
	Balance *hexutil.Big                `json:"balance,omitempty"`
	Code    hexutil.Bytes               `json:"code,omitempty"`
	Nonce   uint64                      `json:"nonce,omitempty"`
	Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
	// contains filtered or unexported fields
}

type PrestateAccountMap

type PrestateAccountMap = map[common.Address]*PrestateAccount

type PrestateDiffResult

type PrestateDiffResult struct {
	Post PrestateAccountMap `json:"post"`
	Pre  PrestateAccountMap `json:"pre"`
}

type RPCCallArgs

type RPCCallArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data  *hexutil.Bytes `json:"data"`
	Input *hexutil.Bytes `json:"input"`
}

type RPCFilterQuery

type RPCFilterQuery ethereum.FilterQuery

func (*RPCFilterQuery) UnmarshalJSON

func (q *RPCFilterQuery) UnmarshalJSON(data []byte) error

type RPCTransaction

type RPCTransaction struct {
	BlockHash        *common.Hash    `json:"blockHash"`
	BlockNumber      *hexutil.Big    `json:"blockNumber"`
	From             common.Address  `json:"from"`
	Gas              hexutil.Uint64  `json:"gas"`
	GasPrice         *hexutil.Big    `json:"gasPrice"`
	Hash             common.Hash     `json:"hash"`
	Input            hexutil.Bytes   `json:"input"`
	Nonce            hexutil.Uint64  `json:"nonce"`
	To               *common.Address `json:"to"`
	TransactionIndex *hexutil.Uint64 `json:"transactionIndex"`
	Value            *hexutil.Big    `json:"value"`
	V                *hexutil.Big    `json:"v"`
	R                *hexutil.Big    `json:"r"`
	S                *hexutil.Big    `json:"s"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Uint64 `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
	// We accept "data" and "input" for backwards-compatibility reasons. "input" is the
	// newer name and should be preferred by clients.
	Data  *hexutil.Bytes `json:"data"`
	Input *hexutil.Bytes `json:"input"`
}

SendTxArgs represents the arguments to submit a new transaction into the transaction pool.

type SuicideTraceAction

type SuicideTraceAction struct {
	Address       *common.Address `json:"address"`
	RefundAddress *common.Address `json:"refundAddress"`
	Balance       hexutil.Big     `json:"balance"`
}

type Trace

type Trace struct {
	Action      interface{}  `json:"action"`
	BlockHash   *common.Hash `json:"blockHash,omitempty"`
	BlockNumber uint64       `json:"blockNumber,omitempty"`
	Error       string       `json:"error,omitempty"`
	Result      interface{}  `json:"result"`
	// Subtraces is an integer that represents the number of direct nested (child) calls, or "subtraces," within a trace entry.
	Subtraces int `json:"subtraces"`
	// TraceAddress is an array of integers that represents the path from the top-level transaction trace down to the current subtrace.
	// Each integer in the array specifies an index in the sequence of calls, showing how to "navigate" down the call stack to reach this trace.
	TraceAddress        []int        `json:"traceAddress"`
	TransactionHash     *common.Hash `json:"transactionHash,omitempty"`
	TransactionPosition uint64       `json:"transactionPosition"`
	Type                string       `json:"type"`
}

type TraceResult

type TraceResult struct {
	GasUsed hexutil.Uint64 `json:"gasUsed"`
	Output  hexutil.Bytes  `json:"output"`
}

type TraceService

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

func NewTraceService

func NewTraceService(evmChain *EVMChain, metrics *metrics.ChainWebAPIMetrics) *TraceService

func (*TraceService) Block

func (d *TraceService) Block(bn rpc.BlockNumber) (any, error)

Block implements the `trace_block` RPC.

type TxPoolService

type TxPoolService struct{}

func NewTxPoolService

func NewTxPoolService() *TxPoolService

func (*TxPoolService) Content

func (s *TxPoolService) Content() map[string]map[string]map[string]*RPCTransaction

func (*TxPoolService) Inspect

func (s *TxPoolService) Inspect() map[string]map[string]map[string]string

func (*TxPoolService) Status

func (s *TxPoolService) Status() map[string]hexutil.Uint

type TxTraceResult

type TxTraceResult struct {
	TxHash common.Hash     `json:"txHash"`           // transaction hash
	Result json.RawMessage `json:"result,omitempty"` // Trace results produced by the tracer
	Error  string          `json:"error,omitempty"`  // Trace failure produced by the tracer
}

type Web3Service

type Web3Service struct{}

func NewWeb3Service

func NewWeb3Service() *Web3Service

func (*Web3Service) ClientVersion

func (s *Web3Service) ClientVersion() string

func (*Web3Service) Sha3

func (s *Web3Service) Sha3(input hexutil.Bytes) hexutil.Bytes

Directories

Path Synopsis
Package jsonrpctest provides testing utilities for the jsonrpc package
Package jsonrpctest provides testing utilities for the jsonrpc package

Jump to

Keyboard shortcuts

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