@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
|
@@ -297,35 +297,18 @@ function resolveProofTimeoutMs(configured) {
|
|
|
297
297
|
}
|
|
298
298
|
return configured;
|
|
299
299
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
if (prop === "addEventListener") {
|
|
304
|
-
return (type, listener, options) => {
|
|
305
|
-
if (type === "abort" && target.aborted) {
|
|
306
|
-
queueMicrotask(() => {
|
|
307
|
-
listener.call(target, new Event("abort"));
|
|
308
|
-
});
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
target.addEventListener(type, listener, options);
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
const value = Reflect.get(target, prop, target);
|
|
315
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
316
|
-
}
|
|
317
|
-
});
|
|
300
|
+
var TRANSIENT_HTTP_STATUSES = /* @__PURE__ */ new Set([408, 425, 429, 500, 502, 503, 504]);
|
|
301
|
+
function isTransientGatewayError(err) {
|
|
302
|
+
return err instanceof JsonRpcNetworkError && TRANSIENT_HTTP_STATUSES.has(err.status);
|
|
318
303
|
}
|
|
319
|
-
function
|
|
320
|
-
return new Promise((
|
|
321
|
-
|
|
322
|
-
reject(signal.reason);
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
304
|
+
function pause(ms, signal) {
|
|
305
|
+
return new Promise((resolve) => {
|
|
306
|
+
const timer = setTimeout(resolve, ms);
|
|
325
307
|
signal.addEventListener(
|
|
326
308
|
"abort",
|
|
327
309
|
() => {
|
|
328
|
-
|
|
310
|
+
clearTimeout(timer);
|
|
311
|
+
resolve();
|
|
329
312
|
},
|
|
330
313
|
{ once: true }
|
|
331
314
|
);
|
|
@@ -348,17 +331,23 @@ async function awaitProofBounded(deps, transaction, external) {
|
|
|
348
331
|
)
|
|
349
332
|
);
|
|
350
333
|
}, deps.timeoutMs);
|
|
351
|
-
const wait = waitInclusionProof(
|
|
352
|
-
deps.client,
|
|
353
|
-
deps.trustBase,
|
|
354
|
-
deps.predicateVerifier,
|
|
355
|
-
transaction,
|
|
356
|
-
lateDeliveringSignal(controller.signal),
|
|
357
|
-
deps.intervalMs
|
|
358
|
-
);
|
|
359
|
-
wait.catch(() => void 0);
|
|
360
334
|
try {
|
|
361
|
-
|
|
335
|
+
for (; ; ) {
|
|
336
|
+
try {
|
|
337
|
+
return await waitInclusionProof(
|
|
338
|
+
deps.client,
|
|
339
|
+
deps.trustBase,
|
|
340
|
+
deps.predicateVerifier,
|
|
341
|
+
transaction,
|
|
342
|
+
controller.signal,
|
|
343
|
+
deps.intervalMs
|
|
344
|
+
);
|
|
345
|
+
} catch (err) {
|
|
346
|
+
if (controller.signal.aborted) throw err;
|
|
347
|
+
if (!isTransientGatewayError(err)) throw err;
|
|
348
|
+
await pause(deps.intervalMs, controller.signal);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
362
351
|
} finally {
|
|
363
352
|
clearTimeout(timer);
|
|
364
353
|
external?.removeEventListener("abort", relayAbort);
|