@fairmint/canton-node-sdk 0.0.291 → 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 (34) hide show
  1. package/README.md +51 -0
  2. package/build/src/wallets/connector.d.ts +181 -0
  3. package/build/src/wallets/connector.d.ts.map +1 -0
  4. package/build/src/wallets/connector.js +686 -0
  5. package/build/src/wallets/connector.js.map +1 -0
  6. package/build/src/wallets/errors.d.ts +29 -3
  7. package/build/src/wallets/errors.d.ts.map +1 -1
  8. package/build/src/wallets/errors.js +38 -1
  9. package/build/src/wallets/errors.js.map +1 -1
  10. package/build/src/wallets/index.d.ts +7 -2
  11. package/build/src/wallets/index.d.ts.map +1 -1
  12. package/build/src/wallets/index.js +13 -2
  13. package/build/src/wallets/index.js.map +1 -1
  14. package/build/src/wallets/latch.d.ts +70 -0
  15. package/build/src/wallets/latch.d.ts.map +1 -0
  16. package/build/src/wallets/latch.js +100 -0
  17. package/build/src/wallets/latch.js.map +1 -0
  18. package/build/src/wallets/loop.d.ts +36 -0
  19. package/build/src/wallets/loop.d.ts.map +1 -0
  20. package/build/src/wallets/loop.js +59 -0
  21. package/build/src/wallets/loop.js.map +1 -0
  22. package/build/src/wallets/options.d.ts +76 -0
  23. package/build/src/wallets/options.d.ts.map +1 -0
  24. package/build/src/wallets/options.js +21 -0
  25. package/build/src/wallets/options.js.map +1 -0
  26. package/build/src/wallets/storage.d.ts +17 -0
  27. package/build/src/wallets/storage.d.ts.map +1 -0
  28. package/build/src/wallets/storage.js +55 -0
  29. package/build/src/wallets/storage.js.map +1 -0
  30. package/build/src/wallets/store.d.ts +57 -6
  31. package/build/src/wallets/store.d.ts.map +1 -1
  32. package/build/src/wallets/store.js +155 -36
  33. package/build/src/wallets/store.js.map +1 -1
  34. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loopWalletOption = loopWalletOption;
4
+ /**
5
+ * Loop (`@fivenorth/loop-sdk`) as a wallet option. node-sdk does not depend on Loop: the app passes the SDK's dynamic
6
+ * import, and the option uses only the part {@link LoopSdkLike} names.
7
+ */
8
+ const abort_1 = require("./abort");
9
+ const errors_1 = require("./errors");
10
+ const AVAILABLE = Object.freeze({ available: true });
11
+ /**
12
+ * Loop as a `LoadedWalletOption` (`key: "loop"`, `kind: "loop"`, `name: "Loop"`). Loop serves one network per page load
13
+ * (a second `init` answers 4900 until a reload), so the option remembers the first network it was set up for. Create it
14
+ * once per page load, at module level. `availability(other)` then reports `reload-required` with `setUpFor`, and
15
+ * `load(other)` rejects `WalletOptionError("reload-required")`. A failed setup is forgotten, so the next `load` tries
16
+ * again (`WalletOptionError("setup-failed", { cause })`). Concurrent loads share one setup; a load's `signal` only
17
+ * stops that caller waiting.
18
+ */
19
+ function loopWalletOption(input) {
20
+ let setup = null;
21
+ async function start(network) {
22
+ const provider = (async () => {
23
+ const loop = await input.load();
24
+ loop.init({ appName: input.appName, network });
25
+ // Structurally a CIP-0103 provider (request, on, removeListener); node-sdk validates every reply.
26
+ return loop.getCip103Provider();
27
+ })().catch((error) => {
28
+ if (setup?.provider === provider)
29
+ setup = null; // the next attempt tries again
30
+ throw new errors_1.WalletOptionError('setup-failed', { requested: network, cause: error });
31
+ });
32
+ // A caller that stopped waiting leaves no unhandled rejection; the next caller sees the failure.
33
+ provider.catch(() => undefined);
34
+ setup = { network, provider };
35
+ return provider;
36
+ }
37
+ return {
38
+ mode: 'load',
39
+ key: 'loop',
40
+ kind: 'loop',
41
+ name: 'Loop',
42
+ availability(network) {
43
+ if (setup !== null && setup.network !== network) {
44
+ return { available: false, reason: 'reload-required', setUpFor: setup.network };
45
+ }
46
+ return AVAILABLE;
47
+ },
48
+ async load(network, signal) {
49
+ if (setup !== null && setup.network !== network) {
50
+ throw new errors_1.WalletOptionError('reload-required', { setUpFor: setup.network, requested: network });
51
+ }
52
+ (0, abort_1.throwIfAborted)(signal);
53
+ const provider = setup?.provider ?? start(network);
54
+ return (0, abort_1.awaitWithAbort)(async () => provider, signal);
55
+ },
56
+ setUpFor: () => setup?.network ?? null,
57
+ };
58
+ }
59
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../../src/wallets/loop.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,mCAAyD;AAGzD,qCAA6C;AA0B7C,MAAM,SAAS,GAAuB,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzE;;;;;;;GAOG;AACH,0BAAiC,KAA4B;IAC3D,IAAI,KAAK,GAAuF,IAAI,CAAC;IAErG,KAAK,UAAU,KAAK,CAAC,OAAkB;QACrC,MAAM,QAAQ,GAA4B,CAAC,KAAK,IAAI,EAAE;YACpD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YAC/C,kGAAkG;YAClG,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAClC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAC5B,IAAI,KAAK,EAAE,QAAQ,KAAK,QAAQ;gBAAE,KAAK,GAAG,IAAI,CAAC,CAAC,+BAA+B;YAC/E,MAAM,IAAI,0BAAiB,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;QACH,iGAAiG;QACjG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAChC,KAAK,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QAC9B,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,YAAY,CAAC,OAAO;YAClB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBAChD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YAClF,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM;YACxB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;gBAChD,MAAM,IAAI,0BAAiB,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;YAClG,CAAC;YACD,IAAA,sBAAc,EAAC,MAAM,CAAC,CAAC;YACvB,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YACnD,OAAO,IAAA,sBAAc,EAAC,KAAK,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,IAAI,IAAI;KACvC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The wallets a page offers to connect, as options a `createWalletConnector` drives: a wallet whose CIP-0103 provider
3
+ * is loaded on demand (Loop, a browser extension), or one the app builds over time through its own setup UI (Privy).
4
+ * Options carry codes, never sentences: the page words them.
5
+ */
6
+ import type { Cip103Provider } from './cip103';
7
+ import type { DaNetwork } from './da-utilities/client';
8
+ import { type DiscoverCip103WalletsOptions } from './discovery';
9
+ /** Whether an option can connect on a network. */
10
+ export type WalletAvailability = {
11
+ readonly available: true;
12
+ }
13
+ /** No DA network (null), or the option does not run on it. */
14
+ | {
15
+ readonly available: false;
16
+ readonly reason: 'unsupported-network';
17
+ }
18
+ /** The option is set up for another network in this page load (Loop): a reload is needed. */
19
+ | {
20
+ readonly available: false;
21
+ readonly reason: 'reload-required';
22
+ readonly setUpFor: DaNetwork;
23
+ }
24
+ /** The app has not configured the option. */
25
+ | {
26
+ readonly available: false;
27
+ readonly reason: 'not-configured';
28
+ };
29
+ /** The display facts of an option. */
30
+ export interface WalletOptionInfo {
31
+ /** Unique and stable across visits; it is what gets remembered. `loop`, `extension:<id>`, `privy`, ... */
32
+ readonly key: string;
33
+ /** For the page's icon and wording: `loop`, `extension`, `privy`, or an app's own kind. */
34
+ readonly kind: string;
35
+ readonly name: string;
36
+ /** A data URL or URL of its icon. */
37
+ readonly icon?: string;
38
+ }
39
+ /** A wallet whose CIP-0103 provider is loaded on demand: Loop, a browser extension. */
40
+ export interface LoadedWalletOption extends WalletOptionInfo {
41
+ readonly mode: 'load';
42
+ availability(network: DaNetwork): WalletAvailability;
43
+ /** Resolves the provider. A rejection is shown as `load-failed`. `signal` aborts a load nobody waits for anymore. */
44
+ load(network: DaNetwork, signal: AbortSignal): Promise<Cip103Provider>;
45
+ }
46
+ /**
47
+ * A wallet the app builds over time, through its own setup UI (Privy: login, wallet, party). It offers a provider only
48
+ * once its setup is done, and offers a new one whenever that setup changes.
49
+ */
50
+ export interface LiveWalletOption extends WalletOptionInfo {
51
+ readonly mode: 'live';
52
+ availability(network: DaNetwork): WalletAvailability;
53
+ readonly live: {
54
+ subscribe(listener: () => void): () => void;
55
+ /** The provider the option offers now, or null (not set up yet, or torn down). Compared by identity. */
56
+ getProvider(): Cip103Provider | null;
57
+ /**
58
+ * What the provider signs as (Privy: the party id), so a rebuilt provider for the same party keeps the page mounted
59
+ * and its snapshot shown. Null: use the session wallet's own key.
60
+ */
61
+ getRetainKey(): string | null;
62
+ /**
63
+ * The connector found this option remembered from an earlier visit. The option starts its own silent recovery
64
+ * (Privy: one party load once logged in). Called at most once per connector.
65
+ */
66
+ restore(): void;
67
+ };
68
+ }
69
+ /** A wallet the page offers. */
70
+ export type WalletOption = LoadedWalletOption | LiveWalletOption;
71
+ /**
72
+ * The CIP-0103 browser extensions installed here (`discoverCip103Wallets`), as options keyed `extension:<id>` with kind
73
+ * `extension`. Each is available on both DA networks.
74
+ */
75
+ export declare function extensionWalletOptions(options?: DiscoverCip103WalletsOptions): Promise<LoadedWalletOption[]>;
76
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/wallets/options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAyB,KAAK,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEvF,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAA;CAAE;AAC9B,8DAA8D;GAC5D;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE;AACvE,6FAA6F;GAC3F;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;CAAE;AACjG,6CAA6C;GAC3C;IAAE,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAErE,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,0GAA0G;IAC1G,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,uFAAuF;AACvF,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,kBAAkB,CAAC;IACrD,qHAAqH;IACrH,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACxE;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,kBAAkB,CAAC;IACrD,QAAQ,CAAC,IAAI,EAAE;QACb,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;QAC5C,wGAAwG;QACxG,WAAW,IAAI,cAAc,GAAG,IAAI,CAAC;QACrC;;;WAGG;QACH,YAAY,IAAI,MAAM,GAAG,IAAI,CAAC;QAC9B;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC;KACjB,CAAC;CACH;AAED,gCAAgC;AAChC,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAIjE;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAUlH"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extensionWalletOptions = extensionWalletOptions;
4
+ const discovery_1 = require("./discovery");
5
+ const AVAILABLE = Object.freeze({ available: true });
6
+ /**
7
+ * The CIP-0103 browser extensions installed here (`discoverCip103Wallets`), as options keyed `extension:<id>` with kind
8
+ * `extension`. Each is available on both DA networks.
9
+ */
10
+ async function extensionWalletOptions(options) {
11
+ return (await (0, discovery_1.discoverCip103Wallets)(options)).map((wallet) => ({
12
+ mode: 'load',
13
+ key: `extension:${wallet.id}`,
14
+ kind: 'extension',
15
+ name: wallet.name,
16
+ ...(wallet.icon !== undefined && { icon: wallet.icon }),
17
+ availability: () => AVAILABLE,
18
+ load: async (network, signal) => wallet.load(network, { signal }),
19
+ }));
20
+ }
21
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/wallets/options.ts"],"names":[],"mappings":";;;AAOA,2CAAuF;AA0DvF,MAAM,SAAS,GAAuB,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzE;;;GAGG;AACI,KAAK,iCAAiC,OAAsC;IACjF,OAAO,CAAC,MAAM,IAAA,iCAAqB,EAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAsB,EAAE,CAAC,CAAC;QACjF,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,aAAa,MAAM,CAAC,EAAE,EAAE;QAC7B,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACvD,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS;QAC7B,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC;KAClE,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Browser storage, read defensively: the accessor itself may throw (a sandboxed frame, blocked site data), and a
3
+ * missing or refusing storage behaves as empty.
4
+ */
5
+ /** The part of the DOM `Storage` the wallets module uses (`localStorage` and `sessionStorage` satisfy it). */
6
+ export interface StorageLike {
7
+ getItem(key: string): string | null;
8
+ setItem(key: string, value: string): void;
9
+ removeItem(key: string): void;
10
+ }
11
+ /** The page's `localStorage` or `sessionStorage`, or null where there is none or reading it throws. */
12
+ export declare function globalStorage(kind: 'local' | 'session'): StorageLike | null;
13
+ /** `storage.getItem(key)`, or null when there is no storage or it throws. */
14
+ export declare function readStorage(storage: StorageLike | null, key: string): string | null;
15
+ /** Sets (`value` a string) or removes (`null`) `key`; a missing or refusing storage is ignored. */
16
+ export declare function writeStorage(storage: StorageLike | null, key: string, value: string | null): void;
17
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/wallets/storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,8GAA8G;AAC9G,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAYD,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAQ3E;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQnF;AAED,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQjG"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * Browser storage, read defensively: the accessor itself may throw (a sandboxed frame, blocked site data), and a
4
+ * missing or refusing storage behaves as empty.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.globalStorage = globalStorage;
8
+ exports.readStorage = readStorage;
9
+ exports.writeStorage = writeStorage;
10
+ function isStorageLike(value) {
11
+ if (typeof value !== 'object' || value === null)
12
+ return false;
13
+ const candidate = value;
14
+ return (typeof candidate.getItem === 'function' &&
15
+ typeof candidate.setItem === 'function' &&
16
+ typeof candidate.removeItem === 'function');
17
+ }
18
+ /** The page's `localStorage` or `sessionStorage`, or null where there is none or reading it throws. */
19
+ function globalStorage(kind) {
20
+ try {
21
+ // Optional globals: absent outside a browser, and the getter throws where site data is blocked.
22
+ const storage = kind === 'local' ? globalThis.localStorage : globalThis.sessionStorage;
23
+ return isStorageLike(storage) ? storage : null;
24
+ }
25
+ catch {
26
+ return null;
27
+ }
28
+ }
29
+ /** `storage.getItem(key)`, or null when there is no storage or it throws. */
30
+ function readStorage(storage, key) {
31
+ if (storage === null)
32
+ return null;
33
+ try {
34
+ const value = storage.getItem(key);
35
+ return typeof value === 'string' ? value : null;
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
41
+ /** Sets (`value` a string) or removes (`null`) `key`; a missing or refusing storage is ignored. */
42
+ function writeStorage(storage, key, value) {
43
+ if (storage === null)
44
+ return;
45
+ try {
46
+ if (value === null)
47
+ storage.removeItem(key);
48
+ else
49
+ storage.setItem(key, value);
50
+ }
51
+ catch {
52
+ // Storage refused (a private window, a full quota): the next visit starts without it.
53
+ }
54
+ }
55
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/wallets/storage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AASH,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;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ACxF,CAAC;AACH,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import type { CantonCoinOptions } from './amulet/registry';
2
2
  import type { FetchLike, DaRegistryOptions } from './da-utilities/client';
3
3
  import { type WalletErrorDescription } from './errors';
4
+ import { type WriteLatch, type WriteRunContext, type WriteRunOutcome } from './latch';
4
5
  import { type WalletOwnershipVerdict } from './ownership';
5
6
  import type { Cip103Session, Cip103SessionState, ConnectedWallet } from './session';
6
7
  import type { InstrumentId, SubmitResult } from './types';
@@ -83,8 +84,8 @@ export type ActionResultOf<A extends WalletAction> = WalletActionResults[A['type
83
84
  */
84
85
  export declare function walletActionKey(action: WalletAction): string;
85
86
  /**
86
- * Whether `store.act(action)` would run it now: the store is `ready`, not busy, and, for a write, no outcome is
87
- * unknown. Use it to enable the action's button.
87
+ * Whether `store.act(action)` would run it now: the store is `ready`, not busy, and, for a write, the store is not
88
+ * read-only and no outcome is unknown. Use it to enable the action's button.
88
89
  */
89
90
  export declare function canAct(view: WalletView, action: WalletAction): boolean;
90
91
  /**
@@ -93,10 +94,11 @@ export declare function canAct(view: WalletView, action: WalletAction): boolean;
93
94
  * - `disconnected`: no wallet is connected (or there is no view yet);
94
95
  * - `reconnecting`: the session is connecting (a reconnect or a switch of wallet);
95
96
  * - `not-ready`: connected, but the token wallet is not open (`view.loadError` may say why);
96
- * - `busy`: a wallet call is in flight or a load is queued;
97
+ * - `read-only`: the app's write gate is closed (`view.readOnly` holds its value); writes only;
98
+ * - `busy`: a wallet call is in flight, a load is queued, or another writer holds the shared latch;
97
99
  * - `unknown-outcome`: a write's outcome is unknown, so writes wait until `acknowledgeUnknownOutcome()`.
98
100
  */
99
- export type WalletActionBlocker = 'disconnected' | 'reconnecting' | 'not-ready' | 'busy' | 'unknown-outcome';
101
+ export type WalletActionBlocker = 'disconnected' | 'reconnecting' | 'not-ready' | 'read-only' | 'busy' | 'unknown-outcome';
100
102
  /**
101
103
  * Whether `store.act(action)` would run it now (as {@link canAct}), and when not, the first reason, in the order listed
102
104
  * by {@link WalletActionBlocker}. `view` may be null (no store yet), which reads as `disconnected`. Use `reason` to say
@@ -143,6 +145,8 @@ export interface WalletNotice {
143
145
  /** Offer a button that calls `store.acknowledgeUnknownOutcome()` once the user checked the wallet. */
144
146
  readonly acknowledge?: true;
145
147
  }
148
+ /** Why {@link WalletView.busy} is true. */
149
+ export type WalletBusyReason = 'action' | 'load' | 'run';
146
150
  export interface WalletView {
147
151
  readonly session: Cip103SessionState;
148
152
  /** The connected wallet the state belongs to (null when disconnected). */
@@ -167,10 +171,26 @@ export interface WalletView {
167
171
  readonly key: string;
168
172
  } | null;
169
173
  /**
170
- * True while any wallet call is in flight or a load is queued: disable every action button. `act()` refuses
171
- * meanwhile, so only one wallet call is ever in flight.
174
+ * True while any wallet call is in flight, a load is queued, or another writer holds the shared latch (a `run()`):
175
+ * disable every action button. `act()` refuses meanwhile, so only one wallet call is ever in flight.
172
176
  */
173
177
  readonly busy: boolean;
178
+ /**
179
+ * Why `busy` is true (null when it is not): `action` (a store action holds the latch), `run` (another writer's
180
+ * `run()` holds it; `busyLabel` names it) or `load` (a snapshot load is in flight or queued), in that precedence.
181
+ */
182
+ readonly busyReason: WalletBusyReason | null;
183
+ /** The latch holder's label while `busyReason` is `action` or `run`, else null. */
184
+ readonly busyLabel: string | null;
185
+ /**
186
+ * What a page renders: `state` when it is non-null; otherwise, while a load runs or the session is connecting, the
187
+ * last state of the same `retainKey` (see {@link WalletStoreOptions.retainKey}); otherwise null.
188
+ */
189
+ readonly shown: WalletState | null;
190
+ /** `shown` is a held snapshot, not `state`. */
191
+ readonly stale: boolean;
192
+ /** The app's write gate in force (`WalletStoreOptions.readOnly`, `setReadOnly`), or null when writes are open. */
193
+ readonly readOnly: string | null;
174
194
  /**
175
195
  * The last action that had something to say: a write's result or failure, an ownership verdict, a plan that failed. A
176
196
  * plan that succeeded leaves it as it was (its result is the plan). Cleared when the wallet changes.
@@ -211,6 +231,16 @@ export interface WalletStore {
211
231
  refresh(): void;
212
232
  /** Clear `unknownOutcome` once the user checked the wallet. */
213
233
  acknowledgeUnknownOutcome(): void;
234
+ /**
235
+ * Runs `fn` under the store's latch (`latch.run(label, fn)`), for a write that is not a store action (a Canton Coin
236
+ * prepare, sign and submit). Its signal is also aborted when the connected wallet changes (the store bumps the latch
237
+ * on every wallet change) and on `dispose()`. A run does not set `outcome` or `unknownOutcome`: the caller reports
238
+ * its {@link WriteRunOutcome}. A write here does not trigger a reload; call `refresh()`. Refused (`busy`) while a
239
+ * store action or another run holds the latch, and (`disposed`) after `dispose()`.
240
+ */
241
+ run<T>(label: string, fn: (context: WriteRunContext) => Promise<T>): Promise<WriteRunOutcome<T>>;
242
+ /** Changes the write gate (null opens it) and publishes a new view. */
243
+ setReadOnly(reason: string | null): void;
214
244
  /**
215
245
  * Stop following the session; pending replies are dropped and no further view is published. Work in flight (an
216
246
  * action, a load) is cancelled through its `signal`, so nothing more is sent before a signature is requested.
@@ -223,6 +253,27 @@ export interface WalletStoreOptions {
223
253
  readonly registry?: DaRegistryOptions;
224
254
  /** Canton Coin for each token wallet (`createWallet`'s `cantonCoin`): on by default, `false` to read none. */
225
255
  readonly cantonCoin?: CantonCoinOptions | false;
256
+ /** The latch the store shares with `run()` and the app's other writers. Default: a private one. */
257
+ readonly latch?: WriteLatch;
258
+ /**
259
+ * The app's write gate, such as a server-supplied reason writes are off. While it is set, every write action is
260
+ * refused; reads (`planTransfer`, `proveOwnership`) still run. The store does not interpret the value. Change it
261
+ * later with `setReadOnly`.
262
+ */
263
+ readonly readOnly?: string | null;
264
+ /**
265
+ * The connection a ledger snapshot belongs to, for `shown`/`stale`. Two wallets with the same key (for example a
266
+ * rebuilt provider for the same party) keep the last snapshot on screen across the reconnect. Read once per connected
267
+ * wallet. Default: `wallet.key`, which keeps it only across reloads of one connection.
268
+ */
269
+ readonly retainKey?: (wallet: ConnectedWallet) => string;
270
+ /**
271
+ * While the session is `connecting`, the retain key of the connection being made, or null when it is not known. The
272
+ * held snapshot stays shown (`stale`) during a connect only when this names its key, so a connect to another wallet
273
+ * or party never shows the previous one's holdings. Read on every view while connecting. Default: none, so nothing is
274
+ * held while the session connects.
275
+ */
276
+ readonly connectingRetainKey?: () => string | null;
226
277
  }
227
278
  /** A test hook beside {@link WalletStoreOptions}; not part of the public options. */
228
279
  export interface WalletStoreInternalOptions extends WalletStoreOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/wallets/store.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAoC,KAAK,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEzF,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,UAAU,CAAC;AAElB,sHAAsH;AACtH,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACvF;IACE,QAAQ,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;IACvF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,aA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