@unicitylabs/sphere-sdk 0.14.4 → 0.14.5
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/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +24 -35
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +24 -35
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/index.cjs +24 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -35
- package/dist/index.js.map +1 -1
- package/dist/token-engine/index.cjs +24 -35
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.js +24 -35
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -332,35 +332,18 @@ function resolveProofTimeoutMs(configured) {
|
|
|
332
332
|
}
|
|
333
333
|
return configured;
|
|
334
334
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (prop === "addEventListener") {
|
|
339
|
-
return (type, listener, options) => {
|
|
340
|
-
if (type === "abort" && target.aborted) {
|
|
341
|
-
queueMicrotask(() => {
|
|
342
|
-
listener.call(target, new Event("abort"));
|
|
343
|
-
});
|
|
344
|
-
return;
|
|
345
|
-
}
|
|
346
|
-
target.addEventListener(type, listener, options);
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
const value = Reflect.get(target, prop, target);
|
|
350
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
351
|
-
}
|
|
352
|
-
});
|
|
335
|
+
var TRANSIENT_HTTP_STATUSES = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
336
|
+
function isTransientGatewayError(err) {
|
|
337
|
+
return err instanceof import_JsonRpcNetworkError.JsonRpcNetworkError && TRANSIENT_HTTP_STATUSES.has(err.status);
|
|
353
338
|
}
|
|
354
|
-
function
|
|
355
|
-
return new Promise((
|
|
356
|
-
|
|
357
|
-
reject(signal.reason);
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
339
|
+
function pause(ms, signal) {
|
|
340
|
+
return new Promise((resolve) => {
|
|
341
|
+
const timer = setTimeout(resolve, ms);
|
|
360
342
|
signal.addEventListener(
|
|
361
343
|
"abort",
|
|
362
344
|
() => {
|
|
363
|
-
|
|
345
|
+
clearTimeout(timer);
|
|
346
|
+
resolve();
|
|
364
347
|
},
|
|
365
348
|
{ once: true }
|
|
366
349
|
);
|
|
@@ -383,17 +366,23 @@ async function awaitProofBounded(deps, transaction, external) {
|
|
|
383
366
|
)
|
|
384
367
|
);
|
|
385
368
|
}, deps.timeoutMs);
|
|
386
|
-
const wait = (0, import_InclusionProofUtils.waitInclusionProof)(
|
|
387
|
-
deps.client,
|
|
388
|
-
deps.trustBase,
|
|
389
|
-
deps.predicateVerifier,
|
|
390
|
-
transaction,
|
|
391
|
-
lateDeliveringSignal(controller.signal),
|
|
392
|
-
deps.intervalMs
|
|
393
|
-
);
|
|
394
|
-
wait.catch(() => void 0);
|
|
395
369
|
try {
|
|
396
|
-
|
|
370
|
+
for (; ; ) {
|
|
371
|
+
try {
|
|
372
|
+
return await (0, import_InclusionProofUtils.waitInclusionProof)(
|
|
373
|
+
deps.client,
|
|
374
|
+
deps.trustBase,
|
|
375
|
+
deps.predicateVerifier,
|
|
376
|
+
transaction,
|
|
377
|
+
controller.signal,
|
|
378
|
+
deps.intervalMs
|
|
379
|
+
);
|
|
380
|
+
} catch (err) {
|
|
381
|
+
if (controller.signal.aborted) throw err;
|
|
382
|
+
if (!isTransientGatewayError(err)) throw err;
|
|
383
|
+
await pause(deps.intervalMs, controller.signal);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
397
386
|
} finally {
|
|
398
387
|
clearTimeout(timer);
|
|
399
388
|
external?.removeEventListener("abort", relayAbort);
|