@unicitylabs/sphere-sdk 0.14.6-dev.1 → 0.14.7
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 +14 -6
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +14 -6
- 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/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +6 -2
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +6 -2
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs +8 -4
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.js +8 -4
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -9484,12 +9484,15 @@ function pause(ms, signal) {
|
|
|
9484
9484
|
});
|
|
9485
9485
|
}
|
|
9486
9486
|
async function retryTransient(attempt, signal, intervalMs) {
|
|
9487
|
+
let retried = false;
|
|
9487
9488
|
for (; ; ) {
|
|
9489
|
+
if (signal.aborted) throw signal.reason;
|
|
9488
9490
|
try {
|
|
9489
|
-
return await attempt();
|
|
9491
|
+
return { value: await attempt(), retried };
|
|
9490
9492
|
} catch (err) {
|
|
9491
9493
|
if (signal.aborted) throw err;
|
|
9492
9494
|
if (!isTransientGatewayError(err)) throw err;
|
|
9495
|
+
retried = true;
|
|
9493
9496
|
await pause(intervalMs, signal);
|
|
9494
9497
|
}
|
|
9495
9498
|
}
|
|
@@ -9515,7 +9518,7 @@ function certificationDeadline(timeoutMs, external, label) {
|
|
|
9515
9518
|
};
|
|
9516
9519
|
}
|
|
9517
9520
|
async function awaitProofBounded(deps, transaction, signal) {
|
|
9518
|
-
|
|
9521
|
+
const { value } = await retryTransient(
|
|
9519
9522
|
() => (0, import_InclusionProofUtils.waitInclusionProof)(
|
|
9520
9523
|
deps.client,
|
|
9521
9524
|
deps.trustBase,
|
|
@@ -9527,6 +9530,7 @@ async function awaitProofBounded(deps, transaction, signal) {
|
|
|
9527
9530
|
signal,
|
|
9528
9531
|
deps.intervalMs
|
|
9529
9532
|
);
|
|
9533
|
+
return value;
|
|
9530
9534
|
}
|
|
9531
9535
|
|
|
9532
9536
|
// token-engine/errors.ts
|
|
@@ -10122,14 +10126,14 @@ var SphereTokenEngine = class {
|
|
|
10122
10126
|
let submitError = null;
|
|
10123
10127
|
let submitRejectedCleanly = false;
|
|
10124
10128
|
try {
|
|
10125
|
-
const response = await retryTransient(
|
|
10129
|
+
const { value: response, retried } = await retryTransient(
|
|
10126
10130
|
() => this.deps.client.submitCertificationRequest(certificationData),
|
|
10127
10131
|
signal,
|
|
10128
10132
|
this.deps.proofPollIntervalMs ?? DEFAULT_PROOF_POLL_INTERVAL_MS
|
|
10129
10133
|
);
|
|
10130
10134
|
if (response.status !== import_CertificationResponse.CertificationStatus.SUCCESS) {
|
|
10131
10135
|
submitError = new SphereError(`${failLabel}: ${response.status}`, failCode);
|
|
10132
|
-
submitRejectedCleanly = CLEAN_REJECT_STATUSES.has(response.status);
|
|
10136
|
+
submitRejectedCleanly = !retried && CLEAN_REJECT_STATUSES.has(response.status);
|
|
10133
10137
|
}
|
|
10134
10138
|
} catch (err) {
|
|
10135
10139
|
submitError = err ?? new SphereError(`${failLabel}: submit failed`, failCode);
|
|
@@ -11526,6 +11530,9 @@ function classifyError(e) {
|
|
|
11526
11530
|
}
|
|
11527
11531
|
return "other";
|
|
11528
11532
|
}
|
|
11533
|
+
function firstNonConflictError(outcomes) {
|
|
11534
|
+
return outcomes.find((o) => o.error !== void 0 && classifyError(o.error) !== "conflict");
|
|
11535
|
+
}
|
|
11529
11536
|
function summarize(outcomes) {
|
|
11530
11537
|
const committed = outcomes.filter((o) => o.certified);
|
|
11531
11538
|
const rank = { "keep-open": 3, conflict: 2, other: 1 };
|
|
@@ -11586,14 +11593,15 @@ var TransferMachine = class {
|
|
|
11586
11593
|
...r.payload.memo !== void 0 ? { memo: r.payload.memo } : {}
|
|
11587
11594
|
};
|
|
11588
11595
|
const outcomes = await this.resumeOps(ctx, engine, r);
|
|
11589
|
-
const { committed
|
|
11596
|
+
const { committed } = summarize(outcomes);
|
|
11590
11597
|
const conflicts = this.toConflicts(engine, r, outcomes);
|
|
11591
11598
|
if (committed.length === 0 && conflicts.length > 0) throw conflicts[0].error;
|
|
11592
11599
|
let deliveryPending = false;
|
|
11593
11600
|
if (committed.length > 0) {
|
|
11594
11601
|
deliveryPending = await this.deliverSet(r.transferId, r.payload.recipient, r.payload.memo, committed);
|
|
11595
11602
|
}
|
|
11596
|
-
|
|
11603
|
+
const blocking = firstNonConflictError(outcomes);
|
|
11604
|
+
if (blocking !== void 0) throw blocking.error;
|
|
11597
11605
|
await this.applyCommitted(engine, r.transferId, committed);
|
|
11598
11606
|
if (conflicts.length > 0) {
|
|
11599
11607
|
return { deliveryPending, partial: await this.settlePartial(engine, r, committed, conflicts) };
|