@fairmint/canton-node-sdk 0.0.277 → 0.0.279

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 (64) hide show
  1. package/README.md +197 -14
  2. package/build/src/utils/external-signing/index.d.ts +2 -0
  3. package/build/src/utils/external-signing/index.d.ts.map +1 -1
  4. package/build/src/utils/external-signing/index.js +2 -0
  5. package/build/src/utils/external-signing/index.js.map +1 -1
  6. package/build/src/utils/external-signing/wallet-ownership-challenger.d.ts +93 -0
  7. package/build/src/utils/external-signing/wallet-ownership-challenger.d.ts.map +1 -0
  8. package/build/src/utils/external-signing/wallet-ownership-challenger.js +253 -0
  9. package/build/src/utils/external-signing/wallet-ownership-challenger.js.map +1 -0
  10. package/build/src/utils/external-signing/wallet-ownership.d.ts +48 -0
  11. package/build/src/utils/external-signing/wallet-ownership.d.ts.map +1 -0
  12. package/build/src/utils/external-signing/wallet-ownership.js +179 -0
  13. package/build/src/utils/external-signing/wallet-ownership.js.map +1 -0
  14. package/build/src/wallets/cip103.d.ts +100 -6
  15. package/build/src/wallets/cip103.d.ts.map +1 -1
  16. package/build/src/wallets/cip103.js +237 -107
  17. package/build/src/wallets/cip103.js.map +1 -1
  18. package/build/src/wallets/da-utilities/client.d.ts.map +1 -1
  19. package/build/src/wallets/da-utilities/client.js +3 -0
  20. package/build/src/wallets/da-utilities/client.js.map +1 -1
  21. package/build/src/wallets/errors.d.ts +51 -0
  22. package/build/src/wallets/errors.d.ts.map +1 -1
  23. package/build/src/wallets/errors.js +68 -1
  24. package/build/src/wallets/errors.js.map +1 -1
  25. package/build/src/wallets/holdings.d.ts +25 -0
  26. package/build/src/wallets/holdings.d.ts.map +1 -1
  27. package/build/src/wallets/holdings.js +44 -0
  28. package/build/src/wallets/holdings.js.map +1 -1
  29. package/build/src/wallets/index.d.ts +14 -7
  30. package/build/src/wallets/index.d.ts.map +1 -1
  31. package/build/src/wallets/index.js +22 -3
  32. package/build/src/wallets/index.js.map +1 -1
  33. package/build/src/wallets/notify.d.ts +7 -0
  34. package/build/src/wallets/notify.d.ts.map +1 -0
  35. package/build/src/wallets/notify.js +21 -0
  36. package/build/src/wallets/notify.js.map +1 -0
  37. package/build/src/wallets/ownership.d.ts +156 -0
  38. package/build/src/wallets/ownership.d.ts.map +1 -0
  39. package/build/src/wallets/ownership.js +269 -0
  40. package/build/src/wallets/ownership.js.map +1 -0
  41. package/build/src/wallets/session.d.ts +107 -0
  42. package/build/src/wallets/session.d.ts.map +1 -0
  43. package/build/src/wallets/session.js +371 -0
  44. package/build/src/wallets/session.js.map +1 -0
  45. package/build/src/wallets/store.d.ts +138 -0
  46. package/build/src/wallets/store.d.ts.map +1 -0
  47. package/build/src/wallets/store.js +262 -0
  48. package/build/src/wallets/store.js.map +1 -0
  49. package/build/src/wallets/templates.d.ts +15 -0
  50. package/build/src/wallets/templates.d.ts.map +1 -1
  51. package/build/src/wallets/templates.js +33 -9
  52. package/build/src/wallets/templates.js.map +1 -1
  53. package/build/src/wallets/token-registry.d.ts +15 -2
  54. package/build/src/wallets/token-registry.d.ts.map +1 -1
  55. package/build/src/wallets/token-registry.js.map +1 -1
  56. package/build/src/wallets/token-standard-wallet.d.ts +94 -9
  57. package/build/src/wallets/token-standard-wallet.d.ts.map +1 -1
  58. package/build/src/wallets/token-standard-wallet.js +160 -19
  59. package/build/src/wallets/token-standard-wallet.js.map +1 -1
  60. package/build/src/wallets/token-wallet.d.ts +43 -7
  61. package/build/src/wallets/token-wallet.d.ts.map +1 -1
  62. package/build/src/wallets/token-wallet.js +113 -35
  63. package/build/src/wallets/token-wallet.js.map +1 -1
  64. package/package.json +1 -1
@@ -0,0 +1,262 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTokenWalletStore = createTokenWalletStore;
4
+ /**
5
+ * A token wallet page's state and actions over a `Cip103Session`: one token wallet per connected wallet, its ledger
6
+ * snapshot, one wallet call at a time, a reload after every write attempt, and outcomes tagged with the session they
7
+ * ran for, so a reply from an ended session is never shown as a success.
8
+ *
9
+ * Observable for any UI framework: `subscribe` and `getSnapshot` (React: `useSyncExternalStore(store.subscribe,
10
+ * store.getSnapshot, store.getSnapshot)`).
11
+ */
12
+ const notify_1 = require("./notify");
13
+ const errors_1 = require("./errors");
14
+ const token_wallet_1 = require("./token-wallet");
15
+ /** Whether the outcome leaves open if a write committed: `interrupted`, or a failure the wallet could not confirm. */
16
+ function outcomeUnknown(outcome) {
17
+ return outcome.status === 'interrupted' || (outcome.status === 'failed' && outcome.error.kind === 'outcome-unknown');
18
+ }
19
+ /** Whether `error` is the SDK's refusal before anything was submitted (`TokenWalletError`). */
20
+ function refusedUnsent(error) {
21
+ return (0, errors_1.describeWalletError)(error).kind === 'refused';
22
+ }
23
+ /** The default token wallet: DA's registry for the network the wallet connected for, acting as its party only. */
24
+ function openTokenWallet(wallet, context) {
25
+ const { provider, partyId, network } = wallet;
26
+ if (network === undefined) {
27
+ throw new errors_1.TokenWalletError('invalid-input', 'The connected wallet names no network: connect with { network }, or pass open to createTokenWalletStore');
28
+ }
29
+ return (0, token_wallet_1.createTokenWallet)({ provider, partyId, network, isActive: context.isActive });
30
+ }
31
+ function createTokenWalletStore(options) {
32
+ const { session } = options;
33
+ // Without `open`, the first overload fixes W to TokenWallet.
34
+ const open = options.open ?? openTokenWallet;
35
+ const listeners = new Set();
36
+ let sessionState = session.getSnapshot();
37
+ let wallet = null;
38
+ let tokens = null;
39
+ let state = null;
40
+ let loadError = null;
41
+ // Stale replies: every load and wallet change takes a new number; a load's reply counts only while its number is the
42
+ // latest and its wallet still current. This drops replies; it does not free the latch.
43
+ let generation = 0;
44
+ // Execution latch: wallet calls (actions and loads, of any wallet) asked and not yet settled.
45
+ let inFlight = 0;
46
+ // A load for the current wallet waits for the latch (one at most: queued loads coalesce).
47
+ let queued = false;
48
+ // A load for the current wallet is in flight.
49
+ let loadInFlight = false;
50
+ let running = null;
51
+ let outcome = null;
52
+ let disposed = false;
53
+ let view = buildView();
54
+ function unknownOutcomeParty() {
55
+ if (running !== null && !running.readOnly && running.wallet !== wallet)
56
+ return running.wallet.partyId;
57
+ if (outcome === null || !outcomeUnknown(outcome))
58
+ return null;
59
+ // The current wallet's own `outcome-unknown` failure is shown as the outcome itself.
60
+ return outcome.status === 'interrupted' || outcome.partyId !== wallet?.partyId ? outcome.partyId : null;
61
+ }
62
+ function buildView() {
63
+ return {
64
+ session: sessionState,
65
+ wallet,
66
+ state,
67
+ loading: loadInFlight || queued,
68
+ loadError,
69
+ running: running?.id ?? null,
70
+ busy: inFlight > 0 || queued,
71
+ outcome,
72
+ unknownOutcomeParty: unknownOutcomeParty(),
73
+ };
74
+ }
75
+ function publish() {
76
+ if (disposed)
77
+ return;
78
+ view = buildView();
79
+ (0, notify_1.notifyListeners)(listeners);
80
+ }
81
+ /** Whether `candidate` is still the wallet this store and its session show. Read after an await. */
82
+ function isCurrent(candidate) {
83
+ return !disposed && candidate === wallet && session.isCurrent(candidate);
84
+ }
85
+ /**
86
+ * Ask for a load of the current wallet's snapshot: it starts now when no wallet call is in flight, and otherwise
87
+ * waits for the latch (`drain`). Publishes.
88
+ */
89
+ function requestLoad() {
90
+ // A session listener that runs before this store's own may ask after the session left `wallet`: the store's
91
+ // pending `onSession` then resets it, and no load goes to a wallet whose session ended.
92
+ if (disposed || wallet === null || tokens === null || !session.isCurrent(wallet))
93
+ return;
94
+ queued = true;
95
+ drain();
96
+ }
97
+ /** Start the queued load if the latch is free, then publish. Called whenever the latch may have freed. */
98
+ function drain() {
99
+ if (disposed)
100
+ return;
101
+ // A wallet the session has left gets no load: `onSession` drops the queued load and queues the next wallet's. A
102
+ // session that left it without publishing (`dispose()`) never calls `onSession`, so the queued load is dropped here:
103
+ // a wallet never becomes current again once the session left it.
104
+ if (queued && wallet !== null && !session.isCurrent(wallet))
105
+ queued = false;
106
+ if (queued && inFlight === 0 && wallet !== null && tokens !== null) {
107
+ queued = false;
108
+ startLoad(wallet, tokens);
109
+ }
110
+ publish();
111
+ }
112
+ /**
113
+ * Load `forWallet`'s snapshot, holding the latch until the wallet answers. The reply is dropped when another wallet
114
+ * superseded it (loads never overlap, so a newer load of the same wallet cannot); the latch frees either way, and the
115
+ * queued load, if any, starts.
116
+ */
117
+ function startLoad(forWallet, forTokens) {
118
+ const attempt = ++generation;
119
+ inFlight += 1;
120
+ loadInFlight = true;
121
+ // A reply counts only for the wallet the session still shows (a disposed session shows none).
122
+ const current = () => !disposed && attempt === generation && forWallet === wallet && session.isCurrent(forWallet);
123
+ void (async () => {
124
+ let next;
125
+ try {
126
+ next = { ok: true, snapshot: (await forTokens.loadState()) };
127
+ }
128
+ catch (error) {
129
+ next = { ok: false, error };
130
+ }
131
+ inFlight -= 1;
132
+ if (disposed)
133
+ return;
134
+ // No newer load of this wallet runs, so this one no longer counts as loading, whether its reply is kept or not.
135
+ if (attempt === generation)
136
+ loadInFlight = false;
137
+ if (current()) {
138
+ if (next.ok) {
139
+ state = next.snapshot;
140
+ loadError = null;
141
+ }
142
+ else {
143
+ state = null; // nothing is offered from a stale snapshot
144
+ loadError = (0, errors_1.describeWalletError)(next.error);
145
+ }
146
+ }
147
+ drain();
148
+ })();
149
+ }
150
+ /** Follow the session: a new connected wallet gets a new token wallet, cleared state and a fresh load. */
151
+ function onSession() {
152
+ if (disposed)
153
+ return;
154
+ sessionState = session.getSnapshot();
155
+ const next = sessionState.status === 'connected' ? sessionState.wallet : null;
156
+ if (next === wallet) {
157
+ publish();
158
+ return;
159
+ }
160
+ wallet = next;
161
+ generation += 1; // drop the previous wallet's load reply (its call still holds the latch until it settles)
162
+ queued = false; // a queued load was for the previous wallet
163
+ loadInFlight = false;
164
+ state = null;
165
+ loadError = null;
166
+ tokens = null;
167
+ // Another wallet never sees this one's result, but a write whose outcome is unknown stays reported.
168
+ if (outcome !== null && !outcomeUnknown(outcome))
169
+ outcome = null;
170
+ if (next === null) {
171
+ publish();
172
+ return;
173
+ }
174
+ try {
175
+ tokens = open(next, { isActive: () => session.isCurrent(next) });
176
+ }
177
+ catch (error) {
178
+ loadError = (0, errors_1.describeWalletError)(error);
179
+ publish();
180
+ return;
181
+ }
182
+ requestLoad(); // queued while the previous wallet's call is in flight
183
+ }
184
+ const unsubscribe = session.subscribe(onSession);
185
+ onSession();
186
+ return {
187
+ subscribe(listener) {
188
+ listeners.add(listener);
189
+ return () => {
190
+ listeners.delete(listener);
191
+ };
192
+ },
193
+ getSnapshot: () => view,
194
+ refresh() {
195
+ requestLoad();
196
+ },
197
+ async run(id, action, runOptions = {}) {
198
+ // Synchronous, before the first await: a second call in the same tick is refused.
199
+ const ranFor = wallet;
200
+ const ranTokens = tokens;
201
+ if (disposed || inFlight > 0 || queued || ranFor === null || ranTokens === null)
202
+ return false;
203
+ const readOnly = runOptions.readOnly === true;
204
+ const previous = outcome;
205
+ inFlight += 1;
206
+ running = { id, wallet: ranFor, readOnly };
207
+ outcome = null;
208
+ publish();
209
+ // A listener of that publish may have ended the session, switched the wallet or disposed the store: then the
210
+ // action must not start (nothing was sent, so no outcome is recorded), and queued work runs instead. A previous
211
+ // write whose outcome is unknown stays reported, as it does across a wallet change.
212
+ if (!isCurrent(ranFor)) {
213
+ inFlight -= 1;
214
+ running = null;
215
+ if (previous !== null && outcomeUnknown(previous))
216
+ outcome = previous;
217
+ drain();
218
+ return false;
219
+ }
220
+ let settled;
221
+ try {
222
+ const message = await action({ tokens: ranTokens, wallet: ranFor });
223
+ settled = { ok: true, message: typeof message === 'string' ? message : null };
224
+ }
225
+ catch (error) {
226
+ settled = { ok: false, error };
227
+ }
228
+ inFlight -= 1;
229
+ running = null;
230
+ const live = isCurrent(ranFor);
231
+ const { partyId } = ranFor;
232
+ if (!live) {
233
+ // Whether a write committed is unknown, unless the SDK refused it before submitting anything (the token
234
+ // wallet's check before signing, once its session ended mid-write).
235
+ outcome =
236
+ readOnly || (!settled.ok && refusedUnsent(settled.error)) ? null : { id, partyId, status: 'interrupted' };
237
+ }
238
+ else if (settled.ok) {
239
+ outcome = { id, partyId, status: 'succeeded', message: settled.message };
240
+ }
241
+ else {
242
+ outcome = { id, partyId, status: 'failed', error: (0, errors_1.describeWalletError)(settled.error) };
243
+ }
244
+ // A failed write may still have committed, so reload after failures too. This only reads; nothing is retried.
245
+ if (live && !readOnly)
246
+ queued = true;
247
+ // Start the queued load: this write's reload, a refresh asked meanwhile, or the first load of a wallet that
248
+ // replaced this action's one. Busy until it answers.
249
+ drain();
250
+ return live && settled.ok;
251
+ },
252
+ dispose() {
253
+ if (disposed)
254
+ return;
255
+ disposed = true;
256
+ queued = false;
257
+ unsubscribe();
258
+ listeners.clear();
259
+ },
260
+ };
261
+ }
262
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/wallets/store.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,qCAA2C;AAC3C,qCAA8F;AAG9F,iDAA4F;AAoH5F,sHAAsH;AACtH,SAAS,cAAc,CAAC,OAAsB;IAC5C,OAAO,OAAO,CAAC,MAAM,KAAK,aAAa,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAC;AACvH,CAAC;AAED,+FAA+F;AAC/F,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,IAAA,4BAAmB,EAAC,KAAK,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;AACvD,CAAC;AAED,kHAAkH;AAClH,SAAS,eAAe,CAAC,MAAuB,EAAE,OAA+B;IAC/E,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC9C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,yBAAgB,CACxB,eAAe,EACf,yGAAyG,CAC1G,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,gCAAiB,EAAC,EAAE,QAAQ,EAAE,OAAO,EAA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C,4GAA4G;YAC5G,qDAAqD;YACrD,KAAK,EAAE,CAAC;YACR,OAAO,IAAI,IAAI,OAAO,CAAC,EAAE,CAAC;QAC5B,CAAC;QAED,OAAO;YACL,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,MAAM,GAAG,KAAK,CAAC;YACf,WAAW,EAAE,CAAC;YACd,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -7,6 +7,7 @@
7
7
  * interface ids (`utils/token-standard/v1/constants`). Both modules are dependency-free, so this module can import them
8
8
  * and stay browser-safe.
9
9
  */
10
+ import type { ActiveContract, ContractFilter } from './types';
10
11
  /**
11
12
  * `Module:Entity` of a template or interface id in either form (`#pkg-name:M:E` or `pkgId:M:E`), or null when the id is
12
13
  * not of that shape.
@@ -18,4 +19,18 @@ export declare function sameQualifiedName(left: string, right: string): boolean;
18
19
  export declare function packageNameOf(id: string): string | null;
19
20
  /** `Module:Entity` of one of the SDK's own id constants; throws on a malformed constant rather than matching nothing. */
20
21
  export declare function requireQualifiedName(id: string): string;
22
+ /** A stable key of a filter: `t:<templateId>` or `i:<interfaceId>`. */
23
+ export declare function contractFilterKey(filter: ContractFilter): string;
24
+ /**
25
+ * Whether a contract of a snapshot read with several filters at once is one the given filter would have returned on its
26
+ * own: of the template, or carrying a view of the interface (the ledger computes views only for the interfaces the read
27
+ * asked for).
28
+ *
29
+ * A template match needs proven package identity, not just the same `Module:Entity`: a cumulative read also returns
30
+ * contracts matched only by one of its interface filters, and any party can create a template of that name in its own
31
+ * package. So a package-name filter (`#pkg:M:E`) matches only a contract whose `packageName` is that package; the
32
+ * Ledger JSON API v2 (Canton 3.x) always reports `createdEvent.packageName` (a required field), so a contract without
33
+ * one is not classified at all (fail closed). A package-id filter matches only the exact template id.
34
+ */
35
+ export declare function contractMatchesFilter(contract: ActiveContract, filter: ContractFilter): boolean;
21
36
  //# sourceMappingURL=templates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvD;AAED,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,8GAA8G;AAC9G,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvD;AAED,yHAAyH;AACzH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAIvD"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvD;AAED,0GAA0G;AAC1G,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,8GAA8G;AAC9G,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvD;AAED,yHAAyH;AACzH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAEhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAgB/F"}
@@ -1,18 +1,11 @@
1
1
  "use strict";
2
- /**
3
- * Comparing template and interface ids across their two forms: package-name (`#package-name:Module:Entity`, as the
4
- * SDK's constants spell them so they survive DAR upgrades) and package-id (`pkgId:Module:Entity`, as the ledger reports
5
- * them).
6
- *
7
- * The ids themselves are the SDK's own: `DA_REGISTRY_TEMPLATES` (`da-registry/templates`) and the token standard V1
8
- * interface ids (`utils/token-standard/v1/constants`). Both modules are dependency-free, so this module can import them
9
- * and stay browser-safe.
10
- */
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.qualifiedName = qualifiedName;
13
4
  exports.sameQualifiedName = sameQualifiedName;
14
5
  exports.packageNameOf = packageNameOf;
15
6
  exports.requireQualifiedName = requireQualifiedName;
7
+ exports.contractFilterKey = contractFilterKey;
8
+ exports.contractMatchesFilter = contractMatchesFilter;
16
9
  /**
17
10
  * `Module:Entity` of a template or interface id in either form (`#pkg-name:M:E` or `pkgId:M:E`), or null when the id is
18
11
  * not of that shape.
@@ -43,4 +36,35 @@ function requireQualifiedName(id) {
43
36
  throw new TypeError(`Malformed template id ${id}`);
44
37
  return name;
45
38
  }
39
+ /** A stable key of a filter: `t:<templateId>` or `i:<interfaceId>`. */
40
+ function contractFilterKey(filter) {
41
+ return 'templateId' in filter ? `t:${filter.templateId}` : `i:${filter.interfaceId}`;
42
+ }
43
+ /**
44
+ * Whether a contract of a snapshot read with several filters at once is one the given filter would have returned on its
45
+ * own: of the template, or carrying a view of the interface (the ledger computes views only for the interfaces the read
46
+ * asked for).
47
+ *
48
+ * A template match needs proven package identity, not just the same `Module:Entity`: a cumulative read also returns
49
+ * contracts matched only by one of its interface filters, and any party can create a template of that name in its own
50
+ * package. So a package-name filter (`#pkg:M:E`) matches only a contract whose `packageName` is that package; the
51
+ * Ledger JSON API v2 (Canton 3.x) always reports `createdEvent.packageName` (a required field), so a contract without
52
+ * one is not classified at all (fail closed). A package-id filter matches only the exact template id.
53
+ */
54
+ function contractMatchesFilter(contract, filter) {
55
+ if ('templateId' in filter) {
56
+ if (!sameQualifiedName(contract.templateId, filter.templateId))
57
+ return false;
58
+ const filterPackage = packageNameOf(filter.templateId);
59
+ return filterPackage === null
60
+ ? contract.templateId === filter.templateId
61
+ : contract.packageName !== undefined && contract.packageName === filterPackage;
62
+ }
63
+ // Same rule for interfaces: a package-id filter (`pkgId:M:E`) matches only that exact interface id, so two
64
+ // same-named interfaces from different packages in one cumulative read are never mixed up; a package-name filter
65
+ // (`#pkg:M:E`) matches by name (the ledger reports a view's interface id with the package id it resolved).
66
+ return contract.interfaceViews.some((view) => packageNameOf(filter.interfaceId) === null
67
+ ? view.interfaceId === filter.interfaceId
68
+ : sameQualifiedName(view.interfaceId, filter.interfaceId));
69
+ }
46
70
  //# sourceMappingURL=templates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/wallets/templates.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;AAEH;;;GAGG;AACH,uBAA8B,EAAU;IACtC,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACrC,OAAO,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC;AAED,0GAA0G;AAC1G,2BAAkC,IAAY,EAAE,KAAa;IAC3D,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,aAAa,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,8GAA8G;AAC9G,uBAA8B,EAAU;IACtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,SAA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C,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAC5D,CAAC;AACJ,CAAC"}
@@ -22,9 +22,11 @@ export interface FactoryWithChoiceContext extends ChoiceContext {
22
22
  /**
23
23
  * How the registry will run a transfer:
24
24
  *
25
- * - `offer`: a pending transfer the receiver must accept;
25
+ * - `offer`: a pending transfer the receiver must accept before it expires. The sender's tokens stay locked until the
26
+ * offer is accepted, rejected by the receiver or withdrawn by the sender; expiry alone only stops acceptance and does
27
+ * not unlock them (withdraw an expired offer to get them back);
26
28
  * - `direct`: the receiver pre-approved transfers, so the holdings move at once;
27
- * - `self`: sender and receiver are the same party.
29
+ * - `self`: sender and receiver are the same party (the holdings are merged or split).
28
30
  */
29
31
  export type TransferKind = 'offer' | 'direct' | 'self';
30
32
  export interface TransferFactory extends FactoryWithChoiceContext {
@@ -62,12 +64,23 @@ export interface TokenRegistry {
62
64
  * lists and spends only the ones this returns true for.
63
65
  */
64
66
  servesHolding(contract: ActiveContract): boolean;
67
+ /**
68
+ * Filters a token wallet reads holdings with besides the CIP-56 HoldingV1 interface, for example the registry's own
69
+ * holding template, whose create argument still reads when the ledger could not compute a HoldingV1 view. Every read
70
+ * of holdings (a write's fresh read and the state snapshot) uses the same filters, and the same `servesHolding`.
71
+ */
72
+ readonly holdingFilters?: readonly ContractFilter[];
65
73
  /**
66
74
  * This registry's pending transfers (CIP-56 TransferInstructions) visible to the wallet, read through `read` and
67
75
  * checked to be genuine (made by the registry, not a look-alike any party could create). Both directions: the caller
68
76
  * splits them by sender and receiver.
69
77
  */
70
78
  pendingTransfers(read: ReadContracts): Promise<TransferOffer[]>;
79
+ /**
80
+ * The filters `pendingTransfers` reads. A token wallet adds them to its one state snapshot, so listing pending
81
+ * transfers costs no ledger read of its own; a read of any other filter goes to the wallet separately.
82
+ */
83
+ readonly pendingTransferFilters?: readonly ContractFilter[];
71
84
  /**
72
85
  * `Module:Entity` names of the templates this registry's transfer factory may have. A factory of any other template
73
86
  * is refused before anything is signed.
@@ -1 +1 @@
1
- {"version":3,"file":"token-registry.d.ts","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE/F,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;CAC7B;AAED,8GAA8G;AAC9G,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,kBAAkB,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC3D;AAED,sDAAsD;AACtD,MAAM,WAAW,wBAAyB,SAAQ,aAAa;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvD,MAAM,WAAW,eAAgB,SAAQ,wBAAwB;IAC/D,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,sBAAsB;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,gBAAgB;IAChB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gBAAgB;IAChB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAA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BAAoC;IAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,mDAAmD,CAAC;IAC7D,CAAC;IACD,MAAM,IAAI,GAAG,IAAA,yBAAa,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACjD,OAAO,IAAI,KAAK,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,2DAA2D,SAAS,CAAC,UAAU,IAAI,CAAC;AAC1F,CAAC"}
1
+ {"version":3,"file":"token-registry.js","sourceRoot":"","sources":["../../../src/wallets/token-registry.ts"],"names":[],"mappings":";;;AAOA,2CAA4C;AAkG5C;;;GAGG;AACH,8BACE,OAAiC,EACjC,iBAAoC;IAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3G,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,mDAAmD,CAAC;IAC7D,CAAC;IACD,MAAM,IAAI,GAAG,IAAA,yBAAa,EAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACjD,OAAO,IAAI,KAAK,IAAI,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtD,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,2DAA2D,SAAS,CAAC,UAAU,IAAI,CAAC;AAC1F,CAAC"}
@@ -3,11 +3,11 @@
3
3
  * the registry's holdings, preview and run a transfer, and answer pending transfers. Registry-specific actions (DA's
4
4
  * mint offers, burn requests and preapprovals) build on it in `token-wallet.ts`.
5
5
  */
6
- import { type Cip103Provider, type Cip103Wallet } from './cip103';
6
+ import { type Cip103Provider, type Cip103Wallet, type WalletReadRetryOptions } from './cip103';
7
7
  import type { TransferOffer } from './contracts';
8
- import { type Holding } from './holdings';
9
- import { type TokenRegistry, type TransferKind } from './token-registry';
10
- import type { InstrumentId, SubmitResult } from './types';
8
+ import { type Holding, type InstrumentBalance } from './holdings';
9
+ import { type ReadContracts, type TokenRegistry, type TransferInstructionAction, type TransferKind } from './token-registry';
10
+ import type { ContractFilter, InstrumentId, SubmitResult } from './types';
11
11
  /** Transfers: `executeBefore` = now + 24 h, a common wallet default. */
12
12
  export declare const TRANSFER_TTL_MS: number;
13
13
  /**
@@ -21,11 +21,36 @@ export interface TokenStandardWalletOptions<R extends TokenRegistry = TokenRegis
21
21
  * `@canton-network/dapp-sdk` provider, `window.canton`, …
22
22
  */
23
23
  readonly provider: Cip103Provider;
24
- /** Act as this party. Defaults to the wallet's primary account, read on every action. */
24
+ /**
25
+ * Act as this party. Defaults to the wallet's primary account, read on every action (a `TransferPlan` keeps the party
26
+ * it was previewed for, and refuses to submit as another).
27
+ */
25
28
  readonly partyId?: string;
26
29
  readonly registry: R;
27
30
  /** Defaults to the system clock. */
28
31
  readonly now?: () => Date;
32
+ /** How reads back off when the wallet rate-limits them (CIP-0103 -32005). Writes are never retried. */
33
+ readonly readRetry?: WalletReadRetryOptions;
34
+ /**
35
+ * Whether the wallet session this token wallet belongs to is still live. Once it answers false, every write (a
36
+ * transfer, a `TransferPlan`'s `submit`, an offer answer, a mint accept, a burn request, a preapproval) is refused
37
+ * with `invalid-input` before its first read, and again right before the wallet signs, so nothing is submitted: the
38
+ * provider may now be signed in to another account. Reads are not limited. `createTokenWalletStore` passes its
39
+ * session's `isCurrent(wallet)`. Default: always live.
40
+ */
41
+ readonly isActive?: () => boolean;
42
+ }
43
+ /** The CIP-56 state of the wallet party, read as one snapshot. */
44
+ export interface TokenStandardState {
45
+ /** The party the snapshot was read for. */
46
+ readonly partyId: string;
47
+ /** The ledger offset every list was read at. */
48
+ readonly offset: number;
49
+ /** The wallet party's holdings this registry serves, locked ones included. */
50
+ readonly holdings: Holding[];
51
+ /** `holdings` summed per instrument (unlocked and locked apart), sorted by instrument id then admin. */
52
+ readonly balances: InstrumentBalance[];
53
+ readonly transferOffers: TransferOffers;
29
54
  }
30
55
  export interface TransferRequest {
31
56
  readonly receiver: string;
@@ -50,6 +75,29 @@ export interface TransferOptions extends TransferRequest {
50
75
  export interface TransferResult extends SubmitResult {
51
76
  readonly kind: TransferKind;
52
77
  }
78
+ /**
79
+ * A previewed transfer, for a dApp that shows the user how the registry will run it before they confirm. `submit` sends
80
+ * exactly the planned request through the token wallet that planned it, as the party it was previewed for and with
81
+ * `expectedKind: kind`: a transfer whose kind changed in between is refused with `kind-changed`, and one whose wallet
82
+ * now acts as another party (an account switch, without a pinned `partyId`) with `invalid-input`, both before signing.
83
+ *
84
+ * A plan is bound to the wallet session that made it: when that token wallet's `isActive` answers false (the token
85
+ * wallets `createTokenWalletStore` opens: their `ConnectedWallet` is no longer the session's), `submit` is refused with
86
+ * `invalid-input` and nothing is submitted, also when its `partyId` is pinned. Plan again in the current session.
87
+ */
88
+ export interface TransferPlan {
89
+ /** How the registry would run the transfer when it was planned. */
90
+ readonly kind: TransferKind;
91
+ /** The party the transfer was previewed for, and the only one `submit` sends it as. */
92
+ readonly partyId: string;
93
+ /** The request as planned (a frozen copy). */
94
+ readonly request: Readonly<TransferRequest>;
95
+ /** Run the transfer (a write: one at a time, see `TokenStandardWallet`). */
96
+ submit(options?: {
97
+ readonly memo?: string;
98
+ readonly requirePreapproval?: boolean;
99
+ }): Promise<TransferResult>;
100
+ }
53
101
  export interface TransferOffers {
54
102
  /** Offers to the wallet party, which it can accept or reject. */
55
103
  readonly incoming: TransferOffer[];
@@ -60,19 +108,33 @@ export interface TransferOffers {
60
108
  * The CIP-56 actions on one registry's instruments. One write action at a time: a write started while another is in
61
109
  * progress (from its first read to its submission's outcome) is refused at once with `busy`, so two writes never pick
62
110
  * the same holdings. Reads and previews are not limited.
111
+ *
112
+ * Reads: `loadState` and the `list*` methods all read one snapshot (one ledger-end call and one paged ACS stream with
113
+ * every filter the wallet needs; a registry that declares no `pendingTransferFilters` costs one more ACS stream, read
114
+ * at the same offset), and calls made while a snapshot is in flight share it instead of reading again, unless a write
115
+ * settled since it started. Load a page with `loadState`; writes do their own fresh reads.
63
116
  */
64
117
  export interface TokenStandardWallet {
65
118
  /** The party every action reads and acts as. */
66
119
  partyId(): Promise<string>;
120
+ /** Holdings and transfer offers, from one snapshot. */
121
+ loadState(): Promise<TokenStandardState>;
67
122
  /** The wallet party's holdings this registry serves, locked ones included (`locked: true`). */
68
123
  listHoldings(): Promise<Holding[]>;
69
124
  /** How the registry would run this transfer, without submitting it. */
70
125
  previewTransfer(request: TransferRequest): Promise<TransferKind>;
126
+ /** Preview a transfer and keep it to submit once the user confirmed the kind (see {@link TransferPlan}). */
127
+ planTransfer(request: TransferRequest): Promise<TransferPlan>;
71
128
  transfer(options: TransferOptions): Promise<TransferResult>;
72
129
  listTransferOffers(): Promise<TransferOffers>;
73
130
  acceptTransferOffer(transferOfferCid: string): Promise<SubmitResult>;
74
131
  rejectTransferOffer(transferOfferCid: string): Promise<SubmitResult>;
75
132
  withdrawTransferOffer(transferOfferCid: string): Promise<SubmitResult>;
133
+ /**
134
+ * Answer a transfer offer: `accept` or `reject` an incoming one, `withdraw` an outgoing one (the same as the three
135
+ * methods above). Any other action is refused with `invalid-input`.
136
+ */
137
+ answerTransferOffer(transferOfferCid: string, action: TransferInstructionAction): Promise<SubmitResult>;
76
138
  }
77
139
  export declare function requireNonEmpty(value: string, field: string): string;
78
140
  /** Milliseconds of a caller's `Date`; `invalid-input` for an invalid one (NaN), which `toISOString` would throw on. */
@@ -80,6 +142,18 @@ export declare function requireTime(date: Date, field: string): number;
80
142
  /** ISO-8601 of a time in milliseconds; `invalid-input` when it is outside the `Date` range. */
81
143
  export declare function isoTime(ms: number, field: string): string;
82
144
  export declare function requireInstrumentId(instrumentId: InstrumentId): InstrumentId;
145
+ /** One state snapshot of the wallet party. */
146
+ export interface StateSnapshot {
147
+ readonly wallet: Cip103Wallet;
148
+ readonly offset: number;
149
+ /** The wallet party's holdings the registry serves, selected from the snapshot as a write's fresh read selects them. */
150
+ readonly holdings: Holding[];
151
+ /**
152
+ * Serves the snapshot's own filters from the snapshot; any other filter is read from the wallet at the snapshot's
153
+ * offset (once per filter), so every list read through it belongs to the same snapshot.
154
+ */
155
+ readonly read: ReadContracts;
156
+ }
83
157
  /** What a registry-specific extension builds on: the wallet as the current party, its holdings, the write guard. */
84
158
  export interface TokenStandardCore {
85
159
  readonly api: TokenStandardWallet;
@@ -87,16 +161,27 @@ export interface TokenStandardCore {
87
161
  readonly now: () => number;
88
162
  /** The wallet as the current party: resolved per action, so an account switch in the wallet is followed. */
89
163
  readonly connect: () => Promise<Cip103Wallet>;
90
- /** The party's unlocked and locked holdings that the registry serves. */
164
+ /** The party's unlocked and locked holdings that the registry serves, freshly read (for writes). */
91
165
  readonly holdingsOf: (wallet: Cip103Wallet) => Promise<Holding[]>;
166
+ /**
167
+ * One snapshot of every state filter (holdings, the registry's pending transfers and the extension's own filters).
168
+ * Concurrent calls for the same party share the snapshot in flight unless a write settled since it started.
169
+ */
170
+ readonly snapshot: () => Promise<StateSnapshot>;
171
+ /** The CIP-56 state in a snapshot. */
172
+ readonly stateOf: (snapshot: StateSnapshot) => Promise<TokenStandardState>;
92
173
  /**
93
174
  * Run a write action alone: refused with `busy` (before `action` starts) while another write of this token wallet is
94
- * in progress, and released when `action` settles, whether it succeeded or failed.
175
+ * in progress, and released when `action` settles, whether it succeeded or failed. Refused with `invalid-input`
176
+ * (before `action` starts) once `isActive` answers false; a wallet from `connect` checks it again before it submits.
95
177
  */
96
178
  readonly exclusive: <T>(action: () => Promise<T>) => Promise<T>;
97
179
  }
98
- /** The generic CIP-56 core; `createTokenWallet` adds DA's actions on top of it. */
99
- export declare function tokenStandardCore(options: TokenStandardWalletOptions): TokenStandardCore;
180
+ /**
181
+ * The generic CIP-56 core; `createTokenWallet` adds DA's actions on top of it, and its own filters to the state
182
+ * snapshot through `extraStateFilters`.
183
+ */
184
+ export declare function tokenStandardCore(options: TokenStandardWalletOptions, extraStateFilters?: readonly ContractFilter[]): TokenStandardCore;
100
185
  /**
101
186
  * CIP-56 holder actions on the instruments of any `TokenRegistry` through a CIP-0103 provider. For DA Utility Registry
102
187
  * instruments use `createTokenWallet`, which adds DA's mint, burn and preapproval actions.
@@ -1 +1 @@
1
- {"version":3,"file":"token-standard-wallet.d.ts","sourceRoot":"","sources":["../../../src/wallets/token-standard-wallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAgC,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAEhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAgC,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAKxE,OAAO,EAEL,KAAK,aAAa,EAGlB,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK1D,wEAAwE;AACxE,eAAO,MAAM,eAAe,QAAS,CAAC;AACtC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAiB,CAAC;AAEnD,MAAM,WAAW,0BAA0B,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACjF;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,yFAAyF;IACzF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrB,oCAAoC;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC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