@pooflabs/web 0.0.83 → 0.0.84

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 (66) hide show
  1. package/dist/{index-FviRSm3S.js → index-BM6hgCdH.js} +13 -363
  2. package/dist/index-BM6hgCdH.js.map +1 -0
  3. package/dist/{index-DP0xF34Z.js → index-BPlF6-PQ.js} +124 -45
  4. package/dist/index-BPlF6-PQ.js.map +1 -0
  5. package/dist/{index-DQWyH96R.js → index-Bp4b5LXs.js} +2 -2
  6. package/dist/index-Bp4b5LXs.js.map +1 -0
  7. package/dist/index-C80kRxWk.esm.js +6 -0
  8. package/dist/index-C80kRxWk.esm.js.map +1 -0
  9. package/dist/{index-CP_wLmYu.esm.js → index-CH2G5Y9i.esm.js} +13 -363
  10. package/dist/index-CH2G5Y9i.esm.js.map +1 -0
  11. package/dist/{index-BxXQhFLQ.js → index-CSeN3jbG.js} +14 -364
  12. package/dist/index-CSeN3jbG.js.map +1 -0
  13. package/dist/{index-B7yaLhND.esm.js → index-XHbmzFFO.esm.js} +124 -45
  14. package/dist/index-XHbmzFFO.esm.js.map +1 -0
  15. package/dist/{index-CpaP1yGp.esm.js → index-ep10Sw82.esm.js} +14 -364
  16. package/dist/index-ep10Sw82.esm.js.map +1 -0
  17. package/dist/{index.browser-BhppfDyf.js → index.browser-BvNsUWjt.js} +2 -2
  18. package/dist/{index.browser-BhppfDyf.js.map → index.browser-BvNsUWjt.js.map} +1 -1
  19. package/dist/{index.browser-BfnOoa_h.js → index.browser-BwIqqM4U.js} +2 -2
  20. package/dist/{index.browser-BfnOoa_h.js.map → index.browser-BwIqqM4U.js.map} +1 -1
  21. package/dist/{index.browser-_zN3Uapq.js → index.browser-C1QL04xM.js} +2 -2
  22. package/dist/{index.browser-_zN3Uapq.js.map → index.browser-C1QL04xM.js.map} +1 -1
  23. package/dist/{index.browser-B_wQp2A8.esm.js → index.browser-Cgj7Hs6n.esm.js} +2 -2
  24. package/dist/{index.browser-B_wQp2A8.esm.js.map → index.browser-Cgj7Hs6n.esm.js.map} +1 -1
  25. package/dist/{index.browser-1_M66nQ6.esm.js → index.browser-CifFI7Ju.esm.js} +2 -2
  26. package/dist/{index.browser-1_M66nQ6.esm.js.map → index.browser-CifFI7Ju.esm.js.map} +1 -1
  27. package/dist/{index.browser-vUinl_9y.esm.js → index.browser-D8VWPXTZ.esm.js} +2 -2
  28. package/dist/{index.browser-vUinl_9y.esm.js.map → index.browser-D8VWPXTZ.esm.js.map} +1 -1
  29. package/dist/index.esm.js +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/{index.native-Dkf8NZ2O.js → index.native-BmtuyGXs.js} +61 -42
  32. package/dist/index.native-BmtuyGXs.js.map +1 -0
  33. package/dist/{index.native-CyEwEeKr.esm.js → index.native-X01vlukI.esm.js} +62 -43
  34. package/dist/index.native-X01vlukI.esm.js.map +1 -0
  35. package/dist/index.native.esm.js +1 -1
  36. package/dist/index.native.js +1 -1
  37. package/dist/{phantom-wallet-provider-CVyVJmH0.js → phantom-wallet-provider-C_LPU6Ns.js} +37 -6
  38. package/dist/phantom-wallet-provider-C_LPU6Ns.js.map +1 -0
  39. package/dist/{phantom-wallet-provider-fkcFbwPk.esm.js → phantom-wallet-provider-DRvhBbbR.esm.js} +37 -6
  40. package/dist/phantom-wallet-provider-DRvhBbbR.esm.js.map +1 -0
  41. package/dist/{privy-wallet-provider-CrBZ52nR.js → privy-wallet-provider-DQM8xO38.js} +3 -3
  42. package/dist/privy-wallet-provider-DQM8xO38.js.map +1 -0
  43. package/dist/{privy-wallet-provider-CpHAxPcv.esm.js → privy-wallet-provider-ZGu8q5T5.esm.js} +3 -3
  44. package/dist/privy-wallet-provider-ZGu8q5T5.esm.js.map +1 -0
  45. package/dist/{solana-mobile-wallet-provider-CAaGfPZJ.js → solana-mobile-wallet-provider-6gNw2_bX.js} +34 -5
  46. package/dist/solana-mobile-wallet-provider-6gNw2_bX.js.map +1 -0
  47. package/dist/{solana-mobile-wallet-provider-DGyWHJVI.esm.js → solana-mobile-wallet-provider-B65A7abd.esm.js} +34 -5
  48. package/dist/solana-mobile-wallet-provider-B65A7abd.esm.js.map +1 -0
  49. package/package.json +2 -2
  50. package/dist/index-B7yaLhND.esm.js.map +0 -1
  51. package/dist/index-BxXQhFLQ.js.map +0 -1
  52. package/dist/index-CP_wLmYu.esm.js.map +0 -1
  53. package/dist/index-CpaP1yGp.esm.js.map +0 -1
  54. package/dist/index-DP0xF34Z.js.map +0 -1
  55. package/dist/index-DQWyH96R.js.map +0 -1
  56. package/dist/index-DfOd8wW4.esm.js +0 -6
  57. package/dist/index-DfOd8wW4.esm.js.map +0 -1
  58. package/dist/index-FviRSm3S.js.map +0 -1
  59. package/dist/index.native-CyEwEeKr.esm.js.map +0 -1
  60. package/dist/index.native-Dkf8NZ2O.js.map +0 -1
  61. package/dist/phantom-wallet-provider-CVyVJmH0.js.map +0 -1
  62. package/dist/phantom-wallet-provider-fkcFbwPk.esm.js.map +0 -1
  63. package/dist/privy-wallet-provider-CpHAxPcv.esm.js.map +0 -1
  64. package/dist/privy-wallet-provider-CrBZ52nR.js.map +0 -1
  65. package/dist/solana-mobile-wallet-provider-CAaGfPZJ.js.map +0 -1
  66. package/dist/solana-mobile-wallet-provider-DGyWHJVI.esm.js.map +0 -1
@@ -22,21 +22,6 @@ function _interopNamespaceDefault(e) {
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- function _mergeNamespaces(n, m) {
26
- m.forEach(function (e) {
27
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
28
- if (k !== 'default' && !(k in n)) {
29
- var d = Object.getOwnPropertyDescriptor(e, k);
30
- Object.defineProperty(n, k, d.get ? d : {
31
- enumerable: true,
32
- get: function () { return e[k]; }
33
- });
34
- }
35
- });
36
- });
37
- return Object.freeze(n);
38
- }
39
-
40
25
  var anchor__namespace = /*#__PURE__*/_interopNamespaceDefault(anchor);
41
26
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React$2);
42
27
 
@@ -6785,6 +6770,28 @@ class WebSessionManager {
6785
6770
  static async storeSession(address, accessToken, idToken, refreshToken) {
6786
6771
  if (typeof window === "undefined")
6787
6772
  return;
6773
+ // JWT-wallet binding: refuse to store a session whose idToken is bound
6774
+ // to a different wallet than `address`. Prevents races that would otherwise
6775
+ // leave localStorage with mismatched address/token state.
6776
+ try {
6777
+ const payloadB64 = idToken.split(".")[1];
6778
+ if (payloadB64) {
6779
+ const payload = JSON.parse(this.decodeBase64Url(payloadB64));
6780
+ const tokenWallet = payload["custom:walletAddress"];
6781
+ if (tokenWallet && tokenWallet !== address) {
6782
+ throw new Error(`[WebSessionManager] Refusing to store session: address (${address}) does not match idToken custom:walletAddress (${tokenWallet})`);
6783
+ }
6784
+ if (!tokenWallet) {
6785
+ console.warn("[WebSessionManager] storeSession: idToken has no custom:walletAddress claim — writing without validation");
6786
+ }
6787
+ }
6788
+ }
6789
+ catch (err) {
6790
+ if (typeof (err === null || err === void 0 ? void 0 : err.message) === "string" && err.message.includes("Refusing to store session")) {
6791
+ throw err;
6792
+ }
6793
+ console.warn("[WebSessionManager] storeSession: failed to decode idToken for validation:", err);
6794
+ }
6788
6795
  const config = await getConfig();
6789
6796
  const currentAppId = config.appId;
6790
6797
  localStorage.setItem(this.TAROBASE_SESSION_STORAGE_KEY, JSON.stringify({
@@ -9483,11 +9490,11 @@ function requireSrc$1 () {
9483
9490
  }
9484
9491
 
9485
9492
  var bs58$1;
9486
- var hasRequiredBs58$1;
9493
+ var hasRequiredBs58;
9487
9494
 
9488
- function requireBs58$1 () {
9489
- if (hasRequiredBs58$1) return bs58$1;
9490
- hasRequiredBs58$1 = 1;
9495
+ function requireBs58 () {
9496
+ if (hasRequiredBs58) return bs58$1;
9497
+ hasRequiredBs58 = 1;
9491
9498
  var basex = requireSrc$1();
9492
9499
  var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9493
9500
 
@@ -9495,8 +9502,8 @@ function requireBs58$1 () {
9495
9502
  return bs58$1;
9496
9503
  }
9497
9504
 
9498
- var bs58Exports$1 = requireBs58$1();
9499
- var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports$1);
9505
+ var bs58Exports = requireBs58();
9506
+ var bs58 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
9500
9507
 
9501
9508
  // ─────────────────────────────────────────────────────────────
9502
9509
  // Local implementation of getSimulationComputeUnits
@@ -9758,7 +9765,7 @@ function loadKeypairFromEnv() {
9758
9765
  try {
9759
9766
  const secretKey = secret.trim().startsWith("[")
9760
9767
  ? Uint8Array.from(JSON.parse(secret))
9761
- : bs58$2.decode(secret.trim());
9768
+ : bs58.decode(secret.trim());
9762
9769
  return web3_js.Keypair.fromSecretKey(secretKey);
9763
9770
  }
9764
9771
  catch (err) {
@@ -11703,6 +11710,28 @@ class ReactNativeSessionManager {
11703
11710
  /* STORE */
11704
11711
  /* ------------------------------------------------------------------ */
11705
11712
  static async storeSession(address, accessToken, idToken, refreshToken) {
11713
+ // JWT-wallet binding: refuse to store a session whose idToken is bound
11714
+ // to a different wallet than `address`. Prevents races that would otherwise
11715
+ // leave storage with mismatched address/token state.
11716
+ try {
11717
+ const payloadB64 = idToken.split(".")[1];
11718
+ if (payloadB64) {
11719
+ const payload = JSON.parse(this.decodeBase64Url(payloadB64));
11720
+ const tokenWallet = payload["custom:walletAddress"];
11721
+ if (tokenWallet && tokenWallet !== address) {
11722
+ throw new Error(`[ReactNativeSessionManager] Refusing to store session: address (${address}) does not match idToken custom:walletAddress (${tokenWallet})`);
11723
+ }
11724
+ if (!tokenWallet) {
11725
+ console.warn("[ReactNativeSessionManager] storeSession: idToken has no custom:walletAddress claim — writing without validation");
11726
+ }
11727
+ }
11728
+ }
11729
+ catch (err) {
11730
+ if (typeof (err === null || err === void 0 ? void 0 : err.message) === "string" && err.message.includes("Refusing to store session")) {
11731
+ throw err;
11732
+ }
11733
+ console.warn("[ReactNativeSessionManager] storeSession: failed to decode idToken for validation:", err);
11734
+ }
11706
11735
  const config = await getConfig();
11707
11736
  const currentAppId = config.appId;
11708
11737
  this.getStorage().setItem(this.TAROBASE_SESSION_STORAGE_KEY, JSON.stringify({
@@ -15701,7 +15730,7 @@ async function loadDependencies() {
15701
15730
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15702
15731
  import('react'),
15703
15732
  import('react-dom/client'),
15704
- Promise.resolve().then(function () { return require('./index-FviRSm3S.js'); })
15733
+ Promise.resolve().then(function () { return require('./index-BM6hgCdH.js'); })
15705
15734
  ]);
15706
15735
  // Extract default export from ESM module namespace
15707
15736
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -15847,6 +15876,17 @@ class PhantomWalletProvider {
15847
15876
  const isMobile = detectMobile();
15848
15877
  const hasPhantomInjected = discoveredWallets.some((w) => w.id === 'phantom');
15849
15878
  const showDeeplink = isMobile && sdkProviders.includes('deeplink') && !hasPhantomInjected;
15879
+ // Treat MWA's own wallet-standard registrations as not-injected, so the MWA
15880
+ // button still appears when only MWA is present (e.g. Android Chrome on Seeker).
15881
+ const hasInjectedWallet = discoveredWallets.some((w) => {
15882
+ var _a, _b;
15883
+ const id = String((_a = w.id) !== null && _a !== void 0 ? _a : '').toLowerCase();
15884
+ const name = String((_b = w.name) !== null && _b !== void 0 ? _b : '').toLowerCase();
15885
+ return (id !== 'mobile-wallet-adapter' &&
15886
+ id !== 'remote-mobile-wallet-adapter' &&
15887
+ name !== 'mobile wallet adapter' &&
15888
+ name !== 'remote mobile wallet adapter');
15889
+ });
15850
15890
  // Track previous modal state to detect closes
15851
15891
  const prevModalOpen = React$1.useRef(false);
15852
15892
  // Track when modal was closed because user selected a wallet (not dismissed)
@@ -15895,6 +15935,16 @@ class PhantomWalletProvider {
15895
15935
  if (!(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected) || (phantom === null || phantom === void 0 ? void 0 : phantom.isLoading) || that.loginInProgress || that.autoLoginInProgress || that.pendingLogin) {
15896
15936
  return;
15897
15937
  }
15938
+ // Don't clobber a session owned by MWA on Seeker. MWA marks the
15939
+ // auth method as soon as login starts (see solana-mobile-wallet-provider),
15940
+ // and clears it on logout, so this guard is correct in both
15941
+ // steady-state and post-logout cases.
15942
+ try {
15943
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'mobile-wallet-adapter') {
15944
+ return;
15945
+ }
15946
+ }
15947
+ catch (_b) { }
15898
15948
  // Need solana to be available AND connected for signing
15899
15949
  if (!solana || !solanaHook.isAvailable || !solana.connected) {
15900
15950
  return;
@@ -15924,12 +15974,21 @@ class PhantomWalletProvider {
15924
15974
  const signatureBytes = signResult.signature;
15925
15975
  const signature = bufferExports.Buffer.from(signatureBytes).toString('base64');
15926
15976
  const createSessionResult = await createSessionWithSignature(publicKey, messageText, signature);
15977
+ // Pre-write guard: MWA may have started a login while we were
15978
+ // in flight. If MWA owns the auth method now, abort before we
15979
+ // overwrite its session (or its in-flight session).
15980
+ try {
15981
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'mobile-wallet-adapter') {
15982
+ return;
15983
+ }
15984
+ }
15985
+ catch (_c) { }
15927
15986
  await WebSessionManager.storeSession(publicKey, createSessionResult.accessToken, createSessionResult.idToken, createSessionResult.refreshToken);
15928
15987
  // Mark auth method so clearIncompatibleSession() doesn't wipe this session
15929
15988
  try {
15930
15989
  getPlatform().storage.setItem('tarobase_last_auth_method', 'phantom');
15931
15990
  }
15932
- catch (_b) { }
15991
+ catch (_d) { }
15933
15992
  setCurrentUser({ provider: that, address: publicKey });
15934
15993
  }
15935
15994
  catch (error) {
@@ -16285,8 +16344,9 @@ class PhantomWalletProvider {
16285
16344
  }), 'Open Phantom app'));
16286
16345
  }
16287
16346
  // Mobile Wallet Adapter button — shown on Android when MWA callback is available
16347
+ // and no injected wallet is present (hides button inside Phantom/Solflare/etc. in-app browsers).
16288
16348
  const isAndroid = detectAndroid();
16289
- if (isAndroid && that.onSwitchToMWA) {
16349
+ if (isAndroid && that.onSwitchToMWA && !hasInjectedWallet) {
16290
16350
  walletButtons.push(React$1.createElement('button', {
16291
16351
  key: 'mobile-wallet',
16292
16352
  style: buttonStyle('mobile-wallet'),
@@ -20328,26 +20388,16 @@ function requireSrc () {
20328
20388
  return src;
20329
20389
  }
20330
20390
 
20331
- var bs58;
20332
- var hasRequiredBs58;
20333
-
20334
- function requireBs58 () {
20335
- if (hasRequiredBs58) return bs58;
20336
- hasRequiredBs58 = 1;
20337
- var basex = requireSrc();
20338
- var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
20339
-
20340
- bs58 = basex(ALPHABET);
20341
- return bs58;
20342
- }
20391
+ var srcExports = requireSrc();
20392
+ var basex = /*@__PURE__*/getDefaultExportFromCjs$1(srcExports);
20343
20393
 
20344
- var bs58Exports = requireBs58();
20345
- var base58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
20394
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
20395
+ var base58 = basex(ALPHABET);
20346
20396
 
20347
- var index = /*#__PURE__*/_mergeNamespaces({
20397
+ var index = /*#__PURE__*/Object.freeze({
20348
20398
  __proto__: null,
20349
20399
  default: base58
20350
- }, [bs58Exports]);
20400
+ });
20351
20401
 
20352
20402
  const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
20353
20403
  let React;
@@ -21261,7 +21311,7 @@ async function loadMwaProtocol() {
21261
21311
  return mwaProtocolLoadPromise;
21262
21312
  mwaProtocolLoadPromise = (async () => {
21263
21313
  try {
21264
- mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-BhppfDyf.js'); });
21314
+ mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-BvNsUWjt.js'); });
21265
21315
  }
21266
21316
  catch (e) {
21267
21317
  console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
@@ -21283,7 +21333,7 @@ async function registerMobileWalletAdapter(config) {
21283
21333
  if (typeof window === 'undefined')
21284
21334
  return;
21285
21335
  try {
21286
- const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-_zN3Uapq.js'); });
21336
+ const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-C1QL04xM.js'); });
21287
21337
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21288
21338
  if (!registerMwa) {
21289
21339
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21413,6 +21463,19 @@ class SolanaMobileWalletProvider {
21413
21463
  async login() {
21414
21464
  var _a, _b, _c, _d, _e;
21415
21465
  setAuthLoading(true);
21466
+ // Mark the auth method early so a concurrent Phantom auto-create can see
21467
+ // 'mobile-wallet-adapter' during our slow transact() / session-creation
21468
+ // roundtrip and back off (see phantom-wallet-provider autoCreateSession).
21469
+ // Capture the previous value so we can restore it if login fails.
21470
+ let prevAuthMethod = null;
21471
+ try {
21472
+ prevAuthMethod = getPlatform().storage.getItem('tarobase_last_auth_method');
21473
+ }
21474
+ catch (_f) { }
21475
+ try {
21476
+ getPlatform().storage.setItem('tarobase_last_auth_method', 'mobile-wallet-adapter');
21477
+ }
21478
+ catch (_g) { }
21416
21479
  try {
21417
21480
  await loadMwaProtocol();
21418
21481
  const { transact } = mwaProtocolModule;
@@ -21478,12 +21541,22 @@ class SolanaMobileWalletProvider {
21478
21541
  try {
21479
21542
  getPlatform().storage.setItem('tarobase_last_auth_method', 'mobile-wallet-adapter');
21480
21543
  }
21481
- catch (_f) { }
21544
+ catch (_h) { }
21482
21545
  const user = { provider: this, address: result.base58Address };
21483
21546
  setCurrentUser(user);
21484
21547
  return user;
21485
21548
  }
21486
21549
  catch (error) {
21550
+ // Restore the previous auth method since this login attempt failed.
21551
+ try {
21552
+ if (prevAuthMethod === null) {
21553
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
21554
+ }
21555
+ else {
21556
+ getPlatform().storage.setItem('tarobase_last_auth_method', prevAuthMethod);
21557
+ }
21558
+ }
21559
+ catch (_j) { }
21487
21560
  const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
21488
21561
  ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
21489
21562
  ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
@@ -21529,6 +21602,12 @@ class SolanaMobileWalletProvider {
21529
21602
  this.authorizedPublicKey = null;
21530
21603
  this.publicKeyObj = null;
21531
21604
  WebSessionManager.clearSession();
21605
+ // Clear the auth-method marker so Phantom auto-create is unblocked
21606
+ // for any subsequent fresh login on this device.
21607
+ try {
21608
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
21609
+ }
21610
+ catch (_a) { }
21532
21611
  setCurrentUser(null);
21533
21612
  }
21534
21613
  async signMessage(message) {
@@ -22249,4 +22328,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
22249
22328
  exports.signTransaction = signTransaction;
22250
22329
  exports.subscribe = subscribe;
22251
22330
  exports.useAuth = useAuth;
22252
- //# sourceMappingURL=index-DP0xF34Z.js.map
22331
+ //# sourceMappingURL=index-BPlF6-PQ.js.map