@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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DlyeWzMk.js');
4
- var index_native = require('./index.native-BGaUOX9f.js');
3
+ var index = require('./index-DyRIXw-l.js');
4
+ var index_native = require('./index.native-ANhb4jEB.js');
5
5
  var web3_js = require('@solana/web3.js');
6
6
  var anchor = require('@coral-xyz/anchor');
7
7
  require('axios');
@@ -29,6 +29,110 @@ var anchor__namespace = /*#__PURE__*/_interopNamespaceDefault(anchor);
29
29
  const ED25519_SIGNATURE_LENGTH = 64;
30
30
  const STORED_AUTH_METHOD_KEY = 'tarobase_last_auth_method';
31
31
  const MWA_AUTH_METHOD = 'mobile-wallet-adapter';
32
+ function findMwaError(e, maxDepth = 5) {
33
+ var _a;
34
+ let cur = e;
35
+ let depth = 0;
36
+ while (cur && depth < maxDepth) {
37
+ if ((cur === null || cur === void 0 ? void 0 : cur.name) === 'SolanaMobileWalletAdapterError' && typeof (cur === null || cur === void 0 ? void 0 : cur.code) === 'string') {
38
+ return { code: cur.code, message: String((_a = cur.message) !== null && _a !== void 0 ? _a : '') };
39
+ }
40
+ cur = cur === null || cur === void 0 ? void 0 : cur.cause;
41
+ depth++;
42
+ }
43
+ return null;
44
+ }
45
+ /**
46
+ * Returns the matched MwaErrorInfo when the error is from an association
47
+ * failure that an automatic retry can recover from (i.e. the wallet exists
48
+ * on-device but the dApp's protocol session didn't complete in time). Returns
49
+ * null for non-retryable errors (user cancel, unknown wallet errors, etc.).
50
+ *
51
+ * Specifically:
52
+ * - ERROR_WALLET_NOT_FOUND: thrown from the protocol's startScenario when
53
+ * it gave up waiting for a wallet to respond. On Seeker this races the
54
+ * first-time-consent UI on the very first authorize.
55
+ * - ERROR_SESSION_TIMEOUT: similar — the protocol's session-establishment
56
+ * timer expired.
57
+ * - ERROR_ASSOCIATION_CANCELLED: shared by user-cancel ("Wallet connection
58
+ * cancelled by user") AND the 30s wallet-standard WALLET_ASSOCIATION_TIMEOUT
59
+ * ("Wallet connection timed out"). Discriminate by message — never retry
60
+ * a user cancel.
61
+ */
62
+ function isMwaAssociationRetryable(e) {
63
+ const info = findMwaError(e);
64
+ if (!info)
65
+ return null;
66
+ if (info.code === 'ERROR_WALLET_NOT_FOUND')
67
+ return info;
68
+ if (info.code === 'ERROR_SESSION_TIMEOUT')
69
+ return info;
70
+ if (info.code === 'ERROR_ASSOCIATION_CANCELLED' && /timed out/i.test(info.message))
71
+ return info;
72
+ return null;
73
+ }
74
+ /**
75
+ * Single-retry wrapper for MWA association failures. Used ONLY for login's
76
+ * `standard:connect` and `solana:signMessage` calls — never for
77
+ * `signAndSendTransaction`/`runTransaction` because retry on a path that
78
+ * may have already submitted a tx can double-send.
79
+ *
80
+ * The retry exists for one specific scenario: on first-time MWA usage from a
81
+ * given origin on Seeker, the protocol's session-establishment timer races
82
+ * Seeker's first-time consent UI. The user reads the consent sheet, taps
83
+ * Connect — but by then the protocol has given up and thrown
84
+ * ERROR_WALLET_NOT_FOUND. The consent itself IS persisted on Seeker though,
85
+ * so a second attempt skips the consent sheet, jumps straight to
86
+ * Verify/Approve, and completes inside the timeout.
87
+ */
88
+ async function withMwaAssociationRetry(label, fn) {
89
+ const t0 = Date.now();
90
+ console.log(`[MWA-DEBUG] ${label} attempt=1 start`);
91
+ try {
92
+ const result = await fn();
93
+ console.log(`[MWA-DEBUG] ${label} attempt=1 ok (${Date.now() - t0}ms)`);
94
+ return result;
95
+ }
96
+ catch (e) {
97
+ const info = findMwaError(e);
98
+ console.log(`[MWA-DEBUG] ${label} attempt=1 err (${Date.now() - t0}ms)`, {
99
+ outer: { name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message },
100
+ mwa: info,
101
+ });
102
+ const retryable = isMwaAssociationRetryable(e);
103
+ if (!retryable)
104
+ throw e;
105
+ // Seeker's consent sheet is a bottom-sheet overlay — Chrome doesn't
106
+ // reliably flip document.visibilityState to 'hidden' while it's open,
107
+ // so visibility-based waits fire too early. Use a fixed delay long
108
+ // enough for Seeker to dismiss its sheet and the OS to release intent
109
+ // state. 2.5s is empirically safe; tune from device traces if needed.
110
+ console.log(`[MWA-DEBUG] ${label} retryable (${retryable.code}); waiting 2500ms before retry`);
111
+ await new Promise(r => setTimeout(r, 2500));
112
+ const t1 = Date.now();
113
+ console.log(`[MWA-DEBUG] ${label} attempt=2 start`);
114
+ try {
115
+ const result = await fn();
116
+ console.log(`[MWA-DEBUG] ${label} attempt=2 ok (${Date.now() - t1}ms)`);
117
+ return result;
118
+ }
119
+ catch (e2) {
120
+ const info2 = findMwaError(e2);
121
+ console.log(`[MWA-DEBUG] ${label} attempt=2 err (${Date.now() - t1}ms)`, {
122
+ outer: { name: e2 === null || e2 === void 0 ? void 0 : e2.name, message: e2 === null || e2 === void 0 ? void 0 : e2.message },
123
+ mwa: info2,
124
+ });
125
+ // Only mask the error with the clean Seeker message when the
126
+ // second failure is also an association-flavored error. If it's
127
+ // a user cancel, wallet rejection, or unknown error, rethrow
128
+ // the original so the host app surfaces the real cause.
129
+ if (isMwaAssociationRetryable(e2)) {
130
+ throw new Error("Couldn't connect to your Seeker wallet. Please try again.");
131
+ }
132
+ throw e2;
133
+ }
134
+ }
135
+ }
32
136
  /**
33
137
  * Normalize a chain string to a wallet-standard Solana chain identifier.
34
138
  *
@@ -214,14 +318,22 @@ class SolanaMobileWalletProvider {
214
318
  async ensureWallet() {
215
319
  if (this.wallet)
216
320
  return this.wallet;
217
- const mod = await Promise.resolve().then(function () { return require('./index.browser-BQSN-6X2.js'); });
321
+ const mod = await Promise.resolve().then(function () { return require('./index.browser-DZtZWdul.js'); });
218
322
  const chain = mapChainToWalletStandard(this.cluster);
219
323
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
220
324
  appIdentity: this.appIdentity,
221
325
  authorizationCache: mod.createDefaultAuthorizationCache(),
222
326
  chains: [chain],
223
327
  chainSelector: mod.createDefaultChainSelector(),
224
- onWalletNotFound: mod.createDefaultWalletNotFoundHandler(),
328
+ // Suppress the default "We can't find a wallet" modal — that
329
+ // modal is misleading when ERROR_WALLET_NOT_FOUND fires during
330
+ // a first-time-consent race on Seeker (the wallet IS installed,
331
+ // the protocol just gave up before the user finished consenting).
332
+ // login()'s withMwaAssociationRetry handles this case; on second
333
+ // failure it surfaces a clean error message to the host app.
334
+ onWalletNotFound: async () => {
335
+ console.warn('[MWA-DEBUG] ensureWallet onWalletNotFound (suppressed)');
336
+ },
225
337
  });
226
338
  return this.wallet;
227
339
  }
@@ -286,8 +398,15 @@ class SolanaMobileWalletProvider {
286
398
  // is where wallet-standard's checkLocalNetworkAccessPermission()
287
399
  // fires the three-stage LNA UX (info modal → permission prompt →
288
400
  // success modal) before opening the localhost WebSocket.
401
+ //
402
+ // Wrap with single-retry: on a Seeker origin's first MWA usage,
403
+ // the protocol's session-establishment timer often races Seeker's
404
+ // first-time consent UI and throws ERROR_WALLET_NOT_FOUND before
405
+ // the user finishes tapping. The retry hits Seeker's cached
406
+ // consent on the second pass and completes quickly. See
407
+ // withMwaAssociationRetry for details.
289
408
  const connectFeat = getConnectFeature(wallet);
290
- const { accounts } = await connectFeat.connect();
409
+ const { accounts } = await withMwaAssociationRetry('login:connect', () => connectFeat.connect());
291
410
  if (!accounts || accounts.length === 0) {
292
411
  throw new Error('MWA returned no accounts');
293
412
  }
@@ -301,11 +420,14 @@ class SolanaMobileWalletProvider {
301
420
  index_native.setCurrentUser(user);
302
421
  return user;
303
422
  }
304
- // Wallet popup #2: sign the Tarobase nonce message.
423
+ // Wallet popup #2: sign the Tarobase nonce message. Wrap with the
424
+ // same retry for defense in depth — by now Seeker has cached the
425
+ // consent so this rarely hits the retry path, but if the
426
+ // protocol's session timer fires here too we recover transparently.
305
427
  const messageText = await index_native.genSolanaMessage(base58Addr, nonce);
306
428
  const messageBytes = index_native.getPlatform().textEncode(messageText);
307
429
  const signMessageFeat = getSignMessageFeature(wallet);
308
- const signResults = await signMessageFeat.signMessage({ account, message: messageBytes });
430
+ const signResults = await withMwaAssociationRetry('login:signMessage', () => signMessageFeat.signMessage({ account, message: messageBytes }));
309
431
  if (!signResults || signResults.length === 0) {
310
432
  throw new Error('MWA returned no signature');
311
433
  }
@@ -716,4 +838,4 @@ class SolanaMobileWalletProvider {
716
838
  SolanaMobileWalletProvider.instance = null;
717
839
 
718
840
  exports.SolanaMobileWalletProvider = SolanaMobileWalletProvider;
719
- //# sourceMappingURL=solana-mobile-wallet-provider-BM9wdF0m.js.map
841
+ //# sourceMappingURL=solana-mobile-wallet-provider-S8yWHG6i.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana-mobile-wallet-provider-S8yWHG6i.js","sources":["../.rollup-tmp/auth/providers/solana-mobile-wallet-provider.js"],"sourcesContent":["import { Buffer } from 'buffer';\nimport { WebSessionManager as SessionManager, createSessionWithSignature, genAuthNonce, genSolanaMessage, buildSetDocumentsTransaction, convertRemainingAccounts } from '@pooflabs/core';\nimport { setCurrentUser, setAuthLoading } from '../../global';\nimport { getPlatform, detectAndroid } from '../../platform';\nimport { Connection, PublicKey, Transaction, VersionedMessage, VersionedTransaction } from '@solana/web3.js';\nimport * as anchor from '@coral-xyz/anchor';\nimport bs58 from 'bs58';\nimport { SOLANA_DEVNET_RPC_URL, SOLANA_MAINNET_RPC_URL, SURFNET_RPC_URL } from '..';\nimport { confirmAndCheckTransaction } from './transaction-utils';\n/**\n * Detects whether the current environment is a mobile browser capable of\n * Mobile Wallet Adapter (MWA) communication.\n *\n * Returns true on Android browsers (Chrome, etc.) where MWA intents work,\n * or inside a Seeker/Saga in-app browser context.\n */\nexport function isMobileWalletAvailable() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined')\n return false;\n return detectAndroid();\n}\nconst ED25519_SIGNATURE_LENGTH = 64;\nconst STORED_AUTH_METHOD_KEY = 'tarobase_last_auth_method';\nconst MWA_AUTH_METHOD = 'mobile-wallet-adapter';\nfunction findMwaError(e, maxDepth = 5) {\n var _a;\n let cur = e;\n let depth = 0;\n while (cur && depth < maxDepth) {\n if ((cur === null || cur === void 0 ? void 0 : cur.name) === 'SolanaMobileWalletAdapterError' && typeof (cur === null || cur === void 0 ? void 0 : cur.code) === 'string') {\n return { code: cur.code, message: String((_a = cur.message) !== null && _a !== void 0 ? _a : '') };\n }\n cur = cur === null || cur === void 0 ? void 0 : cur.cause;\n depth++;\n }\n return null;\n}\n/**\n * Returns the matched MwaErrorInfo when the error is from an association\n * failure that an automatic retry can recover from (i.e. the wallet exists\n * on-device but the dApp's protocol session didn't complete in time). Returns\n * null for non-retryable errors (user cancel, unknown wallet errors, etc.).\n *\n * Specifically:\n * - ERROR_WALLET_NOT_FOUND: thrown from the protocol's startScenario when\n * it gave up waiting for a wallet to respond. On Seeker this races the\n * first-time-consent UI on the very first authorize.\n * - ERROR_SESSION_TIMEOUT: similar — the protocol's session-establishment\n * timer expired.\n * - ERROR_ASSOCIATION_CANCELLED: shared by user-cancel (\"Wallet connection\n * cancelled by user\") AND the 30s wallet-standard WALLET_ASSOCIATION_TIMEOUT\n * (\"Wallet connection timed out\"). Discriminate by message — never retry\n * a user cancel.\n */\nfunction isMwaAssociationRetryable(e) {\n const info = findMwaError(e);\n if (!info)\n return null;\n if (info.code === 'ERROR_WALLET_NOT_FOUND')\n return info;\n if (info.code === 'ERROR_SESSION_TIMEOUT')\n return info;\n if (info.code === 'ERROR_ASSOCIATION_CANCELLED' && /timed out/i.test(info.message))\n return info;\n return null;\n}\n/**\n * Single-retry wrapper for MWA association failures. Used ONLY for login's\n * `standard:connect` and `solana:signMessage` calls — never for\n * `signAndSendTransaction`/`runTransaction` because retry on a path that\n * may have already submitted a tx can double-send.\n *\n * The retry exists for one specific scenario: on first-time MWA usage from a\n * given origin on Seeker, the protocol's session-establishment timer races\n * Seeker's first-time consent UI. The user reads the consent sheet, taps\n * Connect — but by then the protocol has given up and thrown\n * ERROR_WALLET_NOT_FOUND. The consent itself IS persisted on Seeker though,\n * so a second attempt skips the consent sheet, jumps straight to\n * Verify/Approve, and completes inside the timeout.\n */\nasync function withMwaAssociationRetry(label, fn) {\n const t0 = Date.now();\n console.log(`[MWA-DEBUG] ${label} attempt=1 start`);\n try {\n const result = await fn();\n console.log(`[MWA-DEBUG] ${label} attempt=1 ok (${Date.now() - t0}ms)`);\n return result;\n }\n catch (e) {\n const info = findMwaError(e);\n console.log(`[MWA-DEBUG] ${label} attempt=1 err (${Date.now() - t0}ms)`, {\n outer: { name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message },\n mwa: info,\n });\n const retryable = isMwaAssociationRetryable(e);\n if (!retryable)\n throw e;\n // Seeker's consent sheet is a bottom-sheet overlay — Chrome doesn't\n // reliably flip document.visibilityState to 'hidden' while it's open,\n // so visibility-based waits fire too early. Use a fixed delay long\n // enough for Seeker to dismiss its sheet and the OS to release intent\n // state. 2.5s is empirically safe; tune from device traces if needed.\n console.log(`[MWA-DEBUG] ${label} retryable (${retryable.code}); waiting 2500ms before retry`);\n await new Promise(r => setTimeout(r, 2500));\n const t1 = Date.now();\n console.log(`[MWA-DEBUG] ${label} attempt=2 start`);\n try {\n const result = await fn();\n console.log(`[MWA-DEBUG] ${label} attempt=2 ok (${Date.now() - t1}ms)`);\n return result;\n }\n catch (e2) {\n const info2 = findMwaError(e2);\n console.log(`[MWA-DEBUG] ${label} attempt=2 err (${Date.now() - t1}ms)`, {\n outer: { name: e2 === null || e2 === void 0 ? void 0 : e2.name, message: e2 === null || e2 === void 0 ? void 0 : e2.message },\n mwa: info2,\n });\n // Only mask the error with the clean Seeker message when the\n // second failure is also an association-flavored error. If it's\n // a user cancel, wallet rejection, or unknown error, rethrow\n // the original so the host app surfaces the real cause.\n if (isMwaAssociationRetryable(e2)) {\n throw new Error(\"Couldn't connect to your Seeker wallet. Please try again.\");\n }\n throw e2;\n }\n }\n}\n/**\n * Normalize a chain string to a wallet-standard Solana chain identifier.\n *\n * Handles three input shapes that all show up in practice:\n * - Bare cluster name from `SolanaMobileWalletConfig.cluster` (e.g. 'devnet').\n * - Prefixed `solana:cluster` (e.g. 'solana:devnet').\n * - Double-prefixed `solana:solana:cluster` (constructor used to wrap cluster\n * with `solana:` blindly; if a caller already passed a prefixed string the\n * result was `solana:solana:devnet`).\n *\n * Wallet-standard Solana chains are exactly:\n * 'solana:mainnet' | 'solana:devnet' | 'solana:testnet' | 'solana:localnet'\n * — `mainnet-beta` is NOT a valid wallet-standard identifier and must be\n * normalized to `solana:mainnet`.\n */\nfunction mapChainToWalletStandard(input) {\n if (!input)\n return 'solana:mainnet';\n let s = String(input).toLowerCase();\n while (s.startsWith('solana:'))\n s = s.slice('solana:'.length);\n if (s === 'mainnet-beta' || s === 'mainnet')\n return 'solana:mainnet';\n if (s === 'devnet')\n return 'solana:devnet';\n if (s === 'testnet')\n return 'solana:testnet';\n if (s === 'localnet')\n return 'solana:localnet';\n return 'solana:mainnet';\n}\n/**\n * Serialize a Transaction/VersionedTransaction to a Uint8Array wire payload\n * that the wallet-standard `solana:signTransaction` /\n * `solana:signAndSendTransaction` features expect.\n *\n * Legacy transactions must serialize with `requireAllSignatures: false` and\n * `verifySignatures: false` — the wallet hasn't signed yet, and the default\n * `serialize()` would throw \"Signature verification failed\". Versioned\n * transactions use the default `serialize()` which already permits unsigned\n * payloads. Mirrors the helper at\n * `@solana-mobile/mobile-wallet-adapter-protocol-web3js/lib/esm/index.browser.js:13-18`.\n */\nfunction txToWireBytes(tx) {\n if ('version' in tx)\n return tx.serialize();\n return tx.serialize({ requireAllSignatures: false, verifySignatures: false });\n}\n/**\n * Deserialize a wire-format transaction returned by the wallet\n * `solana:signTransaction` feature. Mirrors the helper at\n * `@solana-mobile/mobile-wallet-adapter-protocol-web3js/lib/esm/index.browser.js:19-23`\n * so legacy and versioned bytes both round-trip correctly.\n */\nfunction txFromWireBytes(byteArray) {\n const messageOffset = byteArray[0] * ED25519_SIGNATURE_LENGTH + 1;\n const messageVersion = VersionedMessage.deserializeMessageVersion(byteArray.slice(messageOffset, byteArray.length));\n if (messageVersion === 'legacy') {\n return Transaction.from(byteArray);\n }\n return VersionedTransaction.deserialize(byteArray);\n}\n/**\n * Per-method runtime narrowing of wallet-standard features. The wallet's\n * `.features` type is a union (`signAndSendTransaction` | `signTransaction`),\n * and after authorization the wallet may also narrow `#optionalFeatures`\n * based on actual wallet capabilities. Narrow at the call site so a method\n * that needs only `signMessage` doesn't fail when a wallet lacks\n * `signTransaction`.\n */\nfunction getSignMessageFeature(wallet) {\n const f = wallet.features;\n const feat = f['solana:signMessage'];\n if (!feat || typeof feat.signMessage !== 'function') {\n throw new Error('Wallet does not support solana:signMessage');\n }\n return feat;\n}\nfunction getSignTransactionFeature(wallet) {\n const f = wallet.features;\n const feat = f['solana:signTransaction'];\n if (!feat || typeof feat.signTransaction !== 'function') {\n throw new Error('Wallet does not support solana:signTransaction');\n }\n return feat;\n}\nfunction getSignAndSendTransactionFeature(wallet) {\n const f = wallet.features;\n const feat = f['solana:signAndSendTransaction'];\n if (!feat || typeof feat.signAndSendTransaction !== 'function') {\n throw new Error('Wallet does not support solana:signAndSendTransaction');\n }\n return feat;\n}\nfunction getConnectFeature(wallet) {\n const f = wallet.features;\n const feat = f['standard:connect'];\n if (!feat || typeof feat.connect !== 'function') {\n throw new Error('Wallet does not support standard:connect');\n }\n return feat;\n}\nfunction getDisconnectFeature(wallet) {\n const f = wallet.features;\n const feat = f['standard:disconnect'];\n return feat && typeof feat.disconnect === 'function' ? feat : null;\n}\nfunction writeAuthMethod(method) {\n try {\n if (method === null) {\n getPlatform().storage.removeItem(STORED_AUTH_METHOD_KEY);\n }\n else {\n getPlatform().storage.setItem(STORED_AUTH_METHOD_KEY, method);\n }\n }\n catch (_a) {\n // storage may be unavailable\n }\n}\nfunction readAuthMethod() {\n try {\n return getPlatform().storage.getItem(STORED_AUTH_METHOD_KEY);\n }\n catch (_a) {\n return null;\n }\n}\n/**\n * Registers Mobile Wallet Adapter as a wallet-standard wallet so it appears\n * in wallet selection UIs and can be discovered by other wallet-standard consumers.\n *\n * Call this once at app startup (in a browser-only / non-SSR context).\n *\n * @param config - App identity and optional remote host authority for desktop QR code support\n */\nexport async function registerMobileWalletAdapter(config) {\n var _a, _b;\n if (typeof window === 'undefined')\n return;\n try {\n const walletStandardMobile = await import('@solana-mobile/wallet-standard-mobile');\n const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);\n if (!registerMwa) {\n console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');\n return;\n }\n const options = {};\n if (config === null || config === void 0 ? void 0 : config.appIdentity) {\n options.appIdentity = config.appIdentity;\n }\n if (config === null || config === void 0 ? void 0 : config.chains) {\n options.chains = config.chains;\n }\n if (config === null || config === void 0 ? void 0 : config.remoteHostAuthority) {\n options.remoteHostAuthority = config.remoteHostAuthority;\n }\n // Use the library's default helpers if available\n if (walletStandardMobile.createDefaultAuthorizationCache) {\n options.authorizationCache = walletStandardMobile.createDefaultAuthorizationCache();\n }\n if (walletStandardMobile.createDefaultChainSelector) {\n options.chainSelector = walletStandardMobile.createDefaultChainSelector();\n }\n // Default: suppress the \"We can't find a wallet\" modal — see\n // SolanaMobileWalletProvider.ensureWallet() for why. Consumers that\n // want their own UX can pass config.onWalletNotFound.\n options.onWalletNotFound = (_b = config === null || config === void 0 ? void 0 : config.onWalletNotFound) !== null && _b !== void 0 ? _b : (async () => {\n console.warn('[MWA-DEBUG] registerMobileWalletAdapter onWalletNotFound (suppressed)');\n });\n registerMwa(options);\n }\n catch (e) {\n console.debug('[SolanaMobileWallet] @solana-mobile/wallet-standard-mobile not available, skipping wallet-standard registration');\n }\n}\n/**\n * SolanaMobileWalletProvider implements the AuthProvider interface using\n * Solana Mobile's wallet-standard wrapper (`LocalSolanaMobileWalletAdapterWallet`).\n *\n * Why wallet-standard and not the raw MWA protocol: as of\n * `@solana-mobile/wallet-standard-mobile@0.5.0+`, the wallet's internal\n * `#transact` calls `checkLocalNetworkAccessPermission()` before opening the\n * localhost WebSocket. That helper renders a three-stage UX flow Solana\n * Mobile designed specifically to defuse Chrome's Local Network Access\n * permission dialog (which renders with disabled buttons on Android Chrome,\n * the source of the long-running Seeker MWA bug):\n *\n * 1. \"Allow connections to your wallet\" informational modal.\n * 2. Chrome's permission prompt (interactive because it's spawned as a\n * fresh user gesture from step 1).\n * 3. \"Ready to connect!\" success modal.\n *\n * `checkLocalNetworkAccessPermission` is internal to the library — it's not\n * exported. The only way to invoke it is to go through the wallet's\n * `standard:connect` / `solana:sign*` features, which is what this provider\n * does.\n *\n * Notes on UX: login uses two wallet popups in succession — `standard:connect`\n * (authorize) and `solana:signMessage` (sign the Tarobase nonce). The\n * previous implementation combined both inside a single `transact` callback;\n * splitting them is the cost of going through wallet-standard, and is\n * acceptable given the alternative was broken on Seeker.\n */\nexport class SolanaMobileWalletProvider {\n constructor(networkUrl = null, config = {}) {\n /** LocalSolanaMobileWalletAdapterWallet, lazy-constructed in ensureWallet(). */\n this.wallet = null;\n this.networkUrl = networkUrl;\n this.config = config;\n if (typeof window === 'undefined') {\n throw new Error('SolanaMobileWalletProvider can only be instantiated in a browser environment');\n }\n if (SolanaMobileWalletProvider.instance) {\n return SolanaMobileWalletProvider.instance;\n }\n this.appIdentity = config.appIdentity || {\n name: 'TaroBase App',\n uri: getPlatform().getLocationOrigin(),\n };\n this.cluster = config.cluster || 'mainnet-beta';\n SolanaMobileWalletProvider.instance = this;\n }\n static getInstance(networkUrl, config) {\n if (!SolanaMobileWalletProvider.instance) {\n new SolanaMobileWalletProvider(networkUrl, config);\n }\n return SolanaMobileWalletProvider.instance;\n }\n /** Lazy-construct LocalSolanaMobileWalletAdapterWallet on first need. */\n async ensureWallet() {\n if (this.wallet)\n return this.wallet;\n const mod = await import('@solana-mobile/wallet-standard-mobile');\n const chain = mapChainToWalletStandard(this.cluster);\n this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({\n appIdentity: this.appIdentity,\n authorizationCache: mod.createDefaultAuthorizationCache(),\n chains: [chain],\n chainSelector: mod.createDefaultChainSelector(),\n // Suppress the default \"We can't find a wallet\" modal — that\n // modal is misleading when ERROR_WALLET_NOT_FOUND fires during\n // a first-time-consent race on Seeker (the wallet IS installed,\n // the protocol just gave up before the user finished consenting).\n // login()'s withMwaAssociationRetry handles this case; on second\n // failure it surfaces a clean error message to the host app.\n onWalletNotFound: async () => {\n console.warn('[MWA-DEBUG] ensureWallet onWalletNotFound (suppressed)');\n },\n });\n return this.wallet;\n }\n /**\n * Ensure the wallet has an active authorization. After a Tarobase session\n * is restored from storage on cold-start, `wallet.accounts` is empty until\n * we silently reconnect from the AuthorizationCache. If the cache is also\n * empty, fall back to interactive `login()` (which surfaces the three-stage\n * Solana Mobile LNA flow + wallet popups).\n *\n * Returns the wallet-standard `WalletAccount` to use for sign operations.\n */\n async ensureAuthorized() {\n const wallet = await this.ensureWallet();\n if (wallet.accounts.length === 0) {\n try {\n const connectFeat = getConnectFeature(wallet);\n await connectFeat.connect({ silent: true });\n }\n catch (e) {\n console.warn('[SolanaMobileWallet] silent connect failed:', e === null || e === void 0 ? void 0 : e.message);\n }\n }\n if (wallet.accounts.length === 0) {\n const user = await this.login();\n if (!user)\n throw new Error('MWA not connected');\n }\n return wallet.accounts[0];\n }\n /** Returns the active wallet-standard chain identifier (e.g. 'solana:mainnet'). */\n getChain() {\n return mapChainToWalletStandard(this.cluster);\n }\n async login() {\n var _a, _b, _c, _d, _e;\n setAuthLoading(true);\n // Mark the auth method early so a concurrent Phantom auto-create-session\n // effect (see phantom-wallet-provider) sees 'mobile-wallet-adapter'\n // during our slow connect/sign roundtrip and backs off. Capture the\n // previous value so we can restore it if login fails.\n const prevAuthMethod = readAuthMethod();\n writeAuthMethod(MWA_AUTH_METHOD);\n try {\n const wallet = await this.ensureWallet();\n // Quick-check: wallet may already have authorization (e.g. from a\n // previous in-page login) and a matching Tarobase session — skip\n // popups in that case.\n if (wallet.accounts.length > 0) {\n const accountPubkey = new PublicKey(wallet.accounts[0].publicKey);\n const base58Addr = accountPubkey.toBase58();\n const existingSession = await SessionManager.getSession();\n if (existingSession && existingSession.address === base58Addr) {\n const user = { provider: this, address: base58Addr };\n setCurrentUser(user);\n return user;\n }\n }\n // Pre-fetch nonce while the wallet popup is not yet open.\n const nonce = await genAuthNonce();\n // Wallet popup #1: standard:connect performs MWA authorize. This\n // is where wallet-standard's checkLocalNetworkAccessPermission()\n // fires the three-stage LNA UX (info modal → permission prompt →\n // success modal) before opening the localhost WebSocket.\n //\n // Wrap with single-retry: on a Seeker origin's first MWA usage,\n // the protocol's session-establishment timer often races Seeker's\n // first-time consent UI and throws ERROR_WALLET_NOT_FOUND before\n // the user finishes tapping. The retry hits Seeker's cached\n // consent on the second pass and completes quickly. See\n // withMwaAssociationRetry for details.\n const connectFeat = getConnectFeature(wallet);\n const { accounts } = await withMwaAssociationRetry('login:connect', () => connectFeat.connect());\n if (!accounts || accounts.length === 0) {\n throw new Error('MWA returned no accounts');\n }\n const account = accounts[0];\n const accountPubkey = new PublicKey(account.publicKey);\n const base58Addr = accountPubkey.toBase58();\n // If we happen to already have a matching Tarobase session, reuse it.\n const existingSession = await SessionManager.getSession();\n if (existingSession && existingSession.address === base58Addr) {\n const user = { provider: this, address: base58Addr };\n setCurrentUser(user);\n return user;\n }\n // Wallet popup #2: sign the Tarobase nonce message. Wrap with the\n // same retry for defense in depth — by now Seeker has cached the\n // consent so this rarely hits the retry path, but if the\n // protocol's session timer fires here too we recover transparently.\n const messageText = await genSolanaMessage(base58Addr, nonce);\n const messageBytes = getPlatform().textEncode(messageText);\n const signMessageFeat = getSignMessageFeature(wallet);\n const signResults = await withMwaAssociationRetry('login:signMessage', () => signMessageFeat.signMessage({ account, message: messageBytes }));\n if (!signResults || signResults.length === 0) {\n throw new Error('MWA returned no signature');\n }\n const { signature: sigBytes } = signResults[0];\n const signatureBase64 = Buffer.from(sigBytes).toString('base64');\n // Create Tarobase session on the server.\n const createSessionResult = await createSessionWithSignature(base58Addr, messageText, signatureBase64);\n await SessionManager.storeSession(base58Addr, createSessionResult.accessToken, createSessionResult.idToken, createSessionResult.refreshToken);\n // Auth-method marker is already 'mobile-wallet-adapter' from above.\n const user = { provider: this, address: base58Addr };\n setCurrentUser(user);\n return user;\n }\n catch (error) {\n // Restore the previous auth-method marker since this login attempt failed.\n writeAuthMethod(prevAuthMethod);\n const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||\n ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||\n ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||\n ((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes('user cancelled')) ||\n ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes('user canceled')) ||\n ((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('user declined'));\n if (!isUserRejection) {\n console.error('[SolanaMobileWallet] Login failed:', error);\n }\n throw error;\n }\n finally {\n setAuthLoading(false);\n }\n }\n async restoreSession() {\n const session = await SessionManager.getSession();\n if (session) {\n return { provider: this, address: session.address };\n }\n return null;\n }\n async logout() {\n try {\n const wallet = await this.ensureWallet();\n const disconnectFeat = getDisconnectFeature(wallet);\n if (disconnectFeat) {\n // Disconnect clears the AuthorizationCache and resets\n // wallet.#authorization internally (no LNA dialog).\n await disconnectFeat.disconnect();\n }\n }\n catch (error) {\n console.error('[SolanaMobileWallet] Disconnect error:', error);\n }\n SessionManager.clearSession();\n // Clear the auth-method marker so Phantom auto-create is unblocked\n // for any subsequent fresh login on this device.\n writeAuthMethod(null);\n setCurrentUser(null);\n }\n async signMessage(message) {\n var _a, _b;\n const account = await this.ensureAuthorized();\n const wallet = await this.ensureWallet();\n try {\n const signMessageFeat = getSignMessageFeature(wallet);\n const messageBytes = getPlatform().textEncode(message);\n const results = await signMessageFeat.signMessage({ account, message: messageBytes });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signature');\n }\n const { signature: sigBytes } = results[0];\n return Buffer.from(sigBytes).toString('base64');\n }\n catch (error) {\n if (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('not connected')) || ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('not authorized')) ||\n (error === null || error === void 0 ? void 0 : error.code) === 'ERROR_AUTHORIZATION_FAILED') {\n await this.logout();\n throw new Error('Wallet connection lost. Please reconnect.');\n }\n throw new Error(`Failed to sign message: ${error.message}`);\n }\n }\n async signTransaction(transaction) {\n var _a, _b;\n const account = await this.ensureAuthorized();\n const connectedPubkey = new PublicKey(account.publicKey);\n const wallet = await this.ensureWallet();\n const chain = this.getChain();\n // Preserve existing prep: fill missing blockhash / fee payer so call\n // sites that build a tx without these fields don't regress.\n const isLegacyTransaction = 'recentBlockhash' in transaction && !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacyTransaction) {\n const legacyTx = transaction;\n if (!legacyTx.recentBlockhash) {\n const conn = new Connection(this.getRpcUrl(), 'confirmed');\n const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash('confirmed');\n legacyTx.recentBlockhash = blockhash;\n legacyTx.lastValidBlockHeight = lastValidBlockHeight;\n }\n if (!legacyTx.feePayer) {\n legacyTx.feePayer = connectedPubkey;\n }\n }\n else {\n const versionedTx = transaction;\n if (!versionedTx.message.recentBlockhash) {\n const conn = new Connection(this.getRpcUrl(), 'confirmed');\n const { blockhash } = await conn.getLatestBlockhash('confirmed');\n versionedTx.message.recentBlockhash = blockhash;\n }\n }\n try {\n const signTxFeat = getSignTransactionFeature(wallet);\n const wireBytes = txToWireBytes(transaction);\n const results = await signTxFeat.signTransaction({ account, transaction: wireBytes, chain });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signed transaction');\n }\n const { signedTransaction: signedBytes } = results[0];\n return txFromWireBytes(new Uint8Array(signedBytes));\n }\n catch (error) {\n if (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('not connected')) || ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('not authorized')) ||\n (error === null || error === void 0 ? void 0 : error.code) === 'ERROR_AUTHORIZATION_FAILED') {\n await this.logout();\n throw new Error('Wallet connection lost. Please reconnect.');\n }\n throw new Error(`Failed to sign transaction: ${error.message}`);\n }\n }\n async signAndSubmitTransaction(transaction, feePayer) {\n var _a, _b, _c, _d, _e, _f;\n const account = await this.ensureAuthorized();\n const connectedPubkey = new PublicKey(account.publicKey);\n const wallet = await this.ensureWallet();\n const chain = this.getChain();\n const rpcUrl = this.getRpcUrl();\n const connection = new Connection(rpcUrl, 'confirmed');\n const isSurfnet = rpcUrl === SURFNET_RPC_URL;\n try {\n // Preserve existing prep: refresh blockhash and set fee payer.\n const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');\n const isLegacyTransaction = 'recentBlockhash' in transaction && !('message' in transaction && 'staticAccountKeys' in transaction.message);\n if (isLegacyTransaction) {\n const legacyTx = transaction;\n legacyTx.recentBlockhash = blockhash;\n legacyTx.lastValidBlockHeight = lastValidBlockHeight;\n if (!legacyTx.feePayer) {\n legacyTx.feePayer = feePayer !== null && feePayer !== void 0 ? feePayer : connectedPubkey;\n }\n }\n else {\n const versionedTx = transaction;\n versionedTx.message.recentBlockhash = blockhash;\n }\n if (isSurfnet) {\n // Surfnet: sign locally via wallet-standard, submit manually\n // to the Surfnet RPC. Don't route through signAndSendTransaction\n // because the wallet would submit to its own RPC.\n const signTxFeat = getSignTransactionFeature(wallet);\n const wireBytes = txToWireBytes(transaction);\n const results = await signTxFeat.signTransaction({ account, transaction: wireBytes, chain });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signed transaction');\n }\n const { signedTransaction: signedBytes } = results[0];\n const signedTx = txFromWireBytes(new Uint8Array(signedBytes));\n const signature = await connection.sendRawTransaction(signedTx.serialize(), {\n preflightCommitment: 'confirmed',\n });\n const confirmation = await connection.confirmTransaction({\n signature,\n blockhash,\n lastValidBlockHeight,\n }, 'confirmed');\n if (confirmation.value.err) {\n throw new Error(`Transaction failed: ${confirmation.value.err.toString()}`);\n }\n return signature;\n }\n // Non-Surfnet: wallet signs and submits to its own RPC.\n const signSendFeat = getSignAndSendTransactionFeature(wallet);\n const wireBytes = txToWireBytes(transaction);\n const results = await signSendFeat.signAndSendTransaction({\n account,\n transaction: wireBytes,\n chain,\n options: { commitment: 'confirmed' },\n });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signature');\n }\n const { signature: sigBytes } = results[0];\n const signature = bs58.encode(sigBytes);\n await confirmAndCheckTransaction(connection, signature);\n return signature;\n }\n catch (error) {\n if (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('not connected')) || ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('not authorized')) ||\n (error === null || error === void 0 ? void 0 : error.code) === 'ERROR_AUTHORIZATION_FAILED') {\n await this.logout();\n throw new Error('Wallet connection lost. Please reconnect.');\n }\n const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||\n ((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes('user rejected')) ||\n ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes('user denied')) ||\n ((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('user cancelled')) ||\n ((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.toLowerCase().includes('user canceled'));\n if (!isUserRejection) {\n console.error('[SolanaMobileWallet] Transaction failed:', error);\n }\n throw new Error(`Failed to execute transaction: ${error.message}`);\n }\n }\n async runTransaction(_evmTransactionData, solTransactionData, options) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (!solTransactionData) {\n throw new Error('Solana transaction data is required for mobile wallet');\n }\n const account = await this.ensureAuthorized();\n const connectedPubkey = new PublicKey(account.publicKey);\n const wallet = await this.ensureWallet();\n const chain = this.getChain();\n const rpcUrl = this.getRpcUrl(solTransactionData.network);\n const connection = new Connection(rpcUrl, 'confirmed');\n const isSurfnet = rpcUrl === SURFNET_RPC_URL;\n try {\n const remainingAccounts = convertRemainingAccounts(solTransactionData.txArgs[0].remainingAccounts);\n let app_id = solTransactionData.appId;\n if (typeof window !== 'undefined' && window.CUSTOM_TAROBASE_APP_ID_HEADER) {\n app_id = window.CUSTOM_TAROBASE_APP_ID_HEADER;\n }\n if (!app_id) {\n throw new Error('App ID is required');\n }\n // Mock wallet adapter for Anchor — only publicKey is read during build.\n const mockWalletAdapter = {\n publicKey: connectedPubkey,\n signTransaction: async (tx) => tx,\n signAllTransactions: async (txs) => txs,\n };\n const anchorProvider = new anchor.AnchorProvider(connection, mockWalletAdapter, anchor.AnchorProvider.defaultOptions());\n const finalDeduped = [];\n for (const acc of remainingAccounts) {\n const existing = finalDeduped.find((d) => d.pubkey.equals(acc.pubkey));\n if (existing) {\n existing.isSigner = existing.isSigner || acc.isSigner;\n existing.isWritable = existing.isWritable || acc.isWritable;\n }\n else {\n finalDeduped.push(acc);\n }\n }\n let tx;\n if (solTransactionData.signedTransaction) {\n // Server has co-signed a CPI attestation. Do NOT mutate its\n // blockhash — that would invalidate the server's signature.\n tx = VersionedTransaction.deserialize(Buffer.from(solTransactionData.signedTransaction, 'base64'));\n }\n else {\n const result = await buildSetDocumentsTransaction(connection, solTransactionData.txArgs[0].idl, anchorProvider, connectedPubkey, {\n app_id,\n documents: solTransactionData.txArgs[0].setDocumentData,\n delete_paths: solTransactionData.txArgs[0].deletePaths,\n txData: solTransactionData.txArgs[0].txData\n }, finalDeduped, solTransactionData.lutKey, solTransactionData.preInstructions, false, solTransactionData.additionalLutAddresses);\n tx = result.tx;\n }\n // Sign-only branch — sign the tx but don't submit.\n if ((options === null || options === void 0 ? void 0 : options.shouldSubmitTx) === false) {\n const signTxFeat = getSignTransactionFeature(wallet);\n const wireBytes = txToWireBytes(tx);\n const results = await signTxFeat.signTransaction({ account, transaction: wireBytes, chain });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signed transaction');\n }\n const { signedTransaction: signedBytes } = results[0];\n const signedTx = txFromWireBytes(new Uint8Array(signedBytes));\n return {\n signedTransaction: signedTx,\n blockNumber: 0,\n gasUsed: '0',\n data: ''\n };\n }\n if (isSurfnet) {\n // Surfnet: sign locally via wallet-standard, submit manually.\n const signTxFeat = getSignTransactionFeature(wallet);\n const wireBytes = txToWireBytes(tx);\n const results = await signTxFeat.signTransaction({ account, transaction: wireBytes, chain });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signed transaction');\n }\n const { signedTransaction: signedBytes } = results[0];\n const signedTx = txFromWireBytes(new Uint8Array(signedBytes));\n const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');\n const signature = await connection.sendRawTransaction(signedTx.serialize(), {\n preflightCommitment: 'confirmed',\n });\n const confirmation = await connection.confirmTransaction({\n signature,\n blockhash,\n lastValidBlockHeight,\n }, 'confirmed');\n if (confirmation.value.err) {\n throw new Error(`Transaction failed: ${confirmation.value.err.toString()}`);\n }\n const txInfo = await connection.getParsedTransaction(signature, {\n maxSupportedTransactionVersion: 0,\n commitment: 'confirmed',\n });\n return {\n transactionSignature: signature,\n blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,\n gasUsed: ((_a = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _a === void 0 ? void 0 : _a.fee.toString()) || '0',\n data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,\n };\n }\n // Non-Surfnet: wallet signs and submits to its own RPC.\n const signSendFeat = getSignAndSendTransactionFeature(wallet);\n const wireBytes = txToWireBytes(tx);\n const results = await signSendFeat.signAndSendTransaction({\n account,\n transaction: wireBytes,\n chain,\n options: { commitment: 'confirmed' },\n });\n if (!results || results.length === 0) {\n throw new Error('MWA returned no signature');\n }\n const { signature: sigBytes } = results[0];\n const signature = bs58.encode(sigBytes);\n const txInfo = await confirmAndCheckTransaction(connection, signature);\n return {\n transactionSignature: signature,\n blockNumber: (txInfo === null || txInfo === void 0 ? void 0 : txInfo.slot) || 0,\n gasUsed: ((_b = txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta) === null || _b === void 0 ? void 0 : _b.fee.toString()) || '0',\n data: txInfo === null || txInfo === void 0 ? void 0 : txInfo.meta,\n };\n }\n catch (error) {\n if (((_c = error === null || error === void 0 ? void 0 : error.message) === null || _c === void 0 ? void 0 : _c.includes('not connected')) || ((_d = error === null || error === void 0 ? void 0 : error.message) === null || _d === void 0 ? void 0 : _d.includes('not authorized')) ||\n (error === null || error === void 0 ? void 0 : error.code) === 'ERROR_AUTHORIZATION_FAILED') {\n await this.logout();\n throw new Error('Wallet connection lost. Please reconnect.');\n }\n const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||\n ((_e = error === null || error === void 0 ? void 0 : error.message) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('user rejected')) ||\n ((_f = error === null || error === void 0 ? void 0 : error.message) === null || _f === void 0 ? void 0 : _f.toLowerCase().includes('user denied')) ||\n ((_g = error === null || error === void 0 ? void 0 : error.message) === null || _g === void 0 ? void 0 : _g.toLowerCase().includes('user cancelled')) ||\n ((_h = error === null || error === void 0 ? void 0 : error.message) === null || _h === void 0 ? void 0 : _h.toLowerCase().includes('user canceled'));\n if (!isUserRejection) {\n console.error('[SolanaMobileWallet] Transaction failed:', error);\n }\n throw new Error(`Failed to execute transaction: ${error.message}`);\n }\n }\n async getNativeMethods() {\n var _a, _b, _c;\n // Synchronous-ish state read; tolerate the wallet being unauthorized\n // (return nulls). Don't trigger ensureAuthorized() here — callers that\n // need the wallet active should sign through one of the sign methods.\n const wallet = this.wallet;\n if (!wallet) {\n return {\n authToken: null,\n walletUriBase: null,\n publicKey: null,\n base64Address: null,\n wallet: null,\n currentAuthorization: null,\n };\n }\n const acct = (_a = wallet.accounts) === null || _a === void 0 ? void 0 : _a[0];\n const auth = wallet.currentAuthorization;\n let publicKey = null;\n let base64Address = null;\n if (acct) {\n publicKey = new PublicKey(acct.publicKey);\n base64Address = btoa(String.fromCharCode(...acct.publicKey));\n }\n return {\n authToken: (_b = auth === null || auth === void 0 ? void 0 : auth.auth_token) !== null && _b !== void 0 ? _b : null,\n walletUriBase: (_c = auth === null || auth === void 0 ? void 0 : auth.wallet_uri_base) !== null && _c !== void 0 ? _c : null,\n publicKey,\n base64Address,\n wallet,\n currentAuthorization: auth !== null && auth !== void 0 ? auth : null,\n };\n }\n /* ----------------------------------------------------------- *\n * Private Helpers\n * ----------------------------------------------------------- */\n getRpcUrl(network) {\n if (this.networkUrl) {\n return this.networkUrl;\n }\n if (network === 'solana_devnet') {\n return SOLANA_DEVNET_RPC_URL;\n }\n else if (network === 'solana_mainnet') {\n return SOLANA_MAINNET_RPC_URL;\n }\n else if (network === 'surfnet') {\n return SURFNET_RPC_URL;\n }\n return SOLANA_MAINNET_RPC_URL;\n }\n}\nSolanaMobileWalletProvider.instance = null;\n"],"names":["VersionedMessage","Transaction","VersionedTransaction","getPlatform","setAuthLoading","PublicKey","SessionManager","setCurrentUser","genAuthNonce","genSolanaMessage","Buffer","createSessionWithSignature","Connection","SURFNET_RPC_URL","bs58","confirmAndCheckTransaction","convertRemainingAccounts","anchor","buildSetDocumentsTransaction","SOLANA_DEVNET_RPC_URL","SOLANA_MAINNET_RPC_URL"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,wBAAwB,GAAG,EAAE;AACnC,MAAM,sBAAsB,GAAG,2BAA2B;AAC1D,MAAM,eAAe,GAAG,uBAAuB;AAC/C,SAAS,YAAY,CAAC,CAAC,EAAE,QAAQ,GAAG,CAAC,EAAE;AACvC,IAAI,IAAI,EAAE;AACV,IAAI,IAAI,GAAG,GAAG,CAAC;AACf,IAAI,IAAI,KAAK,GAAG,CAAC;AACjB,IAAI,OAAO,GAAG,IAAI,KAAK,GAAG,QAAQ,EAAE;AACpC,QAAQ,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,IAAI,MAAM,gCAAgC,IAAI,QAAQ,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE;AACnL,YAAY,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE;AAC9G,QAAQ;AACR,QAAQ,GAAG,GAAG,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC,KAAK;AACjE,QAAQ,KAAK,EAAE;AACf,IAAI;AACJ,IAAI,OAAO,IAAI;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AK,gBAAgB,EAAE;AAC/C,YAAY,OAAOC,mCAAsB;AACzC,QAAQ;AACR,aAAa,IAAI,OAAO,KAAK,SAAS,EAAE;AACxC,YAAY,OAAOP,4BAAe;AAClC,QAAQ;AACR,QAAQ,OAAOO,mCAAsB;AACrC,IAAI;AACJ;AACA,0BAA0B,CAAC,QAAQ,GAAG,IAAI;;;;"}
@@ -1,5 +1,5 @@
1
- import { b as bufferExports } from './index-COF6zNCs.esm.js';
2
- import { g as getPlatform, k as setAuthLoading, W as WebSessionManager, s as setCurrentUser, l as genAuthNonce, m as genSolanaMessage, n as createSessionWithSignature, d as base58, e as confirmAndCheckTransaction, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, a as SOLANA_DEVNET_RPC_URL, S as SOLANA_MAINNET_RPC_URL, h as SURFNET_RPC_URL } from './index.native-BPQqeP6_.esm.js';
1
+ import { b as bufferExports } from './index-DbJCCvVN.esm.js';
2
+ import { g as getPlatform, k as setAuthLoading, W as WebSessionManager, s as setCurrentUser, l as genAuthNonce, m as genSolanaMessage, n as createSessionWithSignature, d as base58, e as confirmAndCheckTransaction, c as convertRemainingAccounts, b as buildSetDocumentsTransaction, a as SOLANA_DEVNET_RPC_URL, S as SOLANA_MAINNET_RPC_URL, h as SURFNET_RPC_URL } from './index.native-a3mhu9HP.esm.js';
3
3
  import { PublicKey, Connection, VersionedTransaction, VersionedMessage, Transaction } from '@solana/web3.js';
4
4
  import * as anchor from '@coral-xyz/anchor';
5
5
  import 'axios';
@@ -8,6 +8,110 @@ import 'react';
8
8
  const ED25519_SIGNATURE_LENGTH = 64;
9
9
  const STORED_AUTH_METHOD_KEY = 'tarobase_last_auth_method';
10
10
  const MWA_AUTH_METHOD = 'mobile-wallet-adapter';
11
+ function findMwaError(e, maxDepth = 5) {
12
+ var _a;
13
+ let cur = e;
14
+ let depth = 0;
15
+ while (cur && depth < maxDepth) {
16
+ if ((cur === null || cur === void 0 ? void 0 : cur.name) === 'SolanaMobileWalletAdapterError' && typeof (cur === null || cur === void 0 ? void 0 : cur.code) === 'string') {
17
+ return { code: cur.code, message: String((_a = cur.message) !== null && _a !== void 0 ? _a : '') };
18
+ }
19
+ cur = cur === null || cur === void 0 ? void 0 : cur.cause;
20
+ depth++;
21
+ }
22
+ return null;
23
+ }
24
+ /**
25
+ * Returns the matched MwaErrorInfo when the error is from an association
26
+ * failure that an automatic retry can recover from (i.e. the wallet exists
27
+ * on-device but the dApp's protocol session didn't complete in time). Returns
28
+ * null for non-retryable errors (user cancel, unknown wallet errors, etc.).
29
+ *
30
+ * Specifically:
31
+ * - ERROR_WALLET_NOT_FOUND: thrown from the protocol's startScenario when
32
+ * it gave up waiting for a wallet to respond. On Seeker this races the
33
+ * first-time-consent UI on the very first authorize.
34
+ * - ERROR_SESSION_TIMEOUT: similar — the protocol's session-establishment
35
+ * timer expired.
36
+ * - ERROR_ASSOCIATION_CANCELLED: shared by user-cancel ("Wallet connection
37
+ * cancelled by user") AND the 30s wallet-standard WALLET_ASSOCIATION_TIMEOUT
38
+ * ("Wallet connection timed out"). Discriminate by message — never retry
39
+ * a user cancel.
40
+ */
41
+ function isMwaAssociationRetryable(e) {
42
+ const info = findMwaError(e);
43
+ if (!info)
44
+ return null;
45
+ if (info.code === 'ERROR_WALLET_NOT_FOUND')
46
+ return info;
47
+ if (info.code === 'ERROR_SESSION_TIMEOUT')
48
+ return info;
49
+ if (info.code === 'ERROR_ASSOCIATION_CANCELLED' && /timed out/i.test(info.message))
50
+ return info;
51
+ return null;
52
+ }
53
+ /**
54
+ * Single-retry wrapper for MWA association failures. Used ONLY for login's
55
+ * `standard:connect` and `solana:signMessage` calls — never for
56
+ * `signAndSendTransaction`/`runTransaction` because retry on a path that
57
+ * may have already submitted a tx can double-send.
58
+ *
59
+ * The retry exists for one specific scenario: on first-time MWA usage from a
60
+ * given origin on Seeker, the protocol's session-establishment timer races
61
+ * Seeker's first-time consent UI. The user reads the consent sheet, taps
62
+ * Connect — but by then the protocol has given up and thrown
63
+ * ERROR_WALLET_NOT_FOUND. The consent itself IS persisted on Seeker though,
64
+ * so a second attempt skips the consent sheet, jumps straight to
65
+ * Verify/Approve, and completes inside the timeout.
66
+ */
67
+ async function withMwaAssociationRetry(label, fn) {
68
+ const t0 = Date.now();
69
+ console.log(`[MWA-DEBUG] ${label} attempt=1 start`);
70
+ try {
71
+ const result = await fn();
72
+ console.log(`[MWA-DEBUG] ${label} attempt=1 ok (${Date.now() - t0}ms)`);
73
+ return result;
74
+ }
75
+ catch (e) {
76
+ const info = findMwaError(e);
77
+ console.log(`[MWA-DEBUG] ${label} attempt=1 err (${Date.now() - t0}ms)`, {
78
+ outer: { name: e === null || e === void 0 ? void 0 : e.name, message: e === null || e === void 0 ? void 0 : e.message },
79
+ mwa: info,
80
+ });
81
+ const retryable = isMwaAssociationRetryable(e);
82
+ if (!retryable)
83
+ throw e;
84
+ // Seeker's consent sheet is a bottom-sheet overlay — Chrome doesn't
85
+ // reliably flip document.visibilityState to 'hidden' while it's open,
86
+ // so visibility-based waits fire too early. Use a fixed delay long
87
+ // enough for Seeker to dismiss its sheet and the OS to release intent
88
+ // state. 2.5s is empirically safe; tune from device traces if needed.
89
+ console.log(`[MWA-DEBUG] ${label} retryable (${retryable.code}); waiting 2500ms before retry`);
90
+ await new Promise(r => setTimeout(r, 2500));
91
+ const t1 = Date.now();
92
+ console.log(`[MWA-DEBUG] ${label} attempt=2 start`);
93
+ try {
94
+ const result = await fn();
95
+ console.log(`[MWA-DEBUG] ${label} attempt=2 ok (${Date.now() - t1}ms)`);
96
+ return result;
97
+ }
98
+ catch (e2) {
99
+ const info2 = findMwaError(e2);
100
+ console.log(`[MWA-DEBUG] ${label} attempt=2 err (${Date.now() - t1}ms)`, {
101
+ outer: { name: e2 === null || e2 === void 0 ? void 0 : e2.name, message: e2 === null || e2 === void 0 ? void 0 : e2.message },
102
+ mwa: info2,
103
+ });
104
+ // Only mask the error with the clean Seeker message when the
105
+ // second failure is also an association-flavored error. If it's
106
+ // a user cancel, wallet rejection, or unknown error, rethrow
107
+ // the original so the host app surfaces the real cause.
108
+ if (isMwaAssociationRetryable(e2)) {
109
+ throw new Error("Couldn't connect to your Seeker wallet. Please try again.");
110
+ }
111
+ throw e2;
112
+ }
113
+ }
114
+ }
11
115
  /**
12
116
  * Normalize a chain string to a wallet-standard Solana chain identifier.
13
117
  *
@@ -193,14 +297,22 @@ class SolanaMobileWalletProvider {
193
297
  async ensureWallet() {
194
298
  if (this.wallet)
195
299
  return this.wallet;
196
- const mod = await import('./index.browser-tPepE5fo.esm.js');
300
+ const mod = await import('./index.browser-p-pgsxxW.esm.js');
197
301
  const chain = mapChainToWalletStandard(this.cluster);
198
302
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
199
303
  appIdentity: this.appIdentity,
200
304
  authorizationCache: mod.createDefaultAuthorizationCache(),
201
305
  chains: [chain],
202
306
  chainSelector: mod.createDefaultChainSelector(),
203
- onWalletNotFound: mod.createDefaultWalletNotFoundHandler(),
307
+ // Suppress the default "We can't find a wallet" modal — that
308
+ // modal is misleading when ERROR_WALLET_NOT_FOUND fires during
309
+ // a first-time-consent race on Seeker (the wallet IS installed,
310
+ // the protocol just gave up before the user finished consenting).
311
+ // login()'s withMwaAssociationRetry handles this case; on second
312
+ // failure it surfaces a clean error message to the host app.
313
+ onWalletNotFound: async () => {
314
+ console.warn('[MWA-DEBUG] ensureWallet onWalletNotFound (suppressed)');
315
+ },
204
316
  });
205
317
  return this.wallet;
206
318
  }
@@ -265,8 +377,15 @@ class SolanaMobileWalletProvider {
265
377
  // is where wallet-standard's checkLocalNetworkAccessPermission()
266
378
  // fires the three-stage LNA UX (info modal → permission prompt →
267
379
  // success modal) before opening the localhost WebSocket.
380
+ //
381
+ // Wrap with single-retry: on a Seeker origin's first MWA usage,
382
+ // the protocol's session-establishment timer often races Seeker's
383
+ // first-time consent UI and throws ERROR_WALLET_NOT_FOUND before
384
+ // the user finishes tapping. The retry hits Seeker's cached
385
+ // consent on the second pass and completes quickly. See
386
+ // withMwaAssociationRetry for details.
268
387
  const connectFeat = getConnectFeature(wallet);
269
- const { accounts } = await connectFeat.connect();
388
+ const { accounts } = await withMwaAssociationRetry('login:connect', () => connectFeat.connect());
270
389
  if (!accounts || accounts.length === 0) {
271
390
  throw new Error('MWA returned no accounts');
272
391
  }
@@ -280,11 +399,14 @@ class SolanaMobileWalletProvider {
280
399
  setCurrentUser(user);
281
400
  return user;
282
401
  }
283
- // Wallet popup #2: sign the Tarobase nonce message.
402
+ // Wallet popup #2: sign the Tarobase nonce message. Wrap with the
403
+ // same retry for defense in depth — by now Seeker has cached the
404
+ // consent so this rarely hits the retry path, but if the
405
+ // protocol's session timer fires here too we recover transparently.
284
406
  const messageText = await genSolanaMessage(base58Addr, nonce);
285
407
  const messageBytes = getPlatform().textEncode(messageText);
286
408
  const signMessageFeat = getSignMessageFeature(wallet);
287
- const signResults = await signMessageFeat.signMessage({ account, message: messageBytes });
409
+ const signResults = await withMwaAssociationRetry('login:signMessage', () => signMessageFeat.signMessage({ account, message: messageBytes }));
288
410
  if (!signResults || signResults.length === 0) {
289
411
  throw new Error('MWA returned no signature');
290
412
  }
@@ -695,4 +817,4 @@ class SolanaMobileWalletProvider {
695
817
  SolanaMobileWalletProvider.instance = null;
696
818
 
697
819
  export { SolanaMobileWalletProvider };
698
- //# sourceMappingURL=solana-mobile-wallet-provider-ChHh-U_p.esm.js.map
820
+ //# sourceMappingURL=solana-mobile-wallet-provider-fzLIgJBf.esm.js.map