Skip to content

WalletConnect session expires #32

@bselwe

Description

@bselwe

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
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions