@partylayer/sdk 0.18.2 → 0.20.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/README.md +70 -226
- package/dist/index.d.mts +132 -91
- package/dist/index.d.ts +132 -91
- package/dist/index.js +1232 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1227 -151
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as _partylayer_core from '@partylayer/core';
|
|
2
|
-
import { WalletAdapter, NetworkId, OfficialProviderAdapter, OfficialAdapterFactory, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult, NetworkHosts, PersistedSession } from '@partylayer/core';
|
|
3
|
-
export { AdapterConnectResult, AdapterContext, AdapterDetectResult, AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkHosts, NetworkId, OfficialAdapterFactory, 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, isOfficialAdapterFactory, isOfficialProviderAdapter } from '@partylayer/core';
|
|
2
|
+
import { WalletAdapter, NetworkId, OfficialProviderAdapter, OfficialAdapterFactory, StorageAdapter, CryptoAdapter, TelemetryAdapter, LoggerAdapter, WalletId, Session, SessionId, TransactionHash, TransactionStatus, WalletInfo, SignMessageParams, SignedMessage, SignTransactionParams, SignedTransaction, SubmitTransactionParams, TxReceipt, LedgerApiParams, LedgerApiResult, TransferIntent, TransferResult, CIP0103Provider, CapabilityKey, AdapterDetectResult, AdapterContext, AdapterConnectResult, NetworkHosts, PersistedSession } from '@partylayer/core';
|
|
3
|
+
export { AdapterConnectResult, AdapterContext, AdapterDetectResult, AdapterNotRegisteredError, PartyLayerError as CantonConnectError, CapabilityKey, CapabilityNotSupportedError, ENABLEMENT_METRICS, ERROR_METRICS, ErrorCode, InternalError, LedgerApiParams, LedgerApiResult, METRICS, MetricName, MetricsPayload, NetworkHosts, NetworkId, OfficialAdapterFactory, OfficialProviderAdapter, OriginNotAllowedError, PartyId, PartyLayerError, REGISTRY_METRICS, RegistryFetchFailedError, RegistrySchemaInvalidError, RegistryVerificationFailedError, Session, SessionExpiredError, SessionId, SignMessageParams, SignTransactionParams, SignedMessage, SignedTransaction, SubmitTransactionParams, TRANSFER_INTENT_FIELDS, TimeoutError, TokenInstrumentId, TransactionStatus, TransferIntent, TransferResult, TransportError, TxReceipt, UserRejectedError, WalletAdapter, WalletId, WalletInfo, WalletNotFoundError, WalletNotInstalledError, errorMetricName, isOfficialAdapterFactory, isOfficialProviderAdapter, toTransferIntent } 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
|
+
import { BronAdapterConfig } from '@partylayer/adapter-bron';
|
|
7
7
|
export { BronAdapter, BronAdapterConfig, BronApiConfig, BronAuthConfig } from '@partylayer/adapter-bron';
|
|
8
|
+
import { WalletConnectAdapterConfig } from '@partylayer/adapter-walletconnect';
|
|
9
|
+
export { WalletConnectAdapterConfig } from '@partylayer/adapter-walletconnect';
|
|
10
|
+
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';
|
|
8
11
|
export { Cantor8Adapter } from '@partylayer/adapter-cantor8';
|
|
9
12
|
export { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
10
13
|
export { LoopAdapter } from '@partylayer/adapter-loop';
|
|
@@ -75,6 +78,12 @@ type AdapterClass = new () => WalletAdapter;
|
|
|
75
78
|
* PartyLayer configuration
|
|
76
79
|
*/
|
|
77
80
|
interface PartyLayerConfig {
|
|
81
|
+
/**
|
|
82
|
+
* Delay browser subscriptions and automatic restoration until initialize()
|
|
83
|
+
* or the first explicit client action. Frameworks use this for render safety.
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
deferInitialization?: boolean;
|
|
78
87
|
/**
|
|
79
88
|
* Registry base URL (optional). The client appends `/v1/{channel}/registry.json`,
|
|
80
89
|
* so the default fetch is `https://registry.partylayer.xyz/v1/stable/registry.json`.
|
|
@@ -99,47 +108,17 @@ interface PartyLayerConfig {
|
|
|
99
108
|
*/
|
|
100
109
|
networkEnforcement?: 'off' | 'guard' | 'strict';
|
|
101
110
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* - LoopAdapter (5N Loop - QR code / popup)
|
|
106
|
-
* - Cantor8Adapter (Cantor8 - deep link transport)
|
|
107
|
-
* - NightlyAdapter (Nightly - injected extension)
|
|
108
|
-
*
|
|
109
|
-
* Console and Send are NOT in the defaults; they are CIP-0103 native and appear
|
|
110
|
-
* through the announce path. BronAdapter (hosted OAuth) and the WalletConnect
|
|
111
|
-
* adapter require configuration and are opt-in.
|
|
112
|
-
*
|
|
113
|
-
* Only provide this if you want to customize which adapters to use.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* // Default: the no-config built-in adapters (recommended)
|
|
118
|
-
* const client = createPartyLayer({
|
|
119
|
-
* network: 'devnet',
|
|
120
|
-
* app: { name: 'My dApp' },
|
|
121
|
-
* // adapters not specified = getBuiltinAdapters() = Loop, Cantor8, Nightly
|
|
122
|
-
* });
|
|
123
|
-
*
|
|
124
|
-
* // Custom: only specific adapters
|
|
125
|
-
* import { ConsoleAdapter } from '@partylayer/sdk';
|
|
126
|
-
* const client = createPartyLayer({
|
|
127
|
-
* adapters: [new ConsoleAdapter()], // Only Console Wallet
|
|
128
|
-
* // ...
|
|
129
|
-
* });
|
|
130
|
-
*
|
|
131
|
-
* // With Bron (enterprise wallet with OAuth)
|
|
132
|
-
* import { BronAdapter, getBuiltinAdapters } from '@partylayer/sdk';
|
|
133
|
-
* const client = createPartyLayer({
|
|
134
|
-
* adapters: [
|
|
135
|
-
* ...getBuiltinAdapters(),
|
|
136
|
-
* new BronAdapter({ auth: {...}, api: {...} }),
|
|
137
|
-
* ],
|
|
138
|
-
* // ...
|
|
139
|
-
* });
|
|
140
|
-
* ```
|
|
111
|
+
* Replace the default wallet catalog. Omit for all supported wallets on the
|
|
112
|
+
* configured network/channel. Official wallet SDKs are included and loaded
|
|
113
|
+
* lazily; no per-wallet installation or registration is required.
|
|
141
114
|
*/
|
|
142
115
|
adapters?: (WalletAdapter | AdapterClass | OfficialProviderAdapter | OfficialAdapterFactory)[];
|
|
116
|
+
/** Extend the default catalog with custom adapters (for example a test wallet). */
|
|
117
|
+
additionalAdapters?: PartyLayerConfig['adapters'];
|
|
118
|
+
/** Enable WalletConnect with your application's Cloud project id. */
|
|
119
|
+
walletConnect?: WalletConnectAdapterConfig;
|
|
120
|
+
/** Enable the Bron remote signer with your application's OAuth/API configuration. */
|
|
121
|
+
bron?: BronAdapterConfig;
|
|
143
122
|
/** Storage adapter (default: browser localStorage-based encrypted) */
|
|
144
123
|
storage?: StorageAdapter;
|
|
145
124
|
/** Crypto adapter (default: WebCrypto) */
|
|
@@ -298,7 +277,14 @@ interface SessionNetworkMismatchEvent {
|
|
|
298
277
|
interface TxStatusEvent {
|
|
299
278
|
type: 'tx:status';
|
|
300
279
|
sessionId: SessionId;
|
|
301
|
-
|
|
280
|
+
/**
|
|
281
|
+
* The transaction id, when the wallet reported one. Optional for the same
|
|
282
|
+
* reason as `TxReceipt.transactionHash`, which is where it comes from: a
|
|
283
|
+
* wallet with no hash to give produces an event with no id, and saying so
|
|
284
|
+
* beats emitting an invented one. Prefer reading `updateId` off the receipt
|
|
285
|
+
* when you need a ledger identifier.
|
|
286
|
+
*/
|
|
287
|
+
txId?: TransactionHash;
|
|
302
288
|
status: TransactionStatus;
|
|
303
289
|
raw?: unknown;
|
|
304
290
|
}
|
|
@@ -333,14 +319,13 @@ type PartyLayerEvent = RegistryUpdatedEvent | RegistryStatusEvent | SessionConne
|
|
|
333
319
|
*/
|
|
334
320
|
type EventHandler<T extends PartyLayerEvent = PartyLayerEvent> = (event: T) => void | Promise<void>;
|
|
335
321
|
|
|
336
|
-
/**
|
|
337
|
-
* PartyLayer Client
|
|
338
|
-
*
|
|
339
|
-
* Main client interface for dApps to interact with Canton wallets.
|
|
340
|
-
*/
|
|
341
322
|
declare class PartyLayerClient {
|
|
342
323
|
private config;
|
|
343
324
|
private adapters;
|
|
325
|
+
private destroyed;
|
|
326
|
+
private initialized;
|
|
327
|
+
private readonly defaultLoads;
|
|
328
|
+
private readonly registryDefaultIds;
|
|
344
329
|
/**
|
|
345
330
|
* Pre-resolved connect plans for popup/remote (GenericDiscoveryAdapter)
|
|
346
331
|
* wallets, warmed on `listWallets()` (which the modal calls on open) so a
|
|
@@ -350,6 +335,11 @@ declare class PartyLayerClient {
|
|
|
350
335
|
private readonly warmPlans;
|
|
351
336
|
private eventHandlers;
|
|
352
337
|
private activeSession;
|
|
338
|
+
private sessionRevision;
|
|
339
|
+
private connectionAttempt;
|
|
340
|
+
private restoreTask;
|
|
341
|
+
private restorationBlocked;
|
|
342
|
+
private sessionStorageQueue;
|
|
353
343
|
/**
|
|
354
344
|
* True when `activeSession` was revived AS-IS (no live `status()` probe) because
|
|
355
345
|
* its adapter wasn't registered yet at restore time (the lazy configured-announce
|
|
@@ -367,11 +357,17 @@ declare class PartyLayerClient {
|
|
|
367
357
|
/** Cached announce-discovery picker entries (one-shot; cleared by refreshDiscovery). */
|
|
368
358
|
private announceEntriesCache;
|
|
369
359
|
private readonly announceRegistry;
|
|
360
|
+
private readonly announceChannels;
|
|
370
361
|
private announceUnsubscribe;
|
|
371
362
|
/** Pending debounced `wallets:changed` emit (coalesces an announce burst). */
|
|
372
363
|
private walletsChangedTimer;
|
|
373
364
|
private origin;
|
|
365
|
+
private readonly nativeOwner?;
|
|
366
|
+
private sessionProvider?;
|
|
374
367
|
constructor(config: PartyLayerConfig);
|
|
368
|
+
/** Start browser discovery/restoration once; safe for framework effect replay. */
|
|
369
|
+
initialize(): void;
|
|
370
|
+
private announceChannel;
|
|
375
371
|
/**
|
|
376
372
|
* Register a wallet adapter
|
|
377
373
|
*
|
|
@@ -380,6 +376,7 @@ declare class PartyLayerClient {
|
|
|
380
376
|
* In production, adapters would be auto-registered via registry.
|
|
381
377
|
*/
|
|
382
378
|
registerAdapter(adapter: WalletAdapter): void;
|
|
379
|
+
private onNativeIdentityChanged;
|
|
383
380
|
/**
|
|
384
381
|
* Look up a registered adapter by wallet id.
|
|
385
382
|
*
|
|
@@ -400,6 +397,8 @@ declare class PartyLayerClient {
|
|
|
400
397
|
* List available wallets
|
|
401
398
|
*/
|
|
402
399
|
listWallets(filter?: WalletFilter): Promise<WalletInfo[]>;
|
|
400
|
+
/** Resolve only reviewed default SDKs present in the active registry. */
|
|
401
|
+
private ensureDefaultWallets;
|
|
403
402
|
/**
|
|
404
403
|
* Hide registry entries whose wallet needs an app-registered adapter that is
|
|
405
404
|
* NOT registered. This is the library default (RainbowKit-style): never show a
|
|
@@ -548,6 +547,20 @@ declare class PartyLayerClient {
|
|
|
548
547
|
* Proxy a JSON Ledger API request through the active wallet adapter
|
|
549
548
|
*/
|
|
550
549
|
ledgerApi(params: LedgerApiParams): Promise<LedgerApiResult>;
|
|
550
|
+
/**
|
|
551
|
+
* Request a typed transfer. The application says what it wants; the wallet
|
|
552
|
+
* builds the command, shows the user what they are authorising, obtains their
|
|
553
|
+
* approval, signs, executes, and returns the real update id.
|
|
554
|
+
*
|
|
555
|
+
* The acting party comes from the active session, never from the caller, and
|
|
556
|
+
* the intent is narrowed to the allowlisted fields before any adapter sees it,
|
|
557
|
+
* so no caller-supplied option can reach the wallet.
|
|
558
|
+
*
|
|
559
|
+
* Throws `CapabilityNotSupportedError` when the active wallet does not
|
|
560
|
+
* implement it. Ask first with `session.capabilitiesSnapshot.includes('transfer')`,
|
|
561
|
+
* or require it at connect with `connect({ requiredCapabilities: ['transfer'] })`.
|
|
562
|
+
*/
|
|
563
|
+
requestTransfer(intent: TransferIntent): Promise<TransferResult>;
|
|
551
564
|
/**
|
|
552
565
|
* Subscribe to events
|
|
553
566
|
*/
|
|
@@ -557,20 +570,16 @@ declare class PartyLayerClient {
|
|
|
557
570
|
*/
|
|
558
571
|
off<T extends PartyLayerEvent>(event: T['type'], handler: EventHandler<T>): void;
|
|
559
572
|
/**
|
|
560
|
-
* Get
|
|
561
|
-
*
|
|
562
|
-
* This bridge routes all request() calls through the existing
|
|
563
|
-
* PartyLayerClient methods and maps events to CIP-0103 format.
|
|
564
|
-
*
|
|
565
|
-
* The bridge implements the full CIP-0103 specification:
|
|
566
|
-
* - All 10 mandatory methods including `ledgerApi` (when adapter supports it)
|
|
567
|
-
* - Full transaction lifecycle: pending -> signed -> executed/failed
|
|
568
|
-
* - All CIP-0103 events: statusChanged, accountsChanged, txChanged, connected
|
|
573
|
+
* Get the stable provider facade for this client.
|
|
569
574
|
*
|
|
570
|
-
*
|
|
571
|
-
*
|
|
575
|
+
* Browser-native connections expose the official owner's actual accounts,
|
|
576
|
+
* network, execution/events and raw Ledger API response, including standard
|
|
577
|
+
* path/query/header request fields. Signing keeps the reviewed encoding policy.
|
|
578
|
+
* Existing proprietary/custom integrations retain their compatibility bridge.
|
|
579
|
+
* `createProviderBridge(client)` remains available explicitly for legacy callers.
|
|
580
|
+
* Full async server user-URL orchestration needs a verified direct provider path.
|
|
572
581
|
*
|
|
573
|
-
* @returns CIP-0103
|
|
582
|
+
* @returns Stable CIP-0103 provider facade
|
|
574
583
|
*/
|
|
575
584
|
asProvider(): _partylayer_core.CIP0103Provider;
|
|
576
585
|
/**
|
|
@@ -596,6 +605,7 @@ declare class PartyLayerClient {
|
|
|
596
605
|
* Restore session from storage
|
|
597
606
|
*/
|
|
598
607
|
private restoreSession;
|
|
608
|
+
private restoreSessionOnce;
|
|
599
609
|
/**
|
|
600
610
|
* Update registry status and emit event
|
|
601
611
|
*/
|
|
@@ -739,16 +749,24 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
|
|
|
739
749
|
readonly name: string;
|
|
740
750
|
/** Icon surfaced to the picker (announce detail). */
|
|
741
751
|
readonly icon?: string;
|
|
742
|
-
private readonly
|
|
752
|
+
private readonly rawProvider;
|
|
743
753
|
private readonly metadataEnabled;
|
|
744
754
|
private readonly staticMetadata?;
|
|
745
755
|
private readonly mapError?;
|
|
746
756
|
private readonly signMessageBase64;
|
|
757
|
+
/**
|
|
758
|
+
* Which execute verb this wallet turned out to support. Resolved on the first
|
|
759
|
+
* submit and reused, so the wallet is asked at most once.
|
|
760
|
+
*/
|
|
761
|
+
private readonly executeVerb;
|
|
747
762
|
restore?: WalletAdapter['restore'];
|
|
748
763
|
on?: WalletAdapter['on'];
|
|
749
764
|
ledgerApi?: WalletAdapter['ledgerApi'];
|
|
750
765
|
signMessage?: WalletAdapter['signMessage'];
|
|
751
766
|
constructor(args: GenericAnnounceAdapterArgs);
|
|
767
|
+
private get provider();
|
|
768
|
+
/** @internal Register the discovered transport with the one official owner. */
|
|
769
|
+
prepareNativeConnection(network: NetworkId): Promise<void>;
|
|
752
770
|
/**
|
|
753
771
|
* Capabilities derived from actual presence: connect and submitTransaction are
|
|
754
772
|
* always present; signMessage, restore, ledgerApi, and events are each included
|
|
@@ -761,10 +779,12 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
|
|
|
761
779
|
* its presence is established by the announce handshake itself.
|
|
762
780
|
*/
|
|
763
781
|
detectInstalled(): Promise<AdapterDetectResult>;
|
|
764
|
-
connect(ctx: AdapterContext
|
|
782
|
+
connect(ctx: AdapterContext, options?: {
|
|
783
|
+
signal?: AbortSignal;
|
|
784
|
+
}): Promise<AdapterConnectResult>;
|
|
765
785
|
disconnect(): Promise<void>;
|
|
766
786
|
private signMessageImpl;
|
|
767
|
-
submitTransaction(
|
|
787
|
+
submitTransaction(ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
|
|
768
788
|
/** events: bridge the provider's CIP-0103 `txChanged` push event → `txStatus`. */
|
|
769
789
|
private makeOn;
|
|
770
790
|
/** restore: silent status()/getPrimaryAccount() probe + expiry + party-match. */
|
|
@@ -806,8 +826,8 @@ declare class GenericAnnounceAdapter implements WalletAdapter {
|
|
|
806
826
|
* Session restore forwards to the official adapter's own `restore` (see {@link
|
|
807
827
|
* GenericDiscoveryAdapter.restore}): on reload the wallet reinstates its session, typically
|
|
808
828
|
* from its own storage, and the bridge adopts the returned live provider, so the first
|
|
809
|
-
* request after reload works.
|
|
810
|
-
*
|
|
829
|
+
* request after reload works. A silent primary-account probe validates the persisted party;
|
|
830
|
+
* an expired or unavailable provider requires reconnection.
|
|
811
831
|
*
|
|
812
832
|
* Eventless note: the official provider exposes `on`/`emit`/`removeListener`
|
|
813
833
|
* but popup/remote wallets typically never emit, so `getCapabilities()` NEVER
|
|
@@ -821,6 +841,8 @@ interface GenericDiscoveryAdapterArgs {
|
|
|
821
841
|
* `networkHosts` are ignored. Mutually exclusive with `factory`.
|
|
822
842
|
*/
|
|
823
843
|
official?: OfficialProviderAdapter;
|
|
844
|
+
/** Declared registry capabilities; only methods implemented by this bridge are exposed. */
|
|
845
|
+
capabilities?: Partial<Record<CapabilityKey, boolean>>;
|
|
824
846
|
/**
|
|
825
847
|
* Factory form: `create(host)` constructs the official adapter with a host
|
|
826
848
|
* resolved from `networkHosts[activeNetwork]` at connect time. Needed because
|
|
@@ -847,6 +869,8 @@ interface GenericDiscoveryAdapterArgs {
|
|
|
847
869
|
/** Icon override (falls back to the official adapter's / factory's icon). */
|
|
848
870
|
icon?: string;
|
|
849
871
|
}
|
|
872
|
+
/** The generic bridge's implemented methods, constrained by registry declarations. */
|
|
873
|
+
declare function getDiscoveryCapabilities(declared?: Partial<Record<CapabilityKey, boolean>>): CapabilityKey[];
|
|
850
874
|
declare class GenericDiscoveryAdapter implements WalletAdapter {
|
|
851
875
|
readonly walletId: WalletId;
|
|
852
876
|
readonly name: string;
|
|
@@ -863,6 +887,13 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
|
|
|
863
887
|
private networkHosts;
|
|
864
888
|
/** Lazily resolved from `official.provider()` — NOT at construction (SSR-safe). */
|
|
865
889
|
private providerInstance;
|
|
890
|
+
/**
|
|
891
|
+
* Which execute verb this wallet turned out to support. Resolved on the first
|
|
892
|
+
* submit and reused, so the wallet is asked at most once.
|
|
893
|
+
*/
|
|
894
|
+
private readonly executeVerb;
|
|
895
|
+
private readonly capabilities;
|
|
896
|
+
readonly ledgerApi?: WalletAdapter['ledgerApi'];
|
|
866
897
|
constructor(args: GenericDiscoveryAdapterArgs);
|
|
867
898
|
/** Whether this bridge resolves its host from `networkHosts` (factory form). */
|
|
868
899
|
usesFactory(): boolean;
|
|
@@ -882,41 +913,50 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
|
|
|
882
913
|
* no host for `network` in `networkHosts` throws, naming the network.
|
|
883
914
|
*/
|
|
884
915
|
resolveOfficial(network: NetworkId): void;
|
|
916
|
+
/** @internal Prepare the official owner before a popup-opening click. */
|
|
917
|
+
prepareNativeConnection(network: NetworkId): Promise<void>;
|
|
885
918
|
/** Lazily obtain (and cache) the official provider — deferred off the init/SSR path.
|
|
886
919
|
* `official.provider()` is typed `OfficialProvider` (loose `request` so real
|
|
887
920
|
* official adapters are assignable); it is call-compatible with CIP0103Provider
|
|
888
921
|
* (the bridge only ever calls `request({ method, params })`). */
|
|
889
922
|
private get provider();
|
|
890
|
-
/**
|
|
891
|
-
* Baseline CIP-0103 capabilities. NEVER includes `'events'`: popup/remote
|
|
892
|
-
* wallets expose the event surface but do not emit (truthfulness doctrine).
|
|
893
|
-
*/
|
|
923
|
+
/** Implemented, registry-declared capabilities; popup event listeners are never claimed. */
|
|
894
924
|
getCapabilities(): CapabilityKey[];
|
|
895
|
-
/** Install/availability probe — delegated to the official adapter (popup-free). */
|
|
896
|
-
detectInstalled(): Promise<AdapterDetectResult>;
|
|
897
|
-
connect(ctx: AdapterContext): Promise<AdapterConnectResult>;
|
|
898
925
|
/**
|
|
899
|
-
*
|
|
926
|
+
* THE SINGLE PLACE THE discovery-adapter RULE IS APPLIED.
|
|
900
927
|
*
|
|
901
|
-
*
|
|
902
|
-
*
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* official `restore` and, when it yields a provider, adopts it as the cached provider so
|
|
907
|
-
* the very next request uses the restored session.
|
|
928
|
+
* **A `discovery-adapter` transport implies there is no local install.** Every
|
|
929
|
+
* wallet on that transport is a hosted popup or remote gateway reached with
|
|
930
|
+
* `window.open` — Walley, Cauri and OneSwap today. There is no extension, no
|
|
931
|
+
* injected global, nothing on the machine to probe. The honest answer is
|
|
932
|
+
* `no-local-install`, and it follows from the registry entry alone.
|
|
908
933
|
*
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
*
|
|
934
|
+
* SO THE VENDOR'S `detect()` IS NOT CALLED, and reinstating that call would be
|
|
935
|
+
* a regression however much it looks like rigour. Read from their shipped
|
|
936
|
+
* source, all three are constants:
|
|
937
|
+
*
|
|
938
|
+
* walley: typeof window < "u" && typeof window.open == "function"
|
|
939
|
+
* cauri: Promise.resolve(true)
|
|
940
|
+
* oneswap: typeof window !== 'undefined'
|
|
941
|
+
*
|
|
942
|
+
* Each returns true in any browser. Awaiting them bought a value carrying no
|
|
943
|
+
* information, at the cost of an async hop on the picker's render path and a
|
|
944
|
+
* dependency on three third parties independently choosing to answer
|
|
945
|
+
* honestly. The registry already knows, it is signed, and it cannot drift.
|
|
946
|
+
*
|
|
947
|
+
* `installed: false` is deliberate and is NOT "not available": there is no
|
|
948
|
+
* local install, so the only truthful value for a field that asks about one
|
|
949
|
+
* is false. A picker must read `availability`, which says why.
|
|
915
950
|
*/
|
|
951
|
+
detectInstalled(): Promise<AdapterDetectResult>;
|
|
952
|
+
connect(ctx: AdapterContext, options?: {
|
|
953
|
+
signal?: AbortSignal;
|
|
954
|
+
}): Promise<AdapterConnectResult>;
|
|
955
|
+
/** Restore silently and validate the live party before exposing a connected session. */
|
|
916
956
|
restore(ctx: AdapterContext, persisted: PersistedSession): Promise<Session | null>;
|
|
917
957
|
disconnect(): Promise<void>;
|
|
918
|
-
signMessage(_ctx: AdapterContext,
|
|
919
|
-
submitTransaction(
|
|
958
|
+
signMessage(_ctx: AdapterContext, session: Session, params: SignMessageParams): Promise<SignedMessage>;
|
|
959
|
+
submitTransaction(ctx: AdapterContext, _session: Session, params: SubmitTransactionParams): Promise<TxReceipt>;
|
|
920
960
|
}
|
|
921
961
|
|
|
922
962
|
/**
|
|
@@ -929,7 +969,8 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
|
|
|
929
969
|
/**
|
|
930
970
|
* Get all built-in adapters
|
|
931
971
|
*
|
|
932
|
-
* This function returns
|
|
972
|
+
* This synchronous function returns the legacy, configuration-free adapters.
|
|
973
|
+
* The full default catalog also includes official SDKs loaded during discovery.
|
|
933
974
|
* Called automatically by createPartyLayer() unless custom adapters are provided.
|
|
934
975
|
*
|
|
935
976
|
* Included adapters (returned by this function):
|
|
@@ -944,7 +985,7 @@ declare class GenericDiscoveryAdapter implements WalletAdapter {
|
|
|
944
985
|
* - SendAdapter: Send Canton Wallet (passkey / WebAuthn-PRF).
|
|
945
986
|
*
|
|
946
987
|
* Note: BronAdapter is NOT included by default because it requires OAuth configuration.
|
|
947
|
-
* To use Bron,
|
|
988
|
+
* To use Bron with the full default catalog, set config.bron; no separate install is needed.
|
|
948
989
|
*/
|
|
949
990
|
declare function getBuiltinAdapters(): WalletAdapter[];
|
|
950
991
|
|
|
@@ -1035,4 +1076,4 @@ declare function isTelemetryConfig(value: unknown): value is TelemetryConfig;
|
|
|
1035
1076
|
*/
|
|
1036
1077
|
declare function createTelemetryAdapter(config: TelemetryAdapter | TelemetryConfig | undefined): TelemetryAdapter | undefined;
|
|
1037
1078
|
|
|
1038
|
-
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, type WalletsChangedEvent, PartyLayerClient as _PartyLayerClientInternal, announcedWalletId, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, isTelemetryConfig };
|
|
1079
|
+
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, type WalletsChangedEvent, PartyLayerClient as _PartyLayerClientInternal, announcedWalletId, createPartyLayer as createCantonConnect, createPartyLayer, createTelemetryAdapter, getBuiltinAdapters, getDiscoveryCapabilities, isTelemetryConfig };
|