You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to listen for events, I'm using ethers v6.12.1, node js 18.16.1.
I've tried suggested fixes from issues raised earlier and even downgraded the package, I got another error.
Please what could be the issue?
Code Snippet
const provider = new ethers.WebSocketProvider("wss://mainnet.infura.io/ws/v3/....");
const tokenContract = new ethers.Contract("0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe", [//abi],provider)
tokenContract.on('Transfer', (from, to, value) => {
console.log("transfer from===", from, "===to====", to, "===value===", value)
});
/node_modules/ethers/src.ts/utils/errors.ts:687
error = new TypeError(message);
^
TypeError: unknown fragment (argument="event", value="Transfer", code=INVALID_ARGUMENT, version=6.12.1)
at makeError (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/ethers/src.ts/utils/errors.ts:687:21)
at assert (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/ethers/src.ts/utils/errors.ts:715:25)
at assertArgument (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/ethers/src.ts/utils/errors.ts:727:5)
at getSubInfo (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/ethers/src.ts/contract/contract.ts:496:27)
at getSub (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/ethers/src.ts/contract/contract.ts:545:45)
at Proxy.on (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/ethers/src.ts/contract/contract.ts:969:27)
at Object.createCryptoWallet (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/src/controllers/api/crypto/crypto.controller.ts:512:23)
at preHandlerCallback (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/fastify/lib/handleRequest.js:137:37)
at next (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/fastify/lib/hooks.js:233:9)
at handleResolve (/home/budescode/Documents/CODING/PROJECTS/Bitfornaira/web/Bitfornaira/node_modules/fastify/lib/hooks.js:250:7) {
code: 'INVALID_ARGUMENT',
argument: 'event',
value: 'Transfer',
shortMessage: 'unknown fragment'
}
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered:
Just searching this GitHub issue in my browser, I indeed don't see the Transfer event anywhere in your ABI. Are you sure you have the correct ABI for your contract?
Ethers Version
6.12.0
Search Terms
No response
Describe the Problem
Hi, I'm trying to listen for events, I'm using ethers v6.12.1, node js 18.16.1.
I've tried suggested fixes from issues raised earlier and even downgraded the package, I got another error.
Please what could be the issue?
Code Snippet
Contract ABI
Errors
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: