@partylayer/sdk 0.7.0 → 0.8.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _partylayer_core from '@partylayer/core';
2
- import { WalletAdapter, NetworkId, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult } from '@partylayer/core';
3
- export { AdapterConnectResult, AdapterContext, AdapterDetectResult, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkId, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName } from '@partylayer/core';
2
+ import { WalletAdapter, NetworkId, OfficialProviderAdapter, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult } from '@partylayer/core';
3
+ export { AdapterConnectResult, AdapterContext, AdapterDetectResult, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkId, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialProviderAdapter } from '@partylayer/core';
4
4
  import { RegistryClient, RegistryStatus } from '@partylayer/registry-client';
5
5
  export { Cip0103StatusForDetection, Cip0103Support, ProviderDetection, ProviderMatcher, RegistryStatus, deriveGenericWalletName, findMatchingWallet, findMatchingWalletInfo, isCip0103Native, matchesProviderDetection } from '@partylayer/registry-client';
6
6
  export { CANTON_NETWORKS, CIP0103Account, CIP0103ConnectResult, CIP0103Event, CIP0103EventBus, CIP0103Method, CIP0103Network, CIP0103Provider, CIP0103StatusEvent, CIP0103TxChangedEvent, CIP0103TxStatus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, DiscoveredProvider, JSON_RPC_ERRORS, PartyLayerProvider, PartyLayerProviderOptions, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
@@ -136,7 +136,7 @@ interface PartyLayerConfig {
136
136
  * });
137
137
  * ```
138
138
  */
139
- adapters?: (WalletAdapter | AdapterClass)[];
139
+ adapters?: (WalletAdapter | AdapterClass | OfficialProviderAdapter)[];
140
140
  /** Storage adapter (default: browser localStorage-based encrypted) */
141
141
  storage?: StorageAdapter;
142
142
  /** Crypto adapter (default: WebCrypto) */
@@ -316,6 +316,13 @@ type EventHandler<T extends PartyLayerEvent = PartyLayerEvent> = (event: T) => v
316
316
  declare class PartyLayerClient {
317
317
  private config;
318
318
  private adapters;
319
+ /**
320
+ * Pre-resolved connect plans for popup/remote (GenericDiscoveryAdapter)
321
+ * wallets, warmed on `listWallets()` (which the modal calls on open) so a
322
+ * subsequent click can connect gesture-synchronously. Consumed (deleted) on
323
+ * use and cleared on disconnect; a cold miss falls back to the normal path.
324
+ */
325
+ private readonly warmPlans;
319
326
  private eventHandlers;
320
327
  private activeSession;
321
328
  readonly registryClient: RegistryClient;
@@ -355,6 +362,15 @@ declare class PartyLayerClient {
355
362
  * List available wallets
356
363
  */
357
364
  listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
365
+ /**
366
+ * Hide `transport: 'discovery-adapter'` registry entries whose matching
367
+ * adapter is NOT registered. A discovery-adapter wallet's provider is supplied
368
+ * by the app (an official ProviderAdapter the SDK bridges under
369
+ * `toWalletId(providerId)`); without it, clicking the entry can only fail. So
370
+ * the entry surfaces only when its adapter is present. No-op when the registry
371
+ * is unavailable (list is already adapters-only) or has no such entries.
372
+ */
373
+ private gateDiscoveryAdapterEntries;
358
374
  /**
359
375
  * Whether announce discovery is active: explicit `discovery.announce`, else
360
376
  * ON in the browser and OFF under SSR (no `window`). Canonical: provider.md.
@@ -397,6 +413,44 @@ declare class PartyLayerClient {
397
413
  * Connect to a wallet
398
414
  */
399
415
  connect(options?: ConnectOptions): Promise<Session>;
416
+ /**
417
+ * Pre-resolve everything `adapter.connect()` needs WITHOUT calling it: wallet
418
+ * selection, origin-allowlist + capability + install guards, and the adapter
419
+ * context. `prefetchedWallets` (passed during warm-up from `listWallets`)
420
+ * avoids a recursive `listWallets()` call.
421
+ */
422
+ private resolveConnectPlan;
423
+ /**
424
+ * Invoke `adapter.connect()` (its FIRST statement — no await precedes it) and
425
+ * build / persist / emit the session. Separated from plan resolution so the
426
+ * popup-safe fast-path can call it gesture-synchronously.
427
+ */
428
+ private completeConnect;
429
+ /**
430
+ * PUBLIC popup-safe primitive: pre-resolve a connect plan ahead of the user
431
+ * gesture; the returned `connect()` invokes `adapter.connect()` as its first
432
+ * statement (no await precedes it) so a popup/remote wallet's `window.open`
433
+ * survives the gesture. For consumers driving such a wallet outside the modal
434
+ * (the modal gets this for free via the `listWallets` warm-up + `connect()`).
435
+ */
436
+ prepareConnect(options?: ConnectOptions): Promise<{
437
+ walletId: WalletId;
438
+ connect: (o?: ConnectOptions) => Promise<Session>;
439
+ }>;
440
+ /**
441
+ * Background warm-up of connect plans for popup/remote
442
+ * (`GenericDiscoveryAdapter`) wallets. Popup-free — `resolveConnectPlan` only
443
+ * runs read/guard probes. Skips already-warm entries; never throws.
444
+ */
445
+ private warmDiscoveryPlans;
446
+ /**
447
+ * SYNCHRONOUS fast-path: if a fresh warm plan exists for a popup/remote wallet
448
+ * — and `options` carries no plan-affecting guards — consume it and START
449
+ * `completeConnect` immediately, reaching `adapter.connect()` with no awaits.
450
+ * Returns the in-flight Session promise, or null to fall back to the normal
451
+ * path (e.g. cold cache, or a non-discovery wallet).
452
+ */
453
+ private tryFastConnect;
400
454
  /**
401
455
  * Disconnect from wallet
402
456
  */
@@ -554,6 +608,76 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
554
608
  submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
555
609
  }
556
610
 
611
+ /**
612
+ * Generic bridge from an official `@canton-network/core-wallet-discovery`
613
+ * `ProviderAdapter` (matched structurally as `OfficialProviderAdapter`) to our
614
+ * `WalletAdapter` contract.
615
+ *
616
+ * This is the GENERIC host for popup/remote Canton wallets that neither inject
617
+ * `window.canton` nor announce via `canton:announceProvider` (e.g. Walley): the
618
+ * app supplies the wallet's OWN official adapter instance in `config.adapters`,
619
+ * and the SDK auto-wraps it here. There is NO wallet-specific package in our
620
+ * codebase — any standards-compliant wallet shipping the official ProviderAdapter
621
+ * shape inherits this path. We deliberately do NOT import `@canton-network/*`
622
+ * (mirroring `@partylayer/provider`'s extension-channel); the standard's SHAPE
623
+ * is the contract.
624
+ *
625
+ * Sibling to `GenericAnnounceAdapter`: both delegate every call to a
626
+ * `CIP0103Provider`. The difference is the source — here the provider comes from
627
+ * the official adapter's `provider()` (obtained LAZILY so SDK init stays
628
+ * SSR-safe; the wallet's `provider()` may touch `window`).
629
+ *
630
+ * Host/network are baked into the app-supplied official adapter at construction
631
+ * (e.g. `new WalleyAdapter({ host: 'https://dev.walley.cc' })`), so the bridge
632
+ * never sees or sets them.
633
+ *
634
+ * Eventless note: the official provider exposes `on`/`emit`/`removeListener`
635
+ * but popup/remote wallets typically never emit. The session layer restores via
636
+ * `status`/`listAccounts` polling + persists on fresh connect, so this is
637
+ * tolerated; `getCapabilities()` therefore NEVER returns `'events'`.
638
+ */
639
+
640
+ interface GenericDiscoveryAdapterArgs {
641
+ /** App-supplied official adapter (e.g. `new WalleyAdapter({ host })`). */
642
+ official: OfficialProviderAdapter;
643
+ /**
644
+ * SDK walletId for this wallet. Defaults to `toWalletId(official.providerId)`
645
+ * so it aligns with the registry entry whose `id` equals the provider id
646
+ * (the convention for `transport: 'discovery-adapter'` entries). Pass
647
+ * explicitly to bind to a different registry id.
648
+ */
649
+ walletId?: WalletId;
650
+ /** Display name override (falls back to the official adapter's name). */
651
+ name?: string;
652
+ /** Icon override (falls back to the official adapter's icon). */
653
+ icon?: string;
654
+ }
655
+ declare class GenericDiscoveryAdapter implements WalletAdapter {
656
+ readonly walletId: WalletId;
657
+ readonly name: string;
658
+ readonly icon?: string;
659
+ private readonly official;
660
+ /** Lazily resolved from `official.provider()` — NOT at construction (SSR-safe). */
661
+ private providerInstance;
662
+ constructor(args: GenericDiscoveryAdapterArgs);
663
+ /** Lazily obtain (and cache) the official provider — deferred off the init/SSR path.
664
+ * `official.provider()` is typed `OfficialProvider` (loose `request` so real
665
+ * official adapters are assignable); it is call-compatible with CIP0103Provider
666
+ * (the bridge only ever calls `request({ method, params })`). */
667
+ private get provider();
668
+ /**
669
+ * Baseline CIP-0103 capabilities. NEVER includes `'events'`: popup/remote
670
+ * wallets expose the event surface but do not emit (truthfulness doctrine).
671
+ */
672
+ getCapabilities(): CapabilityKey[];
673
+ /** Install/availability probe — delegated to the official adapter (popup-free). */
674
+ detectInstalled(): Promise<AdapterDetectResult>;
675
+ connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
676
+ disconnect(): Promise<void>;
677
+ signMessage(_ctx: AdapterContext, _session: Session, params: SignMessageParams): Promise<SignedMessage>;
678
+ submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
679
+ }
680
+
557
681
  /**
558
682
  * Built-in wallet adapters
559
683
  *
@@ -672,4 +796,4 @@ declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
672
796
  */
673
797
  declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
674
798
 
675
- export { ANNOUNCED_WALLET_ID_PREFIX, type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, GenericAnnounceAdapter, type GenericAnnounceAdapterArgs, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, announcedWalletId, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
799
+ export { ANNOUNCED_WALLET_ID_PREFIX, type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, GenericAnnounceAdapter, type GenericAnnounceAdapterArgs, GenericDiscoveryAdapter, type GenericDiscoveryAdapterArgs, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, announcedWalletId, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _partylayer_core from '@partylayer/core';
2
- import { WalletAdapter, NetworkId, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult } from '@partylayer/core';
3
- export { AdapterConnectResult, AdapterContext, AdapterDetectResult, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkId, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName } from '@partylayer/core';
2
+ import { WalletAdapter, NetworkId, OfficialProviderAdapter, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult } from '@partylayer/core';
3
+ export { AdapterConnectResult, AdapterContext, AdapterDetectResult, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkId, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TimeoutError, TransactionStatus, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialProviderAdapter } from '@partylayer/core';
4
4
  import { RegistryClient, RegistryStatus } from '@partylayer/registry-client';
5
5
  export { Cip0103StatusForDetection, Cip0103Support, ProviderDetection, ProviderMatcher, RegistryStatus, deriveGenericWalletName, findMatchingWallet, findMatchingWalletInfo, isCip0103Native, matchesProviderDetection } from '@partylayer/registry-client';
6
6
  export { CANTON_NETWORKS, CIP0103Account, CIP0103ConnectResult, CIP0103Event, CIP0103EventBus, CIP0103Method, CIP0103Network, CIP0103Provider, CIP0103StatusEvent, CIP0103TxChangedEvent, CIP0103TxStatus, CIP0103_EVENTS, CIP0103_MANDATORY_METHODS, CIP0103_METHODS, DiscoveredProvider, JSON_RPC_ERRORS, PartyLayerProvider, PartyLayerProviderOptions, ProviderRpcError, RPC_ERRORS, createProviderBridge, discoverInjectedProviders, fromCAIP2Network, isCIP0103Provider, isValidCAIP2, toCAIP2Network, waitForProvider } from '@partylayer/provider';
@@ -136,7 +136,7 @@ interface PartyLayerConfig {
136
136
  * });
137
137
  * ```
138
138
  */
139
- adapters?: (WalletAdapter | AdapterClass)[];
139
+ adapters?: (WalletAdapter | AdapterClass | OfficialProviderAdapter)[];
140
140
  /** Storage adapter (default: browser localStorage-based encrypted) */
141
141
  storage?: StorageAdapter;
142
142
  /** Crypto adapter (default: WebCrypto) */
@@ -316,6 +316,13 @@ type EventHandler<T extends PartyLayerEvent = PartyLayerEvent> = (event: T) => v
316
316
  declare class PartyLayerClient {
317
317
  private config;
318
318
  private adapters;
319
+ /**
320
+ * Pre-resolved connect plans for popup/remote (GenericDiscoveryAdapter)
321
+ * wallets, warmed on `listWallets()` (which the modal calls on open) so a
322
+ * subsequent click can connect gesture-synchronously. Consumed (deleted) on
323
+ * use and cleared on disconnect; a cold miss falls back to the normal path.
324
+ */
325
+ private readonly warmPlans;
319
326
  private eventHandlers;
320
327
  private activeSession;
321
328
  readonly registryClient: RegistryClient;
@@ -355,6 +362,15 @@ declare class PartyLayerClient {
355
362
  * List available wallets
356
363
  */
357
364
  listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
365
+ /**
366
+ * Hide `transport: 'discovery-adapter'` registry entries whose matching
367
+ * adapter is NOT registered. A discovery-adapter wallet's provider is supplied
368
+ * by the app (an official ProviderAdapter the SDK bridges under
369
+ * `toWalletId(providerId)`); without it, clicking the entry can only fail. So
370
+ * the entry surfaces only when its adapter is present. No-op when the registry
371
+ * is unavailable (list is already adapters-only) or has no such entries.
372
+ */
373
+ private gateDiscoveryAdapterEntries;
358
374
  /**
359
375
  * Whether announce discovery is active: explicit `discovery.announce`, else
360
376
  * ON in the browser and OFF under SSR (no `window`). Canonical: provider.md.
@@ -397,6 +413,44 @@ declare class PartyLayerClient {
397
413
  * Connect to a wallet
398
414
  */
399
415
  connect(options?: ConnectOptions): Promise<Session>;
416
+ /**
417
+ * Pre-resolve everything `adapter.connect()` needs WITHOUT calling it: wallet
418
+ * selection, origin-allowlist + capability + install guards, and the adapter
419
+ * context. `prefetchedWallets` (passed during warm-up from `listWallets`)
420
+ * avoids a recursive `listWallets()` call.
421
+ */
422
+ private resolveConnectPlan;
423
+ /**
424
+ * Invoke `adapter.connect()` (its FIRST statement — no await precedes it) and
425
+ * build / persist / emit the session. Separated from plan resolution so the
426
+ * popup-safe fast-path can call it gesture-synchronously.
427
+ */
428
+ private completeConnect;
429
+ /**
430
+ * PUBLIC popup-safe primitive: pre-resolve a connect plan ahead of the user
431
+ * gesture; the returned `connect()` invokes `adapter.connect()` as its first
432
+ * statement (no await precedes it) so a popup/remote wallet's `window.open`
433
+ * survives the gesture. For consumers driving such a wallet outside the modal
434
+ * (the modal gets this for free via the `listWallets` warm-up + `connect()`).
435
+ */
436
+ prepareConnect(options?: ConnectOptions): Promise<{
437
+ walletId: WalletId;
438
+ connect: (o?: ConnectOptions) => Promise<Session>;
439
+ }>;
440
+ /**
441
+ * Background warm-up of connect plans for popup/remote
442
+ * (`GenericDiscoveryAdapter`) wallets. Popup-free — `resolveConnectPlan` only
443
+ * runs read/guard probes. Skips already-warm entries; never throws.
444
+ */
445
+ private warmDiscoveryPlans;
446
+ /**
447
+ * SYNCHRONOUS fast-path: if a fresh warm plan exists for a popup/remote wallet
448
+ * — and `options` carries no plan-affecting guards — consume it and START
449
+ * `completeConnect` immediately, reaching `adapter.connect()` with no awaits.
450
+ * Returns the in-flight Session promise, or null to fall back to the normal
451
+ * path (e.g. cold cache, or a non-discovery wallet).
452
+ */
453
+ private tryFastConnect;
400
454
  /**
401
455
  * Disconnect from wallet
402
456
  */
@@ -554,6 +608,76 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
554
608
  submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
555
609
  }
556
610
 
611
+ /**
612
+ * Generic bridge from an official `@canton-network/core-wallet-discovery`
613
+ * `ProviderAdapter` (matched structurally as `OfficialProviderAdapter`) to our
614
+ * `WalletAdapter` contract.
615
+ *
616
+ * This is the GENERIC host for popup/remote Canton wallets that neither inject
617
+ * `window.canton` nor announce via `canton:announceProvider` (e.g. Walley): the
618
+ * app supplies the wallet's OWN official adapter instance in `config.adapters`,
619
+ * and the SDK auto-wraps it here. There is NO wallet-specific package in our
620
+ * codebase — any standards-compliant wallet shipping the official ProviderAdapter
621
+ * shape inherits this path. We deliberately do NOT import `@canton-network/*`
622
+ * (mirroring `@partylayer/provider`'s extension-channel); the standard's SHAPE
623
+ * is the contract.
624
+ *
625
+ * Sibling to `GenericAnnounceAdapter`: both delegate every call to a
626
+ * `CIP0103Provider`. The difference is the source — here the provider comes from
627
+ * the official adapter's `provider()` (obtained LAZILY so SDK init stays
628
+ * SSR-safe; the wallet's `provider()` may touch `window`).
629
+ *
630
+ * Host/network are baked into the app-supplied official adapter at construction
631
+ * (e.g. `new WalleyAdapter({ host: 'https://dev.walley.cc' })`), so the bridge
632
+ * never sees or sets them.
633
+ *
634
+ * Eventless note: the official provider exposes `on`/`emit`/`removeListener`
635
+ * but popup/remote wallets typically never emit. The session layer restores via
636
+ * `status`/`listAccounts` polling + persists on fresh connect, so this is
637
+ * tolerated; `getCapabilities()` therefore NEVER returns `'events'`.
638
+ */
639
+
640
+ interface GenericDiscoveryAdapterArgs {
641
+ /** App-supplied official adapter (e.g. `new WalleyAdapter({ host })`). */
642
+ official: OfficialProviderAdapter;
643
+ /**
644
+ * SDK walletId for this wallet. Defaults to `toWalletId(official.providerId)`
645
+ * so it aligns with the registry entry whose `id` equals the provider id
646
+ * (the convention for `transport: 'discovery-adapter'` entries). Pass
647
+ * explicitly to bind to a different registry id.
648
+ */
649
+ walletId?: WalletId;
650
+ /** Display name override (falls back to the official adapter's name). */
651
+ name?: string;
652
+ /** Icon override (falls back to the official adapter's icon). */
653
+ icon?: string;
654
+ }
655
+ declare class GenericDiscoveryAdapter implements WalletAdapter {
656
+ readonly walletId: WalletId;
657
+ readonly name: string;
658
+ readonly icon?: string;
659
+ private readonly official;
660
+ /** Lazily resolved from `official.provider()` — NOT at construction (SSR-safe). */
661
+ private providerInstance;
662
+ constructor(args: GenericDiscoveryAdapterArgs);
663
+ /** Lazily obtain (and cache) the official provider — deferred off the init/SSR path.
664
+ * `official.provider()` is typed `OfficialProvider` (loose `request` so real
665
+ * official adapters are assignable); it is call-compatible with CIP0103Provider
666
+ * (the bridge only ever calls `request({ method, params })`). */
667
+ private get provider();
668
+ /**
669
+ * Baseline CIP-0103 capabilities. NEVER includes `'events'`: popup/remote
670
+ * wallets expose the event surface but do not emit (truthfulness doctrine).
671
+ */
672
+ getCapabilities(): CapabilityKey[];
673
+ /** Install/availability probe — delegated to the official adapter (popup-free). */
674
+ detectInstalled(): Promise<AdapterDetectResult>;
675
+ connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
676
+ disconnect(): Promise<void>;
677
+ signMessage(_ctx: AdapterContext, _session: Session, params: SignMessageParams): Promise<SignedMessage>;
678
+ submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
679
+ }
680
+
557
681
  /**
558
682
  * Built-in wallet adapters
559
683
  *
@@ -672,4 +796,4 @@ declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
672
796
  */
673
797
  declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
674
798
 
675
- export { ANNOUNCED_WALLET_ID_PREFIX, type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, GenericAnnounceAdapter, type GenericAnnounceAdapterArgs, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, announcedWalletId, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
799
+ export { ANNOUNCED_WALLET_ID_PREFIX, type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, GenericAnnounceAdapter, type GenericAnnounceAdapterArgs, GenericDiscoveryAdapter, type GenericDiscoveryAdapterArgs, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, announcedWalletId, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };