Add "Disconnect wallet" button (clears stuck WC session / switch wallets)

A stuck WalletConnect request or wrong-wallet choice could trap testers. New
IAPWallet.disconnect() drops the WC session, forgets the chosen provider, and
clears WC localStorage so the next connect re-offers the picker. Surfaced as a
"Disconnect wallet" button on the Wallet pane.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-08 09:21:42 -05:00
parent d23eb10c58
commit 379a5352ea
4 changed files with 22 additions and 4 deletions
+5
View File
@@ -1425,6 +1425,11 @@
+ (copied ? ' is copied' : '') + '. On the faucet, choose <b>Polygon Amoy</b>, paste your address, and request POL. Then come back and buy.';
IAP.status('Faucet opened in a new tab. Choose Polygon Amoy, paste your address, and request test POL.', 'ok');
}));
if ($('wcDisconnect')) $('wcDisconnect').addEventListener('click', busy($('wcDisconnect'), async () => {
try { await IAPWallet.disconnect(); } catch (e) {}
$('wcDisconnectInfo').textContent = 'Disconnected. Tap Connect or Get test POL to pick a wallet again.';
IAP.status('Wallet disconnected. You can connect a different wallet now.', 'ok');
}));
$('activateBtn').addEventListener('click', busy($('activateBtn'), async () => {
const me = await (await fetch('/api/me')).json();
IAP.status('Confirm the free activation in your wallet…');