@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.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { toWalletId, toPartyId, isRecognizedNetwork, hashForPrivacy, createMetri
|
|
|
2
2
|
export { AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, InternalError, METRICS, OriginNotAllowedError, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, SessionExpiredError, TimeoutError, TransportError, UserRejectedError, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialAdapterFactory, isOfficialProviderAdapter } from '@partylayer/core';
|
|
3
3
|
import { RegistryClient } from '@partylayer/registry-client';
|
|
4
4
|
export { deriveGenericWalletName, findMatchingWallet, findMatchingWalletInfo, isCip0103Native, matchesProviderDetection } from '@partylayer/registry-client';
|
|
5
|
-
import {
|
|
5
|
+
import { subscribeAnnouncedProviders, createExtensionChannelProvider, discoverProviders, createProviderBridge } from '@partylayer/provider';
|
|
6
6
|
export { CANTON_NETWORKS, CIP0103EventBus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, JSON_RPC_ERRORS, PartyLayerProvider, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
|
|
7
7
|
import { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
8
8
|
export { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
@@ -605,6 +605,12 @@ var PartyLayerClient = class {
|
|
|
605
605
|
telemetry;
|
|
606
606
|
/** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
|
|
607
607
|
announceEntriesCache = null;
|
|
608
|
+
// Persistent announce accumulator (option 1): one window subscription mounted
|
|
609
|
+
// at construction so LATE / inject-time `canton:announceProvider` replies are
|
|
610
|
+
// captured (not just a one-shot window). Read by aggregateAnnouncedWallets;
|
|
611
|
+
// torn down in destroy(). Empty → listWallets() output is byte-identical.
|
|
612
|
+
announceRegistry = /* @__PURE__ */ new Map();
|
|
613
|
+
announceUnsubscribe = null;
|
|
608
614
|
origin;
|
|
609
615
|
constructor(config) {
|
|
610
616
|
this.config = config;
|
|
@@ -646,6 +652,12 @@ var PartyLayerClient = class {
|
|
|
646
652
|
storage: this.storage
|
|
647
653
|
});
|
|
648
654
|
this.updateRegistryStatus();
|
|
655
|
+
if (this.announceEnabled) {
|
|
656
|
+
this.announceUnsubscribe = subscribeAnnouncedProviders(
|
|
657
|
+
(p) => this.announceRegistry.set(p.id, p),
|
|
658
|
+
{ createProvider: (a) => createExtensionChannelProvider({ target: a.target ?? a.id }) }
|
|
659
|
+
);
|
|
660
|
+
}
|
|
649
661
|
this.restoreSession().catch((err) => {
|
|
650
662
|
this.emit("error", {
|
|
651
663
|
type: "error",
|
|
@@ -806,12 +818,17 @@ var PartyLayerClient = class {
|
|
|
806
818
|
if (!this.announceEnabled) return base;
|
|
807
819
|
if (this.announceEntriesCache === null) {
|
|
808
820
|
try {
|
|
809
|
-
const
|
|
821
|
+
const snapshot = await discoverProviders({
|
|
810
822
|
timeoutMs: this.config.discovery?.announceTimeoutMs,
|
|
811
823
|
// Working provider over the announce target channel; G4 (provider.md):
|
|
812
824
|
// target defaults to id when omitted — never a shared slot.
|
|
813
825
|
createProvider: (a) => createExtensionChannelProvider({ target: a.target ?? a.id })
|
|
814
826
|
});
|
|
827
|
+
const byId = /* @__PURE__ */ new Map();
|
|
828
|
+
for (const d of snapshot) byId.set(d.id, d);
|
|
829
|
+
for (const d of this.announceRegistry.values())
|
|
830
|
+
if (!byId.has(d.id)) byId.set(d.id, d);
|
|
831
|
+
const discovered = [...byId.values()];
|
|
815
832
|
const entries = [];
|
|
816
833
|
for (const d of discovered) {
|
|
817
834
|
if (d.identityResolved === false) continue;
|
|
@@ -1321,6 +1338,9 @@ var PartyLayerClient = class {
|
|
|
1321
1338
|
this.telemetry.flush().catch(() => {
|
|
1322
1339
|
});
|
|
1323
1340
|
}
|
|
1341
|
+
this.announceUnsubscribe?.();
|
|
1342
|
+
this.announceUnsubscribe = null;
|
|
1343
|
+
this.announceRegistry.clear();
|
|
1324
1344
|
this.eventHandlers.clear();
|
|
1325
1345
|
this.activeSession = null;
|
|
1326
1346
|
}
|