@pooflabs/web 0.0.85-rc1 → 0.0.85-rc2

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 (51) hide show
  1. package/dist/auth/providers/solana-mobile-wallet-provider.d.ts +5 -0
  2. package/dist/{index-BoWQVxMI.js → index-B1_Q49qQ.js} +2 -2
  3. package/dist/{index-BoWQVxMI.js.map → index-B1_Q49qQ.js.map} +1 -1
  4. package/dist/{index-Buu8v-Oe.esm.js → index-B7tJ8TAn.esm.js} +2 -2
  5. package/dist/{index-Buu8v-Oe.esm.js.map → index-B7tJ8TAn.esm.js.map} +1 -1
  6. package/dist/{index-R7cvXys2.js → index-BeFR3-cf.js} +137 -12
  7. package/dist/{index-R7cvXys2.js.map → index-BeFR3-cf.js.map} +1 -1
  8. package/dist/index-DbJCCvVN.esm.js +6 -0
  9. package/dist/index-DbJCCvVN.esm.js.map +1 -0
  10. package/dist/{index-C2p1Cldz.js → index-DflG_JAB.js} +3 -3
  11. package/dist/{index-C2p1Cldz.js.map → index-DflG_JAB.js.map} +1 -1
  12. package/dist/{index-DlyeWzMk.js → index-DyRIXw-l.js} +2 -2
  13. package/dist/index-DyRIXw-l.js.map +1 -0
  14. package/dist/{index-ZKzq5QT_.esm.js → index-QukWgaIi.esm.js} +137 -12
  15. package/dist/{index-ZKzq5QT_.esm.js.map → index-QukWgaIi.esm.js.map} +1 -1
  16. package/dist/{index-4TKz3Mn_.esm.js → index-agGmWBn4.esm.js} +3 -3
  17. package/dist/{index-4TKz3Mn_.esm.js.map → index-agGmWBn4.esm.js.map} +1 -1
  18. package/dist/{index.browser-DZCNegue.js → index.browser-BJmFjY2f.js} +2 -2
  19. package/dist/{index.browser-DZCNegue.js.map → index.browser-BJmFjY2f.js.map} +1 -1
  20. package/dist/{index.browser-BQSN-6X2.js → index.browser-DZtZWdul.js} +2 -118
  21. package/dist/{index.browser-BQSN-6X2.js.map → index.browser-DZtZWdul.js.map} +1 -1
  22. package/dist/{index.browser-zfGYm0ST.esm.js → index.browser-lHP9glAW.esm.js} +2 -2
  23. package/dist/{index.browser-zfGYm0ST.esm.js.map → index.browser-lHP9glAW.esm.js.map} +1 -1
  24. package/dist/{index.browser-tPepE5fo.esm.js → index.browser-p-pgsxxW.esm.js} +3 -117
  25. package/dist/{index.browser-tPepE5fo.esm.js.map → index.browser-p-pgsxxW.esm.js.map} +1 -1
  26. package/dist/index.esm.js +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/{index.native-BGaUOX9f.js → index.native-ANhb4jEB.js} +4 -4
  29. package/dist/{index.native-BGaUOX9f.js.map → index.native-ANhb4jEB.js.map} +1 -1
  30. package/dist/{index.native-BPQqeP6_.esm.js → index.native-a3mhu9HP.esm.js} +4 -4
  31. package/dist/{index.native-BPQqeP6_.esm.js.map → index.native-a3mhu9HP.esm.js.map} +1 -1
  32. package/dist/index.native.esm.js +1 -1
  33. package/dist/index.native.js +1 -1
  34. package/dist/{phantom-wallet-provider-MFcwrRpJ.js → phantom-wallet-provider-BOdn0D1Q.js} +4 -4
  35. package/dist/{phantom-wallet-provider-MFcwrRpJ.js.map → phantom-wallet-provider-BOdn0D1Q.js.map} +1 -1
  36. package/dist/{phantom-wallet-provider-DheGhOp4.esm.js → phantom-wallet-provider-Dsza6TBv.esm.js} +4 -4
  37. package/dist/{phantom-wallet-provider-DheGhOp4.esm.js.map → phantom-wallet-provider-Dsza6TBv.esm.js.map} +1 -1
  38. package/dist/{privy-wallet-provider-CFw6o7O5.js → privy-wallet-provider-BlPh3Gn_.js} +3 -3
  39. package/dist/{privy-wallet-provider-CFw6o7O5.js.map → privy-wallet-provider-BlPh3Gn_.js.map} +1 -1
  40. package/dist/{privy-wallet-provider-D15Au3j8.esm.js → privy-wallet-provider-bwwhkFjL.esm.js} +3 -3
  41. package/dist/{privy-wallet-provider-D15Au3j8.esm.js.map → privy-wallet-provider-bwwhkFjL.esm.js.map} +1 -1
  42. package/dist/{solana-mobile-wallet-provider-BM9wdF0m.js → solana-mobile-wallet-provider-S8yWHG6i.js} +130 -8
  43. package/dist/solana-mobile-wallet-provider-S8yWHG6i.js.map +1 -0
  44. package/dist/{solana-mobile-wallet-provider-ChHh-U_p.esm.js → solana-mobile-wallet-provider-fzLIgJBf.esm.js} +130 -8
  45. package/dist/solana-mobile-wallet-provider-fzLIgJBf.esm.js.map +1 -0
  46. package/package.json +1 -1
  47. package/dist/index-COF6zNCs.esm.js +0 -6
  48. package/dist/index-COF6zNCs.esm.js.map +0 -1
  49. package/dist/index-DlyeWzMk.js.map +0 -1
  50. package/dist/solana-mobile-wallet-provider-BM9wdF0m.js.map +0 -1
  51. package/dist/solana-mobile-wallet-provider-ChHh-U_p.esm.js.map +0 -1
@@ -15730,7 +15730,7 @@ async function loadDependencies() {
15730
15730
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15731
15731
  import('react'),
15732
15732
  import('react-dom/client'),
15733
- Promise.resolve().then(function () { return require('./index-BoWQVxMI.js'); })
15733
+ Promise.resolve().then(function () { return require('./index-B1_Q49qQ.js'); })
15734
15734
  ]);
15735
15735
  // Extract default export from ESM module namespace
15736
15736
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -21301,6 +21301,110 @@ function isMobileWalletAvailable() {
21301
21301
  const ED25519_SIGNATURE_LENGTH = 64;
21302
21302
  const STORED_AUTH_METHOD_KEY = 'tarobase_last_auth_method';
21303
21303
  const MWA_AUTH_METHOD = 'mobile-wallet-adapter';
21304
+ function findMwaError(e, maxDepth = 5) {
21305
+ var _a;
21306
+ let cur = e;
21307
+ let depth = 0;
21308
+ while (cur && depth < maxDepth) {
21309
+ if ((cur === null || cur === void 0 ? void 0 : cur.name) === 'SolanaMobileWalletAdapterError' && typeof (cur === null || cur === void 0 ? void 0 : cur.code) === 'string') {
21310
+ return { code: cur.code, message: String((_a = cur.message) !== null && _a !== void 0 ? _a : '') };
21311
+ }
21312
+ cur = cur === null || cur === void 0 ? void 0 : cur.cause;
21313
+ depth++;
21314
+ }
21315
+ return null;
21316
+ }
21317
+ /**
21318
+ * Returns the matched MwaErrorInfo when the error is from an association
21319
+ * failure that an automatic retry can recover from (i.e. the wallet exists
21320
+ * on-device but the dApp's protocol session didn't complete in time). Returns
21321
+ * null for non-retryable errors (user cancel, unknown wallet errors, etc.).
21322
+ *
21323
+ * Specifically:
21324
+ * - ERROR_WALLET_NOT_FOUND: thrown from the protocol's startScenario when
21325
+ * it gave up waiting for a wallet to respond. On Seeker this races the
21326
+ * first-time-consent UI on the very first authorize.
21327
+ * - ERROR_SESSION_TIMEOUT: similar — the protocol's session-establishment
21328
+ * timer expired.
21329
+ * - ERROR_ASSOCIATION_CANCELLED: shared by user-cancel ("Wallet connection
21330
+ * cancelled by user") AND the 30s wallet-standard WALLET_ASSOCIATION_TIMEOUT
21331
+ * ("Wallet connection timed out"). Discriminate by message — never retry
21332
+ * a user cancel.
21333
+ */
21334
+ function isMwaAssociationRetryable(e) {
21335
+ const info = findMwaError(e);
21336
+ if (!info)
21337
+ return null;
21338
+ if (info.code === 'ERROR_WALLET_NOT_FOUND')
21339
+ return info;
21340
+ if (info.code === 'ERROR_SESSION_TIMEOUT')
21341
+ return info;
21342
+ if (info.code === 'ERROR_ASSOCIATION_CANCELLED' && /timed out/i.test(info.message))
21343
+ return info;
21344
+ return null;
21345
+ }
21346
+ /**
21347
+ * Single-retry wrapper for MWA association failures. Used ONLY for login's
21348
+ * `standard:connect` and `solana:signMessage` calls — never for
21349
+ * `signAndSendTransaction`/`runTransaction` because retry on a path that
21350
+ * may have already submitted a tx can double-send.
21351
+ *
21352
+ * The retry exists for one specific scenario: on first-time MWA usage from a
21353
+ * given origin on Seeker, the protocol's session-establishment timer races
21354
+ * Seeker's first-time consent UI. The user reads the consent sheet, taps
21355
+ * Connect — but by then the protocol has given up and thrown
21356
+ * ERROR_WALLET_NOT_FOUND. The consent itself IS persisted on Seeker though,
21357
+ * so a second attempt skips the consent sheet, jumps straight to
21358
+ * Verify/Approve, and completes inside the timeout.
21359
+ */
21360
+ async function withMwaAssociationRetry(label, fn) {
21361
+ const t0 = Date.now();
21362
+ console.log(`[MWA-DEBUG] ${label} attempt=1 start`);
21363
+ try {
21364
+ const result = await fn();
21365
+ console.log(`[MWA-DEBUG] ${label} attempt=1 ok (${Date.now() - t0}ms)`);
21366
+ return result;
21367
+ }
21368
+ catch (e) {
21369
+ const info = findMwaError(e);
21370
+ console.log(`[MWA-DEBUG] ${label} attempt=1 err (${Date.now() - t0}ms)`, {
21371
+ outer: { name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message },
21372
+ mwa: info,
21373
+ });
21374
+ const retryable = isMwaAssociationRetryable(e);
21375
+ if (!retryable)
21376
+ throw e;
21377
+ // Seeker's consent sheet is a bottom-sheet overlay — Chrome doesn't
21378
+ // reliably flip document.visibilityState to 'hidden' while it's open,
21379
+ // so visibility-based waits fire too early. Use a fixed delay long
21380
+ // enough for Seeker to dismiss its sheet and the OS to release intent
21381
+ // state. 2.5s is empirically safe; tune from device traces if needed.
21382
+ console.log(`[MWA-DEBUG] ${label} retryable (${retryable.code}); waiting 2500ms before retry`);
21383
+ await new Promise(r => setTimeout(r, 2500));
21384
+ const t1 = Date.now();
21385
+ console.log(`[MWA-DEBUG] ${label} attempt=2 start`);
21386
+ try {
21387
+ const result = await fn();
21388
+ console.log(`[MWA-DEBUG] ${label} attempt=2 ok (${Date.now() - t1}ms)`);
21389
+ return result;
21390
+ }
21391
+ catch (e2) {
21392
+ const info2 = findMwaError(e2);
21393
+ console.log(`[MWA-DEBUG] ${label} attempt=2 err (${Date.now() - t1}ms)`, {
21394
+ outer: { name: e2 === null || e2 === void 0 ? void 0 : e2.name, message: e2 === null || e2 === void 0 ? void 0 : e2.message },
21395
+ mwa: info2,
21396
+ });
21397
+ // Only mask the error with the clean Seeker message when the
21398
+ // second failure is also an association-flavored error. If it's
21399
+ // a user cancel, wallet rejection, or unknown error, rethrow
21400
+ // the original so the host app surfaces the real cause.
21401
+ if (isMwaAssociationRetryable(e2)) {
21402
+ throw new Error("Couldn't connect to your Seeker wallet. Please try again.");
21403
+ }
21404
+ throw e2;
21405
+ }
21406
+ }
21407
+ }
21304
21408
  /**
21305
21409
  * Normalize a chain string to a wallet-standard Solana chain identifier.
21306
21410
  *
@@ -21438,11 +21542,11 @@ function readAuthMethod() {
21438
21542
  * @param config - App identity and optional remote host authority for desktop QR code support
21439
21543
  */
21440
21544
  async function registerMobileWalletAdapter(config) {
21441
- var _a;
21545
+ var _a, _b;
21442
21546
  if (typeof window === 'undefined')
21443
21547
  return;
21444
21548
  try {
21445
- const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-DZCNegue.js'); });
21549
+ const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-BJmFjY2f.js'); });
21446
21550
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21447
21551
  if (!registerMwa) {
21448
21552
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21465,9 +21569,12 @@ async function registerMobileWalletAdapter(config) {
21465
21569
  if (walletStandardMobile.createDefaultChainSelector) {
21466
21570
  options.chainSelector = walletStandardMobile.createDefaultChainSelector();
21467
21571
  }
21468
- if (walletStandardMobile.createDefaultWalletNotFoundHandler) {
21469
- options.onWalletNotFound = walletStandardMobile.createDefaultWalletNotFoundHandler();
21470
- }
21572
+ // Default: suppress the "We can't find a wallet" modal — see
21573
+ // SolanaMobileWalletProvider.ensureWallet() for why. Consumers that
21574
+ // want their own UX can pass config.onWalletNotFound.
21575
+ options.onWalletNotFound = (_b = config === null || config === void 0 ? void 0 : config.onWalletNotFound) !== null && _b !== void 0 ? _b : (async () => {
21576
+ console.warn('[MWA-DEBUG] registerMobileWalletAdapter onWalletNotFound (suppressed)');
21577
+ });
21471
21578
  registerMwa(options);
21472
21579
  }
21473
21580
  catch (e) {
@@ -21531,14 +21638,22 @@ class SolanaMobileWalletProvider {
21531
21638
  async ensureWallet() {
21532
21639
  if (this.wallet)
21533
21640
  return this.wallet;
21534
- const mod = await Promise.resolve().then(function () { return require('./index.browser-DZCNegue.js'); });
21641
+ const mod = await Promise.resolve().then(function () { return require('./index.browser-BJmFjY2f.js'); });
21535
21642
  const chain = mapChainToWalletStandard(this.cluster);
21536
21643
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21537
21644
  appIdentity: this.appIdentity,
21538
21645
  authorizationCache: mod.createDefaultAuthorizationCache(),
21539
21646
  chains: [chain],
21540
21647
  chainSelector: mod.createDefaultChainSelector(),
21541
- onWalletNotFound: mod.createDefaultWalletNotFoundHandler(),
21648
+ // Suppress the default "We can't find a wallet" modal — that
21649
+ // modal is misleading when ERROR_WALLET_NOT_FOUND fires during
21650
+ // a first-time-consent race on Seeker (the wallet IS installed,
21651
+ // the protocol just gave up before the user finished consenting).
21652
+ // login()'s withMwaAssociationRetry handles this case; on second
21653
+ // failure it surfaces a clean error message to the host app.
21654
+ onWalletNotFound: async () => {
21655
+ console.warn('[MWA-DEBUG] ensureWallet onWalletNotFound (suppressed)');
21656
+ },
21542
21657
  });
21543
21658
  return this.wallet;
21544
21659
  }
@@ -21603,8 +21718,15 @@ class SolanaMobileWalletProvider {
21603
21718
  // is where wallet-standard's checkLocalNetworkAccessPermission()
21604
21719
  // fires the three-stage LNA UX (info modal → permission prompt →
21605
21720
  // success modal) before opening the localhost WebSocket.
21721
+ //
21722
+ // Wrap with single-retry: on a Seeker origin's first MWA usage,
21723
+ // the protocol's session-establishment timer often races Seeker's
21724
+ // first-time consent UI and throws ERROR_WALLET_NOT_FOUND before
21725
+ // the user finishes tapping. The retry hits Seeker's cached
21726
+ // consent on the second pass and completes quickly. See
21727
+ // withMwaAssociationRetry for details.
21606
21728
  const connectFeat = getConnectFeature(wallet);
21607
- const { accounts } = await connectFeat.connect();
21729
+ const { accounts } = await withMwaAssociationRetry('login:connect', () => connectFeat.connect());
21608
21730
  if (!accounts || accounts.length === 0) {
21609
21731
  throw new Error('MWA returned no accounts');
21610
21732
  }
@@ -21618,11 +21740,14 @@ class SolanaMobileWalletProvider {
21618
21740
  setCurrentUser(user);
21619
21741
  return user;
21620
21742
  }
21621
- // Wallet popup #2: sign the Tarobase nonce message.
21743
+ // Wallet popup #2: sign the Tarobase nonce message. Wrap with the
21744
+ // same retry for defense in depth — by now Seeker has cached the
21745
+ // consent so this rarely hits the retry path, but if the
21746
+ // protocol's session timer fires here too we recover transparently.
21622
21747
  const messageText = await genSolanaMessage(base58Addr, nonce);
21623
21748
  const messageBytes = getPlatform().textEncode(messageText);
21624
21749
  const signMessageFeat = getSignMessageFeature(wallet);
21625
- const signResults = await signMessageFeat.signMessage({ account, message: messageBytes });
21750
+ const signResults = await withMwaAssociationRetry('login:signMessage', () => signMessageFeat.signMessage({ account, message: messageBytes }));
21626
21751
  if (!signResults || signResults.length === 0) {
21627
21752
  throw new Error('MWA returned no signature');
21628
21753
  }
@@ -22436,4 +22561,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
22436
22561
  exports.signTransaction = signTransaction;
22437
22562
  exports.subscribe = subscribe;
22438
22563
  exports.useAuth = useAuth;
22439
- //# sourceMappingURL=index-R7cvXys2.js.map
22564
+ //# sourceMappingURL=index-BeFR3-cf.js.map