eth_getLogs

Retrieves logs from the Ethereum blockchain based on the specified parameters.

Example

import { getRpcClient, eth_getLogs } from "thirdweb/rpc";
const rpcRequest = getRpcClient({ client, chain });
const logs = await eth_getLogs(rpcRequest, {
address: "0x...",
fromBlock: 123456n,
toBlock: 123456n,
});
function eth_getLogs(
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: GetLogsParams,
): Promise<Array<Log>>;

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 retrieving logs.

Type

let params: GetLogsParams;

Returns

let returnType: Promise<Array<Log>>;

A promise that resolves to the retrieved logs.