starknet-react icon indicating copy to clipboard operation
starknet-react copied to clipboard

Create useContractEvents hook

Open 0xEniotna opened this issue 2 years ago • 4 comments

Hey, do you think it is a good idea to add Wagmi's useContractEvent hook ? https://wagmi.sh/react/hooks/useContractEvent

I'd live to use that for my project so I guess it could be the case for others as well !

As a junior dev I'm not sure how difficult it is to make the necessary changes to adapt this file useContractEvent but I'd love to give it a try !

0xEniotna avatar Jan 03 '23 10:01 0xEniotna

Yes, I think that would be a great idea! The main issue is that starknet.js provider doesn't support it because it defaults to the gateway provider. Until the ecosystem moves over to the json rpc provider I don't think it's possible to add this in a way that integrates with the rest of the library.

To go more in detail, the default provider is replaced with the wallet's provider once the user connects (so network changes with the user's wallet), so we cannot rely on the json rpc at all.

For your use case, you can manually instantiate a RpcProvider and use that in your code.

Keeping this issue open so in the future we can revisit this decision.

fracek avatar Jan 03 '23 11:01 fracek

Alchemy does have an events API and it seems fairly similar to TokenFlow? Could they be harmonized/supported?

Pet3ris avatar May 21 '23 18:05 Pet3ris

For this to happen we need wallets to switch to the rpc provider. Once that happens, we can implement this issue.

fracek avatar May 22 '23 18:05 fracek

This issue has been automatically marked as stale because it has not had activity in the six months. It will be closed in 2 weeks if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant.

github-actions[bot] avatar Feb 26 '24 02:02 github-actions[bot]

Close in favour of #465

fracek avatar Aug 07 '24 08:08 fracek