@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.cjs CHANGED
@@ -12614,13 +12614,11 @@ var PaymentsModule = class _PaymentsModule {
12614
12614
  );
12615
12615
  }
12616
12616
  const deliverBlob = async (tokenBlob) => {
12617
+ const nm = this.currentNametagName();
12617
12618
  await delivery.deliver(recipientChainPubkeyHex, hexToBytes2(tokenBlob), {
12618
12619
  transferId: result.id,
12619
12620
  memo: request.memo,
12620
- // Carry the sender's own nametag so the recipient renders "@name"
12621
- // instead of "Someone" — bundled with the memo in ONE
12622
- // recipient-addressed envelope (S6).
12623
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
12621
+ ...nm !== void 0 ? { senderNametag: nm } : {}
12624
12622
  });
12625
12623
  };
12626
12624
  const consumedSources = [];
@@ -13038,7 +13036,7 @@ var PaymentsModule = class _PaymentsModule {
13038
13036
  }
13039
13037
  const memoEnvelope = encryptDeliveryBundle(
13040
13038
  deriveDeliveryEncryptionKey(this.deps.identity.privateKey, toPubkey),
13041
- { senderNametag: this.getNametag()?.name, memo: request.message }
13039
+ { senderNametag: this.currentNametagName(), memo: request.message }
13042
13040
  );
13043
13041
  const wire = await api.createPaymentRequest({
13044
13042
  toPubkey,
@@ -14294,6 +14292,22 @@ var PaymentsModule = class _PaymentsModule {
14294
14292
  getNametag() {
14295
14293
  return this.nametags[0] ?? null;
14296
14294
  }
14295
+ /**
14296
+ * The requester's CURRENT display nametag for outgoing memos: the canonical
14297
+ * Sphere-level (Nostr-backed) store first, then the local minted-token store.
14298
+ *
14299
+ * The minted-token `nametags[]` is populated only by the best-effort,
14300
+ * oracle-gated mint path, so in the real app it is empty at send time even
14301
+ * when the user has a nametag — reading it dropped the nametag from the
14302
+ * payment-request/delivery memo and the payer rendered a raw pubkey. The
14303
+ * canonical store (injected via `getCurrentNametag`) is the one the UI shows
14304
+ * and is reliably loaded on every startup. (#576, 6bd3058 regression)
14305
+ *
14306
+ * @returns The bare nametag name (no leading '@'), or `undefined`.
14307
+ */
14308
+ currentNametagName() {
14309
+ return this.deps?.getCurrentNametag?.() ?? this.nametags[0]?.name;
14310
+ }
14297
14311
  /**
14298
14312
  * Get all nametag data entries.
14299
14313
  *
@@ -15309,10 +15323,11 @@ var PaymentsModule = class _PaymentsModule {
15309
15323
  memo: payload.memo,
15310
15324
  createdAt: Date.now()
15311
15325
  });
15326
+ const nm = this.currentNametagName();
15312
15327
  await delivery.deliver(payload.recipient, hexToBytes2(tokenBlobHex), {
15313
15328
  transferId,
15314
15329
  memo: payload.memo,
15315
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
15330
+ ...nm !== void 0 ? { senderNametag: nm } : {}
15316
15331
  });
15317
15332
  await this.removePendingV2Delivery(tokenBlobHex);
15318
15333
  };
@@ -15505,10 +15520,11 @@ var PaymentsModule = class _PaymentsModule {
15505
15520
  logger.warn("Payments", `${entries.length} undelivered v2 transfer(s) journaled from a previous session \u2014 replaying`);
15506
15521
  for (const e of entries) {
15507
15522
  try {
15523
+ const nm = this.currentNametagName();
15508
15524
  await this.delivery.deliver(e.recipientPubkey, hexToBytes2(e.tokenBlob), {
15509
15525
  transferId: e.transferId,
15510
15526
  memo: e.memo,
15511
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
15527
+ ...nm !== void 0 ? { senderNametag: nm } : {}
15512
15528
  });
15513
15529
  await this.removePendingV2Delivery(e.tokenBlob);
15514
15530
  logger.debug("Payments", `Replayed undelivered v2 transfer ${e.transferId.slice(0, 8)}...`);
@@ -29249,7 +29265,8 @@ var Sphere = class _Sphere {
29249
29265
  price: this._priceProvider ?? void 0,
29250
29266
  tokenEngine: moduleSet.tokenEngine,
29251
29267
  delivery: this._delivery ?? void 0,
29252
- walletApi: this._walletApi ?? void 0
29268
+ walletApi: this._walletApi ?? void 0,
29269
+ getCurrentNametag: () => this.getNametagForAddress()
29253
29270
  });
29254
29271
  }
29255
29272
  }
@@ -29338,7 +29355,8 @@ var Sphere = class _Sphere {
29338
29355
  price: this._priceProvider ?? void 0,
29339
29356
  tokenEngine,
29340
29357
  delivery: this._delivery ?? void 0,
29341
- walletApi: this._walletApi ?? void 0
29358
+ walletApi: this._walletApi ?? void 0,
29359
+ getCurrentNametag: () => this.getNametagForAddress()
29342
29360
  });
29343
29361
  communications.initialize({
29344
29362
  identity,
@@ -30813,7 +30831,8 @@ var Sphere = class _Sphere {
30813
30831
  disabledProviderIds: this._disabledProviders,
30814
30832
  tokenEngine,
30815
30833
  delivery: this._delivery ?? void 0,
30816
- walletApi: this._walletApi ?? void 0
30834
+ walletApi: this._walletApi ?? void 0,
30835
+ getCurrentNametag: () => this.getNametagForAddress()
30817
30836
  });
30818
30837
  this._communications.initialize({
30819
30838
  identity: this._identity,