WalletConnect / WalletConnectModalFlutter

The WalletConnectModal for WalletConnect built using Flutter.
https://pub.dev/packages/walletconnect_modal_flutter
Apache License 2.0
20 stars 18 forks source link

WalletConnect session expires #32

Open bselwe opened 10 months ago

bselwe commented 10 months ago

Describe the bug

We've observed that the WalletConnect session sometimes expires and returns that the connected wallet address is null, even if it was connected successfully before.

To Reproduce

Initialize the WalletConnect session ```dart service = WalletConnectModalService( projectId: AppDotEnv.walletConnectProjectId, metadata: const PairingMetadata( name: 'orb', description: 'Everyday app for web3 social', url: 'https://orb.ac/', icons: ['https://i.ibb.co/w6sNHRC/launcher.png'], redirect: Redirect( native: 'orbapp://', universal: 'https://orb.ac/', ), ), recommendedWalletIds: { WalletUtils.metaMaskWalletId, WalletUtils.zerionWalletId, WalletUtils.trustWalletId, WalletUtils.rainbowWalletId, WalletUtils.bitgetWalletId, WalletUtils.imTokenWalletId, WalletUtils.omniWalletId, ... }, requiredNamespaces: { 'eip155': RequiredNamespace( methods: [ 'eth_sendTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', ], chains: ['eip155:137'], events: [ 'chainChanged', 'accountsChanged', ], ), }, excludedWalletState: ExcludedWalletState.list, ); service!.addListener(_onWalletUpdated); await service!.init(); ```

Here's how I was able to reproduce it with a Metamask wallet:

  1. Connect a Metamask wallet using WalletConnectModalConnect widget.
  2. After connecting a wallet, you'll observe isConnected is true and address is not null (in _onWalletUpdated listener).
  3. Restart the app after connecting the wallet (within 10-15 seconds).
  4. After the app launches, you'll observe isConnected is false and address is null.

Expected behavior If the WalletConnect service returns isConnected as true and the connected address is not null, then at any point in the future, the session should stay connected unless I disconnect it manually.