@tevm/decorators / 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.
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']
})eth_blobGasPrice:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:114
Method:
"eth_blobGasPrice"
optionalParameters:undefined
ReturnType:
Quantity
Returns the current blob price of gas expressed in wei
provider.request({ method: 'eth_blobGasPrice' })
// => '0x09184e72a000'eth_blockNumber:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:126
Method:
"eth_blockNumber"
optionalParameters:undefined
ReturnType:
Quantity
Returns the number of the most recent block seen by this client
provider.request({ method: 'eth_blockNumber' })
// => '0x1b4'eth_call:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:138
Method:
"eth_call"
Parameters: [
Partial<TransactionRequest>] | [Partial<TransactionRequest>,BlockNumber|BlockTag|BlockIdentifier] | [Partial<TransactionRequest>,BlockNumber|BlockTag|BlockIdentifier,RpcStateOverride]
ReturnType:
Hex
Executes a new message call immediately without submitting a transaction to the network
provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
// => '0x...'eth_chainId:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:156
Method:
"eth_chainId"
optionalParameters:undefined
ReturnType:
Quantity
Returns the chain ID associated with the current network
provider.request({ method: 'eth_chainId' })
// => '1'eth_coinbase:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:167
Method:
"eth_coinbase"
optionalParameters:undefined
ReturnType:
Address
Returns the client coinbase address.
provider.request({ method: 'eth_coinbase' })
// => '0x...'eth_estimateGas:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:182
Method:
"eth_estimateGas"
Parameters: [
TransactionRequest] | [TransactionRequest,BlockNumber|BlockTag]
ReturnType:
Quantity
Estimates the gas necessary to complete a transaction without submitting it to the network
provider.request({
method: 'eth_estimateGas',
params: [{ from: '0x...', to: '0x...', value: '0x...' }]
})
// => '0x5208'eth_feeHistory:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:202
Method:
"eth_feeHistory"
Parameters: [
Quantity,BlockNumber|BlockTag,number[] |undefined]
ReturnType:
FeeHistory
Returns a collection of historical gas information
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:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:221
Method:
"eth_gasPrice"
optionalParameters:undefined
ReturnType:
Quantity
Returns the current price of gas expressed in wei
provider.request({ method: 'eth_gasPrice' })
// => '0x09184e72a000'eth_getBalance:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:233
Method:
"eth_getBalance"
Parameters: [
Address,BlockNumber|BlockTag|BlockIdentifier]
ReturnType:
Quantity
Returns the balance of an address in wei
provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
// => '0x12a05...'eth_getBlockByHash:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:250
Method:
"eth_getBlockByHash"
Parameters: [
Hash,boolean]
ReturnType:
Block|null
Returns information about a block specified by hash
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
// => {
// number: '0x1b4',
// hash: '0x...',
// parentHash: '0x...',
// ...
// }eth_getBlockByNumber:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:272
Method:
"eth_getBlockByNumber"
Parameters: [
BlockNumber|BlockTag,boolean]
ReturnType:
Block|null
Returns information about a block specified by number
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
// => {
// number: '0x1b4',
// hash: '0x...',
// parentHash: '0x...',
// ...
// }eth_getBlockTransactionCountByHash:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:289
Method:
"eth_getBlockTransactionCountByHash"
Parameters: [
Hash]
ReturnType:
Quantity
Returns the number of transactions in a block specified by block hash
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
// => '0x1'eth_getBlockTransactionCountByNumber:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:301
Method:
"eth_getBlockTransactionCountByNumber"
Parameters: [
BlockNumber|BlockTag]
ReturnType:
Quantity
Returns the number of transactions in a block specified by block number
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
// => '0x1'eth_getCode:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:313
Method:
"eth_getCode"
Parameters: [
Address,BlockNumber|BlockTag|BlockIdentifier]
ReturnType:
Hex
Returns the contract code stored at a given address
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
// => '0x...'eth_getFilterChanges:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:325
Method:
"eth_getFilterChanges"
Parameters: [
Quantity]
ReturnType:
Log[] |Hex[]
Returns a list of all logs based on filter ID since the last log retrieval
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
// => [{ ... }, { ... }]eth_getFilterLogs:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:337
Method:
"eth_getFilterLogs"
Parameters: [
Quantity]
ReturnType:
Log[]
Returns a list of all logs based on filter ID
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
// => [{ ... }, { ... }]eth_getLogs:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:349
Method:
"eth_getLogs"
Parameters: [
object& {blockHash?:never;fromBlock?:BlockNumber|BlockTag;toBlock?:BlockNumber|BlockTag; } | {blockHash?:Hash;fromBlock?:never;toBlock?:never; }]
ReturnType:
Log[]
Returns a list of all logs based on a filter object
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
// => [{ ... }, { ... }]eth_getProof:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:379
Method:
"eth_getProof"
Parameters: [
Address,Hash[],BlockNumber|BlockTag]
ReturnType:
Proof
Returns the account and storage values of the specified account including the Merkle-proof.
https://eips.ethereum.org/EIPS/eip-1186
provider.request({ method: 'eth_getProof', params: ['0x...', ['0x...'], 'latest'] })
// => {
// ...
// }eth_getStorageAt:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:397
Method:
"eth_getStorageAt"
Parameters: [
Address,Quantity,BlockNumber|BlockTag|BlockIdentifier]
ReturnType:
Hex
Returns the value from a storage position at an address
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
// => '0x...'eth_getTransactionByBlockHashAndIndex:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:409
Method:
"eth_getTransactionByBlockHashAndIndex"
Parameters: [
Hash,Quantity]
ReturnType:
Transaction|null
Returns information about a transaction specified by block hash and transaction index
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
// => { ... }eth_getTransactionByBlockNumberAndIndex:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:421
Method:
"eth_getTransactionByBlockNumberAndIndex"
Parameters: [
BlockNumber|BlockTag,Quantity]
ReturnType:
Transaction|null
Returns information about a transaction specified by block number and transaction index
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
// => { ... }eth_getTransactionByHash:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:433
Method:
"eth_getTransactionByHash"
Parameters: [
Hash]
ReturnType:
Transaction|null
Returns information about a transaction specified by hash
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
// => { ... }eth_getTransactionCount:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:445
Method:
"eth_getTransactionCount"
Parameters: [
Address,BlockNumber|BlockTag|BlockIdentifier]
ReturnType:
Quantity
Returns the number of transactions sent from an address
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
// => '0x1'eth_getTransactionReceipt:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:457
Method:
"eth_getTransactionReceipt"
Parameters: [
Hash]
ReturnType:
TransactionReceipt|null
Returns the receipt of a transaction specified by hash
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
// => { ... }eth_getUncleByBlockHashAndIndex:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:469
Method:
"eth_getUncleByBlockHashAndIndex"
Parameters: [
Hash,Quantity]
ReturnType:
Uncle|null
Returns information about an uncle specified by block hash and uncle index position
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
// => { ... }eth_getUncleByBlockNumberAndIndex:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:481
Method:
"eth_getUncleByBlockNumberAndIndex"
Parameters: [
BlockNumber|BlockTag,Quantity]
ReturnType:
Uncle|null
Returns information about an uncle specified by block number and uncle index position
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
// => { ... }eth_getUncleCountByBlockHash:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:493
Method:
"eth_getUncleCountByBlockHash"
Parameters: [
Hash]
ReturnType:
Quantity
Returns the number of uncles in a block specified by block hash
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
// => '0x1'eth_getUncleCountByBlockNumber:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:505
Method:
"eth_getUncleCountByBlockNumber"
Parameters: [
BlockNumber|BlockTag]
ReturnType:
Quantity
Returns the number of uncles in a block specified by block number
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
// => '0x1'eth_maxPriorityFeePerGas:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:517
Method:
"eth_maxPriorityFeePerGas"
optionalParameters:undefined
ReturnType:
Quantity
Returns the current maxPriorityFeePerGas in wei.
https://ethereum.github.io/execution-apis/api-documentation/
provider.request({ method: 'eth_maxPriorityFeePerGas' })
// => '0x5f5e100'eth_newBlockFilter:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:529
Method:
"eth_newBlockFilter"
optionalParameters:undefined
ReturnType:
Quantity
Creates a filter to listen for new blocks that can be used with eth_getFilterChanges
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_newBlockFilter' })
// => '0x1'eth_newFilter:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:541
Method:
"eth_newFilter"
Parameters: [
object]
ReturnType:
Quantity
Creates a filter to listen for specific state changes that can then be used with eth_getFilterChanges
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
// => '0x1'eth_newPendingTransactionFilter:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:560
Method:
"eth_newPendingTransactionFilter"
optionalParameters:undefined
ReturnType:
Quantity
Creates a filter to listen for new pending transactions that can be used with eth_getFilterChanges
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_newPendingTransactionFilter' })
// => '0x1'eth_protocolVersion:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:572
Method:
"eth_protocolVersion"
optionalParameters:undefined
ReturnType:
string
Returns the current Ethereum protocol version
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_protocolVersion' })
// => '54'eth_sendRawTransaction:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:584
Method:
"eth_sendRawTransaction"
Parameters: [
Hex]
ReturnType:
Hash
Sends a signed transaction to the network
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
// => '0x...'eth_uninstallFilter:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:596
Method:
"eth_uninstallFilter"
Parameters: [
Quantity]
ReturnType:
boolean
Destroys a filter based on filter ID
https://eips.ethereum.org/EIPS/eip-1474
provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
// => truenet_listening:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:78
Method:
"net_listening"
optionalParameters:undefined
ReturnType:
boolean
Determines if this client is listening for new network connections
provider.request({ method: 'net_listening' })
// => truenet_peerCount:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:90
Method:
"net_peerCount"
optionalParameters:undefined
ReturnType:
Quantity
Returns the number of peers currently connected to this client
provider.request({ method: 'net_peerCount' })
// => '0x1'net_version:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:102
Method:
"net_version"
optionalParameters:undefined
ReturnType:
Quantity
Returns the chain ID associated with the current network
provider.request({ method: 'net_version' })
// => '1'web3_clientVersion:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:54
Method:
"web3_clientVersion"
optionalParameters:undefined
ReturnType:
string
Returns the version of the current client
provider.request({ method: 'web3_clientVersion' })
// => 'MetaMask/v1.0.0'web3_sha3:
object
Defined in: eip1193/JsonRpcSchemaPublic.ts:66
Method:
"web3_sha3"
Parameters: [
Hash]
ReturnType:
string
Hashes data using the Keccak-256 algorithm
provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
// => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'