@unicitylabs/sphere-sdk 0.14.11-dev.1 → 0.14.11-dev.2
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 +18 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +18 -2
- 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 +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +18 -2
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +18 -2
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12900,6 +12900,7 @@ var InventoryView = class {
|
|
|
12900
12900
|
|
|
12901
12901
|
// modules/payments-v2/receive/Receive.ts
|
|
12902
12902
|
var ACK_BATCH_SIZE = 200;
|
|
12903
|
+
var REFRESH_INTERVAL_MS = 750;
|
|
12903
12904
|
var POLL_INTERVAL_MS = 3e4;
|
|
12904
12905
|
var ATTENTION_CLAIM_CONFLICT = "claim:conflict";
|
|
12905
12906
|
function receivedDedupKey(tokenId, stateHash) {
|
|
@@ -12916,6 +12917,7 @@ var Receive = class {
|
|
|
12916
12917
|
drainFlight = new SingleFlight();
|
|
12917
12918
|
pollTimer = null;
|
|
12918
12919
|
unsubscribeWake = null;
|
|
12920
|
+
lastRefreshAt = 0;
|
|
12919
12921
|
drainOnce() {
|
|
12920
12922
|
return this.drainFlight.run(() => this.doDrain());
|
|
12921
12923
|
}
|
|
@@ -12933,6 +12935,14 @@ var Receive = class {
|
|
|
12933
12935
|
this.unsubscribeWake?.();
|
|
12934
12936
|
this.unsubscribeWake = null;
|
|
12935
12937
|
}
|
|
12938
|
+
/** Ask for a mirror refresh at most once per REFRESH_INTERVAL_MS. */
|
|
12939
|
+
maybeRefresh(deps) {
|
|
12940
|
+
if (deps.refreshView === void 0) return;
|
|
12941
|
+
const now = deps.now?.() ?? Date.now();
|
|
12942
|
+
if (now - this.lastRefreshAt < REFRESH_INTERVAL_MS) return;
|
|
12943
|
+
this.lastRefreshAt = now;
|
|
12944
|
+
deps.refreshView();
|
|
12945
|
+
}
|
|
12936
12946
|
async doDrain() {
|
|
12937
12947
|
const deps = this.deps;
|
|
12938
12948
|
const engine = deps.engine();
|
|
@@ -12946,6 +12956,7 @@ var Receive = class {
|
|
|
12946
12956
|
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
12947
12957
|
await this.processEntry(deps, engine, entry, pending, stored);
|
|
12948
12958
|
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
12959
|
+
if (stored.length > 0) this.maybeRefresh(deps);
|
|
12949
12960
|
}
|
|
12950
12961
|
await flushAcks(deps, pending, pageEpoch);
|
|
12951
12962
|
const served = deps.delivery.incomingEpoch();
|
|
@@ -13845,7 +13856,7 @@ function composeFacadeParts(deps, hooks) {
|
|
|
13845
13856
|
machineDeps,
|
|
13846
13857
|
machine: new TransferMachine(machineDeps),
|
|
13847
13858
|
heldStates,
|
|
13848
|
-
receiveLoop: buildReceive(deps, hooks, historyStore, heldStates),
|
|
13859
|
+
receiveLoop: buildReceive(deps, hooks, historyStore, heldStates, view),
|
|
13849
13860
|
requests: buildRequests(deps, hooks),
|
|
13850
13861
|
restoreDeps: buildRestoreDeps(deps, machineDeps, machineStores, view)
|
|
13851
13862
|
};
|
|
@@ -13912,7 +13923,7 @@ function buildMachineDeps(deps, hooks, historyStore) {
|
|
|
13912
13923
|
}
|
|
13913
13924
|
};
|
|
13914
13925
|
}
|
|
13915
|
-
function buildReceive(deps, hooks, historyStore, heldStates) {
|
|
13926
|
+
function buildReceive(deps, hooks, historyStore, heldStates, view) {
|
|
13916
13927
|
return new Receive({
|
|
13917
13928
|
delivery: deps.deliveryPort,
|
|
13918
13929
|
engine: () => hooks.engine(),
|
|
@@ -13926,6 +13937,11 @@ function buildReceive(deps, hooks, historyStore, heldStates) {
|
|
|
13926
13937
|
registry: deps.registry,
|
|
13927
13938
|
recordReceived: (record) => recordReceived(historyStore, record),
|
|
13928
13939
|
emit: (event, transfer) => deps.emit(event, transfer),
|
|
13940
|
+
// The mirror is the balance the wallet renders; refresh it as the drain runs
|
|
13941
|
+
// so a multi-token receive lands progressively instead of all at the end.
|
|
13942
|
+
refreshView: () => {
|
|
13943
|
+
void view.delta().catch(() => void 0);
|
|
13944
|
+
},
|
|
13929
13945
|
attention: (transferId, code, detail) => {
|
|
13930
13946
|
deps.emit(
|
|
13931
13947
|
"transfer:attention",
|