Created
November 26, 2024 08:38
-
-
Save earthchie/5d1ca86de07bfbbdb81985ff907f0759 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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