Skip to content

Instantly share code, notes, and snippets.

@earthchie
Created November 26, 2024 08:38
Show Gist options
  • Save earthchie/5d1ca86de07bfbbdb81985ff907f0759 to your computer and use it in GitHub Desktop.
Save earthchie/5d1ca86de07bfbbdb81985ff907f0759 to your computer and use it in GitHub Desktop.
const ethers = require('ethers');
async function app() {
const abi = [
'event Transfer(address indexed from, address indexed to, uint256 value)'
];
const provider = new ethers.providers.JsonRpcProvider('https://data-seed-prebsc-1-s1.binance.org:8545/'); // BSC TESTNET
const contract = new ethers.Contract('0x...ERC-20 contract_address...', abi, provider);
const address = '0x...'; // our wallet address
contract.on('Transfer', async function(from, to, value){
if(to === address){
console.log('Incoming from ', from, , 'to', to, 'amount', ethers.utils.formatUnits(value));
}
});
}
app();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment