I am creating Ethereum Wallet application & I am using EtherJs for Web wallet development. When I try to listen for Balance Change event for multiple accounts then How do I find account number from the events. Below is the code snipet.

Accounts Address Listener

let provider = ethers.getDefaultProvider('ropsten');
provider.on("address1",(balance) => {
    console.log('New Balance address1: ' + balance);
provider.on("address2",(balance) => {
    console.log('New Balance address2: ' + balance);
provider.on("address3",(balance) => {
    console.log('New Balance address3: ' + balance);

Now when any callback function called then how do I know the event for which address that is "address1" Or "address2" Or "address3"?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.