@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
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index_native = require('./index.native-BGaUOX9f.js');
3
+ var index_native = require('./index.native-ANhb4jEB.js');
4
4
 
5
5
  var bufferExports = index_native.requireBuffer();
6
6
 
7
7
  exports.bufferExports = bufferExports;
8
- //# sourceMappingURL=index-DlyeWzMk.js.map
8
+ //# sourceMappingURL=index-DyRIXw-l.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DyRIXw-l.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -15709,7 +15709,7 @@ async function loadDependencies() {
15709
15709
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15710
15710
  import('react'),
15711
15711
  import('react-dom/client'),
15712
- import('./index-Buu8v-Oe.esm.js')
15712
+ import('./index-B7tJ8TAn.esm.js')
15713
15713
  ]);
15714
15714
  // Extract default export from ESM module namespace
15715
15715
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -21280,6 +21280,110 @@ function isMobileWalletAvailable() {
21280
21280
  const ED25519_SIGNATURE_LENGTH = 64;
21281
21281
  const STORED_AUTH_METHOD_KEY = 'tarobase_last_auth_method';
21282
21282
  const MWA_AUTH_METHOD = 'mobile-wallet-adapter';
21283
+ function findMwaError(e, maxDepth = 5) {
21284
+ var _a;
21285
+ let cur = e;
21286
+ let depth = 0;
21287
+ while (cur && depth < maxDepth) {
21288
+ if ((cur === null || cur === void 0 ? void 0 : cur.name) === 'SolanaMobileWalletAdapterError' && typeof (cur === null || cur === void 0 ? void 0 : cur.code) === 'string') {
21289
+ return { code: cur.code, message: String((_a = cur.message) !== null && _a !== void 0 ? _a : '') };
21290
+ }
21291
+ cur = cur === null || cur === void 0 ? void 0 : cur.cause;
21292
+ depth++;
21293
+ }
21294
+ return null;
21295
+ }
21296
+ /**
21297
+ * Returns the matched MwaErrorInfo when the error is from an association
21298
+ * failure that an automatic retry can recover from (i.e. the wallet exists
21299
+ * on-device but the dApp's protocol session didn't complete in time). Returns
21300
+ * null for non-retryable errors (user cancel, unknown wallet errors, etc.).
21301
+ *
21302
+ * Specifically:
21303
+ * - ERROR_WALLET_NOT_FOUND: thrown from the protocol's startScenario when
21304
+ * it gave up waiting for a wallet to respond. On Seeker this races the
21305
+ * first-time-consent UI on the very first authorize.
21306
+ * - ERROR_SESSION_TIMEOUT: similar — the protocol's session-establishment
21307
+ * timer expired.
21308
+ * - ERROR_ASSOCIATION_CANCELLED: shared by user-cancel ("Wallet connection
21309
+ * cancelled by user") AND the 30s wallet-standard WALLET_ASSOCIATION_TIMEOUT
21310
+ * ("Wallet connection timed out"). Discriminate by message — never retry
21311
+ * a user cancel.
21312
+ */
21313
+ function isMwaAssociationRetryable(e) {
21314
+ const info = findMwaError(e);
21315
+ if (!info)
21316
+ return null;
21317
+ if (info.code === 'ERROR_WALLET_NOT_FOUND')
21318
+ return info;
21319
+ if (info.code === 'ERROR_SESSION_TIMEOUT')
21320
+ return info;
21321
+ if (info.code === 'ERROR_ASSOCIATION_CANCELLED' && /timed out/i.test(info.message))
21322
+ return info;
21323
+ return null;
21324
+ }
21325
+ /**
21326
+ * Single-retry wrapper for MWA association failures. Used ONLY for login's
21327
+ * `standard:connect` and `solana:signMessage` calls — never for
21328
+ * `signAndSendTransaction`/`runTransaction` because retry on a path that
21329
+ * may have already submitted a tx can double-send.
21330
+ *
21331
+ * The retry exists for one specific scenario: on first-time MWA usage from a
21332
+ * given origin on Seeker, the protocol's session-establishment timer races
21333
+ * Seeker's first-time consent UI. The user reads the consent sheet, taps
21334
+ * Connect — but by then the protocol has given up and thrown
21335
+ * ERROR_WALLET_NOT_FOUND. The consent itself IS persisted on Seeker though,
21336
+ * so a second attempt skips the consent sheet, jumps straight to
21337
+ * Verify/Approve, and completes inside the timeout.
21338
+ */
21339
+ async function withMwaAssociationRetry(label, fn) {
21340
+ const t0 = Date.now();
21341
+ console.log(`[MWA-DEBUG] ${label} attempt=1 start`);
21342
+ try {
21343
+ const result = await fn();
21344
+ console.log(`[MWA-DEBUG] ${label} attempt=1 ok (${Date.now() - t0}ms)`);
21345
+ return result;
21346
+ }
21347
+ catch (e) {
21348
+ const info = findMwaError(e);
21349
+ console.log(`[MWA-DEBUG] ${label} attempt=1 err (${Date.now() - t0}ms)`, {
21350
+ outer: { name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message },
21351
+ mwa: info,
21352
+ });
21353
+ const retryable = isMwaAssociationRetryable(e);
21354
+ if (!retryable)
21355
+ throw e;
21356
+ // Seeker's consent sheet is a bottom-sheet overlay — Chrome doesn't
21357
+ // reliably flip document.visibilityState to 'hidden' while it's open,
21358
+ // so visibility-based waits fire too early. Use a fixed delay long
21359
+ // enough for Seeker to dismiss its sheet and the OS to release intent
21360
+ // state. 2.5s is empirically safe; tune from device traces if needed.
21361
+ console.log(`[MWA-DEBUG] ${label} retryable (${retryable.code}); waiting 2500ms before retry`);
21362
+ await new Promise(r => setTimeout(r, 2500));
21363
+ const t1 = Date.now();
21364
+ console.log(`[MWA-DEBUG] ${label} attempt=2 start`);
21365
+ try {
21366
+ const result = await fn();
21367
+ console.log(`[MWA-DEBUG] ${label} attempt=2 ok (${Date.now() - t1}ms)`);
21368
+ return result;
21369
+ }
21370
+ catch (e2) {
21371
+ const info2 = findMwaError(e2);
21372
+ console.log(`[MWA-DEBUG] ${label} attempt=2 err (${Date.now() - t1}ms)`, {
21373
+ outer: { name: e2 === null || e2 === void 0 ? void 0 : e2.name, message: e2 === null || e2 === void 0 ? void 0 : e2.message },
21374
+ mwa: info2,
21375
+ });
21376
+ // Only mask the error with the clean Seeker message when the
21377
+ // second failure is also an association-flavored error. If it's
21378
+ // a user cancel, wallet rejection, or unknown error, rethrow
21379
+ // the original so the host app surfaces the real cause.
21380
+ if (isMwaAssociationRetryable(e2)) {
21381
+ throw new Error("Couldn't connect to your Seeker wallet. Please try again.");
21382
+ }
21383
+ throw e2;
21384
+ }
21385
+ }
21386
+ }
21283
21387
  /**
21284
21388
  * Normalize a chain string to a wallet-standard Solana chain identifier.
21285
21389
  *
@@ -21417,11 +21521,11 @@ function readAuthMethod() {
21417
21521
  * @param config - App identity and optional remote host authority for desktop QR code support
21418
21522
  */
21419
21523
  async function registerMobileWalletAdapter(config) {
21420
- var _a;
21524
+ var _a, _b;
21421
21525
  if (typeof window === 'undefined')
21422
21526
  return;
21423
21527
  try {
21424
- const walletStandardMobile = await import('./index.browser-zfGYm0ST.esm.js');
21528
+ const walletStandardMobile = await import('./index.browser-lHP9glAW.esm.js');
21425
21529
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21426
21530
  if (!registerMwa) {
21427
21531
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21444,9 +21548,12 @@ async function registerMobileWalletAdapter(config) {
21444
21548
  if (walletStandardMobile.createDefaultChainSelector) {
21445
21549
  options.chainSelector = walletStandardMobile.createDefaultChainSelector();
21446
21550
  }
21447
- if (walletStandardMobile.createDefaultWalletNotFoundHandler) {
21448
- options.onWalletNotFound = walletStandardMobile.createDefaultWalletNotFoundHandler();
21449
- }
21551
+ // Default: suppress the "We can't find a wallet" modal — see
21552
+ // SolanaMobileWalletProvider.ensureWallet() for why. Consumers that
21553
+ // want their own UX can pass config.onWalletNotFound.
21554
+ options.onWalletNotFound = (_b = config === null || config === void 0 ? void 0 : config.onWalletNotFound) !== null && _b !== void 0 ? _b : (async () => {
21555
+ console.warn('[MWA-DEBUG] registerMobileWalletAdapter onWalletNotFound (suppressed)');
21556
+ });
21450
21557
  registerMwa(options);
21451
21558
  }
21452
21559
  catch (e) {
@@ -21510,14 +21617,22 @@ class SolanaMobileWalletProvider {
21510
21617
  async ensureWallet() {
21511
21618
  if (this.wallet)
21512
21619
  return this.wallet;
21513
- const mod = await import('./index.browser-zfGYm0ST.esm.js');
21620
+ const mod = await import('./index.browser-lHP9glAW.esm.js');
21514
21621
  const chain = mapChainToWalletStandard(this.cluster);
21515
21622
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21516
21623
  appIdentity: this.appIdentity,
21517
21624
  authorizationCache: mod.createDefaultAuthorizationCache(),
21518
21625
  chains: [chain],
21519
21626
  chainSelector: mod.createDefaultChainSelector(),
21520
- onWalletNotFound: mod.createDefaultWalletNotFoundHandler(),
21627
+ // Suppress the default "We can't find a wallet" modal — that
21628
+ // modal is misleading when ERROR_WALLET_NOT_FOUND fires during
21629
+ // a first-time-consent race on Seeker (the wallet IS installed,
21630
+ // the protocol just gave up before the user finished consenting).
21631
+ // login()'s withMwaAssociationRetry handles this case; on second
21632
+ // failure it surfaces a clean error message to the host app.
21633
+ onWalletNotFound: async () => {
21634
+ console.warn('[MWA-DEBUG] ensureWallet onWalletNotFound (suppressed)');
21635
+ },
21521
21636
  });
21522
21637
  return this.wallet;
21523
21638
  }
@@ -21582,8 +21697,15 @@ class SolanaMobileWalletProvider {
21582
21697
  // is where wallet-standard's checkLocalNetworkAccessPermission()
21583
21698
  // fires the three-stage LNA UX (info modal → permission prompt →
21584
21699
  // success modal) before opening the localhost WebSocket.
21700
+ //
21701
+ // Wrap with single-retry: on a Seeker origin's first MWA usage,
21702
+ // the protocol's session-establishment timer often races Seeker's
21703
+ // first-time consent UI and throws ERROR_WALLET_NOT_FOUND before
21704
+ // the user finishes tapping. The retry hits Seeker's cached
21705
+ // consent on the second pass and completes quickly. See
21706
+ // withMwaAssociationRetry for details.
21585
21707
  const connectFeat = getConnectFeature(wallet);
21586
- const { accounts } = await connectFeat.connect();
21708
+ const { accounts } = await withMwaAssociationRetry('login:connect', () => connectFeat.connect());
21587
21709
  if (!accounts || accounts.length === 0) {
21588
21710
  throw new Error('MWA returned no accounts');
21589
21711
  }
@@ -21597,11 +21719,14 @@ class SolanaMobileWalletProvider {
21597
21719
  setCurrentUser(user);
21598
21720
  return user;
21599
21721
  }
21600
- // Wallet popup #2: sign the Tarobase nonce message.
21722
+ // Wallet popup #2: sign the Tarobase nonce message. Wrap with the
21723
+ // same retry for defense in depth — by now Seeker has cached the
21724
+ // consent so this rarely hits the retry path, but if the
21725
+ // protocol's session timer fires here too we recover transparently.
21601
21726
  const messageText = await genSolanaMessage(base58Addr, nonce);
21602
21727
  const messageBytes = getPlatform().textEncode(messageText);
21603
21728
  const signMessageFeat = getSignMessageFeature(wallet);
21604
- const signResults = await signMessageFeat.signMessage({ account, message: messageBytes });
21729
+ const signResults = await withMwaAssociationRetry('login:signMessage', () => signMessageFeat.signMessage({ account, message: messageBytes }));
21605
21730
  if (!signResults || signResults.length === 0) {
21606
21731
  throw new Error('MWA returned no signature');
21607
21732
  }
@@ -22358,4 +22483,4 @@ class PrivyExpoProvider {
22358
22483
  }
22359
22484
 
22360
22485
  export { getCachedData as $, subscribe as A, useAuth as B, deserializeTransaction as C, getIdToken as D, setPlatform as E, getPlatform as F, PrivyWalletProvider as G, DEFAULT_TEST_ADDRESS as H, isMobileWalletAvailable as I, registerMobileWalletAdapter as J, PrivyExpoProvider as K, InsufficientBalanceError as L, MockAuthProvider as M, ServerSessionManager as N, OffchainAuthProvider as O, PhantomWalletProvider as P, buildSetDocumentsTransaction as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, clearCache as T, closeAllSubscriptions as U, convertRemainingAccounts as V, WebSessionManager as W, createSessionWithPrivy as X, createSessionWithSignature as Y, genAuthNonce as Z, genSolanaMessage as _, base58 as a, getMany as a0, reconnectWithNewAuth as a1, refreshSession as a2, signSessionCreateMessage as a3, bufferExports as b, getCurrentUser as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getDefaultExportFromCjs$1 as g, getConfig as h, init as i, getAuthProvider as j, get as k, login as l, setMany as m, setFile as n, onAuthStateChanged as o, getFiles as p, runQueryMany as q, runQuery as r, set as s, runExpression as t, runExpressionMany as u, signMessage as v, signTransaction as w, signAndSubmitTransaction as x, count as y, aggregate as z };
22361
- //# sourceMappingURL=index-ZKzq5QT_.esm.js.map
22486
+ //# sourceMappingURL=index-QukWgaIi.esm.js.map