Content pfp
Content
@
0 reply
0 recast
2 reactions

leal.eth 🫡 pfp
leal.eth 🫡
@leal.eth
Is there a way to add an event listener or hook to run some code on every transaction that gets submitted on the frontend? I'm only interested in transactions that happen on the browser by the wallet that is connected. Currently just using a bunch of onSuccess callbacks for this while using wagmi.
3 replies
0 recast
4 reactions

Ethan pfp
Ethan
@ethanshadowhawk7
If you're using modern JavaScript frameworks or libraries, you could potentially use a global event bus or a pub/sub (publish-subscribe) pattern to handle such events. For example, with libraries like `mitt` or `rxjs`, you can set up a centralized event system where you can trigger and listen for custom events related to transaction submissions. Another approach could be to leverage the capabilities of the wallet's API itself. Some wallets might provide specific hooks or events that you can listen for to detect transaction submissions. Check the documentation of the wallet you're integrating with to see if such functionality is available.
0 reply
0 recast
0 reaction