-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugVerified to be an issue.Verified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v6Issues regarding v6Issues regarding v6
Description
Ethers Version
6.02
Search Terms
events, event
Describe the Problem
While creating event listeners upon receipt of event an error occurs. Simplified example provided.
This is occurring for multiple contracts and events. Switching to v5.7.2 the events work fine.
Code Snippet
const { ethers } = require(`ethers`);
const newEthersClient = new ethers.providers.JsonRpcProvider('https://rpc.ankr.com/polygon/486f6d938d85e35aeacf83a59afd95c4fab739093c8f919adb258799d81d51bf');
abi = [
"event Transfer(address indexed from, address indexed to, uint amount)"
]
contract = new ethers.Contract("0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", abi, newEthersClient)
// Begin listening for any Transfer event
contract.on("Transfer", (from, to, _amount, event) => {
const amount = ethers.formatEther(_amount, 18)
console.log(`${ from } => ${ to }: ${ amount }`);
// The `event.log` has the entire EventLog
// Optionally, convenience method to stop listening
event.removeListener();
});Contract ABI
[
"event Transfer(address indexed from, address indexed to, uint amount)"
]Errors
Uncaught TypeError TypeError: unknown ProviderEvent (argument="event", value="{\"topics\":[\"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"],\"address\":[\"0x8f3cf7ad23cd3cadbd9735aff958023239c6a063\"]}", code=INVALID_ARGUMENT, version=6.0.2)Environment
node.js (v12 or newer)
Environment (Other)
No response
mktcode and duskcodes
Metadata
Metadata
Assignees
Labels
bugVerified to be an issue.Verified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v6Issues regarding v6Issues regarding v6