@partylayer/sdk 0.10.0 → 0.10.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/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { toWalletId, toPartyId, isRecognizedNetwork, hashForPrivacy, createMetricsPayload, isOfficialAdapterFactory, isOfficialProviderAdapter, mapUnknownErrorToPartyLayerError, findMatchingWalletInfo, detectNetworkMismatch, NetworkMismatchError, METRICS, WalletNotFoundError, capabilityGuard, installGuard, toSessionId, CapabilityNotSupportedError, errorMetricName } from '@partylayer/core';
|
|
2
|
-
export { 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';
|
|
1
|
+
import { toWalletId, toPartyId, isRecognizedNetwork, hashForPrivacy, createMetricsPayload, isOfficialAdapterFactory, isOfficialProviderAdapter, mapUnknownErrorToPartyLayerError, findMatchingWalletInfo, detectNetworkMismatch, NetworkMismatchError, METRICS, AdapterNotRegisteredError, WalletNotFoundError, capabilityGuard, installGuard, toSessionId, CapabilityNotSupportedError, errorMetricName } from '@partylayer/core';
|
|
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
5
|
import { discoverProviders, createExtensionChannelProvider, createProviderBridge } from '@partylayer/provider';
|
|
@@ -753,6 +753,27 @@ var PartyLayerClient = class {
|
|
|
753
753
|
if (!hidden || hidden.size === 0) return wallets;
|
|
754
754
|
return wallets.filter((w) => !hidden.has(String(w.walletId)));
|
|
755
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* If `walletId` maps to a registry entry with `transport: 'discovery-adapter'`,
|
|
758
|
+
* return the bits to build an actionable "register its adapter" error; else
|
|
759
|
+
* null (truly-unknown or non-discovery → plain WalletNotFoundError). Reads the
|
|
760
|
+
* UNGATED registry (SWR-cached); registry-unavailable → null (safe fallback).
|
|
761
|
+
*/
|
|
762
|
+
async unregisteredDiscoveryInfo(walletId) {
|
|
763
|
+
try {
|
|
764
|
+
const registry = await this.registryClient.getRegistry();
|
|
765
|
+
const entry = registry.wallets.find((w) => toWalletId(w.id) === walletId);
|
|
766
|
+
if (entry?.adapter?.transport !== "discovery-adapter") return null;
|
|
767
|
+
const pid = entry.adapter?.config?.providerId;
|
|
768
|
+
return {
|
|
769
|
+
name: entry.name,
|
|
770
|
+
providerId: typeof pid === "string" ? pid : entry.id,
|
|
771
|
+
adapterPackage: typeof entry.adapter?.type === "string" ? entry.adapter.type : void 0
|
|
772
|
+
};
|
|
773
|
+
} catch {
|
|
774
|
+
return null;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
756
777
|
/**
|
|
757
778
|
* Whether announce discovery is active: explicit `discovery.announce`, else
|
|
758
779
|
* ON in the browser and OFF under SSR (no `window`). Canonical: provider.md.
|
|
@@ -916,6 +937,10 @@ var PartyLayerClient = class {
|
|
|
916
937
|
metadata: { source: "native-cip0103" }
|
|
917
938
|
};
|
|
918
939
|
} else {
|
|
940
|
+
const info = await this.unregisteredDiscoveryInfo(options.walletId);
|
|
941
|
+
if (info) {
|
|
942
|
+
throw new AdapterNotRegisteredError(String(options.walletId), info);
|
|
943
|
+
}
|
|
919
944
|
throw new WalletNotFoundError(String(options.walletId));
|
|
920
945
|
}
|
|
921
946
|
}
|