@unicitylabs/sphere-sdk 0.15.0-dev.1 → 0.16.0-dev.1

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.
Files changed (50) hide show
  1. package/README.md +15 -5
  2. package/dist/connect/index.cjs +23 -25
  3. package/dist/connect/index.cjs.map +1 -1
  4. package/dist/connect/index.d.cts +4 -0
  5. package/dist/connect/index.d.ts +4 -0
  6. package/dist/connect/index.js +23 -25
  7. package/dist/connect/index.js.map +1 -1
  8. package/dist/core/index.cjs +726 -225
  9. package/dist/core/index.cjs.map +1 -1
  10. package/dist/core/index.d.cts +172 -21
  11. package/dist/core/index.d.ts +172 -21
  12. package/dist/core/index.js +726 -224
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/impl/browser/connect/index.cjs +23 -25
  15. package/dist/impl/browser/connect/index.cjs.map +1 -1
  16. package/dist/impl/browser/connect/index.js +23 -25
  17. package/dist/impl/browser/connect/index.js.map +1 -1
  18. package/dist/impl/browser/index.cjs +331 -504
  19. package/dist/impl/browser/index.cjs.map +1 -1
  20. package/dist/impl/browser/index.js +331 -504
  21. package/dist/impl/browser/index.js.map +1 -1
  22. package/dist/impl/nodejs/connect/index.cjs +22 -24
  23. package/dist/impl/nodejs/connect/index.cjs.map +1 -1
  24. package/dist/impl/nodejs/connect/index.js +22 -24
  25. package/dist/impl/nodejs/connect/index.js.map +1 -1
  26. package/dist/impl/nodejs/index.cjs +298 -569
  27. package/dist/impl/nodejs/index.cjs.map +1 -1
  28. package/dist/impl/nodejs/index.d.cts +90 -13
  29. package/dist/impl/nodejs/index.d.ts +90 -13
  30. package/dist/impl/nodejs/index.js +298 -569
  31. package/dist/impl/nodejs/index.js.map +1 -1
  32. package/dist/impl/shared/wallet-api/index.d.cts +54 -2
  33. package/dist/impl/shared/wallet-api/index.d.ts +54 -2
  34. package/dist/index.cjs +728 -225
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +227 -108
  37. package/dist/index.d.ts +227 -108
  38. package/dist/index.js +728 -224
  39. package/dist/index.js.map +1 -1
  40. package/dist/modules/payments-v2/index.cjs +11 -7
  41. package/dist/modules/payments-v2/index.cjs.map +1 -1
  42. package/dist/modules/payments-v2/index.d.cts +56 -3
  43. package/dist/modules/payments-v2/index.d.ts +56 -3
  44. package/dist/modules/payments-v2/index.js +11 -7
  45. package/dist/modules/payments-v2/index.js.map +1 -1
  46. package/dist/token-engine/index.cjs +46 -0
  47. package/dist/token-engine/index.cjs.map +1 -1
  48. package/dist/token-engine/index.js +46 -0
  49. package/dist/token-engine/index.js.map +1 -1
  50. package/package.json +2 -1
@@ -3214,12 +3214,13 @@ var Receive = class {
3214
3214
  return this.drainFlight.run(() => this.doDrain());
3215
3215
  }
3216
3216
  start(pollIntervalMs = POLL_INTERVAL_MS) {
3217
- this.unsubscribeWake ??= this.deps.delivery.onWake?.(() => {
3218
- void this.drainOnce();
3219
- }) ?? null;
3220
- this.pollTimer ??= setInterval(() => {
3221
- void this.drainOnce();
3222
- }, pollIntervalMs);
3217
+ this.unsubscribeWake ??= this.deps.delivery.onWake?.(() => this.spawnDrain()) ?? null;
3218
+ this.pollTimer ??= setInterval(() => this.spawnDrain(), pollIntervalMs);
3219
+ }
3220
+ spawnDrain() {
3221
+ const op = this.drainOnce();
3222
+ if (this.deps.track !== void 0) this.deps.track(op);
3223
+ else void op;
3223
3224
  }
3224
3225
  stop() {
3225
3226
  if (this.pollTimer !== null) clearInterval(this.pollTimer);
@@ -4322,6 +4323,8 @@ function buildReceive(deps, hooks, historyStore, heldStates, refreshView) {
4322
4323
  );
4323
4324
  },
4324
4325
  syncEpoch: deps.syncEpoch,
4326
+ // #770: the poll/wake drains Receive spawns itself must hold stop() too.
4327
+ track: hooks.track,
4325
4328
  ...deps.now !== void 0 ? { now: deps.now } : {}
4326
4329
  });
4327
4330
  }
@@ -4464,7 +4467,8 @@ var PaymentsFacade = class {
4464
4467
  await Promise.allSettled([...this.pendingOps]);
4465
4468
  }
4466
4469
  }
4467
- /** Swaps what FUTURE operations snapshot; in-flight ops finish on the old engine. */
4470
+ /** Swaps what FUTURE operations snapshot. Chain ops finish on the old engine, but it is
4471
+ * DISPOSED here, so one mid-`verify()` is cancelled — MODULE_DESTROYED, #770(4). */
4468
4472
  setEngine(next) {
4469
4473
  const previous = this.currentEngine ?? this.deps.engineRef();
4470
4474
  this.currentEngine = next;