@unicitylabs/sphere-sdk 0.14.11-dev.4 → 0.14.11-dev.6
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 +19 -11
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +19 -11
- 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 +19 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +19 -11
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +1 -0
- package/dist/modules/payments-v2/index.d.ts +1 -0
- package/dist/modules/payments-v2/index.js +19 -11
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1044,6 +1044,7 @@ declare const MAX_RESELECT = 8;
|
|
|
1044
1044
|
declare const ATTENTION_MINT_UNRESOLVED = "mint:unresolved";
|
|
1045
1045
|
declare class PaymentsFacade implements PaymentsV2 {
|
|
1046
1046
|
private readonly deps;
|
|
1047
|
+
private readonly wakeRefresh;
|
|
1047
1048
|
private readonly prewarmed;
|
|
1048
1049
|
private readonly view;
|
|
1049
1050
|
private readonly ledger;
|
|
@@ -1044,6 +1044,7 @@ declare const MAX_RESELECT = 8;
|
|
|
1044
1044
|
declare const ATTENTION_MINT_UNRESOLVED = "mint:unresolved";
|
|
1045
1045
|
declare class PaymentsFacade implements PaymentsV2 {
|
|
1046
1046
|
private readonly deps;
|
|
1047
|
+
private readonly wakeRefresh;
|
|
1047
1048
|
private readonly prewarmed;
|
|
1048
1049
|
private readonly view;
|
|
1049
1050
|
private readonly ledger;
|
|
@@ -3159,7 +3159,7 @@ var logger = {
|
|
|
3159
3159
|
|
|
3160
3160
|
// modules/payments-v2/receive/Receive.ts
|
|
3161
3161
|
var ACK_BATCH_SIZE = 200;
|
|
3162
|
-
var REFRESH_INTERVAL_MS =
|
|
3162
|
+
var REFRESH_INTERVAL_MS = 2500;
|
|
3163
3163
|
var POLL_INTERVAL_MS = 3e4;
|
|
3164
3164
|
var ATTENTION_CLAIM_CONFLICT = "claim:conflict";
|
|
3165
3165
|
function receivedDedupKey(tokenId, stateHash) {
|
|
@@ -4088,15 +4088,25 @@ function parseAmount(raw) {
|
|
|
4088
4088
|
function supportsDeterministicMint(engine) {
|
|
4089
4089
|
return engine.deterministicMint === true;
|
|
4090
4090
|
}
|
|
4091
|
-
function
|
|
4091
|
+
function makeCoalescedRefresh(refresh) {
|
|
4092
4092
|
let inFlight = false;
|
|
4093
|
-
|
|
4094
|
-
|
|
4093
|
+
let queued = false;
|
|
4094
|
+
const run = () => {
|
|
4095
4095
|
inFlight = true;
|
|
4096
4096
|
void refresh().catch(() => void 0).finally(() => {
|
|
4097
4097
|
inFlight = false;
|
|
4098
|
+
if (!queued) return;
|
|
4099
|
+
queued = false;
|
|
4100
|
+
run();
|
|
4098
4101
|
});
|
|
4099
4102
|
};
|
|
4103
|
+
return () => {
|
|
4104
|
+
if (inFlight) {
|
|
4105
|
+
queued = true;
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
run();
|
|
4109
|
+
};
|
|
4100
4110
|
}
|
|
4101
4111
|
function composeFacadeParts(deps, hooks) {
|
|
4102
4112
|
const ownPubkeyBytes = hexToBytes(deps.ownPubkey);
|
|
@@ -4219,10 +4229,8 @@ function buildReceive(deps, hooks, historyStore, heldStates, view) {
|
|
|
4219
4229
|
registry: deps.registry,
|
|
4220
4230
|
recordReceived: (record) => recordReceived(historyStore, record),
|
|
4221
4231
|
emit: (event, transfer) => deps.emit(event, transfer),
|
|
4222
|
-
//
|
|
4223
|
-
|
|
4224
|
-
// drains in a burst at the END — a slower version of the bug being fixed.
|
|
4225
|
-
refreshView: makeSingleFlightRefresh(() => view.delta()),
|
|
4232
|
+
// Coalesced — see makeCoalescedRefresh.
|
|
4233
|
+
refreshView: makeCoalescedRefresh(() => view.delta()),
|
|
4226
4234
|
attention: (transferId, code, detail) => {
|
|
4227
4235
|
deps.emit(
|
|
4228
4236
|
"transfer:attention",
|
|
@@ -4274,6 +4282,7 @@ var PaymentsFacade = class {
|
|
|
4274
4282
|
isActiveOp: (id) => this.activeMoneyOps.has(id)
|
|
4275
4283
|
});
|
|
4276
4284
|
this.view = parts.view;
|
|
4285
|
+
this.wakeRefresh = makeCoalescedRefresh(() => this.view.delta());
|
|
4277
4286
|
this.ledger = parts.ledger;
|
|
4278
4287
|
this.queue = parts.queue;
|
|
4279
4288
|
this.machine = parts.machine;
|
|
@@ -4303,6 +4312,7 @@ var PaymentsFacade = class {
|
|
|
4303
4312
|
now: () => this.nowMs()
|
|
4304
4313
|
});
|
|
4305
4314
|
}
|
|
4315
|
+
wakeRefresh;
|
|
4306
4316
|
prewarmed = new PrewarmCache();
|
|
4307
4317
|
view;
|
|
4308
4318
|
ledger;
|
|
@@ -4341,9 +4351,7 @@ var PaymentsFacade = class {
|
|
|
4341
4351
|
this.deps.session.subscribeStream("mailbox", () => {
|
|
4342
4352
|
this.trackTail(this.receiveLoop.drainOnce());
|
|
4343
4353
|
}),
|
|
4344
|
-
this.deps.session.subscribeStream("inventory",
|
|
4345
|
-
this.trackTail(this.view.delta());
|
|
4346
|
-
}),
|
|
4354
|
+
this.deps.session.subscribeStream("inventory", this.wakeRefresh),
|
|
4347
4355
|
this.deps.session.subscribeStream("payment_requests", () => {
|
|
4348
4356
|
this.trackTail(this.requests.drainIncoming());
|
|
4349
4357
|
})
|