@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.
- 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
package/dist/connect/index.d.cts
CHANGED
|
@@ -31,7 +31,6 @@ declare const HOST_READY_TIMEOUT = 30000;
|
|
|
31
31
|
*/
|
|
32
32
|
declare const SPHERE_CONNECT_NAMESPACE = "sphere-connect";
|
|
33
33
|
declare const SPHERE_CONNECT_VERSION = "2.1";
|
|
34
|
-
|
|
35
34
|
declare const RPC_METHODS: {
|
|
36
35
|
readonly GET_IDENTITY: "sphere_getIdentity";
|
|
37
36
|
readonly GET_BALANCE: "sphere_getBalance";
|
package/dist/connect/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ declare const HOST_READY_TIMEOUT = 30000;
|
|
|
31
31
|
*/
|
|
32
32
|
declare const SPHERE_CONNECT_NAMESPACE = "sphere-connect";
|
|
33
33
|
declare const SPHERE_CONNECT_VERSION = "2.1";
|
|
34
|
-
|
|
35
34
|
declare const RPC_METHODS: {
|
|
36
35
|
readonly GET_IDENTITY: "sphere_getIdentity";
|
|
37
36
|
readonly GET_BALANCE: "sphere_getBalance";
|
package/dist/connect/index.js
CHANGED
|
@@ -249,6 +249,7 @@ var HOST_READY_TIMEOUT = 3e4;
|
|
|
249
249
|
// connect/protocol.ts
|
|
250
250
|
var SPHERE_CONNECT_NAMESPACE = "sphere-connect";
|
|
251
251
|
var SPHERE_CONNECT_VERSION = "2.1";
|
|
252
|
+
var DEFAULT_MIN_CLIENT_SDK_VERSION = "0.14.1-0";
|
|
252
253
|
var RPC_METHODS = {
|
|
253
254
|
GET_IDENTITY: "sphere_getIdentity",
|
|
254
255
|
GET_BALANCE: "sphere_getBalance",
|
|
@@ -405,7 +406,7 @@ function checkCompatibility(input) {
|
|
|
405
406
|
}
|
|
406
407
|
|
|
407
408
|
// connect/version.ts
|
|
408
|
-
var SDK_VERSION = "0.14.1
|
|
409
|
+
var SDK_VERSION = "0.14.1";
|
|
409
410
|
|
|
410
411
|
// connect/permissions.ts
|
|
411
412
|
var PERMISSION_SCOPES = {
|
|
@@ -487,6 +488,9 @@ var REALTIME_STATUS = {
|
|
|
487
488
|
degraded: "reconnecting",
|
|
488
489
|
offline: "closed"
|
|
489
490
|
};
|
|
491
|
+
function toLegacyRequest(view, status) {
|
|
492
|
+
return { ...view, symbol: view.symbol ?? "", status };
|
|
493
|
+
}
|
|
490
494
|
function legacyRequestPayload(sphere, update) {
|
|
491
495
|
const view = sphere.paymentsV2?.requests.list().find((request) => request.id === update.id);
|
|
492
496
|
if (!view) {
|
|
@@ -501,7 +505,7 @@ function legacyRequestPayload(sphere, update) {
|
|
|
501
505
|
status: update.status
|
|
502
506
|
};
|
|
503
507
|
}
|
|
504
|
-
return
|
|
508
|
+
return toLegacyRequest(view, update.status);
|
|
505
509
|
}
|
|
506
510
|
function requestStatusAttacher(status) {
|
|
507
511
|
return (sphere, forward) => sphere.on("payment_request:updated", (update) => {
|
|
@@ -532,6 +536,11 @@ var COMPAT_ATTACHERS = /* @__PURE__ */ new Map([
|
|
|
532
536
|
["transfer:failed", (sphere, forward) => sphere.on("transfer:updated", (result) => {
|
|
533
537
|
if (result.status === "failed") forward(result);
|
|
534
538
|
})],
|
|
539
|
+
// Same name on both wires, different payload: the raw v2 view has optional `symbol`;
|
|
540
|
+
// legacy subscribers get the IncomingPaymentRequest shape via the shared mapping.
|
|
541
|
+
["payment_request:incoming", (sphere, forward) => sphere.on("payment_request:incoming", (view) => {
|
|
542
|
+
forward(toLegacyRequest(view, view.status));
|
|
543
|
+
})],
|
|
535
544
|
["payment_request:paid", requestStatusAttacher("paid")],
|
|
536
545
|
["payment_request:rejected", requestStatusAttacher("rejected")],
|
|
537
546
|
["payment_request:expired", requestStatusAttacher("expired")],
|
|
@@ -1068,7 +1077,7 @@ var ConnectHost = class {
|
|
|
1068
1077
|
walletNetworkId: this.snapshot.networkId ?? -1,
|
|
1069
1078
|
minMinor: this.config.minMinorVersion,
|
|
1070
1079
|
clientSdkVersion: msg.sdkVersion,
|
|
1071
|
-
minSdkVersion: this.config.minSdkVersion
|
|
1080
|
+
minSdkVersion: this.config.minSdkVersion ?? DEFAULT_MIN_CLIENT_SDK_VERSION
|
|
1072
1081
|
});
|
|
1073
1082
|
if (!result.ok) {
|
|
1074
1083
|
logger.warn("ConnectHost", "Rejected handshake", {
|
|
@@ -1335,8 +1344,14 @@ var ConnectHost = class {
|
|
|
1335
1344
|
case RPC_METHODS.GET_HISTORY: {
|
|
1336
1345
|
if (!v2) return sphere.payments.getHistory();
|
|
1337
1346
|
const limit = typeof params.limit === "number" && Number.isFinite(params.limit) ? params.limit : void 0;
|
|
1338
|
-
|
|
1339
|
-
|
|
1347
|
+
if (limit !== void 0) return (await v2.history({ limit })).entries;
|
|
1348
|
+
let page = await v2.history(void 0);
|
|
1349
|
+
const entries = [...page.entries];
|
|
1350
|
+
while (page.more && page.cursor !== null) {
|
|
1351
|
+
page = await v2.history({ before: page.cursor });
|
|
1352
|
+
entries.push(...page.entries);
|
|
1353
|
+
}
|
|
1354
|
+
return entries;
|
|
1340
1355
|
}
|
|
1341
1356
|
case RPC_METHODS.RESOLVE:
|
|
1342
1357
|
if (!params.identifier) {
|