@partylayer/sdk 0.5.0 → 0.7.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,5 +1,5 @@
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 } 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
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';
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';
@@ -84,6 +84,19 @@ interface PartyLayerConfig {
84
84
  channel?: 'stable' | 'beta';
85
85
  /** Default network */
86
86
  network: NetworkId;
87
+ /**
88
+ * Network-mismatch enforcement policy (default: `'guard'`).
89
+ *
90
+ * When a connected wallet's effective network differs from `network`:
91
+ * - `'off'` — detect + emit `session:networkMismatch` only; never block.
92
+ * - `'guard'` — (default) block wrong-network TRANSACTIONS (signMessage,
93
+ * signTransaction, submitTransaction, ledgerApi); connect still succeeds.
94
+ * - `'strict'` — also block CONNECT (throws `NetworkMismatchError`).
95
+ *
96
+ * BEHAVIOR CHANGE: prior to this, wrong-network transactions always
97
+ * proceeded. Set `'off'` to restore that.
98
+ */
99
+ networkEnforcement?: 'off' | 'guard' | 'strict';
87
100
  /**
88
101
  * Wallet adapters to register (OPTIONAL)
89
102
  *
@@ -130,6 +143,28 @@ interface PartyLayerConfig {
130
143
  crypto?: CryptoAdapter;
131
144
  /** Registry public keys for signature verification (ed25519) */
132
145
  registryPublicKeys?: string[];
146
+ /**
147
+ * EIP-6963-style announce discovery — the canonical Canton provider contract
148
+ * (`canton:requestProvider` → `canton:announceProvider`, see provider.md).
149
+ *
150
+ * When enabled, `listWallets()` aggregates announced CIP-0103 wallets with
151
+ * the `window.canton` namespace scan, the registry, and registered adapters:
152
+ * - an announced id matching a registered/registry wallet's
153
+ * `providerDetection` (provider.id) maps to that adapter — NO duplicate
154
+ * picker entry (e.g. Console's announce `lpnf…` → the Console adapter);
155
+ * - an UNKNOWN announced id surfaces as a dynamic entry routed to its own
156
+ * extension `target` (collision-proof; future announce-capable wallets
157
+ * appear with zero code changes).
158
+ *
159
+ * Default ON in the browser; ALWAYS skipped under SSR (`typeof window` guard).
160
+ * With zero announcers, `listWallets()` output is byte-identical to before.
161
+ */
162
+ discovery?: {
163
+ /** Aggregate `canton:announceProvider` wallets. @default true (in browser) */
164
+ announce?: boolean;
165
+ /** Announce-collection window in ms. @default 300 (canonical ~300ms) */
166
+ announceTimeoutMs?: number;
167
+ };
133
168
  /**
134
169
  * Telemetry configuration or adapter
135
170
  *
@@ -232,6 +267,21 @@ interface SessionExpiredEvent {
232
267
  type: 'session:expired';
233
268
  sessionId: SessionId;
234
269
  }
270
+ /**
271
+ * Network mismatch event — the connected wallet's effective network differs
272
+ * from the dApp's configured network. Emitted under ALL policies (informational);
273
+ * `enforced` is true when the active policy ('guard' | 'strict') will block.
274
+ */
275
+ interface SessionNetworkMismatchEvent {
276
+ type: 'session:networkMismatch';
277
+ sessionId: SessionId;
278
+ /** dApp-configured (expected) network, CAIP-2 normalized. */
279
+ expected: string;
280
+ /** Wallet-reported (actual) network, CAIP-2 normalized. */
281
+ actual: string;
282
+ /** Whether the active policy will block (guard|strict) vs. detect-only (off). */
283
+ enforced: boolean;
284
+ }
235
285
  /**
236
286
  * Transaction status event
237
287
  */
@@ -252,7 +302,7 @@ interface ErrorEvent {
252
302
  /**
253
303
  * All event types
254
304
  */
255
- type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConnectedEvent | SessionDisconnectedEvent | SessionExpiredEvent | TxStatusEvent | ErrorEvent;
305
+ type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConnectedEvent | SessionDisconnectedEvent | SessionExpiredEvent | SessionNetworkMismatchEvent | TxStatusEvent | ErrorEvent;
256
306
  /**
257
307
  * Event handler type
258
308
  */
@@ -273,6 +323,8 @@ declare class PartyLayerClient {
273
323
  private crypto;
274
324
  private storage;
275
325
  private telemetry?;
326
+ /** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
327
+ private announceEntriesCache;
276
328
  private origin;
277
329
  constructor(config: PartyLayerConfig);
278
330
  /**
@@ -303,6 +355,44 @@ declare class PartyLayerClient {
303
355
  * List available wallets
304
356
  */
305
357
  listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
358
+ /**
359
+ * Whether announce discovery is active: explicit `discovery.announce`, else
360
+ * ON in the browser and OFF under SSR (no `window`). Canonical: provider.md.
361
+ */
362
+ private get announceEnabled();
363
+ /**
364
+ * Clear the cached announce round-trip so the next `listWallets()` re-runs the
365
+ * `canton:requestProvider` handshake (e.g. after a wallet is installed).
366
+ */
367
+ refreshDiscovery(): void;
368
+ /**
369
+ * Aggregate `canton:announceProvider` wallets into the picker list (A2).
370
+ *
371
+ * One-shot cached per client (refresh via {@link refreshDiscovery}); SSR-skipped.
372
+ * For each discovered provider (announce ∪ `window.canton` scan, deduped):
373
+ * - if its id matches a known wallet's `providerDetection` (provider.id) it
374
+ * IS that wallet — no new entry (identity bridge: Console's `lpnf…` → the
375
+ * `console` entry, Send's `ldmo…` → the `send` entry);
376
+ * - otherwise it is surfaced as a dynamic `browser:ext:<id>` entry routed to
377
+ * its own extension `target`, with a {@link GenericAnnounceAdapter}
378
+ * registered so a click connects through that target ONLY (no shared slot).
379
+ * With zero announcers this returns `base` unchanged.
380
+ */
381
+ private aggregateAnnouncedWallets;
382
+ /** Active network-enforcement policy (default 'guard'). */
383
+ private get enforcement();
384
+ /**
385
+ * Detect a confident network mismatch between the dApp's configured network
386
+ * and the session's (wallet-reported) network. Returns null when they match
387
+ * or the comparison isn't confident (conservative — never a false positive).
388
+ */
389
+ private networkMismatch;
390
+ /**
391
+ * Guard a transaction-class operation: throw `NetworkMismatchError` when the
392
+ * session is on the wrong network AND the policy enforces it ('guard' |
393
+ * 'strict'). Also protects restored sessions and mid-session network switches.
394
+ */
395
+ private assertNetworkOk;
306
396
  /**
307
397
  * Connect to a wallet
308
398
  */
@@ -411,6 +501,59 @@ declare class PartyLayerClient {
411
501
  */
412
502
  declare function createPartyLayer(config: PartyLayerConfig): PartyLayerClient;
413
503
 
504
+ /**
505
+ * Dynamic adapter for an announced CIP-0103 wallet that has no first-party
506
+ * PartyLayer adapter.
507
+ *
508
+ * Canonical contract (provider.md): after `canton:requestProvider`, wallets
509
+ * announce `{ id, name?, icon?, target? }`; "the SDK … registers one adapter
510
+ * per id with providerId `browser:ext:<id>`". This adapter is that registration
511
+ * for the UNKNOWN case — it delegates every call to a `CIP0103Provider` bound to
512
+ * the wallet's own extension `target` channel (built by
513
+ * `createExtensionChannelProvider({ target: announced.target ?? announced.id })`).
514
+ * Because the channel is target-scoped, a click on this entry can ONLY ever
515
+ * reach the wallet that announced it — never a shared `window.canton` slot or
516
+ * another wallet (the A2 collision guarantee), and future announce-capable
517
+ * Canton wallets light up with zero code changes.
518
+ *
519
+ * KNOWN wallets (Console, Send, …) never use this class — the SDK's identity
520
+ * bridge maps their announce id to their existing adapter via `providerDetection`.
521
+ */
522
+
523
+ /** Canonical providerId prefix for an announced extension (provider.md: `browser:ext:<id>`). */
524
+ declare const ANNOUNCED_WALLET_ID_PREFIX = "browser:ext:";
525
+ /** Build the canonical SDK walletId for an announced extension id. */
526
+ declare function announcedWalletId(announceId: string): WalletId;
527
+ interface GenericAnnounceAdapterArgs {
528
+ /** The announced extension id (== announce `detail.id`). */
529
+ announceId: string;
530
+ /** Display name from the announce detail (falls back to a derived label). */
531
+ name?: string;
532
+ /** Icon (data: URI or URL) from the announce detail. */
533
+ icon?: string;
534
+ /** Target-scoped CIP-0103 provider built from the announce (the discovery result). */
535
+ provider: CIP0103Provider;
536
+ }
537
+ declare class GenericAnnounceAdapter implements WalletAdapter {
538
+ readonly walletId: WalletId;
539
+ readonly name: string;
540
+ /** Icon surfaced to the picker (announce detail). */
541
+ readonly icon?: string;
542
+ private readonly provider;
543
+ constructor(args: GenericAnnounceAdapterArgs);
544
+ /** Baseline CIP-0103 capabilities every announced wallet must implement. */
545
+ getCapabilities(): CapabilityKey[];
546
+ /**
547
+ * The adapter is only ever constructed for a wallet that just announced, so
548
+ * its presence is established by the announce handshake itself.
549
+ */
550
+ detectInstalled(): Promise<AdapterDetectResult>;
551
+ connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
552
+ disconnect(): Promise<void>;
553
+ signMessage(_ctx: AdapterContext, _session: Session, params: SignMessageParams): Promise<SignedMessage>;
554
+ submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
555
+ }
556
+
414
557
  /**
415
558
  * Built-in wallet adapters
416
559
  *
@@ -529,4 +672,4 @@ declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
529
672
  */
530
673
  declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
531
674
 
532
- export { type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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 } 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
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';
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';
@@ -84,6 +84,19 @@ interface PartyLayerConfig {
84
84
  channel?: 'stable' | 'beta';
85
85
  /** Default network */
86
86
  network: NetworkId;
87
+ /**
88
+ * Network-mismatch enforcement policy (default: `'guard'`).
89
+ *
90
+ * When a connected wallet's effective network differs from `network`:
91
+ * - `'off'` — detect + emit `session:networkMismatch` only; never block.
92
+ * - `'guard'` — (default) block wrong-network TRANSACTIONS (signMessage,
93
+ * signTransaction, submitTransaction, ledgerApi); connect still succeeds.
94
+ * - `'strict'` — also block CONNECT (throws `NetworkMismatchError`).
95
+ *
96
+ * BEHAVIOR CHANGE: prior to this, wrong-network transactions always
97
+ * proceeded. Set `'off'` to restore that.
98
+ */
99
+ networkEnforcement?: 'off' | 'guard' | 'strict';
87
100
  /**
88
101
  * Wallet adapters to register (OPTIONAL)
89
102
  *
@@ -130,6 +143,28 @@ interface PartyLayerConfig {
130
143
  crypto?: CryptoAdapter;
131
144
  /** Registry public keys for signature verification (ed25519) */
132
145
  registryPublicKeys?: string[];
146
+ /**
147
+ * EIP-6963-style announce discovery — the canonical Canton provider contract
148
+ * (`canton:requestProvider` → `canton:announceProvider`, see provider.md).
149
+ *
150
+ * When enabled, `listWallets()` aggregates announced CIP-0103 wallets with
151
+ * the `window.canton` namespace scan, the registry, and registered adapters:
152
+ * - an announced id matching a registered/registry wallet's
153
+ * `providerDetection` (provider.id) maps to that adapter — NO duplicate
154
+ * picker entry (e.g. Console's announce `lpnf…` → the Console adapter);
155
+ * - an UNKNOWN announced id surfaces as a dynamic entry routed to its own
156
+ * extension `target` (collision-proof; future announce-capable wallets
157
+ * appear with zero code changes).
158
+ *
159
+ * Default ON in the browser; ALWAYS skipped under SSR (`typeof window` guard).
160
+ * With zero announcers, `listWallets()` output is byte-identical to before.
161
+ */
162
+ discovery?: {
163
+ /** Aggregate `canton:announceProvider` wallets. @default true (in browser) */
164
+ announce?: boolean;
165
+ /** Announce-collection window in ms. @default 300 (canonical ~300ms) */
166
+ announceTimeoutMs?: number;
167
+ };
133
168
  /**
134
169
  * Telemetry configuration or adapter
135
170
  *
@@ -232,6 +267,21 @@ interface SessionExpiredEvent {
232
267
  type: 'session:expired';
233
268
  sessionId: SessionId;
234
269
  }
270
+ /**
271
+ * Network mismatch event — the connected wallet's effective network differs
272
+ * from the dApp's configured network. Emitted under ALL policies (informational);
273
+ * `enforced` is true when the active policy ('guard' | 'strict') will block.
274
+ */
275
+ interface SessionNetworkMismatchEvent {
276
+ type: 'session:networkMismatch';
277
+ sessionId: SessionId;
278
+ /** dApp-configured (expected) network, CAIP-2 normalized. */
279
+ expected: string;
280
+ /** Wallet-reported (actual) network, CAIP-2 normalized. */
281
+ actual: string;
282
+ /** Whether the active policy will block (guard|strict) vs. detect-only (off). */
283
+ enforced: boolean;
284
+ }
235
285
  /**
236
286
  * Transaction status event
237
287
  */
@@ -252,7 +302,7 @@ interface ErrorEvent {
252
302
  /**
253
303
  * All event types
254
304
  */
255
- type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConnectedEvent | SessionDisconnectedEvent | SessionExpiredEvent | TxStatusEvent | ErrorEvent;
305
+ type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConnectedEvent | SessionDisconnectedEvent | SessionExpiredEvent | SessionNetworkMismatchEvent | TxStatusEvent | ErrorEvent;
256
306
  /**
257
307
  * Event handler type
258
308
  */
@@ -273,6 +323,8 @@ declare class PartyLayerClient {
273
323
  private crypto;
274
324
  private storage;
275
325
  private telemetry?;
326
+ /** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
327
+ private announceEntriesCache;
276
328
  private origin;
277
329
  constructor(config: PartyLayerConfig);
278
330
  /**
@@ -303,6 +355,44 @@ declare class PartyLayerClient {
303
355
  * List available wallets
304
356
  */
305
357
  listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
358
+ /**
359
+ * Whether announce discovery is active: explicit `discovery.announce`, else
360
+ * ON in the browser and OFF under SSR (no `window`). Canonical: provider.md.
361
+ */
362
+ private get announceEnabled();
363
+ /**
364
+ * Clear the cached announce round-trip so the next `listWallets()` re-runs the
365
+ * `canton:requestProvider` handshake (e.g. after a wallet is installed).
366
+ */
367
+ refreshDiscovery(): void;
368
+ /**
369
+ * Aggregate `canton:announceProvider` wallets into the picker list (A2).
370
+ *
371
+ * One-shot cached per client (refresh via {@link refreshDiscovery}); SSR-skipped.
372
+ * For each discovered provider (announce ∪ `window.canton` scan, deduped):
373
+ * - if its id matches a known wallet's `providerDetection` (provider.id) it
374
+ * IS that wallet — no new entry (identity bridge: Console's `lpnf…` → the
375
+ * `console` entry, Send's `ldmo…` → the `send` entry);
376
+ * - otherwise it is surfaced as a dynamic `browser:ext:<id>` entry routed to
377
+ * its own extension `target`, with a {@link GenericAnnounceAdapter}
378
+ * registered so a click connects through that target ONLY (no shared slot).
379
+ * With zero announcers this returns `base` unchanged.
380
+ */
381
+ private aggregateAnnouncedWallets;
382
+ /** Active network-enforcement policy (default 'guard'). */
383
+ private get enforcement();
384
+ /**
385
+ * Detect a confident network mismatch between the dApp's configured network
386
+ * and the session's (wallet-reported) network. Returns null when they match
387
+ * or the comparison isn't confident (conservative — never a false positive).
388
+ */
389
+ private networkMismatch;
390
+ /**
391
+ * Guard a transaction-class operation: throw `NetworkMismatchError` when the
392
+ * session is on the wrong network AND the policy enforces it ('guard' |
393
+ * 'strict'). Also protects restored sessions and mid-session network switches.
394
+ */
395
+ private assertNetworkOk;
306
396
  /**
307
397
  * Connect to a wallet
308
398
  */
@@ -411,6 +501,59 @@ declare class PartyLayerClient {
411
501
  */
412
502
  declare function createPartyLayer(config: PartyLayerConfig): PartyLayerClient;
413
503
 
504
+ /**
505
+ * Dynamic adapter for an announced CIP-0103 wallet that has no first-party
506
+ * PartyLayer adapter.
507
+ *
508
+ * Canonical contract (provider.md): after `canton:requestProvider`, wallets
509
+ * announce `{ id, name?, icon?, target? }`; "the SDK … registers one adapter
510
+ * per id with providerId `browser:ext:<id>`". This adapter is that registration
511
+ * for the UNKNOWN case — it delegates every call to a `CIP0103Provider` bound to
512
+ * the wallet's own extension `target` channel (built by
513
+ * `createExtensionChannelProvider({ target: announced.target ?? announced.id })`).
514
+ * Because the channel is target-scoped, a click on this entry can ONLY ever
515
+ * reach the wallet that announced it — never a shared `window.canton` slot or
516
+ * another wallet (the A2 collision guarantee), and future announce-capable
517
+ * Canton wallets light up with zero code changes.
518
+ *
519
+ * KNOWN wallets (Console, Send, …) never use this class — the SDK's identity
520
+ * bridge maps their announce id to their existing adapter via `providerDetection`.
521
+ */
522
+
523
+ /** Canonical providerId prefix for an announced extension (provider.md: `browser:ext:<id>`). */
524
+ declare const ANNOUNCED_WALLET_ID_PREFIX = "browser:ext:";
525
+ /** Build the canonical SDK walletId for an announced extension id. */
526
+ declare function announcedWalletId(announceId: string): WalletId;
527
+ interface GenericAnnounceAdapterArgs {
528
+ /** The announced extension id (== announce `detail.id`). */
529
+ announceId: string;
530
+ /** Display name from the announce detail (falls back to a derived label). */
531
+ name?: string;
532
+ /** Icon (data: URI or URL) from the announce detail. */
533
+ icon?: string;
534
+ /** Target-scoped CIP-0103 provider built from the announce (the discovery result). */
535
+ provider: CIP0103Provider;
536
+ }
537
+ declare class GenericAnnounceAdapter implements WalletAdapter {
538
+ readonly walletId: WalletId;
539
+ readonly name: string;
540
+ /** Icon surfaced to the picker (announce detail). */
541
+ readonly icon?: string;
542
+ private readonly provider;
543
+ constructor(args: GenericAnnounceAdapterArgs);
544
+ /** Baseline CIP-0103 capabilities every announced wallet must implement. */
545
+ getCapabilities(): CapabilityKey[];
546
+ /**
547
+ * The adapter is only ever constructed for a wallet that just announced, so
548
+ * its presence is established by the announce handshake itself.
549
+ */
550
+ detectInstalled(): Promise<AdapterDetectResult>;
551
+ connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
552
+ disconnect(): Promise<void>;
553
+ signMessage(_ctx: AdapterContext, _session: Session, params: SignMessageParams): Promise<SignedMessage>;
554
+ submitTransaction(_ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
555
+ }
556
+
414
557
  /**
415
558
  * Built-in wallet adapters
416
559
  *
@@ -529,4 +672,4 @@ declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
529
672
  */
530
673
  declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
531
674
 
532
- export { type AdapterClass, PartyLayerClient as CantonConnectClient, type PartyLayerConfig as CantonConnectConfig, type PartyLayerEvent as CantonConnectEvent, type ConnectOptions, DEFAULT_REGISTRY_URL, type ErrorEvent, type EventHandler, MetricsTelemetryAdapter, PartyLayerClient, type PartyLayerConfig, type PartyLayerEvent, type RegistryUpdatedEvent, type SessionConnectedEvent, type SessionDisconnectedEvent, type SessionExpiredEvent, type TelemetryConfig, type TxStatusEvent, type WalletFilter, PartyLayerClient as _PartyLayerClientInternal, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
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 };