@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
@@ -22,21 +22,6 @@ function _interopNamespaceDefault(e) {
22
22
  return Object.freeze(n);
23
23
  }
24
24
 
25
- function _mergeNamespaces(n, m) {
26
- m.forEach(function (e) {
27
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
28
- if (k !== 'default' && !(k in n)) {
29
- var d = Object.getOwnPropertyDescriptor(e, k);
30
- Object.defineProperty(n, k, d.get ? d : {
31
- enumerable: true,
32
- get: function () { return e[k]; }
33
- });
34
- }
35
- });
36
- });
37
- return Object.freeze(n);
38
- }
39
-
40
25
  var anchor__namespace = /*#__PURE__*/_interopNamespaceDefault(anchor);
41
26
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React$2);
42
27
 
@@ -6415,6 +6400,261 @@ var ReconnectingWebSocket = /** @class */ (function () {
6415
6400
  return ReconnectingWebSocket;
6416
6401
  }());
6417
6402
 
6403
+ function getDefaultExportFromCjs (x) {
6404
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6405
+ }
6406
+
6407
+ var isRetryAllowed$1;
6408
+ var hasRequiredIsRetryAllowed;
6409
+
6410
+ function requireIsRetryAllowed () {
6411
+ if (hasRequiredIsRetryAllowed) return isRetryAllowed$1;
6412
+ hasRequiredIsRetryAllowed = 1;
6413
+
6414
+ const denyList = new Set([
6415
+ 'ENOTFOUND',
6416
+ 'ENETUNREACH',
6417
+
6418
+ // SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
6419
+ 'UNABLE_TO_GET_ISSUER_CERT',
6420
+ 'UNABLE_TO_GET_CRL',
6421
+ 'UNABLE_TO_DECRYPT_CERT_SIGNATURE',
6422
+ 'UNABLE_TO_DECRYPT_CRL_SIGNATURE',
6423
+ 'UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
6424
+ 'CERT_SIGNATURE_FAILURE',
6425
+ 'CRL_SIGNATURE_FAILURE',
6426
+ 'CERT_NOT_YET_VALID',
6427
+ 'CERT_HAS_EXPIRED',
6428
+ 'CRL_NOT_YET_VALID',
6429
+ 'CRL_HAS_EXPIRED',
6430
+ 'ERROR_IN_CERT_NOT_BEFORE_FIELD',
6431
+ 'ERROR_IN_CERT_NOT_AFTER_FIELD',
6432
+ 'ERROR_IN_CRL_LAST_UPDATE_FIELD',
6433
+ 'ERROR_IN_CRL_NEXT_UPDATE_FIELD',
6434
+ 'OUT_OF_MEM',
6435
+ 'DEPTH_ZERO_SELF_SIGNED_CERT',
6436
+ 'SELF_SIGNED_CERT_IN_CHAIN',
6437
+ 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
6438
+ 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
6439
+ 'CERT_CHAIN_TOO_LONG',
6440
+ 'CERT_REVOKED',
6441
+ 'INVALID_CA',
6442
+ 'PATH_LENGTH_EXCEEDED',
6443
+ 'INVALID_PURPOSE',
6444
+ 'CERT_UNTRUSTED',
6445
+ 'CERT_REJECTED',
6446
+ 'HOSTNAME_MISMATCH'
6447
+ ]);
6448
+
6449
+ // TODO: Use `error?.code` when targeting Node.js 14
6450
+ isRetryAllowed$1 = error => !denyList.has(error && error.code);
6451
+ return isRetryAllowed$1;
6452
+ }
6453
+
6454
+ var isRetryAllowedExports = requireIsRetryAllowed();
6455
+ var isRetryAllowed = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowedExports);
6456
+
6457
+ const namespace = 'axios-retry';
6458
+ function isNetworkError(error) {
6459
+ const CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
6460
+ if (error.response) {
6461
+ return false;
6462
+ }
6463
+ if (!error.code) {
6464
+ return false;
6465
+ }
6466
+ // Prevents retrying timed out & cancelled requests
6467
+ if (CODE_EXCLUDE_LIST.includes(error.code)) {
6468
+ return false;
6469
+ }
6470
+ // Prevents retrying unsafe errors
6471
+ return isRetryAllowed(error);
6472
+ }
6473
+ const SAFE_HTTP_METHODS = ['get', 'head', 'options'];
6474
+ const IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
6475
+ function isRetryableError(error) {
6476
+ return (error.code !== 'ECONNABORTED' &&
6477
+ (!error.response ||
6478
+ error.response.status === 429 ||
6479
+ (error.response.status >= 500 && error.response.status <= 599)));
6480
+ }
6481
+ function isSafeRequestError(error) {
6482
+ if (!error.config?.method) {
6483
+ // Cannot determine if the request can be retried
6484
+ return false;
6485
+ }
6486
+ return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
6487
+ }
6488
+ function isIdempotentRequestError(error) {
6489
+ if (!error.config?.method) {
6490
+ // Cannot determine if the request can be retried
6491
+ return false;
6492
+ }
6493
+ return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
6494
+ }
6495
+ function isNetworkOrIdempotentRequestError(error) {
6496
+ return isNetworkError(error) || isIdempotentRequestError(error);
6497
+ }
6498
+ function retryAfter(error = undefined) {
6499
+ const retryAfterHeader = error?.response?.headers['retry-after'];
6500
+ if (!retryAfterHeader) {
6501
+ return 0;
6502
+ }
6503
+ // if the retry after header is a number, convert it to milliseconds
6504
+ let retryAfterMs = (Number(retryAfterHeader) || 0) * 1000;
6505
+ // If the retry after header is a date, get the number of milliseconds until that date
6506
+ if (retryAfterMs === 0) {
6507
+ retryAfterMs = (new Date(retryAfterHeader).valueOf() || 0) - Date.now();
6508
+ }
6509
+ return Math.max(0, retryAfterMs);
6510
+ }
6511
+ function noDelay(_retryNumber = 0, error = undefined) {
6512
+ return Math.max(0, retryAfter(error));
6513
+ }
6514
+ function exponentialDelay(retryNumber = 0, error = undefined, delayFactor = 100) {
6515
+ const calculatedDelay = 2 ** retryNumber * delayFactor;
6516
+ const delay = Math.max(calculatedDelay, retryAfter(error));
6517
+ const randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay
6518
+ return delay + randomSum;
6519
+ }
6520
+ /**
6521
+ * Linear delay
6522
+ * @param {number | undefined} delayFactor - delay factor in milliseconds (default: 100)
6523
+ * @returns {function} (retryNumber: number, error: AxiosError | undefined) => number
6524
+ */
6525
+ function linearDelay(delayFactor = 100) {
6526
+ return (retryNumber = 0, error = undefined) => {
6527
+ const delay = retryNumber * delayFactor;
6528
+ return Math.max(delay, retryAfter(error));
6529
+ };
6530
+ }
6531
+ const DEFAULT_OPTIONS = {
6532
+ retries: 3,
6533
+ retryCondition: isNetworkOrIdempotentRequestError,
6534
+ retryDelay: noDelay,
6535
+ shouldResetTimeout: false,
6536
+ onRetry: () => { },
6537
+ onMaxRetryTimesExceeded: () => { },
6538
+ validateResponse: null
6539
+ };
6540
+ function getRequestOptions(config, defaultOptions) {
6541
+ return { ...DEFAULT_OPTIONS, ...defaultOptions, ...config[namespace] };
6542
+ }
6543
+ function setCurrentState(config, defaultOptions, resetLastRequestTime = false) {
6544
+ const currentState = getRequestOptions(config, defaultOptions || {});
6545
+ currentState.retryCount = currentState.retryCount || 0;
6546
+ if (!currentState.lastRequestTime || resetLastRequestTime) {
6547
+ currentState.lastRequestTime = Date.now();
6548
+ }
6549
+ config[namespace] = currentState;
6550
+ return currentState;
6551
+ }
6552
+ function fixConfig(axiosInstance, config) {
6553
+ // @ts-ignore
6554
+ if (axiosInstance.defaults.agent === config.agent) {
6555
+ // @ts-ignore
6556
+ delete config.agent;
6557
+ }
6558
+ if (axiosInstance.defaults.httpAgent === config.httpAgent) {
6559
+ delete config.httpAgent;
6560
+ }
6561
+ if (axiosInstance.defaults.httpsAgent === config.httpsAgent) {
6562
+ delete config.httpsAgent;
6563
+ }
6564
+ }
6565
+ async function shouldRetry(currentState, error) {
6566
+ const { retries, retryCondition } = currentState;
6567
+ const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(error);
6568
+ // This could be a promise
6569
+ if (typeof shouldRetryOrPromise === 'object') {
6570
+ try {
6571
+ const shouldRetryPromiseResult = await shouldRetryOrPromise;
6572
+ // keep return true unless shouldRetryPromiseResult return false for compatibility
6573
+ return shouldRetryPromiseResult !== false;
6574
+ }
6575
+ catch (_err) {
6576
+ return false;
6577
+ }
6578
+ }
6579
+ return shouldRetryOrPromise;
6580
+ }
6581
+ async function handleRetry(axiosInstance, currentState, error, config) {
6582
+ currentState.retryCount += 1;
6583
+ const { retryDelay, shouldResetTimeout, onRetry } = currentState;
6584
+ const delay = retryDelay(currentState.retryCount, error);
6585
+ // Axios fails merging this configuration to the default configuration because it has an issue
6586
+ // with circular structures: https://github.com/mzabriskie/axios/issues/370
6587
+ fixConfig(axiosInstance, config);
6588
+ if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
6589
+ const lastRequestDuration = Date.now() - currentState.lastRequestTime;
6590
+ const timeout = config.timeout - lastRequestDuration - delay;
6591
+ if (timeout <= 0) {
6592
+ return Promise.reject(error);
6593
+ }
6594
+ config.timeout = timeout;
6595
+ }
6596
+ config.transformRequest = [(data) => data];
6597
+ await onRetry(currentState.retryCount, error, config);
6598
+ if (config.signal?.aborted) {
6599
+ return Promise.resolve(axiosInstance(config));
6600
+ }
6601
+ return new Promise((resolve) => {
6602
+ const abortListener = () => {
6603
+ clearTimeout(timeout);
6604
+ resolve(axiosInstance(config));
6605
+ };
6606
+ const timeout = setTimeout(() => {
6607
+ resolve(axiosInstance(config));
6608
+ if (config.signal?.removeEventListener) {
6609
+ config.signal.removeEventListener('abort', abortListener);
6610
+ }
6611
+ }, delay);
6612
+ if (config.signal?.addEventListener) {
6613
+ config.signal.addEventListener('abort', abortListener, { once: true });
6614
+ }
6615
+ });
6616
+ }
6617
+ async function handleMaxRetryTimesExceeded(currentState, error) {
6618
+ if (currentState.retryCount >= currentState.retries)
6619
+ await currentState.onMaxRetryTimesExceeded(error, currentState.retryCount);
6620
+ }
6621
+ const axiosRetry = (axiosInstance, defaultOptions) => {
6622
+ const requestInterceptorId = axiosInstance.interceptors.request.use((config) => {
6623
+ setCurrentState(config, defaultOptions, true);
6624
+ if (config[namespace]?.validateResponse) {
6625
+ // by setting this, all HTTP responses will be go through the error interceptor first
6626
+ config.validateStatus = () => false;
6627
+ }
6628
+ return config;
6629
+ });
6630
+ const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (error) => {
6631
+ const { config } = error;
6632
+ // If we have no information to retry the request
6633
+ if (!config) {
6634
+ return Promise.reject(error);
6635
+ }
6636
+ const currentState = setCurrentState(config, defaultOptions);
6637
+ if (error.response && currentState.validateResponse?.(error.response)) {
6638
+ // no issue with response
6639
+ return error.response;
6640
+ }
6641
+ if (await shouldRetry(currentState, error)) {
6642
+ return handleRetry(axiosInstance, currentState, error, config);
6643
+ }
6644
+ await handleMaxRetryTimesExceeded(currentState, error);
6645
+ return Promise.reject(error);
6646
+ });
6647
+ return { requestInterceptorId, responseInterceptorId };
6648
+ };
6649
+ // Compatibility with CommonJS
6650
+ axiosRetry.isNetworkError = isNetworkError;
6651
+ axiosRetry.isSafeRequestError = isSafeRequestError;
6652
+ axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
6653
+ axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
6654
+ axiosRetry.exponentialDelay = exponentialDelay;
6655
+ axiosRetry.linearDelay = linearDelay;
6656
+ axiosRetry.isRetryableError = isRetryableError;
6657
+
6418
6658
  let axiosClient;
6419
6659
  async function getAxiosAuthClient() {
6420
6660
  if (!axiosClient) {
@@ -6424,6 +6664,7 @@ async function getAxiosAuthClient() {
6424
6664
  headers: {
6425
6665
  'Content-Type': 'application/json',
6426
6666
  },
6667
+ timeout: 30000, // 30s timeout, matching makeApiRequest
6427
6668
  });
6428
6669
  }
6429
6670
  return axiosClient;
@@ -6470,15 +6711,41 @@ async function createSessionWithPrivy(authToken, address, privyIdToken) {
6470
6711
  });
6471
6712
  return response.data;
6472
6713
  }
6714
+ // Deduplicate concurrent refreshSession calls to prevent multiple code paths
6715
+ // (WebSocket reconnection, periodic refresh, API 401 retry) from all hitting
6716
+ // /session/refresh simultaneously.
6717
+ // Note: module-level state is shared across requests in SSR/Node — acceptable
6718
+ // since there is only one active session per server instance (same pattern as
6719
+ // refreshInFlight in api.ts).
6720
+ let refreshInFlight$1 = null;
6721
+ let refreshInFlightToken = null;
6473
6722
  async function refreshSession(refreshToken) {
6474
- const client = await getAxiosAuthClient();
6475
- const config = await getConfig();
6476
- const appId = config.appId;
6477
- const response = await client.post('/session/refresh', {
6478
- refreshToken,
6479
- appId
6480
- });
6481
- return response.data;
6723
+ if (refreshInFlight$1 && refreshInFlightToken === refreshToken) {
6724
+ return refreshInFlight$1;
6725
+ }
6726
+ refreshInFlightToken = refreshToken;
6727
+ let currentFlight;
6728
+ currentFlight = refreshInFlight$1 = (async () => {
6729
+ try {
6730
+ const client = await getAxiosAuthClient();
6731
+ const config = await getConfig();
6732
+ const appId = config.appId;
6733
+ const response = await client.post('/session/refresh', {
6734
+ refreshToken,
6735
+ appId
6736
+ });
6737
+ return response.data;
6738
+ }
6739
+ finally {
6740
+ // Only clear if we're still the active in-flight request.
6741
+ // A second call with a different token may have replaced us.
6742
+ if (refreshInFlight$1 === currentFlight) {
6743
+ refreshInFlight$1 = null;
6744
+ refreshInFlightToken = null;
6745
+ }
6746
+ }
6747
+ })();
6748
+ return refreshInFlight$1;
6482
6749
  }
6483
6750
  async function signSessionCreateMessage(_signMessageFunction) {
6484
6751
  }
@@ -6616,14 +6883,10 @@ class WebSessionManager {
6616
6883
  WebSessionManager.TAROBASE_SESSION_STORAGE_KEY = "tarobase_session_storage";
6617
6884
 
6618
6885
  var webSessionManager = /*#__PURE__*/Object.freeze({
6619
- __proto__: null,
6620
- WebSessionManager: WebSessionManager
6886
+ __proto__: null,
6887
+ WebSessionManager: WebSessionManager
6621
6888
  });
6622
6889
 
6623
- function getDefaultExportFromCjs (x) {
6624
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
6625
- }
6626
-
6627
6890
  var buffer$1 = {};
6628
6891
 
6629
6892
  var base64Js$1 = {};
@@ -8995,15 +9258,15 @@ function requireBuffer$1 () {
8995
9258
 
8996
9259
  var bufferExports$1 = requireBuffer$1();
8997
9260
 
8998
- var safeBuffer$1 = {exports: {}};
9261
+ var safeBuffer = {exports: {}};
8999
9262
 
9000
9263
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
9001
9264
 
9002
- var hasRequiredSafeBuffer$1;
9265
+ var hasRequiredSafeBuffer;
9003
9266
 
9004
- function requireSafeBuffer$1 () {
9005
- if (hasRequiredSafeBuffer$1) return safeBuffer$1.exports;
9006
- hasRequiredSafeBuffer$1 = 1;
9267
+ function requireSafeBuffer () {
9268
+ if (hasRequiredSafeBuffer) return safeBuffer.exports;
9269
+ hasRequiredSafeBuffer = 1;
9007
9270
  (function (module, exports$1) {
9008
9271
  /* eslint-disable node/no-deprecated-api */
9009
9272
  var buffer = requireBuffer$1();
@@ -9069,23 +9332,23 @@ function requireSafeBuffer$1 () {
9069
9332
  }
9070
9333
  return buffer.SlowBuffer(size)
9071
9334
  };
9072
- } (safeBuffer$1, safeBuffer$1.exports));
9073
- return safeBuffer$1.exports;
9335
+ } (safeBuffer, safeBuffer.exports));
9336
+ return safeBuffer.exports;
9074
9337
  }
9075
9338
 
9076
- var src$1;
9077
- var hasRequiredSrc$1;
9339
+ var src;
9340
+ var hasRequiredSrc;
9078
9341
 
9079
- function requireSrc$1 () {
9080
- if (hasRequiredSrc$1) return src$1;
9081
- hasRequiredSrc$1 = 1;
9342
+ function requireSrc () {
9343
+ if (hasRequiredSrc) return src;
9344
+ hasRequiredSrc = 1;
9082
9345
  // base-x encoding / decoding
9083
9346
  // Copyright (c) 2018 base-x contributors
9084
9347
  // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
9085
9348
  // Distributed under the MIT software license, see the accompanying
9086
9349
  // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
9087
9350
  // @ts-ignore
9088
- var _Buffer = requireSafeBuffer$1().Buffer;
9351
+ var _Buffer = requireSafeBuffer().Buffer;
9089
9352
  function base (ALPHABET) {
9090
9353
  if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
9091
9354
  var BASE_MAP = new Uint8Array(256);
@@ -9200,25 +9463,25 @@ function requireSrc$1 () {
9200
9463
  decode: decode
9201
9464
  }
9202
9465
  }
9203
- src$1 = base;
9204
- return src$1;
9466
+ src = base;
9467
+ return src;
9205
9468
  }
9206
9469
 
9207
- var bs58$1$1;
9208
- var hasRequiredBs58$1;
9470
+ var bs58$1;
9471
+ var hasRequiredBs58;
9209
9472
 
9210
- function requireBs58$1 () {
9211
- if (hasRequiredBs58$1) return bs58$1$1;
9212
- hasRequiredBs58$1 = 1;
9213
- var basex = requireSrc$1();
9473
+ function requireBs58 () {
9474
+ if (hasRequiredBs58) return bs58$1;
9475
+ hasRequiredBs58 = 1;
9476
+ var basex = requireSrc();
9214
9477
  var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
9215
9478
 
9216
- bs58$1$1 = basex(ALPHABET);
9217
- return bs58$1$1;
9479
+ bs58$1 = basex(ALPHABET);
9480
+ return bs58$1;
9218
9481
  }
9219
9482
 
9220
- var bs58Exports$1 = requireBs58$1();
9221
- var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports$1);
9483
+ var bs58Exports = requireBs58();
9484
+ var bs58$2 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
9222
9485
 
9223
9486
  // ─────────────────────────────────────────────────────────────
9224
9487
  // Local implementation of getSimulationComputeUnits
@@ -9420,7 +9683,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
9420
9683
  }
9421
9684
  }
9422
9685
  else if (lutKey != null) {
9423
- const { value: table } = await connection.getAddressLookupTable(new web3_js.PublicKey(lutKey));
9686
+ // The LUT may have just been created server-side and the client's RPC node
9687
+ // may not have indexed it yet (load-balancer split). Retry with exponential
9688
+ // back-off; first retry at 100 ms almost always resolves it.
9689
+ let table = null;
9690
+ for (let attempt = 0; attempt < 5; attempt++) {
9691
+ const { value } = await connection.getAddressLookupTable(new web3_js.PublicKey(lutKey));
9692
+ if (value) {
9693
+ table = value;
9694
+ break;
9695
+ }
9696
+ if (attempt < 4)
9697
+ await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
9698
+ }
9424
9699
  if (!table)
9425
9700
  throw new Error('LUT not found after creation/extend');
9426
9701
  lookupTables.push(table);
@@ -9555,8 +9830,8 @@ class ServerSessionManager {
9555
9830
  ServerSessionManager.instance = new ServerSessionManager();
9556
9831
 
9557
9832
  var serverSessionManager = /*#__PURE__*/Object.freeze({
9558
- __proto__: null,
9559
- ServerSessionManager: ServerSessionManager
9833
+ __proto__: null,
9834
+ ServerSessionManager: ServerSessionManager
9560
9835
  });
9561
9836
 
9562
9837
  /**
@@ -9655,6 +9930,23 @@ async function updateIdTokenAndAccessToken(idToken, accessToken, isServer = fals
9655
9930
  await WebSessionManager.updateIdTokenAndAccessToken(idToken, accessToken);
9656
9931
  }
9657
9932
 
9933
+ const apiClient = globalAxios.create();
9934
+ axiosRetry(apiClient, {
9935
+ retries: 2,
9936
+ retryCondition: (error) => {
9937
+ var _a, _b;
9938
+ // Only retry GET requests on network errors (ECONNRESET, ETIMEDOUT, etc.)
9939
+ // Writes (POST/PUT) are not retried — the server may have processed
9940
+ // the request before the connection was reset.
9941
+ 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';
9942
+ },
9943
+ retryDelay: axiosRetry.exponentialDelay,
9944
+ shouldResetTimeout: true,
9945
+ onRetry: (retryCount, error, requestConfig) => {
9946
+ var _a;
9947
+ console.warn(`[tarobase-sdk] retry ${retryCount} for ${(_a = requestConfig.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()} ${requestConfig.url} — ${error.code || error.message}`);
9948
+ },
9949
+ });
9658
9950
  const refreshInFlight = new Map();
9659
9951
  async function refreshAuthSessionOnce(appId, isServer) {
9660
9952
  const key = `${isServer ? "server" : "web"}:${appId}`;
@@ -9701,6 +9993,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
9701
9993
  ServerSessionManager.instance.clearSession();
9702
9994
  };
9703
9995
  async function executeRequest() {
9996
+ var _a;
9704
9997
  // When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
9705
9998
  // Otherwise use the global createAuthHeader (default path).
9706
9999
  const authHeader = (_overrides === null || _overrides === void 0 ? void 0 : _overrides._getAuthHeaders)
@@ -9722,11 +10015,12 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
9722
10015
  method,
9723
10016
  url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
9724
10017
  headers,
10018
+ timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : 30000,
9725
10019
  };
9726
10020
  if (method !== "GET" && method !== "get") {
9727
10021
  requestConfig.data = data ? JSON.stringify(data) : {};
9728
10022
  }
9729
- const response = await globalAxios(requestConfig);
10023
+ const response = await apiClient(requestConfig);
9730
10024
  return { data: response.data, status: response.status, headers: response.headers };
9731
10025
  }
9732
10026
  try {
@@ -10662,6 +10956,7 @@ function scheduleTokenRefresh(connection, isServer) {
10662
10956
  // This replaces the old single setTimeout approach which was unreliable for long
10663
10957
  // delays (browsers throttle/suspend timers in background tabs).
10664
10958
  connection.tokenRefreshTimer = setInterval(async () => {
10959
+ var _a, _b;
10665
10960
  try {
10666
10961
  const currentToken = await getIdToken$1(isServer);
10667
10962
  if (!currentToken)
@@ -10692,6 +10987,17 @@ function scheduleTokenRefresh(connection, isServer) {
10692
10987
  }
10693
10988
  }
10694
10989
  catch (refreshError) {
10990
+ // If the refresh token itself is invalid (401/403), stop retrying —
10991
+ // the token won't magically become valid next interval, and continuing
10992
+ // to hammer /session/refresh causes 429 rate-limit storms.
10993
+ 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) {
10994
+ console.warn('[WS v2] Refresh token rejected (401/403), stopping periodic refresh');
10995
+ if (connection.tokenRefreshTimer) {
10996
+ clearInterval(connection.tokenRefreshTimer);
10997
+ connection.tokenRefreshTimer = null;
10998
+ }
10999
+ return;
11000
+ }
10695
11001
  console.warn('[WS v2] Proactive token refresh failed, will retry next interval:', refreshError);
10696
11002
  }
10697
11003
  }
@@ -10702,6 +11008,7 @@ function scheduleTokenRefresh(connection, isServer) {
10702
11008
  }, TOKEN_CHECK_INTERVAL);
10703
11009
  }
10704
11010
  async function getFreshAuthToken(isServer) {
11011
+ var _a, _b;
10705
11012
  const currentToken = await getIdToken$1(isServer);
10706
11013
  if (!currentToken) {
10707
11014
  return null;
@@ -10724,6 +11031,17 @@ async function getFreshAuthToken(isServer) {
10724
11031
  }
10725
11032
  catch (error) {
10726
11033
  console.error('[WS v2] Error refreshing token:', error);
11034
+ // If the refresh token is permanently invalid (401/403), clear the stale
11035
+ // session from storage so future attempts don't keep retrying with it.
11036
+ 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)) {
11037
+ try {
11038
+ const { WebSessionManager } = await Promise.resolve().then(function () { return webSessionManager; });
11039
+ WebSessionManager.clearSession();
11040
+ }
11041
+ catch (clearError) {
11042
+ console.warn('[WS v2] Failed to clear stale session:', clearError);
11043
+ }
11044
+ }
10727
11045
  }
10728
11046
  // Return null instead of the expired token to prevent infinite 401 reconnect storms.
10729
11047
  // The server accepts unauthenticated connections; auth-required subscriptions will
@@ -10844,7 +11162,16 @@ async function getOrCreateConnection(appId, isServer) {
10844
11162
  ws.addEventListener('open', () => {
10845
11163
  connection.isConnecting = false;
10846
11164
  connection.isConnected = true;
10847
- connection.consecutiveAuthFailures = 0;
11165
+ // NOTE: Do NOT reset consecutiveAuthFailures here. It is reset when a
11166
+ // fresh auth token is actually obtained (in urlProvider, line ~389) or on
11167
+ // an explicit auth change (reconnectWithNewAuthV2, line ~854). Resetting
11168
+ // on every 'open' event created an infinite loop: auth fails 5x → connect
11169
+ // without auth → open resets counter → disconnect → auth fails 5x again →
11170
+ // repeat forever, hammering /session/refresh and causing 429s.
11171
+ //
11172
+ // An elevated counter is safe for anonymous/guest sessions: when there's no
11173
+ // token at all (getIdToken returns null), the counter is never checked —
11174
+ // urlProvider skips straight to unauthenticated connection.
10848
11175
  // Schedule periodic token freshness checks
10849
11176
  scheduleTokenRefresh(connection, isServer);
10850
11177
  // Re-subscribe to all existing subscriptions after reconnect
@@ -15342,7 +15669,7 @@ async function loadDependencies() {
15342
15669
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
15343
15670
  import('react'),
15344
15671
  import('react-dom/client'),
15345
- Promise.resolve().then(function () { return require('./index-zS_Y-wbi.js'); })
15672
+ Promise.resolve().then(function () { return require('./index-Fo9o33oZ.js'); })
15346
15673
  ]);
15347
15674
  // Extract default export from ESM module namespace
15348
15675
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -15385,8 +15712,13 @@ class PhantomWalletProvider {
15385
15712
  async initializeAsync() {
15386
15713
  // Lazy load dependencies only when actually instantiating
15387
15714
  await loadDependencies();
15388
- // Initialize React component
15389
- this.initialize();
15715
+ // Initialize React component eagerly only when there's a real reason to
15716
+ // (URL callback to consume, prior session to restore, in-page wallet,
15717
+ // or non-Android). Otherwise defer until ensureReady() is reached from
15718
+ // a user-gesture flow. See shouldMountEagerly() for the rationale.
15719
+ if (this.shouldMountEagerly()) {
15720
+ this.initialize();
15721
+ }
15390
15722
  }
15391
15723
  /**
15392
15724
  * Check if social login providers are configured (non-injected providers).
@@ -15394,6 +15726,69 @@ class PhantomWalletProvider {
15394
15726
  hasSocialProviders() {
15395
15727
  return this.resolvedProviders.some(p => p !== 'injected');
15396
15728
  }
15729
+ /**
15730
+ * Decide whether to mount the @phantom/react-sdk <PhantomProvider> tree
15731
+ * eagerly during init() or defer until the first user-triggered call
15732
+ * (login / sign / etc.) reaches ensureReady().
15733
+ *
15734
+ * Mounting the React tree synchronously constructs BrowserSDK, which runs
15735
+ * wallet-standard discovery in its constructor and fires sdk.autoConnect()
15736
+ * in a useEffect on mount. On Solana Seeker (Android Chrome PWA), both
15737
+ * pathways probe the Android intent surface to discover the Phantom mobile
15738
+ * app, which surfaces Chrome's system "wants to access other apps and
15739
+ * services" permission dialog *before* the PWA activity has window focus.
15740
+ * The dialog renders with grayed-out buttons until the user backgrounds
15741
+ * and resumes the app.
15742
+ *
15743
+ * Returns true when eager mount is needed (callback to handle, prior
15744
+ * session, in-page wallet present, or non-Android). Otherwise returns
15745
+ * false — the React tree is mounted lazily inside ensureReady() once a
15746
+ * user gesture brings us there.
15747
+ */
15748
+ shouldMountEagerly() {
15749
+ if (typeof window === 'undefined')
15750
+ return false;
15751
+ // Preserve desktop behavior: always mount eagerly.
15752
+ if (!detectAndroid())
15753
+ return true;
15754
+ // In-page wallet present (Phantom in-app browser / desktop extension on
15755
+ // a desktop-mode Android UA): no Android intent probe needed, mount free.
15756
+ // Tighten beyond truthy `window.phantom` since arbitrary stubs can land
15757
+ // on that key — require a wallet-shaped surface.
15758
+ const ph = window.phantom;
15759
+ if (ph && (ph.solana || ph.ethereum || ph.app))
15760
+ return true;
15761
+ // Returning from a Phantom redirect (OAuth or deeplink hop). SDK must
15762
+ // be live to read these URL params via urlParamsAccessor.
15763
+ const callbackKeys = ['session_id', 'wallet_id', 'selected_account_index', 'error', 'error_description'];
15764
+ try {
15765
+ const params = new URLSearchParams(window.location.search);
15766
+ if (callbackKeys.some(k => params.has(k)))
15767
+ return true;
15768
+ }
15769
+ catch (_a) {
15770
+ return true; // conservative on URL access failure
15771
+ }
15772
+ // Returning user with a stored Phantom session. They've already
15773
+ // approved the Android intent permission for this origin on first
15774
+ // login, so the dialog is typically pre-granted by Chrome — eager
15775
+ // mount lets autoConnect silently restore the wallet handshake.
15776
+ // Require BOTH the marker AND a session storage entry so a stale
15777
+ // orphaned marker doesn't keep eager-mounting forever. Note
15778
+ // isAuthenticated() is a raw key-existence check, not a validity
15779
+ // check — restoreSession() above clears the marker on the next load
15780
+ // if the session is unusable, so the bug self-corrects after at
15781
+ // most one further cold start.
15782
+ try {
15783
+ const stored = getPlatform().storage.getItem('tarobase_last_auth_method');
15784
+ if (stored === 'phantom' && WebSessionManager.isAuthenticated())
15785
+ return true;
15786
+ }
15787
+ catch (_b) {
15788
+ return true;
15789
+ }
15790
+ return false;
15791
+ }
15397
15792
  static getInstance(networkUrl, config) {
15398
15793
  if (!PhantomWalletProvider.instance) {
15399
15794
  new PhantomWalletProvider(networkUrl, config);
@@ -16070,6 +16465,13 @@ class PhantomWalletProvider {
16070
16465
  if (this.initPromise) {
16071
16466
  await this.initPromise;
16072
16467
  }
16468
+ // Lazy-mount path: if initializeAsync deferred the React mount (e.g.
16469
+ // first-time visitor on Android Chrome PWA), do it now. We're being
16470
+ // called from a user-gesture flow like login(), so any Android intent
16471
+ // dialog that surfaces will appear with the activity already focused.
16472
+ if (!this.containerElement) {
16473
+ this.initialize();
16474
+ }
16073
16475
  // Wait for SDK to be ready
16074
16476
  await new Promise((resolve) => {
16075
16477
  const check = () => {
@@ -16179,12 +16581,53 @@ class PhantomWalletProvider {
16179
16581
  });
16180
16582
  }
16181
16583
  async restoreSession() {
16182
- await this.ensureReady();
16183
- const session = await WebSessionManager.getSession();
16184
- if (session) {
16185
- return { provider: this, address: session.address };
16584
+ // Read from storage directly. Do NOT ensureReady() here — that would
16585
+ // mount @phantom/react-sdk's <PhantomProvider> during init(), which
16586
+ // synchronously constructs BrowserSDK (running wallet-standard discovery)
16587
+ // and fires sdk.autoConnect() both probing the Android intent surface
16588
+ // before the PWA activity has window focus on Solana Seeker. The
16589
+ // resulting "access other apps and services" system dialog renders
16590
+ // with grayed-out buttons.
16591
+ //
16592
+ // Wrap getSession() in try/catch: WebSessionManager.getSession() runs
16593
+ // JSON.parse on the stored session *outside* its internal try/catch,
16594
+ // so genuinely malformed JSON in localStorage would propagate through
16595
+ // restoreSession() and break init() entirely. Treat any throw as
16596
+ // "no session" and fall through to the cleanup path so corrupted
16597
+ // storage is recoverable on next load.
16598
+ let session;
16599
+ try {
16600
+ session = await WebSessionManager.getSession();
16186
16601
  }
16187
- return null;
16602
+ catch (_a) {
16603
+ session = null;
16604
+ }
16605
+ if (!session) {
16606
+ // Tidy up storage so we don't leave junk behind:
16607
+ // (a) clearSession() removes any stale or unparseable session
16608
+ // storage entry. WebSessionManager.getSession() can't reach
16609
+ // its own clearSession() if JSON.parse threw. Idempotent —
16610
+ // safe to call unconditionally here.
16611
+ // (b) Drop the auth-method marker if it's stale.
16612
+ // WebSessionManager.clearSession() only removes the session
16613
+ // storage key, not the marker — so without this cleanup
16614
+ // shouldMountEagerly() would keep eager-mounting on every
16615
+ // future cold start.
16616
+ try {
16617
+ WebSessionManager.clearSession();
16618
+ }
16619
+ catch ( /* best-effort */_b) { /* best-effort */ }
16620
+ try {
16621
+ if (getPlatform().storage.getItem('tarobase_last_auth_method') === 'phantom') {
16622
+ getPlatform().storage.removeItem('tarobase_last_auth_method');
16623
+ }
16624
+ }
16625
+ catch (_c) {
16626
+ // storage unavailable — best-effort cleanup
16627
+ }
16628
+ return null;
16629
+ }
16630
+ return { provider: this, address: session.address };
16188
16631
  }
16189
16632
  async address() {
16190
16633
  var _a, _b, _c, _d;
@@ -19675,235 +20118,137 @@ function createSolanaRpcSubscriptionsFromTransport(transport) {
19675
20118
  });
19676
20119
  }
19677
20120
 
19678
- var safeBuffer = {exports: {}};
19679
-
19680
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
19681
-
19682
- var hasRequiredSafeBuffer;
19683
-
19684
- function requireSafeBuffer () {
19685
- if (hasRequiredSafeBuffer) return safeBuffer.exports;
19686
- hasRequiredSafeBuffer = 1;
19687
- (function (module, exports$1) {
19688
- /* eslint-disable node/no-deprecated-api */
19689
- var buffer = requireBuffer();
19690
- var Buffer = buffer.Buffer;
19691
-
19692
- // alternative to using Object.keys for old browsers
19693
- function copyProps (src, dst) {
19694
- for (var key in src) {
19695
- dst[key] = src[key];
19696
- }
19697
- }
19698
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
19699
- module.exports = buffer;
19700
- } else {
19701
- // Copy properties from require('buffer')
19702
- copyProps(buffer, exports$1);
19703
- exports$1.Buffer = SafeBuffer;
19704
- }
19705
-
19706
- function SafeBuffer (arg, encodingOrOffset, length) {
19707
- return Buffer(arg, encodingOrOffset, length)
19708
- }
19709
-
19710
- SafeBuffer.prototype = Object.create(Buffer.prototype);
19711
-
19712
- // Copy static methods from Buffer
19713
- copyProps(Buffer, SafeBuffer);
19714
-
19715
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
19716
- if (typeof arg === 'number') {
19717
- throw new TypeError('Argument must not be a number')
19718
- }
19719
- return Buffer(arg, encodingOrOffset, length)
19720
- };
19721
-
19722
- SafeBuffer.alloc = function (size, fill, encoding) {
19723
- if (typeof size !== 'number') {
19724
- throw new TypeError('Argument must be a number')
19725
- }
19726
- var buf = Buffer(size);
19727
- if (fill !== undefined) {
19728
- if (typeof encoding === 'string') {
19729
- buf.fill(fill, encoding);
19730
- } else {
19731
- buf.fill(fill);
19732
- }
19733
- } else {
19734
- buf.fill(0);
19735
- }
19736
- return buf
19737
- };
19738
-
19739
- SafeBuffer.allocUnsafe = function (size) {
19740
- if (typeof size !== 'number') {
19741
- throw new TypeError('Argument must be a number')
19742
- }
19743
- return Buffer(size)
19744
- };
19745
-
19746
- SafeBuffer.allocUnsafeSlow = function (size) {
19747
- if (typeof size !== 'number') {
19748
- throw new TypeError('Argument must be a number')
19749
- }
19750
- return buffer.SlowBuffer(size)
19751
- };
19752
- } (safeBuffer, safeBuffer.exports));
19753
- return safeBuffer.exports;
19754
- }
19755
-
19756
- var src;
19757
- var hasRequiredSrc;
19758
-
19759
- function requireSrc () {
19760
- if (hasRequiredSrc) return src;
19761
- hasRequiredSrc = 1;
19762
- // base-x encoding / decoding
19763
- // Copyright (c) 2018 base-x contributors
19764
- // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
19765
- // Distributed under the MIT software license, see the accompanying
19766
- // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
19767
- // @ts-ignore
19768
- var _Buffer = requireSafeBuffer().Buffer;
19769
- function base (ALPHABET) {
19770
- if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
19771
- var BASE_MAP = new Uint8Array(256);
19772
- for (var j = 0; j < BASE_MAP.length; j++) {
19773
- BASE_MAP[j] = 255;
19774
- }
19775
- for (var i = 0; i < ALPHABET.length; i++) {
19776
- var x = ALPHABET.charAt(i);
19777
- var xc = x.charCodeAt(0);
19778
- if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
19779
- BASE_MAP[xc] = i;
19780
- }
19781
- var BASE = ALPHABET.length;
19782
- var LEADER = ALPHABET.charAt(0);
19783
- var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
19784
- var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
19785
- function encode (source) {
19786
- if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }
19787
- if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }
19788
- if (source.length === 0) { return '' }
19789
- // Skip & count leading zeroes.
19790
- var zeroes = 0;
19791
- var length = 0;
19792
- var pbegin = 0;
19793
- var pend = source.length;
19794
- while (pbegin !== pend && source[pbegin] === 0) {
19795
- pbegin++;
19796
- zeroes++;
19797
- }
19798
- // Allocate enough space in big-endian base58 representation.
19799
- var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
19800
- var b58 = new Uint8Array(size);
19801
- // Process the bytes.
19802
- while (pbegin !== pend) {
19803
- var carry = source[pbegin];
19804
- // Apply "b58 = b58 * 256 + ch".
19805
- var i = 0;
19806
- for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
19807
- carry += (256 * b58[it1]) >>> 0;
19808
- b58[it1] = (carry % BASE) >>> 0;
19809
- carry = (carry / BASE) >>> 0;
19810
- }
19811
- if (carry !== 0) { throw new Error('Non-zero carry') }
19812
- length = i;
19813
- pbegin++;
19814
- }
19815
- // Skip leading zeroes in base58 result.
19816
- var it2 = size - length;
19817
- while (it2 !== size && b58[it2] === 0) {
19818
- it2++;
19819
- }
19820
- // Translate the result into a string.
19821
- var str = LEADER.repeat(zeroes);
19822
- for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
19823
- return str
19824
- }
19825
- function decodeUnsafe (source) {
19826
- if (typeof source !== 'string') { throw new TypeError('Expected String') }
19827
- if (source.length === 0) { return _Buffer.alloc(0) }
19828
- var psz = 0;
19829
- // Skip and count leading '1's.
19830
- var zeroes = 0;
19831
- var length = 0;
19832
- while (source[psz] === LEADER) {
19833
- zeroes++;
19834
- psz++;
19835
- }
19836
- // Allocate enough space in big-endian base256 representation.
19837
- var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
19838
- var b256 = new Uint8Array(size);
19839
- // Process the characters.
19840
- while (psz < source.length) {
19841
- // Find code of next character
19842
- var charCode = source.charCodeAt(psz);
19843
- // Base map can not be indexed using char code
19844
- if (charCode > 255) { return }
19845
- // Decode character
19846
- var carry = BASE_MAP[charCode];
19847
- // Invalid character
19848
- if (carry === 255) { return }
19849
- var i = 0;
19850
- for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
19851
- carry += (BASE * b256[it3]) >>> 0;
19852
- b256[it3] = (carry % 256) >>> 0;
19853
- carry = (carry / 256) >>> 0;
19854
- }
19855
- if (carry !== 0) { throw new Error('Non-zero carry') }
19856
- length = i;
19857
- psz++;
19858
- }
19859
- // Skip leading zeroes in b256.
19860
- var it4 = size - length;
19861
- while (it4 !== size && b256[it4] === 0) {
19862
- it4++;
19863
- }
19864
- var vch = _Buffer.allocUnsafe(zeroes + (size - it4));
19865
- vch.fill(0x00, 0, zeroes);
19866
- var j = zeroes;
19867
- while (it4 !== size) {
19868
- vch[j++] = b256[it4++];
19869
- }
19870
- return vch
19871
- }
19872
- function decode (string) {
19873
- var buffer = decodeUnsafe(string);
19874
- if (buffer) { return buffer }
19875
- throw new Error('Non-base' + BASE + ' character')
19876
- }
19877
- return {
19878
- encode: encode,
19879
- decodeUnsafe: decodeUnsafe,
19880
- decode: decode
19881
- }
19882
- }
19883
- src = base;
19884
- return src;
19885
- }
19886
-
19887
- var bs58$1;
19888
- var hasRequiredBs58;
19889
-
19890
- function requireBs58 () {
19891
- if (hasRequiredBs58) return bs58$1;
19892
- hasRequiredBs58 = 1;
19893
- var basex = requireSrc();
19894
- var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
19895
-
19896
- bs58$1 = basex(ALPHABET);
19897
- return bs58$1;
20121
+ // base-x encoding / decoding
20122
+ // Copyright (c) 2018 base-x contributors
20123
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
20124
+ // Distributed under the MIT software license, see the accompanying
20125
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
20126
+ function base (ALPHABET) {
20127
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
20128
+ const BASE_MAP = new Uint8Array(256);
20129
+ for (let j = 0; j < BASE_MAP.length; j++) {
20130
+ BASE_MAP[j] = 255;
20131
+ }
20132
+ for (let i = 0; i < ALPHABET.length; i++) {
20133
+ const x = ALPHABET.charAt(i);
20134
+ const xc = x.charCodeAt(0);
20135
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
20136
+ BASE_MAP[xc] = i;
20137
+ }
20138
+ const BASE = ALPHABET.length;
20139
+ const LEADER = ALPHABET.charAt(0);
20140
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
20141
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
20142
+ function encode (source) {
20143
+ // eslint-disable-next-line no-empty
20144
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
20145
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
20146
+ } else if (Array.isArray(source)) {
20147
+ source = Uint8Array.from(source);
20148
+ }
20149
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
20150
+ if (source.length === 0) { return '' }
20151
+ // Skip & count leading zeroes.
20152
+ let zeroes = 0;
20153
+ let length = 0;
20154
+ let pbegin = 0;
20155
+ const pend = source.length;
20156
+ while (pbegin !== pend && source[pbegin] === 0) {
20157
+ pbegin++;
20158
+ zeroes++;
20159
+ }
20160
+ // Allocate enough space in big-endian base58 representation.
20161
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
20162
+ const b58 = new Uint8Array(size);
20163
+ // Process the bytes.
20164
+ while (pbegin !== pend) {
20165
+ let carry = source[pbegin];
20166
+ // Apply "b58 = b58 * 256 + ch".
20167
+ let i = 0;
20168
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
20169
+ carry += (256 * b58[it1]) >>> 0;
20170
+ b58[it1] = (carry % BASE) >>> 0;
20171
+ carry = (carry / BASE) >>> 0;
20172
+ }
20173
+ if (carry !== 0) { throw new Error('Non-zero carry') }
20174
+ length = i;
20175
+ pbegin++;
20176
+ }
20177
+ // Skip leading zeroes in base58 result.
20178
+ let it2 = size - length;
20179
+ while (it2 !== size && b58[it2] === 0) {
20180
+ it2++;
20181
+ }
20182
+ // Translate the result into a string.
20183
+ let str = LEADER.repeat(zeroes);
20184
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
20185
+ return str
20186
+ }
20187
+ function decodeUnsafe (source) {
20188
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
20189
+ if (source.length === 0) { return new Uint8Array() }
20190
+ let psz = 0;
20191
+ // Skip and count leading '1's.
20192
+ let zeroes = 0;
20193
+ let length = 0;
20194
+ while (source[psz] === LEADER) {
20195
+ zeroes++;
20196
+ psz++;
20197
+ }
20198
+ // Allocate enough space in big-endian base256 representation.
20199
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
20200
+ const b256 = new Uint8Array(size);
20201
+ // Process the characters.
20202
+ while (psz < source.length) {
20203
+ // Find code of next character
20204
+ const charCode = source.charCodeAt(psz);
20205
+ // Base map can not be indexed using char code
20206
+ if (charCode > 255) { return }
20207
+ // Decode character
20208
+ let carry = BASE_MAP[charCode];
20209
+ // Invalid character
20210
+ if (carry === 255) { return }
20211
+ let i = 0;
20212
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
20213
+ carry += (BASE * b256[it3]) >>> 0;
20214
+ b256[it3] = (carry % 256) >>> 0;
20215
+ carry = (carry / 256) >>> 0;
20216
+ }
20217
+ if (carry !== 0) { throw new Error('Non-zero carry') }
20218
+ length = i;
20219
+ psz++;
20220
+ }
20221
+ // Skip leading zeroes in b256.
20222
+ let it4 = size - length;
20223
+ while (it4 !== size && b256[it4] === 0) {
20224
+ it4++;
20225
+ }
20226
+ const vch = new Uint8Array(zeroes + (size - it4));
20227
+ let j = zeroes;
20228
+ while (it4 !== size) {
20229
+ vch[j++] = b256[it4++];
20230
+ }
20231
+ return vch
20232
+ }
20233
+ function decode (string) {
20234
+ const buffer = decodeUnsafe(string);
20235
+ if (buffer) { return buffer }
20236
+ throw new Error('Non-base' + BASE + ' character')
20237
+ }
20238
+ return {
20239
+ encode,
20240
+ decodeUnsafe,
20241
+ decode
20242
+ }
19898
20243
  }
19899
20244
 
19900
- var bs58Exports = requireBs58();
19901
- var bs58 = /*@__PURE__*/getDefaultExportFromCjs$1(bs58Exports);
20245
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
20246
+ var bs58 = base(ALPHABET);
19902
20247
 
19903
- var index = /*#__PURE__*/_mergeNamespaces({
20248
+ var index = /*#__PURE__*/Object.freeze({
19904
20249
  __proto__: null,
19905
20250
  default: bs58
19906
- }, [bs58Exports]);
20251
+ });
19907
20252
 
19908
20253
  const SURFNET_RPC_URL$1 = "https://surfpool.fly.dev";
19909
20254
  let React;
@@ -20817,7 +21162,7 @@ async function loadMwaProtocol() {
20817
21162
  return mwaProtocolLoadPromise;
20818
21163
  mwaProtocolLoadPromise = (async () => {
20819
21164
  try {
20820
- mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-Df7yN8D5.js'); });
21165
+ mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-CQUvzkLr.js'); });
20821
21166
  }
20822
21167
  catch (e) {
20823
21168
  console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
@@ -20839,7 +21184,7 @@ async function registerMobileWalletAdapter(config) {
20839
21184
  if (typeof window === 'undefined')
20840
21185
  return;
20841
21186
  try {
20842
- const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-Cpi4W_1r.js'); });
21187
+ const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-CGfTdDXe.js'); });
20843
21188
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
20844
21189
  if (!registerMwa) {
20845
21190
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21759,6 +22104,7 @@ exports.ServerSessionManager = ServerSessionManager;
21759
22104
  exports.SolanaMobileWalletProvider = SolanaMobileWalletProvider;
21760
22105
  exports.WebSessionManager = WebSessionManager;
21761
22106
  exports.aggregate = aggregate;
22107
+ exports.bs58 = bs58;
21762
22108
  exports.bufferExports = bufferExports;
21763
22109
  exports.buildSetDocumentsTransaction = buildSetDocumentsTransaction;
21764
22110
  exports.clearCache = clearCache;
@@ -21804,4 +22150,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
21804
22150
  exports.signTransaction = signTransaction;
21805
22151
  exports.subscribe = subscribe;
21806
22152
  exports.useAuth = useAuth;
21807
- //# sourceMappingURL=index-DwU9hjtr.js.map
22153
+ //# sourceMappingURL=index-BU6puWaY.js.map