eth_call

Executes a call or a transaction on the Ethereum network.

Example

import { getRpcClient, eth_call } from "thirdweb/rpc";
const rpcRequest = getRpcClient({ client, chain });
const result = await eth_call(rpcRequest, {
to: "0x...",
...
});
function eth_call(
request: EIP1193RequestFn<
[
{
Method: "web3_clientVersion";
Parameters?: undefined;
ReturnType: string;
},
{
Method: "web3_sha3";
Parameters: [data: `0x${string}`];
ReturnType: string;
},
{
Method: "net_listening";
Parameters?: undefined;
ReturnType: boolean;
},
{
Method: "net_peerCount";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
{
Method: "net_version";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
]
>,
params: Partial<RpcTransactionRequest> & {
blockNumber?: number | bigint;
blockTag?: BlockTag | undefined;
stateOverrides?: StateOverride;
},
): Promise<Hex>;

Parameters

The EIP1193 request function.

Type

let request: EIP1193RequestFn<
[
{
Method: "web3_clientVersion";
Parameters?: undefined;
ReturnType: string;
},
{
Method: "web3_sha3";
Parameters: [data: `0x${string}`];
ReturnType: string;
},
{
Method: "net_listening";
Parameters?: undefined;
ReturnType: boolean;
},
{
Method: "net_peerCount";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
{
Method: "net_version";
Parameters?: undefined;
ReturnType: `0x${string}`;
},
]
>;

The parameters for the call or transaction.

Type

let params: Partial<RpcTransactionRequest> & {
blockNumber?: number | bigint;
blockTag?: BlockTag | undefined;
stateOverrides?: StateOverride;
};

Returns

let returnType: ox__Hex.Hex;

A promise that resolves to the result of the call or transaction.