@pooflabs/web 0.0.79 → 0.0.81-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 (68) hide show
  1. package/dist/auth/providers/phantom-wallet-provider.d.ts +20 -0
  2. package/dist/{index-BHGEc97p.js → index-BSL3D7PC.js} +25 -883
  3. package/dist/index-BSL3D7PC.js.map +1 -0
  4. package/dist/{index-DwU9hjtr.js → index-BU6puWaY.js} +640 -294
  5. package/dist/index-BU6puWaY.js.map +1 -0
  6. package/dist/index-Bdcc5821.js +2375 -0
  7. package/dist/index-Bdcc5821.js.map +1 -0
  8. package/dist/{index-CsIXFm8d.esm.js → index-Cpw11-0x.esm.js} +640 -295
  9. package/dist/index-Cpw11-0x.esm.js.map +1 -0
  10. package/dist/index-CrOVJFX9.esm.js +2373 -0
  11. package/dist/index-CrOVJFX9.esm.js.map +1 -0
  12. package/dist/{index-U-xlsKRI.esm.js → index-CtwdL0-L.esm.js} +23 -881
  13. package/dist/index-CtwdL0-L.esm.js.map +1 -0
  14. package/dist/{index-CiwYJvf8.esm.js → index-DLfRKZI7.esm.js} +24 -882
  15. package/dist/index-DLfRKZI7.esm.js.map +1 -0
  16. package/dist/{index-zS_Y-wbi.js → index-Fo9o33oZ.js} +24 -882
  17. package/dist/index-Fo9o33oZ.js.map +1 -0
  18. package/dist/{index.browser-Dbq5Qf1G.esm.js → index.browser-9JJy5Y7o.esm.js} +5 -128
  19. package/dist/index.browser-9JJy5Y7o.esm.js.map +1 -0
  20. package/dist/{index.browser-dszs5oe5.js → index.browser-B4RzFwu2.js} +6 -129
  21. package/dist/index.browser-B4RzFwu2.js.map +1 -0
  22. package/dist/{index.browser-Cpi4W_1r.js → index.browser-CGfTdDXe.js} +2 -2
  23. package/dist/{index.browser-Cpi4W_1r.js.map → index.browser-CGfTdDXe.js.map} +1 -1
  24. package/dist/{index.browser-Df7yN8D5.js → index.browser-CQUvzkLr.js} +6 -129
  25. package/dist/index.browser-CQUvzkLr.js.map +1 -0
  26. package/dist/{index.browser-C9bFQZyQ.esm.js → index.browser-Dzo4A2XB.esm.js} +5 -128
  27. package/dist/index.browser-Dzo4A2XB.esm.js.map +1 -0
  28. package/dist/{index.browser-CMEwqnEe.esm.js → index.browser-HEDpODB5.esm.js} +2 -2
  29. package/dist/{index.browser-CMEwqnEe.esm.js.map → index.browser-HEDpODB5.esm.js.map} +1 -1
  30. package/dist/index.esm.js +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/{index.native-DtxPWD00.js → index.native-DYI4vw0X.js} +547 -2688
  33. package/dist/index.native-DYI4vw0X.js.map +1 -0
  34. package/dist/{index.native-CEf5PJ_g.esm.js → index.native-UxpBL0TA.esm.js} +548 -2688
  35. package/dist/index.native-UxpBL0TA.esm.js.map +1 -0
  36. package/dist/index.native.esm.js +1 -1
  37. package/dist/index.native.js +1 -1
  38. package/dist/{phantom-wallet-provider-BbyQIlro.js → phantom-wallet-provider-BPSAXPZ6.js} +127 -11
  39. package/dist/{phantom-wallet-provider-BbyQIlro.js.map → phantom-wallet-provider-BPSAXPZ6.js.map} +1 -1
  40. package/dist/{phantom-wallet-provider-B0UmUtfB.esm.js → phantom-wallet-provider-DcMJW18_.esm.js} +127 -11
  41. package/dist/{phantom-wallet-provider-B0UmUtfB.esm.js.map → phantom-wallet-provider-DcMJW18_.esm.js.map} +1 -1
  42. package/dist/{privy-wallet-provider-DGjYglh7.esm.js → privy-wallet-provider-CtIl8FgH.esm.js} +3 -3
  43. package/dist/privy-wallet-provider-CtIl8FgH.esm.js.map +1 -0
  44. package/dist/{privy-wallet-provider-CoQzq0F4.js → privy-wallet-provider-Zu5K_vNN.js} +3 -3
  45. package/dist/privy-wallet-provider-Zu5K_vNN.js.map +1 -0
  46. package/dist/{solana-mobile-wallet-provider-DIyP-Az5.esm.js → solana-mobile-wallet-provider-C31APzEp.esm.js} +4 -4
  47. package/dist/{solana-mobile-wallet-provider-DIyP-Az5.esm.js.map → solana-mobile-wallet-provider-C31APzEp.esm.js.map} +1 -1
  48. package/dist/{solana-mobile-wallet-provider-BLoovRsJ.js → solana-mobile-wallet-provider-Dg9_h3QI.js} +4 -4
  49. package/dist/{solana-mobile-wallet-provider-BLoovRsJ.js.map → solana-mobile-wallet-provider-Dg9_h3QI.js.map} +1 -1
  50. package/package.json +24 -24
  51. package/dist/index-6pNPzV1t.esm.js +0 -6
  52. package/dist/index-6pNPzV1t.esm.js.map +0 -1
  53. package/dist/index-BHGEc97p.js.map +0 -1
  54. package/dist/index-CiwYJvf8.esm.js.map +0 -1
  55. package/dist/index-CsIXFm8d.esm.js.map +0 -1
  56. package/dist/index-D9BY44i-.js +0 -8
  57. package/dist/index-D9BY44i-.js.map +0 -1
  58. package/dist/index-DwU9hjtr.js.map +0 -1
  59. package/dist/index-U-xlsKRI.esm.js.map +0 -1
  60. package/dist/index-zS_Y-wbi.js.map +0 -1
  61. package/dist/index.browser-C9bFQZyQ.esm.js.map +0 -1
  62. package/dist/index.browser-Dbq5Qf1G.esm.js.map +0 -1
  63. package/dist/index.browser-Df7yN8D5.js.map +0 -1
  64. package/dist/index.browser-dszs5oe5.js.map +0 -1
  65. package/dist/index.native-CEf5PJ_g.esm.js.map +0 -1
  66. package/dist/index.native-DtxPWD00.js.map +0 -1
  67. package/dist/privy-wallet-provider-CoQzq0F4.js.map +0 -1
  68. package/dist/privy-wallet-provider-DGjYglh7.esm.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
  }
@@ -6394,6 +6379,261 @@ var ReconnectingWebSocket = /** @class */ (function () {
6394
6379
  return ReconnectingWebSocket;
6395
6380
  }());
6396
6381
 
6382
+ function getDefaultExportFromCjs (x) {
6383
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6384
+ }
6385
+
6386
+ var isRetryAllowed$1;
6387
+ var hasRequiredIsRetryAllowed;
6388
+
6389
+ function requireIsRetryAllowed () {
6390
+ if (hasRequiredIsRetryAllowed) return isRetryAllowed$1;
6391
+ hasRequiredIsRetryAllowed = 1;
6392
+
6393
+ const denyList = new Set([
6394
+ 'ENOTFOUND',
6395
+ 'ENETUNREACH',
6396
+
6397
+ // SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
6398
+ 'UNABLE_TO_GET_ISSUER_CERT',
6399
+ 'UNABLE_TO_GET_CRL',
6400
+ 'UNABLE_TO_DECRYPT_CERT_SIGNATURE',
6401
+ 'UNABLE_TO_DECRYPT_CRL_SIGNATURE',
6402
+ 'UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
6403
+ 'CERT_SIGNATURE_FAILURE',
6404
+ 'CRL_SIGNATURE_FAILURE',
6405
+ 'CERT_NOT_YET_VALID',
6406
+ 'CERT_HAS_EXPIRED',
6407
+ 'CRL_NOT_YET_VALID',
6408
+ 'CRL_HAS_EXPIRED',
6409
+ 'ERROR_IN_CERT_NOT_BEFORE_FIELD',
6410
+ 'ERROR_IN_CERT_NOT_AFTER_FIELD',
6411
+ 'ERROR_IN_CRL_LAST_UPDATE_FIELD',
6412
+ 'ERROR_IN_CRL_NEXT_UPDATE_FIELD',
6413
+ 'OUT_OF_MEM',
6414
+ 'DEPTH_ZERO_SELF_SIGNED_CERT',
6415
+ 'SELF_SIGNED_CERT_IN_CHAIN',
6416
+ 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
6417
+ 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
6418
+ 'CERT_CHAIN_TOO_LONG',
6419
+ 'CERT_REVOKED',
6420
+ 'INVALID_CA',
6421
+ 'PATH_LENGTH_EXCEEDED',
6422
+ 'INVALID_PURPOSE',
6423
+ 'CERT_UNTRUSTED',
6424
+ 'CERT_REJECTED',
6425
+ 'HOSTNAME_MISMATCH'
6426
+ ]);
6427
+
6428
+ // TODO: Use `error?.code` when targeting Node.js 14
6429
+ isRetryAllowed$1 = error => !denyList.has(error && error.code);
6430
+ return isRetryAllowed$1;
6431
+ }
6432
+
6433
+ var isRetryAllowedExports = requireIsRetryAllowed();
6434
+ var isRetryAllowed = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowedExports);
6435
+
6436
+ const namespace = 'axios-retry';
6437
+ function isNetworkError(error) {
6438
+ const CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
6439
+ if (error.response) {
6440
+ return false;
6441
+ }
6442
+ if (!error.code) {
6443
+ return false;
6444
+ }
6445
+ // Prevents retrying timed out & cancelled requests
6446
+ if (CODE_EXCLUDE_LIST.includes(error.code)) {
6447
+ return false;
6448
+ }
6449
+ // Prevents retrying unsafe errors
6450
+ return isRetryAllowed(error);
6451
+ }
6452
+ const SAFE_HTTP_METHODS = ['get', 'head', 'options'];
6453
+ const IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
6454
+ function isRetryableError(error) {
6455
+ return (error.code !== 'ECONNABORTED' &&
6456
+ (!error.response ||
6457
+ error.response.status === 429 ||
6458
+ (error.response.status >= 500 && error.response.status <= 599)));
6459
+ }
6460
+ function isSafeRequestError(error) {
6461
+ if (!error.config?.method) {
6462
+ // Cannot determine if the request can be retried
6463
+ return false;
6464
+ }
6465
+ return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
6466
+ }
6467
+ function isIdempotentRequestError(error) {
6468
+ if (!error.config?.method) {
6469
+ // Cannot determine if the request can be retried
6470
+ return false;
6471
+ }
6472
+ return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
6473
+ }
6474
+ function isNetworkOrIdempotentRequestError(error) {
6475
+ return isNetworkError(error) || isIdempotentRequestError(error);
6476
+ }
6477
+ function retryAfter(error = undefined) {
6478
+ const retryAfterHeader = error?.response?.headers['retry-after'];
6479
+ if (!retryAfterHeader) {
6480
+ return 0;
6481
+ }
6482
+ // if the retry after header is a number, convert it to milliseconds
6483
+ let retryAfterMs = (Number(retryAfterHeader) || 0) * 1000;
6484
+ // If the retry after header is a date, get the number of milliseconds until that date
6485
+ if (retryAfterMs === 0) {
6486
+ retryAfterMs = (new Date(retryAfterHeader).valueOf() || 0) - Date.now();
6487
+ }
6488
+ return Math.max(0, retryAfterMs);
6489
+ }
6490
+ function noDelay(_retryNumber = 0, error = undefined) {
6491
+ return Math.max(0, retryAfter(error));
6492
+ }
6493
+ function exponentialDelay(retryNumber = 0, error = undefined, delayFactor = 100) {
6494
+ const calculatedDelay = 2 ** retryNumber * delayFactor;
6495
+ const delay = Math.max(calculatedDelay, retryAfter(error));
6496
+ const randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay
6497
+ return delay + randomSum;
6498
+ }
6499
+ /**
6500
+ * Linear delay
6501
+ * @param {number | undefined} delayFactor - delay factor in milliseconds (default: 100)
6502
+ * @returns {function} (retryNumber: number, error: AxiosError | undefined) => number
6503
+ */
6504
+ function linearDelay(delayFactor = 100) {
6505
+ return (retryNumber = 0, error = undefined) => {
6506
+ const delay = retryNumber * delayFactor;
6507
+ return Math.max(delay, retryAfter(error));
6508
+ };
6509
+ }
6510
+ const DEFAULT_OPTIONS = {
6511
+ retries: 3,
6512
+ retryCondition: isNetworkOrIdempotentRequestError,
6513
+ retryDelay: noDelay,
6514
+ shouldResetTimeout: false,
6515
+ onRetry: () => { },
6516
+ onMaxRetryTimesExceeded: () => { },
6517
+ validateResponse: null
6518
+ };
6519
+ function getRequestOptions(config, defaultOptions) {
6520
+ return { ...DEFAULT_OPTIONS, ...defaultOptions, ...config[namespace] };
6521
+ }
6522
+ function setCurrentState(config, defaultOptions, resetLastRequestTime = false) {
6523
+ const currentState = getRequestOptions(config, defaultOptions || {});
6524
+ currentState.retryCount = currentState.retryCount || 0;
6525
+ if (!currentState.lastRequestTime || resetLastRequestTime) {
6526
+ currentState.lastRequestTime = Date.now();
6527
+ }
6528
+ config[namespace] = currentState;
6529
+ return currentState;
6530
+ }
6531
+ function fixConfig(axiosInstance, config) {
6532
+ // @ts-ignore
6533
+ if (axiosInstance.defaults.agent === config.agent) {
6534
+ // @ts-ignore
6535
+ delete config.agent;
6536
+ }
6537
+ if (axiosInstance.defaults.httpAgent === config.httpAgent) {
6538
+ delete config.httpAgent;
6539
+ }
6540
+ if (axiosInstance.defaults.httpsAgent === config.httpsAgent) {
6541
+ delete config.httpsAgent;
6542
+ }
6543
+ }
6544
+ async function shouldRetry(currentState, error) {
6545
+ const { retries, retryCondition } = currentState;
6546
+ const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(error);
6547
+ // This could be a promise
6548
+ if (typeof shouldRetryOrPromise === 'object') {
6549
+ try {
6550
+ const shouldRetryPromiseResult = await shouldRetryOrPromise;
6551
+ // keep return true unless shouldRetryPromiseResult return false for compatibility
6552
+ return shouldRetryPromiseResult !== false;
6553
+ }
6554
+ catch (_err) {
6555
+ return false;
6556
+ }
6557
+ }
6558
+ return shouldRetryOrPromise;
6559
+ }
6560
+ async function handleRetry(axiosInstance, currentState, error, config) {
6561
+ currentState.retryCount += 1;
6562
+ const { retryDelay, shouldResetTimeout, onRetry } = currentState;
6563
+ const delay = retryDelay(currentState.retryCount, error);
6564
+ // Axios fails merging this configuration to the default configuration because it has an issue
6565
+ // with circular structures: https://github.com/mzabriskie/axios/issues/370
6566
+ fixConfig(axiosInstance, config);
6567
+ if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
6568
+ const lastRequestDuration = Date.now() - currentState.lastRequestTime;
6569
+ const timeout = config.timeout - lastRequestDuration - delay;
6570
+ if (timeout <= 0) {
6571
+ return Promise.reject(error);
6572
+ }
6573
+ config.timeout = timeout;
6574
+ }
6575
+ config.transformRequest = [(data) => data];
6576
+ await onRetry(currentState.retryCount, error, config);
6577
+ if (config.signal?.aborted) {
6578
+ return Promise.resolve(axiosInstance(config));
6579
+ }
6580
+ return new Promise((resolve) => {
6581
+ const abortListener = () => {
6582
+ clearTimeout(timeout);
6583
+ resolve(axiosInstance(config));
6584
+ };
6585
+ const timeout = setTimeout(() => {
6586
+ resolve(axiosInstance(config));
6587
+ if (config.signal?.removeEventListener) {
6588
+ config.signal.removeEventListener('abort', abortListener);
6589
+ }
6590
+ }, delay);
6591
+ if (config.signal?.addEventListener) {
6592
+ config.signal.addEventListener('abort', abortListener, { once: true });
6593
+ }
6594
+ });
6595
+ }
6596
+ async function handleMaxRetryTimesExceeded(currentState, error) {
6597
+ if (currentState.retryCount >= currentState.retries)
6598
+ await currentState.onMaxRetryTimesExceeded(error, currentState.retryCount);
6599
+ }
6600
+ const axiosRetry = (axiosInstance, defaultOptions) => {
6601
+ const requestInterceptorId = axiosInstance.interceptors.request.use((config) => {
6602
+ setCurrentState(config, defaultOptions, true);
6603
+ if (config[namespace]?.validateResponse) {
6604
+ // by setting this, all HTTP responses will be go through the error interceptor first
6605
+ config.validateStatus = () => false;
6606
+ }
6607
+ return config;
6608
+ });
6609
+ const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (error) => {
6610
+ const { config } = error;
6611
+ // If we have no information to retry the request
6612
+ if (!config) {
6613
+ return Promise.reject(error);
6614
+ }
6615
+ const currentState = setCurrentState(config, defaultOptions);
6616
+ if (error.response && currentState.validateResponse?.(error.response)) {
6617
+ // no issue with response
6618
+ return error.response;
6619
+ }
6620
+ if (await shouldRetry(currentState, error)) {
6621
+ return handleRetry(axiosInstance, currentState, error, config);
6622
+ }
6623
+ await handleMaxRetryTimesExceeded(currentState, error);
6624
+ return Promise.reject(error);
6625
+ });
6626
+ return { requestInterceptorId, responseInterceptorId };
6627
+ };
6628
+ // Compatibility with CommonJS
6629
+ axiosRetry.isNetworkError = isNetworkError;
6630
+ axiosRetry.isSafeRequestError = isSafeRequestError;
6631
+ axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
6632
+ axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
6633
+ axiosRetry.exponentialDelay = exponentialDelay;
6634
+ axiosRetry.linearDelay = linearDelay;
6635
+ axiosRetry.isRetryableError = isRetryableError;
6636
+
6397
6637
  let axiosClient;
6398
6638
  async function getAxiosAuthClient() {
6399
6639
  if (!axiosClient) {
@@ -6403,6 +6643,7 @@ async function getAxiosAuthClient() {
6403
6643
  headers: {
6404
6644
  'Content-Type': 'application/json',
6405
6645
  },
6646
+ timeout: 30000, // 30s timeout, matching makeApiRequest
6406
6647
  });
6407
6648
  }
6408
6649
  return axiosClient;
@@ -6449,15 +6690,41 @@ async function createSessionWithPrivy(authToken, address, privyIdToken) {
6449
6690
  });
6450
6691
  return response.data;
6451
6692
  }
6693
+ // Deduplicate concurrent refreshSession calls to prevent multiple code paths
6694
+ // (WebSocket reconnection, periodic refresh, API 401 retry) from all hitting
6695
+ // /session/refresh simultaneously.
6696
+ // Note: module-level state is shared across requests in SSR/Node — acceptable
6697
+ // since there is only one active session per server instance (same pattern as
6698
+ // refreshInFlight in api.ts).
6699
+ let refreshInFlight$1 = null;
6700
+ let refreshInFlightToken = null;
6452
6701
  async function refreshSession(refreshToken) {
6453
- const client = await getAxiosAuthClient();
6454
- const config = await getConfig();
6455
- const appId = config.appId;
6456
- const response = await client.post('/session/refresh', {
6457
- refreshToken,
6458
- appId
6459
- });
6460
- return response.data;
6702
+ if (refreshInFlight$1 && refreshInFlightToken === refreshToken) {
6703
+ return refreshInFlight$1;
6704
+ }
6705
+ refreshInFlightToken = refreshToken;
6706
+ let currentFlight;
6707
+ currentFlight = refreshInFlight$1 = (async () => {
6708
+ try {
6709
+ const client = await getAxiosAuthClient();
6710
+ const config = await getConfig();
6711
+ const appId = config.appId;
6712
+ const response = await client.post('/session/refresh', {
6713
+ refreshToken,
6714
+ appId
6715
+ });
6716
+ return response.data;
6717
+ }
6718
+ finally {
6719
+ // Only clear if we're still the active in-flight request.
6720
+ // A second call with a different token may have replaced us.
6721
+ if (refreshInFlight$1 === currentFlight) {
6722
+ refreshInFlight$1 = null;
6723
+ refreshInFlightToken = null;
6724
+ }
6725
+ }
6726
+ })();
6727
+ return refreshInFlight$1;
6461
6728
  }
6462
6729
  async function signSessionCreateMessage(_signMessageFunction) {
6463
6730
  }
@@ -6595,14 +6862,10 @@ class WebSessionManager {
6595
6862
  WebSessionManager.TAROBASE_SESSION_STORAGE_KEY = "tarobase_session_storage";
6596
6863
 
6597
6864
  var webSessionManager = /*#__PURE__*/Object.freeze({
6598
- __proto__: null,
6599
- WebSessionManager: WebSessionManager
6865
+ __proto__: null,
6866
+ WebSessionManager: WebSessionManager
6600
6867
  });
6601
6868
 
6602
- function getDefaultExportFromCjs (x) {
6603
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6604
- }
6605
-
6606
6869
  var buffer$1 = {};
6607
6870
 
6608
6871
  var base64Js$1 = {};
@@ -8974,15 +9237,15 @@ function requireBuffer$1 () {
8974
9237
 
8975
9238
  var bufferExports$1 = requireBuffer$1();
8976
9239
 
8977
- var safeBuffer$1 = {exports: {}};
9240
+ var safeBuffer = {exports: {}};
8978
9241
 
8979
9242
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
8980
9243
 
8981
- var hasRequiredSafeBuffer$1;
9244
+ var hasRequiredSafeBuffer;
8982
9245
 
8983
- function requireSafeBuffer$1 () {
8984
- if (hasRequiredSafeBuffer$1) return safeBuffer$1.exports;
8985
- hasRequiredSafeBuffer$1 = 1;
9246
+ function requireSafeBuffer () {
9247
+ if (hasRequiredSafeBuffer) return safeBuffer.exports;
9248
+ hasRequiredSafeBuffer = 1;
8986
9249
  (function (module, exports$1) {
8987
9250
  /* eslint-disable node/no-deprecated-api */
8988
9251
  var buffer = requireBuffer$1();
@@ -9048,23 +9311,23 @@ function requireSafeBuffer$1 () {
9048
9311
  }
9049
9312
  return buffer.SlowBuffer(size)
9050
9313
  };
9051
- } (safeBuffer$1, safeBuffer$1.exports));
9052
- return safeBuffer$1.exports;
9314
+ } (safeBuffer, safeBuffer.exports));
9315
+ return safeBuffer.exports;
9053
9316
  }
9054
9317
 
9055
- var src$1;
9056
- var hasRequiredSrc$1;
9318
+ var src;
9319
+ var hasRequiredSrc;
9057
9320
 
9058
- function requireSrc$1 () {
9059
- if (hasRequiredSrc$1) return src$1;
9060
- hasRequiredSrc$1 = 1;
9321
+ function requireSrc () {
9322
+ if (hasRequiredSrc) return src;
9323
+ hasRequiredSrc = 1;
9061
9324
  // base-x encoding / decoding
9062
9325
  // Copyright (c) 2018 base-x contributors
9063
9326
  // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
9064
9327
  // Distributed under the MIT software license, see the accompanying
9065
9328
  // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9066
9329
  // @ts-ignore
9067
- var _Buffer = requireSafeBuffer$1().Buffer;
9330
+ var _Buffer = requireSafeBuffer().Buffer;
9068
9331
  function base (ALPHABET) {
9069
9332
  if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
9070
9333
  var BASE_MAP = new Uint8Array(256);
@@ -9179,25 +9442,25 @@ function requireSrc$1 () {
9179
9442
  decode: decode
9180
9443
  }
9181
9444
  }
9182
- src$1 = base;
9183
- return src$1;
9445
+ src = base;
9446
+ return src;
9184
9447
  }
9185
9448
 
9186
- var bs58$1$1;
9187
- var hasRequiredBs58$1;
9449
+ var bs58$1;
9450
+ var hasRequiredBs58;
9188
9451
 
9189
- function requireBs58$1 () {
9190
- if (hasRequiredBs58$1) return bs58$1$1;
9191
- hasRequiredBs58$1 = 1;
9192
- var basex = requireSrc$1();
9452
+ function requireBs58 () {
9453
+ if (hasRequiredBs58) return bs58$1;
9454
+ hasRequiredBs58 = 1;
9455
+ var basex = requireSrc();
9193
9456
  var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9194
9457
 
9195
- bs58$1$1 = basex(ALPHABET);
9196
- return bs58$1$1;
9458
+ bs58$1 = basex(ALPHABET);
9459
+ return bs58$1;
9197
9460
  }
9198
9461
 
9199
- var bs58Exports$1 = requireBs58$1();
9200
- var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports$1);
9462
+ var bs58Exports = requireBs58();
9463
+ var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
9201
9464
 
9202
9465
  // ─────────────────────────────────────────────────────────────
9203
9466
  // Local implementation of getSimulationComputeUnits
@@ -9399,7 +9662,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
9399
9662
  }
9400
9663
  }
9401
9664
  else if (lutKey != null) {
9402
- const { value: table } = await connection.getAddressLookupTable(new PublicKey(lutKey));
9665
+ // The LUT may have just been created server-side and the client's RPC node
9666
+ // may not have indexed it yet (load-balancer split). Retry with exponential
9667
+ // back-off; first retry at 100 ms almost always resolves it.
9668
+ let table = null;
9669
+ for (let attempt = 0; attempt < 5; attempt++) {
9670
+ const { value } = await connection.getAddressLookupTable(new PublicKey(lutKey));
9671
+ if (value) {
9672
+ table = value;
9673
+ break;
9674
+ }
9675
+ if (attempt < 4)
9676
+ await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
9677
+ }
9403
9678
  if (!table)
9404
9679
  throw new Error('LUT not found after creation/extend');
9405
9680
  lookupTables.push(table);
@@ -9534,8 +9809,8 @@ class ServerSessionManager {
9534
9809
  ServerSessionManager.instance = new ServerSessionManager();
9535
9810
 
9536
9811
  var serverSessionManager = /*#__PURE__*/Object.freeze({
9537
- __proto__: null,
9538
- ServerSessionManager: ServerSessionManager
9812
+ __proto__: null,
9813
+ ServerSessionManager: ServerSessionManager
9539
9814
  });
9540
9815
 
9541
9816
  /**
@@ -9634,6 +9909,23 @@ async function updateIdTokenAndAccessToken(idToken, accessToken, isServer = fals
9634
9909
  await WebSessionManager.updateIdTokenAndAccessToken(idToken, accessToken);
9635
9910
  }
9636
9911
 
9912
+ const apiClient = globalAxios.create();
9913
+ axiosRetry(apiClient, {
9914
+ retries: 2,
9915
+ retryCondition: (error) => {
9916
+ var _a, _b;
9917
+ // Only retry GET requests on network errors (ECONNRESET, ETIMEDOUT, etc.)
9918
+ // Writes (POST/PUT) are not retried — the server may have processed
9919
+ // the request before the connection was reset.
9920
+ return axiosRetry.isNetworkError(error) && ((_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'get';
9921
+ },
9922
+ retryDelay: axiosRetry.exponentialDelay,
9923
+ shouldResetTimeout: true,
9924
+ onRetry: (retryCount, error, requestConfig) => {
9925
+ var _a;
9926
+ console.warn(`[tarobase-sdk] retry ${retryCount} for ${(_a = requestConfig.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()} ${requestConfig.url} — ${error.code || error.message}`);
9927
+ },
9928
+ });
9637
9929
  const refreshInFlight = new Map();
9638
9930
  async function refreshAuthSessionOnce(appId, isServer) {
9639
9931
  const key = `${isServer ? "server" : "web"}:${appId}`;
@@ -9680,6 +9972,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
9680
9972
  ServerSessionManager.instance.clearSession();
9681
9973
  };
9682
9974
  async function executeRequest() {
9975
+ var _a;
9683
9976
  // When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
9684
9977
  // Otherwise use the global createAuthHeader (default path).
9685
9978
  const authHeader = (_overrides === null || _overrides === void 0 ? void 0 : _overrides._getAuthHeaders)
@@ -9701,11 +9994,12 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
9701
9994
  method,
9702
9995
  url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
9703
9996
  headers,
9997
+ timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : 30000,
9704
9998
  };
9705
9999
  if (method !== "GET" && method !== "get") {
9706
10000
  requestConfig.data = data ? JSON.stringify(data) : {};
9707
10001
  }
9708
- const response = await globalAxios(requestConfig);
10002
+ const response = await apiClient(requestConfig);
9709
10003
  return { data: response.data, status: response.status, headers: response.headers };
9710
10004
  }
9711
10005
  try {
@@ -10641,6 +10935,7 @@ function scheduleTokenRefresh(connection, isServer) {
10641
10935
  // This replaces the old single setTimeout approach which was unreliable for long
10642
10936
  // delays (browsers throttle/suspend timers in background tabs).
10643
10937
  connection.tokenRefreshTimer = setInterval(async () => {
10938
+ var _a, _b;
10644
10939
  try {
10645
10940
  const currentToken = await getIdToken$1(isServer);
10646
10941
  if (!currentToken)
@@ -10671,6 +10966,17 @@ function scheduleTokenRefresh(connection, isServer) {
10671
10966
  }
10672
10967
  }
10673
10968
  catch (refreshError) {
10969
+ // If the refresh token itself is invalid (401/403), stop retrying —
10970
+ // the token won't magically become valid next interval, and continuing
10971
+ // to hammer /session/refresh causes 429 rate-limit storms.
10972
+ if (((_a = refreshError === null || refreshError === void 0 ? void 0 : refreshError.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = refreshError === null || refreshError === void 0 ? void 0 : refreshError.response) === null || _b === void 0 ? void 0 : _b.status) === 403) {
10973
+ console.warn('[WS v2] Refresh token rejected (401/403), stopping periodic refresh');
10974
+ if (connection.tokenRefreshTimer) {
10975
+ clearInterval(connection.tokenRefreshTimer);
10976
+ connection.tokenRefreshTimer = null;
10977
+ }
10978
+ return;
10979
+ }
10674
10980
  console.warn('[WS v2] Proactive token refresh failed, will retry next interval:', refreshError);
10675
10981
  }
10676
10982
  }
@@ -10681,6 +10987,7 @@ function scheduleTokenRefresh(connection, isServer) {
10681
10987
  }, TOKEN_CHECK_INTERVAL);
10682
10988
  }
10683
10989
  async function getFreshAuthToken(isServer) {
10990
+ var _a, _b;
10684
10991
  const currentToken = await getIdToken$1(isServer);
10685
10992
  if (!currentToken) {
10686
10993
  return null;
@@ -10703,6 +11010,17 @@ async function getFreshAuthToken(isServer) {
10703
11010
  }
10704
11011
  catch (error) {
10705
11012
  console.error('[WS v2] Error refreshing token:', error);
11013
+ // If the refresh token is permanently invalid (401/403), clear the stale
11014
+ // session from storage so future attempts don't keep retrying with it.
11015
+ if (!isServer && (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) === 403)) {
11016
+ try {
11017
+ const { WebSessionManager } = await Promise.resolve().then(function () { return webSessionManager; });
11018
+ WebSessionManager.clearSession();
11019
+ }
11020
+ catch (clearError) {
11021
+ console.warn('[WS v2] Failed to clear stale session:', clearError);
11022
+ }
11023
+ }
10706
11024
  }
10707
11025
  // Return null instead of the expired token to prevent infinite 401 reconnect storms.
10708
11026
  // The server accepts unauthenticated connections; auth-required subscriptions will
@@ -10823,7 +11141,16 @@ async function getOrCreateConnection(appId, isServer) {
10823
11141
  ws.addEventListener('open', () => {
10824
11142
  connection.isConnecting = false;
10825
11143
  connection.isConnected = true;
10826
- connection.consecutiveAuthFailures = 0;
11144
+ // NOTE: Do NOT reset consecutiveAuthFailures here. It is reset when a
11145
+ // fresh auth token is actually obtained (in urlProvider, line ~389) or on
11146
+ // an explicit auth change (reconnectWithNewAuthV2, line ~854). Resetting
11147
+ // on every 'open' event created an infinite loop: auth fails 5x → connect
11148
+ // without auth → open resets counter → disconnect → auth fails 5x again →
11149
+ // repeat forever, hammering /session/refresh and causing 429s.
11150
+ //
11151
+ // An elevated counter is safe for anonymous/guest sessions: when there's no
11152
+ // token at all (getIdToken returns null), the counter is never checked —
11153
+ // urlProvider skips straight to unauthenticated connection.
10827
11154
  // Schedule periodic token freshness checks
10828
11155
  scheduleTokenRefresh(connection, isServer);
10829
11156
  // Re-subscribe to all existing subscriptions after reconnect
@@ -15321,7 +15648,7 @@ async function loadDependencies() {
15321
15648
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15322
15649
  import('react'),
15323
15650
  import('react-dom/client'),
15324
- import('./index-U-xlsKRI.esm.js')
15651
+ import('./index-CtwdL0-L.esm.js')
15325
15652
  ]);
15326
15653
  // Extract default export from ESM module namespace
15327
15654
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -15364,8 +15691,13 @@ class PhantomWalletProvider {
15364
15691
  async initializeAsync() {
15365
15692
  // Lazy load dependencies only when actually instantiating
15366
15693
  await loadDependencies();
15367
- // Initialize React component
15368
- this.initialize();
15694
+ // Initialize React component eagerly only when there's a real reason to
15695
+ // (URL callback to consume, prior session to restore, in-page wallet,
15696
+ // or non-Android). Otherwise defer until ensureReady() is reached from
15697
+ // a user-gesture flow. See shouldMountEagerly() for the rationale.
15698
+ if (this.shouldMountEagerly()) {
15699
+ this.initialize();
15700
+ }
15369
15701
  }
15370
15702
  /**
15371
15703
  * Check if social login providers are configured (non-injected providers).
@@ -15373,6 +15705,69 @@ class PhantomWalletProvider {
15373
15705
  hasSocialProviders() {
15374
15706
  return this.resolvedProviders.some(p => p !== 'injected');
15375
15707
  }
15708
+ /**
15709
+ * Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
15710
+ * eagerly during init() or defer until the first user-triggered call
15711
+ * (login / sign / etc.) reaches ensureReady().
15712
+ *
15713
+ * Mounting the React tree synchronously constructs BrowserSDK, which runs
15714
+ * wallet-standard discovery in its constructor and fires sdk.autoConnect()
15715
+ * in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
15716
+ * pathways probe the Android intent surface to discover the Phantom mobile
15717
+ * app, which surfaces Chrome's system "wants to access other apps and
15718
+ * services" permission dialog *before* the PWA activity has window focus.
15719
+ * The dialog renders with grayed-out buttons until the user backgrounds
15720
+ * and resumes the app.
15721
+ *
15722
+ * Returns true when eager mount is needed (callback to handle, prior
15723
+ * session, in-page wallet present, or non-Android). Otherwise returns
15724
+ * false — the React tree is mounted lazily inside ensureReady() once a
15725
+ * user gesture brings us there.
15726
+ */
15727
+ shouldMountEagerly() {
15728
+ if (typeof window === 'undefined')
15729
+ return false;
15730
+ // Preserve desktop behavior: always mount eagerly.
15731
+ if (!detectAndroid())
15732
+ return true;
15733
+ // In-page wallet present (Phantom in-app browser / desktop extension on
15734
+ // a desktop-mode Android UA): no Android intent probe needed, mount free.
15735
+ // Tighten beyond truthy `window.phantom` since arbitrary stubs can land
15736
+ // on that key — require a wallet-shaped surface.
15737
+ const ph = window.phantom;
15738
+ if (ph && (ph.solana || ph.ethereum || ph.app))
15739
+ return true;
15740
+ // Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
15741
+ // be live to read these URL params via urlParamsAccessor.
15742
+ const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
15743
+ try {
15744
+ const params = new URLSearchParams(window.location.search);
15745
+ if (callbackKeys.some(k => params.has(k)))
15746
+ return true;
15747
+ }
15748
+ catch (_a) {
15749
+ return true; // conservative on URL access failure
15750
+ }
15751
+ // Returning user with a stored Phantom session. They've already
15752
+ // approved the Android intent permission for this origin on first
15753
+ // login, so the dialog is typically pre-granted by Chrome — eager
15754
+ // mount lets autoConnect silently restore the wallet handshake.
15755
+ // Require BOTH the marker AND a session storage entry so a stale
15756
+ // orphaned marker doesn't keep eager-mounting forever. Note
15757
+ // isAuthenticated() is a raw key-existence check, not a validity
15758
+ // check — restoreSession() above clears the marker on the next load
15759
+ // if the session is unusable, so the bug self-corrects after at
15760
+ // most one further cold start.
15761
+ try {
15762
+ const stored = getPlatform().storage.getItem('tarobase_last_auth_method');
15763
+ if (stored === 'phantom' && WebSessionManager.isAuthenticated())
15764
+ return true;
15765
+ }
15766
+ catch (_b) {
15767
+ return true;
15768
+ }
15769
+ return false;
15770
+ }
15376
15771
  static getInstance(networkUrl, config) {
15377
15772
  if (!PhantomWalletProvider.instance) {
15378
15773
  new PhantomWalletProvider(networkUrl, config);
@@ -16049,6 +16444,13 @@ class PhantomWalletProvider {
16049
16444
  if (this.initPromise) {
16050
16445
  await this.initPromise;
16051
16446
  }
16447
+ // Lazy-mount path: if initializeAsync deferred the React mount (e.g.
16448
+ // first-time visitor on Android Chrome PWA), do it now. We're being
16449
+ // called from a user-gesture flow like login(), so any Android intent
16450
+ // dialog that surfaces will appear with the activity already focused.
16451
+ if (!this.containerElement) {
16452
+ this.initialize();
16453
+ }
16052
16454
  // Wait for SDK to be ready
16053
16455
  await new Promise((resolve) => {
16054
16456
  const check = () => {
@@ -16158,12 +16560,53 @@ class PhantomWalletProvider {
16158
16560
  });
16159
16561
  }
16160
16562
  async restoreSession() {
16161
- await this.ensureReady();
16162
- const session = await WebSessionManager.getSession();
16163
- if (session) {
16164
- return { provider: this, address: session.address };
16563
+ // Read from storage directly. Do NOT ensureReady() here — that would
16564
+ // mount @phantom/react-sdk's <PhantomProvider> during init(), which
16565
+ // synchronously constructs BrowserSDK (running wallet-standard discovery)
16566
+ // and fires sdk.autoConnect() both probing the Android intent surface
16567
+ // before the PWA activity has window focus on Solana Seeker. The
16568
+ // resulting "access other apps and services" system dialog renders
16569
+ // with grayed-out buttons.
16570
+ //
16571
+ // Wrap getSession() in try/catch: WebSessionManager.getSession() runs
16572
+ // JSON.parse on the stored session *outside* its internal try/catch,
16573
+ // so genuinely malformed JSON in localStorage would propagate through
16574
+ // restoreSession() and break init() entirely. Treat any throw as
16575
+ // "no session" and fall through to the cleanup path so corrupted
16576
+ // storage is recoverable on next load.
16577
+ let session;
16578
+ try {
16579
+ session = await WebSessionManager.getSession();
16165
16580
  }
16166
- return null;
16581
+ catch (_a) {
16582
+ session = null;
16583
+ }
16584
+ if (!session) {
16585
+ // Tidy up storage so we don't leave junk behind:
16586
+ // (a) clearSession() removes any stale or unparseable session
16587
+ // storage entry. WebSessionManager.getSession() can't reach
16588
+ // its own clearSession() if JSON.parse threw. Idempotent —
16589
+ // safe to call unconditionally here.
16590
+ // (b) Drop the auth-method marker if it's stale.
16591
+ // WebSessionManager.clearSession() only removes the session
16592
+ // storage key, not the marker — so without this cleanup
16593
+ // shouldMountEagerly() would keep eager-mounting on every
16594
+ // future cold start.
16595
+ try {
16596
+ WebSessionManager.clearSession();
16597
+ }
16598
+ catch ( /* best-effort */_b) { /* best-effort */ }
16599
+ try {
16600
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
16601
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
16602
+ }
16603
+ }
16604
+ catch (_c) {
16605
+ // storage unavailable — best-effort cleanup
16606
+ }
16607
+ return null;
16608
+ }
16609
+ return { provider: this, address: session.address };
16167
16610
  }
16168
16611
  async address() {
16169
16612
  var _a, _b, _c, _d;
@@ -19654,235 +20097,137 @@ function createSolanaRpcSubscriptionsFromTransport(transport) {
19654
20097
  });
19655
20098
  }
19656
20099
 
19657
- var safeBuffer = {exports: {}};
19658
-
19659
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
19660
-
19661
- var hasRequiredSafeBuffer;
19662
-
19663
- function requireSafeBuffer () {
19664
- if (hasRequiredSafeBuffer) return safeBuffer.exports;
19665
- hasRequiredSafeBuffer = 1;
19666
- (function (module, exports$1) {
19667
- /* eslint-disable node/no-deprecated-api */
19668
- var buffer = requireBuffer();
19669
- var Buffer = buffer.Buffer;
19670
-
19671
- // alternative to using Object.keys for old browsers
19672
- function copyProps (src, dst) {
19673
- for (var key in src) {
19674
- dst[key] = src[key];
19675
- }
19676
- }
19677
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
19678
- module.exports = buffer;
19679
- } else {
19680
- // Copy properties from require('buffer')
19681
- copyProps(buffer, exports$1);
19682
- exports$1.Buffer = SafeBuffer;
19683
- }
19684
-
19685
- function SafeBuffer (arg, encodingOrOffset, length) {
19686
- return Buffer(arg, encodingOrOffset, length)
19687
- }
19688
-
19689
- SafeBuffer.prototype = Object.create(Buffer.prototype);
19690
-
19691
- // Copy static methods from Buffer
19692
- copyProps(Buffer, SafeBuffer);
19693
-
19694
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
19695
- if (typeof arg === 'number') {
19696
- throw new TypeError('Argument must not be a number')
19697
- }
19698
- return Buffer(arg, encodingOrOffset, length)
19699
- };
19700
-
19701
- SafeBuffer.alloc = function (size, fill, encoding) {
19702
- if (typeof size !== 'number') {
19703
- throw new TypeError('Argument must be a number')
19704
- }
19705
- var buf = Buffer(size);
19706
- if (fill !== undefined) {
19707
- if (typeof encoding === 'string') {
19708
- buf.fill(fill, encoding);
19709
- } else {
19710
- buf.fill(fill);
19711
- }
19712
- } else {
19713
- buf.fill(0);
19714
- }
19715
- return buf
19716
- };
19717
-
19718
- SafeBuffer.allocUnsafe = function (size) {
19719
- if (typeof size !== 'number') {
19720
- throw new TypeError('Argument must be a number')
19721
- }
19722
- return Buffer(size)
19723
- };
19724
-
19725
- SafeBuffer.allocUnsafeSlow = function (size) {
19726
- if (typeof size !== 'number') {
19727
- throw new TypeError('Argument must be a number')
19728
- }
19729
- return buffer.SlowBuffer(size)
19730
- };
19731
- } (safeBuffer, safeBuffer.exports));
19732
- return safeBuffer.exports;
19733
- }
19734
-
19735
- var src;
19736
- var hasRequiredSrc;
19737
-
19738
- function requireSrc () {
19739
- if (hasRequiredSrc) return src;
19740
- hasRequiredSrc = 1;
19741
- // base-x encoding / decoding
19742
- // Copyright (c) 2018 base-x contributors
19743
- // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
19744
- // Distributed under the MIT software license, see the accompanying
19745
- // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
19746
- // @ts-ignore
19747
- var _Buffer = requireSafeBuffer().Buffer;
19748
- function base (ALPHABET) {
19749
- if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
19750
- var BASE_MAP = new Uint8Array(256);
19751
- for (var j = 0; j < BASE_MAP.length; j++) {
19752
- BASE_MAP[j] = 255;
19753
- }
19754
- for (var i = 0; i < ALPHABET.length; i++) {
19755
- var x = ALPHABET.charAt(i);
19756
- var xc = x.charCodeAt(0);
19757
- if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
19758
- BASE_MAP[xc] = i;
19759
- }
19760
- var BASE = ALPHABET.length;
19761
- var LEADER = ALPHABET.charAt(0);
19762
- var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
19763
- var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
19764
- function encode (source) {
19765
- if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }
19766
- if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }
19767
- if (source.length === 0) { return '' }
19768
- // Skip & count leading zeroes.
19769
- var zeroes = 0;
19770
- var length = 0;
19771
- var pbegin = 0;
19772
- var pend = source.length;
19773
- while (pbegin !== pend && source[pbegin] === 0) {
19774
- pbegin++;
19775
- zeroes++;
19776
- }
19777
- // Allocate enough space in big-endian base58 representation.
19778
- var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
19779
- var b58 = new Uint8Array(size);
19780
- // Process the bytes.
19781
- while (pbegin !== pend) {
19782
- var carry = source[pbegin];
19783
- // Apply "b58 = b58 * 256 + ch".
19784
- var i = 0;
19785
- for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
19786
- carry += (256 * b58[it1]) >>> 0;
19787
- b58[it1] = (carry % BASE) >>> 0;
19788
- carry = (carry / BASE) >>> 0;
19789
- }
19790
- if (carry !== 0) { throw new Error('Non-zero carry') }
19791
- length = i;
19792
- pbegin++;
19793
- }
19794
- // Skip leading zeroes in base58 result.
19795
- var it2 = size - length;
19796
- while (it2 !== size && b58[it2] === 0) {
19797
- it2++;
19798
- }
19799
- // Translate the result into a string.
19800
- var str = LEADER.repeat(zeroes);
19801
- for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
19802
- return str
19803
- }
19804
- function decodeUnsafe (source) {
19805
- if (typeof source !== 'string') { throw new TypeError('Expected String') }
19806
- if (source.length === 0) { return _Buffer.alloc(0) }
19807
- var psz = 0;
19808
- // Skip and count leading '1's.
19809
- var zeroes = 0;
19810
- var length = 0;
19811
- while (source[psz] === LEADER) {
19812
- zeroes++;
19813
- psz++;
19814
- }
19815
- // Allocate enough space in big-endian base256 representation.
19816
- var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
19817
- var b256 = new Uint8Array(size);
19818
- // Process the characters.
19819
- while (psz < source.length) {
19820
- // Find code of next character
19821
- var charCode = source.charCodeAt(psz);
19822
- // Base map can not be indexed using char code
19823
- if (charCode > 255) { return }
19824
- // Decode character
19825
- var carry = BASE_MAP[charCode];
19826
- // Invalid character
19827
- if (carry === 255) { return }
19828
- var i = 0;
19829
- for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
19830
- carry += (BASE * b256[it3]) >>> 0;
19831
- b256[it3] = (carry % 256) >>> 0;
19832
- carry = (carry / 256) >>> 0;
19833
- }
19834
- if (carry !== 0) { throw new Error('Non-zero carry') }
19835
- length = i;
19836
- psz++;
19837
- }
19838
- // Skip leading zeroes in b256.
19839
- var it4 = size - length;
19840
- while (it4 !== size && b256[it4] === 0) {
19841
- it4++;
19842
- }
19843
- var vch = _Buffer.allocUnsafe(zeroes + (size - it4));
19844
- vch.fill(0x00, 0, zeroes);
19845
- var j = zeroes;
19846
- while (it4 !== size) {
19847
- vch[j++] = b256[it4++];
19848
- }
19849
- return vch
19850
- }
19851
- function decode (string) {
19852
- var buffer = decodeUnsafe(string);
19853
- if (buffer) { return buffer }
19854
- throw new Error('Non-base' + BASE + ' character')
19855
- }
19856
- return {
19857
- encode: encode,
19858
- decodeUnsafe: decodeUnsafe,
19859
- decode: decode
19860
- }
19861
- }
19862
- src = base;
19863
- return src;
19864
- }
19865
-
19866
- var bs58$1;
19867
- var hasRequiredBs58;
19868
-
19869
- function requireBs58 () {
19870
- if (hasRequiredBs58) return bs58$1;
19871
- hasRequiredBs58 = 1;
19872
- var basex = requireSrc();
19873
- var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
19874
-
19875
- bs58$1 = basex(ALPHABET);
19876
- return bs58$1;
20100
+ // base-x encoding / decoding
20101
+ // Copyright (c) 2018 base-x contributors
20102
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
20103
+ // Distributed under the MIT software license, see the accompanying
20104
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
20105
+ function base (ALPHABET) {
20106
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
20107
+ const BASE_MAP = new Uint8Array(256);
20108
+ for (let j = 0; j < BASE_MAP.length; j++) {
20109
+ BASE_MAP[j] = 255;
20110
+ }
20111
+ for (let i = 0; i < ALPHABET.length; i++) {
20112
+ const x = ALPHABET.charAt(i);
20113
+ const xc = x.charCodeAt(0);
20114
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
20115
+ BASE_MAP[xc] = i;
20116
+ }
20117
+ const BASE = ALPHABET.length;
20118
+ const LEADER = ALPHABET.charAt(0);
20119
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
20120
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
20121
+ function encode (source) {
20122
+ // eslint-disable-next-line no-empty
20123
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
20124
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
20125
+ } else if (Array.isArray(source)) {
20126
+ source = Uint8Array.from(source);
20127
+ }
20128
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
20129
+ if (source.length === 0) { return '' }
20130
+ // Skip & count leading zeroes.
20131
+ let zeroes = 0;
20132
+ let length = 0;
20133
+ let pbegin = 0;
20134
+ const pend = source.length;
20135
+ while (pbegin !== pend && source[pbegin] === 0) {
20136
+ pbegin++;
20137
+ zeroes++;
20138
+ }
20139
+ // Allocate enough space in big-endian base58 representation.
20140
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
20141
+ const b58 = new Uint8Array(size);
20142
+ // Process the bytes.
20143
+ while (pbegin !== pend) {
20144
+ let carry = source[pbegin];
20145
+ // Apply "b58 = b58 * 256 + ch".
20146
+ let i = 0;
20147
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
20148
+ carry += (256 * b58[it1]) >>> 0;
20149
+ b58[it1] = (carry % BASE) >>> 0;
20150
+ carry = (carry / BASE) >>> 0;
20151
+ }
20152
+ if (carry !== 0) { throw new Error('Non-zero carry') }
20153
+ length = i;
20154
+ pbegin++;
20155
+ }
20156
+ // Skip leading zeroes in base58 result.
20157
+ let it2 = size - length;
20158
+ while (it2 !== size && b58[it2] === 0) {
20159
+ it2++;
20160
+ }
20161
+ // Translate the result into a string.
20162
+ let str = LEADER.repeat(zeroes);
20163
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
20164
+ return str
20165
+ }
20166
+ function decodeUnsafe (source) {
20167
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
20168
+ if (source.length === 0) { return new Uint8Array() }
20169
+ let psz = 0;
20170
+ // Skip and count leading '1's.
20171
+ let zeroes = 0;
20172
+ let length = 0;
20173
+ while (source[psz] === LEADER) {
20174
+ zeroes++;
20175
+ psz++;
20176
+ }
20177
+ // Allocate enough space in big-endian base256 representation.
20178
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
20179
+ const b256 = new Uint8Array(size);
20180
+ // Process the characters.
20181
+ while (psz < source.length) {
20182
+ // Find code of next character
20183
+ const charCode = source.charCodeAt(psz);
20184
+ // Base map can not be indexed using char code
20185
+ if (charCode > 255) { return }
20186
+ // Decode character
20187
+ let carry = BASE_MAP[charCode];
20188
+ // Invalid character
20189
+ if (carry === 255) { return }
20190
+ let i = 0;
20191
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
20192
+ carry += (BASE * b256[it3]) >>> 0;
20193
+ b256[it3] = (carry % 256) >>> 0;
20194
+ carry = (carry / 256) >>> 0;
20195
+ }
20196
+ if (carry !== 0) { throw new Error('Non-zero carry') }
20197
+ length = i;
20198
+ psz++;
20199
+ }
20200
+ // Skip leading zeroes in b256.
20201
+ let it4 = size - length;
20202
+ while (it4 !== size && b256[it4] === 0) {
20203
+ it4++;
20204
+ }
20205
+ const vch = new Uint8Array(zeroes + (size - it4));
20206
+ let j = zeroes;
20207
+ while (it4 !== size) {
20208
+ vch[j++] = b256[it4++];
20209
+ }
20210
+ return vch
20211
+ }
20212
+ function decode (string) {
20213
+ const buffer = decodeUnsafe(string);
20214
+ if (buffer) { return buffer }
20215
+ throw new Error('Non-base' + BASE + ' character')
20216
+ }
20217
+ return {
20218
+ encode,
20219
+ decodeUnsafe,
20220
+ decode
20221
+ }
19877
20222
  }
19878
20223
 
19879
- var bs58Exports = requireBs58();
19880
- var bs58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
20224
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
20225
+ var bs58 = base(ALPHABET);
19881
20226
 
19882
- var index = /*#__PURE__*/_mergeNamespaces({
20227
+ var index = /*#__PURE__*/Object.freeze({
19883
20228
  __proto__: null,
19884
20229
  default: bs58
19885
- }, [bs58Exports]);
20230
+ });
19886
20231
 
19887
20232
  const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
19888
20233
  let React;
@@ -20796,7 +21141,7 @@ async function loadMwaProtocol() {
20796
21141
  return mwaProtocolLoadPromise;
20797
21142
  mwaProtocolLoadPromise = (async () => {
20798
21143
  try {
20799
- mwaProtocolModule = await import('./index.browser-Dbq5Qf1G.esm.js');
21144
+ mwaProtocolModule = await import('./index.browser-9JJy5Y7o.esm.js');
20800
21145
  }
20801
21146
  catch (e) {
20802
21147
  console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
@@ -20818,7 +21163,7 @@ async function registerMobileWalletAdapter(config) {
20818
21163
  if (typeof window === 'undefined')
20819
21164
  return;
20820
21165
  try {
20821
- const walletStandardMobile = await import('./index.browser-CMEwqnEe.esm.js');
21166
+ const walletStandardMobile = await import('./index.browser-HEDpODB5.esm.js');
20822
21167
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
20823
21168
  if (!registerMwa) {
20824
21169
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21726,5 +22071,5 @@ class PrivyExpoProvider {
21726
22071
  }
21727
22072
  }
21728
22073
 
21729
- export { getMany as $, useAuth as A, deserializeTransaction as B, getIdToken as C, setPlatform as D, getPlatform as E, PrivyWalletProvider as F, DEFAULT_TEST_ADDRESS as G, isMobileWalletAvailable as H, registerMobileWalletAdapter as I, PrivyExpoProvider as J, InsufficientBalanceError as K, ServerSessionManager as L, MockAuthProvider as M, buildSetDocumentsTransaction as N, OffchainAuthProvider as O, PhantomWalletProvider as P, clearCache as Q, ReactNativeSessionManager as R, SolanaMobileWalletProvider as S, closeAllSubscriptions as T, convertRemainingAccounts as U, createSessionWithPrivy as V, WebSessionManager as W, createSessionWithSignature as X, genAuthNonce as Y, genSolanaMessage as Z, getCachedData as _, getCurrentUser as a, reconnectWithNewAuth as a0, refreshSession as a1, signSessionCreateMessage as a2, bufferExports as b, onAuthLoadingChanged as c, getAuthLoading as d, logout as e, getConfig as f, getDefaultExportFromCjs$1 as g, getAuthProvider as h, init as i, get as j, setMany as k, login as l, setFile as m, getFiles as n, onAuthStateChanged as o, runQueryMany as p, runExpression as q, runQuery as r, set as s, runExpressionMany as t, signMessage as u, signTransaction as v, signAndSubmitTransaction as w, count as x, aggregate as y, subscribe as z };
21730
- //# sourceMappingURL=index-CsIXFm8d.esm.js.map
22074
+ 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 _, bs58 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 };
22075
+ //# sourceMappingURL=index-Cpw11-0x.esm.js.map