@unicitylabs/sphere-sdk 0.14.1-dev.1 → 0.14.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 (47) hide show
  1. package/dist/connect/index.cjs +20 -5
  2. package/dist/connect/index.cjs.map +1 -1
  3. package/dist/connect/index.d.cts +0 -1
  4. package/dist/connect/index.d.ts +0 -1
  5. package/dist/connect/index.js +20 -5
  6. package/dist/connect/index.js.map +1 -1
  7. package/dist/core/index.cjs +395 -213
  8. package/dist/core/index.cjs.map +1 -1
  9. package/dist/core/index.d.cts +10 -3
  10. package/dist/core/index.d.ts +10 -3
  11. package/dist/core/index.js +395 -213
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/impl/browser/connect/index.cjs +10 -2
  14. package/dist/impl/browser/connect/index.cjs.map +1 -1
  15. package/dist/impl/browser/connect/index.d.cts +0 -1
  16. package/dist/impl/browser/connect/index.d.ts +0 -1
  17. package/dist/impl/browser/connect/index.js +10 -2
  18. package/dist/impl/browser/connect/index.js.map +1 -1
  19. package/dist/impl/nodejs/connect/index.cjs +9 -1
  20. package/dist/impl/nodejs/connect/index.cjs.map +1 -1
  21. package/dist/impl/nodejs/connect/index.d.cts +0 -1
  22. package/dist/impl/nodejs/connect/index.d.ts +0 -1
  23. package/dist/impl/nodejs/connect/index.js +9 -1
  24. package/dist/impl/nodejs/connect/index.js.map +1 -1
  25. package/dist/impl/nodejs/index.d.cts +8 -1
  26. package/dist/impl/nodejs/index.d.ts +8 -1
  27. package/dist/impl/shared/wallet-api/index.d.cts +8 -1
  28. package/dist/impl/shared/wallet-api/index.d.ts +8 -1
  29. package/dist/impl/wallet-api-v2/index.cjs +38 -5
  30. package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
  31. package/dist/impl/wallet-api-v2/index.d.cts +23 -2
  32. package/dist/impl/wallet-api-v2/index.d.ts +23 -2
  33. package/dist/impl/wallet-api-v2/index.js +38 -5
  34. package/dist/impl/wallet-api-v2/index.js.map +1 -1
  35. package/dist/index.cjs +395 -213
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +10 -3
  38. package/dist/index.d.ts +10 -3
  39. package/dist/index.js +395 -213
  40. package/dist/index.js.map +1 -1
  41. package/dist/modules/payments-v2/index.cjs +340 -199
  42. package/dist/modules/payments-v2/index.cjs.map +1 -1
  43. package/dist/modules/payments-v2/index.d.cts +68 -19
  44. package/dist/modules/payments-v2/index.d.ts +68 -19
  45. package/dist/modules/payments-v2/index.js +339 -199
  46. package/dist/modules/payments-v2/index.js.map +1 -1
  47. package/package.json +1 -1
@@ -298,6 +298,7 @@ var HOST_READY_TIMEOUT = 3e4;
298
298
  // connect/protocol.ts
299
299
  var SPHERE_CONNECT_NAMESPACE = "sphere-connect";
300
300
  var SPHERE_CONNECT_VERSION = "2.1";
301
+ var DEFAULT_MIN_CLIENT_SDK_VERSION = "0.14.1-0";
301
302
  var RPC_METHODS = {
302
303
  GET_IDENTITY: "sphere_getIdentity",
303
304
  GET_BALANCE: "sphere_getBalance",
@@ -454,7 +455,7 @@ function checkCompatibility(input) {
454
455
  }
455
456
 
456
457
  // connect/version.ts
457
- var SDK_VERSION = "0.14.1-dev.1";
458
+ var SDK_VERSION = "0.14.1";
458
459
 
459
460
  // connect/permissions.ts
460
461
  var PERMISSION_SCOPES = {
@@ -536,6 +537,9 @@ var REALTIME_STATUS = {
536
537
  degraded: "reconnecting",
537
538
  offline: "closed"
538
539
  };
540
+ function toLegacyRequest(view, status) {
541
+ return { ...view, symbol: view.symbol ?? "", status };
542
+ }
539
543
  function legacyRequestPayload(sphere, update) {
540
544
  const view = sphere.paymentsV2?.requests.list().find((request) => request.id === update.id);
541
545
  if (!view) {
@@ -550,7 +554,7 @@ function legacyRequestPayload(sphere, update) {
550
554
  status: update.status
551
555
  };
552
556
  }
553
- return { ...view, symbol: view.symbol ?? "", status: update.status };
557
+ return toLegacyRequest(view, update.status);
554
558
  }
555
559
  function requestStatusAttacher(status) {
556
560
  return (sphere, forward) => sphere.on("payment_request:updated", (update) => {
@@ -581,6 +585,11 @@ var COMPAT_ATTACHERS = /* @__PURE__ */ new Map([
581
585
  ["transfer:failed", (sphere, forward) => sphere.on("transfer:updated", (result) => {
582
586
  if (result.status === "failed") forward(result);
583
587
  })],
588
+ // Same name on both wires, different payload: the raw v2 view has optional `symbol`;
589
+ // legacy subscribers get the IncomingPaymentRequest shape via the shared mapping.
590
+ ["payment_request:incoming", (sphere, forward) => sphere.on("payment_request:incoming", (view) => {
591
+ forward(toLegacyRequest(view, view.status));
592
+ })],
584
593
  ["payment_request:paid", requestStatusAttacher("paid")],
585
594
  ["payment_request:rejected", requestStatusAttacher("rejected")],
586
595
  ["payment_request:expired", requestStatusAttacher("expired")],
@@ -1117,7 +1126,7 @@ var ConnectHost = class {
1117
1126
  walletNetworkId: this.snapshot.networkId ?? -1,
1118
1127
  minMinor: this.config.minMinorVersion,
1119
1128
  clientSdkVersion: msg.sdkVersion,
1120
- minSdkVersion: this.config.minSdkVersion
1129
+ minSdkVersion: this.config.minSdkVersion ?? DEFAULT_MIN_CLIENT_SDK_VERSION
1121
1130
  });
1122
1131
  if (!result.ok) {
1123
1132
  logger.warn("ConnectHost", "Rejected handshake", {
@@ -1384,8 +1393,14 @@ var ConnectHost = class {
1384
1393
  case RPC_METHODS.GET_HISTORY: {
1385
1394
  if (!v2) return sphere.payments.getHistory();
1386
1395
  const limit = typeof params.limit === "number" && Number.isFinite(params.limit) ? params.limit : void 0;
1387
- const page = await v2.history(limit === void 0 ? void 0 : { limit });
1388
- return page.entries;
1396
+ if (limit !== void 0) return (await v2.history({ limit })).entries;
1397
+ let page = await v2.history(void 0);
1398
+ const entries = [...page.entries];
1399
+ while (page.more && page.cursor !== null) {
1400
+ page = await v2.history({ before: page.cursor });
1401
+ entries.push(...page.entries);
1402
+ }
1403
+ return entries;
1389
1404
  }
1390
1405
  case RPC_METHODS.RESOLVE:
1391
1406
  if (!params.identifier) {