'Can't Retrieve Wallets transactions using web3
so yea I tried to get all the transactions of a wallet address on a certain token contract. But it keeps on returning null.
const Web3 = require('web3')
const web3 = new Web3('https://rpc-mainnet.maticvigil.com/v1/___')
const abi = [contains correct abi]
const contract_address = '0x----------'
const wallet_address = '0x2-----------'
var instance = new web3.eth.Contract(abi, contract_address)
instance.getPastEvents(
"Transfer",
{filter: {to: wallet_address }},
{ fromBlock: 0, toBlock: "latest" },
(errors, events) => {
if (!errors) {
console.log(events);
}
console.log(errors);
}
);
Idk what's wrong with it? Maybe I'm doing it wrong? Thank you for the help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|