@unicitylabs/sphere-sdk 0.9.1-dev.15 → 0.9.1-dev.16
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/core/index.cjs +29 -10
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +16 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +29 -10
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +29 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +29 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -2116,6 +2116,8 @@ interface PaymentsModuleDependencies {
|
|
|
2116
2116
|
* ones.
|
|
2117
2117
|
*/
|
|
2118
2118
|
walletApi?: PaymentsWalletApiPort;
|
|
2119
|
+
/** Current address's canonical display nametag (bare, no '@'), from the Sphere-level Nostr-backed store. Preferred over the local minted-token nametags[] for outgoing memos. */
|
|
2120
|
+
getCurrentNametag?: () => string | undefined;
|
|
2119
2121
|
}
|
|
2120
2122
|
declare class PaymentsModule {
|
|
2121
2123
|
private readonly moduleConfig;
|
|
@@ -2716,6 +2718,20 @@ declare class PaymentsModule {
|
|
|
2716
2718
|
* @returns The nametag data, or `null` if no nametag is set.
|
|
2717
2719
|
*/
|
|
2718
2720
|
getNametag(): NametagData | null;
|
|
2721
|
+
/**
|
|
2722
|
+
* The requester's CURRENT display nametag for outgoing memos: the canonical
|
|
2723
|
+
* Sphere-level (Nostr-backed) store first, then the local minted-token store.
|
|
2724
|
+
*
|
|
2725
|
+
* The minted-token `nametags[]` is populated only by the best-effort,
|
|
2726
|
+
* oracle-gated mint path, so in the real app it is empty at send time even
|
|
2727
|
+
* when the user has a nametag — reading it dropped the nametag from the
|
|
2728
|
+
* payment-request/delivery memo and the payer rendered a raw pubkey. The
|
|
2729
|
+
* canonical store (injected via `getCurrentNametag`) is the one the UI shows
|
|
2730
|
+
* and is reliably loaded on every startup. (#576, 6bd3058 regression)
|
|
2731
|
+
*
|
|
2732
|
+
* @returns The bare nametag name (no leading '@'), or `undefined`.
|
|
2733
|
+
*/
|
|
2734
|
+
private currentNametagName;
|
|
2719
2735
|
/**
|
|
2720
2736
|
* Get all nametag data entries.
|
|
2721
2737
|
*
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2116,6 +2116,8 @@ interface PaymentsModuleDependencies {
|
|
|
2116
2116
|
* ones.
|
|
2117
2117
|
*/
|
|
2118
2118
|
walletApi?: PaymentsWalletApiPort;
|
|
2119
|
+
/** Current address's canonical display nametag (bare, no '@'), from the Sphere-level Nostr-backed store. Preferred over the local minted-token nametags[] for outgoing memos. */
|
|
2120
|
+
getCurrentNametag?: () => string | undefined;
|
|
2119
2121
|
}
|
|
2120
2122
|
declare class PaymentsModule {
|
|
2121
2123
|
private readonly moduleConfig;
|
|
@@ -2716,6 +2718,20 @@ declare class PaymentsModule {
|
|
|
2716
2718
|
* @returns The nametag data, or `null` if no nametag is set.
|
|
2717
2719
|
*/
|
|
2718
2720
|
getNametag(): NametagData | null;
|
|
2721
|
+
/**
|
|
2722
|
+
* The requester's CURRENT display nametag for outgoing memos: the canonical
|
|
2723
|
+
* Sphere-level (Nostr-backed) store first, then the local minted-token store.
|
|
2724
|
+
*
|
|
2725
|
+
* The minted-token `nametags[]` is populated only by the best-effort,
|
|
2726
|
+
* oracle-gated mint path, so in the real app it is empty at send time even
|
|
2727
|
+
* when the user has a nametag — reading it dropped the nametag from the
|
|
2728
|
+
* payment-request/delivery memo and the payer rendered a raw pubkey. The
|
|
2729
|
+
* canonical store (injected via `getCurrentNametag`) is the one the UI shows
|
|
2730
|
+
* and is reliably loaded on every startup. (#576, 6bd3058 regression)
|
|
2731
|
+
*
|
|
2732
|
+
* @returns The bare nametag name (no leading '@'), or `undefined`.
|
|
2733
|
+
*/
|
|
2734
|
+
private currentNametagName;
|
|
2719
2735
|
/**
|
|
2720
2736
|
* Get all nametag data entries.
|
|
2721
2737
|
*
|
package/dist/core/index.js
CHANGED
|
@@ -12161,13 +12161,11 @@ var PaymentsModule = class _PaymentsModule {
|
|
|
12161
12161
|
);
|
|
12162
12162
|
}
|
|
12163
12163
|
const deliverBlob = async (tokenBlob) => {
|
|
12164
|
+
const nm = this.currentNametagName();
|
|
12164
12165
|
await delivery.deliver(recipientChainPubkeyHex, hexToBytes2(tokenBlob), {
|
|
12165
12166
|
transferId: result.id,
|
|
12166
12167
|
memo: request.memo,
|
|
12167
|
-
|
|
12168
|
-
// instead of "Someone" — bundled with the memo in ONE
|
|
12169
|
-
// recipient-addressed envelope (S6).
|
|
12170
|
-
...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
|
|
12168
|
+
...nm !== void 0 ? { senderNametag: nm } : {}
|
|
12171
12169
|
});
|
|
12172
12170
|
};
|
|
12173
12171
|
const consumedSources = [];
|
|
@@ -12585,7 +12583,7 @@ var PaymentsModule = class _PaymentsModule {
|
|
|
12585
12583
|
}
|
|
12586
12584
|
const memoEnvelope = encryptDeliveryBundle(
|
|
12587
12585
|
deriveDeliveryEncryptionKey(this.deps.identity.privateKey, toPubkey),
|
|
12588
|
-
{ senderNametag: this.
|
|
12586
|
+
{ senderNametag: this.currentNametagName(), memo: request.message }
|
|
12589
12587
|
);
|
|
12590
12588
|
const wire = await api.createPaymentRequest({
|
|
12591
12589
|
toPubkey,
|
|
@@ -13841,6 +13839,22 @@ var PaymentsModule = class _PaymentsModule {
|
|
|
13841
13839
|
getNametag() {
|
|
13842
13840
|
return this.nametags[0] ?? null;
|
|
13843
13841
|
}
|
|
13842
|
+
/**
|
|
13843
|
+
* The requester's CURRENT display nametag for outgoing memos: the canonical
|
|
13844
|
+
* Sphere-level (Nostr-backed) store first, then the local minted-token store.
|
|
13845
|
+
*
|
|
13846
|
+
* The minted-token `nametags[]` is populated only by the best-effort,
|
|
13847
|
+
* oracle-gated mint path, so in the real app it is empty at send time even
|
|
13848
|
+
* when the user has a nametag — reading it dropped the nametag from the
|
|
13849
|
+
* payment-request/delivery memo and the payer rendered a raw pubkey. The
|
|
13850
|
+
* canonical store (injected via `getCurrentNametag`) is the one the UI shows
|
|
13851
|
+
* and is reliably loaded on every startup. (#576, 6bd3058 regression)
|
|
13852
|
+
*
|
|
13853
|
+
* @returns The bare nametag name (no leading '@'), or `undefined`.
|
|
13854
|
+
*/
|
|
13855
|
+
currentNametagName() {
|
|
13856
|
+
return this.deps?.getCurrentNametag?.() ?? this.nametags[0]?.name;
|
|
13857
|
+
}
|
|
13844
13858
|
/**
|
|
13845
13859
|
* Get all nametag data entries.
|
|
13846
13860
|
*
|
|
@@ -14856,10 +14870,11 @@ var PaymentsModule = class _PaymentsModule {
|
|
|
14856
14870
|
memo: payload.memo,
|
|
14857
14871
|
createdAt: Date.now()
|
|
14858
14872
|
});
|
|
14873
|
+
const nm = this.currentNametagName();
|
|
14859
14874
|
await delivery.deliver(payload.recipient, hexToBytes2(tokenBlobHex), {
|
|
14860
14875
|
transferId,
|
|
14861
14876
|
memo: payload.memo,
|
|
14862
|
-
...
|
|
14877
|
+
...nm !== void 0 ? { senderNametag: nm } : {}
|
|
14863
14878
|
});
|
|
14864
14879
|
await this.removePendingV2Delivery(tokenBlobHex);
|
|
14865
14880
|
};
|
|
@@ -15052,10 +15067,11 @@ var PaymentsModule = class _PaymentsModule {
|
|
|
15052
15067
|
logger.warn("Payments", `${entries.length} undelivered v2 transfer(s) journaled from a previous session \u2014 replaying`);
|
|
15053
15068
|
for (const e of entries) {
|
|
15054
15069
|
try {
|
|
15070
|
+
const nm = this.currentNametagName();
|
|
15055
15071
|
await this.delivery.deliver(e.recipientPubkey, hexToBytes2(e.tokenBlob), {
|
|
15056
15072
|
transferId: e.transferId,
|
|
15057
15073
|
memo: e.memo,
|
|
15058
|
-
...
|
|
15074
|
+
...nm !== void 0 ? { senderNametag: nm } : {}
|
|
15059
15075
|
});
|
|
15060
15076
|
await this.removePendingV2Delivery(e.tokenBlob);
|
|
15061
15077
|
logger.debug("Payments", `Replayed undelivered v2 transfer ${e.transferId.slice(0, 8)}...`);
|
|
@@ -28805,7 +28821,8 @@ var Sphere = class _Sphere {
|
|
|
28805
28821
|
price: this._priceProvider ?? void 0,
|
|
28806
28822
|
tokenEngine: moduleSet.tokenEngine,
|
|
28807
28823
|
delivery: this._delivery ?? void 0,
|
|
28808
|
-
walletApi: this._walletApi ?? void 0
|
|
28824
|
+
walletApi: this._walletApi ?? void 0,
|
|
28825
|
+
getCurrentNametag: () => this.getNametagForAddress()
|
|
28809
28826
|
});
|
|
28810
28827
|
}
|
|
28811
28828
|
}
|
|
@@ -28894,7 +28911,8 @@ var Sphere = class _Sphere {
|
|
|
28894
28911
|
price: this._priceProvider ?? void 0,
|
|
28895
28912
|
tokenEngine,
|
|
28896
28913
|
delivery: this._delivery ?? void 0,
|
|
28897
|
-
walletApi: this._walletApi ?? void 0
|
|
28914
|
+
walletApi: this._walletApi ?? void 0,
|
|
28915
|
+
getCurrentNametag: () => this.getNametagForAddress()
|
|
28898
28916
|
});
|
|
28899
28917
|
communications.initialize({
|
|
28900
28918
|
identity,
|
|
@@ -30369,7 +30387,8 @@ var Sphere = class _Sphere {
|
|
|
30369
30387
|
disabledProviderIds: this._disabledProviders,
|
|
30370
30388
|
tokenEngine,
|
|
30371
30389
|
delivery: this._delivery ?? void 0,
|
|
30372
|
-
walletApi: this._walletApi ?? void 0
|
|
30390
|
+
walletApi: this._walletApi ?? void 0,
|
|
30391
|
+
getCurrentNametag: () => this.getNametagForAddress()
|
|
30373
30392
|
});
|
|
30374
30393
|
this._communications.initialize({
|
|
30375
30394
|
identity: this._identity,
|