@unicitylabs/sphere-sdk 0.14.8-dev.1 → 0.14.9-dev.1
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/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 +34 -4
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +34 -4
- 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/wallet-api-v2/index.cjs +5 -1
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.d.cts +0 -1
- package/dist/impl/wallet-api-v2/index.d.ts +0 -1
- package/dist/impl/wallet-api-v2/index.js +5 -1
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +22 -2
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +22 -2
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11474,6 +11474,15 @@ var ListStore = class {
|
|
|
11474
11474
|
return await this.kv.get(this.storeKey) ?? [];
|
|
11475
11475
|
}
|
|
11476
11476
|
};
|
|
11477
|
+
function senderNametagOption(ownNametag) {
|
|
11478
|
+
let nametag;
|
|
11479
|
+
try {
|
|
11480
|
+
nametag = ownNametag?.();
|
|
11481
|
+
} catch {
|
|
11482
|
+
return {};
|
|
11483
|
+
}
|
|
11484
|
+
return nametag === void 0 || nametag === "" ? {} : { senderNametag: nametag };
|
|
11485
|
+
}
|
|
11477
11486
|
var DeliveryJournal = class extends ListStore {
|
|
11478
11487
|
constructor(kv) {
|
|
11479
11488
|
super(kv, STORE_KEYS.deliveryJournal, (e) => `${e.transferId}:${String(e.opIndex)}`);
|
|
@@ -11524,7 +11533,8 @@ var DeliveryJournal = class extends ListStore {
|
|
|
11524
11533
|
try {
|
|
11525
11534
|
await deps.delivery.deliver(entry.recipientPubkey, hexToBytes4(entry.blobHex), {
|
|
11526
11535
|
transferId: entry.transferId,
|
|
11527
|
-
...entry.memo !== void 0 ? { memo: entry.memo } : {}
|
|
11536
|
+
...entry.memo !== void 0 ? { memo: entry.memo } : {},
|
|
11537
|
+
...senderNametagOption(deps.ownNametag)
|
|
11528
11538
|
});
|
|
11529
11539
|
await this.remove(entry.transferId, entry.opIndex);
|
|
11530
11540
|
stats.delivered += 1;
|
|
@@ -11792,7 +11802,11 @@ var TransferMachine = class {
|
|
|
11792
11802
|
const journaled = committed.filter((o) => o.error === void 0 && o.recipientBlob !== void 0);
|
|
11793
11803
|
let pending = journaled.length < committed.length;
|
|
11794
11804
|
if (journaled.length === 0) return pending;
|
|
11795
|
-
const options = {
|
|
11805
|
+
const options = {
|
|
11806
|
+
transferId,
|
|
11807
|
+
...memo !== void 0 ? { memo } : {},
|
|
11808
|
+
...senderNametagOption(this.deps.ownNametag)
|
|
11809
|
+
};
|
|
11796
11810
|
if (await this.tryBatchDeposit(recipientPubkey, journaled, options)) return pending;
|
|
11797
11811
|
for (const outcome of journaled) {
|
|
11798
11812
|
const stillPending = await this.deliverOne(recipientPubkey, outcome, options);
|
|
@@ -12226,6 +12240,9 @@ var Converger = class {
|
|
|
12226
12240
|
return {
|
|
12227
12241
|
delivery: this.deps.delivery,
|
|
12228
12242
|
now: () => this.deps.now(),
|
|
12243
|
+
// sphere#487: a replayed leg carries the sender's name too — the machine
|
|
12244
|
+
// deps hold the one live getter, so replay can never drift from a send.
|
|
12245
|
+
...this.deps.machineDeps.ownNametag !== void 0 ? { ownNametag: this.deps.machineDeps.ownNametag } : {},
|
|
12229
12246
|
attention: (transferId, code, detail) => {
|
|
12230
12247
|
this.deps.emit(
|
|
12231
12248
|
"transfer:attention",
|
|
@@ -13869,6 +13886,9 @@ function buildMachineDeps(deps, hooks, historyStore) {
|
|
|
13869
13886
|
decryptPayload: async (envelope) => JSON.parse(decryptField(deps.fieldKey, envelope)),
|
|
13870
13887
|
signComplete: deps.signComplete,
|
|
13871
13888
|
ownPubkey: hexToBytes4(deps.ownPubkey),
|
|
13889
|
+
// sphere#487: the same live getter Requests uses — the delivery envelope is
|
|
13890
|
+
// the recipient's ONLY source for the sender's Unicity ID.
|
|
13891
|
+
...deps.ownNametag !== void 0 ? { ownNametag: deps.ownNametag } : {},
|
|
13872
13892
|
emit: deps.emit,
|
|
13873
13893
|
now: deps.now ?? Date.now,
|
|
13874
13894
|
recordHistory: async ({ transferId, payload, committedAmount }) => {
|
|
@@ -15345,10 +15365,14 @@ var WalletApiDeliveryPort = class {
|
|
|
15345
15365
|
sha: bytesToHex3(sha256(bytes))
|
|
15346
15366
|
};
|
|
15347
15367
|
}
|
|
15368
|
+
// sphere#487: the nametag is a per-call option and NOT port config — a
|
|
15369
|
+
// construction-time copy would silently go stale on registration, and only a
|
|
15370
|
+
// caller-supplied value is enforceable by the port contract suite (which any
|
|
15371
|
+
// swapped DeliveryPort must pass).
|
|
15348
15372
|
buildEnvelope(recipientPubkey, options) {
|
|
15349
15373
|
const key = deriveDeliveryEncryptionKey(this.identity.privateKey, recipientPubkey);
|
|
15350
15374
|
return encryptDeliveryBundle(key, {
|
|
15351
|
-
senderNametag: options.senderNametag
|
|
15375
|
+
senderNametag: options.senderNametag,
|
|
15352
15376
|
memo: options.memo
|
|
15353
15377
|
});
|
|
15354
15378
|
}
|
|
@@ -18400,6 +18424,7 @@ var Sphere = class _Sphere {
|
|
|
18400
18424
|
"INVALID_CONFIG"
|
|
18401
18425
|
);
|
|
18402
18426
|
}
|
|
18427
|
+
const facadeAddressId = identity.directAddress === void 0 ? void 0 : getAddressId(identity.directAddress);
|
|
18403
18428
|
const facade = composePaymentsV2({
|
|
18404
18429
|
identity,
|
|
18405
18430
|
composition: this._paymentsV2Composition,
|
|
@@ -18413,7 +18438,12 @@ var Sphere = class _Sphere {
|
|
|
18413
18438
|
price: this._priceProvider,
|
|
18414
18439
|
emit: (event, payload) => this.emitEvent(event, payload),
|
|
18415
18440
|
resolvePeer: (identifier) => this._transport.resolve?.(identifier) ?? Promise.resolve(null),
|
|
18416
|
-
|
|
18441
|
+
// Scoped to THIS facade's address, never "whichever is active":
|
|
18442
|
+
// switchToAddress moves _currentAddressIndex BEFORE stopping this
|
|
18443
|
+
// vertical, so the argument-less getter would hand an in-flight
|
|
18444
|
+
// deliver the NEXT address's Unicity ID — a name the sending key does
|
|
18445
|
+
// not own (sphere#487 review).
|
|
18446
|
+
nametag: () => this.getNametagForAddress(facadeAddressId)
|
|
18417
18447
|
}
|
|
18418
18448
|
});
|
|
18419
18449
|
this._paymentsV2Active = { index, facade };
|