@unicitylabs/sphere-sdk 0.14.11-dev.7 → 0.14.11-dev.8
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 +26 -12
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +26 -12
- 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 +1 -0
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js +1 -0
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +25 -12
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +25 -12
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11361,12 +11361,19 @@ var SerialChain = class {
|
|
|
11361
11361
|
return run;
|
|
11362
11362
|
}
|
|
11363
11363
|
};
|
|
11364
|
-
function coalesced(run) {
|
|
11364
|
+
function coalesced(run, observe) {
|
|
11365
11365
|
let inFlight = false;
|
|
11366
11366
|
let queued = false;
|
|
11367
11367
|
const start = () => {
|
|
11368
11368
|
inFlight = true;
|
|
11369
|
-
|
|
11369
|
+
let running;
|
|
11370
|
+
try {
|
|
11371
|
+
running = run();
|
|
11372
|
+
} catch {
|
|
11373
|
+
running = Promise.resolve();
|
|
11374
|
+
}
|
|
11375
|
+
observe?.(running);
|
|
11376
|
+
void running.catch(() => void 0).finally(() => {
|
|
11370
11377
|
inFlight = false;
|
|
11371
11378
|
if (!queued) return;
|
|
11372
11379
|
queued = false;
|
|
@@ -13123,6 +13130,17 @@ var Receive = class {
|
|
|
13123
13130
|
await flushAcks(deps, pending, epochOf);
|
|
13124
13131
|
deps.refreshView();
|
|
13125
13132
|
}
|
|
13133
|
+
/** One listing pass: process each entry, flushing and refreshing as it goes. */
|
|
13134
|
+
async drainPages(ctx, basis) {
|
|
13135
|
+
const { deps, engine, pending, stored, pageEpoch } = ctx;
|
|
13136
|
+
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
13137
|
+
const storedBefore = stored.length;
|
|
13138
|
+
await this.processEntry(deps, engine, entry, pending, stored);
|
|
13139
|
+
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
13140
|
+
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
13141
|
+
}
|
|
13142
|
+
await flushAcks(deps, pending, pageEpoch);
|
|
13143
|
+
}
|
|
13126
13144
|
async doDrain() {
|
|
13127
13145
|
const deps = this.deps;
|
|
13128
13146
|
this.lastRefreshAt = deps.now?.() ?? Date.now();
|
|
@@ -13134,13 +13152,7 @@ var Receive = class {
|
|
|
13134
13152
|
const record = await deps.kv.get(STORE_KEYS.streamCursor("mailbox"));
|
|
13135
13153
|
let basis = record !== null && record.syncEpoch === deps.syncEpoch() ? record : null;
|
|
13136
13154
|
for (let pass = 0; pass < 2; pass++) {
|
|
13137
|
-
|
|
13138
|
-
const storedBefore = stored.length;
|
|
13139
|
-
await this.processEntry(deps, engine, entry, pending, stored);
|
|
13140
|
-
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
13141
|
-
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
13142
|
-
}
|
|
13143
|
-
await flushAcks(deps, pending, pageEpoch);
|
|
13155
|
+
await this.drainPages({ deps, engine, pending, stored, pageEpoch }, basis);
|
|
13144
13156
|
const served = deps.delivery.incomingEpoch();
|
|
13145
13157
|
if (basis === null || served === null || served === basis.syncEpoch) break;
|
|
13146
13158
|
await deps.kv.remove(STORE_KEYS.streamCursor("mailbox"));
|
|
@@ -13153,6 +13165,7 @@ var Receive = class {
|
|
|
13153
13165
|
logger.warn("PaymentsV2", "receive ack flush failed \u2014 cursor holds at the acked prefix:", flushErr);
|
|
13154
13166
|
});
|
|
13155
13167
|
}
|
|
13168
|
+
if (stored.length > 0) deps.refreshView?.();
|
|
13156
13169
|
return stored;
|
|
13157
13170
|
}
|
|
13158
13171
|
async processEntry(deps, engine, entry, pending, stored) {
|
|
@@ -14083,7 +14096,7 @@ function composeFacadeParts(deps, hooks) {
|
|
|
14083
14096
|
const machineDeps = buildMachineDeps(deps, hooks, historyStore);
|
|
14084
14097
|
const machineStores = createMachineStores(deps.kv);
|
|
14085
14098
|
const heldStates = /* @__PURE__ */ new Map();
|
|
14086
|
-
const refreshView = coalesced(() => view.delta());
|
|
14099
|
+
const refreshView = coalesced(() => view.delta(), hooks.track);
|
|
14087
14100
|
return {
|
|
14088
14101
|
ownPubkeyBytes,
|
|
14089
14102
|
view,
|
|
@@ -14226,7 +14239,8 @@ var PaymentsFacade = class {
|
|
|
14226
14239
|
const parts = composeFacadeParts(deps, {
|
|
14227
14240
|
engine: () => this.engine(),
|
|
14228
14241
|
send: (request) => this.send(request),
|
|
14229
|
-
isActiveOp: (id) => this.activeMoneyOps.has(id)
|
|
14242
|
+
isActiveOp: (id) => this.activeMoneyOps.has(id),
|
|
14243
|
+
track: (op) => this.trackTail(op)
|
|
14230
14244
|
});
|
|
14231
14245
|
this.view = parts.view;
|
|
14232
14246
|
this.wakeRefresh = parts.refreshView;
|
|
@@ -14366,7 +14380,6 @@ var PaymentsFacade = class {
|
|
|
14366
14380
|
}
|
|
14367
14381
|
async receive() {
|
|
14368
14382
|
const transfers = await this.track(this.receiveLoop.drainOnce());
|
|
14369
|
-
if (transfers.length > 0) this.trackTail(this.view.delta());
|
|
14370
14383
|
return { transfers };
|
|
14371
14384
|
}
|
|
14372
14385
|
mint(coinId, amount) {
|
|
@@ -15761,6 +15774,7 @@ var WalletApiDeliveryPort = class {
|
|
|
15761
15774
|
await this.settleClaims(acks, settled, outcomes);
|
|
15762
15775
|
await this.settleRejects(acks, settled);
|
|
15763
15776
|
} catch (err) {
|
|
15777
|
+
await this.addSeenAll(settled).catch(() => void 0);
|
|
15764
15778
|
throw asRetryable(err);
|
|
15765
15779
|
}
|
|
15766
15780
|
await this.addSeenAll(settled);
|