WalletConnect: make the chain optional (fixes Trust hang on Amoy)
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 <noreply@anthropic.com>
This commit is contained in:
@@ -76,8 +76,11 @@ window.IAPWallet = (function () {
|
|||||||
const EP = await loadWcSdk();
|
const EP = await loadWcSdk();
|
||||||
const chainId = Number(c.chainId);
|
const chainId = Number(c.chainId);
|
||||||
if (!wcProvider) {
|
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({
|
wcProvider = await EP.init({
|
||||||
projectId, chains: [chainId], optionalChains: [chainId], showQrModal: true,
|
projectId, optionalChains: [chainId], showQrModal: true,
|
||||||
rpcMap: { [chainId]: c.rpc },
|
rpcMap: { [chainId]: c.rpc },
|
||||||
metadata: { name: c.siteName || 'InstantAdPay', description: c.tagline || 'Advertise and earn, paid on-chain.',
|
metadata: { name: c.siteName || 'InstantAdPay', description: c.tagline || 'Advertise and earn, paid on-chain.',
|
||||||
url: location.origin, icons: [location.origin + '/logo-icon.png'] }
|
url: location.origin, icons: [location.origin + '/logo-icon.png'] }
|
||||||
|
|||||||
+1
-1
@@ -439,7 +439,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script src="/assets/common.js?v=20260908c"></script>
|
<script src="/assets/common.js?v=20260908c"></script>
|
||||||
<script src="/assets/wallet.js?v=20260908b"></script>
|
<script src="/assets/wallet.js?v=20260908c"></script>
|
||||||
<script src="/assets/home.js?v=20260906m"></script>
|
<script src="/assets/home.js?v=20260906m"></script>
|
||||||
<script src="/assets/chat.js?v=20260906m"></script>
|
<script src="/assets/chat.js?v=20260906m"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+1
-1
@@ -690,7 +690,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/assets/common.js?v=20260908c"></script>
|
<script src="/assets/common.js?v=20260908c"></script>
|
||||||
<script src="/assets/wallet.js?v=20260908b"></script>
|
<script src="/assets/wallet.js?v=20260908c"></script>
|
||||||
<script src="/assets/my.js?v=20260908i"></script>
|
<script src="/assets/my.js?v=20260908i"></script>
|
||||||
<script src="/assets/chat.js?v=20260907l"></script>
|
<script src="/assets/chat.js?v=20260907l"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user