@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.cjs
CHANGED
|
@@ -13028,6 +13028,7 @@ var InventoryView = class {
|
|
|
13028
13028
|
|
|
13029
13029
|
// modules/payments-v2/receive/Receive.ts
|
|
13030
13030
|
var ACK_BATCH_SIZE = 200;
|
|
13031
|
+
var REFRESH_INTERVAL_MS = 750;
|
|
13031
13032
|
var POLL_INTERVAL_MS = 3e4;
|
|
13032
13033
|
var ATTENTION_CLAIM_CONFLICT = "claim:conflict";
|
|
13033
13034
|
function receivedDedupKey(tokenId, stateHash) {
|
|
@@ -13044,6 +13045,7 @@ var Receive = class {
|
|
|
13044
13045
|
drainFlight = new SingleFlight();
|
|
13045
13046
|
pollTimer = null;
|
|
13046
13047
|
unsubscribeWake = null;
|
|
13048
|
+
lastRefreshAt = 0;
|
|
13047
13049
|
drainOnce() {
|
|
13048
13050
|
return this.drainFlight.run(() => this.doDrain());
|
|
13049
13051
|
}
|
|
@@ -13061,6 +13063,14 @@ var Receive = class {
|
|
|
13061
13063
|
this.unsubscribeWake?.();
|
|
13062
13064
|
this.unsubscribeWake = null;
|
|
13063
13065
|
}
|
|
13066
|
+
/** Ask for a mirror refresh at most once per REFRESH_INTERVAL_MS. */
|
|
13067
|
+
maybeRefresh(deps) {
|
|
13068
|
+
if (deps.refreshView === void 0) return;
|
|
13069
|
+
const now = deps.now?.() ?? Date.now();
|
|
13070
|
+
if (now - this.lastRefreshAt < REFRESH_INTERVAL_MS) return;
|
|
13071
|
+
this.lastRefreshAt = now;
|
|
13072
|
+
deps.refreshView();
|
|
13073
|
+
}
|
|
13064
13074
|
async doDrain() {
|
|
13065
13075
|
const deps = this.deps;
|
|
13066
13076
|
const engine = deps.engine();
|
|
@@ -13074,6 +13084,7 @@ var Receive = class {
|
|
|
13074
13084
|
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
13075
13085
|
await this.processEntry(deps, engine, entry, pending, stored);
|
|
13076
13086
|
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
13087
|
+
if (stored.length > 0) this.maybeRefresh(deps);
|
|
13077
13088
|
}
|
|
13078
13089
|
await flushAcks(deps, pending, pageEpoch);
|
|
13079
13090
|
const served = deps.delivery.incomingEpoch();
|
|
@@ -13973,7 +13984,7 @@ function composeFacadeParts(deps, hooks) {
|
|
|
13973
13984
|
machineDeps,
|
|
13974
13985
|
machine: new TransferMachine(machineDeps),
|
|
13975
13986
|
heldStates,
|
|
13976
|
-
receiveLoop: buildReceive(deps, hooks, historyStore, heldStates),
|
|
13987
|
+
receiveLoop: buildReceive(deps, hooks, historyStore, heldStates, view),
|
|
13977
13988
|
requests: buildRequests(deps, hooks),
|
|
13978
13989
|
restoreDeps: buildRestoreDeps(deps, machineDeps, machineStores, view)
|
|
13979
13990
|
};
|
|
@@ -14040,7 +14051,7 @@ function buildMachineDeps(deps, hooks, historyStore) {
|
|
|
14040
14051
|
}
|
|
14041
14052
|
};
|
|
14042
14053
|
}
|
|
14043
|
-
function buildReceive(deps, hooks, historyStore, heldStates) {
|
|
14054
|
+
function buildReceive(deps, hooks, historyStore, heldStates, view) {
|
|
14044
14055
|
return new Receive({
|
|
14045
14056
|
delivery: deps.deliveryPort,
|
|
14046
14057
|
engine: () => hooks.engine(),
|
|
@@ -14054,6 +14065,11 @@ function buildReceive(deps, hooks, historyStore, heldStates) {
|
|
|
14054
14065
|
registry: deps.registry,
|
|
14055
14066
|
recordReceived: (record) => recordReceived(historyStore, record),
|
|
14056
14067
|
emit: (event, transfer) => deps.emit(event, transfer),
|
|
14068
|
+
// The mirror is the balance the wallet renders; refresh it as the drain runs
|
|
14069
|
+
// so a multi-token receive lands progressively instead of all at the end.
|
|
14070
|
+
refreshView: () => {
|
|
14071
|
+
void view.delta().catch(() => void 0);
|
|
14072
|
+
},
|
|
14057
14073
|
attention: (transferId, code, detail) => {
|
|
14058
14074
|
deps.emit(
|
|
14059
14075
|
"transfer:attention",
|