Skip to content

Latest commit

 

History

History
1401 lines (778 loc) · 26.4 KB

File metadata and controls

1401 lines (778 loc) · 26.4 KB

@tevm/decorators


@tevm/decorators / JsonRpcSchemaPublic

Type Alias: JsonRpcSchemaPublic

JsonRpcSchemaPublic = object

Defined in: eip1193/JsonRpcSchemaPublic.ts:46

Type definitions for standard Ethereum JSON-RPC methods accessible to the public. Includes methods related to network info, blocks, transactions, and state queries.

Example

import { JsonRpcSchemaPublic } from '@tevm/decorators'
import { createTevmNode } from 'tevm'
import { requestEip1193 } from '@tevm/decorators'

const node = createTevmNode().extend(requestEip1193())

// Call methods using their defined types
const blockNumber = await node.request({
  method: 'eth_blockNumber'
})

const balance = await node.request({
  method: 'eth_getBalance',
  params: ['0x1234567890123456789012345678901234567890', 'latest']
})

Properties

eth_blobGasPrice

eth_blobGasPrice: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:114

Method

Method: "eth_blobGasPrice"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the current blob price of gas expressed in wei

Example

provider.request({ method: 'eth_blobGasPrice' })
// => '0x09184e72a000'

eth_blockNumber

eth_blockNumber: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:126

Method

Method: "eth_blockNumber"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the number of the most recent block seen by this client

Example

provider.request({ method: 'eth_blockNumber' })
// => '0x1b4'

eth_call

eth_call: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:138

Method

Method: "eth_call"

Parameters

Parameters: [Partial<TransactionRequest>] | [Partial<TransactionRequest>, BlockNumber | BlockTag | BlockIdentifier] | [Partial<TransactionRequest>, BlockNumber | BlockTag | BlockIdentifier, RpcStateOverride]

ReturnType

ReturnType: Hex

Description

Executes a new message call immediately without submitting a transaction to the network

Example

provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
// => '0x...'

eth_chainId

eth_chainId: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:156

Method

Method: "eth_chainId"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the chain ID associated with the current network

Example

provider.request({ method: 'eth_chainId' })
// => '1'

eth_coinbase

eth_coinbase: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:167

Method

Method: "eth_coinbase"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Address

Description

Returns the client coinbase address.

Example

provider.request({ method: 'eth_coinbase' })
// => '0x...'

eth_estimateGas

eth_estimateGas: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:182

Method

Method: "eth_estimateGas"

Parameters

Parameters: [TransactionRequest] | [TransactionRequest, BlockNumber | BlockTag]

ReturnType

ReturnType: Quantity

Description

Estimates the gas necessary to complete a transaction without submitting it to the network

Example

provider.request({
 method: 'eth_estimateGas',
 params: [{ from: '0x...', to: '0x...', value: '0x...' }]
})
// => '0x5208'

eth_feeHistory

eth_feeHistory: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:202

Method

Method: "eth_feeHistory"

Parameters

Parameters: [Quantity, BlockNumber | BlockTag, number[] | undefined]

ReturnType

ReturnType: FeeHistory

Description

Returns a collection of historical gas information

Example

provider.request({
 method: 'eth_feeHistory',
 params: ['4', 'latest', ['25', '75']]
})
// => {
//   oldestBlock: '0x1',
//   baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
//   gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
//   reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
// }

eth_gasPrice

eth_gasPrice: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:221

Method

Method: "eth_gasPrice"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the current price of gas expressed in wei

Example

provider.request({ method: 'eth_gasPrice' })
// => '0x09184e72a000'

eth_getBalance

eth_getBalance: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:233

Method

Method: "eth_getBalance"

Parameters

Parameters: [Address, BlockNumber | BlockTag | BlockIdentifier]

ReturnType

ReturnType: Quantity

Description

Returns the balance of an address in wei

Example

provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
// => '0x12a05...'

eth_getBlockByHash

eth_getBlockByHash: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:250

Method

Method: "eth_getBlockByHash"

Parameters

Parameters: [Hash, boolean]

ReturnType

ReturnType: Block | null

Description

Returns information about a block specified by hash

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
// => {
//   number: '0x1b4',
//   hash: '0x...',
//   parentHash: '0x...',
//   ...
// }

eth_getBlockByNumber

eth_getBlockByNumber: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:272

Method

Method: "eth_getBlockByNumber"

Parameters

Parameters: [BlockNumber | BlockTag, boolean]

ReturnType

ReturnType: Block | null

Description

Returns information about a block specified by number

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
// => {
//   number: '0x1b4',
//   hash: '0x...',
//   parentHash: '0x...',
//   ...
// }

eth_getBlockTransactionCountByHash

eth_getBlockTransactionCountByHash: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:289

Method

Method: "eth_getBlockTransactionCountByHash"

Parameters

Parameters: [Hash]

ReturnType

ReturnType: Quantity

Description

Returns the number of transactions in a block specified by block hash

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
// => '0x1'

eth_getBlockTransactionCountByNumber

eth_getBlockTransactionCountByNumber: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:301

Method

Method: "eth_getBlockTransactionCountByNumber"

Parameters

Parameters: [BlockNumber | BlockTag]

ReturnType

ReturnType: Quantity

Description

Returns the number of transactions in a block specified by block number

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
// => '0x1'

eth_getCode

eth_getCode: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:313

Method

Method: "eth_getCode"

Parameters

Parameters: [Address, BlockNumber | BlockTag | BlockIdentifier]

ReturnType

ReturnType: Hex

Description

Returns the contract code stored at a given address

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
// => '0x...'

eth_getFilterChanges

eth_getFilterChanges: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:325

Method

Method: "eth_getFilterChanges"

Parameters

Parameters: [Quantity]

ReturnType

ReturnType: Log[] | Hex[]

Description

Returns a list of all logs based on filter ID since the last log retrieval

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
// => [{ ... }, { ... }]

eth_getFilterLogs

eth_getFilterLogs: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:337

Method

Method: "eth_getFilterLogs"

Parameters

Parameters: [Quantity]

ReturnType

ReturnType: Log[]

Description

Returns a list of all logs based on filter ID

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
// => [{ ... }, { ... }]

eth_getLogs

eth_getLogs: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:349

Method

Method: "eth_getLogs"

Parameters

Parameters: [object & { blockHash?: never; fromBlock?: BlockNumber | BlockTag; toBlock?: BlockNumber | BlockTag; } | { blockHash?: Hash; fromBlock?: never; toBlock?: never; }]

ReturnType

ReturnType: Log[]

Description

Returns a list of all logs based on a filter object

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
// => [{ ... }, { ... }]

eth_getProof

eth_getProof: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:379

Method

Method: "eth_getProof"

Parameters

Parameters: [Address, Hash[], BlockNumber | BlockTag]

ReturnType

ReturnType: Proof

Description

Returns the account and storage values of the specified account including the Merkle-proof.

Link

https://eips.ethereum.org/EIPS/eip-1186

Example

provider.request({ method: 'eth_getProof', params: ['0x...', ['0x...'], 'latest'] })
// => {
//   ...
// }

eth_getStorageAt

eth_getStorageAt: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:397

Method

Method: "eth_getStorageAt"

Parameters

Parameters: [Address, Quantity, BlockNumber | BlockTag | BlockIdentifier]

ReturnType

ReturnType: Hex

Description

Returns the value from a storage position at an address

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
// => '0x...'

eth_getTransactionByBlockHashAndIndex

eth_getTransactionByBlockHashAndIndex: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:409

Method

Method: "eth_getTransactionByBlockHashAndIndex"

Parameters

Parameters: [Hash, Quantity]

ReturnType

ReturnType: Transaction | null

Description

Returns information about a transaction specified by block hash and transaction index

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
// => { ... }

eth_getTransactionByBlockNumberAndIndex

eth_getTransactionByBlockNumberAndIndex: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:421

Method

Method: "eth_getTransactionByBlockNumberAndIndex"

Parameters

Parameters: [BlockNumber | BlockTag, Quantity]

ReturnType

ReturnType: Transaction | null

Description

Returns information about a transaction specified by block number and transaction index

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
// => { ... }

eth_getTransactionByHash

eth_getTransactionByHash: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:433

Method

Method: "eth_getTransactionByHash"

Parameters

Parameters: [Hash]

ReturnType

ReturnType: Transaction | null

Description

Returns information about a transaction specified by hash

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
// => { ... }

eth_getTransactionCount

eth_getTransactionCount: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:445

Method

Method: "eth_getTransactionCount"

Parameters

Parameters: [Address, BlockNumber | BlockTag | BlockIdentifier]

ReturnType

ReturnType: Quantity

Description

Returns the number of transactions sent from an address

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
// => '0x1'

eth_getTransactionReceipt

eth_getTransactionReceipt: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:457

Method

Method: "eth_getTransactionReceipt"

Parameters

Parameters: [Hash]

ReturnType

ReturnType: TransactionReceipt | null

Description

Returns the receipt of a transaction specified by hash

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
// => { ... }

eth_getUncleByBlockHashAndIndex

eth_getUncleByBlockHashAndIndex: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:469

Method

Method: "eth_getUncleByBlockHashAndIndex"

Parameters

Parameters: [Hash, Quantity]

ReturnType

ReturnType: Uncle | null

Description

Returns information about an uncle specified by block hash and uncle index position

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
// => { ... }

eth_getUncleByBlockNumberAndIndex

eth_getUncleByBlockNumberAndIndex: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:481

Method

Method: "eth_getUncleByBlockNumberAndIndex"

Parameters

Parameters: [BlockNumber | BlockTag, Quantity]

ReturnType

ReturnType: Uncle | null

Description

Returns information about an uncle specified by block number and uncle index position

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
// => { ... }

eth_getUncleCountByBlockHash

eth_getUncleCountByBlockHash: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:493

Method

Method: "eth_getUncleCountByBlockHash"

Parameters

Parameters: [Hash]

ReturnType

ReturnType: Quantity

Description

Returns the number of uncles in a block specified by block hash

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
// => '0x1'

eth_getUncleCountByBlockNumber

eth_getUncleCountByBlockNumber: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:505

Method

Method: "eth_getUncleCountByBlockNumber"

Parameters

Parameters: [BlockNumber | BlockTag]

ReturnType

ReturnType: Quantity

Description

Returns the number of uncles in a block specified by block number

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
// => '0x1'

eth_maxPriorityFeePerGas

eth_maxPriorityFeePerGas: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:517

Method

Method: "eth_maxPriorityFeePerGas"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the current maxPriorityFeePerGas in wei.

Link

https://ethereum.github.io/execution-apis/api-documentation/

Example

provider.request({ method: 'eth_maxPriorityFeePerGas' })
// => '0x5f5e100'

eth_newBlockFilter

eth_newBlockFilter: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:529

Method

Method: "eth_newBlockFilter"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Creates a filter to listen for new blocks that can be used with eth_getFilterChanges

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_newBlockFilter' })
// => '0x1'

eth_newFilter

eth_newFilter: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:541

Method

Method: "eth_newFilter"

Parameters

Parameters: [object]

ReturnType

ReturnType: Quantity

Description

Creates a filter to listen for specific state changes that can then be used with eth_getFilterChanges

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
// => '0x1'

eth_newPendingTransactionFilter

eth_newPendingTransactionFilter: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:560

Method

Method: "eth_newPendingTransactionFilter"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Creates a filter to listen for new pending transactions that can be used with eth_getFilterChanges

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_newPendingTransactionFilter' })
// => '0x1'

eth_protocolVersion

eth_protocolVersion: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:572

Method

Method: "eth_protocolVersion"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: string

Description

Returns the current Ethereum protocol version

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_protocolVersion' })
// => '54'

eth_sendRawTransaction

eth_sendRawTransaction: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:584

Method

Method: "eth_sendRawTransaction"

Parameters

Parameters: [Hex]

ReturnType

ReturnType: Hash

Description

Sends a signed transaction to the network

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
// => '0x...'

eth_uninstallFilter

eth_uninstallFilter: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:596

Method

Method: "eth_uninstallFilter"

Parameters

Parameters: [Quantity]

ReturnType

ReturnType: boolean

Description

Destroys a filter based on filter ID

Link

https://eips.ethereum.org/EIPS/eip-1474

Example

provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
// => true

net_listening

net_listening: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:78

Method

Method: "net_listening"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: boolean

Description

Determines if this client is listening for new network connections

Example

provider.request({ method: 'net_listening' })
// => true

net_peerCount

net_peerCount: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:90

Method

Method: "net_peerCount"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the number of peers currently connected to this client

Example

provider.request({ method: 'net_peerCount' })
// => '0x1'

net_version

net_version: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:102

Method

Method: "net_version"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: Quantity

Description

Returns the chain ID associated with the current network

Example

provider.request({ method: 'net_version' })
// => '1'

web3_clientVersion

web3_clientVersion: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:54

Method

Method: "web3_clientVersion"

Parameters?

optional Parameters: undefined

ReturnType

ReturnType: string

Description

Returns the version of the current client

Example

provider.request({ method: 'web3_clientVersion' })
// => 'MetaMask/v1.0.0'

web3_sha3

web3_sha3: object

Defined in: eip1193/JsonRpcSchemaPublic.ts:66

Method

Method: "web3_sha3"

Parameters

Parameters: [Hash]

ReturnType

ReturnType: string

Description

Hashes data using the Keccak-256 algorithm

Example

provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
// => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'