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

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.
@@ -393,8 +393,15 @@ var REALTIME_STATUS = {
393
393
  function toLegacyRequest(view, status) {
394
394
  return { ...view, symbol: view.symbol ?? "", status };
395
395
  }
396
+ function paymentsOrNull(sphere) {
397
+ try {
398
+ return sphere.payments;
399
+ } catch {
400
+ return null;
401
+ }
402
+ }
396
403
  function legacyRequestPayload(sphere, update) {
397
- const view = sphere.payments.requests.list().find((request) => request.id === update.id);
404
+ const view = paymentsOrNull(sphere)?.requests.list().find((request) => request.id === update.id);
398
405
  if (!view) {
399
406
  return {
400
407
  id: update.id,
@@ -473,7 +480,7 @@ var COMPAT_ATTACHERS = /* @__PURE__ */ new Map([
473
480
  forward({ providerId: "wallet-api", error: "wallet-api connection degraded" });
474
481
  })],
475
482
  ["sync:completed", (sphere, forward) => sphere.on("inventory:updated", () => {
476
- forward({ source: "payments", count: sphere.payments.tokens().length });
483
+ forward({ source: "payments", count: paymentsOrNull(sphere)?.tokens().length ?? 0 });
477
484
  })],
478
485
  ["sync:remote-update", remoteUpdateAttacher]
479
486
  ]);