@pooflabs/web 0.0.81 → 0.0.83-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/{index-D_DiP8XQ.js → index-2qSlZ-n6.js} +7850 -10985
  2. package/dist/index-2qSlZ-n6.js.map +1 -0
  3. package/dist/{index-DXPkkq81.js → index-BAz5F9Qr.js} +7850 -10985
  4. package/dist/index-BAz5F9Qr.js.map +1 -0
  5. package/dist/{index-CjHbp7Dq.esm.js → index-BpjqfeKL.esm.js} +7850 -10985
  6. package/dist/index-BpjqfeKL.esm.js.map +1 -0
  7. package/dist/{index-B2WGCssJ.js → index-CYhzBf0k.js} +231 -180
  8. package/dist/index-CYhzBf0k.js.map +1 -0
  9. package/dist/{index-dcJIjFrs.esm.js → index-DOfXgVkn.esm.js} +7850 -10985
  10. package/dist/index-DOfXgVkn.esm.js.map +1 -0
  11. package/dist/{index-nt_HQVrk.esm.js → index-DiSZgxvm.esm.js} +232 -179
  12. package/dist/index-DiSZgxvm.esm.js.map +1 -0
  13. package/dist/{index.browser-CT6PUv9G.js → index.browser-BgibQtKi.js} +2 -2
  14. package/dist/{index.browser-CT6PUv9G.js.map → index.browser-BgibQtKi.js.map} +1 -1
  15. package/dist/{index.browser-BNdFfyIg.esm.js → index.browser-BlQ9w7lf.esm.js} +2 -2
  16. package/dist/{index.browser-BNdFfyIg.esm.js.map → index.browser-BlQ9w7lf.esm.js.map} +1 -1
  17. package/dist/{index.browser-ZD7Tz2bn.js → index.browser-CDhaFhaH.js} +2 -2
  18. package/dist/{index.browser-ZD7Tz2bn.js.map → index.browser-CDhaFhaH.js.map} +1 -1
  19. package/dist/{index.browser-pE1s68e9.esm.js → index.browser-DVn6ApJy.esm.js} +2 -2
  20. package/dist/{index.browser-pE1s68e9.esm.js.map → index.browser-DVn6ApJy.esm.js.map} +1 -1
  21. package/dist/{index.browser-Cy21yaX0.esm.js → index.browser-I9UnPFqe.esm.js} +2 -2
  22. package/dist/{index.browser-Cy21yaX0.esm.js.map → index.browser-I9UnPFqe.esm.js.map} +1 -1
  23. package/dist/{index.browser-d0PlOXpF.js → index.browser-XpeHKCJM.js} +2 -2
  24. package/dist/{index.browser-d0PlOXpF.js.map → index.browser-XpeHKCJM.js.map} +1 -1
  25. package/dist/index.esm.js +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/{index.native-BqYr--vb.esm.js → index.native-CbNEYkFa.esm.js} +185 -180
  28. package/dist/index.native-CbNEYkFa.esm.js.map +1 -0
  29. package/dist/{index.native-CyA-RdvW.js → index.native-lubRe8nA.js} +184 -181
  30. package/dist/index.native-lubRe8nA.js.map +1 -0
  31. package/dist/index.native.esm.js +1 -1
  32. package/dist/index.native.js +1 -1
  33. package/dist/{phantom-wallet-provider-DWCaMkyz.js → phantom-wallet-provider-CfJti5dZ.js} +23 -4
  34. package/dist/phantom-wallet-provider-CfJti5dZ.js.map +1 -0
  35. package/dist/{phantom-wallet-provider-K2V96G-G.esm.js → phantom-wallet-provider-YH1gySq_.esm.js} +23 -4
  36. package/dist/phantom-wallet-provider-YH1gySq_.esm.js.map +1 -0
  37. package/dist/{privy-wallet-provider-DoX8q99w.esm.js → privy-wallet-provider-Bt7Jk-TE.esm.js} +3 -3
  38. package/dist/{privy-wallet-provider-DoX8q99w.esm.js.map → privy-wallet-provider-Bt7Jk-TE.esm.js.map} +1 -1
  39. package/dist/{privy-wallet-provider-BMg_S_d0.js → privy-wallet-provider-CeH9zTfE.js} +3 -3
  40. package/dist/{privy-wallet-provider-BMg_S_d0.js.map → privy-wallet-provider-CeH9zTfE.js.map} +1 -1
  41. package/dist/{solana-mobile-wallet-provider-t22Ie8lY.js → solana-mobile-wallet-provider-4PG6JNmJ.js} +33 -4
  42. package/dist/solana-mobile-wallet-provider-4PG6JNmJ.js.map +1 -0
  43. package/dist/{solana-mobile-wallet-provider-Cmphb3oB.esm.js → solana-mobile-wallet-provider-BtM0Saad.esm.js} +33 -4
  44. package/dist/solana-mobile-wallet-provider-BtM0Saad.esm.js.map +1 -0
  45. package/package.json +2 -2
  46. package/dist/index-B2WGCssJ.js.map +0 -1
  47. package/dist/index-CjHbp7Dq.esm.js.map +0 -1
  48. package/dist/index-DXPkkq81.js.map +0 -1
  49. package/dist/index-D_DiP8XQ.js.map +0 -1
  50. package/dist/index-dcJIjFrs.esm.js.map +0 -1
  51. package/dist/index-nt_HQVrk.esm.js.map +0 -1
  52. package/dist/index.native-BqYr--vb.esm.js.map +0 -1
  53. package/dist/index.native-CyA-RdvW.js.map +0 -1
  54. package/dist/phantom-wallet-provider-DWCaMkyz.js.map +0 -1
  55. package/dist/phantom-wallet-provider-K2V96G-G.esm.js.map +0 -1
  56. package/dist/solana-mobile-wallet-provider-Cmphb3oB.esm.js.map +0 -1
  57. package/dist/solana-mobile-wallet-provider-t22Ie8lY.js.map +0 -1
@@ -4,21 +4,6 @@ import * as anchor from '@coral-xyz/anchor';
4
4
  import { Program } from '@coral-xyz/anchor';
5
5
  import * as React$2 from 'react';
6
6
 
7
- function _mergeNamespaces(n, m) {
8
- m.forEach(function (e) {
9
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
10
- if (k !== 'default' && !(k in n)) {
11
- var d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: function () { return e[k]; }
15
- });
16
- }
17
- });
18
- });
19
- return Object.freeze(n);
20
- }
21
-
22
7
  function getDefaultExportFromCjs$1 (x) {
23
8
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
24
9
  }
@@ -6764,6 +6749,28 @@ class WebSessionManager {
6764
6749
  static async storeSession(address, accessToken, idToken, refreshToken) {
6765
6750
  if (typeof window === "undefined")
6766
6751
  return;
6752
+ // JWT-wallet binding: refuse to store a session whose idToken is bound
6753
+ // to a different wallet than `address`. Prevents races that would otherwise
6754
+ // leave localStorage with mismatched address/token state.
6755
+ try {
6756
+ const payloadB64 = idToken.split(".")[1];
6757
+ if (payloadB64) {
6758
+ const payload = JSON.parse(this.decodeBase64Url(payloadB64));
6759
+ const tokenWallet = payload["custom:walletAddress"];
6760
+ if (tokenWallet && tokenWallet !== address) {
6761
+ throw new Error(`[WebSessionManager] Refusing to store session: address (${address}) does not match idToken custom:walletAddress (${tokenWallet})`);
6762
+ }
6763
+ if (!tokenWallet) {
6764
+ console.warn("[WebSessionManager] storeSession: idToken has no custom:walletAddress claim — writing without validation");
6765
+ }
6766
+ }
6767
+ }
6768
+ catch (err) {
6769
+ if (typeof (err === null || err === void 0 ? void 0 : err.message) === "string" && err.message.includes("Refusing to store session")) {
6770
+ throw err;
6771
+ }
6772
+ console.warn("[WebSessionManager] storeSession: failed to decode idToken for validation:", err);
6773
+ }
6767
6774
  const config = await getConfig();
6768
6775
  const currentAppId = config.appId;
6769
6776
  localStorage.setItem(this.TAROBASE_SESSION_STORAGE_KEY, JSON.stringify({
@@ -9462,11 +9469,11 @@ function requireSrc () {
9462
9469
  }
9463
9470
 
9464
9471
  var bs58$1;
9465
- var hasRequiredBs58$1;
9472
+ var hasRequiredBs58;
9466
9473
 
9467
- function requireBs58$1 () {
9468
- if (hasRequiredBs58$1) return bs58$1;
9469
- hasRequiredBs58$1 = 1;
9474
+ function requireBs58 () {
9475
+ if (hasRequiredBs58) return bs58$1;
9476
+ hasRequiredBs58 = 1;
9470
9477
  var basex = requireSrc();
9471
9478
  var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9472
9479
 
@@ -9474,8 +9481,8 @@ function requireBs58$1 () {
9474
9481
  return bs58$1;
9475
9482
  }
9476
9483
 
9477
- var bs58Exports$1 = requireBs58$1();
9478
- var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports$1);
9484
+ var bs58Exports = requireBs58();
9485
+ var bs58 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
9479
9486
 
9480
9487
  // ─────────────────────────────────────────────────────────────
9481
9488
  // Local implementation of getSimulationComputeUnits
@@ -9728,7 +9735,7 @@ function loadKeypairFromEnv() {
9728
9735
  try {
9729
9736
  const secretKey = secret.trim().startsWith("[")
9730
9737
  ? Uint8Array.from(JSON.parse(secret))
9731
- : bs58$2.decode(secret.trim());
9738
+ : bs58.decode(secret.trim());
9732
9739
  return Keypair.fromSecretKey(secretKey);
9733
9740
  }
9734
9741
  catch (err) {
@@ -11650,6 +11657,28 @@ class ReactNativeSessionManager {
11650
11657
  /* STORE */
11651
11658
  /* ------------------------------------------------------------------ */
11652
11659
  static async storeSession(address, accessToken, idToken, refreshToken) {
11660
+ // JWT-wallet binding: refuse to store a session whose idToken is bound
11661
+ // to a different wallet than `address`. Prevents races that would otherwise
11662
+ // leave storage with mismatched address/token state.
11663
+ try {
11664
+ const payloadB64 = idToken.split(".")[1];
11665
+ if (payloadB64) {
11666
+ const payload = JSON.parse(this.decodeBase64Url(payloadB64));
11667
+ const tokenWallet = payload["custom:walletAddress"];
11668
+ if (tokenWallet && tokenWallet !== address) {
11669
+ throw new Error(`[ReactNativeSessionManager] Refusing to store session: address (${address}) does not match idToken custom:walletAddress (${tokenWallet})`);
11670
+ }
11671
+ if (!tokenWallet) {
11672
+ console.warn("[ReactNativeSessionManager] storeSession: idToken has no custom:walletAddress claim — writing without validation");
11673
+ }
11674
+ }
11675
+ }
11676
+ catch (err) {
11677
+ if (typeof (err === null || err === void 0 ? void 0 : err.message) === "string" && err.message.includes("Refusing to store session")) {
11678
+ throw err;
11679
+ }
11680
+ console.warn("[ReactNativeSessionManager] storeSession: failed to decode idToken for validation:", err);
11681
+ }
11653
11682
  const config = await getConfig();
11654
11683
  const currentAppId = config.appId;
11655
11684
  this.getStorage().setItem(this.TAROBASE_SESSION_STORAGE_KEY, JSON.stringify({
@@ -15648,7 +15677,7 @@ async function loadDependencies() {
15648
15677
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15649
15678
  import('react'),
15650
15679
  import('react-dom/client'),
15651
- import('./index-dcJIjFrs.esm.js')
15680
+ import('./index-DOfXgVkn.esm.js')
15652
15681
  ]);
15653
15682
  // Extract default export from ESM module namespace
15654
15683
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -15842,6 +15871,16 @@ class PhantomWalletProvider {
15842
15871
  if (!(phantom === null || phantom === void 0 ? void 0 : phantom.isConnected) || (phantom === null || phantom === void 0 ? void 0 : phantom.isLoading) || that.loginInProgress || that.autoLoginInProgress || that.pendingLogin) {
15843
15872
  return;
15844
15873
  }
15874
+ // Don't clobber a session owned by MWA on Seeker. MWA marks the
15875
+ // auth method as soon as login starts (see solana-mobile-wallet-provider),
15876
+ // and clears it on logout, so this guard is correct in both
15877
+ // steady-state and post-logout cases.
15878
+ try {
15879
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'mobile-wallet-adapter') {
15880
+ return;
15881
+ }
15882
+ }
15883
+ catch (_b) { }
15845
15884
  // Need solana to be available AND connected for signing
15846
15885
  if (!solana || !solanaHook.isAvailable || !solana.connected) {
15847
15886
  return;
@@ -15871,12 +15910,21 @@ class PhantomWalletProvider {
15871
15910
  const signatureBytes = signResult.signature;
15872
15911
  const signature = bufferExports.Buffer.from(signatureBytes).toString('base64');
15873
15912
  const createSessionResult = await createSessionWithSignature(publicKey, messageText, signature);
15913
+ // Pre-write guard: MWA may have started a login while we were
15914
+ // in flight. If MWA owns the auth method now, abort before we
15915
+ // overwrite its session (or its in-flight session).
15916
+ try {
15917
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'mobile-wallet-adapter') {
15918
+ return;
15919
+ }
15920
+ }
15921
+ catch (_c) { }
15874
15922
  await WebSessionManager.storeSession(publicKey, createSessionResult.accessToken, createSessionResult.idToken, createSessionResult.refreshToken);
15875
15923
  // Mark auth method so clearIncompatibleSession() doesn't wipe this session
15876
15924
  try {
15877
15925
  getPlatform().storage.setItem('tarobase_last_auth_method', 'phantom');
15878
15926
  }
15879
- catch (_b) { }
15927
+ catch (_d) { }
15880
15928
  setCurrentUser({ provider: that, address: publicKey });
15881
15929
  }
15882
15930
  catch (error) {
@@ -20066,161 +20114,137 @@ function createSolanaRpcSubscriptionsFromTransport(transport) {
20066
20114
  });
20067
20115
  }
20068
20116
 
20069
- var cjs = {};
20070
-
20071
- var hasRequiredCjs;
20072
-
20073
- function requireCjs () {
20074
- if (hasRequiredCjs) return cjs;
20075
- hasRequiredCjs = 1;
20076
- // base-x encoding / decoding
20077
- // Copyright (c) 2018 base-x contributors
20078
- // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
20079
- // Distributed under the MIT software license, see the accompanying
20080
- // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
20081
- Object.defineProperty(cjs, '__esModule', { value: true });
20082
- function base (ALPHABET) {
20083
- if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
20084
- const BASE_MAP = new Uint8Array(256);
20085
- for (let j = 0; j < BASE_MAP.length; j++) {
20086
- BASE_MAP[j] = 255;
20087
- }
20088
- for (let i = 0; i < ALPHABET.length; i++) {
20089
- const x = ALPHABET.charAt(i);
20090
- const xc = x.charCodeAt(0);
20091
- if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
20092
- BASE_MAP[xc] = i;
20093
- }
20094
- const BASE = ALPHABET.length;
20095
- const LEADER = ALPHABET.charAt(0);
20096
- const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
20097
- const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
20098
- function encode (source) {
20099
- // eslint-disable-next-line no-empty
20100
- if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
20101
- source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
20102
- } else if (Array.isArray(source)) {
20103
- source = Uint8Array.from(source);
20104
- }
20105
- if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
20106
- if (source.length === 0) { return '' }
20107
- // Skip & count leading zeroes.
20108
- let zeroes = 0;
20109
- let length = 0;
20110
- let pbegin = 0;
20111
- const pend = source.length;
20112
- while (pbegin !== pend && source[pbegin] === 0) {
20113
- pbegin++;
20114
- zeroes++;
20115
- }
20116
- // Allocate enough space in big-endian base58 representation.
20117
- const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
20118
- const b58 = new Uint8Array(size);
20119
- // Process the bytes.
20120
- while (pbegin !== pend) {
20121
- let carry = source[pbegin];
20122
- // Apply "b58 = b58 * 256 + ch".
20123
- let i = 0;
20124
- for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
20125
- carry += (256 * b58[it1]) >>> 0;
20126
- b58[it1] = (carry % BASE) >>> 0;
20127
- carry = (carry / BASE) >>> 0;
20128
- }
20129
- if (carry !== 0) { throw new Error('Non-zero carry') }
20130
- length = i;
20131
- pbegin++;
20132
- }
20133
- // Skip leading zeroes in base58 result.
20134
- let it2 = size - length;
20135
- while (it2 !== size && b58[it2] === 0) {
20136
- it2++;
20137
- }
20138
- // Translate the result into a string.
20139
- let str = LEADER.repeat(zeroes);
20140
- for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
20141
- return str
20142
- }
20143
- function decodeUnsafe (source) {
20144
- if (typeof source !== 'string') { throw new TypeError('Expected String') }
20145
- if (source.length === 0) { return new Uint8Array() }
20146
- let psz = 0;
20147
- // Skip and count leading '1's.
20148
- let zeroes = 0;
20149
- let length = 0;
20150
- while (source[psz] === LEADER) {
20151
- zeroes++;
20152
- psz++;
20153
- }
20154
- // Allocate enough space in big-endian base256 representation.
20155
- const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
20156
- const b256 = new Uint8Array(size);
20157
- // Process the characters.
20158
- while (psz < source.length) {
20159
- // Find code of next character
20160
- const charCode = source.charCodeAt(psz);
20161
- // Base map can not be indexed using char code
20162
- if (charCode > 255) { return }
20163
- // Decode character
20164
- let carry = BASE_MAP[charCode];
20165
- // Invalid character
20166
- if (carry === 255) { return }
20167
- let i = 0;
20168
- for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
20169
- carry += (BASE * b256[it3]) >>> 0;
20170
- b256[it3] = (carry % 256) >>> 0;
20171
- carry = (carry / 256) >>> 0;
20172
- }
20173
- if (carry !== 0) { throw new Error('Non-zero carry') }
20174
- length = i;
20175
- psz++;
20176
- }
20177
- // Skip leading zeroes in b256.
20178
- let it4 = size - length;
20179
- while (it4 !== size && b256[it4] === 0) {
20180
- it4++;
20181
- }
20182
- const vch = new Uint8Array(zeroes + (size - it4));
20183
- let j = zeroes;
20184
- while (it4 !== size) {
20185
- vch[j++] = b256[it4++];
20186
- }
20187
- return vch
20188
- }
20189
- function decode (string) {
20190
- const buffer = decodeUnsafe(string);
20191
- if (buffer) { return buffer }
20192
- throw new Error('Non-base' + BASE + ' character')
20193
- }
20194
- return {
20195
- encode,
20196
- decodeUnsafe,
20197
- decode
20198
- }
20199
- }
20200
- cjs.default = base;
20201
- return cjs;
20202
- }
20203
-
20204
- var bs58;
20205
- var hasRequiredBs58;
20206
-
20207
- function requireBs58 () {
20208
- if (hasRequiredBs58) return bs58;
20209
- hasRequiredBs58 = 1;
20210
- var basex = requireCjs();
20211
- var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
20212
-
20213
- bs58 = basex(ALPHABET);
20214
- return bs58;
20117
+ // base-x encoding / decoding
20118
+ // Copyright (c) 2018 base-x contributors
20119
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
20120
+ // Distributed under the MIT software license, see the accompanying
20121
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
20122
+ function base (ALPHABET) {
20123
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
20124
+ const BASE_MAP = new Uint8Array(256);
20125
+ for (let j = 0; j < BASE_MAP.length; j++) {
20126
+ BASE_MAP[j] = 255;
20127
+ }
20128
+ for (let i = 0; i < ALPHABET.length; i++) {
20129
+ const x = ALPHABET.charAt(i);
20130
+ const xc = x.charCodeAt(0);
20131
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
20132
+ BASE_MAP[xc] = i;
20133
+ }
20134
+ const BASE = ALPHABET.length;
20135
+ const LEADER = ALPHABET.charAt(0);
20136
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
20137
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
20138
+ function encode (source) {
20139
+ // eslint-disable-next-line no-empty
20140
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
20141
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
20142
+ } else if (Array.isArray(source)) {
20143
+ source = Uint8Array.from(source);
20144
+ }
20145
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
20146
+ if (source.length === 0) { return '' }
20147
+ // Skip & count leading zeroes.
20148
+ let zeroes = 0;
20149
+ let length = 0;
20150
+ let pbegin = 0;
20151
+ const pend = source.length;
20152
+ while (pbegin !== pend && source[pbegin] === 0) {
20153
+ pbegin++;
20154
+ zeroes++;
20155
+ }
20156
+ // Allocate enough space in big-endian base58 representation.
20157
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
20158
+ const b58 = new Uint8Array(size);
20159
+ // Process the bytes.
20160
+ while (pbegin !== pend) {
20161
+ let carry = source[pbegin];
20162
+ // Apply "b58 = b58 * 256 + ch".
20163
+ let i = 0;
20164
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
20165
+ carry += (256 * b58[it1]) >>> 0;
20166
+ b58[it1] = (carry % BASE) >>> 0;
20167
+ carry = (carry / BASE) >>> 0;
20168
+ }
20169
+ if (carry !== 0) { throw new Error('Non-zero carry') }
20170
+ length = i;
20171
+ pbegin++;
20172
+ }
20173
+ // Skip leading zeroes in base58 result.
20174
+ let it2 = size - length;
20175
+ while (it2 !== size && b58[it2] === 0) {
20176
+ it2++;
20177
+ }
20178
+ // Translate the result into a string.
20179
+ let str = LEADER.repeat(zeroes);
20180
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
20181
+ return str
20182
+ }
20183
+ function decodeUnsafe (source) {
20184
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
20185
+ if (source.length === 0) { return new Uint8Array() }
20186
+ let psz = 0;
20187
+ // Skip and count leading '1's.
20188
+ let zeroes = 0;
20189
+ let length = 0;
20190
+ while (source[psz] === LEADER) {
20191
+ zeroes++;
20192
+ psz++;
20193
+ }
20194
+ // Allocate enough space in big-endian base256 representation.
20195
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
20196
+ const b256 = new Uint8Array(size);
20197
+ // Process the characters.
20198
+ while (psz < source.length) {
20199
+ // Find code of next character
20200
+ const charCode = source.charCodeAt(psz);
20201
+ // Base map can not be indexed using char code
20202
+ if (charCode > 255) { return }
20203
+ // Decode character
20204
+ let carry = BASE_MAP[charCode];
20205
+ // Invalid character
20206
+ if (carry === 255) { return }
20207
+ let i = 0;
20208
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
20209
+ carry += (BASE * b256[it3]) >>> 0;
20210
+ b256[it3] = (carry % 256) >>> 0;
20211
+ carry = (carry / 256) >>> 0;
20212
+ }
20213
+ if (carry !== 0) { throw new Error('Non-zero carry') }
20214
+ length = i;
20215
+ psz++;
20216
+ }
20217
+ // Skip leading zeroes in b256.
20218
+ let it4 = size - length;
20219
+ while (it4 !== size && b256[it4] === 0) {
20220
+ it4++;
20221
+ }
20222
+ const vch = new Uint8Array(zeroes + (size - it4));
20223
+ let j = zeroes;
20224
+ while (it4 !== size) {
20225
+ vch[j++] = b256[it4++];
20226
+ }
20227
+ return vch
20228
+ }
20229
+ function decode (string) {
20230
+ const buffer = decodeUnsafe(string);
20231
+ if (buffer) { return buffer }
20232
+ throw new Error('Non-base' + BASE + ' character')
20233
+ }
20234
+ return {
20235
+ encode,
20236
+ decodeUnsafe,
20237
+ decode
20238
+ }
20215
20239
  }
20216
20240
 
20217
- var bs58Exports = requireBs58();
20218
- var base58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
20241
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
20242
+ var base58 = base(ALPHABET);
20219
20243
 
20220
- var index = /*#__PURE__*/_mergeNamespaces({
20244
+ var index = /*#__PURE__*/Object.freeze({
20221
20245
  __proto__: null,
20222
20246
  default: base58
20223
- }, [bs58Exports]);
20247
+ });
20224
20248
 
20225
20249
  const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
20226
20250
  let React;
@@ -21134,7 +21158,7 @@ async function loadMwaProtocol() {
21134
21158
  return mwaProtocolLoadPromise;
21135
21159
  mwaProtocolLoadPromise = (async () => {
21136
21160
  try {
21137
- mwaProtocolModule = await import('./index.browser-pE1s68e9.esm.js');
21161
+ mwaProtocolModule = await import('./index.browser-DVn6ApJy.esm.js');
21138
21162
  }
21139
21163
  catch (e) {
21140
21164
  console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
@@ -21156,7 +21180,7 @@ async function registerMobileWalletAdapter(config) {
21156
21180
  if (typeof window === 'undefined')
21157
21181
  return;
21158
21182
  try {
21159
- const walletStandardMobile = await import('./index.browser-BNdFfyIg.esm.js');
21183
+ const walletStandardMobile = await import('./index.browser-BlQ9w7lf.esm.js');
21160
21184
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21161
21185
  if (!registerMwa) {
21162
21186
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21286,6 +21310,19 @@ class SolanaMobileWalletProvider {
21286
21310
  async login() {
21287
21311
  var _a, _b, _c, _d, _e;
21288
21312
  setAuthLoading(true);
21313
+ // Mark the auth method early so a concurrent Phantom auto-create can see
21314
+ // 'mobile-wallet-adapter' during our slow transact() / session-creation
21315
+ // roundtrip and back off (see phantom-wallet-provider autoCreateSession).
21316
+ // Capture the previous value so we can restore it if login fails.
21317
+ let prevAuthMethod = null;
21318
+ try {
21319
+ prevAuthMethod = getPlatform().storage.getItem('tarobase_last_auth_method');
21320
+ }
21321
+ catch (_f) { }
21322
+ try {
21323
+ getPlatform().storage.setItem('tarobase_last_auth_method', 'mobile-wallet-adapter');
21324
+ }
21325
+ catch (_g) { }
21289
21326
  try {
21290
21327
  await loadMwaProtocol();
21291
21328
  const { transact } = mwaProtocolModule;
@@ -21351,12 +21388,22 @@ class SolanaMobileWalletProvider {
21351
21388
  try {
21352
21389
  getPlatform().storage.setItem('tarobase_last_auth_method', 'mobile-wallet-adapter');
21353
21390
  }
21354
- catch (_f) { }
21391
+ catch (_h) { }
21355
21392
  const user = { provider: this, address: result.base58Address };
21356
21393
  setCurrentUser(user);
21357
21394
  return user;
21358
21395
  }
21359
21396
  catch (error) {
21397
+ // Restore the previous auth method since this login attempt failed.
21398
+ try {
21399
+ if (prevAuthMethod === null) {
21400
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
21401
+ }
21402
+ else {
21403
+ getPlatform().storage.setItem('tarobase_last_auth_method', prevAuthMethod);
21404
+ }
21405
+ }
21406
+ catch (_j) { }
21360
21407
  const isUserRejection = (error === null || error === void 0 ? void 0 : error.code) === 4001 ||
21361
21408
  ((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('user rejected')) ||
21362
21409
  ((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('user denied')) ||
@@ -21402,6 +21449,12 @@ class SolanaMobileWalletProvider {
21402
21449
  this.authorizedPublicKey = null;
21403
21450
  this.publicKeyObj = null;
21404
21451
  WebSessionManager.clearSession();
21452
+ // Clear the auth-method marker so Phantom auto-create is unblocked
21453
+ // for any subsequent fresh login on this device.
21454
+ try {
21455
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
21456
+ }
21457
+ catch (_a) { }
21405
21458
  setCurrentUser(null);
21406
21459
  }
21407
21460
  async signMessage(message) {
@@ -22064,5 +22117,5 @@ class PrivyExpoProvider {
22064
22117
  }
22065
22118
  }
22066
22119
 
22067
- export { genAuthNonce as $, count as A, aggregate as B, subscribe as C, useAuth as D, deserializeTransaction as E, getIdToken as F, setPlatform as G, getPlatform as H, PrivyWalletProvider as I, DEFAULT_TEST_ADDRESS as J, isMobileWalletAvailable as K, registerMobileWalletAdapter as L, MockAuthProvider as M, PrivyExpoProvider as N, OffchainAuthProvider as O, PhantomWalletProvider as P, InsufficientBalanceError as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, ServerSessionManager as T, buildSetDocumentsTransaction as U, clearCache as V, WebSessionManager as W, closeAllSubscriptions as X, convertRemainingAccounts as Y, createSessionWithPrivy as Z, createSessionWithSignature as _, base58 as a, genSolanaMessage as a0, getCachedData as a1, getMany as a2, reconnectWithNewAuth as a3, refreshSession as a4, signSessionCreateMessage as a5, bufferExports as b, commonjsRequire as c, getCurrentUser as d, onAuthLoadingChanged as e, getAuthLoading as f, getDefaultExportFromCjs$1 as g, logout as h, init as i, getConfig as j, getAuthProvider as k, login as l, get as m, setMany as n, onAuthStateChanged as o, setFile as p, getFiles as q, require$$0 as r, set as s, runQuery as t, runQueryMany as u, runExpression as v, runExpressionMany as w, signMessage as x, signTransaction as y, signAndSubmitTransaction as z };
22068
- //# sourceMappingURL=index-nt_HQVrk.esm.js.map
22120
+ 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 };
22121
+ //# sourceMappingURL=index-DiSZgxvm.esm.js.map