WalletConnectModalFlutter
WalletConnectModalFlutter copied to clipboard
WalletConnect session expires
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:
- Connect a Metamask wallet using
WalletConnectModalConnectwidget. - After connecting a wallet, you'll observe
isConnectedis true andaddressis not null (in_onWalletUpdatedlistener). - Restart the app after connecting the wallet (within 10-15 seconds).
- After the app launches, you'll observe
isConnectedis false andaddressis 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.