@pooflabs/web 0.0.80 → 0.0.81-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/auth/providers/phantom-wallet-provider.d.ts +20 -0
  2. package/dist/{index-BhfNMrC0.js → index-BSL3D7PC.js} +25 -883
  3. package/dist/index-BSL3D7PC.js.map +1 -0
  4. package/dist/{index-BNyxZ82q.js → index-BU6puWaY.js} +279 -275
  5. package/dist/index-BU6puWaY.js.map +1 -0
  6. package/dist/index-Bdcc5821.js +2375 -0
  7. package/dist/index-Bdcc5821.js.map +1 -0
  8. package/dist/{index-Db0NqU8R.esm.js → index-Cpw11-0x.esm.js} +279 -276
  9. package/dist/index-Cpw11-0x.esm.js.map +1 -0
  10. package/dist/index-CrOVJFX9.esm.js +2373 -0
  11. package/dist/index-CrOVJFX9.esm.js.map +1 -0
  12. package/dist/{index-COIUWugk.esm.js → index-CtwdL0-L.esm.js} +23 -881
  13. package/dist/index-CtwdL0-L.esm.js.map +1 -0
  14. package/dist/{index-BbtYb8sE.esm.js → index-DLfRKZI7.esm.js} +24 -882
  15. package/dist/index-DLfRKZI7.esm.js.map +1 -0
  16. package/dist/{index-BVi7fTm2.js → index-Fo9o33oZ.js} +24 -882
  17. package/dist/index-Fo9o33oZ.js.map +1 -0
  18. package/dist/index.browser-9JJy5Y7o.esm.js +119 -0
  19. package/dist/index.browser-9JJy5Y7o.esm.js.map +1 -0
  20. package/dist/index.browser-B4RzFwu2.js +1253 -0
  21. package/dist/index.browser-B4RzFwu2.js.map +1 -0
  22. package/dist/index.browser-C-_FEr5M.esm.js +1134 -0
  23. package/dist/index.browser-C-_FEr5M.esm.js.map +1 -0
  24. package/dist/{index.browser-8hyi2LOX.js → index.browser-CGfTdDXe.js} +1367 -1697
  25. package/dist/index.browser-CGfTdDXe.js.map +1 -0
  26. package/dist/index.browser-CQUvzkLr.js +122 -0
  27. package/dist/index.browser-CQUvzkLr.js.map +1 -0
  28. package/dist/index.browser-DjEZSiqI.js +1137 -0
  29. package/dist/index.browser-DjEZSiqI.js.map +1 -0
  30. package/dist/index.browser-Dzo4A2XB.esm.js +1250 -0
  31. package/dist/index.browser-Dzo4A2XB.esm.js.map +1 -0
  32. package/dist/{index.browser-BuHl80dp.esm.js → index.browser-HEDpODB5.esm.js} +1367 -1697
  33. package/dist/index.browser-HEDpODB5.esm.js.map +1 -0
  34. package/dist/index.esm.js +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/{index.native-DUnE51Mx.js → index.native-DYI4vw0X.js} +186 -2669
  37. package/dist/index.native-DYI4vw0X.js.map +1 -0
  38. package/dist/{index.native-DuKhZcus.esm.js → index.native-UxpBL0TA.esm.js} +187 -2669
  39. package/dist/index.native-UxpBL0TA.esm.js.map +1 -0
  40. package/dist/index.native.esm.js +1 -1
  41. package/dist/index.native.js +1 -1
  42. package/dist/{phantom-wallet-provider-Cg-srwP4.js → phantom-wallet-provider-BPSAXPZ6.js} +127 -11
  43. package/dist/{phantom-wallet-provider-Cg-srwP4.js.map → phantom-wallet-provider-BPSAXPZ6.js.map} +1 -1
  44. package/dist/{phantom-wallet-provider--BJjVUA1.esm.js → phantom-wallet-provider-DcMJW18_.esm.js} +127 -11
  45. package/dist/{phantom-wallet-provider--BJjVUA1.esm.js.map → phantom-wallet-provider-DcMJW18_.esm.js.map} +1 -1
  46. package/dist/{privy-wallet-provider-BLcur3Ue.esm.js → privy-wallet-provider-CtIl8FgH.esm.js} +3 -3
  47. package/dist/privy-wallet-provider-CtIl8FgH.esm.js.map +1 -0
  48. package/dist/{privy-wallet-provider-DpNVyaXa.js → privy-wallet-provider-Zu5K_vNN.js} +3 -3
  49. package/dist/privy-wallet-provider-Zu5K_vNN.js.map +1 -0
  50. package/dist/{solana-mobile-wallet-provider-CFaubssb.esm.js → solana-mobile-wallet-provider-C31APzEp.esm.js} +4 -4
  51. package/dist/{solana-mobile-wallet-provider-CFaubssb.esm.js.map → solana-mobile-wallet-provider-C31APzEp.esm.js.map} +1 -1
  52. package/dist/{solana-mobile-wallet-provider-zXAk2tfS.js → solana-mobile-wallet-provider-Dg9_h3QI.js} +4 -4
  53. package/dist/{solana-mobile-wallet-provider-zXAk2tfS.js.map → solana-mobile-wallet-provider-Dg9_h3QI.js.map} +1 -1
  54. package/package.json +1 -1
  55. package/dist/index-BNyxZ82q.js.map +0 -1
  56. package/dist/index-BVi7fTm2.js.map +0 -1
  57. package/dist/index-BbtYb8sE.esm.js.map +0 -1
  58. package/dist/index-BhfNMrC0.js.map +0 -1
  59. package/dist/index-CKIoDkjJ.esm.js +0 -6
  60. package/dist/index-CKIoDkjJ.esm.js.map +0 -1
  61. package/dist/index-COIUWugk.esm.js.map +0 -1
  62. package/dist/index-CSraUgD6.js +0 -8
  63. package/dist/index-CSraUgD6.js.map +0 -1
  64. package/dist/index-Db0NqU8R.esm.js.map +0 -1
  65. package/dist/index.browser-8hyi2LOX.js.map +0 -1
  66. package/dist/index.browser-B4zXnffD.esm.js +0 -225
  67. package/dist/index.browser-B4zXnffD.esm.js.map +0 -1
  68. package/dist/index.browser-BJ_TdUVA.js +0 -228
  69. package/dist/index.browser-BJ_TdUVA.js.map +0 -1
  70. package/dist/index.browser-BkNaRRVe.js +0 -1222
  71. package/dist/index.browser-BkNaRRVe.js.map +0 -1
  72. package/dist/index.browser-BuHl80dp.esm.js.map +0 -1
  73. package/dist/index.browser-CnbxBj3-.esm.js +0 -1219
  74. package/dist/index.browser-CnbxBj3-.esm.js.map +0 -1
  75. package/dist/index.browser-OvGNsMPu.esm.js +0 -1002
  76. package/dist/index.browser-OvGNsMPu.esm.js.map +0 -1
  77. package/dist/index.browser-vuTr40so.js +0 -1008
  78. package/dist/index.browser-vuTr40so.js.map +0 -1
  79. package/dist/index.native-DUnE51Mx.js.map +0 -1
  80. package/dist/index.native-DuKhZcus.esm.js.map +0 -1
  81. package/dist/privy-wallet-provider-BLcur3Ue.esm.js.map +0 -1
  82. package/dist/privy-wallet-provider-DpNVyaXa.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { X as DEFAULT_TEST_ADDRESS, _ as InsufficientBalanceError, V as MockAuthProvider, Y as OffchainAuthProvider, Z as PrivyExpoProvider, $ as ReactNativeSessionManager, a0 as ServerSessionManager, W as WebSessionManager, O as aggregate, b as buildSetDocumentsTransaction, a1 as clearCache, a2 as closeAllSubscriptions, c as convertRemainingAccounts, N as count, f as createSessionWithPrivy, o as createSessionWithSignature, R as deserializeTransaction, m as genAuthNonce, n as genSolanaMessage, B as get, w as getAuthLoading, A as getAuthProvider, a3 as getCachedData, z as getConfig, t as getCurrentUser, F as getFiles, T as getIdToken, a4 as getMany, g as getPlatform, q as init, x as login, y as logout, v as onAuthLoadingChanged, u as onAuthStateChanged, a5 as reconnectWithNewAuth, a6 as refreshSession, I as runExpression, J as runExpressionMany, G as runQuery, H as runQueryMany, C as set, E as setFile, D as setMany, U as setPlatform, M as signAndSubmitTransaction, K as signMessage, a7 as signSessionCreateMessage, L as signTransaction, P as subscribe, Q as useAuth } from './index.native-DuKhZcus.esm.js';
1
+ export { U as DEFAULT_TEST_ADDRESS, Y as InsufficientBalanceError, T as MockAuthProvider, V as OffchainAuthProvider, X as PrivyExpoProvider, Z as ReactNativeSessionManager, _ as ServerSessionManager, W as WebSessionManager, M as aggregate, b as buildSetDocumentsTransaction, $ as clearCache, a0 as closeAllSubscriptions, c as convertRemainingAccounts, L as count, f as createSessionWithPrivy, n as createSessionWithSignature, P as deserializeTransaction, l as genAuthNonce, m as genSolanaMessage, z as get, u as getAuthLoading, y as getAuthProvider, a1 as getCachedData, x as getConfig, q as getCurrentUser, D as getFiles, Q as getIdToken, a2 as getMany, g as getPlatform, p as init, v as login, w as logout, t as onAuthLoadingChanged, r as onAuthStateChanged, a3 as reconnectWithNewAuth, a4 as refreshSession, G as runExpression, H as runExpressionMany, E as runQuery, F as runQueryMany, A as set, C as setFile, B as setMany, R as setPlatform, K as signAndSubmitTransaction, I as signMessage, a5 as signSessionCreateMessage, J as signTransaction, N as subscribe, O as useAuth } from './index.native-UxpBL0TA.esm.js';
2
2
  import 'axios';
3
3
  import '@solana/web3.js';
4
4
  import '@coral-xyz/anchor';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index_native = require('./index.native-DUnE51Mx.js');
3
+ var index_native = require('./index.native-DYI4vw0X.js');
4
4
  require('axios');
5
5
  require('@solana/web3.js');
6
6
  require('@coral-xyz/anchor');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-CSraUgD6.js');
4
- var index_native = require('./index.native-DUnE51Mx.js');
3
+ var index = require('./index-Bdcc5821.js');
4
+ var index_native = require('./index.native-DYI4vw0X.js');
5
5
  var web3_js = require('@solana/web3.js');
6
6
  var anchor = require('@coral-xyz/anchor');
7
7
  require('axios');
@@ -73,7 +73,7 @@ async function loadDependencies() {
73
73
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
74
74
  import('react'),
75
75
  import('react-dom/client'),
76
- Promise.resolve().then(function () { return require('./index-BhfNMrC0.js'); })
76
+ Promise.resolve().then(function () { return require('./index-BSL3D7PC.js'); })
77
77
  ]);
78
78
  // Extract default export from ESM module namespace
79
79
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -116,8 +116,13 @@ class PhantomWalletProvider {
116
116
  async initializeAsync() {
117
117
  // Lazy load dependencies only when actually instantiating
118
118
  await loadDependencies();
119
- // Initialize React component
120
- this.initialize();
119
+ // Initialize React component eagerly only when there's a real reason to
120
+ // (URL callback to consume, prior session to restore, in-page wallet,
121
+ // or non-Android). Otherwise defer until ensureReady() is reached from
122
+ // a user-gesture flow. See shouldMountEagerly() for the rationale.
123
+ if (this.shouldMountEagerly()) {
124
+ this.initialize();
125
+ }
121
126
  }
122
127
  /**
123
128
  * Check if social login providers are configured (non-injected providers).
@@ -125,6 +130,69 @@ class PhantomWalletProvider {
125
130
  hasSocialProviders() {
126
131
  return this.resolvedProviders.some(p => p !== 'injected');
127
132
  }
133
+ /**
134
+ * Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
135
+ * eagerly during init() or defer until the first user-triggered call
136
+ * (login / sign / etc.) reaches ensureReady().
137
+ *
138
+ * Mounting the React tree synchronously constructs BrowserSDK, which runs
139
+ * wallet-standard discovery in its constructor and fires sdk.autoConnect()
140
+ * in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
141
+ * pathways probe the Android intent surface to discover the Phantom mobile
142
+ * app, which surfaces Chrome's system "wants to access other apps and
143
+ * services" permission dialog *before* the PWA activity has window focus.
144
+ * The dialog renders with grayed-out buttons until the user backgrounds
145
+ * and resumes the app.
146
+ *
147
+ * Returns true when eager mount is needed (callback to handle, prior
148
+ * session, in-page wallet present, or non-Android). Otherwise returns
149
+ * false — the React tree is mounted lazily inside ensureReady() once a
150
+ * user gesture brings us there.
151
+ */
152
+ shouldMountEagerly() {
153
+ if (typeof window === 'undefined')
154
+ return false;
155
+ // Preserve desktop behavior: always mount eagerly.
156
+ if (!index_native.detectAndroid())
157
+ return true;
158
+ // In-page wallet present (Phantom in-app browser / desktop extension on
159
+ // a desktop-mode Android UA): no Android intent probe needed, mount free.
160
+ // Tighten beyond truthy `window.phantom` since arbitrary stubs can land
161
+ // on that key — require a wallet-shaped surface.
162
+ const ph = window.phantom;
163
+ if (ph && (ph.solana || ph.ethereum || ph.app))
164
+ return true;
165
+ // Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
166
+ // be live to read these URL params via urlParamsAccessor.
167
+ const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
168
+ try {
169
+ const params = new URLSearchParams(window.location.search);
170
+ if (callbackKeys.some(k => params.has(k)))
171
+ return true;
172
+ }
173
+ catch (_a) {
174
+ return true; // conservative on URL access failure
175
+ }
176
+ // Returning user with a stored Phantom session. They've already
177
+ // approved the Android intent permission for this origin on first
178
+ // login, so the dialog is typically pre-granted by Chrome — eager
179
+ // mount lets autoConnect silently restore the wallet handshake.
180
+ // Require BOTH the marker AND a session storage entry so a stale
181
+ // orphaned marker doesn't keep eager-mounting forever. Note
182
+ // isAuthenticated() is a raw key-existence check, not a validity
183
+ // check — restoreSession() above clears the marker on the next load
184
+ // if the session is unusable, so the bug self-corrects after at
185
+ // most one further cold start.
186
+ try {
187
+ const stored = index_native.getPlatform().storage.getItem('tarobase_last_auth_method');
188
+ if (stored === 'phantom' && index_native.WebSessionManager.isAuthenticated())
189
+ return true;
190
+ }
191
+ catch (_b) {
192
+ return true;
193
+ }
194
+ return false;
195
+ }
128
196
  static getInstance(networkUrl, config) {
129
197
  if (!PhantomWalletProvider.instance) {
130
198
  new PhantomWalletProvider(networkUrl, config);
@@ -801,6 +869,13 @@ class PhantomWalletProvider {
801
869
  if (this.initPromise) {
802
870
  await this.initPromise;
803
871
  }
872
+ // Lazy-mount path: if initializeAsync deferred the React mount (e.g.
873
+ // first-time visitor on Android Chrome PWA), do it now. We're being
874
+ // called from a user-gesture flow like login(), so any Android intent
875
+ // dialog that surfaces will appear with the activity already focused.
876
+ if (!this.containerElement) {
877
+ this.initialize();
878
+ }
804
879
  // Wait for SDK to be ready
805
880
  await new Promise((resolve) => {
806
881
  const check = () => {
@@ -910,12 +985,53 @@ class PhantomWalletProvider {
910
985
  });
911
986
  }
912
987
  async restoreSession() {
913
- await this.ensureReady();
914
- const session = await index_native.WebSessionManager.getSession();
915
- if (session) {
916
- return { provider: this, address: session.address };
988
+ // Read from storage directly. Do NOT ensureReady() here — that would
989
+ // mount @phantom/react-sdk's <PhantomProvider> during init(), which
990
+ // synchronously constructs BrowserSDK (running wallet-standard discovery)
991
+ // and fires sdk.autoConnect() both probing the Android intent surface
992
+ // before the PWA activity has window focus on Solana Seeker. The
993
+ // resulting "access other apps and services" system dialog renders
994
+ // with grayed-out buttons.
995
+ //
996
+ // Wrap getSession() in try/catch: WebSessionManager.getSession() runs
997
+ // JSON.parse on the stored session *outside* its internal try/catch,
998
+ // so genuinely malformed JSON in localStorage would propagate through
999
+ // restoreSession() and break init() entirely. Treat any throw as
1000
+ // "no session" and fall through to the cleanup path so corrupted
1001
+ // storage is recoverable on next load.
1002
+ let session;
1003
+ try {
1004
+ session = await index_native.WebSessionManager.getSession();
1005
+ }
1006
+ catch (_a) {
1007
+ session = null;
1008
+ }
1009
+ if (!session) {
1010
+ // Tidy up storage so we don't leave junk behind:
1011
+ // (a) clearSession() removes any stale or unparseable session
1012
+ // storage entry. WebSessionManager.getSession() can't reach
1013
+ // its own clearSession() if JSON.parse threw. Idempotent —
1014
+ // safe to call unconditionally here.
1015
+ // (b) Drop the auth-method marker if it's stale.
1016
+ // WebSessionManager.clearSession() only removes the session
1017
+ // storage key, not the marker — so without this cleanup
1018
+ // shouldMountEagerly() would keep eager-mounting on every
1019
+ // future cold start.
1020
+ try {
1021
+ index_native.WebSessionManager.clearSession();
1022
+ }
1023
+ catch ( /* best-effort */_b) { /* best-effort */ }
1024
+ try {
1025
+ if (index_native.getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
1026
+ index_native.getPlatform().storage.removeItem('tarobase_last_auth_method');
1027
+ }
1028
+ }
1029
+ catch (_c) {
1030
+ // storage unavailable — best-effort cleanup
1031
+ }
1032
+ return null;
917
1033
  }
918
- return null;
1034
+ return { provider: this, address: session.address };
919
1035
  }
920
1036
  async address() {
921
1037
  var _a, _b, _c, _d;
@@ -1372,4 +1488,4 @@ class PhantomWalletProvider {
1372
1488
  PhantomWalletProvider.instance = null;
1373
1489
 
1374
1490
  exports.PhantomWalletProvider = PhantomWalletProvider;
1375
- //# sourceMappingURL=phantom-wallet-provider-Cg-srwP4.js.map
1491
+ //# sourceMappingURL=phantom-wallet-provider-BPSAXPZ6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"phantom-wallet-provider-Cg-srwP4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { b as bufferExports } from './index-CKIoDkjJ.esm.js';
2
- import { W as WebSessionManager, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, e as confirmAndCheckTransaction, s as setCurrentUser, a as SOLANA_DEVNET_RPC_URL, S as SOLANA_MAINNET_RPC_URL, h as SURFNET_RPC_URL, j as detectMobile, k as detectAndroid, l as setAuthLoading, m as genAuthNonce, n as genSolanaMessage, o as createSessionWithSignature, g as getPlatform } from './index.native-DuKhZcus.esm.js';
1
+ import { b as bufferExports } from './index-CrOVJFX9.esm.js';
2
+ import { h as detectAndroid, g as getPlatform, W as WebSessionManager, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, e as confirmAndCheckTransaction, s as setCurrentUser, a as SOLANA_DEVNET_RPC_URL, S as SOLANA_MAINNET_RPC_URL, i as SURFNET_RPC_URL, j as detectMobile, k as setAuthLoading, l as genAuthNonce, m as genSolanaMessage, n as createSessionWithSignature } from './index.native-UxpBL0TA.esm.js';
3
3
  import { Connection, PublicKey, VersionedTransaction } from '@solana/web3.js';
4
4
  import * as anchor from '@coral-xyz/anchor';
5
5
  import 'axios';
@@ -52,7 +52,7 @@ async function loadDependencies() {
52
52
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
53
53
  import('react'),
54
54
  import('react-dom/client'),
55
- import('./index-BbtYb8sE.esm.js')
55
+ import('./index-DLfRKZI7.esm.js')
56
56
  ]);
57
57
  // Extract default export from ESM module namespace
58
58
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -95,8 +95,13 @@ class PhantomWalletProvider {
95
95
  async initializeAsync() {
96
96
  // Lazy load dependencies only when actually instantiating
97
97
  await loadDependencies();
98
- // Initialize React component
99
- this.initialize();
98
+ // Initialize React component eagerly only when there's a real reason to
99
+ // (URL callback to consume, prior session to restore, in-page wallet,
100
+ // or non-Android). Otherwise defer until ensureReady() is reached from
101
+ // a user-gesture flow. See shouldMountEagerly() for the rationale.
102
+ if (this.shouldMountEagerly()) {
103
+ this.initialize();
104
+ }
100
105
  }
101
106
  /**
102
107
  * Check if social login providers are configured (non-injected providers).
@@ -104,6 +109,69 @@ class PhantomWalletProvider {
104
109
  hasSocialProviders() {
105
110
  return this.resolvedProviders.some(p => p !== 'injected');
106
111
  }
112
+ /**
113
+ * Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
114
+ * eagerly during init() or defer until the first user-triggered call
115
+ * (login / sign / etc.) reaches ensureReady().
116
+ *
117
+ * Mounting the React tree synchronously constructs BrowserSDK, which runs
118
+ * wallet-standard discovery in its constructor and fires sdk.autoConnect()
119
+ * in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
120
+ * pathways probe the Android intent surface to discover the Phantom mobile
121
+ * app, which surfaces Chrome's system "wants to access other apps and
122
+ * services" permission dialog *before* the PWA activity has window focus.
123
+ * The dialog renders with grayed-out buttons until the user backgrounds
124
+ * and resumes the app.
125
+ *
126
+ * Returns true when eager mount is needed (callback to handle, prior
127
+ * session, in-page wallet present, or non-Android). Otherwise returns
128
+ * false — the React tree is mounted lazily inside ensureReady() once a
129
+ * user gesture brings us there.
130
+ */
131
+ shouldMountEagerly() {
132
+ if (typeof window === 'undefined')
133
+ return false;
134
+ // Preserve desktop behavior: always mount eagerly.
135
+ if (!detectAndroid())
136
+ return true;
137
+ // In-page wallet present (Phantom in-app browser / desktop extension on
138
+ // a desktop-mode Android UA): no Android intent probe needed, mount free.
139
+ // Tighten beyond truthy `window.phantom` since arbitrary stubs can land
140
+ // on that key — require a wallet-shaped surface.
141
+ const ph = window.phantom;
142
+ if (ph && (ph.solana || ph.ethereum || ph.app))
143
+ return true;
144
+ // Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
145
+ // be live to read these URL params via urlParamsAccessor.
146
+ const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
147
+ try {
148
+ const params = new URLSearchParams(window.location.search);
149
+ if (callbackKeys.some(k => params.has(k)))
150
+ return true;
151
+ }
152
+ catch (_a) {
153
+ return true; // conservative on URL access failure
154
+ }
155
+ // Returning user with a stored Phantom session. They've already
156
+ // approved the Android intent permission for this origin on first
157
+ // login, so the dialog is typically pre-granted by Chrome — eager
158
+ // mount lets autoConnect silently restore the wallet handshake.
159
+ // Require BOTH the marker AND a session storage entry so a stale
160
+ // orphaned marker doesn't keep eager-mounting forever. Note
161
+ // isAuthenticated() is a raw key-existence check, not a validity
162
+ // check — restoreSession() above clears the marker on the next load
163
+ // if the session is unusable, so the bug self-corrects after at
164
+ // most one further cold start.
165
+ try {
166
+ const stored = getPlatform().storage.getItem('tarobase_last_auth_method');
167
+ if (stored === 'phantom' && WebSessionManager.isAuthenticated())
168
+ return true;
169
+ }
170
+ catch (_b) {
171
+ return true;
172
+ }
173
+ return false;
174
+ }
107
175
  static getInstance(networkUrl, config) {
108
176
  if (!PhantomWalletProvider.instance) {
109
177
  new PhantomWalletProvider(networkUrl, config);
@@ -780,6 +848,13 @@ class PhantomWalletProvider {
780
848
  if (this.initPromise) {
781
849
  await this.initPromise;
782
850
  }
851
+ // Lazy-mount path: if initializeAsync deferred the React mount (e.g.
852
+ // first-time visitor on Android Chrome PWA), do it now. We're being
853
+ // called from a user-gesture flow like login(), so any Android intent
854
+ // dialog that surfaces will appear with the activity already focused.
855
+ if (!this.containerElement) {
856
+ this.initialize();
857
+ }
783
858
  // Wait for SDK to be ready
784
859
  await new Promise((resolve) => {
785
860
  const check = () => {
@@ -889,12 +964,53 @@ class PhantomWalletProvider {
889
964
  });
890
965
  }
891
966
  async restoreSession() {
892
- await this.ensureReady();
893
- const session = await WebSessionManager.getSession();
894
- if (session) {
895
- return { provider: this, address: session.address };
967
+ // Read from storage directly. Do NOT ensureReady() here — that would
968
+ // mount @phantom/react-sdk's <PhantomProvider> during init(), which
969
+ // synchronously constructs BrowserSDK (running wallet-standard discovery)
970
+ // and fires sdk.autoConnect() both probing the Android intent surface
971
+ // before the PWA activity has window focus on Solana Seeker. The
972
+ // resulting "access other apps and services" system dialog renders
973
+ // with grayed-out buttons.
974
+ //
975
+ // Wrap getSession() in try/catch: WebSessionManager.getSession() runs
976
+ // JSON.parse on the stored session *outside* its internal try/catch,
977
+ // so genuinely malformed JSON in localStorage would propagate through
978
+ // restoreSession() and break init() entirely. Treat any throw as
979
+ // "no session" and fall through to the cleanup path so corrupted
980
+ // storage is recoverable on next load.
981
+ let session;
982
+ try {
983
+ session = await WebSessionManager.getSession();
984
+ }
985
+ catch (_a) {
986
+ session = null;
987
+ }
988
+ if (!session) {
989
+ // Tidy up storage so we don't leave junk behind:
990
+ // (a) clearSession() removes any stale or unparseable session
991
+ // storage entry. WebSessionManager.getSession() can't reach
992
+ // its own clearSession() if JSON.parse threw. Idempotent —
993
+ // safe to call unconditionally here.
994
+ // (b) Drop the auth-method marker if it's stale.
995
+ // WebSessionManager.clearSession() only removes the session
996
+ // storage key, not the marker — so without this cleanup
997
+ // shouldMountEagerly() would keep eager-mounting on every
998
+ // future cold start.
999
+ try {
1000
+ WebSessionManager.clearSession();
1001
+ }
1002
+ catch ( /* best-effort */_b) { /* best-effort */ }
1003
+ try {
1004
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
1005
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
1006
+ }
1007
+ }
1008
+ catch (_c) {
1009
+ // storage unavailable — best-effort cleanup
1010
+ }
1011
+ return null;
896
1012
  }
897
- return null;
1013
+ return { provider: this, address: session.address };
898
1014
  }
899
1015
  async address() {
900
1016
  var _a, _b, _c, _d;
@@ -1351,4 +1467,4 @@ class PhantomWalletProvider {
1351
1467
  PhantomWalletProvider.instance = null;
1352
1468
 
1353
1469
  export { PhantomWalletProvider };
1354
- //# sourceMappingURL=phantom-wallet-provider--BJjVUA1.esm.js.map
1470
+ //# sourceMappingURL=phantom-wallet-provider-DcMJW18_.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"phantom-wallet-provider--BJjVUA1.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { S as SOLANA_MAINNET_RPC_URL, a as SOLANA_DEVNET_RPC_URL, W as WebSessionManager, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, d as bs58, e as confirmAndCheckTransaction, s as setCurrentUser, g as getPlatform, f as createSessionWithPrivy } from './index.native-DuKhZcus.esm.js';
1
+ import { S as SOLANA_MAINNET_RPC_URL, a as SOLANA_DEVNET_RPC_URL, W as WebSessionManager, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, d as bs58, e as confirmAndCheckTransaction, s as setCurrentUser, g as getPlatform, f as createSessionWithPrivy } from './index.native-UxpBL0TA.esm.js';
2
2
  import { Connection, VersionedTransaction, PublicKey, Transaction } from '@solana/web3.js';
3
3
  import * as anchor from '@coral-xyz/anchor';
4
4
  import 'axios';
@@ -3848,7 +3848,7 @@ class PrivyWalletProvider {
3848
3848
  }));
3849
3849
  // The signature is returned as a Uint8Array, encode it as base58 (standard Solana format)
3850
3850
  const signatureBytes = (result === null || result === void 0 ? void 0 : result.signature) || result;
3851
- const bs58 = await import('./index.native-DuKhZcus.esm.js').then(function (n) { return n.i; });
3851
+ const bs58 = await import('./index.native-UxpBL0TA.esm.js').then(function (n) { return n.a6; });
3852
3852
  return bs58.default.encode(signatureBytes);
3853
3853
  }
3854
3854
  async restoreSession() {
@@ -3917,4 +3917,4 @@ class PrivyWalletProvider {
3917
3917
  PrivyWalletProvider.instance = null;
3918
3918
 
3919
3919
  export { PrivyWalletProvider };
3920
- //# sourceMappingURL=privy-wallet-provider-BLcur3Ue.esm.js.map
3920
+ //# sourceMappingURL=privy-wallet-provider-CtIl8FgH.esm.js.map