@pooflabs/web 0.0.79-rc.1 → 0.0.80
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.
- package/dist/{index-DwU9hjtr.js → index-BNyxZ82q.js} +365 -23
- package/dist/index-BNyxZ82q.js.map +1 -0
- package/dist/{index-zS_Y-wbi.js → index-BVi7fTm2.js} +2 -2
- package/dist/{index-zS_Y-wbi.js.map → index-BVi7fTm2.js.map} +1 -1
- package/dist/{index-CiwYJvf8.esm.js → index-BbtYb8sE.esm.js} +3 -3
- package/dist/{index-CiwYJvf8.esm.js.map → index-BbtYb8sE.esm.js.map} +1 -1
- package/dist/{index-BHGEc97p.js → index-BhfNMrC0.js} +3 -3
- package/dist/{index-BHGEc97p.js.map → index-BhfNMrC0.js.map} +1 -1
- package/dist/index-CKIoDkjJ.esm.js +6 -0
- package/dist/index-CKIoDkjJ.esm.js.map +1 -0
- package/dist/{index-U-xlsKRI.esm.js → index-COIUWugk.esm.js} +2 -2
- package/dist/{index-U-xlsKRI.esm.js.map → index-COIUWugk.esm.js.map} +1 -1
- package/dist/{index-D9BY44i-.js → index-CSraUgD6.js} +2 -2
- package/dist/index-CSraUgD6.js.map +1 -0
- package/dist/{index-CsIXFm8d.esm.js → index-Db0NqU8R.esm.js} +365 -23
- package/dist/index-Db0NqU8R.esm.js.map +1 -0
- package/dist/{index.browser-Cpi4W_1r.js → index.browser-8hyi2LOX.js} +1696 -1366
- package/dist/index.browser-8hyi2LOX.js.map +1 -0
- package/dist/{index.browser-Dbq5Qf1G.esm.js → index.browser-B4zXnffD.esm.js} +81 -98
- package/dist/index.browser-B4zXnffD.esm.js.map +1 -0
- package/dist/{index.browser-Df7yN8D5.js → index.browser-BJ_TdUVA.js} +80 -97
- package/dist/index.browser-BJ_TdUVA.js.map +1 -0
- package/dist/index.browser-BkNaRRVe.js +1222 -0
- package/dist/index.browser-BkNaRRVe.js.map +1 -0
- package/dist/{index.browser-CMEwqnEe.esm.js → index.browser-BuHl80dp.esm.js} +1696 -1366
- package/dist/index.browser-BuHl80dp.esm.js.map +1 -0
- package/dist/index.browser-CnbxBj3-.esm.js +1219 -0
- package/dist/index.browser-CnbxBj3-.esm.js.map +1 -0
- package/dist/index.browser-OvGNsMPu.esm.js +1002 -0
- package/dist/index.browser-OvGNsMPu.esm.js.map +1 -0
- package/dist/index.browser-vuTr40so.js +1008 -0
- package/dist/index.browser-vuTr40so.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{index.native-DtxPWD00.js → index.native-DUnE51Mx.js} +365 -23
- package/dist/index.native-DUnE51Mx.js.map +1 -0
- package/dist/{index.native-CEf5PJ_g.esm.js → index.native-DuKhZcus.esm.js} +365 -23
- package/dist/index.native-DuKhZcus.esm.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +1 -1
- package/dist/{phantom-wallet-provider-B0UmUtfB.esm.js → phantom-wallet-provider--BJjVUA1.esm.js} +4 -4
- package/dist/{phantom-wallet-provider-B0UmUtfB.esm.js.map → phantom-wallet-provider--BJjVUA1.esm.js.map} +1 -1
- package/dist/{phantom-wallet-provider-BbyQIlro.js → phantom-wallet-provider-Cg-srwP4.js} +4 -4
- package/dist/{phantom-wallet-provider-BbyQIlro.js.map → phantom-wallet-provider-Cg-srwP4.js.map} +1 -1
- package/dist/{privy-wallet-provider-DGjYglh7.esm.js → privy-wallet-provider-BLcur3Ue.esm.js} +3 -3
- package/dist/{privy-wallet-provider-DGjYglh7.esm.js.map → privy-wallet-provider-BLcur3Ue.esm.js.map} +1 -1
- package/dist/{privy-wallet-provider-CoQzq0F4.js → privy-wallet-provider-DpNVyaXa.js} +3 -3
- package/dist/{privy-wallet-provider-CoQzq0F4.js.map → privy-wallet-provider-DpNVyaXa.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-DIyP-Az5.esm.js → solana-mobile-wallet-provider-CFaubssb.esm.js} +4 -4
- package/dist/{solana-mobile-wallet-provider-DIyP-Az5.esm.js.map → solana-mobile-wallet-provider-CFaubssb.esm.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-BLoovRsJ.js → solana-mobile-wallet-provider-zXAk2tfS.js} +4 -4
- package/dist/{solana-mobile-wallet-provider-BLoovRsJ.js.map → solana-mobile-wallet-provider-zXAk2tfS.js.map} +1 -1
- package/package.json +24 -24
- package/dist/index-6pNPzV1t.esm.js +0 -6
- package/dist/index-6pNPzV1t.esm.js.map +0 -1
- package/dist/index-CsIXFm8d.esm.js.map +0 -1
- package/dist/index-D9BY44i-.js.map +0 -1
- package/dist/index-DwU9hjtr.js.map +0 -1
- package/dist/index.browser-C-_FEr5M.esm.js +0 -1134
- package/dist/index.browser-C-_FEr5M.esm.js.map +0 -1
- package/dist/index.browser-C9bFQZyQ.esm.js +0 -1373
- package/dist/index.browser-C9bFQZyQ.esm.js.map +0 -1
- package/dist/index.browser-CMEwqnEe.esm.js.map +0 -1
- package/dist/index.browser-Cpi4W_1r.js.map +0 -1
- package/dist/index.browser-Dbq5Qf1G.esm.js.map +0 -1
- package/dist/index.browser-Df7yN8D5.js.map +0 -1
- package/dist/index.browser-DjEZSiqI.js +0 -1137
- package/dist/index.browser-DjEZSiqI.js.map +0 -1
- package/dist/index.browser-dszs5oe5.js +0 -1376
- package/dist/index.browser-dszs5oe5.js.map +0 -1
- package/dist/index.native-CEf5PJ_g.esm.js.map +0 -1
- package/dist/index.native-DtxPWD00.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index_native = require('./index.native-
|
|
3
|
+
var index_native = require('./index.native-DUnE51Mx.js');
|
|
4
4
|
|
|
5
5
|
var bufferExports = index_native.requireBuffer();
|
|
6
6
|
|
|
7
7
|
exports.bufferExports = bufferExports;
|
|
8
|
-
//# sourceMappingURL=index-
|
|
8
|
+
//# sourceMappingURL=index-CSraUgD6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CSraUgD6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -6394,6 +6394,261 @@ var ReconnectingWebSocket = /** @class */ (function () {
|
|
|
6394
6394
|
return ReconnectingWebSocket;
|
|
6395
6395
|
}());
|
|
6396
6396
|
|
|
6397
|
+
function getDefaultExportFromCjs (x) {
|
|
6398
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
6399
|
+
}
|
|
6400
|
+
|
|
6401
|
+
var isRetryAllowed$1;
|
|
6402
|
+
var hasRequiredIsRetryAllowed;
|
|
6403
|
+
|
|
6404
|
+
function requireIsRetryAllowed () {
|
|
6405
|
+
if (hasRequiredIsRetryAllowed) return isRetryAllowed$1;
|
|
6406
|
+
hasRequiredIsRetryAllowed = 1;
|
|
6407
|
+
|
|
6408
|
+
const denyList = new Set([
|
|
6409
|
+
'ENOTFOUND',
|
|
6410
|
+
'ENETUNREACH',
|
|
6411
|
+
|
|
6412
|
+
// SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
|
|
6413
|
+
'UNABLE_TO_GET_ISSUER_CERT',
|
|
6414
|
+
'UNABLE_TO_GET_CRL',
|
|
6415
|
+
'UNABLE_TO_DECRYPT_CERT_SIGNATURE',
|
|
6416
|
+
'UNABLE_TO_DECRYPT_CRL_SIGNATURE',
|
|
6417
|
+
'UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
|
|
6418
|
+
'CERT_SIGNATURE_FAILURE',
|
|
6419
|
+
'CRL_SIGNATURE_FAILURE',
|
|
6420
|
+
'CERT_NOT_YET_VALID',
|
|
6421
|
+
'CERT_HAS_EXPIRED',
|
|
6422
|
+
'CRL_NOT_YET_VALID',
|
|
6423
|
+
'CRL_HAS_EXPIRED',
|
|
6424
|
+
'ERROR_IN_CERT_NOT_BEFORE_FIELD',
|
|
6425
|
+
'ERROR_IN_CERT_NOT_AFTER_FIELD',
|
|
6426
|
+
'ERROR_IN_CRL_LAST_UPDATE_FIELD',
|
|
6427
|
+
'ERROR_IN_CRL_NEXT_UPDATE_FIELD',
|
|
6428
|
+
'OUT_OF_MEM',
|
|
6429
|
+
'DEPTH_ZERO_SELF_SIGNED_CERT',
|
|
6430
|
+
'SELF_SIGNED_CERT_IN_CHAIN',
|
|
6431
|
+
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
|
|
6432
|
+
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
|
|
6433
|
+
'CERT_CHAIN_TOO_LONG',
|
|
6434
|
+
'CERT_REVOKED',
|
|
6435
|
+
'INVALID_CA',
|
|
6436
|
+
'PATH_LENGTH_EXCEEDED',
|
|
6437
|
+
'INVALID_PURPOSE',
|
|
6438
|
+
'CERT_UNTRUSTED',
|
|
6439
|
+
'CERT_REJECTED',
|
|
6440
|
+
'HOSTNAME_MISMATCH'
|
|
6441
|
+
]);
|
|
6442
|
+
|
|
6443
|
+
// TODO: Use `error?.code` when targeting Node.js 14
|
|
6444
|
+
isRetryAllowed$1 = error => !denyList.has(error && error.code);
|
|
6445
|
+
return isRetryAllowed$1;
|
|
6446
|
+
}
|
|
6447
|
+
|
|
6448
|
+
var isRetryAllowedExports = requireIsRetryAllowed();
|
|
6449
|
+
var isRetryAllowed = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowedExports);
|
|
6450
|
+
|
|
6451
|
+
const namespace = 'axios-retry';
|
|
6452
|
+
function isNetworkError(error) {
|
|
6453
|
+
const CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
|
|
6454
|
+
if (error.response) {
|
|
6455
|
+
return false;
|
|
6456
|
+
}
|
|
6457
|
+
if (!error.code) {
|
|
6458
|
+
return false;
|
|
6459
|
+
}
|
|
6460
|
+
// Prevents retrying timed out & cancelled requests
|
|
6461
|
+
if (CODE_EXCLUDE_LIST.includes(error.code)) {
|
|
6462
|
+
return false;
|
|
6463
|
+
}
|
|
6464
|
+
// Prevents retrying unsafe errors
|
|
6465
|
+
return isRetryAllowed(error);
|
|
6466
|
+
}
|
|
6467
|
+
const SAFE_HTTP_METHODS = ['get', 'head', 'options'];
|
|
6468
|
+
const IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
|
|
6469
|
+
function isRetryableError(error) {
|
|
6470
|
+
return (error.code !== 'ECONNABORTED' &&
|
|
6471
|
+
(!error.response ||
|
|
6472
|
+
error.response.status === 429 ||
|
|
6473
|
+
(error.response.status >= 500 && error.response.status <= 599)));
|
|
6474
|
+
}
|
|
6475
|
+
function isSafeRequestError(error) {
|
|
6476
|
+
if (!error.config?.method) {
|
|
6477
|
+
// Cannot determine if the request can be retried
|
|
6478
|
+
return false;
|
|
6479
|
+
}
|
|
6480
|
+
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6481
|
+
}
|
|
6482
|
+
function isIdempotentRequestError(error) {
|
|
6483
|
+
if (!error.config?.method) {
|
|
6484
|
+
// Cannot determine if the request can be retried
|
|
6485
|
+
return false;
|
|
6486
|
+
}
|
|
6487
|
+
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6488
|
+
}
|
|
6489
|
+
function isNetworkOrIdempotentRequestError(error) {
|
|
6490
|
+
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
6491
|
+
}
|
|
6492
|
+
function retryAfter(error = undefined) {
|
|
6493
|
+
const retryAfterHeader = error?.response?.headers['retry-after'];
|
|
6494
|
+
if (!retryAfterHeader) {
|
|
6495
|
+
return 0;
|
|
6496
|
+
}
|
|
6497
|
+
// if the retry after header is a number, convert it to milliseconds
|
|
6498
|
+
let retryAfterMs = (Number(retryAfterHeader) || 0) * 1000;
|
|
6499
|
+
// If the retry after header is a date, get the number of milliseconds until that date
|
|
6500
|
+
if (retryAfterMs === 0) {
|
|
6501
|
+
retryAfterMs = (new Date(retryAfterHeader).valueOf() || 0) - Date.now();
|
|
6502
|
+
}
|
|
6503
|
+
return Math.max(0, retryAfterMs);
|
|
6504
|
+
}
|
|
6505
|
+
function noDelay(_retryNumber = 0, error = undefined) {
|
|
6506
|
+
return Math.max(0, retryAfter(error));
|
|
6507
|
+
}
|
|
6508
|
+
function exponentialDelay(retryNumber = 0, error = undefined, delayFactor = 100) {
|
|
6509
|
+
const calculatedDelay = 2 ** retryNumber * delayFactor;
|
|
6510
|
+
const delay = Math.max(calculatedDelay, retryAfter(error));
|
|
6511
|
+
const randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay
|
|
6512
|
+
return delay + randomSum;
|
|
6513
|
+
}
|
|
6514
|
+
/**
|
|
6515
|
+
* Linear delay
|
|
6516
|
+
* @param {number | undefined} delayFactor - delay factor in milliseconds (default: 100)
|
|
6517
|
+
* @returns {function} (retryNumber: number, error: AxiosError | undefined) => number
|
|
6518
|
+
*/
|
|
6519
|
+
function linearDelay(delayFactor = 100) {
|
|
6520
|
+
return (retryNumber = 0, error = undefined) => {
|
|
6521
|
+
const delay = retryNumber * delayFactor;
|
|
6522
|
+
return Math.max(delay, retryAfter(error));
|
|
6523
|
+
};
|
|
6524
|
+
}
|
|
6525
|
+
const DEFAULT_OPTIONS = {
|
|
6526
|
+
retries: 3,
|
|
6527
|
+
retryCondition: isNetworkOrIdempotentRequestError,
|
|
6528
|
+
retryDelay: noDelay,
|
|
6529
|
+
shouldResetTimeout: false,
|
|
6530
|
+
onRetry: () => { },
|
|
6531
|
+
onMaxRetryTimesExceeded: () => { },
|
|
6532
|
+
validateResponse: null
|
|
6533
|
+
};
|
|
6534
|
+
function getRequestOptions(config, defaultOptions) {
|
|
6535
|
+
return { ...DEFAULT_OPTIONS, ...defaultOptions, ...config[namespace] };
|
|
6536
|
+
}
|
|
6537
|
+
function setCurrentState(config, defaultOptions, resetLastRequestTime = false) {
|
|
6538
|
+
const currentState = getRequestOptions(config, defaultOptions || {});
|
|
6539
|
+
currentState.retryCount = currentState.retryCount || 0;
|
|
6540
|
+
if (!currentState.lastRequestTime || resetLastRequestTime) {
|
|
6541
|
+
currentState.lastRequestTime = Date.now();
|
|
6542
|
+
}
|
|
6543
|
+
config[namespace] = currentState;
|
|
6544
|
+
return currentState;
|
|
6545
|
+
}
|
|
6546
|
+
function fixConfig(axiosInstance, config) {
|
|
6547
|
+
// @ts-ignore
|
|
6548
|
+
if (axiosInstance.defaults.agent === config.agent) {
|
|
6549
|
+
// @ts-ignore
|
|
6550
|
+
delete config.agent;
|
|
6551
|
+
}
|
|
6552
|
+
if (axiosInstance.defaults.httpAgent === config.httpAgent) {
|
|
6553
|
+
delete config.httpAgent;
|
|
6554
|
+
}
|
|
6555
|
+
if (axiosInstance.defaults.httpsAgent === config.httpsAgent) {
|
|
6556
|
+
delete config.httpsAgent;
|
|
6557
|
+
}
|
|
6558
|
+
}
|
|
6559
|
+
async function shouldRetry(currentState, error) {
|
|
6560
|
+
const { retries, retryCondition } = currentState;
|
|
6561
|
+
const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(error);
|
|
6562
|
+
// This could be a promise
|
|
6563
|
+
if (typeof shouldRetryOrPromise === 'object') {
|
|
6564
|
+
try {
|
|
6565
|
+
const shouldRetryPromiseResult = await shouldRetryOrPromise;
|
|
6566
|
+
// keep return true unless shouldRetryPromiseResult return false for compatibility
|
|
6567
|
+
return shouldRetryPromiseResult !== false;
|
|
6568
|
+
}
|
|
6569
|
+
catch (_err) {
|
|
6570
|
+
return false;
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
return shouldRetryOrPromise;
|
|
6574
|
+
}
|
|
6575
|
+
async function handleRetry(axiosInstance, currentState, error, config) {
|
|
6576
|
+
currentState.retryCount += 1;
|
|
6577
|
+
const { retryDelay, shouldResetTimeout, onRetry } = currentState;
|
|
6578
|
+
const delay = retryDelay(currentState.retryCount, error);
|
|
6579
|
+
// Axios fails merging this configuration to the default configuration because it has an issue
|
|
6580
|
+
// with circular structures: https://github.com/mzabriskie/axios/issues/370
|
|
6581
|
+
fixConfig(axiosInstance, config);
|
|
6582
|
+
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
6583
|
+
const lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
6584
|
+
const timeout = config.timeout - lastRequestDuration - delay;
|
|
6585
|
+
if (timeout <= 0) {
|
|
6586
|
+
return Promise.reject(error);
|
|
6587
|
+
}
|
|
6588
|
+
config.timeout = timeout;
|
|
6589
|
+
}
|
|
6590
|
+
config.transformRequest = [(data) => data];
|
|
6591
|
+
await onRetry(currentState.retryCount, error, config);
|
|
6592
|
+
if (config.signal?.aborted) {
|
|
6593
|
+
return Promise.resolve(axiosInstance(config));
|
|
6594
|
+
}
|
|
6595
|
+
return new Promise((resolve) => {
|
|
6596
|
+
const abortListener = () => {
|
|
6597
|
+
clearTimeout(timeout);
|
|
6598
|
+
resolve(axiosInstance(config));
|
|
6599
|
+
};
|
|
6600
|
+
const timeout = setTimeout(() => {
|
|
6601
|
+
resolve(axiosInstance(config));
|
|
6602
|
+
if (config.signal?.removeEventListener) {
|
|
6603
|
+
config.signal.removeEventListener('abort', abortListener);
|
|
6604
|
+
}
|
|
6605
|
+
}, delay);
|
|
6606
|
+
if (config.signal?.addEventListener) {
|
|
6607
|
+
config.signal.addEventListener('abort', abortListener, { once: true });
|
|
6608
|
+
}
|
|
6609
|
+
});
|
|
6610
|
+
}
|
|
6611
|
+
async function handleMaxRetryTimesExceeded(currentState, error) {
|
|
6612
|
+
if (currentState.retryCount >= currentState.retries)
|
|
6613
|
+
await currentState.onMaxRetryTimesExceeded(error, currentState.retryCount);
|
|
6614
|
+
}
|
|
6615
|
+
const axiosRetry = (axiosInstance, defaultOptions) => {
|
|
6616
|
+
const requestInterceptorId = axiosInstance.interceptors.request.use((config) => {
|
|
6617
|
+
setCurrentState(config, defaultOptions, true);
|
|
6618
|
+
if (config[namespace]?.validateResponse) {
|
|
6619
|
+
// by setting this, all HTTP responses will be go through the error interceptor first
|
|
6620
|
+
config.validateStatus = () => false;
|
|
6621
|
+
}
|
|
6622
|
+
return config;
|
|
6623
|
+
});
|
|
6624
|
+
const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (error) => {
|
|
6625
|
+
const { config } = error;
|
|
6626
|
+
// If we have no information to retry the request
|
|
6627
|
+
if (!config) {
|
|
6628
|
+
return Promise.reject(error);
|
|
6629
|
+
}
|
|
6630
|
+
const currentState = setCurrentState(config, defaultOptions);
|
|
6631
|
+
if (error.response && currentState.validateResponse?.(error.response)) {
|
|
6632
|
+
// no issue with response
|
|
6633
|
+
return error.response;
|
|
6634
|
+
}
|
|
6635
|
+
if (await shouldRetry(currentState, error)) {
|
|
6636
|
+
return handleRetry(axiosInstance, currentState, error, config);
|
|
6637
|
+
}
|
|
6638
|
+
await handleMaxRetryTimesExceeded(currentState, error);
|
|
6639
|
+
return Promise.reject(error);
|
|
6640
|
+
});
|
|
6641
|
+
return { requestInterceptorId, responseInterceptorId };
|
|
6642
|
+
};
|
|
6643
|
+
// Compatibility with CommonJS
|
|
6644
|
+
axiosRetry.isNetworkError = isNetworkError;
|
|
6645
|
+
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
6646
|
+
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
6647
|
+
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
6648
|
+
axiosRetry.exponentialDelay = exponentialDelay;
|
|
6649
|
+
axiosRetry.linearDelay = linearDelay;
|
|
6650
|
+
axiosRetry.isRetryableError = isRetryableError;
|
|
6651
|
+
|
|
6397
6652
|
let axiosClient;
|
|
6398
6653
|
async function getAxiosAuthClient() {
|
|
6399
6654
|
if (!axiosClient) {
|
|
@@ -6403,6 +6658,7 @@ async function getAxiosAuthClient() {
|
|
|
6403
6658
|
headers: {
|
|
6404
6659
|
'Content-Type': 'application/json',
|
|
6405
6660
|
},
|
|
6661
|
+
timeout: 30000, // 30s timeout, matching makeApiRequest
|
|
6406
6662
|
});
|
|
6407
6663
|
}
|
|
6408
6664
|
return axiosClient;
|
|
@@ -6449,15 +6705,41 @@ async function createSessionWithPrivy(authToken, address, privyIdToken) {
|
|
|
6449
6705
|
});
|
|
6450
6706
|
return response.data;
|
|
6451
6707
|
}
|
|
6708
|
+
// Deduplicate concurrent refreshSession calls to prevent multiple code paths
|
|
6709
|
+
// (WebSocket reconnection, periodic refresh, API 401 retry) from all hitting
|
|
6710
|
+
// /session/refresh simultaneously.
|
|
6711
|
+
// Note: module-level state is shared across requests in SSR/Node — acceptable
|
|
6712
|
+
// since there is only one active session per server instance (same pattern as
|
|
6713
|
+
// refreshInFlight in api.ts).
|
|
6714
|
+
let refreshInFlight$1 = null;
|
|
6715
|
+
let refreshInFlightToken = null;
|
|
6452
6716
|
async function refreshSession(refreshToken) {
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6717
|
+
if (refreshInFlight$1 && refreshInFlightToken === refreshToken) {
|
|
6718
|
+
return refreshInFlight$1;
|
|
6719
|
+
}
|
|
6720
|
+
refreshInFlightToken = refreshToken;
|
|
6721
|
+
let currentFlight;
|
|
6722
|
+
currentFlight = refreshInFlight$1 = (async () => {
|
|
6723
|
+
try {
|
|
6724
|
+
const client = await getAxiosAuthClient();
|
|
6725
|
+
const config = await getConfig();
|
|
6726
|
+
const appId = config.appId;
|
|
6727
|
+
const response = await client.post('/session/refresh', {
|
|
6728
|
+
refreshToken,
|
|
6729
|
+
appId
|
|
6730
|
+
});
|
|
6731
|
+
return response.data;
|
|
6732
|
+
}
|
|
6733
|
+
finally {
|
|
6734
|
+
// Only clear if we're still the active in-flight request.
|
|
6735
|
+
// A second call with a different token may have replaced us.
|
|
6736
|
+
if (refreshInFlight$1 === currentFlight) {
|
|
6737
|
+
refreshInFlight$1 = null;
|
|
6738
|
+
refreshInFlightToken = null;
|
|
6739
|
+
}
|
|
6740
|
+
}
|
|
6741
|
+
})();
|
|
6742
|
+
return refreshInFlight$1;
|
|
6461
6743
|
}
|
|
6462
6744
|
async function signSessionCreateMessage(_signMessageFunction) {
|
|
6463
6745
|
}
|
|
@@ -6595,14 +6877,10 @@ class WebSessionManager {
|
|
|
6595
6877
|
WebSessionManager.TAROBASE_SESSION_STORAGE_KEY = "tarobase_session_storage";
|
|
6596
6878
|
|
|
6597
6879
|
var webSessionManager = /*#__PURE__*/Object.freeze({
|
|
6598
|
-
|
|
6599
|
-
|
|
6880
|
+
__proto__: null,
|
|
6881
|
+
WebSessionManager: WebSessionManager
|
|
6600
6882
|
});
|
|
6601
6883
|
|
|
6602
|
-
function getDefaultExportFromCjs (x) {
|
|
6603
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
6604
|
-
}
|
|
6605
|
-
|
|
6606
6884
|
var buffer$1 = {};
|
|
6607
6885
|
|
|
6608
6886
|
var base64Js$1 = {};
|
|
@@ -9399,7 +9677,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
9399
9677
|
}
|
|
9400
9678
|
}
|
|
9401
9679
|
else if (lutKey != null) {
|
|
9402
|
-
|
|
9680
|
+
// The LUT may have just been created server-side and the client's RPC node
|
|
9681
|
+
// may not have indexed it yet (load-balancer split). Retry with exponential
|
|
9682
|
+
// back-off; first retry at 100 ms almost always resolves it.
|
|
9683
|
+
let table = null;
|
|
9684
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
9685
|
+
const { value } = await connection.getAddressLookupTable(new PublicKey(lutKey));
|
|
9686
|
+
if (value) {
|
|
9687
|
+
table = value;
|
|
9688
|
+
break;
|
|
9689
|
+
}
|
|
9690
|
+
if (attempt < 4)
|
|
9691
|
+
await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
|
|
9692
|
+
}
|
|
9403
9693
|
if (!table)
|
|
9404
9694
|
throw new Error('LUT not found after creation/extend');
|
|
9405
9695
|
lookupTables.push(table);
|
|
@@ -9534,8 +9824,8 @@ class ServerSessionManager {
|
|
|
9534
9824
|
ServerSessionManager.instance = new ServerSessionManager();
|
|
9535
9825
|
|
|
9536
9826
|
var serverSessionManager = /*#__PURE__*/Object.freeze({
|
|
9537
|
-
|
|
9538
|
-
|
|
9827
|
+
__proto__: null,
|
|
9828
|
+
ServerSessionManager: ServerSessionManager
|
|
9539
9829
|
});
|
|
9540
9830
|
|
|
9541
9831
|
/**
|
|
@@ -9634,6 +9924,23 @@ async function updateIdTokenAndAccessToken(idToken, accessToken, isServer = fals
|
|
|
9634
9924
|
await WebSessionManager.updateIdTokenAndAccessToken(idToken, accessToken);
|
|
9635
9925
|
}
|
|
9636
9926
|
|
|
9927
|
+
const apiClient = globalAxios.create();
|
|
9928
|
+
axiosRetry(apiClient, {
|
|
9929
|
+
retries: 2,
|
|
9930
|
+
retryCondition: (error) => {
|
|
9931
|
+
var _a, _b;
|
|
9932
|
+
// Only retry GET requests on network errors (ECONNRESET, ETIMEDOUT, etc.)
|
|
9933
|
+
// Writes (POST/PUT) are not retried — the server may have processed
|
|
9934
|
+
// the request before the connection was reset.
|
|
9935
|
+
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';
|
|
9936
|
+
},
|
|
9937
|
+
retryDelay: axiosRetry.exponentialDelay,
|
|
9938
|
+
shouldResetTimeout: true,
|
|
9939
|
+
onRetry: (retryCount, error, requestConfig) => {
|
|
9940
|
+
var _a;
|
|
9941
|
+
console.warn(`[tarobase-sdk] retry ${retryCount} for ${(_a = requestConfig.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()} ${requestConfig.url} — ${error.code || error.message}`);
|
|
9942
|
+
},
|
|
9943
|
+
});
|
|
9637
9944
|
const refreshInFlight = new Map();
|
|
9638
9945
|
async function refreshAuthSessionOnce(appId, isServer) {
|
|
9639
9946
|
const key = `${isServer ? "server" : "web"}:${appId}`;
|
|
@@ -9680,6 +9987,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
9680
9987
|
ServerSessionManager.instance.clearSession();
|
|
9681
9988
|
};
|
|
9682
9989
|
async function executeRequest() {
|
|
9990
|
+
var _a;
|
|
9683
9991
|
// When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
|
|
9684
9992
|
// Otherwise use the global createAuthHeader (default path).
|
|
9685
9993
|
const authHeader = (_overrides === null || _overrides === void 0 ? void 0 : _overrides._getAuthHeaders)
|
|
@@ -9701,11 +10009,12 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
9701
10009
|
method,
|
|
9702
10010
|
url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
|
|
9703
10011
|
headers,
|
|
10012
|
+
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : 30000,
|
|
9704
10013
|
};
|
|
9705
10014
|
if (method !== "GET" && method !== "get") {
|
|
9706
10015
|
requestConfig.data = data ? JSON.stringify(data) : {};
|
|
9707
10016
|
}
|
|
9708
|
-
const response = await
|
|
10017
|
+
const response = await apiClient(requestConfig);
|
|
9709
10018
|
return { data: response.data, status: response.status, headers: response.headers };
|
|
9710
10019
|
}
|
|
9711
10020
|
try {
|
|
@@ -10641,6 +10950,7 @@ function scheduleTokenRefresh(connection, isServer) {
|
|
|
10641
10950
|
// This replaces the old single setTimeout approach which was unreliable for long
|
|
10642
10951
|
// delays (browsers throttle/suspend timers in background tabs).
|
|
10643
10952
|
connection.tokenRefreshTimer = setInterval(async () => {
|
|
10953
|
+
var _a, _b;
|
|
10644
10954
|
try {
|
|
10645
10955
|
const currentToken = await getIdToken$1(isServer);
|
|
10646
10956
|
if (!currentToken)
|
|
@@ -10671,6 +10981,17 @@ function scheduleTokenRefresh(connection, isServer) {
|
|
|
10671
10981
|
}
|
|
10672
10982
|
}
|
|
10673
10983
|
catch (refreshError) {
|
|
10984
|
+
// If the refresh token itself is invalid (401/403), stop retrying —
|
|
10985
|
+
// the token won't magically become valid next interval, and continuing
|
|
10986
|
+
// to hammer /session/refresh causes 429 rate-limit storms.
|
|
10987
|
+
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) {
|
|
10988
|
+
console.warn('[WS v2] Refresh token rejected (401/403), stopping periodic refresh');
|
|
10989
|
+
if (connection.tokenRefreshTimer) {
|
|
10990
|
+
clearInterval(connection.tokenRefreshTimer);
|
|
10991
|
+
connection.tokenRefreshTimer = null;
|
|
10992
|
+
}
|
|
10993
|
+
return;
|
|
10994
|
+
}
|
|
10674
10995
|
console.warn('[WS v2] Proactive token refresh failed, will retry next interval:', refreshError);
|
|
10675
10996
|
}
|
|
10676
10997
|
}
|
|
@@ -10681,6 +11002,7 @@ function scheduleTokenRefresh(connection, isServer) {
|
|
|
10681
11002
|
}, TOKEN_CHECK_INTERVAL);
|
|
10682
11003
|
}
|
|
10683
11004
|
async function getFreshAuthToken(isServer) {
|
|
11005
|
+
var _a, _b;
|
|
10684
11006
|
const currentToken = await getIdToken$1(isServer);
|
|
10685
11007
|
if (!currentToken) {
|
|
10686
11008
|
return null;
|
|
@@ -10703,6 +11025,17 @@ async function getFreshAuthToken(isServer) {
|
|
|
10703
11025
|
}
|
|
10704
11026
|
catch (error) {
|
|
10705
11027
|
console.error('[WS v2] Error refreshing token:', error);
|
|
11028
|
+
// If the refresh token is permanently invalid (401/403), clear the stale
|
|
11029
|
+
// session from storage so future attempts don't keep retrying with it.
|
|
11030
|
+
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)) {
|
|
11031
|
+
try {
|
|
11032
|
+
const { WebSessionManager } = await Promise.resolve().then(function () { return webSessionManager; });
|
|
11033
|
+
WebSessionManager.clearSession();
|
|
11034
|
+
}
|
|
11035
|
+
catch (clearError) {
|
|
11036
|
+
console.warn('[WS v2] Failed to clear stale session:', clearError);
|
|
11037
|
+
}
|
|
11038
|
+
}
|
|
10706
11039
|
}
|
|
10707
11040
|
// Return null instead of the expired token to prevent infinite 401 reconnect storms.
|
|
10708
11041
|
// The server accepts unauthenticated connections; auth-required subscriptions will
|
|
@@ -10823,7 +11156,16 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
10823
11156
|
ws.addEventListener('open', () => {
|
|
10824
11157
|
connection.isConnecting = false;
|
|
10825
11158
|
connection.isConnected = true;
|
|
10826
|
-
|
|
11159
|
+
// NOTE: Do NOT reset consecutiveAuthFailures here. It is reset when a
|
|
11160
|
+
// fresh auth token is actually obtained (in urlProvider, line ~389) or on
|
|
11161
|
+
// an explicit auth change (reconnectWithNewAuthV2, line ~854). Resetting
|
|
11162
|
+
// on every 'open' event created an infinite loop: auth fails 5x → connect
|
|
11163
|
+
// without auth → open resets counter → disconnect → auth fails 5x again →
|
|
11164
|
+
// repeat forever, hammering /session/refresh and causing 429s.
|
|
11165
|
+
//
|
|
11166
|
+
// An elevated counter is safe for anonymous/guest sessions: when there's no
|
|
11167
|
+
// token at all (getIdToken returns null), the counter is never checked —
|
|
11168
|
+
// urlProvider skips straight to unauthenticated connection.
|
|
10827
11169
|
// Schedule periodic token freshness checks
|
|
10828
11170
|
scheduleTokenRefresh(connection, isServer);
|
|
10829
11171
|
// Re-subscribe to all existing subscriptions after reconnect
|
|
@@ -15321,7 +15663,7 @@ async function loadDependencies() {
|
|
|
15321
15663
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
15322
15664
|
import('react'),
|
|
15323
15665
|
import('react-dom/client'),
|
|
15324
|
-
import('./index-
|
|
15666
|
+
import('./index-COIUWugk.esm.js')
|
|
15325
15667
|
]);
|
|
15326
15668
|
// Extract default export from ESM module namespace
|
|
15327
15669
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -20796,7 +21138,7 @@ async function loadMwaProtocol() {
|
|
|
20796
21138
|
return mwaProtocolLoadPromise;
|
|
20797
21139
|
mwaProtocolLoadPromise = (async () => {
|
|
20798
21140
|
try {
|
|
20799
|
-
mwaProtocolModule = await import('./index.browser-
|
|
21141
|
+
mwaProtocolModule = await import('./index.browser-B4zXnffD.esm.js');
|
|
20800
21142
|
}
|
|
20801
21143
|
catch (e) {
|
|
20802
21144
|
console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
|
|
@@ -20818,7 +21160,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
20818
21160
|
if (typeof window === 'undefined')
|
|
20819
21161
|
return;
|
|
20820
21162
|
try {
|
|
20821
|
-
const walletStandardMobile = await import('./index.browser-
|
|
21163
|
+
const walletStandardMobile = await import('./index.browser-BuHl80dp.esm.js');
|
|
20822
21164
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
20823
21165
|
if (!registerMwa) {
|
|
20824
21166
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -21727,4 +22069,4 @@ class PrivyExpoProvider {
|
|
|
21727
22069
|
}
|
|
21728
22070
|
|
|
21729
22071
|
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-
|
|
22072
|
+
//# sourceMappingURL=index-Db0NqU8R.esm.js.map
|