hashgraph / hedera-wallet-connect

This package is a messaging relay between decentralized applications and wallets in Hedera network based on Wallet Connect relays.
Apache License 2.0
13 stars 22 forks source link

fix: enhance modal session handling to reject on user cancellation #348

Open MohamedArbani opened 5 days ago

MohamedArbani commented 5 days ago

Description:
This PR enhances the openModal function to handle scenarios where the user dismisses the WalletConnect modal without completing the wallet connection process.

Key changes include:

This improvement ensures the app properly handles cases where users dismiss the modal, improving UX and error feedback.

Notes for reviewer:
The following logs and behaviors can be observed with this change:

  1. If the user closes the modal (via the "X" button or by clicking outside), the app immediately throws an error: User rejected pairing.
  2. The approval process is cleanly resolved or rejected based on user actions.
  3. Ensures closeModal() is called in all cases.

No breaking changes introduced to existing workflows.

Checklist

kantorcodes commented 19 hours ago

@MohamedArbani

Thanks for getting this PR going :)

I like this idea, but I think the kind of error handling you're proposing should probably be an opt-in parameter with a callback that can be passed in. Otherwise, I fear that it is possible to introduce a breaking change to existing implementations