@unicitylabs/sphere-sdk 0.14.1-dev.1 → 0.14.1-dev.2
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 +20 -5
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.cts +0 -1
- package/dist/connect/index.d.ts +0 -1
- package/dist/connect/index.js +20 -5
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +395 -213
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +10 -3
- package/dist/core/index.d.ts +10 -3
- package/dist/core/index.js +395 -213
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +10 -2
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.d.cts +0 -1
- package/dist/impl/browser/connect/index.d.ts +0 -1
- package/dist/impl/browser/connect/index.js +10 -2
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/nodejs/connect/index.cjs +9 -1
- package/dist/impl/nodejs/connect/index.cjs.map +1 -1
- package/dist/impl/nodejs/connect/index.d.cts +0 -1
- package/dist/impl/nodejs/connect/index.d.ts +0 -1
- package/dist/impl/nodejs/connect/index.js +9 -1
- package/dist/impl/nodejs/connect/index.js.map +1 -1
- package/dist/impl/nodejs/index.d.cts +8 -1
- package/dist/impl/nodejs/index.d.ts +8 -1
- package/dist/impl/shared/wallet-api/index.d.cts +8 -1
- package/dist/impl/shared/wallet-api/index.d.ts +8 -1
- package/dist/impl/wallet-api-v2/index.cjs +38 -5
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.d.cts +23 -2
- package/dist/impl/wallet-api-v2/index.d.ts +23 -2
- package/dist/impl/wallet-api-v2/index.js +38 -5
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +395 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +395 -213
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +340 -199
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +68 -19
- package/dist/modules/payments-v2/index.d.ts +68 -19
- package/dist/modules/payments-v2/index.js +339 -199
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,6 @@ interface NetworkInfo {
|
|
|
15
15
|
*/
|
|
16
16
|
declare const SPHERE_CONNECT_NAMESPACE = "sphere-connect";
|
|
17
17
|
declare const SPHERE_CONNECT_VERSION = "2.1";
|
|
18
|
-
|
|
19
18
|
interface SphereMessageBase {
|
|
20
19
|
readonly ns: typeof SPHERE_CONNECT_NAMESPACE;
|
|
21
20
|
readonly v: typeof SPHERE_CONNECT_VERSION;
|
|
@@ -15,7 +15,6 @@ interface NetworkInfo {
|
|
|
15
15
|
*/
|
|
16
16
|
declare const SPHERE_CONNECT_NAMESPACE = "sphere-connect";
|
|
17
17
|
declare const SPHERE_CONNECT_VERSION = "2.1";
|
|
18
|
-
|
|
19
18
|
interface SphereMessageBase {
|
|
20
19
|
readonly ns: typeof SPHERE_CONNECT_NAMESPACE;
|
|
21
20
|
readonly v: typeof SPHERE_CONNECT_VERSION;
|
|
@@ -352,6 +352,9 @@ var REALTIME_STATUS = {
|
|
|
352
352
|
degraded: "reconnecting",
|
|
353
353
|
offline: "closed"
|
|
354
354
|
};
|
|
355
|
+
function toLegacyRequest(view, status) {
|
|
356
|
+
return { ...view, symbol: view.symbol ?? "", status };
|
|
357
|
+
}
|
|
355
358
|
function legacyRequestPayload(sphere, update) {
|
|
356
359
|
const view = sphere.paymentsV2?.requests.list().find((request) => request.id === update.id);
|
|
357
360
|
if (!view) {
|
|
@@ -366,7 +369,7 @@ function legacyRequestPayload(sphere, update) {
|
|
|
366
369
|
status: update.status
|
|
367
370
|
};
|
|
368
371
|
}
|
|
369
|
-
return
|
|
372
|
+
return toLegacyRequest(view, update.status);
|
|
370
373
|
}
|
|
371
374
|
function requestStatusAttacher(status) {
|
|
372
375
|
return (sphere, forward) => sphere.on("payment_request:updated", (update) => {
|
|
@@ -397,6 +400,11 @@ var COMPAT_ATTACHERS = /* @__PURE__ */ new Map([
|
|
|
397
400
|
["transfer:failed", (sphere, forward) => sphere.on("transfer:updated", (result) => {
|
|
398
401
|
if (result.status === "failed") forward(result);
|
|
399
402
|
})],
|
|
403
|
+
// Same name on both wires, different payload: the raw v2 view has optional `symbol`;
|
|
404
|
+
// legacy subscribers get the IncomingPaymentRequest shape via the shared mapping.
|
|
405
|
+
["payment_request:incoming", (sphere, forward) => sphere.on("payment_request:incoming", (view) => {
|
|
406
|
+
forward(toLegacyRequest(view, view.status));
|
|
407
|
+
})],
|
|
400
408
|
["payment_request:paid", requestStatusAttacher("paid")],
|
|
401
409
|
["payment_request:rejected", requestStatusAttacher("rejected")],
|
|
402
410
|
["payment_request:expired", requestStatusAttacher("expired")],
|