@fairmint/canton-node-sdk 0.0.290 → 0.0.292

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.
Files changed (57) hide show
  1. package/README.md +51 -0
  2. package/build/src/wallets/abort.d.ts +13 -0
  3. package/build/src/wallets/abort.d.ts.map +1 -1
  4. package/build/src/wallets/abort.js +66 -0
  5. package/build/src/wallets/abort.js.map +1 -1
  6. package/build/src/wallets/connector.d.ts +181 -0
  7. package/build/src/wallets/connector.d.ts.map +1 -0
  8. package/build/src/wallets/connector.js +686 -0
  9. package/build/src/wallets/connector.js.map +1 -0
  10. package/build/src/wallets/da-utilities/client.d.ts +10 -0
  11. package/build/src/wallets/da-utilities/client.d.ts.map +1 -1
  12. package/build/src/wallets/da-utilities/client.js +41 -13
  13. package/build/src/wallets/da-utilities/client.js.map +1 -1
  14. package/build/src/wallets/errors.d.ts +40 -5
  15. package/build/src/wallets/errors.d.ts.map +1 -1
  16. package/build/src/wallets/errors.js +79 -2
  17. package/build/src/wallets/errors.js.map +1 -1
  18. package/build/src/wallets/format.d.ts +54 -0
  19. package/build/src/wallets/format.d.ts.map +1 -0
  20. package/build/src/wallets/format.js +57 -0
  21. package/build/src/wallets/format.js.map +1 -0
  22. package/build/src/wallets/index.d.ts +15 -4
  23. package/build/src/wallets/index.d.ts.map +1 -1
  24. package/build/src/wallets/index.js +34 -1
  25. package/build/src/wallets/index.js.map +1 -1
  26. package/build/src/wallets/latch.d.ts +70 -0
  27. package/build/src/wallets/latch.d.ts.map +1 -0
  28. package/build/src/wallets/latch.js +100 -0
  29. package/build/src/wallets/latch.js.map +1 -0
  30. package/build/src/wallets/loop.d.ts +36 -0
  31. package/build/src/wallets/loop.d.ts.map +1 -0
  32. package/build/src/wallets/loop.js +59 -0
  33. package/build/src/wallets/loop.js.map +1 -0
  34. package/build/src/wallets/options.d.ts +76 -0
  35. package/build/src/wallets/options.d.ts.map +1 -0
  36. package/build/src/wallets/options.js +21 -0
  37. package/build/src/wallets/options.js.map +1 -0
  38. package/build/src/wallets/ownership.d.ts.map +1 -1
  39. package/build/src/wallets/ownership.js +2 -5
  40. package/build/src/wallets/ownership.js.map +1 -1
  41. package/build/src/wallets/sign-message.d.ts +43 -0
  42. package/build/src/wallets/sign-message.d.ts.map +1 -0
  43. package/build/src/wallets/sign-message.js +56 -0
  44. package/build/src/wallets/sign-message.js.map +1 -0
  45. package/build/src/wallets/storage.d.ts +17 -0
  46. package/build/src/wallets/storage.d.ts.map +1 -0
  47. package/build/src/wallets/storage.js +55 -0
  48. package/build/src/wallets/storage.js.map +1 -0
  49. package/build/src/wallets/store.d.ts +74 -4
  50. package/build/src/wallets/store.d.ts.map +1 -1
  51. package/build/src/wallets/store.js +174 -33
  52. package/build/src/wallets/store.js.map +1 -1
  53. package/build/src/wallets/tokens.d.ts +48 -11
  54. package/build/src/wallets/tokens.d.ts.map +1 -1
  55. package/build/src/wallets/tokens.js +35 -14
  56. package/build/src/wallets/tokens.js.map +1 -1
  57. package/package.json +1 -1
package/README.md CHANGED
@@ -236,6 +236,57 @@ if (plan !== null && confirm(plan.description)) await store.act({ type: 'submitT
236
236
  - Wallet discovery follows the Canton dApp SDK's announce handshake; a CIP that standardizes
237
237
  discovery is still a draft, so `discoverCip103Wallets` will follow it once it settles.
238
238
 
239
+ ### Connecting a wallet: options, the connector and the write latch
240
+
241
+ A page that offers several wallets uses `createWalletConnector` instead of wiring the session
242
+ itself. It owns the network's session and store, restores the wallet remembered from an earlier
243
+ visit, and remembers the user's choice. Like the store it is a framework-free observable
244
+ (`subscribe`, `getSnapshot`), and its snapshot carries codes (`status`, `error.code`,
245
+ `availability.reason`), never sentences: the page words them.
246
+
247
+ - Options. A `LoadedWalletOption` loads its CIP-0103 provider on demand:
248
+ `loopWalletOption({ appName, load })` (the app passes Loop's dynamic import; node-sdk does not
249
+ depend on Loop) and `extensionWalletOptions()` (the installed extensions, keyed `extension:<id>`).
250
+ Loop serves one network per page load, so after it is set up its availability on the other network
251
+ is `reload-required`. A `LiveWalletOption` is one the app builds through its own setup UI (Privy's
252
+ session in `@fairmint/canton-privy-sdk` offers one): it offers a provider once set up, and a new
253
+ one whenever its setup changes.
254
+ - `connector.connect(key)` is the user's click. A provider loaded beforehand with
255
+ `connector.preload()` is connected synchronously inside the click, which Loop's sign-in window
256
+ needs. A live option without a provider yet answers `preparing` and connects once it offers one; a
257
+ rebuilt provider for the same party shows `reconnecting` with the held connection (`stale`), so
258
+ the page stays mounted. `select(key)` opens a live option's setup UI, and survives a login
259
+ redirect in the same tab. `cancel()` and `disconnect()` end what is in flight.
260
+ - Restore. On creation the connector reads `${storageKey}.wallet` (local storage) and restores that
261
+ wallet silently, giving up after `restoreTimeoutMs` (15 s) and forgetting it then or on
262
+ `cancel()`. A retired restore never connects late and never disconnects anything. Storage defaults
263
+ to the page's `localStorage` and `sessionStorage`; either may be missing or throw.
264
+ - One write at a time. `createWriteLatch()` is a single-flight latch the store,
265
+ `store.run(label, fn)` (a write that is not a store action) and the app's other writers share. A
266
+ run starts synchronously, so a double click is refused; `bump()` (every wallet change) aborts the
267
+ runs in flight, which then report `dropped`, or `unknown-outcome` once they called
268
+ `markSubmitted()`. The view says why it is busy (`busyReason`: `action`, `run` or `load`, and
269
+ `busyLabel`).
270
+ - `readOnly` (or `store.setReadOnly(reason)`) closes the app's write gate: writes are refused, reads
271
+ run, and `actionState` reports `read-only`. `view.shown` is what to render: `state`, or the last
272
+ snapshot of the same `retainKey` while a reload or reconnect runs (`view.stale`).
273
+
274
+ ```ts
275
+ const loop = loopWalletOption({
276
+ appName: 'My dApp',
277
+ load: async () => (await import('@fivenorth/loop-sdk')).loop,
278
+ });
279
+ const connector = createWalletConnector({
280
+ network: 'devnet',
281
+ options: [loop],
282
+ discover: (signal) => extensionWalletOptions({ signal }),
283
+ storageKey: 'my-dapp.wallet',
284
+ });
285
+ const { status, options, connection, error } = connector.getSnapshot();
286
+ await connector.connect('loop'); // { status: 'connected' | 'failed' | 'cancelled' | 'preparing' | 'refused' }
287
+ connector.store?.getSnapshot(); // the token wallet view of the connected wallet
288
+ ```
289
+
239
290
  ### One panel per token
240
291
 
241
292
  `walletTokens(view.state)` gives one entry per token the state names, Canton Coin and DA Registry
@@ -14,4 +14,17 @@ export declare function anySignal(...signals: ReadonlyArray<AbortSignal | undefi
14
14
  readonly signal: AbortSignal | undefined;
15
15
  readonly release: () => void;
16
16
  };
17
+ /** The longest delay `setTimeout` honours (2^31 - 1 ms, about 24.8 days); a longer one fires at once. */
18
+ export declare const MAX_TIMER_MS = 2147483647;
19
+ /**
20
+ * Runs `work` with a deadline. `work` gets a signal that aborts when `ms` milliseconds pass or `options.signal` aborts;
21
+ * pass it on (to `fetch`, a wallet call) so the work stops too. The call settles as `work` does, else rejects at the
22
+ * deadline with an `Error` named `TimeoutError` (match it by `name`), or, when `options.signal` aborted first, with an
23
+ * `AbortError`. A rejection here does not say whether the work had an effect: work that may submit something must be
24
+ * treated as of unknown outcome. `ms` must be a non-negative finite number of at most {@link MAX_TIMER_MS} (else a
25
+ * `RangeError`).
26
+ */
27
+ export declare function withTimeout<Value>(work: (signal: AbortSignal) => Promise<Value>, ms: number, options?: {
28
+ readonly signal?: AbortSignal;
29
+ }): Promise<Value>;
17
30
  //# sourceMappingURL=abort.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../src/wallets/abort.ts"],"names":[],"mappings":"AAUA,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,KAAK,CAI5E;AAED,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAO/D;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAEpE;AAED,gGAAgG;AAChG,wBAAsB,cAAc,CAAC,KAAK,EACxC,IAAI,EAAE,MAAM,KAAK,GAA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CAAC,EAC7C,EAAE,EAAE,MAAM,EACV,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC9C,OAAO,CAAC,KAAK,CAAC,CA2ChB"}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_TIMER_MS = void 0;
3
4
  exports.cancelledBeforeSubmit = cancelledBeforeSubmit;
4
5
  exports.isCancelledBeforeSubmit = isCancelledBeforeSubmit;
5
6
  exports.throwIfAborted = throwIfAborted;
6
7
  exports.awaitWithAbort = awaitWithAbort;
7
8
  exports.anySignal = anySignal;
9
+ exports.withTimeout = withTimeout;
8
10
  /**
9
11
  * Cancellation errors the wallets module throws before it submits anything. Each is an `AbortError` carrying a brand (a
10
12
  * non-enumerable symbol from the global registry, so it is recognised across copies of this module), which is how
@@ -95,4 +97,68 @@ function anySignal(...signals) {
95
97
  }
96
98
  return { signal: controller.signal, release };
97
99
  }
100
+ /** An `Error` named `TimeoutError` (the name `AbortSignal.timeout()` gives its reason), for {@link withTimeout}. */
101
+ function timeoutError(ms) {
102
+ const error = new Error(`Timed out after ${String(ms)} ms`);
103
+ error.name = 'TimeoutError';
104
+ return error;
105
+ }
106
+ /** The longest delay `setTimeout` honours (2^31 - 1 ms, about 24.8 days); a longer one fires at once. */
107
+ exports.MAX_TIMER_MS = 2147483647;
108
+ /**
109
+ * Runs `work` with a deadline. `work` gets a signal that aborts when `ms` milliseconds pass or `options.signal` aborts;
110
+ * pass it on (to `fetch`, a wallet call) so the work stops too. The call settles as `work` does, else rejects at the
111
+ * deadline with an `Error` named `TimeoutError` (match it by `name`), or, when `options.signal` aborted first, with an
112
+ * `AbortError`. A rejection here does not say whether the work had an effect: work that may submit something must be
113
+ * treated as of unknown outcome. `ms` must be a non-negative finite number of at most {@link MAX_TIMER_MS} (else a
114
+ * `RangeError`).
115
+ */
116
+ async function withTimeout(work, ms, options = {}) {
117
+ if (!Number.isFinite(ms) || ms < 0 || ms > exports.MAX_TIMER_MS) {
118
+ throw new RangeError(`withTimeout: ms must be a non-negative finite number, at most ${exports.MAX_TIMER_MS}`);
119
+ }
120
+ const { signal } = options;
121
+ if (signal?.aborted === true)
122
+ throw (0, abort_1.createAbortError)(signal);
123
+ const controller = new AbortController();
124
+ return new Promise((resolve, reject) => {
125
+ let settled = false;
126
+ const finish = () => {
127
+ if (settled)
128
+ return false;
129
+ settled = true;
130
+ clearTimeout(timer);
131
+ signal?.removeEventListener('abort', onAbort);
132
+ return true;
133
+ };
134
+ const timer = setTimeout(() => {
135
+ if (!finish())
136
+ return;
137
+ const error = timeoutError(ms);
138
+ controller.abort(error);
139
+ reject(error);
140
+ }, ms);
141
+ const onAbort = () => {
142
+ if (!finish())
143
+ return;
144
+ controller.abort(signal?.reason);
145
+ reject((0, abort_1.createAbortError)(signal));
146
+ };
147
+ signal?.addEventListener('abort', onAbort, { once: true });
148
+ let running;
149
+ try {
150
+ running = work(controller.signal);
151
+ }
152
+ catch (error) {
153
+ running = Promise.reject(error);
154
+ }
155
+ running.then((value) => {
156
+ if (finish())
157
+ resolve(value);
158
+ }, (error) => {
159
+ if (finish())
160
+ reject(error);
161
+ });
162
+ });
163
+ }
98
164
  //# sourceMappingURL=abort.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../src/wallets/abort.ts"],"names":[],"mappings":";;;;;;;AAAA;;;;;GAKG;AACH,8CAAsD;AAEtD,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;AAE9F,8FAA8F;AAC9F,+BAAsC,MAA+B;IACnE,MAAM,KAAK,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;IACvC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAChF,OAAO,KAAK,CAAC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EAAE,CAAC,CAAC;YAC/B,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxB,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,IAAI,CAAC,MAAM,EAAE;gBAAE,OAAO;YACtB,UAAU,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjC,MAAM,CAAC,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC;QACF,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,IAAI,OAAuB,CAAC;QAC5B,IAAI,CAAC;YACH,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,MAAM,EAAE;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,EACD,CAAC,KAAc,EAAE,EAAE;YACjB,IAAI,MAAM,EAAE;gBAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,181 @@
1
+ import type { DaNetwork } from './da-utilities/client';
2
+ import { type WalletErrorDescription } from './errors';
3
+ import { type WriteLatch } from './latch';
4
+ import type { WalletAvailability, WalletOption, WalletOptionInfo } from './options';
5
+ import { type Cip103Session, type ConnectedWallet } from './session';
6
+ import { type StorageLike } from './storage';
7
+ import { type WalletStore, type WalletStoreOptions } from './store';
8
+ /** {@link createWalletConnector}'s input. */
9
+ export interface WalletConnectorInput {
10
+ /**
11
+ * The DA network, or null where DA runs none: every option is then `unsupported-network`, and `session`/`store` are
12
+ * null.
13
+ */
14
+ readonly network: DaNetwork | null;
15
+ /** The fixed options: Loop, a live option such as a Privy session's, an app's own. Keys must be unique. */
16
+ readonly options: readonly WalletOption[];
17
+ /**
18
+ * Options found at run time, such as `(signal) => extensionWalletOptions({ signal })`. Run once at creation and again
19
+ * on `rediscover()`. An option whose key a fixed option has is ignored.
20
+ */
21
+ readonly discover?: (signal: AbortSignal) => Promise<readonly WalletOption[]>;
22
+ /**
23
+ * Where the remembered wallet (`local`) and the selected-setup flag (`session`) are kept. Defaults: the page's
24
+ * `localStorage` and `sessionStorage`. `null` disables one.
25
+ */
26
+ readonly storage?: {
27
+ readonly local?: StorageLike | null;
28
+ readonly session?: StorageLike | null;
29
+ };
30
+ /** Prefix of the two storage keys, `${storageKey}.wallet` and `${storageKey}.selected`. Default `canton-wallet`. */
31
+ readonly storageKey?: string;
32
+ /**
33
+ * How long a restore of a remembered loaded option may take before it is abandoned and forgotten. Default 15 000 ms;
34
+ * at most `MAX_TIMER_MS`.
35
+ */
36
+ readonly restoreTimeoutMs?: number;
37
+ /** Store options other than `session`, `latch`, `retainKey` and `connectingRetainKey`, which the connector supplies. */
38
+ readonly store?: Omit<WalletStoreOptions, 'session' | 'latch' | 'retainKey' | 'connectingRetainKey'>;
39
+ /** Shared with the app's other writers (a wallet setup session). Default: a new one. */
40
+ readonly latch?: WriteLatch;
41
+ }
42
+ /**
43
+ * - `disconnected`: nothing is wanted;
44
+ * - `restoring`: restoring a remembered loaded option silently (`cancel()` abandons it);
45
+ * - `preparing`: a live option is wanted and offers no provider yet: the app shows its setup UI;
46
+ * - `connecting`: a connect is in flight, its option's provider still loading included (`cancel()` ends it);
47
+ * - `connected`;
48
+ * - `reconnecting`: a live option offered a new provider for the same retain key; `connection` is the held one (`stale:
49
+ * true`).
50
+ */
51
+ export type WalletConnectorStatus = 'disconnected' | 'restoring' | 'preparing' | 'connecting' | 'connected' | 'reconnecting';
52
+ /** A connected wallet, with the option it came through. */
53
+ export interface WalletConnection {
54
+ /** Stable UI key: `${option.key}:${retainKey}` for live options, else the session wallet's `key`. */
55
+ readonly key: string;
56
+ readonly option: WalletOptionInfo;
57
+ /** The session's connected wallet (provider, party, network, key). */
58
+ readonly wallet: ConnectedWallet;
59
+ }
60
+ /** An option as the snapshot shows it. */
61
+ export interface WalletOptionState extends WalletOptionInfo {
62
+ readonly mode: 'load' | 'live';
63
+ readonly availability: WalletAvailability;
64
+ /** Loaded options: their preload state. Live options: `ready` once they offer a provider, else `idle`. */
65
+ readonly provider: 'idle' | 'loading' | 'ready' | 'failed';
66
+ /** Why the last preload failed. */
67
+ readonly loadError: WalletErrorDescription | null;
68
+ }
69
+ /** Why the last connect, select or option load failed. */
70
+ export interface WalletConnectorError {
71
+ /**
72
+ * - `load-failed`: an option's `load` rejected (`description` from `describeWalletError`);
73
+ * - `connect-failed`: the session's connect failed (`description` is the session's own error; 4001 is `declined`);
74
+ * - `unavailable`: `connect(key)` for an option whose availability is false (`availability` says why).
75
+ */
76
+ readonly code: 'load-failed' | 'connect-failed' | 'unavailable';
77
+ readonly key: string;
78
+ readonly description: WalletErrorDescription | null;
79
+ readonly availability?: WalletAvailability;
80
+ }
81
+ /** What {@link WalletConnector.getSnapshot} returns: the same frozen object until something changes. */
82
+ export interface WalletConnectorSnapshot {
83
+ readonly network: DaNetwork | null;
84
+ readonly status: WalletConnectorStatus;
85
+ /** The option being restored, prepared, connected or reconnected; null when disconnected. */
86
+ readonly target: WalletOptionInfo | null;
87
+ /**
88
+ * The live option whose setup UI is open. It survives a reload in this tab (session storage), so a login redirect
89
+ * lands back on it.
90
+ */
91
+ readonly selected: string | null;
92
+ /**
93
+ * The live connection, or the held one while `reconnecting`. Null while `connecting`, also while a loaded option's
94
+ * provider loads and the session is still on the previous wallet.
95
+ */
96
+ readonly connection: WalletConnection | null;
97
+ /** `connection` is the held one. */
98
+ readonly stale: boolean;
99
+ /** Fixed options first, then discovered ones in discovery order. */
100
+ readonly options: readonly WalletOptionState[];
101
+ readonly discovering: boolean;
102
+ /** Cleared by the next connect, select, cancel or disconnect. A restore never sets it. */
103
+ readonly error: WalletConnectorError | null;
104
+ }
105
+ /** How a `connect()` ended. */
106
+ export type WalletConnectResult = {
107
+ readonly status: 'connected';
108
+ }
109
+ /** A live option without a provider yet: it connects on its own once one appears. */
110
+ | {
111
+ readonly status: 'preparing';
112
+ }
113
+ /** See `snapshot.error`. */
114
+ | {
115
+ readonly status: 'failed';
116
+ }
117
+ /** `cancel()`, `disconnect()`, another `connect()` or `dispose()` superseded it. */
118
+ | {
119
+ readonly status: 'cancelled';
120
+ } | {
121
+ readonly status: 'refused';
122
+ readonly reason: 'busy' | 'unavailable' | 'unknown-option' | 'no-network' | 'disposed';
123
+ };
124
+ /** A page's wallet connection. Create it with {@link createWalletConnector}. */
125
+ export interface WalletConnector {
126
+ subscribe(listener: () => void): () => void;
127
+ getSnapshot(): WalletConnectorSnapshot;
128
+ /** Null when `network` is null. */
129
+ readonly session: Cip103Session | null;
130
+ /** Null when `network` is null. */
131
+ readonly store: WalletStore | null;
132
+ readonly latch: WriteLatch;
133
+ /**
134
+ * The user's click. Refused while the latch is held (`busy`). It retires any restore, bumps the latch, remembers
135
+ * `key` and clears `selected` unless `key` is that live option. For a loaded option whose provider was preloaded,
136
+ * `session.connect` is called synchronously inside the click (a wallet's sign-in window needs the gesture); otherwise
137
+ * it loads first. Each call is a new attempt, so a click after a cancelled or failed connect retries it. It never
138
+ * rejects.
139
+ */
140
+ connect(key: string): Promise<WalletConnectResult>;
141
+ /**
142
+ * Opens a live option's setup UI without connecting (`selected = key`), or closes it (`null`, "choose another
143
+ * wallet"). Closing forgets the remembered key when it is that option's. Refused (false) while the latch is held or
144
+ * `connecting`, and for a key that names no live option.
145
+ */
146
+ select(key: string | null): boolean;
147
+ /**
148
+ * Loads loaded options' providers (all available ones, or `keys`) while the chooser is open, so a click connects at
149
+ * once. Returns a release that aborts loads still pending; finished ones stay ready.
150
+ */
151
+ preload(keys?: readonly string[]): () => void;
152
+ /** Runs `discover` again; options that disappear lose their preload. */
153
+ rediscover(): Promise<void>;
154
+ /**
155
+ * - `restoring`: abandon the restore, and forget its key if it is still the remembered one;
156
+ * - `connecting` / `reconnecting`: the same, then `session.disconnect()` (the CIP-0103 disconnect ends the wallet's own
157
+ * sign-in window). A connect still loading its option's provider stops loading and never connects; the wallet the
158
+ * session was on is disconnected too, since the connect had already left it;
159
+ * - `preparing`: stop wanting the live option (`selected` stays);
160
+ * - Otherwise nothing.
161
+ */
162
+ cancel(): void;
163
+ /** Retires any restore, bumps the latch, disconnects the session, clears target and selected, forgets both keys. */
164
+ disconnect(): void;
165
+ /**
166
+ * Stops everything: the restore, preloads and discovery; unsubscribes from live options; bumps and disposes the latch
167
+ * only if the connector created it; disposes the store; and sends a best-effort CIP-0103 disconnect for a connected
168
+ * wallet before disposing the session. Storage is not touched, so a later connector for the same network restores.
169
+ * Afterwards every method is a no-op or refused `disposed`.
170
+ */
171
+ dispose(): void;
172
+ }
173
+ /** The default {@link WalletConnectorInput.restoreTimeoutMs}. */
174
+ export declare const DEFAULT_RESTORE_TIMEOUT_MS = 15000;
175
+ /**
176
+ * A wallet connection for `input.network`: the session, the store over it and the shared latch, plus restore and
177
+ * remember (see {@link WalletConnector}). Create one per network a page serves, and `dispose()` it when the page leaves
178
+ * that network.
179
+ */
180
+ export declare function createWalletConnector(input: WalletConnectorInput): WalletConnector;
181
+ //# sourceMappingURL=connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/wallets/connector.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5D,OAAO,KAA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