[SOLVED] Event capture does not work in ethers.js version 6

In our fronts, until version v5 of ethers.js we did it this way:

contract.on("TokenPurchase", (from, buyer, value, idToken) => {
			console.log(`The account ${buyer} has purchased the nft with id #${idToken}`);

As I have researched this does not work in version 6. As discussed here:

it is recommended to downgrade to version 5.
The use of async is indifferent.

Do you know what is the new methodology in v6 to capture events in our fronts?

I get back the address of the called contract but not the event info…
I have managed to get it to work with this provider:

        const customHttpProvider = new ethers.JsonRpcProvider(url); 
	const provider = customHttpProvider;
	const contract = new ethers.Contract(contractAddress, ABI, provider);


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.