@partylayer/sdk 0.10.1 → 0.10.2
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.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -332,6 +332,8 @@ declare class PartyLayerClient {
|
|
|
332
332
|
private telemetry?;
|
|
333
333
|
/** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
|
|
334
334
|
private announceEntriesCache;
|
|
335
|
+
private readonly announceRegistry;
|
|
336
|
+
private announceUnsubscribe;
|
|
335
337
|
private origin;
|
|
336
338
|
constructor(config: PartyLayerConfig);
|
|
337
339
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -332,6 +332,8 @@ declare class PartyLayerClient {
|
|
|
332
332
|
private telemetry?;
|
|
333
333
|
/** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
|
|
334
334
|
private announceEntriesCache;
|
|
335
|
+
private readonly announceRegistry;
|
|
336
|
+
private announceUnsubscribe;
|
|
335
337
|
private origin;
|
|
336
338
|
constructor(config: PartyLayerConfig);
|
|
337
339
|
/**
|
package/dist/index.js
CHANGED
|
@@ -599,6 +599,12 @@ var PartyLayerClient = class {
|
|
|
599
599
|
telemetry;
|
|
600
600
|
/** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
|
|
601
601
|
announceEntriesCache = null;
|
|
602
|
+
// Persistent announce accumulator (option 1): one window subscription mounted
|
|
603
|
+
// at construction so LATE / inject-time `canton:announceProvider` replies are
|
|
604
|
+
// captured (not just a one-shot window). Read by aggregateAnnouncedWallets;
|
|
605
|
+
// torn down in destroy(). Empty → listWallets() output is byte-identical.
|
|
606
|
+
announceRegistry = /* @__PURE__ */ new Map();
|
|
607
|
+
announceUnsubscribe = null;
|
|
602
608
|
origin;
|
|
603
609
|
constructor(config) {
|
|
604
610
|
this.config = config;
|
|
@@ -640,6 +646,12 @@ var PartyLayerClient = class {
|
|
|
640
646
|
storage: this.storage
|
|
641
647
|
});
|
|
642
648
|
this.updateRegistryStatus();
|
|
649
|
+
if (this.announceEnabled) {
|
|
650
|
+
this.announceUnsubscribe = provider.subscribeAnnouncedProviders(
|
|
651
|
+
(p) => this.announceRegistry.set(p.id, p),
|
|
652
|
+
{ createProvider: (a) => provider.createExtensionChannelProvider({ target: a.target ?? a.id }) }
|
|
653
|
+
);
|
|
654
|
+
}
|
|
643
655
|
this.restoreSession().catch((err) => {
|
|
644
656
|
this.emit("error", {
|
|
645
657
|
type: "error",
|
|
@@ -800,12 +812,17 @@ var PartyLayerClient = class {
|
|
|
800
812
|
if (!this.announceEnabled) return base;
|
|
801
813
|
if (this.announceEntriesCache === null) {
|
|
802
814
|
try {
|
|
803
|
-
const
|
|
815
|
+
const snapshot = await provider.discoverProviders({
|
|
804
816
|
timeoutMs: this.config.discovery?.announceTimeoutMs,
|
|
805
817
|
// Working provider over the announce target channel; G4 (provider.md):
|
|
806
818
|
// target defaults to id when omitted — never a shared slot.
|
|
807
819
|
createProvider: (a) => provider.createExtensionChannelProvider({ target: a.target ?? a.id })
|
|
808
820
|
});
|
|
821
|
+
const byId = /* @__PURE__ */ new Map();
|
|
822
|
+
for (const d of snapshot) byId.set(d.id, d);
|
|
823
|
+
for (const d of this.announceRegistry.values())
|
|
824
|
+
if (!byId.has(d.id)) byId.set(d.id, d);
|
|
825
|
+
const discovered = [...byId.values()];
|
|
809
826
|
const entries = [];
|
|
810
827
|
for (const d of discovered) {
|
|
811
828
|
if (d.identityResolved === false) continue;
|
|
@@ -1315,6 +1332,9 @@ var PartyLayerClient = class {
|
|
|
1315
1332
|
this.telemetry.flush().catch(() => {
|
|
1316
1333
|
});
|
|
1317
1334
|
}
|
|
1335
|
+
this.announceUnsubscribe?.();
|
|
1336
|
+
this.announceUnsubscribe = null;
|
|
1337
|
+
this.announceRegistry.clear();
|
|
1318
1338
|
this.eventHandlers.clear();
|
|
1319
1339
|
this.activeSession = null;
|
|
1320
1340
|
}
|