import { EthBlockNumberHandler, EthCallHandler, EthChainIdHandler, EthGetCodeHandler, EthGetStorageAtHandler, EthGasPriceHandler, EthGetBalanceHandler, SetAccountHandler, GetAccountHandler, CallHandler, ContractHandler, DumpStateHandler, LoadStateHandler, MineHandler, DeployHandler, AnvilDealHandler, CallJsonRpcRequest, CallResult, LoadStateJsonRpcRequest, LoadStateResult, DumpStateJsonRpcRequest, DumpStateResult, GetAccountJsonRpcRequest, GetAccountResult, SetAccountJsonRpcRequest, SetAccountResult, TevmJsonRpcRequestHandler, TevmJsonRpcBulkRequestHandler } from '@tevm/actions'; import * as _tevm_node from '@tevm/node'; import { Hex, BlockTag, Address, SerializeToJson } from '@tevm/utils'; import { Quantity as Quantity$1, RpcTransactionRequest, RpcBlockNumber, RpcBlockIdentifier, RpcStateOverride, RpcFeeHistory, RpcBlock, RpcLog, RpcProof, RpcTransaction, RpcTransactionReceipt, RpcUncle, PublicRpcSchema, TestRpcSchema as TestRpcSchema$1 } from 'viem'; /** * The actions api is the high level API for interacting with a Tevm client similar to [viem actions](https://viem.sh/learn/actions/) * These actions correspond 1:1 eith the public ethereum JSON-RPC api * @see {@link https://tevm.sh/learn/actions/} */ type EthActionsApi = { /** * Standard JSON-RPC methods for interacting with the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} */ eth: { /** * Returns the current block number * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const blockNumber = await tevm.eth.blockNumber() * console.log(blockNumber) // 0n */ blockNumber: EthBlockNumberHandler; /** * Executes a call without modifying the state * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const res = await tevm.eth.call({to: '0x123...', data: '0x123...'}) * console.log(res) // "0x..." */ call: EthCallHandler; /** * Returns the current chain id * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const chainId = await tevm.eth.chainId() * console.log(chainId) // 10n */ chainId: EthChainIdHandler; /** * Returns code at a given address * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const code = await tevm.eth.getCode({address: '0x123...'}) */ getCode: EthGetCodeHandler; /** * Returns storage at a given address and slot * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const storageValue = await tevm.eth.getStorageAt({address: '0x123...', position: 0}) */ getStorageAt: EthGetStorageAtHandler; /** * Returns the current gas price * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const gasPrice = await tevm.eth.gasPrice() * console.log(gasPrice) // 0n */ gasPrice: EthGasPriceHandler; /** * Returns the balance of a given address * Set the `tag` to a block number or block hash to get the balance at that block * Block tag defaults to 'pending' tag which is the optimistic state of the VM * @see {@link https://ethereum.github.io/execution-apis/api-documentation/ | JSON-RPC} * @example * const balance = await tevm.eth.getBalance({address: '0x123...', tag: 'pending'}) * console.log(gasPrice) // 0n */ getBalance: EthGetBalanceHandler; }; }; declare function ethActions(): _tevm_node.Extension; /** * The actions api is the high level API for interacting with a Tevm client similar to [viem actions](https://viem.sh/learn/actions/) * @see {@link https://tevm.sh/learn/actions/} */ type TevmActionsApi = { /** * Sets the state of a specific ethereum address * @example * import {parseEther} from 'tevm' * * await tevm.setAccount({ * address: '0x123...', * deployedBytecode: '0x6080604...', * balance: parseEther('1.0') * }) */ setAccount: SetAccountHandler; /** * Gets the state of a specific ethereum address * @example * const res = tevm.getAccount({address: '0x123...'}) * console.log(res.deployedBytecode) * console.log(res.nonce) * console.log(res.balance) */ getAccount: GetAccountHandler; /** * Executes a call against the VM. It is similar to `eth_call` but has more * options for controlling the execution environment * * By default it does not modify the state after the call is complete but this can be configured. * @example * const res = tevm.call({ * to: '0x123...', * data: '0x123...', * from: '0x123...', * gas: 1000000, * gasPrice: 1n, * skipBalance: true, * } * */ call: CallHandler; /** * Executes a contract call against the VM. It is similar to `eth_call` but has more * options for controlling the execution environment along with a typesafe API * for creating the call via the contract abi. * * The contract must already be deployed. Otherwise see `script` which executes calls * against undeployed contracts * * @example * const res = await tevm.contract({ * to: '0x123...', * abi: [...], * function: 'run', * args: ['world'] * from: '0x123...', * gas: 1000000, * gasPrice: 1n, * skipBalance: true, * } * console.log(res.data) // "hello" */ contract: ContractHandler; /** * Dumps the current state of the VM into a JSON-seralizable object * * State can be dumped as follows * @example * ```typescript * const {state} = await tevm.dumpState() * fs.writeFileSync('state.json', JSON.stringify(state)) * ``` * * And then loaded as follows * @example * ```typescript * const state = JSON.parse(fs.readFileSync('state.json')) * await tevm.loadState({state}) * ``` */ dumpState: DumpStateHandler; /** * Loads a previously dumped state into the VM * * State can be dumped as follows * @example * ```typescript * const {state} = await tevm.dumpState() * fs.writeFileSync('state.json', JSON.stringify(state)) * ``` * * And then loaded as follows * @example * ```typescript * const state = JSON.parse(fs.readFileSync('state.json')) * await tevm.loadState({state}) * ``` */ loadState: LoadStateHandler; /** * Mines 1 or more blocks */ mine: MineHandler; /** * Creates a transaction to deploys a contract to tevm */ deploy: DeployHandler; /** * Deals ERC20 tokens to an account by overriding the storage of balanceOf(account) * @example * ```typescript * await tevm.deal({ * erc20: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // Optional: USDC address * account: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', * amount: 1000000n // 1 USDC (6 decimals) * }) * ``` */ deal: AnvilDealHandler; }; declare function tevmActions(): _tevm_node.Extension; /** * Parameters for wallet_addEthereumChain RPC method (EIP-3085). * Used to request that a wallet adds a specific blockchain network. * @example * ```typescript * import { AddEthereumChainParameter } from '@tevm/decorators' * * const optimismChain: AddEthereumChainParameter = { * chainId: '0xa', // 10 in hex * chainName: 'Optimism', * nativeCurrency: { * name: 'Ether', * symbol: 'ETH', * decimals: 18 * }, * rpcUrls: ['https://mainnet.optimism.io'], * blockExplorerUrls: ['https://optimistic.etherscan.io'] * } * ``` */ type AddEthereumChainParameter = { /** A 0x-prefixed hexadecimal string */ chainId: string; /** The chain name. */ chainName: string; /** Native currency for the chain. */ nativeCurrency?: { name: string; symbol: string; decimals: number; }; rpcUrls: readonly string[]; blockExplorerUrls?: string[]; iconUrls?: string[]; }; /** * @internal * Most general RPC schema type. */ type RpcSchema = readonly { Method: string; Parameters?: unknown; ReturnType: unknown; }[]; /** * Type for overriding parameters and return types of existing JSON-RPC methods. * Used to modify or extend the behavior of standard RPC methods in a type-safe way. * @example * ```typescript * import { RpcSchemaOverride } from '@tevm/decorators' * import { createTevmNode } from 'tevm' * import { requestEip1193 } from '@tevm/decorators' * * // Define custom parameter and return types for a method * type CustomGetBlockOverride = RpcSchemaOverride & { * Parameters: [blockNumber: string, includeTransactions: boolean, includeOffchainData?: boolean] * ReturnType: { * number: string * hash: string * parentHash: string * // ... other standard fields * customData?: Record // Extended field * } * } * * // The override can be used with the standard method name * const customMethod = { * Method: 'eth_getBlockByNumber', * ...customOverride * } * ``` */ type RpcSchemaOverride = Omit; type DerivedRpcSchema = TRpcSchemaOverride extends RpcSchemaOverride ? [TRpcSchemaOverride & { Method: string; }] : TRpcSchema; type EIP1193Parameters = TRpcSchema extends RpcSchema ? { [K in keyof TRpcSchema]: { method: TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]['Method'] : never; } & (TRpcSchema[K] extends TRpcSchema[number] ? TRpcSchema[K]['Parameters'] extends undefined ? { params?: never; } : { params: TRpcSchema[K]['Parameters']; } : never); }[number] : { method: string; params?: unknown; }; /** * Options for EIP-1193 compatible JSON-RPC requests. * Controls retry behavior for network requests to Ethereum providers. * @example * ```typescript * import { EIP1193RequestOptions } from '@tevm/decorators' * import { requestEip1193 } from '@tevm/decorators' * * const node = createTevmNode().extend(requestEip1193()) * * // Add retry options to handle network instability * const options: EIP1193RequestOptions = { * retryCount: 3, // Retry failed requests up to 3 times * retryDelay: 1000 // Wait 1 second between retries * } * * await node.request({ * method: 'eth_getBalance', * params: ['0x1234...', 'latest'] * }, options) * ``` */ type EIP1193RequestOptions = { retryDelay?: number | undefined; retryCount?: number | undefined; }; type EIP1193RequestFn = > = EIP1193Parameters>, _ReturnType = DerivedRpcSchema extends RpcSchema ? Extract[number], { Method: TParameters['method']; }>['ReturnType'] : unknown>(args: TParameters, options?: EIP1193RequestOptions) => Promise<_ReturnType>; /** * Ethereum hash value represented as a hexadecimal string. * Used for block hashes, transaction hashes, state roots, etc. * @example * ```typescript * import { Hash } from '@tevm/decorators' * * const blockHash: Hash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' * const txHash: Hash = '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060' * ``` */ type Hash = `0x${string}`; /** * Event log topic for Ethereum event filtering. * Can be a single topic, array of alternative topics, or null for wildcard matching. * @example * ```typescript * import { LogTopic } from '@tevm/decorators' * * // Match specific topic * const singleTopic: LogTopic = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' * * // Match any of several topics (OR condition) * const multipleTopic: LogTopic = [ * '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', // Transfer * '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925' // Approval * ] * * // Wildcard - match any topic * const wildcardTopic: LogTopic = null * ``` */ type LogTopic = Hex | Hex[] | null; /** * Type definitions for standard Ethereum JSON-RPC methods accessible to the public. * Includes methods related to network info, blocks, transactions, and state queries. * @example * ```typescript * 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'] * }) * ``` */ type JsonRpcSchemaPublic = { /** * @description Returns the version of the current client * * @example * provider.request({ method: 'web3_clientVersion' }) * // => 'MetaMask/v1.0.0' */ web3_clientVersion: { Method: 'web3_clientVersion'; Parameters?: undefined; ReturnType: string; }; /** * @description Hashes data using the Keccak-256 algorithm * * @example * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] }) * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f' */ web3_sha3: { Method: 'web3_sha3'; Parameters: [data: Hash]; ReturnType: string; }; /** * @description Determines if this client is listening for new network connections * * @example * provider.request({ method: 'net_listening' }) * // => true */ net_listening: { Method: 'net_listening'; Parameters?: undefined; ReturnType: boolean; }; /** * @description Returns the number of peers currently connected to this client * * @example * provider.request({ method: 'net_peerCount' }) * // => '0x1' */ net_peerCount: { Method: 'net_peerCount'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @description Returns the chain ID associated with the current network * * @example * provider.request({ method: 'net_version' }) * // => '1' */ net_version: { Method: 'net_version'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @description Returns the current blob price of gas expressed in wei * * @example * provider.request({ method: 'eth_blobGasPrice' }) * // => '0x09184e72a000' */ eth_blobGasPrice: { Method: 'eth_blobGasPrice'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @description Returns the number of the most recent block seen by this client * * @example * provider.request({ method: 'eth_blockNumber' }) * // => '0x1b4' */ eth_blockNumber: { Method: 'eth_blockNumber'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @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_call: { Method: 'eth_call'; Parameters: [transaction: Partial] | [transaction: Partial, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier] | [ transaction: Partial, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier, stateOverrideSet: RpcStateOverride ]; ReturnType: Hex; }; /** * @description Returns the chain ID associated with the current network * @example * provider.request({ method: 'eth_chainId' }) * // => '1' */ eth_chainId: { Method: 'eth_chainId'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @description Returns the client coinbase address. * @example * provider.request({ method: 'eth_coinbase' }) * // => '0x...' */ eth_coinbase: { Method: 'eth_coinbase'; Parameters?: undefined; ReturnType: Address; }; /** * @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_estimateGas: { Method: 'eth_estimateGas'; Parameters: [transaction: RpcTransactionRequest] | [transaction: RpcTransactionRequest, block: RpcBlockNumber | BlockTag]; ReturnType: Quantity$1; }; /** * @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_feeHistory: { Method: 'eth_feeHistory'; Parameters: [ /** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */ blockCount: Quantity$1, /** Highest number block of the requested range. */ newestBlock: RpcBlockNumber | BlockTag, /** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */ rewardPercentiles: number[] | undefined ]; ReturnType: RpcFeeHistory; }; /** * @description Returns the current price of gas expressed in wei * * @example * provider.request({ method: 'eth_gasPrice' }) * // => '0x09184e72a000' */ eth_gasPrice: { Method: 'eth_gasPrice'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @description Returns the balance of an address in wei * * @example * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] }) * // => '0x12a05...' */ eth_getBalance: { Method: 'eth_getBalance'; Parameters: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier]; ReturnType: Quantity$1; }; /** * @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_getBlockByHash: { Method: 'eth_getBlockByHash'; Parameters: [ /** hash of a block */ hash: Hash, /** true will pull full transaction objects, false will pull transaction hashes */ includeTransactionObjects: boolean ]; ReturnType: RpcBlock | 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_getBlockByNumber: { Method: 'eth_getBlockByNumber'; Parameters: [ /** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */ block: RpcBlockNumber | BlockTag, /** true will pull full transaction objects, false will pull transaction hashes */ includeTransactionObjects: boolean ]; ReturnType: RpcBlock | null; }; /** * @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_getBlockTransactionCountByHash: { Method: 'eth_getBlockTransactionCountByHash'; Parameters: [hash: Hash]; ReturnType: Quantity$1; }; /** * @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_getBlockTransactionCountByNumber: { Method: 'eth_getBlockTransactionCountByNumber'; Parameters: [block: RpcBlockNumber | BlockTag]; ReturnType: Quantity$1; }; /** * @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_getCode: { Method: 'eth_getCode'; Parameters: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier]; ReturnType: 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_getFilterChanges: { Method: 'eth_getFilterChanges'; Parameters: [filterId: Quantity$1]; ReturnType: RpcLog[] | Hex[]; }; /** * @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_getFilterLogs: { Method: 'eth_getFilterLogs'; Parameters: [filterId: Quantity$1]; ReturnType: RpcLog[]; }; /** * @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_getLogs: { Method: 'eth_getLogs'; Parameters: [ { address?: Address | Address[]; topics?: LogTopic[]; } & ({ fromBlock?: RpcBlockNumber | BlockTag; toBlock?: RpcBlockNumber | BlockTag; blockHash?: never; } | { fromBlock?: never; toBlock?: never; blockHash?: Hash; }) ]; ReturnType: RpcLog[]; }; /** * @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_getProof: { Method: 'eth_getProof'; Parameters: [ /** Address of the account. */ address: Address, /** An array of storage-keys that should be proofed and included. */ storageKeys: Hash[], block: RpcBlockNumber | BlockTag ]; ReturnType: RpcProof; }; /** * @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_getStorageAt: { Method: 'eth_getStorageAt'; Parameters: [address: Address, index: Quantity$1, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier]; ReturnType: Hex; }; /** * @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_getTransactionByBlockHashAndIndex: { Method: 'eth_getTransactionByBlockHashAndIndex'; Parameters: [hash: Hash, index: Quantity$1]; ReturnType: RpcTransaction | 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_getTransactionByBlockNumberAndIndex: { Method: 'eth_getTransactionByBlockNumberAndIndex'; Parameters: [block: RpcBlockNumber | BlockTag, index: Quantity$1]; ReturnType: RpcTransaction | 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_getTransactionByHash: { Method: 'eth_getTransactionByHash'; Parameters: [hash: Hash]; ReturnType: RpcTransaction | null; }; /** * @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_getTransactionCount: { Method: 'eth_getTransactionCount'; Parameters: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier]; ReturnType: Quantity$1; }; /** * @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_getTransactionReceipt: { Method: 'eth_getTransactionReceipt'; Parameters: [hash: Hash]; ReturnType: RpcTransactionReceipt | 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_getUncleByBlockHashAndIndex: { Method: 'eth_getUncleByBlockHashAndIndex'; Parameters: [hash: Hash, index: Quantity$1]; ReturnType: RpcUncle | 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_getUncleByBlockNumberAndIndex: { Method: 'eth_getUncleByBlockNumberAndIndex'; Parameters: [block: RpcBlockNumber | BlockTag, index: Quantity$1]; ReturnType: RpcUncle | null; }; /** * @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_getUncleCountByBlockHash: { Method: 'eth_getUncleCountByBlockHash'; Parameters: [hash: Hash]; ReturnType: Quantity$1; }; /** * @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_getUncleCountByBlockNumber: { Method: 'eth_getUncleCountByBlockNumber'; Parameters: [block: RpcBlockNumber | BlockTag]; ReturnType: Quantity$1; }; /** * @description Returns the current maxPriorityFeePerGas in wei. * @link https://ethereum.github.io/execution-apis/api-documentation/ * @example * provider.request({ method: 'eth_maxPriorityFeePerGas' }) * // => '0x5f5e100' */ eth_maxPriorityFeePerGas: { Method: 'eth_maxPriorityFeePerGas'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @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_newBlockFilter: { Method: 'eth_newBlockFilter'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @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_newFilter: { Method: 'eth_newFilter'; Parameters: [ filter: { fromBlock?: RpcBlockNumber | BlockTag; toBlock?: RpcBlockNumber | BlockTag; address?: Address | Address[]; topics?: LogTopic[]; } ]; ReturnType: Quantity$1; }; /** * @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_newPendingTransactionFilter: { Method: 'eth_newPendingTransactionFilter'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @description Returns the current Ethereum protocol version * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_protocolVersion' }) * // => '54' */ eth_protocolVersion: { Method: 'eth_protocolVersion'; Parameters?: undefined; ReturnType: string; }; /** * @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_sendRawTransaction: { Method: 'eth_sendRawTransaction'; Parameters: [signedTransaction: Hex]; ReturnType: Hash; }; /** * @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 */ eth_uninstallFilter: { Method: 'eth_uninstallFilter'; Parameters: [filterId: Quantity$1]; ReturnType: boolean; }; }; type TestRpcSchema = [ /** * @description Add information about compiled contracts * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_addcompilationresult */ addCompilationResult: { Method: `${TMode}_addCompilationResult`; Parameters: any[]; ReturnType: any; }, /** * @description Remove a transaction from the mempool * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_droptransaction */ dropTransaction: { Method: `${TMode}_dropTransaction`; Parameters: [hash: Hash]; ReturnType: void; }, /** * @description Serializes the current state (including contracts code, contract's storage, accounts properties, etc.) into a savable data blob. */ dumpState: { Method: `${TMode}_dumpState`; Parameters?: undefined; ReturnType: Hex; }, /** * @description Turn on call traces for transactions that are returned to the user when they execute a transaction (instead of just txhash/receipt). */ enableTraces: { Method: `${TMode}_enableTraces`; Parameters?: undefined; ReturnType: void; }, /** * @description Impersonate an account or contract address. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_impersonateaccount */ impersonateAccount: { Method: `${TMode}_impersonateAccount`; Parameters: [address: Address]; ReturnType: void; }, /** * @description Returns true if automatic mining is enabled, and false otherwise. See [Mining Modes](https://hardhat.org/hardhat-network/explanation/mining-modes) to learn more. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_getautomine */ getAutomine: { Method: `${TMode}_getAutomine`; Parameters?: undefined; ReturnType: boolean; }, /** * @description Adds state previously dumped with `dumpState` to the current chain. */ loadState: { Method: `${TMode}_loadState`; Parameters?: [Hex]; ReturnType: void; }, /** * @description Advance the block number of the network by a certain number of blocks * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_mine */ mine: { Method: `${TMode}_mine`; Parameters: [ /** Number of blocks to mine. */ count: Hex, /** Interval between each block in seconds. */ interval: Hex | undefined ]; ReturnType: void; }, /** * @description Resets the fork. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_reset */ reset: { Method: `${TMode}_reset`; Parameters: any[]; ReturnType: void; }, /** * @description Modifies the balance of an account. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setbalance */ setBalance: { Method: `${TMode}_setBalance`; Parameters: [ /** The address of the target account. */ address: Address, /** Amount to send in wei. */ balance: Quantity$1 ]; ReturnType: void; }, /** * @description Modifies the bytecode stored at an account's address. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcode */ setCode: { Method: `${TMode}_setCode`; Parameters: [ /** The address of the contract. */ address: Address, /** Data bytecode. */ data: string ]; ReturnType: void; }, /** * @description Sets the coinbase address to be used in new blocks. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase */ setCoinbase: { Method: `${TMode}_setCoinbase`; Parameters: [ /** The address to set as the coinbase address. */ address: Address ]; ReturnType: void; }, /** * @description Enable or disable logging on the test node network. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setcoinbase */ setLoggingEnabled: { Method: `${TMode}_setLoggingEnabled`; Parameters: [enabled: boolean]; ReturnType: void; }, /** * @description Change the minimum gas price accepted by the network (in wei). * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setmingasprice */ setMinGasPrice: { Method: `${TMode}_setMinGasPrice`; Parameters: [gasPrice: Quantity$1]; ReturnType: void; }, /** * @description Sets the base fee of the next block. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnextblockbasefeepergas */ setNextBlockBaseFeePerGas: { Method: `${TMode}_setNextBlockBaseFeePerGas`; Parameters: [baseFeePerGas: Quantity$1]; ReturnType: void; }, /** * @description Modifies an account's nonce by overwriting it. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setnonce */ setNonce: { Method: `${TMode}_setNonce`; Parameters: [ /** The account address. */ address: Address, /** The new nonce. */ nonce: Quantity$1 ]; ReturnType: void; }, /** * @description Sets the backend RPC URL. */ setRpcUrl: { Method: `${TMode}_setRpcUrl`; Parameters: [url: string]; ReturnType: void; }, /** * @description Writes a single position of an account's storage. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_setstorageat */ setStorageAt: { Method: `${TMode}_setStorageAt`; Parameters: [ /** The account address. */ address: Address, /** The storage position index. */ index: Quantity$1, /** The storage value. */ value: Quantity$1 ]; ReturnType: void; }, /** * @description Use this method to stop impersonating an account after having previously used impersonateAccount. * @link https://hardhat.org/hardhat-network/docs/reference#hardhat_stopimpersonatingaccount */ stopImpersonatingAccount: { Method: `${TMode}_stopImpersonatingAccount`; Parameters: [ /** The address to stop impersonating. */ address: Address ]; ReturnType: void; }, /** * @description Jump forward in time by the given amount of time, in seconds. * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime */ increaseTime: { Method: `${TMode}_increaseTime`; Parameters: [seconds: number]; ReturnType: Quantity$1; }, /** * @description Modifies the balance of an account. * @link https://ganache.dev/#evm_setAccountBalance */ setAccountBalance: { Method: `evm_setAccountBalance`; Parameters: [ /** The address of the target account. */ address: Address, /** Amount to send in wei. */ value: Quantity$1 ]; ReturnType: void; }, /** * @description Enables or disables, based on the single boolean argument, the automatic mining of new blocks with each new transaction submitted to the network. * @link https://hardhat.org/hardhat-network/docs/reference#evm_setautomine */ evm_setAutomine: { Method: `evm_setAutomine`; Parameters: [boolean]; ReturnType: void; }, /** * @description Sets the block's gas limit. * @link https://hardhat.org/hardhat-network/docs/reference#evm_setblockgaslimit */ evm_setBlockGasLimit: { Method: 'evm_setBlockGasLimit'; Parameters: [gasLimit: Quantity$1]; ReturnType: void; }, /** * @description Jump forward in time by the given amount of time, in seconds. * @link https://github.com/trufflesuite/ganache/blob/ef1858d5d6f27e4baeb75cccd57fb3dc77a45ae8/src/chains/ethereum/ethereum/RPC-METHODS.md#evm_increasetime */ evm_increaseTime: { Method: `evm_increaseTime`; Parameters: [seconds: Quantity$1]; ReturnType: Quantity$1; }, /** * @description Similar to `evm_increaseTime` but sets a block timestamp `interval`. * The timestamp of the next block will be computed as `lastBlock_timestamp` + `interval` */ setBlockTimestampInterval: { Method: `${TMode}_setBlockTimestampInterval`; Parameters: [seconds: number]; ReturnType: void; }, /** * @description Removes `setBlockTimestampInterval` if it exists */ removeBlockTimestampInterval: { Method: `${TMode}_removeBlockTimestampInterval`; Parameters?: undefined; ReturnType: void; }, /** * @description Enables (with a numeric argument greater than 0) or disables (with a numeric argument equal to 0), the automatic mining of blocks at a regular interval of milliseconds, each of which will include all pending transactions. * @link https://hardhat.org/hardhat-network/docs/reference#evm_setintervalmining */ evm_setIntervalMining: { Method: 'evm_setIntervalMining'; Parameters: [number]; ReturnType: void; }, /** * @description Set the timestamp of the next block. * @link https://hardhat.org/hardhat-network/docs/reference#evm_setnextblocktimestamp */ evm_setNextBlockTimestamp: { Method: 'evm_setNextBlockTimestamp'; Parameters: [Quantity$1]; ReturnType: void; }, /** * @description Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the id of the snapshot that was created. * @link https://hardhat.org/hardhat-network/docs/reference#evm_snapshot */ evm_snapshot: { Method: 'evm_snapshot'; Parameters?: undefined; ReturnType: Quantity$1; }, /** * @description Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to. */ evm_revert: { Method: 'evm_revert'; Parameters?: [id: Quantity$1]; ReturnType: void; }, /** * @description Enables the automatic mining of new blocks with each new transaction submitted to the network. * @link https://ganache.dev/#miner_start */ miner_start: { Method: 'miner_start'; Parameters?: undefined; ReturnType: void; }, /** * @description Disables the automatic mining of new blocks with each new transaction submitted to the network. * @link https://ganache.dev/#miner_stop */ miner_stop: { Method: 'miner_stop'; Parameters?: undefined; ReturnType: void; }, /** * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-content */ txpool_content: { Method: 'txpool_content'; Parameters?: undefined; ReturnType: { pending: Record>; queued: Record>; }; }, /** * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect */ txpool_inspect: { Method: 'txpool_inspect'; Parameters?: undefined; ReturnType: { pending: Record>; queued: Record>; }; }, /** * @link https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-txpool#txpool-inspect */ txpool_status: { Method: 'txpool_status'; Parameters?: undefined; ReturnType: { pending: Quantity$1; queued: Quantity$1; }; }, /** * @description Returns whether the client is actively mining new blocks. * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_mining' }) * // => true */ eth_mining: { Method: 'eth_mining'; Parameters?: undefined; ReturnType: boolean; }, /** * @description Advance the block number of the network by a certain number of blocks. * @link https://ganache.dev/#evm_mine */ evm_mine: { Method: 'evm_mine'; Parameters?: [ { /** Number of blocks to mine. */ blocks: Hex; } ]; ReturnType: void; }, /** * @description Creates, signs, and sends a new transaction to the network regardless of the signature. * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] }) * // => '0x...' */ eth_sendUnsignedTransaction: { Method: 'eth_sendUnsignedTransaction'; Parameters: [transaction: RpcTransactionRequest]; ReturnType: Hash; } ]; /** * Type definitions for Tevm-specific JSON-RPC methods. * Includes methods for state manipulation, EVM calls, and account management. * @example * ```typescript * import { JsonRpcSchemaTevm } from '@tevm/decorators' * import { createTevmNode } from 'tevm' * import { requestEip1193 } from '@tevm/decorators' * * const node = createTevmNode().extend(requestEip1193()) * * // Execute a call with detailed return data * const result = await node.request({ * method: 'tevm_call', * params: [{ * to: '0x1234567890123456789012345678901234567890', * data: '0xa9059cbb000000000000000000000000deadbeefdeadbeefdeadbeefdeadbeefdeadbeef0000000000000000000000000000000000000000000000000de0b6b3a7640000' * }] * }) * * // Get the state of an account * const account = await node.request({ * method: 'tevm_getAccount', * params: [{ address: '0x1234567890123456789012345678901234567890' }] * }) * ``` */ type JsonRpcSchemaTevm = { /** * @description A versatile way of executing an EVM call with many options and detailed return data * @link https://tevm.sh/learn/json-rpc/#tevm-methods * @example * provider.request({ method: 'tevm_call', params: [{ from: '0x...', to: '0x...', data: '0x...' }] })}) * // => { data: '0x...', events: [{...}], ... } */ tevm_call: { Method: 'tevm_call'; Parameters: CallJsonRpcRequest['params']; ReturnType: SerializeToJson>; }; /** * @description Loads the provided state into the EVM * @link https://tevm.sh/learn/json-rpc/#tevm-methods * @example * provider.request({ method: 'tevm_loadState', params: [{ state: {...} }] }])}) * // => { success: true } */ tevm_loadState: { Method: 'tevm_loadState'; Parameters: LoadStateJsonRpcRequest['params']; ReturnType: SerializeToJson>; }; /** * @description Dumps the current cached state of the EVM. * @link https://tevm.sh/learn/json-rpc/#tevm-methods * @example * provider.request({ method: 'tevm_dumpState' })}) */ tevm_dumpState: { Method: 'tevm_dumpState'; Parameters?: DumpStateJsonRpcRequest['params']; ReturnType: SerializeToJson>; }; /** * @description Returns the account state of the given address * @link https://tevm.sh/learn/json-rpc/#tevm-methods * @example * provider.request({ method: 'tevm_getAccount', params: [{address: '0x...' }])}) */ tevm_getAccount: { Method: 'tevm_getAccount'; Parameters: GetAccountJsonRpcRequest['params']; ReturnType: SerializeToJson>; }; /** * @description Sets the account state of the given address * @link https://tevm.sh/learn/json-rpc/#tevm-methods * @example * provider.request({ method: 'tevm_setAccount', params: [{address: '0x...', value: '0x42' }])}) r */ tevm_setAccount: { Method: 'tevm_setAccount'; Parameters: SetAccountJsonRpcRequest['params']; ReturnType: SerializeToJson>; }; }; /** * Hexadecimal string representation of an Ethereum quantity (number). * Used throughout the Ethereum JSON-RPC API for numerical values. * @example * ```typescript * import { Quantity } from '@tevm/decorators' * * const blockNumber: Quantity = '0x4b7' // 1207 in decimal * const gasPrice: Quantity = '0x3b9aca00' // 1,000,000,000 in decimal (1 Gwei) * ``` */ type Quantity = Hex; /** * Information about the Ethereum client's sync status. * Returned by the eth_syncing JSON-RPC method when synchronization is in progress. * @example * ```typescript * import { NetworkSync } from '@tevm/decorators' * import { createTevmNode } from 'tevm' * import { requestEip1193 } from '@tevm/decorators' * * const node = createTevmNode().extend(requestEip1193()) * const syncStatus = await node.request({ method: 'eth_syncing' }) * * if (syncStatus !== false) { * const networkSync: NetworkSync = syncStatus * console.log(`Syncing: ${networkSync.currentBlock} of ${networkSync.highestBlock}`) * console.log(`Progress: ${(parseInt(networkSync.currentBlock, 16) / parseInt(networkSync.highestBlock, 16) * 100).toFixed(2)}%`) * } else { * console.log('Node is fully synced') * } * ``` */ type NetworkSync = { /** The current block number */ currentBlock: Quantity; /** Number of latest block on the network */ highestBlock: Quantity; /** Block number at which syncing started */ startingBlock: Quantity; }; /** * Restrictions or conditions applied to a wallet permission. * Used in the EIP-2255 wallet permissions system to add constraints to granted permissions. * @example * ```typescript * import { WalletPermissionCaveat } from '@tevm/decorators' * * const addressCaveat: WalletPermissionCaveat = { * type: 'restrictReturnedAccounts', * value: ['0x1234567890123456789012345678901234567890'] * } * * const expirationCaveat: WalletPermissionCaveat = { * type: 'expiresOn', * value: 1720872662291 // Unix timestamp in milliseconds * } * ``` */ type WalletPermissionCaveat = { type: string; value: any; }; /** * Permission granted to a website or application by a wallet. * Defined in EIP-2255 for the wallet permissions management system. * @example * ```typescript * import { WalletPermission } from '@tevm/decorators' * import { createTevmNode } from 'tevm' * import { requestEip1193 } from '@tevm/decorators' * * const node = createTevmNode().extend(requestEip1193()) * * // Request and display current wallet permissions * const permissions = await node.request({ * method: 'wallet_getPermissions' * }) * * const accountsPermission: WalletPermission = { * id: 'ZcbZ7h80QuyOfK1im9OHbw', * parentCapability: 'eth_accounts', * invoker: 'https://example.com', * date: 1720872662291, * caveats: [{ * type: 'restrictReturnedAccounts', * value: ['0x1234567890123456789012345678901234567890'] * }] * } * ``` */ type WalletPermission = { caveats: WalletPermissionCaveat[]; date: number; id: string; invoker: `http://${string}` | `https://${string}`; parentCapability: 'eth_accounts' | string; }; /** * Parameters for the `watchAsset` method. */ type WatchAssetParams = { /** Token type. */ type: 'ERC20'; options: { /** The address of the token contract */ address: string; /** A ticker symbol or shorthand, up to 11 characters */ symbol: string; /** The number of token decimals */ decimals: number; /** A string url of the token logo */ image?: string; }; }; /** * Type definitions for Ethereum JSON-RPC methods that interact with wallets. * Includes methods for account management, signing, transactions, and wallet-specific features. * @example * ```typescript * import { JsonRpcSchemaWallet } from '@tevm/decorators' * import { createTevmNode } from 'tevm' * import { requestEip1193 } from '@tevm/decorators' * * const node = createTevmNode().extend(requestEip1193()) * * // Request accounts access (triggers wallet popup) * const accounts = await node.request({ * method: 'eth_requestAccounts' * }) * * // Send a transaction * const txHash = await node.request({ * method: 'eth_sendTransaction', * params: [{ * from: accounts[0], * to: '0x1234567890123456789012345678901234567890', * value: '0xde0b6b3a7640000' // 1 ETH * }] * }) * ``` */ type JsonRpcSchemaWallet = { /** * @description Returns a list of addresses owned by this client * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_accounts' }) * // => ['0x0fB69...'] */ eth_accounts: { Method: 'eth_accounts'; Parameters?: undefined; ReturnType: Address[]; }; /** * @description Returns the current chain ID associated with the wallet. * @example * provider.request({ method: 'eth_chainId' }) * // => '1' */ eth_chainId: { Method: 'eth_chainId'; Parameters?: undefined; ReturnType: Quantity$1; }; /** * @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_estimateGas: { Method: 'eth_estimateGas'; Parameters: [transaction: RpcTransactionRequest] | [transaction: RpcTransactionRequest, block: RpcBlockNumber | BlockTag]; ReturnType: Quantity$1; }; /** * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear. * @link https://eips.ethereum.org/EIPS/eip-1102 * @example * provider.request({ method: 'eth_requestAccounts' }] }) * // => ['0x...', '0x...'] */ eth_requestAccounts: { Method: 'eth_requestAccounts'; Parameters?: undefined; ReturnType: Address[]; }; /** * @description Creates, signs, and sends a new transaction to the network * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] }) * // => '0x...' */ eth_sendTransaction: { Method: 'eth_sendTransaction'; Parameters: [transaction: RpcTransactionRequest]; ReturnType: Hash; }; /** * @description Sends and already-signed transaction to the network * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] }) * // => '0x...' */ eth_sendRawTransaction: { Method: 'eth_sendRawTransaction'; Parameters: [signedTransaction: Hex]; ReturnType: Hash; }; /** * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))` * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] }) * // => '0x...' */ eth_sign: { Method: 'eth_sign'; Parameters: [ /** Address to use for signing */ address: Address, /** Data to sign */ data: Hex ]; ReturnType: Hex; }; /** * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction` * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] }) * // => '0x...' */ eth_signTransaction: { Method: 'eth_signTransaction'; Parameters: [request: RpcTransactionRequest]; ReturnType: Hex; }; /** * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))` * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] }) * // => '0x...' */ eth_signTypedData_v4: { Method: 'eth_signTypedData_v4'; Parameters: [ /** Address to use for signing */ address: Address, /** Message to sign containing type information, a domain separator, and data */ message: string ]; ReturnType: Hex; }; /** * @description Returns information about the status of this client’s network synchronization * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'eth_syncing' }) * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' } */ eth_syncing: { Method: 'eth_syncing'; Parameters?: undefined; ReturnType: NetworkSync | false; }; /** * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))` * @link https://eips.ethereum.org/EIPS/eip-1474 * @example * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] }) * // => '0x...' */ personal_sign: { Method: 'personal_sign'; Parameters: [ /** Data to sign */ data: Hex, /** Address to use for signing */ address: Address ]; ReturnType: Hex; }; /** * @description Add an Ethereum chain to the wallet. * @link https://eips.ethereum.org/EIPS/eip-3085 * @example * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] }) * // => { ... } */ wallet_addEthereumChain: { Method: 'wallet_addEthereumChain'; Parameters: [chain: AddEthereumChainParameter]; ReturnType: null; }; /** * @description Gets the wallets current permissions. * @link https://eips.ethereum.org/EIPS/eip-2255 * @example * provider.request({ method: 'wallet_getPermissions' }) * // => { ... } */ wallet_getPermissions: { Method: 'wallet_getPermissions'; Parameters?: undefined; ReturnType: WalletPermission[]; }; /** * @description Requests the given permissions from the user. * @link https://eips.ethereum.org/EIPS/eip-2255 * @example * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] }) * // => { ... } */ wallet_requestPermissions: { Method: 'wallet_requestPermissions'; Parameters: [permissions: { eth_accounts: Record; }]; ReturnType: WalletPermission[]; }; /** * @description Switch the wallet to the given Ethereum chain. * @link https://eips.ethereum.org/EIPS/eip-3326 * @example * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] }) * // => { ... } */ wallet_switchEthereumChain: { Method: 'wallet_switchEthereumChain'; Parameters: [chain: { chainId: string; }]; ReturnType: null; }; /** * @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added. * @link https://eips.ethereum.org/EIPS/eip-747 * @example * provider.request({ method: 'wallet_watchAsset' }] }) * // => true */ wallet_watchAsset: { Method: 'wallet_watchAsset'; Parameters: WatchAssetParams; ReturnType: boolean; }; }; /** * * The default EIP1193 compatable provider request method with enabled tevm methods. */ type Eip1193RequestProvider = { request: EIP1193RequestFn<[ ...PublicRpcSchema, ...TestRpcSchema$1<'anvil' | 'ganache' | 'hardhat'>, JsonRpcSchemaTevm['tevm_call'], JsonRpcSchemaTevm['tevm_dumpState'], JsonRpcSchemaTevm['tevm_loadState'], JsonRpcSchemaTevm['tevm_getAccount'], JsonRpcSchemaTevm['tevm_setAccount'] ]>; }; declare function requestEip1193(): _tevm_node.Extension; /** * API interface for sending JSON-RPC requests to Tevm * Provides methods for both single and bulk requests * * @example * ```typescript * import { TevmSendApi } from '@tevm/decorators' * * // Example usage with a Tevm client * const client: TevmSendApi = { * send: async (request) => { return null }, // implementation * sendBulk: async (requests) => { return [] } // implementation * } * * // Send a single request * await client.send({ * method: 'eth_blockNumber', * params: [] * }) * * // Send multiple requests in bulk * await client.sendBulk([ * { method: 'eth_blockNumber', params: [] }, * { method: 'eth_getBalance', params: ['0x...', 'latest'] } * ]) * ``` */ type TevmSendApi = { send: TevmJsonRpcRequestHandler; sendBulk: TevmJsonRpcBulkRequestHandler; }; declare function tevmSend(): _tevm_node.Extension; export { type AddEthereumChainParameter, type DerivedRpcSchema, type EIP1193Parameters, type EIP1193RequestFn, type EIP1193RequestOptions, type Eip1193RequestProvider, type EthActionsApi, type Hash, type JsonRpcSchemaPublic, type JsonRpcSchemaTevm, type JsonRpcSchemaWallet, type LogTopic, type NetworkSync, type Quantity, type RpcSchema, type RpcSchemaOverride, type TestRpcSchema, type TevmActionsApi, type TevmSendApi, type WalletPermission, type WalletPermissionCaveat, type WatchAssetParams, ethActions, requestEip1193, tevmActions, tevmSend };