Reputation: 11
I am trying to retrieve a list of all the transactions a wallet has executed on the Ethereum Mainnet but I keep getting an empty array as the result. Could you please help me fix it? Please see the code below.
import { ethers } from "ethers";
const endpointURL = "https://mainnet.infura.io/v3/8e9f219935524dd7ac8a469c9367c4b7";
const provider = new ethers.JsonRpcProvider(endpointURL);
const currentBlockNumber = await provider.getBlockNumber();
// Block number on January 01, 2024 at 00:00:00 UTC.
const startBlockNumber = 18908894;
const walletAddress = "0x6843a2F81aCc7f5903359230E54E667703416DD4";
const walletTransactionLog = await provider.getLogs(
{
address: walletAddress,
fromBlock: startBlockNumber,
toBlock: currentBlockNumber
}
);
console.log(walletTransactionLog);
I tried changing the endpoint providers but that didn't work. It keeps returning an empty array.
[]
Upvotes: 1
Views: 120