From dcfc5ca86eecf2d532012cab89d70e31e4beef7b Mon Sep 17 00:00:00 2001 From: martbost Date: Tue, 8 Sep 2026 08:44:21 -0500 Subject: [PATCH] WalletConnect: make the chain optional (fixes Trust hang on Amoy) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requiring Amoy (80002) in the session namespaces made Trust Wallet hang on "redirecting" — testnet wallets that don't natively list Amoy can't satisfy a required-chain proposal. Switched to optionalChains so the session establishes; the chain is switched/added after connect. Co-Authored-By: Claude Opus 4.8 --- public/assets/wallet.js | 5 ++++- public/index.html | 2 +- public/my.html | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/public/assets/wallet.js b/public/assets/wallet.js index f9dddd8..af34c8c 100644 --- a/public/assets/wallet.js +++ b/public/assets/wallet.js @@ -76,8 +76,11 @@ window.IAPWallet = (function () { const EP = await loadWcSdk(); const chainId = Number(c.chainId); if (!wcProvider) { + // optionalChains (not required): testnet wallets like Trust hang or reject + // a session that REQUIRES a chain they don't natively list (Amoy 80002). + // Optional lets the session establish; we switch/add the chain after. wcProvider = await EP.init({ - projectId, chains: [chainId], optionalChains: [chainId], showQrModal: true, + projectId, optionalChains: [chainId], showQrModal: true, rpcMap: { [chainId]: c.rpc }, metadata: { name: c.siteName || 'InstantAdPay', description: c.tagline || 'Advertise and earn, paid on-chain.', url: location.origin, icons: [location.origin + '/logo-icon.png'] } diff --git a/public/index.html b/public/index.html index e866d20..1cc7dae 100644 --- a/public/index.html +++ b/public/index.html @@ -439,7 +439,7 @@ - + diff --git a/public/my.html b/public/my.html index 28196a2..80e4d04 100644 --- a/public/my.html +++ b/public/my.html @@ -690,7 +690,7 @@ - +