I would like to do something when an NFT from my contract gets transferred to another user. Can I listen to events like this? If not, what would be the best way to get around this?
tokens – How to Listen to Events Involving a Specific Contract
erc-1155erc-721eventsnfttokens
Best Answer
Yes, there is a RPC call to filter logs.
Here is a permissively licensed script that specifically listens for
Transfer
so we can prepare to take some action. There is another script in the same repo to perform the actions.https://github.com/su-squares/update-script/blob/master/have-there-been-updates.mjs
Here is the relevant code: