@unicitylabs/sphere-sdk 0.17.2 → 0.17.3
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/README.md +1 -0
- package/dist/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +32 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +25 -9
- package/dist/core/index.d.ts +25 -9
- package/dist/core/index.js +31 -1
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/browser/index.cjs.map +1 -1
- package/dist/impl/browser/index.js.map +1 -1
- package/dist/impl/nodejs/index.cjs.map +1 -1
- package/dist/impl/nodejs/index.js.map +1 -1
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -9
- package/dist/index.d.ts +25 -9
- package/dist/index.js +31 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/dist/token-engine/index.cjs.map +1 -1
- package/dist/token-engine/index.d.cts +1 -1
- package/dist/token-engine/index.d.ts +1 -1
- package/dist/token-engine/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -58,6 +58,7 @@ __export(index_exports, {
|
|
|
58
58
|
NFT_SIGNED_TAG: () => NFT_SIGNED_TAG,
|
|
59
59
|
NIP29_KINDS: () => NIP29_KINDS,
|
|
60
60
|
NOSTR_EVENT_KINDS: () => NOSTR_EVENT_KINDS,
|
|
61
|
+
NO_PAYMENTS: () => NO_PAYMENTS,
|
|
61
62
|
NostrClient: () => import_nostr_js_sdk6.NostrClient,
|
|
62
63
|
NostrKeyManager: () => import_nostr_js_sdk6.NostrKeyManager,
|
|
63
64
|
PartialSendConflictError: () => PartialSendConflictError,
|
|
@@ -17148,7 +17149,16 @@ var WalletApiSplitCheckpointStore = class {
|
|
|
17148
17149
|
};
|
|
17149
17150
|
|
|
17150
17151
|
// core/payments-v2-wiring.ts
|
|
17152
|
+
var NO_PAYMENTS = "none";
|
|
17153
|
+
function readPaymentsOptOut(walletApi) {
|
|
17154
|
+
if (walletApi === NO_PAYMENTS) return NO_PAYMENTS;
|
|
17155
|
+
throw new SphereError(
|
|
17156
|
+
`walletApi must be a wallet-api transport config or the literal '${NO_PAYMENTS}' (the explicit messaging-only opt-out, #793) \u2014 received ${JSON.stringify(walletApi)}.`,
|
|
17157
|
+
"INVALID_CONFIG"
|
|
17158
|
+
);
|
|
17159
|
+
}
|
|
17151
17160
|
function resolvePaymentsV2Composition(walletApi, sphereNetwork) {
|
|
17161
|
+
if (typeof walletApi === "string") return readPaymentsOptOut(walletApi);
|
|
17152
17162
|
const source = walletApi;
|
|
17153
17163
|
const network = typeof source?.network === "string" && source.network !== "" ? source.network : null;
|
|
17154
17164
|
if (!source || network === null) {
|
|
@@ -17428,7 +17438,11 @@ var Sphere = class _Sphere {
|
|
|
17428
17438
|
// The payments vertical (the ONLY money path since the P11 flip)
|
|
17429
17439
|
/** The ACTIVE address's running vertical — §7: exactly one at a time, ever. */
|
|
17430
17440
|
_paymentsV2Active = null;
|
|
17431
|
-
/**
|
|
17441
|
+
/**
|
|
17442
|
+
* Money composition, set at init. `null` = never resolved (a construction bug),
|
|
17443
|
+
* `NO_PAYMENTS` = the explicit #793 opt-out, an object = a real composition. One
|
|
17444
|
+
* spelling for the last two would read a forgotten resolve as messaging-only.
|
|
17445
|
+
*/
|
|
17432
17446
|
_paymentsV2Composition = null;
|
|
17433
17447
|
/**
|
|
17434
17448
|
* §7 lifecycle mutex: every stop/start pair runs strictly serialized, so
|
|
@@ -18104,10 +18118,24 @@ var Sphere = class _Sphere {
|
|
|
18104
18118
|
get payments() {
|
|
18105
18119
|
const facade = this._paymentsV2Active?.facade;
|
|
18106
18120
|
if (!facade) {
|
|
18121
|
+
if (this._paymentsV2Composition === NO_PAYMENTS) {
|
|
18122
|
+
throw new SphereError(
|
|
18123
|
+
"payments is not composed: this Sphere was initialised with `walletApi: 'none'`, the explicit messaging-only composition. Money has no path here \u2014 re-init with a wallet-api transport config to move any.",
|
|
18124
|
+
"PAYMENTS_NOT_COMPOSED"
|
|
18125
|
+
);
|
|
18126
|
+
}
|
|
18107
18127
|
throw new SphereError("Sphere not initialized", "NOT_INITIALIZED");
|
|
18108
18128
|
}
|
|
18109
18129
|
return facade;
|
|
18110
18130
|
}
|
|
18131
|
+
/**
|
|
18132
|
+
* Whether this Sphere composes money at all (#793) — fixed for the instance's life,
|
|
18133
|
+
* so a messaging-only wallet can branch without a try/catch. Not a liveness check:
|
|
18134
|
+
* `true` still leaves `payments` throwing NOT_INITIALIZED mid-init or mid-switch.
|
|
18135
|
+
*/
|
|
18136
|
+
get hasPayments() {
|
|
18137
|
+
return this._paymentsV2Composition !== NO_PAYMENTS;
|
|
18138
|
+
}
|
|
18111
18139
|
/** Communications module */
|
|
18112
18140
|
get communications() {
|
|
18113
18141
|
this.ensureReady();
|
|
@@ -20135,6 +20163,7 @@ var Sphere = class _Sphere {
|
|
|
20135
20163
|
* breaks initialization.
|
|
20136
20164
|
*/
|
|
20137
20165
|
async buildTokenEngine(identity) {
|
|
20166
|
+
if (this._paymentsV2Composition === NO_PAYMENTS) return void 0;
|
|
20138
20167
|
const oracle = this._oracle;
|
|
20139
20168
|
const privateKey = (identity ?? this._identity)?.privateKey;
|
|
20140
20169
|
const trustBaseJson = oracle.getTrustBaseJson?.() ?? null;
|
|
@@ -20240,6 +20269,7 @@ var Sphere = class _Sphere {
|
|
|
20240
20269
|
* setOracleApiKey rebuild is what future operations snapshot.
|
|
20241
20270
|
*/
|
|
20242
20271
|
async startPaymentsV2Inner(index, identity) {
|
|
20272
|
+
if (this._paymentsV2Composition === NO_PAYMENTS) return;
|
|
20243
20273
|
if (!this._paymentsV2Composition) {
|
|
20244
20274
|
throw new SphereError("wallet-api composition required for money", "INVALID_CONFIG");
|
|
20245
20275
|
}
|
|
@@ -20924,6 +20954,7 @@ function addressesMatch(a, b) {
|
|
|
20924
20954
|
NFT_SIGNED_TAG,
|
|
20925
20955
|
NIP29_KINDS,
|
|
20926
20956
|
NOSTR_EVENT_KINDS,
|
|
20957
|
+
NO_PAYMENTS,
|
|
20927
20958
|
NostrClient,
|
|
20928
20959
|
NostrKeyManager,
|
|
20929
20960
|
PartialSendConflictError,
|