@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.
@@ -12254,13 +12254,11 @@ var PaymentsModule = class _PaymentsModule {
12254
12254
  );
12255
12255
  }
12256
12256
  const deliverBlob = async (tokenBlob) => {
12257
+ const nm = this.currentNametagName();
12257
12258
  await delivery.deliver(recipientChainPubkeyHex, hexToBytes2(tokenBlob), {
12258
12259
  transferId: result.id,
12259
12260
  memo: request.memo,
12260
- // Carry the sender's own nametag so the recipient renders "@name"
12261
- // instead of "Someone" — bundled with the memo in ONE
12262
- // recipient-addressed envelope (S6).
12263
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
12261
+ ...nm !== void 0 ? { senderNametag: nm } : {}
12264
12262
  });
12265
12263
  };
12266
12264
  const consumedSources = [];
@@ -12678,7 +12676,7 @@ var PaymentsModule = class _PaymentsModule {
12678
12676
  }
12679
12677
  const memoEnvelope = encryptDeliveryBundle(
12680
12678
  deriveDeliveryEncryptionKey(this.deps.identity.privateKey, toPubkey),
12681
- { senderNametag: this.getNametag()?.name, memo: request.message }
12679
+ { senderNametag: this.currentNametagName(), memo: request.message }
12682
12680
  );
12683
12681
  const wire = await api.createPaymentRequest({
12684
12682
  toPubkey,
@@ -13934,6 +13932,22 @@ var PaymentsModule = class _PaymentsModule {
13934
13932
  getNametag() {
13935
13933
  return this.nametags[0] ?? null;
13936
13934
  }
13935
+ /**
13936
+ * The requester's CURRENT display nametag for outgoing memos: the canonical
13937
+ * Sphere-level (Nostr-backed) store first, then the local minted-token store.
13938
+ *
13939
+ * The minted-token `nametags[]` is populated only by the best-effort,
13940
+ * oracle-gated mint path, so in the real app it is empty at send time even
13941
+ * when the user has a nametag — reading it dropped the nametag from the
13942
+ * payment-request/delivery memo and the payer rendered a raw pubkey. The
13943
+ * canonical store (injected via `getCurrentNametag`) is the one the UI shows
13944
+ * and is reliably loaded on every startup. (#576, 6bd3058 regression)
13945
+ *
13946
+ * @returns The bare nametag name (no leading '@'), or `undefined`.
13947
+ */
13948
+ currentNametagName() {
13949
+ return this.deps?.getCurrentNametag?.() ?? this.nametags[0]?.name;
13950
+ }
13937
13951
  /**
13938
13952
  * Get all nametag data entries.
13939
13953
  *
@@ -14949,10 +14963,11 @@ var PaymentsModule = class _PaymentsModule {
14949
14963
  memo: payload.memo,
14950
14964
  createdAt: Date.now()
14951
14965
  });
14966
+ const nm = this.currentNametagName();
14952
14967
  await delivery.deliver(payload.recipient, hexToBytes2(tokenBlobHex), {
14953
14968
  transferId,
14954
14969
  memo: payload.memo,
14955
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
14970
+ ...nm !== void 0 ? { senderNametag: nm } : {}
14956
14971
  });
14957
14972
  await this.removePendingV2Delivery(tokenBlobHex);
14958
14973
  };
@@ -15145,10 +15160,11 @@ var PaymentsModule = class _PaymentsModule {
15145
15160
  logger.warn("Payments", `${entries.length} undelivered v2 transfer(s) journaled from a previous session \u2014 replaying`);
15146
15161
  for (const e of entries) {
15147
15162
  try {
15163
+ const nm = this.currentNametagName();
15148
15164
  await this.delivery.deliver(e.recipientPubkey, hexToBytes2(e.tokenBlob), {
15149
15165
  transferId: e.transferId,
15150
15166
  memo: e.memo,
15151
- ...this.getNametag()?.name !== void 0 ? { senderNametag: this.getNametag().name } : {}
15167
+ ...nm !== void 0 ? { senderNametag: nm } : {}
15152
15168
  });
15153
15169
  await this.removePendingV2Delivery(e.tokenBlob);
15154
15170
  logger.debug("Payments", `Replayed undelivered v2 transfer ${e.transferId.slice(0, 8)}...`);
@@ -28894,7 +28910,8 @@ var Sphere = class _Sphere {
28894
28910
  price: this._priceProvider ?? void 0,
28895
28911
  tokenEngine: moduleSet.tokenEngine,
28896
28912
  delivery: this._delivery ?? void 0,
28897
- walletApi: this._walletApi ?? void 0
28913
+ walletApi: this._walletApi ?? void 0,
28914
+ getCurrentNametag: () => this.getNametagForAddress()
28898
28915
  });
28899
28916
  }
28900
28917
  }
@@ -28983,7 +29000,8 @@ var Sphere = class _Sphere {
28983
29000
  price: this._priceProvider ?? void 0,
28984
29001
  tokenEngine,
28985
29002
  delivery: this._delivery ?? void 0,
28986
- walletApi: this._walletApi ?? void 0
29003
+ walletApi: this._walletApi ?? void 0,
29004
+ getCurrentNametag: () => this.getNametagForAddress()
28987
29005
  });
28988
29006
  communications.initialize({
28989
29007
  identity,
@@ -30458,7 +30476,8 @@ var Sphere = class _Sphere {
30458
30476
  disabledProviderIds: this._disabledProviders,
30459
30477
  tokenEngine,
30460
30478
  delivery: this._delivery ?? void 0,
30461
- walletApi: this._walletApi ?? void 0
30479
+ walletApi: this._walletApi ?? void 0,
30480
+ getCurrentNametag: () => this.getNametagForAddress()
30462
30481
  });
30463
30482
  this._communications.initialize({
30464
30483
  identity: this._identity,