What's the best way to catch user's interaction on metamask/walletconnect/trustwallet?

Hi! I’m trying to catch all the errors and user’s interaction on the wallet. What’s the best way to catch them? I’m using ReactJS, and I use try catch but sometimes it’s not catching user’s rejection of a transaction, or if the transaction failed.

what do you mean with a transaction failing? a transaction can fail after it was sent to the blockchain and in that case you will not catch it with a try catch, you will have to get the transaction status after it was included in the blockchain.

What code / library are you using? This would also depend on the wallet or type of wallet connection.