@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/index.d.cts CHANGED
@@ -2056,6 +2056,8 @@ interface PaymentsModuleDependencies {
2056
2056
  * ones.
2057
2057
  */
2058
2058
  walletApi?: PaymentsWalletApiPort;
2059
+ /** 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. */
2060
+ getCurrentNametag?: () => string | undefined;
2059
2061
  }
2060
2062
  declare class PaymentsModule {
2061
2063
  private readonly moduleConfig;
@@ -2656,6 +2658,20 @@ declare class PaymentsModule {
2656
2658
  * @returns The nametag data, or `null` if no nametag is set.
2657
2659
  */
2658
2660
  getNametag(): NametagData | null;
2661
+ /**
2662
+ * The requester's CURRENT display nametag for outgoing memos: the canonical
2663
+ * Sphere-level (Nostr-backed) store first, then the local minted-token store.
2664
+ *
2665
+ * The minted-token `nametags[]` is populated only by the best-effort,
2666
+ * oracle-gated mint path, so in the real app it is empty at send time even
2667
+ * when the user has a nametag — reading it dropped the nametag from the
2668
+ * payment-request/delivery memo and the payer rendered a raw pubkey. The
2669
+ * canonical store (injected via `getCurrentNametag`) is the one the UI shows
2670
+ * and is reliably loaded on every startup. (#576, 6bd3058 regression)
2671
+ *
2672
+ * @returns The bare nametag name (no leading '@'), or `undefined`.
2673
+ */
2674
+ private currentNametagName;
2659
2675
  /**
2660
2676
  * Get all nametag data entries.
2661
2677
  *
package/dist/index.d.ts CHANGED
@@ -2056,6 +2056,8 @@ interface PaymentsModuleDependencies {
2056
2056
  * ones.
2057
2057
  */
2058
2058
  walletApi?: PaymentsWalletApiPort;
2059
+ /** 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. */
2060
+ getCurrentNametag?: () => string | undefined;
2059
2061
  }
2060
2062
  declare class PaymentsModule {
2061
2063
  private readonly moduleConfig;
@@ -2656,6 +2658,20 @@ declare class PaymentsModule {
2656
2658
  * @returns The nametag data, or `null` if no nametag is set.
2657
2659
  */
2658
2660
  getNametag(): NametagData | null;
2661
+ /**
2662
+ * The requester's CURRENT display nametag for outgoing memos: the canonical
2663
+ * Sphere-level (Nostr-backed) store first, then the local minted-token store.
2664
+ *
2665
+ * The minted-token `nametags[]` is populated only by the best-effort,
2666
+ * oracle-gated mint path, so in the real app it is empty at send time even
2667
+ * when the user has a nametag — reading it dropped the nametag from the
2668
+ * payment-request/delivery memo and the payer rendered a raw pubkey. The
2669
+ * canonical store (injected via `getCurrentNametag`) is the one the UI shows
2670
+ * and is reliably loaded on every startup. (#576, 6bd3058 regression)
2671
+ *
2672
+ * @returns The bare nametag name (no leading '@'), or `undefined`.
2673
+ */
2674
+ private currentNametagName;
2659
2675
  /**
2660
2676
  * Get all nametag data entries.
2661
2677
  *
package/dist/index.js CHANGED
@@ -12425,13 +12425,11 @@ var PaymentsModule = class _PaymentsModule {
12425
12425
  );
12426
12426
  }
12427
12427
  const deliverBlob = async (tokenBlob) => {
12428
+ const nm = this.currentNametagName();
12428
12429
  await delivery.deliver(recipientChainPubkeyHex, hexToBytes2(tokenBlob), {
12429
12430
  transferId: result.id,
12430
12431
  memo: request.memo,
12431
- // Carry the sender's own nametag so the recipient renders "@name"
12432
- // instead of "Someone" — bundled with the memo in ONE
12433
- // recipient-addressed envelope (S6).
12434
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
12432
+ ...nm !== void 0 ? { senderNametag: nm } : {}
12435
12433
  });
12436
12434
  };
12437
12435
  const consumedSources = [];
@@ -12849,7 +12847,7 @@ var PaymentsModule = class _PaymentsModule {
12849
12847
  }
12850
12848
  const memoEnvelope = encryptDeliveryBundle(
12851
12849
  deriveDeliveryEncryptionKey(this.deps.identity.privateKey, toPubkey),
12852
- { senderNametag: this.getNametag()?.name, memo: request.message }
12850
+ { senderNametag: this.currentNametagName(), memo: request.message }
12853
12851
  );
12854
12852
  const wire = await api.createPaymentRequest({
12855
12853
  toPubkey,
@@ -14105,6 +14103,22 @@ var PaymentsModule = class _PaymentsModule {
14105
14103
  getNametag() {
14106
14104
  return this.nametags[0] ?? null;
14107
14105
  }
14106
+ /**
14107
+ * The requester's CURRENT display nametag for outgoing memos: the canonical
14108
+ * Sphere-level (Nostr-backed) store first, then the local minted-token store.
14109
+ *
14110
+ * The minted-token `nametags[]` is populated only by the best-effort,
14111
+ * oracle-gated mint path, so in the real app it is empty at send time even
14112
+ * when the user has a nametag — reading it dropped the nametag from the
14113
+ * payment-request/delivery memo and the payer rendered a raw pubkey. The
14114
+ * canonical store (injected via `getCurrentNametag`) is the one the UI shows
14115
+ * and is reliably loaded on every startup. (#576, 6bd3058 regression)
14116
+ *
14117
+ * @returns The bare nametag name (no leading '@'), or `undefined`.
14118
+ */
14119
+ currentNametagName() {
14120
+ return this.deps?.getCurrentNametag?.() ?? this.nametags[0]?.name;
14121
+ }
14108
14122
  /**
14109
14123
  * Get all nametag data entries.
14110
14124
  *
@@ -15120,10 +15134,11 @@ var PaymentsModule = class _PaymentsModule {
15120
15134
  memo: payload.memo,
15121
15135
  createdAt: Date.now()
15122
15136
  });
15137
+ const nm = this.currentNametagName();
15123
15138
  await delivery.deliver(payload.recipient, hexToBytes2(tokenBlobHex), {
15124
15139
  transferId,
15125
15140
  memo: payload.memo,
15126
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
15141
+ ...nm !== void 0 ? { senderNametag: nm } : {}
15127
15142
  });
15128
15143
  await this.removePendingV2Delivery(tokenBlobHex);
15129
15144
  };
@@ -15316,10 +15331,11 @@ var PaymentsModule = class _PaymentsModule {
15316
15331
  logger.warn("Payments", `${entries.length} undelivered v2 transfer(s) journaled from a previous session \u2014 replaying`);
15317
15332
  for (const e of entries) {
15318
15333
  try {
15334
+ const nm = this.currentNametagName();
15319
15335
  await this.delivery.deliver(e.recipientPubkey, hexToBytes2(e.tokenBlob), {
15320
15336
  transferId: e.transferId,
15321
15337
  memo: e.memo,
15322
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
15338
+ ...nm !== void 0 ? { senderNametag: nm } : {}
15323
15339
  });
15324
15340
  await this.removePendingV2Delivery(e.tokenBlob);
15325
15341
  logger.debug("Payments", `Replayed undelivered v2 transfer ${e.transferId.slice(0, 8)}...`);
@@ -29064,7 +29080,8 @@ var Sphere = class _Sphere {
29064
29080
  price: this._priceProvider ?? void 0,
29065
29081
  tokenEngine: moduleSet.tokenEngine,
29066
29082
  delivery: this._delivery ?? void 0,
29067
- walletApi: this._walletApi ?? void 0
29083
+ walletApi: this._walletApi ?? void 0,
29084
+ getCurrentNametag: () => this.getNametagForAddress()
29068
29085
  });
29069
29086
  }
29070
29087
  }
@@ -29153,7 +29170,8 @@ var Sphere = class _Sphere {
29153
29170
  price: this._priceProvider ?? void 0,
29154
29171
  tokenEngine,
29155
29172
  delivery: this._delivery ?? void 0,
29156
- walletApi: this._walletApi ?? void 0
29173
+ walletApi: this._walletApi ?? void 0,
29174
+ getCurrentNametag: () => this.getNametagForAddress()
29157
29175
  });
29158
29176
  communications.initialize({
29159
29177
  identity,
@@ -30628,7 +30646,8 @@ var Sphere = class _Sphere {
30628
30646
  disabledProviderIds: this._disabledProviders,
30629
30647
  tokenEngine,
30630
30648
  delivery: this._delivery ?? void 0,
30631
- walletApi: this._walletApi ?? void 0
30649
+ walletApi: this._walletApi ?? void 0,
30650
+ getCurrentNametag: () => this.getNametagForAddress()
30632
30651
  });
30633
30652
  this._communications.initialize({
30634
30653
  identity: this._identity,