From ead42638004bd9d5cbd598628c8f621f2768ff59 Mon Sep 17 00:00:00 2001 From: Tokin Date: Fri, 3 Jul 2026 23:32:15 -0700 Subject: [PATCH] Update wallet.js Moved await getPhantomSDK(); to the top of the window load listener, right after the URL parameters are defined. This makes sure the SDK is fully initialized before any other logic (like OAuth or memory recall) runs, which should resolve auto connection issues and fix state persistence across pages. --- assets/js/webapp/wallet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/js/webapp/wallet.js b/assets/js/webapp/wallet.js index 7962df3..c8e06fa 100644 --- a/assets/js/webapp/wallet.js +++ b/assets/js/webapp/wallet.js @@ -261,11 +261,12 @@ window.getPhantomSDK = getPhantomSDK; // ====================== LOAD LISTENER - SINGLE SOURCE OF TRUTH ====================== window.addEventListener('load', async () => { const urlParams = new URLSearchParams(window.location.search); + + await getPhantomSDK(); // 1. Handle OAuth Handshake if (urlParams.get('code')) { console.log("⚠️ OAuth callback detected — Initializing SDK handshake"); - await getPhantomSDK(); return; // The 'connect' listener in getPhantomSDK will handle the UI update }