@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.
@@ -355,8 +355,15 @@ var REALTIME_STATUS = {
355
355
  function toLegacyRequest(view, status) {
356
356
  return { ...view, symbol: view.symbol ?? "", status };
357
357
  }
358
+ function paymentsOrNull(sphere) {
359
+ try {
360
+ return sphere.payments;
361
+ } catch {
362
+ return null;
363
+ }
364
+ }
358
365
  function legacyRequestPayload(sphere, update) {
359
- const view = sphere.payments.requests.list().find((request) => request.id === update.id);
366
+ const view = paymentsOrNull(sphere)?.requests.list().find((request) => request.id === update.id);
360
367
  if (!view) {
361
368
  return {
362
369
  id: update.id,
@@ -435,7 +442,7 @@ var COMPAT_ATTACHERS = /* @__PURE__ */ new Map([
435
442
  forward({ providerId: "wallet-api", error: "wallet-api connection degraded" });
436
443
  })],
437
444
  ["sync:completed", (sphere, forward) => sphere.on("inventory:updated", () => {
438
- forward({ source: "payments", count: sphere.payments.tokens().length });
445
+ forward({ source: "payments", count: paymentsOrNull(sphere)?.tokens().length ?? 0 });
439
446
  })],
440
447
  ["sync:remote-update", remoteUpdateAttacher]
441
448
  ]);