@miden-sdk/miden-sdk 0.14.5 → 0.14.9

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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -18
  3. package/dist/mt/Cargo-DKB2aRX-.js +25826 -0
  4. package/dist/mt/Cargo-DKB2aRX-.js.map +1 -0
  5. package/dist/{api-types.d.ts → mt/api-types.d.ts} +18 -3
  6. package/dist/mt/assets/miden_client_web.wasm +0 -0
  7. package/dist/mt/crates/miden_client_web.d.ts +4726 -0
  8. package/dist/{docs-entry.d.ts → mt/docs-entry.d.ts} +2 -2
  9. package/dist/mt/eager.js +35 -0
  10. package/dist/mt/eager.js.map +1 -0
  11. package/dist/{index.d.ts → mt/index.d.ts} +9 -7
  12. package/dist/mt/index.js +3371 -0
  13. package/dist/mt/index.js.map +1 -0
  14. package/dist/{wasm.js → mt/wasm.js} +1 -1
  15. package/dist/mt/wasm.js.map +1 -0
  16. package/dist/mt/workerHelpers.js +28 -0
  17. package/dist/mt/workers/Cargo-DKB2aRX--C6T4l3AF.js +25827 -0
  18. package/dist/mt/workers/Cargo-DKB2aRX--C6T4l3AF.js.map +1 -0
  19. package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
  20. package/dist/mt/workers/web-client-methods-worker.js +26560 -0
  21. package/dist/mt/workers/web-client-methods-worker.js.map +1 -0
  22. package/dist/{workers → mt/workers}/web-client-methods-worker.module.js +17 -1
  23. package/dist/mt/workers/web-client-methods-worker.module.js.map +1 -0
  24. package/dist/mt/workers/workerHelpers.js +28 -0
  25. package/dist/{Cargo-M3382VZc.js → st/Cargo-jOTNoFyS.js} +6714 -5926
  26. package/dist/st/Cargo-jOTNoFyS.js.map +1 -0
  27. package/dist/st/api-types.d.ts +1051 -0
  28. package/dist/{workers → st}/assets/miden_client_web.wasm +0 -0
  29. package/dist/{crates → st/crates}/miden_client_web.d.ts +31 -0
  30. package/dist/st/docs-entry.d.ts +35 -0
  31. package/dist/{eager.js → st/eager.js} +1 -1
  32. package/dist/st/eager.js.map +1 -0
  33. package/dist/st/index.d.ts +89 -0
  34. package/dist/{index.js → st/index.js} +126 -13
  35. package/dist/st/index.js.map +1 -0
  36. package/dist/st/wasm.js +23 -0
  37. package/dist/st/wasm.js.map +1 -0
  38. package/dist/{workers/Cargo-M3382VZc-Dfw4tXwh.js → st/workers/Cargo-jOTNoFyS-DRTcF6wf.js} +6714 -5926
  39. package/dist/st/workers/Cargo-jOTNoFyS-DRTcF6wf.js.map +1 -0
  40. package/dist/{assets → st/workers/assets}/miden_client_web.wasm +0 -0
  41. package/dist/{workers → st/workers}/web-client-methods-worker.js +6731 -5926
  42. package/dist/st/workers/web-client-methods-worker.js.map +1 -0
  43. package/dist/st/workers/web-client-methods-worker.module.js +571 -0
  44. package/dist/st/workers/web-client-methods-worker.module.js.map +1 -0
  45. package/lazy/package.json +4 -0
  46. package/mt/lazy/package.json +4 -0
  47. package/mt/package.json +4 -0
  48. package/package.json +66 -44
  49. package/dist/Cargo-M3382VZc.js.map +0 -1
  50. package/dist/eager.js.map +0 -1
  51. package/dist/index.js.map +0 -1
  52. package/dist/wasm.js.map +0 -1
  53. package/dist/workers/Cargo-M3382VZc-Dfw4tXwh.js.map +0 -1
  54. package/dist/workers/web-client-methods-worker.js.map +0 -1
  55. package/dist/workers/web-client-methods-worker.module.js.map +0 -1
@@ -0,0 +1,4726 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Specifies which procedures an account accepts, and by extension which notes it can consume.
5
+ */
6
+
7
+ type AddressInterface = "BasicWallet";
8
+ /**
9
+ * The `ReadableStreamType` enum.
10
+ *
11
+ * *This API requires the following crate features to be activated: `ReadableStreamType`*
12
+ */
13
+
14
+ type ReadableStreamType = "bytes";
15
+
16
+ /**
17
+ * An account which can store assets and define rules for manipulating them.
18
+ *
19
+ * An account consists of the following components:
20
+ * - Account ID, which uniquely identifies the account and also defines basic properties of the
21
+ * account.
22
+ * - Account vault, which stores assets owned by the account.
23
+ * - Account storage, which is a key-value map (both keys and values are words) used to store
24
+ * arbitrary user-defined data.
25
+ * - Account code, which is a set of Miden VM programs defining the public interface of the
26
+ * account.
27
+ * - Account nonce, a value which is incremented whenever account state is updated.
28
+ *
29
+ * Out of the above components account ID is always immutable (once defined it can never be
30
+ * changed). Other components may be mutated throughout the lifetime of the account. However,
31
+ * account state can be changed only by invoking one of account interface methods.
32
+ *
33
+ * The recommended way to build an account is through an `AccountBuilder`, which can be
34
+ * instantiated directly from a 32-byte seed.
35
+ */
36
+ export class Account {
37
+ private constructor();
38
+ free(): void;
39
+ [Symbol.dispose](): void;
40
+ /**
41
+ * Returns the code commitment for this account.
42
+ */
43
+ code(): AccountCode;
44
+ /**
45
+ * Restores an account from its serialized bytes.
46
+ */
47
+ static deserialize(bytes: Uint8Array): Account;
48
+ /**
49
+ * Returns the public key commitments derived from the account's authentication scheme.
50
+ */
51
+ getPublicKeyCommitments(): Word[];
52
+ /**
53
+ * Returns the account identifier.
54
+ */
55
+ id(): AccountId;
56
+ /**
57
+ * Returns true if the account is a faucet.
58
+ */
59
+ isFaucet(): boolean;
60
+ /**
61
+ * Returns true if this is a network-owned account.
62
+ */
63
+ isNetwork(): boolean;
64
+ /**
65
+ * Returns true if the account has not yet been committed to the chain.
66
+ */
67
+ isNew(): boolean;
68
+ /**
69
+ * Returns true if the account storage is private.
70
+ */
71
+ isPrivate(): boolean;
72
+ /**
73
+ * Returns true if the account exposes public storage.
74
+ */
75
+ isPublic(): boolean;
76
+ /**
77
+ * Returns true if the account is a regular account (immutable or updatable code).
78
+ */
79
+ isRegularAccount(): boolean;
80
+ /**
81
+ * Returns true if the account can update its code.
82
+ */
83
+ isUpdatable(): boolean;
84
+ /**
85
+ * Returns the account nonce, which is incremented on every state update.
86
+ */
87
+ nonce(): Felt;
88
+ /**
89
+ * Serializes the account into bytes.
90
+ */
91
+ serialize(): Uint8Array;
92
+ /**
93
+ * Returns the account storage commitment.
94
+ */
95
+ storage(): AccountStorage;
96
+ /**
97
+ * Returns the commitment to the account header, storage, and code.
98
+ */
99
+ to_commitment(): Word;
100
+ /**
101
+ * Returns the vault commitment for this account.
102
+ */
103
+ vault(): AssetVault;
104
+ }
105
+
106
+ export class AccountArray {
107
+ /**
108
+ ** Return copy of self without private attributes.
109
+ */
110
+ toJSON(): Object;
111
+ /**
112
+ * Return stringified version of self.
113
+ */
114
+ toString(): string;
115
+ free(): void;
116
+ [Symbol.dispose](): void;
117
+ /**
118
+ * Get element at index, will always return a clone to avoid aliasing issues.
119
+ */
120
+ get(index: number): Account;
121
+ length(): number;
122
+ constructor(elements?: Account[] | null);
123
+ push(element: Account): void;
124
+ /**
125
+ * Replace the element at `index`. Borrows + clones the input
126
+ * (mirrors `push`), so the caller's JS handle remains valid
127
+ * after the call. Without this borrow, passing `elem` by
128
+ * value would move the underlying Rust value out of the
129
+ * caller's JS handle and any subsequent method on it would
130
+ * panic with `"null pointer passed to rust"`.
131
+ */
132
+ replaceAt(index: number, elem: Account): void;
133
+ }
134
+
135
+ export class AccountBuilder {
136
+ free(): void;
137
+ [Symbol.dispose](): void;
138
+ /**
139
+ * Sets the account type (regular, faucet, etc.).
140
+ *
141
+ * Accepts either a numeric WASM enum value (0–3) or a string name
142
+ * (`"FungibleFaucet"`, `"NonFungibleFaucet"`,
143
+ * `"RegularAccountImmutableCode"`, `"RegularAccountUpdatableCode"`).
144
+ */
145
+ accountType(account_type: any): AccountBuilder;
146
+ /**
147
+ * Builds the account and returns it together with the derived seed.
148
+ */
149
+ build(): AccountBuilderResult;
150
+ /**
151
+ * Creates a new account builder from a 32-byte initial seed.
152
+ */
153
+ constructor(init_seed: Uint8Array);
154
+ /**
155
+ * Sets the storage mode (public/private) for the account.
156
+ */
157
+ storageMode(storage_mode: AccountStorageMode): AccountBuilder;
158
+ /**
159
+ * Adds an authentication component to the account.
160
+ */
161
+ withAuthComponent(account_component: AccountComponent): AccountBuilder;
162
+ withBasicWalletComponent(): AccountBuilder;
163
+ /**
164
+ * Adds a component to the account.
165
+ */
166
+ withComponent(account_component: AccountComponent): AccountBuilder;
167
+ /**
168
+ * Adds a no-auth component to the account (for public accounts).
169
+ */
170
+ withNoAuthComponent(): AccountBuilder;
171
+ }
172
+
173
+ export class AccountBuilderResult {
174
+ private constructor();
175
+ free(): void;
176
+ [Symbol.dispose](): void;
177
+ /**
178
+ * Returns the built account.
179
+ */
180
+ readonly account: Account;
181
+ /**
182
+ * Returns the seed used to derive the account ID.
183
+ */
184
+ readonly seed: Word;
185
+ }
186
+
187
+ /**
188
+ * A public interface of an account.
189
+ *
190
+ * Account's public interface consists of a set of callable procedures, each committed to by its
191
+ * root hash and paired with storage bounds (offset and size).
192
+ *
193
+ * The full interface commitment hashes every procedure root together with its storage bounds so
194
+ * that the account code uniquely captures the set of available calls.
195
+ */
196
+ export class AccountCode {
197
+ private constructor();
198
+ free(): void;
199
+ [Symbol.dispose](): void;
200
+ /**
201
+ * Returns the code commitment for the account.
202
+ */
203
+ commitment(): Word;
204
+ /**
205
+ * Returns true if the account code exports a procedure with the given MAST root.
206
+ */
207
+ hasProcedure(mast_root: Word): boolean;
208
+ }
209
+
210
+ export class AccountComponent {
211
+ private constructor();
212
+ free(): void;
213
+ [Symbol.dispose](): void;
214
+ /**
215
+ * Compiles account code with the given storage slots using the provided assembler.
216
+ */
217
+ static compile(account_code: AccountComponentCode, storage_slots: StorageSlot[]): AccountComponent;
218
+ static createAuthComponentFromCommitment(commitment: Word, auth_scheme: AuthScheme): AccountComponent;
219
+ /**
220
+ * Builds an auth component from a secret key, inferring the auth scheme from the key type.
221
+ */
222
+ static createAuthComponentFromSecretKey(secret_key: AuthSecretKey): AccountComponent;
223
+ /**
224
+ * Creates an account component from a compiled library and storage slots.
225
+ */
226
+ static fromLibrary(library: Library, storage_slots: StorageSlot[]): AccountComponent;
227
+ /**
228
+ * Creates an account component from a compiled package and storage slots.
229
+ */
230
+ static fromPackage(_package: Package, storage_slots: StorageSlotArray): AccountComponent;
231
+ /**
232
+ * Returns the hex-encoded MAST root for a procedure by name.
233
+ *
234
+ * Matches by full path, relative path, or local name (after the last `::`).
235
+ * When matching by local name, if multiple procedures share the same local
236
+ * name across modules, the first match is returned.
237
+ */
238
+ getProcedureHash(procedure_name: string): string;
239
+ /**
240
+ * Returns all procedures exported by this component.
241
+ */
242
+ getProcedures(): GetProceduresResultItem[];
243
+ /**
244
+ * Marks the component as supporting all account types.
245
+ */
246
+ withSupportsAllTypes(): AccountComponent;
247
+ }
248
+
249
+ /**
250
+ * A Library that has been assembled for use as component code.
251
+ */
252
+ export class AccountComponentCode {
253
+ private constructor();
254
+ free(): void;
255
+ [Symbol.dispose](): void;
256
+ /**
257
+ * Returns the underlying Library
258
+ */
259
+ asLibrary(): Library;
260
+ }
261
+
262
+ /**
263
+ * `AccountDelta` stores the differences between two account states.
264
+ *
265
+ * The differences are represented as follows:
266
+ * - `storage`: an `AccountStorageDelta` that contains the changes to the account storage.
267
+ * - `vault`: an `AccountVaultDelta` object that contains the changes to the account vault.
268
+ * - `nonce`: if the nonce of the account has changed, the new nonce is stored here.
269
+ */
270
+ export class AccountDelta {
271
+ private constructor();
272
+ free(): void;
273
+ [Symbol.dispose](): void;
274
+ /**
275
+ * Deserializes an account delta from bytes.
276
+ */
277
+ static deserialize(bytes: Uint8Array): AccountDelta;
278
+ /**
279
+ * Returns the affected account ID.
280
+ */
281
+ id(): AccountId;
282
+ /**
283
+ * Returns true if there are no changes.
284
+ */
285
+ isEmpty(): boolean;
286
+ /**
287
+ * Returns the nonce change.
288
+ */
289
+ nonceDelta(): Felt;
290
+ /**
291
+ * Serializes the account delta into bytes.
292
+ */
293
+ serialize(): Uint8Array;
294
+ /**
295
+ * Returns the storage delta.
296
+ */
297
+ storage(): AccountStorageDelta;
298
+ /**
299
+ * Returns the vault delta.
300
+ */
301
+ vault(): AccountVaultDelta;
302
+ }
303
+
304
+ export class AccountFile {
305
+ private constructor();
306
+ free(): void;
307
+ [Symbol.dispose](): void;
308
+ /**
309
+ * Returns the account data.
310
+ */
311
+ account(): Account;
312
+ /**
313
+ * Returns the account ID.
314
+ */
315
+ accountId(): AccountId;
316
+ /**
317
+ * Returns the number of auth secret keys included.
318
+ */
319
+ authSecretKeyCount(): number;
320
+ /**
321
+ * Deserializes a byte array into an `AccountFile`
322
+ */
323
+ static deserialize(bytes: Uint8Array): AccountFile;
324
+ /**
325
+ * Serializes the `AccountFile` into a byte array
326
+ */
327
+ serialize(): Uint8Array;
328
+ }
329
+
330
+ /**
331
+ * A header of an account which contains information that succinctly describes the state of the
332
+ * components of the account.
333
+ *
334
+ * The account header is composed of:
335
+ * - `id`: the account ID (`AccountId`).
336
+ * - `nonce`: the nonce of the account.
337
+ * - `vault_root`: a commitment to the account's vault (`AssetVault`).
338
+ * - `storage_commitment`: a commitment to the account's storage (`AccountStorage`).
339
+ * - `code_commitment`: a commitment to the account's code (`AccountCode`).
340
+ */
341
+ export class AccountHeader {
342
+ private constructor();
343
+ free(): void;
344
+ [Symbol.dispose](): void;
345
+ /**
346
+ * Returns the code commitment.
347
+ */
348
+ codeCommitment(): Word;
349
+ /**
350
+ * Returns the account ID.
351
+ */
352
+ id(): AccountId;
353
+ /**
354
+ * Returns the current nonce.
355
+ */
356
+ nonce(): Felt;
357
+ /**
358
+ * Returns the storage commitment.
359
+ */
360
+ storageCommitment(): Word;
361
+ /**
362
+ * Returns the full account commitment.
363
+ */
364
+ to_commitment(): Word;
365
+ /**
366
+ * Returns the vault commitment.
367
+ */
368
+ vaultCommitment(): Word;
369
+ }
370
+
371
+ /**
372
+ * Uniquely identifies a specific account.
373
+ *
374
+ * A Miden account ID is a 120-bit value derived from the commitments to account code and storage,
375
+ * and a random user-provided seed.
376
+ */
377
+ export class AccountId {
378
+ private constructor();
379
+ free(): void;
380
+ [Symbol.dispose](): void;
381
+ /**
382
+ * Given a bech32 encoded string, return the matching Account ID for it.
383
+ */
384
+ static fromBech32(bech_32_encoded_id: string): AccountId;
385
+ /**
386
+ * Builds an account ID from its hex string representation.
387
+ *
388
+ * Returns an error if the provided string is not a valid hex-encoded account ID.
389
+ */
390
+ static fromHex(hex: string): AccountId;
391
+ /**
392
+ * Builds an account ID from its prefix and suffix field elements.
393
+ *
394
+ * This is useful when the account ID components are stored separately (e.g., in storage
395
+ * maps) and need to be recombined into an `AccountId`.
396
+ *
397
+ * Returns an error if the provided felts do not form a valid account ID.
398
+ */
399
+ static fromPrefixSuffix(prefix: Felt, suffix: Felt): AccountId;
400
+ /**
401
+ * Returns true if the ID refers to a faucet.
402
+ */
403
+ isFaucet(): boolean;
404
+ /**
405
+ * Returns true if the ID is reserved for network accounts.
406
+ */
407
+ isNetwork(): boolean;
408
+ /**
409
+ * Returns true if the account uses private storage.
410
+ */
411
+ isPrivate(): boolean;
412
+ /**
413
+ * Returns true if the account uses public storage.
414
+ */
415
+ isPublic(): boolean;
416
+ /**
417
+ * Returns true if the ID refers to a regular account.
418
+ */
419
+ isRegularAccount(): boolean;
420
+ /**
421
+ * Returns the prefix field element storing metadata about version, type, and storage mode.
422
+ */
423
+ prefix(): Felt;
424
+ /**
425
+ * Returns the suffix field element derived from the account seed.
426
+ */
427
+ suffix(): Felt;
428
+ /**
429
+ * Will turn the Account ID into its bech32 string representation.
430
+ */
431
+ toBech32(network_id: NetworkId, account_interface: AccountInterface): string;
432
+ /**
433
+ * Returns the canonical hex representation of the account ID.
434
+ */
435
+ toString(): string;
436
+ }
437
+
438
+ export class AccountIdArray {
439
+ /**
440
+ ** Return copy of self without private attributes.
441
+ */
442
+ toJSON(): Object;
443
+ /**
444
+ * Return stringified version of self.
445
+ */
446
+ toString(): string;
447
+ free(): void;
448
+ [Symbol.dispose](): void;
449
+ /**
450
+ * Get element at index, will always return a clone to avoid aliasing issues.
451
+ */
452
+ get(index: number): AccountId;
453
+ length(): number;
454
+ constructor(elements?: AccountId[] | null);
455
+ push(element: AccountId): void;
456
+ /**
457
+ * Replace the element at `index`. Borrows + clones the input
458
+ * (mirrors `push`), so the caller's JS handle remains valid
459
+ * after the call. Without this borrow, passing `elem` by
460
+ * value would move the underlying Rust value out of the
461
+ * caller's JS handle and any subsequent method on it would
462
+ * panic with `"null pointer passed to rust"`.
463
+ */
464
+ replaceAt(index: number, elem: AccountId): void;
465
+ }
466
+
467
+ export enum AccountInterface {
468
+ /**
469
+ * Basic wallet address interface.
470
+ */
471
+ BasicWallet = 0,
472
+ }
473
+
474
+ /**
475
+ * Proof of existence of an account's state at a specific block number, as returned by the node.
476
+ *
477
+ * For public accounts, this includes the account header, storage slot values, account code,
478
+ * and optionally storage map entries for the requested storage maps.
479
+ * For private accounts, only the account commitment and merkle proof are available.
480
+ */
481
+ export class AccountProof {
482
+ private constructor();
483
+ free(): void;
484
+ [Symbol.dispose](): void;
485
+ /**
486
+ * Returns the account code, if available (public accounts only).
487
+ */
488
+ accountCode(): AccountCode | undefined;
489
+ /**
490
+ * Returns the account commitment (hash of the full state).
491
+ */
492
+ accountCommitment(): Word;
493
+ /**
494
+ * Returns the account header, if available (public accounts only).
495
+ */
496
+ accountHeader(): AccountHeader | undefined;
497
+ /**
498
+ * Returns the account ID.
499
+ */
500
+ accountId(): AccountId;
501
+ /**
502
+ * Returns the block number at which this proof was retrieved.
503
+ */
504
+ blockNum(): number;
505
+ /**
506
+ * Returns storage map entries for a given slot name, if available.
507
+ *
508
+ * Returns `undefined` if the account is private, the slot was not requested in the
509
+ * storage requirements, or the slot is not a map.
510
+ *
511
+ * Each entry contains a `key` and `value` as `Word` objects.
512
+ */
513
+ getStorageMapEntries(slot_name: string): StorageMapEntry[] | undefined;
514
+ /**
515
+ * Returns the names of all storage slots that have map details available.
516
+ *
517
+ * This can be used to discover which storage maps were included in the proof response.
518
+ * Returns `undefined` if the account is private.
519
+ */
520
+ getStorageMapSlotNames(): string[] | undefined;
521
+ /**
522
+ * Returns the value of a storage slot by name, if available.
523
+ *
524
+ * For `Value` slots, this returns the stored word.
525
+ * For `Map` slots, this returns the map root commitment.
526
+ *
527
+ * Returns `undefined` if the account is private or the slot name is not found.
528
+ */
529
+ getStorageSlotValue(slot_name: string): Word | undefined;
530
+ /**
531
+ * Returns whether a storage map slot had too many entries to return inline.
532
+ *
533
+ * When this returns `true`, use `RpcClient.syncStorageMaps()` to fetch the full
534
+ * storage map data.
535
+ *
536
+ * Returns `undefined` if the slot was not found or the account is private.
537
+ */
538
+ hasStorageMapTooManyEntries(slot_name: string): boolean | undefined;
539
+ /**
540
+ * Returns the number of storage slots, if available (public accounts only).
541
+ */
542
+ numStorageSlots(): number | undefined;
543
+ }
544
+
545
+ /**
546
+ * Provides lazy access to account data.
547
+ *
548
+ * `AccountReader` executes queries lazily - each method call fetches fresh data
549
+ * from storage, ensuring you always see the current state.
550
+ */
551
+ export class AccountReader {
552
+ private constructor();
553
+ free(): void;
554
+ [Symbol.dispose](): void;
555
+ /**
556
+ * Returns the account ID.
557
+ */
558
+ accountId(): AccountId;
559
+ /**
560
+ * Retrieves the addresses associated with this account.
561
+ */
562
+ addresses(): Promise<Address[]>;
563
+ /**
564
+ * Retrieves the code commitment (hash of the account code).
565
+ */
566
+ codeCommitment(): Promise<Word>;
567
+ /**
568
+ * Retrieves the account commitment (hash of the full state).
569
+ */
570
+ commitment(): Promise<Word>;
571
+ /**
572
+ * Retrieves the balance of a fungible asset in the account's vault.
573
+ *
574
+ * Returns 0 if the asset is not present in the vault.
575
+ */
576
+ getBalance(faucet_id: AccountId): Promise<bigint>;
577
+ /**
578
+ * Retrieves a storage slot value by name.
579
+ *
580
+ * For `Value` slots, returns the stored word.
581
+ * For `Map` slots, returns the map root.
582
+ */
583
+ getStorageItem(slot_name: string): Promise<Word>;
584
+ /**
585
+ * Retrieves a value from a storage map slot by name and key.
586
+ */
587
+ getStorageMapItem(slot_name: string, key: Word): Promise<Word>;
588
+ /**
589
+ * Retrieves the account header.
590
+ */
591
+ header(): Promise<AccountHeader>;
592
+ /**
593
+ * Retrieves the current account nonce.
594
+ */
595
+ nonce(): Promise<Felt>;
596
+ /**
597
+ * Retrieves the account status.
598
+ */
599
+ status(): Promise<AccountStatus>;
600
+ /**
601
+ * Retrieves the storage commitment (root of the storage tree).
602
+ */
603
+ storageCommitment(): Promise<Word>;
604
+ /**
605
+ * Retrieves the vault root (root of the asset vault tree).
606
+ */
607
+ vaultRoot(): Promise<Word>;
608
+ }
609
+
610
+ /**
611
+ * Represents the status of an account tracked by the client.
612
+ *
613
+ * The status of an account may change by local or external factors.
614
+ */
615
+ export class AccountStatus {
616
+ private constructor();
617
+ free(): void;
618
+ [Symbol.dispose](): void;
619
+ /**
620
+ * Returns `true` if the account is locked.
621
+ *
622
+ * A locked account has a local state that doesn't match the node's state,
623
+ * rendering it unusable for transactions.
624
+ */
625
+ isLocked(): boolean;
626
+ /**
627
+ * Returns `true` if the account is new and hasn't been used yet.
628
+ */
629
+ isNew(): boolean;
630
+ /**
631
+ * Returns the account seed if available.
632
+ *
633
+ * The seed is available for:
634
+ * - New accounts (stored in the New status)
635
+ * - Locked private accounts with nonce=0 (preserved for reconstruction)
636
+ */
637
+ seed(): Word | undefined;
638
+ /**
639
+ * Returns the status as a string representation.
640
+ */
641
+ toString(): string;
642
+ }
643
+
644
+ /**
645
+ * Account storage is composed of a variable number of index-addressable storage slots up to 255
646
+ * slots in total.
647
+ *
648
+ * Each slot has a type which defines its size and structure. Currently, the following types are
649
+ * supported:
650
+ * - `StorageSlot::Value`: contains a single Word of data (i.e., 32 bytes).
651
+ * - `StorageSlot::Map`: contains a `StorageMap` which is a key-value map where both keys and
652
+ * values are Words. The value of a storage slot containing a map is the commitment to the
653
+ * underlying map.
654
+ */
655
+ export class AccountStorage {
656
+ private constructor();
657
+ free(): void;
658
+ [Symbol.dispose](): void;
659
+ /**
660
+ * Returns the commitment to the full account storage.
661
+ */
662
+ commitment(): Word;
663
+ /**
664
+ * Returns the value stored at the given slot name, if any.
665
+ */
666
+ getItem(slot_name: string): Word | undefined;
667
+ /**
668
+ * Get all key-value pairs from the map slot identified by `slot_name`.
669
+ * Returns `undefined` if the slot isn't a map or doesn't exist.
670
+ * Returns `[]` if the map exists but is empty.
671
+ */
672
+ getMapEntries(slot_name: string): JsStorageMapEntry[] | undefined;
673
+ /**
674
+ * Returns the value for a key in the map stored at the given slot, if any.
675
+ */
676
+ getMapItem(slot_name: string, key: Word): Word | undefined;
677
+ /**
678
+ * Returns the names of all storage slots on this account.
679
+ */
680
+ getSlotNames(): string[];
681
+ }
682
+
683
+ /**
684
+ * `AccountStorageDelta` stores the differences between two states of account storage.
685
+ *
686
+ * The delta consists of two maps:
687
+ * - A map containing the updates to value storage slots. The keys in this map are indexes of the
688
+ * updated storage slots and the values are the new values for these slots.
689
+ * - A map containing updates to storage maps. The keys in this map are indexes of the updated
690
+ * storage slots and the values are corresponding storage map delta objects.
691
+ */
692
+ export class AccountStorageDelta {
693
+ private constructor();
694
+ free(): void;
695
+ [Symbol.dispose](): void;
696
+ /**
697
+ * Deserializes a storage delta from bytes.
698
+ */
699
+ static deserialize(bytes: Uint8Array): AccountStorageDelta;
700
+ /**
701
+ * Returns true if no storage slots are changed.
702
+ */
703
+ isEmpty(): boolean;
704
+ /**
705
+ * Serializes the storage delta into bytes.
706
+ */
707
+ serialize(): Uint8Array;
708
+ /**
709
+ * Returns the new values for modified storage slots.
710
+ */
711
+ values(): Word[];
712
+ }
713
+
714
+ /**
715
+ * Storage visibility mode for an account.
716
+ */
717
+ export class AccountStorageMode {
718
+ private constructor();
719
+ free(): void;
720
+ [Symbol.dispose](): void;
721
+ /**
722
+ * Returns the storage mode as a string.
723
+ */
724
+ asStr(): string;
725
+ /**
726
+ * Creates a network storage mode.
727
+ */
728
+ static network(): AccountStorageMode;
729
+ /**
730
+ * Creates a private storage mode.
731
+ */
732
+ static private(): AccountStorageMode;
733
+ /**
734
+ * Creates a public storage mode.
735
+ */
736
+ static public(): AccountStorageMode;
737
+ /**
738
+ * Parses a storage mode from its string representation.
739
+ */
740
+ static tryFromStr(s: string): AccountStorageMode;
741
+ }
742
+
743
+ export class AccountStorageRequirements {
744
+ free(): void;
745
+ [Symbol.dispose](): void;
746
+ /**
747
+ * Builds storage requirements from a list of slot/key pairs.
748
+ */
749
+ static fromSlotAndKeysArray(slots_and_keys: SlotAndKeys[]): AccountStorageRequirements;
750
+ /**
751
+ * Creates empty storage requirements.
752
+ */
753
+ constructor();
754
+ }
755
+
756
+ export enum AccountType {
757
+ FungibleFaucet = 0,
758
+ NonFungibleFaucet = 1,
759
+ RegularAccountImmutableCode = 2,
760
+ RegularAccountUpdatableCode = 3,
761
+ }
762
+
763
+ /**
764
+ * `AccountVaultDelta` stores the difference between the initial and final account vault states.
765
+ *
766
+ * The difference is represented as follows:
767
+ * - `fungible`: a binary tree map of fungible asset balance changes in the account vault.
768
+ * - `non_fungible`: a binary tree map of non-fungible assets that were added to or removed from
769
+ * the account vault.
770
+ */
771
+ export class AccountVaultDelta {
772
+ private constructor();
773
+ free(): void;
774
+ [Symbol.dispose](): void;
775
+ /**
776
+ * Returns the fungible assets that increased.
777
+ */
778
+ addedFungibleAssets(): FungibleAsset[];
779
+ /**
780
+ * Deserializes a vault delta from bytes.
781
+ */
782
+ static deserialize(bytes: Uint8Array): AccountVaultDelta;
783
+ /**
784
+ * Returns the fungible portion of the delta.
785
+ */
786
+ fungible(): FungibleAssetDelta;
787
+ /**
788
+ * Returns true if no assets are changed.
789
+ */
790
+ isEmpty(): boolean;
791
+ /**
792
+ * Returns the fungible assets that decreased.
793
+ */
794
+ removedFungibleAssets(): FungibleAsset[];
795
+ /**
796
+ * Serializes the vault delta into bytes.
797
+ */
798
+ serialize(): Uint8Array;
799
+ }
800
+
801
+ /**
802
+ * Representation of a Miden address (account ID plus routing parameters).
803
+ */
804
+ export class Address {
805
+ private constructor();
806
+ /**
807
+ ** Return copy of self without private attributes.
808
+ */
809
+ toJSON(): Object;
810
+ /**
811
+ * Return stringified version of self.
812
+ */
813
+ toString(): string;
814
+ free(): void;
815
+ [Symbol.dispose](): void;
816
+ /**
817
+ * Returns the account ID embedded in the address.
818
+ */
819
+ accountId(): AccountId;
820
+ /**
821
+ * Deserializes a byte array into an `Address`.
822
+ */
823
+ static deserialize(bytes: Uint8Array): Address;
824
+ /**
825
+ * Builds an address from an account ID and optional interface.
826
+ */
827
+ static fromAccountId(account_id: AccountId, _interface?: string | null): Address;
828
+ /**
829
+ * Builds an address from a bech32-encoded string.
830
+ */
831
+ static fromBech32(bech32: string): Address;
832
+ /**
833
+ * Returns the address interface.
834
+ */
835
+ interface(): AddressInterface;
836
+ /**
837
+ * Encodes the address using the provided network prefix.
838
+ */
839
+ toBech32(network_id: NetworkId): string;
840
+ /**
841
+ * Converts the address into a note tag.
842
+ */
843
+ toNoteTag(): NoteTag;
844
+ }
845
+
846
+ /**
847
+ * Advice inputs provided to a transaction or note script.
848
+ */
849
+ export class AdviceInputs {
850
+ free(): void;
851
+ [Symbol.dispose](): void;
852
+ /**
853
+ * Returns mapped values for a given key if present.
854
+ */
855
+ mappedValues(key: Word): Felt[] | undefined;
856
+ /**
857
+ * `wasm_bindgen` requires an explicit constructor; `#[derive(Default)]` alone
858
+ * is not callable from JS.
859
+ */
860
+ constructor();
861
+ /**
862
+ * Returns the stack inputs as a vector of felts.
863
+ */
864
+ stack(): Felt[];
865
+ }
866
+
867
+ /**
868
+ * Map of advice values keyed by words for script execution.
869
+ */
870
+ export class AdviceMap {
871
+ free(): void;
872
+ [Symbol.dispose](): void;
873
+ /**
874
+ * Inserts a value for the given key, returning any previous value.
875
+ */
876
+ insert(key: Word, value: FeltArray): Felt[] | undefined;
877
+ /**
878
+ * Creates an empty advice map.
879
+ */
880
+ constructor();
881
+ }
882
+
883
+ /**
884
+ * A container for an unlimited number of assets.
885
+ *
886
+ * An asset vault can contain an unlimited number of assets. The assets are stored in a Sparse
887
+ * Merkle tree as follows:
888
+ * - For fungible assets, the index of a node is defined by the issuing faucet ID, and the value of
889
+ * the node is the asset itself. Thus, for any fungible asset there will be only one node in the
890
+ * tree.
891
+ * - For non-fungible assets, the index is defined by the asset itself, and the asset is also the
892
+ * value of the node.
893
+ *
894
+ * An asset vault can be reduced to a single hash which is the root of the Sparse Merkle Tree.
895
+ */
896
+ export class AssetVault {
897
+ private constructor();
898
+ free(): void;
899
+ [Symbol.dispose](): void;
900
+ /**
901
+ * Returns the fungible assets contained in this vault.
902
+ */
903
+ fungibleAssets(): FungibleAsset[];
904
+ /**
905
+ * Returns the balance for the given fungible faucet, or zero if absent.
906
+ */
907
+ getBalance(faucet_id: AccountId): bigint;
908
+ /**
909
+ * Returns the root commitment of the asset vault tree.
910
+ */
911
+ root(): Word;
912
+ }
913
+
914
+ /**
915
+ * Multisig auth configuration for `RpoFalcon512` signatures.
916
+ */
917
+ export class AuthFalcon512RpoMultisigConfig {
918
+ free(): void;
919
+ [Symbol.dispose](): void;
920
+ /**
921
+ * Per-procedure thresholds.
922
+ */
923
+ getProcThresholds(): ProcedureThreshold[];
924
+ /**
925
+ * Build a configuration with a list of approver public key commitments and a default
926
+ * threshold.
927
+ *
928
+ * `default_threshold` must be >= 1 and <= `approvers.length`.
929
+ */
930
+ constructor(approvers: Word[], default_threshold: number);
931
+ /**
932
+ * Attach per-procedure thresholds. Each threshold must be >= 1 and <= `approvers.length`.
933
+ */
934
+ withProcThresholds(proc_thresholds: ProcedureThreshold[]): AuthFalcon512RpoMultisigConfig;
935
+ /**
936
+ * Approver public key commitments as Words.
937
+ */
938
+ readonly approvers: Word[];
939
+ readonly defaultThreshold: number;
940
+ }
941
+
942
+ /**
943
+ * Authentication schemes supported by the web client.
944
+ */
945
+ export enum AuthScheme {
946
+ AuthEcdsaK256Keccak = 1,
947
+ AuthRpoFalcon512 = 2,
948
+ }
949
+
950
+ export class AuthSecretKey {
951
+ private constructor();
952
+ free(): void;
953
+ [Symbol.dispose](): void;
954
+ static deserialize(bytes: Uint8Array): AuthSecretKey;
955
+ static ecdsaWithRNG(seed?: Uint8Array | null): AuthSecretKey;
956
+ /**
957
+ * Returns the ECDSA k256 Keccak secret key bytes encoded as felts.
958
+ */
959
+ getEcdsaK256KeccakSecretKeyAsFelts(): Felt[];
960
+ getPublicKeyAsWord(): Word;
961
+ getRpoFalcon512SecretKeyAsFelts(): Felt[];
962
+ publicKey(): PublicKey;
963
+ static rpoFalconWithRNG(seed?: Uint8Array | null): AuthSecretKey;
964
+ serialize(): Uint8Array;
965
+ sign(message: Word): Signature;
966
+ signData(signing_inputs: SigningInputs): Signature;
967
+ }
968
+
969
+ /**
970
+ * Provides metadata for a basic fungible faucet account component.
971
+ */
972
+ export class BasicFungibleFaucetComponent {
973
+ private constructor();
974
+ free(): void;
975
+ [Symbol.dispose](): void;
976
+ /**
977
+ * Returns the number of decimal places for the token.
978
+ */
979
+ decimals(): number;
980
+ /**
981
+ * Extracts faucet metadata from an account.
982
+ */
983
+ static fromAccount(account: Account): BasicFungibleFaucetComponent;
984
+ /**
985
+ * Returns the maximum token supply.
986
+ */
987
+ maxSupply(): Felt;
988
+ /**
989
+ * Returns the faucet's token symbol.
990
+ */
991
+ symbol(): TokenSymbol;
992
+ }
993
+
994
+ /**
995
+ * Public header for a block, containing commitments to the chain state and the proof attesting to
996
+ * the block's validity.
997
+ *
998
+ * Key fields include the previous block commitment, block number, chain/nullifier/note roots,
999
+ * transaction commitments (including the kernel), proof commitment, and a timestamp. Two derived
1000
+ * values are exposed:
1001
+ * - `sub_commitment`: sequential hash of all fields except the `note_root`.
1002
+ * - `commitment`: a 2-to-1 hash of the `sub_commitment` and the `note_root`.
1003
+ */
1004
+ export class BlockHeader {
1005
+ private constructor();
1006
+ free(): void;
1007
+ [Symbol.dispose](): void;
1008
+ /**
1009
+ * Returns the account root commitment.
1010
+ */
1011
+ accountRoot(): Word;
1012
+ /**
1013
+ * Returns the block height.
1014
+ */
1015
+ blockNum(): number;
1016
+ /**
1017
+ * Returns the chain commitment.
1018
+ */
1019
+ chainCommitment(): Word;
1020
+ /**
1021
+ * Returns the commitment to the block contents.
1022
+ */
1023
+ commitment(): Word;
1024
+ /**
1025
+ * Returns the account ID of the fungible faucet whose assets are accepted as the native
1026
+ * asset of the blockchain (i.e. the asset used for paying transaction verification fees).
1027
+ *
1028
+ * This is stored on-chain as part of the block's fee parameters, which means consumers can
1029
+ * discover the native faucet by reading any block header rather than hardcoding it per
1030
+ * network.
1031
+ */
1032
+ nativeAssetId(): AccountId;
1033
+ /**
1034
+ * Returns the note commitment root.
1035
+ */
1036
+ noteRoot(): Word;
1037
+ /**
1038
+ * Returns the nullifier root commitment.
1039
+ */
1040
+ nullifierRoot(): Word;
1041
+ /**
1042
+ * Returns the commitment of the previous block.
1043
+ */
1044
+ prevBlockCommitment(): Word;
1045
+ /**
1046
+ * Returns the proof commitment.
1047
+ */
1048
+ proofCommitment(): Word;
1049
+ /**
1050
+ * Returns the commitment to block metadata.
1051
+ */
1052
+ subCommitment(): Word;
1053
+ /**
1054
+ * Returns the block timestamp.
1055
+ */
1056
+ timestamp(): number;
1057
+ /**
1058
+ * Returns the transaction commitment.
1059
+ */
1060
+ txCommitment(): Word;
1061
+ /**
1062
+ * Returns the transaction kernel commitment.
1063
+ */
1064
+ txKernelCommitment(): Word;
1065
+ /**
1066
+ * Returns the header version.
1067
+ */
1068
+ version(): number;
1069
+ }
1070
+
1071
+ /**
1072
+ * Utility for linking libraries and compiling transaction/note scripts.
1073
+ */
1074
+ export class CodeBuilder {
1075
+ private constructor();
1076
+ /**
1077
+ ** Return copy of self without private attributes.
1078
+ */
1079
+ toJSON(): Object;
1080
+ /**
1081
+ * Return stringified version of self.
1082
+ */
1083
+ toString(): string;
1084
+ free(): void;
1085
+ [Symbol.dispose](): void;
1086
+ /**
1087
+ * Given a Library Path, and a source code, turn it into a Library.
1088
+ * E.g. A path library can be `miden::my_contract`. When turned into a library,
1089
+ * this can be used from another script with an import statement, following the
1090
+ * previous example: `use miden::my_contract'.
1091
+ */
1092
+ buildLibrary(library_path: string, source_code: string): Library;
1093
+ /**
1094
+ * Given an `AccountComponentCode`, compiles it
1095
+ * with the available modules under this builder. Returns the compiled account component code.
1096
+ */
1097
+ compileAccountComponentCode(account_code: string): AccountComponentCode;
1098
+ /**
1099
+ * Given a Note Script's source code, compiles it with the available
1100
+ * modules under this builder. Returns the compiled script.
1101
+ */
1102
+ compileNoteScript(program: string): NoteScript;
1103
+ /**
1104
+ * Given a Transaction Script's source code, compiles it with the available
1105
+ * modules under this builder. Returns the compiled script.
1106
+ */
1107
+ compileTxScript(tx_script: string): TransactionScript;
1108
+ /**
1109
+ * This is useful to dynamically link the {@link Library} of a foreign account
1110
+ * that is invoked using foreign procedure invocation (FPI). Its code is available
1111
+ * on-chain and so it does not have to be copied into the script code.
1112
+ *
1113
+ * For all other use cases not involving FPI, link the library statically.
1114
+ * Receives as argument the library to be linked.
1115
+ */
1116
+ linkDynamicLibrary(library: Library): void;
1117
+ /**
1118
+ * Given a module path (something like `my_lib::module`) and source code, this will
1119
+ * statically link it for use with scripts to be built with this builder.
1120
+ */
1121
+ linkModule(module_path: string, module_code: string): void;
1122
+ /**
1123
+ * Statically links the given library.
1124
+ *
1125
+ * Static linking means the library code is copied into the script code.
1126
+ * Use this for most libraries that are not available on-chain.
1127
+ *
1128
+ * Receives as argument the library to link.
1129
+ */
1130
+ linkStaticLibrary(library: Library): void;
1131
+ }
1132
+
1133
+ /**
1134
+ * Represents a note committed on chain.
1135
+ */
1136
+ export class CommittedNote {
1137
+ private constructor();
1138
+ free(): void;
1139
+ [Symbol.dispose](): void;
1140
+ /**
1141
+ * Returns the full note metadata when the attachment payload is available.
1142
+ */
1143
+ fullMetadata(): NoteMetadata | undefined;
1144
+ /**
1145
+ * Returns the inclusion path for the note in the block's note tree.
1146
+ */
1147
+ inclusionPath(): SparseMerklePath;
1148
+ /**
1149
+ * Returns the inclusion proof for this note.
1150
+ */
1151
+ inclusionProof(): NoteInclusionProof;
1152
+ /**
1153
+ * Returns the note metadata.
1154
+ *
1155
+ * If only metadata headers are available, the returned metadata contains
1156
+ * the sender, note type, and tag without attachment payload.
1157
+ */
1158
+ metadata(): NoteMetadata;
1159
+ /**
1160
+ * Returns the note ID.
1161
+ */
1162
+ noteId(): NoteId;
1163
+ /**
1164
+ * Returns the note index in the block's note tree.
1165
+ */
1166
+ noteIndex(): number;
1167
+ /**
1168
+ * Returns the note type (public, private, etc.).
1169
+ */
1170
+ noteType(): NoteType;
1171
+ /**
1172
+ * Returns the note sender, even when only header metadata is available.
1173
+ */
1174
+ sender(): AccountId;
1175
+ /**
1176
+ * Returns the note tag.
1177
+ */
1178
+ tag(): number;
1179
+ }
1180
+
1181
+ /**
1182
+ * Input note record annotated with consumption conditions.
1183
+ */
1184
+ export class ConsumableNoteRecord {
1185
+ free(): void;
1186
+ [Symbol.dispose](): void;
1187
+ /**
1188
+ * Returns the underlying input note record.
1189
+ */
1190
+ inputNoteRecord(): InputNoteRecord;
1191
+ /**
1192
+ * Creates a new consumable note record from an input note record and consumability metadata.
1193
+ */
1194
+ constructor(input_note_record: InputNoteRecord, note_consumability: NoteConsumability[]);
1195
+ /**
1196
+ * Returns the consumability entries.
1197
+ */
1198
+ noteConsumability(): NoteConsumability[];
1199
+ }
1200
+
1201
+ /**
1202
+ * The `Endpoint` struct represents a network endpoint, consisting of a protocol, a host, and a
1203
+ * port.
1204
+ *
1205
+ * This struct is used to define the address of a Miden node that the client will connect to.
1206
+ */
1207
+ export class Endpoint {
1208
+ free(): void;
1209
+ [Symbol.dispose](): void;
1210
+ /**
1211
+ * Returns the endpoint for the Miden devnet.
1212
+ */
1213
+ static devnet(): Endpoint;
1214
+ /**
1215
+ * Returns the endpoint for a local Miden node.
1216
+ *
1217
+ * Uses <http://localhost:57291>
1218
+ */
1219
+ static localhost(): Endpoint;
1220
+ /**
1221
+ * Creates an endpoint from a URL string.
1222
+ *
1223
+ * @param url - The URL string (e.g., <https://localhost:57291>)
1224
+ * @throws throws an error if the URL is invalid
1225
+ */
1226
+ constructor(url: string);
1227
+ /**
1228
+ * Returns the endpoint for the Miden testnet.
1229
+ */
1230
+ static testnet(): Endpoint;
1231
+ /**
1232
+ * Returns the string representation of the endpoint.
1233
+ */
1234
+ toString(): string;
1235
+ /**
1236
+ * Returns the host of the endpoint.
1237
+ */
1238
+ readonly host: string;
1239
+ /**
1240
+ * Returns the port of the endpoint.
1241
+ */
1242
+ readonly port: number | undefined;
1243
+ /**
1244
+ * Returns the protocol of the endpoint.
1245
+ */
1246
+ readonly protocol: string;
1247
+ }
1248
+
1249
+ /**
1250
+ * Describes the result of executing a transaction program for the Miden protocol.
1251
+ *
1252
+ * Executed transaction serves two primary purposes:
1253
+ * - It contains a complete description of the effects of the transaction. Specifically, it
1254
+ * contains all output notes created as the result of the transaction and describes all the
1255
+ * changes made to the involved account (i.e., the account delta).
1256
+ * - It contains all the information required to re-execute and prove the transaction in a
1257
+ * stateless manner. This includes all public transaction inputs, but also all nondeterministic
1258
+ * inputs that the host provided to Miden VM while executing the transaction (i.e., advice
1259
+ * witness).
1260
+ */
1261
+ export class ExecutedTransaction {
1262
+ private constructor();
1263
+ free(): void;
1264
+ [Symbol.dispose](): void;
1265
+ /**
1266
+ * Returns the account delta resulting from execution.
1267
+ */
1268
+ accountDelta(): AccountDelta;
1269
+ /**
1270
+ * Returns the account the transaction was executed against.
1271
+ */
1272
+ accountId(): AccountId;
1273
+ /**
1274
+ * Returns the block header that included the transaction.
1275
+ */
1276
+ blockHeader(): BlockHeader;
1277
+ /**
1278
+ * Returns the final account header after execution.
1279
+ */
1280
+ finalAccountHeader(): AccountHeader;
1281
+ /**
1282
+ * Returns the transaction ID.
1283
+ */
1284
+ id(): TransactionId;
1285
+ /**
1286
+ * Returns the initial account header before execution.
1287
+ */
1288
+ initialAccountHeader(): AccountHeader;
1289
+ /**
1290
+ * Returns the input notes consumed by the transaction.
1291
+ */
1292
+ inputNotes(): InputNotes;
1293
+ /**
1294
+ * Returns the output notes produced by the transaction.
1295
+ */
1296
+ outputNotes(): OutputNotes;
1297
+ /**
1298
+ * Returns the arguments passed to the transaction script.
1299
+ */
1300
+ txArgs(): TransactionArgs;
1301
+ }
1302
+
1303
+ /**
1304
+ * Field element wrapper exposed to JavaScript.
1305
+ */
1306
+ export class Felt {
1307
+ free(): void;
1308
+ [Symbol.dispose](): void;
1309
+ /**
1310
+ * Returns the integer representation of the field element.
1311
+ */
1312
+ asInt(): bigint;
1313
+ /**
1314
+ * Creates a new field element from a u64 value.
1315
+ */
1316
+ constructor(value: bigint);
1317
+ /**
1318
+ * Returns the string representation of the field element.
1319
+ */
1320
+ toString(): string;
1321
+ }
1322
+
1323
+ export class FeltArray {
1324
+ /**
1325
+ ** Return copy of self without private attributes.
1326
+ */
1327
+ toJSON(): Object;
1328
+ /**
1329
+ * Return stringified version of self.
1330
+ */
1331
+ toString(): string;
1332
+ free(): void;
1333
+ [Symbol.dispose](): void;
1334
+ /**
1335
+ * Get element at index, will always return a clone to avoid aliasing issues.
1336
+ */
1337
+ get(index: number): Felt;
1338
+ length(): number;
1339
+ constructor(elements?: Felt[] | null);
1340
+ push(element: Felt): void;
1341
+ /**
1342
+ * Replace the element at `index`. Borrows + clones the input
1343
+ * (mirrors `push`), so the caller's JS handle remains valid
1344
+ * after the call. Without this borrow, passing `elem` by
1345
+ * value would move the underlying Rust value out of the
1346
+ * caller's JS handle and any subsequent method on it would
1347
+ * panic with `"null pointer passed to rust"`.
1348
+ */
1349
+ replaceAt(index: number, elem: Felt): void;
1350
+ }
1351
+
1352
+ /**
1353
+ * Account details returned by the node.
1354
+ */
1355
+ export class FetchedAccount {
1356
+ private constructor();
1357
+ free(): void;
1358
+ [Symbol.dispose](): void;
1359
+ /**
1360
+ * Returns the full account data when the account is public.
1361
+ */
1362
+ account(): Account | undefined;
1363
+ /**
1364
+ * Returns the account ID.
1365
+ */
1366
+ accountId(): AccountId;
1367
+ /**
1368
+ * Returns the account commitment reported by the node.
1369
+ */
1370
+ commitment(): Word;
1371
+ /**
1372
+ * Returns true when the account is a network account.
1373
+ */
1374
+ isNetwork(): boolean;
1375
+ /**
1376
+ * Returns true when the account is private.
1377
+ */
1378
+ isPrivate(): boolean;
1379
+ /**
1380
+ * Returns true when the account is public.
1381
+ */
1382
+ isPublic(): boolean;
1383
+ /**
1384
+ * Returns the last block height where the account was updated.
1385
+ */
1386
+ lastBlockNum(): number;
1387
+ }
1388
+
1389
+ /**
1390
+ * Wrapper for a note fetched over RPC.
1391
+ *
1392
+ * It contains the note header and inclusion proof. The note details are only present for
1393
+ * public notes.
1394
+ */
1395
+ export class FetchedNote {
1396
+ free(): void;
1397
+ [Symbol.dispose](): void;
1398
+ /**
1399
+ * Returns an [`InputNote`] when the fetched note is public.
1400
+ *
1401
+ * Returns `undefined` when the note body is missing (e.g. private notes); in that case build
1402
+ * an `InputNote` manually using the inclusion proof and note data obtained elsewhere.
1403
+ */
1404
+ asInputNote(): InputNote | undefined;
1405
+ /**
1406
+ * Create a `FetchedNote` with an optional [`Note`].
1407
+ */
1408
+ constructor(note_id: NoteId, metadata: NoteMetadata, inclusion_proof: NoteInclusionProof, note?: Note | null);
1409
+ /**
1410
+ * The note's header, containing the ID and metadata.
1411
+ */
1412
+ readonly header: NoteHeader;
1413
+ /**
1414
+ * The note's inclusion proof.
1415
+ *
1416
+ * Contains the data required to prove inclusion of the note in the canonical chain.
1417
+ */
1418
+ readonly inclusionProof: NoteInclusionProof;
1419
+ /**
1420
+ * The note's metadata, including sender, tag, and other properties.
1421
+ * Available for both private and public notes.
1422
+ */
1423
+ readonly metadata: NoteMetadata;
1424
+ /**
1425
+ * The full [`Note`] data.
1426
+ *
1427
+ * For public notes, it contains the complete note data.
1428
+ * For private notes, it will be undefined.
1429
+ */
1430
+ readonly note: Note | undefined;
1431
+ /**
1432
+ * The unique identifier of the note.
1433
+ */
1434
+ readonly noteId: NoteId;
1435
+ /**
1436
+ * Returns whether the note is private, encrypted, or public.
1437
+ */
1438
+ readonly noteType: NoteType;
1439
+ }
1440
+
1441
+ export class FlattenedU8Vec {
1442
+ private constructor();
1443
+ free(): void;
1444
+ [Symbol.dispose](): void;
1445
+ data(): Uint8Array;
1446
+ lengths(): Uint32Array;
1447
+ num_inner_vecs(): number;
1448
+ }
1449
+
1450
+ /**
1451
+ * Description of a foreign account referenced by a transaction.
1452
+ */
1453
+ export class ForeignAccount {
1454
+ private constructor();
1455
+ free(): void;
1456
+ [Symbol.dispose](): void;
1457
+ /**
1458
+ * Returns the ID of the foreign account.
1459
+ */
1460
+ account_id(): AccountId;
1461
+ /**
1462
+ * Creates a foreign account entry for a public account with given storage requirements.
1463
+ */
1464
+ static public(account_id: AccountId, storage_requirements: AccountStorageRequirements): ForeignAccount;
1465
+ /**
1466
+ * Returns the required storage slots/keys for this foreign account.
1467
+ */
1468
+ storage_slot_requirements(): AccountStorageRequirements;
1469
+ }
1470
+
1471
+ export class ForeignAccountArray {
1472
+ /**
1473
+ ** Return copy of self without private attributes.
1474
+ */
1475
+ toJSON(): Object;
1476
+ /**
1477
+ * Return stringified version of self.
1478
+ */
1479
+ toString(): string;
1480
+ free(): void;
1481
+ [Symbol.dispose](): void;
1482
+ /**
1483
+ * Get element at index, will always return a clone to avoid aliasing issues.
1484
+ */
1485
+ get(index: number): ForeignAccount;
1486
+ length(): number;
1487
+ constructor(elements?: ForeignAccount[] | null);
1488
+ push(element: ForeignAccount): void;
1489
+ /**
1490
+ * Replace the element at `index`. Borrows + clones the input
1491
+ * (mirrors `push`), so the caller's JS handle remains valid
1492
+ * after the call. Without this borrow, passing `elem` by
1493
+ * value would move the underlying Rust value out of the
1494
+ * caller's JS handle and any subsequent method on it would
1495
+ * panic with `"null pointer passed to rust"`.
1496
+ */
1497
+ replaceAt(index: number, elem: ForeignAccount): void;
1498
+ }
1499
+
1500
+ /**
1501
+ * A fungible asset.
1502
+ *
1503
+ * A fungible asset consists of a faucet ID of the faucet which issued the asset as well as the
1504
+ * asset amount. Asset amount is guaranteed to be 2^63 - 1 or smaller.
1505
+ */
1506
+ export class FungibleAsset {
1507
+ free(): void;
1508
+ [Symbol.dispose](): void;
1509
+ /**
1510
+ * Returns the amount of fungible units.
1511
+ */
1512
+ amount(): bigint;
1513
+ /**
1514
+ * Returns the faucet account that minted this asset.
1515
+ */
1516
+ faucetId(): AccountId;
1517
+ /**
1518
+ * Encodes this asset into the word layout used in the vault.
1519
+ */
1520
+ intoWord(): Word;
1521
+ /**
1522
+ * Creates a fungible asset for the given faucet and amount.
1523
+ */
1524
+ constructor(faucet_id: AccountId, amount: bigint);
1525
+ }
1526
+
1527
+ /**
1528
+ * Aggregated fungible deltas keyed by faucet ID.
1529
+ */
1530
+ export class FungibleAssetDelta {
1531
+ private constructor();
1532
+ free(): void;
1533
+ [Symbol.dispose](): void;
1534
+ /**
1535
+ * Returns the delta amount for a given faucet, if present.
1536
+ */
1537
+ amount(faucet_id: AccountId): bigint | undefined;
1538
+ /**
1539
+ * Returns all fungible asset deltas as a list.
1540
+ */
1541
+ assets(): FungibleAssetDeltaItem[];
1542
+ /**
1543
+ * Deserializes a fungible delta from bytes.
1544
+ */
1545
+ static deserialize(bytes: Uint8Array): FungibleAssetDelta;
1546
+ /**
1547
+ * Returns true if no fungible assets are affected.
1548
+ */
1549
+ isEmpty(): boolean;
1550
+ /**
1551
+ * Returns the number of distinct fungible assets in the delta.
1552
+ */
1553
+ numAssets(): number;
1554
+ /**
1555
+ * Serializes the fungible delta into bytes.
1556
+ */
1557
+ serialize(): Uint8Array;
1558
+ }
1559
+
1560
+ /**
1561
+ * A single fungible asset change in the vault delta.
1562
+ */
1563
+ export class FungibleAssetDeltaItem {
1564
+ private constructor();
1565
+ free(): void;
1566
+ [Symbol.dispose](): void;
1567
+ /**
1568
+ * Returns the signed amount change (positive adds assets, negative removes).
1569
+ */
1570
+ readonly amount: bigint;
1571
+ /**
1572
+ * Returns the faucet ID this delta refers to.
1573
+ */
1574
+ readonly faucetId: AccountId;
1575
+ }
1576
+
1577
+ /**
1578
+ * Procedure digest paired with whether it is an auth procedure.
1579
+ */
1580
+ export class GetProceduresResultItem {
1581
+ private constructor();
1582
+ free(): void;
1583
+ [Symbol.dispose](): void;
1584
+ /**
1585
+ * Returns the MAST root digest for the procedure.
1586
+ */
1587
+ readonly digest: Word;
1588
+ /**
1589
+ * Returns true if the procedure is used for authentication.
1590
+ */
1591
+ readonly isAuth: boolean;
1592
+ }
1593
+
1594
+ /**
1595
+ * Note supplied as an input to a transaction, optionally with authentication data.
1596
+ */
1597
+ export class InputNote {
1598
+ private constructor();
1599
+ free(): void;
1600
+ [Symbol.dispose](): void;
1601
+ /**
1602
+ * Creates an authenticated input note from a note and its inclusion proof.
1603
+ *
1604
+ * An authenticated note has a proof of inclusion in the block's note tree,
1605
+ * which is required for consuming the note in a transaction.
1606
+ */
1607
+ static authenticated(note: Note, inclusion_proof: NoteInclusionProof): InputNote;
1608
+ /**
1609
+ * Returns the commitment to the note ID and metadata.
1610
+ */
1611
+ commitment(): Word;
1612
+ /**
1613
+ * Returns the identifier of the input note.
1614
+ */
1615
+ id(): NoteId;
1616
+ /**
1617
+ * Returns the note's location within the commitment tree when available.
1618
+ */
1619
+ location(): NoteLocation | undefined;
1620
+ /**
1621
+ * Returns the underlying note contents.
1622
+ */
1623
+ note(): Note;
1624
+ /**
1625
+ * Returns the inclusion proof if the note is authenticated.
1626
+ */
1627
+ proof(): NoteInclusionProof | undefined;
1628
+ /**
1629
+ * Creates an unauthenticated input note from note details.
1630
+ *
1631
+ * An unauthenticated note can be consumed in a transaction as long as the note exists in the
1632
+ * network as of the transaction batch in which the consume transaction is included.
1633
+ */
1634
+ static unauthenticated(note: Note): InputNote;
1635
+ }
1636
+
1637
+ /**
1638
+ * Represents a Note of which the Store can keep track and retrieve.
1639
+ *
1640
+ * An `InputNoteRecord` contains all the information of a `NoteDetails`, in addition to specific
1641
+ * information about the note state.
1642
+ *
1643
+ * Once a proof is received, the `InputNoteRecord` can be transformed into an `InputNote` and used
1644
+ * as input for transactions. It is also possible to convert `Note` and `InputNote` into
1645
+ * `InputNoteRecord` (we fill the `metadata` and `inclusion_proof` fields if possible).
1646
+ *
1647
+ * Notes can also be consumed as unauthenticated notes, where their existence is verified by the
1648
+ * network.
1649
+ */
1650
+ export class InputNoteRecord {
1651
+ private constructor();
1652
+ free(): void;
1653
+ [Symbol.dispose](): void;
1654
+ /**
1655
+ * Returns the note commitment (id + metadata), if available.
1656
+ */
1657
+ commitment(): Word | undefined;
1658
+ /**
1659
+ * Returns the transaction ID that consumed this note, if any.
1660
+ */
1661
+ consumerTransactionId(): string | undefined;
1662
+ /**
1663
+ * Returns the note details, if present.
1664
+ */
1665
+ details(): NoteDetails;
1666
+ /**
1667
+ * Returns the note ID.
1668
+ */
1669
+ id(): NoteId;
1670
+ /**
1671
+ * Returns the inclusion proof when the note is authenticated.
1672
+ */
1673
+ inclusionProof(): NoteInclusionProof | undefined;
1674
+ /**
1675
+ * Returns true if the record contains authentication data (proof).
1676
+ */
1677
+ isAuthenticated(): boolean;
1678
+ /**
1679
+ * Returns true if the note has already been consumed.
1680
+ */
1681
+ isConsumed(): boolean;
1682
+ /**
1683
+ * Returns true if the note is currently being processed.
1684
+ */
1685
+ isProcessing(): boolean;
1686
+ /**
1687
+ * Returns the note metadata if available.
1688
+ */
1689
+ metadata(): NoteMetadata | undefined;
1690
+ /**
1691
+ * Returns the nullifier for this note.
1692
+ */
1693
+ nullifier(): string;
1694
+ /**
1695
+ * Returns the current processing state for this note.
1696
+ */
1697
+ state(): InputNoteState;
1698
+ /**
1699
+ * Converts the record into an `InputNote` (including proof when available).
1700
+ */
1701
+ toInputNote(): InputNote;
1702
+ /**
1703
+ * Converts the record into a `Note` (including proof when available).
1704
+ */
1705
+ toNote(): Note;
1706
+ }
1707
+
1708
+ export enum InputNoteState {
1709
+ Expected = 0,
1710
+ Unverified = 1,
1711
+ Committed = 2,
1712
+ Invalid = 3,
1713
+ ProcessingAuthenticated = 4,
1714
+ ProcessingUnauthenticated = 5,
1715
+ ConsumedAuthenticatedLocal = 6,
1716
+ ConsumedUnauthenticatedLocal = 7,
1717
+ ConsumedExternal = 8,
1718
+ }
1719
+
1720
+ /**
1721
+ * Input notes for a transaction, empty if the transaction does not consume notes.
1722
+ */
1723
+ export class InputNotes {
1724
+ private constructor();
1725
+ free(): void;
1726
+ [Symbol.dispose](): void;
1727
+ /**
1728
+ * Returns the commitment to all input notes.
1729
+ */
1730
+ commitment(): Word;
1731
+ /**
1732
+ * Returns the input note at the specified index.
1733
+ */
1734
+ getNote(index: number): InputNote;
1735
+ /**
1736
+ * Returns true if there are no input notes.
1737
+ */
1738
+ isEmpty(): boolean;
1739
+ /**
1740
+ * Returns all input notes as a vector.
1741
+ */
1742
+ notes(): InputNote[];
1743
+ /**
1744
+ * Returns the number of input notes.
1745
+ */
1746
+ numNotes(): number;
1747
+ }
1748
+
1749
+ export class IntoUnderlyingByteSource {
1750
+ private constructor();
1751
+ free(): void;
1752
+ [Symbol.dispose](): void;
1753
+ cancel(): void;
1754
+ pull(controller: ReadableByteStreamController): Promise<any>;
1755
+ start(controller: ReadableByteStreamController): void;
1756
+ readonly autoAllocateChunkSize: number;
1757
+ readonly type: ReadableStreamType;
1758
+ }
1759
+
1760
+ export class IntoUnderlyingSink {
1761
+ private constructor();
1762
+ free(): void;
1763
+ [Symbol.dispose](): void;
1764
+ abort(reason: any): Promise<any>;
1765
+ close(): Promise<any>;
1766
+ write(chunk: any): Promise<any>;
1767
+ }
1768
+
1769
+ export class IntoUnderlyingSource {
1770
+ private constructor();
1771
+ free(): void;
1772
+ [Symbol.dispose](): void;
1773
+ cancel(): void;
1774
+ pull(controller: ReadableStreamDefaultController): Promise<any>;
1775
+ }
1776
+
1777
+ /**
1778
+ * Represents an update to a single account's state.
1779
+ */
1780
+ export class JsAccountUpdate {
1781
+ private constructor();
1782
+ /**
1783
+ ** Return copy of self without private attributes.
1784
+ */
1785
+ toJSON(): Object;
1786
+ /**
1787
+ * Return stringified version of self.
1788
+ */
1789
+ toString(): string;
1790
+ free(): void;
1791
+ [Symbol.dispose](): void;
1792
+ /**
1793
+ * The cryptographic commitment representing this account's current state.
1794
+ */
1795
+ accountCommitment: string;
1796
+ /**
1797
+ * ID for this account.
1798
+ */
1799
+ accountId: string;
1800
+ /**
1801
+ * Optional seed data for the account.
1802
+ */
1803
+ get accountSeed(): Uint8Array | undefined;
1804
+ /**
1805
+ * Optional seed data for the account.
1806
+ */
1807
+ set accountSeed(value: Uint8Array | null | undefined);
1808
+ /**
1809
+ * The account's asset vault.
1810
+ */
1811
+ assets: JsVaultAsset[];
1812
+ /**
1813
+ * The merkle root of the account's executable code.
1814
+ */
1815
+ codeRoot: string;
1816
+ /**
1817
+ * Whether this account update has been committed.
1818
+ */
1819
+ committed: boolean;
1820
+ /**
1821
+ * The account's transaction nonce as a string.
1822
+ */
1823
+ nonce: string;
1824
+ /**
1825
+ * Serialized storage map entries for this account.
1826
+ */
1827
+ storageMapEntries: JsStorageMapEntry[];
1828
+ /**
1829
+ * The merkle root of the account's storage trie.
1830
+ */
1831
+ storageRoot: string;
1832
+ /**
1833
+ * Serialized storage slot data for this account.
1834
+ */
1835
+ storageSlots: JsStorageSlot[];
1836
+ /**
1837
+ * The merkle root of the account's asset vault.
1838
+ */
1839
+ vaultRoot: string;
1840
+ }
1841
+
1842
+ /**
1843
+ * An object that contains data for a sync update,
1844
+ * which will be received by the applyStateSync JS function.
1845
+ * under sync.js
1846
+ */
1847
+ export class JsStateSyncUpdate {
1848
+ private constructor();
1849
+ free(): void;
1850
+ [Symbol.dispose](): void;
1851
+ /**
1852
+ * Account state updates included in this sync.
1853
+ */
1854
+ accountUpdates: JsAccountUpdate[];
1855
+ /**
1856
+ * For each block in this update, stores a boolean (as u8) indicating whether
1857
+ * that block contains notes relevant to this client. Index i corresponds to
1858
+ * the ith block, with 1 meaning relevant and 0 meaning not relevant.
1859
+ */
1860
+ blockHasRelevantNotes: Uint8Array;
1861
+ /**
1862
+ * The block number for this update.
1863
+ */
1864
+ blockNum: number;
1865
+ /**
1866
+ * IDs of note tags that should be removed from the client's local state.
1867
+ */
1868
+ committedNoteIds: string[];
1869
+ /**
1870
+ * The new block headers for this state update, serialized into a flattened byte array.
1871
+ */
1872
+ flattenedNewBlockHeaders: FlattenedU8Vec;
1873
+ /**
1874
+ * Flattened byte array containing partial blockchain peaks used for merkle tree
1875
+ * verification.
1876
+ */
1877
+ flattenedPartialBlockChainPeaks: FlattenedU8Vec;
1878
+ /**
1879
+ * The block numbers corresponding to each header in `flattened_new_block_headers`.
1880
+ * This vec should have the same length as the number of headers, with each index
1881
+ * representing the block number for the header at that same index.
1882
+ */
1883
+ newBlockNums: Uint32Array;
1884
+ /**
1885
+ * Input notes for this state update in serialized form.
1886
+ */
1887
+ serializedInputNotes: SerializedInputNoteData[];
1888
+ /**
1889
+ * Serialized IDs for new authentication nodes required to verify block headers.
1890
+ */
1891
+ serializedNodeIds: string[];
1892
+ /**
1893
+ * The actual authentication node data corresponding to the IDs above.
1894
+ */
1895
+ serializedNodes: string[];
1896
+ /**
1897
+ * Output notes created in this state update in serialized form.
1898
+ */
1899
+ serializedOutputNotes: SerializedOutputNoteData[];
1900
+ /**
1901
+ * Transaction data for transactions included in this update.
1902
+ */
1903
+ transactionUpdates: SerializedTransactionData[];
1904
+ }
1905
+
1906
+ /**
1907
+ * A JavaScript representation of a storage map entry in an account.
1908
+ */
1909
+ export class JsStorageMapEntry {
1910
+ private constructor();
1911
+ /**
1912
+ ** Return copy of self without private attributes.
1913
+ */
1914
+ toJSON(): Object;
1915
+ /**
1916
+ * Return stringified version of self.
1917
+ */
1918
+ toString(): string;
1919
+ free(): void;
1920
+ [Symbol.dispose](): void;
1921
+ /**
1922
+ * The key of the storage map entry.
1923
+ */
1924
+ key: string;
1925
+ /**
1926
+ * The slot name of the map this entry belongs to.
1927
+ */
1928
+ slotName: string;
1929
+ /**
1930
+ * The value of the storage map entry.
1931
+ */
1932
+ value: string;
1933
+ }
1934
+
1935
+ /**
1936
+ * A JavaScript representation of a storage slot in an account.
1937
+ */
1938
+ export class JsStorageSlot {
1939
+ private constructor();
1940
+ /**
1941
+ ** Return copy of self without private attributes.
1942
+ */
1943
+ toJSON(): Object;
1944
+ /**
1945
+ * Return stringified version of self.
1946
+ */
1947
+ toString(): string;
1948
+ free(): void;
1949
+ [Symbol.dispose](): void;
1950
+ /**
1951
+ * The name of the storage slot.
1952
+ */
1953
+ slotName: string;
1954
+ /**
1955
+ * The type of the storage slot.
1956
+ */
1957
+ slotType: number;
1958
+ /**
1959
+ * The value stored in the storage slot.
1960
+ */
1961
+ slotValue: string;
1962
+ }
1963
+
1964
+ /**
1965
+ * An object that contains a serialized vault asset.
1966
+ */
1967
+ export class JsVaultAsset {
1968
+ private constructor();
1969
+ /**
1970
+ ** Return copy of self without private attributes.
1971
+ */
1972
+ toJSON(): Object;
1973
+ /**
1974
+ * Return stringified version of self.
1975
+ */
1976
+ toString(): string;
1977
+ free(): void;
1978
+ [Symbol.dispose](): void;
1979
+ /**
1980
+ * Word representing the asset.
1981
+ */
1982
+ asset: string;
1983
+ /**
1984
+ * The vault key associated with the asset.
1985
+ */
1986
+ vaultKey: string;
1987
+ }
1988
+
1989
+ export class Library {
1990
+ private constructor();
1991
+ free(): void;
1992
+ [Symbol.dispose](): void;
1993
+ }
1994
+
1995
+ /**
1996
+ * Represents a Merkle path.
1997
+ */
1998
+ export class MerklePath {
1999
+ private constructor();
2000
+ free(): void;
2001
+ [Symbol.dispose](): void;
2002
+ /**
2003
+ * Computes the root given a leaf index and value.
2004
+ */
2005
+ computeRoot(index: bigint, node: Word): Word;
2006
+ /**
2007
+ * Returns the depth of the path.
2008
+ */
2009
+ depth(): number;
2010
+ /**
2011
+ * Returns the nodes that make up the path.
2012
+ */
2013
+ nodes(): Word[];
2014
+ /**
2015
+ * Verifies the path against a root.
2016
+ */
2017
+ verify(index: bigint, node: Word, root: Word): boolean;
2018
+ }
2019
+
2020
+ /**
2021
+ * The identifier of a Miden network.
2022
+ */
2023
+ export class NetworkId {
2024
+ private constructor();
2025
+ free(): void;
2026
+ [Symbol.dispose](): void;
2027
+ /**
2028
+ * Builds a custom network ID from a provided custom prefix.
2029
+ *
2030
+ * Returns an error if the prefix is invalid.
2031
+ */
2032
+ static custom(custom_prefix: string): NetworkId;
2033
+ static devnet(): NetworkId;
2034
+ static mainnet(): NetworkId;
2035
+ static testnet(): NetworkId;
2036
+ }
2037
+
2038
+ /**
2039
+ * The type of a Miden network.
2040
+ */
2041
+ export enum NetworkType {
2042
+ /**
2043
+ * Main network prefix (`mm`).
2044
+ */
2045
+ Mainnet = 0,
2046
+ /**
2047
+ * Public test network prefix (`mtst`).
2048
+ */
2049
+ Testnet = 1,
2050
+ /**
2051
+ * Developer network prefix (`mdev`).
2052
+ */
2053
+ Devnet = 2,
2054
+ /**
2055
+ * Custom network prefix.
2056
+ */
2057
+ Custom = 3,
2058
+ }
2059
+
2060
+ /**
2061
+ * A note bundles public metadata with private details: assets, script, inputs, and a serial number
2062
+ * grouped into a recipient. The public identifier (`NoteId`) commits to those
2063
+ * details, while the nullifier stays hidden until the note is consumed. Assets move by
2064
+ * transferring them into the note; the script and inputs define how and when consumption can
2065
+ * happen. See `NoteRecipient` for the shape of the recipient data.
2066
+ */
2067
+ export class Note {
2068
+ free(): void;
2069
+ [Symbol.dispose](): void;
2070
+ /**
2071
+ * Returns the assets locked inside the note.
2072
+ */
2073
+ assets(): NoteAssets;
2074
+ /**
2075
+ * Returns the commitment to the note ID and metadata.
2076
+ */
2077
+ commitment(): Word;
2078
+ /**
2079
+ * Builds a P2IDE note that can be reclaimed or timelocked based on block heights.
2080
+ */
2081
+ static createP2IDENote(sender: AccountId, target: AccountId, assets: NoteAssets, reclaim_height: number | null | undefined, timelock_height: number | null | undefined, note_type: NoteType, attachment: NoteAttachment): Note;
2082
+ /**
2083
+ * Builds a standard P2ID note that targets the specified account.
2084
+ */
2085
+ static createP2IDNote(sender: AccountId, target: AccountId, assets: NoteAssets, note_type: NoteType, attachment: NoteAttachment): Note;
2086
+ /**
2087
+ * Deserializes a note from its byte representation.
2088
+ */
2089
+ static deserialize(bytes: Uint8Array): Note;
2090
+ /**
2091
+ * Returns the unique identifier of the note.
2092
+ */
2093
+ id(): NoteId;
2094
+ /**
2095
+ * Returns the public metadata associated with the note.
2096
+ */
2097
+ metadata(): NoteMetadata;
2098
+ /**
2099
+ * Creates a new note from the provided assets, metadata, and recipient.
2100
+ */
2101
+ constructor(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient);
2102
+ /**
2103
+ * Returns the note nullifier as a word.
2104
+ */
2105
+ nullifier(): Word;
2106
+ /**
2107
+ * Returns the recipient who can consume this note.
2108
+ */
2109
+ recipient(): NoteRecipient;
2110
+ /**
2111
+ * Returns the script that guards the note.
2112
+ */
2113
+ script(): NoteScript;
2114
+ /**
2115
+ * Serializes the note into bytes.
2116
+ */
2117
+ serialize(): Uint8Array;
2118
+ }
2119
+
2120
+ export class NoteAndArgs {
2121
+ free(): void;
2122
+ [Symbol.dispose](): void;
2123
+ /**
2124
+ * Creates a new note/args pair for transaction building.
2125
+ */
2126
+ constructor(note: Note, args?: Word | null);
2127
+ }
2128
+
2129
+ export class NoteAndArgsArray {
2130
+ /**
2131
+ ** Return copy of self without private attributes.
2132
+ */
2133
+ toJSON(): Object;
2134
+ /**
2135
+ * Return stringified version of self.
2136
+ */
2137
+ toString(): string;
2138
+ free(): void;
2139
+ [Symbol.dispose](): void;
2140
+ /**
2141
+ * Get element at index, will always return a clone to avoid aliasing issues.
2142
+ */
2143
+ get(index: number): NoteAndArgs;
2144
+ length(): number;
2145
+ constructor(elements?: NoteAndArgs[] | null);
2146
+ push(element: NoteAndArgs): void;
2147
+ /**
2148
+ * Replace the element at `index`. Borrows + clones the input
2149
+ * (mirrors `push`), so the caller's JS handle remains valid
2150
+ * after the call. Without this borrow, passing `elem` by
2151
+ * value would move the underlying Rust value out of the
2152
+ * caller's JS handle and any subsequent method on it would
2153
+ * panic with `"null pointer passed to rust"`.
2154
+ */
2155
+ replaceAt(index: number, elem: NoteAndArgs): void;
2156
+ }
2157
+
2158
+ export class NoteArray {
2159
+ /**
2160
+ ** Return copy of self without private attributes.
2161
+ */
2162
+ toJSON(): Object;
2163
+ /**
2164
+ * Return stringified version of self.
2165
+ */
2166
+ toString(): string;
2167
+ free(): void;
2168
+ [Symbol.dispose](): void;
2169
+ /**
2170
+ * Get element at index, will always return a clone to avoid aliasing issues.
2171
+ */
2172
+ get(index: number): Note;
2173
+ length(): number;
2174
+ constructor(elements?: Note[] | null);
2175
+ push(element: Note): void;
2176
+ /**
2177
+ * Replace the element at `index`. Borrows + clones the input
2178
+ * (mirrors `push`), so the caller's JS handle remains valid
2179
+ * after the call. Without this borrow, passing `elem` by
2180
+ * value would move the underlying Rust value out of the
2181
+ * caller's JS handle and any subsequent method on it would
2182
+ * panic with `"null pointer passed to rust"`.
2183
+ */
2184
+ replaceAt(index: number, elem: Note): void;
2185
+ }
2186
+
2187
+ /**
2188
+ * An asset container for a note.
2189
+ *
2190
+ * A note must contain at least 1 asset and can contain up to 256 assets. No duplicates are
2191
+ * allowed, but the order of assets is unspecified.
2192
+ *
2193
+ * All the assets in a note can be reduced to a single commitment which is computed by sequentially
2194
+ * hashing the assets. Note that the same list of assets can result in two different commitments if
2195
+ * the asset ordering is different.
2196
+ */
2197
+ export class NoteAssets {
2198
+ free(): void;
2199
+ [Symbol.dispose](): void;
2200
+ /**
2201
+ * Returns all fungible assets contained in the note.
2202
+ */
2203
+ fungibleAssets(): FungibleAsset[];
2204
+ /**
2205
+ * Creates a new asset list for a note.
2206
+ */
2207
+ constructor(assets_array?: FungibleAsset[] | null);
2208
+ /**
2209
+ * Adds a fungible asset to the collection.
2210
+ */
2211
+ push(asset: FungibleAsset): void;
2212
+ }
2213
+
2214
+ /**
2215
+ * An attachment to a note.
2216
+ *
2217
+ * Note attachments provide additional context about how notes should be processed.
2218
+ * For example, a network account target attachment indicates that the note should
2219
+ * be consumed by a specific network account.
2220
+ */
2221
+ export class NoteAttachment {
2222
+ free(): void;
2223
+ [Symbol.dispose](): void;
2224
+ /**
2225
+ * Returns the content as an array of Felts if the attachment kind is Array, otherwise None.
2226
+ */
2227
+ asArray(): FeltArray | undefined;
2228
+ /**
2229
+ * Returns the content as a Word if the attachment kind is Word, otherwise None.
2230
+ */
2231
+ asWord(): Word | undefined;
2232
+ /**
2233
+ * Returns the attachment kind.
2234
+ */
2235
+ attachmentKind(): NoteAttachmentKind;
2236
+ /**
2237
+ * Returns the attachment scheme.
2238
+ */
2239
+ attachmentScheme(): NoteAttachmentScheme;
2240
+ /**
2241
+ * Creates a default (empty) note attachment.
2242
+ */
2243
+ constructor();
2244
+ /**
2245
+ * Creates a new note attachment with Array content from the provided elements.
2246
+ */
2247
+ static newArray(scheme: NoteAttachmentScheme, elements: FeltArray): NoteAttachment;
2248
+ /**
2249
+ * Creates a new note attachment for a network account target.
2250
+ *
2251
+ * This attachment indicates that the note should be consumed by a specific network account.
2252
+ * Network accounts are accounts whose storage mode is `Network`, meaning the network (nodes)
2253
+ * can execute transactions on behalf of the account.
2254
+ *
2255
+ * # Arguments
2256
+ * * `target_id` - The ID of the network account that should consume the note
2257
+ * * `exec_hint` - A hint about when the note can be executed
2258
+ *
2259
+ * # Errors
2260
+ * Returns an error if the target account is not a network account.
2261
+ */
2262
+ static newNetworkAccountTarget(target_id: AccountId, exec_hint: NoteExecutionHint): NoteAttachment;
2263
+ /**
2264
+ * Creates a new note attachment with Word content from the provided word.
2265
+ */
2266
+ static newWord(scheme: NoteAttachmentScheme, word: Word): NoteAttachment;
2267
+ }
2268
+
2269
+ /**
2270
+ * Defines the payload shape of a note attachment.
2271
+ */
2272
+ export enum NoteAttachmentKind {
2273
+ None = 0,
2274
+ Word = 1,
2275
+ Array = 2,
2276
+ }
2277
+
2278
+ /**
2279
+ * Describes the type of a note attachment.
2280
+ *
2281
+ * Value `0` is reserved to signal that the scheme is none or absent. Whenever the kind of
2282
+ * attachment is not standardized or interoperability is unimportant, this none value can be used.
2283
+ */
2284
+ export class NoteAttachmentScheme {
2285
+ free(): void;
2286
+ [Symbol.dispose](): void;
2287
+ /**
2288
+ * Returns the note attachment scheme as a u32.
2289
+ */
2290
+ asU32(): number;
2291
+ /**
2292
+ * Returns true if the attachment scheme is the reserved value that signals an absent scheme.
2293
+ */
2294
+ isNone(): boolean;
2295
+ /**
2296
+ * Creates a new `NoteAttachmentScheme` from a u32.
2297
+ */
2298
+ constructor(scheme: number);
2299
+ /**
2300
+ * Returns the `NoteAttachmentScheme` that signals the absence of an attachment scheme.
2301
+ */
2302
+ static none(): NoteAttachmentScheme;
2303
+ }
2304
+
2305
+ export class NoteConsumability {
2306
+ private constructor();
2307
+ free(): void;
2308
+ [Symbol.dispose](): void;
2309
+ /**
2310
+ * Returns the account that can consume the note.
2311
+ */
2312
+ accountId(): AccountId;
2313
+ /**
2314
+ * Returns the consumption status of the note.
2315
+ */
2316
+ consumptionStatus(): NoteConsumptionStatus;
2317
+ }
2318
+
2319
+ /**
2320
+ * Describes if a note could be consumed under a specific conditions: target account state and
2321
+ * block height.
2322
+ */
2323
+ export class NoteConsumptionStatus {
2324
+ private constructor();
2325
+ free(): void;
2326
+ [Symbol.dispose](): void;
2327
+ /**
2328
+ * Constructs a `NoteConsumptionStatus` that is consumable.
2329
+ */
2330
+ static consumable(): NoteConsumptionStatus;
2331
+ /**
2332
+ * Constructs a `NoteConsumptionStatus` that is consumable after a specific block height.
2333
+ */
2334
+ static consumableAfter(block_height: number): NoteConsumptionStatus;
2335
+ /**
2336
+ * Returns the block number at which the note can be consumed.
2337
+ * Returns None if the note is already consumable or never possible
2338
+ */
2339
+ consumableAfterBlock(): number | undefined;
2340
+ /**
2341
+ * Constructs a `NoteConsumptionStatus` that is consumable with authorization.
2342
+ */
2343
+ static consumableWithAuthorization(): NoteConsumptionStatus;
2344
+ /**
2345
+ * Constructs a `NoteConsumptionStatus` that is never consumable.
2346
+ */
2347
+ static neverConsumable(err: string): NoteConsumptionStatus;
2348
+ /**
2349
+ * Constructs a `NoteConsumptionStatus` that is unconsumable due to conditions.
2350
+ */
2351
+ static unconsumableConditions(): NoteConsumptionStatus;
2352
+ }
2353
+
2354
+ /**
2355
+ * Details of a note consisting of assets, script, inputs, and a serial number.
2356
+ *
2357
+ * See the {@link Note} type for more details.
2358
+ */
2359
+ export class NoteDetails {
2360
+ free(): void;
2361
+ [Symbol.dispose](): void;
2362
+ /**
2363
+ * Returns the assets locked by the note.
2364
+ */
2365
+ assets(): NoteAssets;
2366
+ /**
2367
+ * Returns the note identifier derived from these details.
2368
+ */
2369
+ id(): NoteId;
2370
+ /**
2371
+ * Creates a new set of note details from the given assets and recipient.
2372
+ */
2373
+ constructor(note_assets: NoteAssets, note_recipient: NoteRecipient);
2374
+ /**
2375
+ * Returns the note nullifier as a word.
2376
+ */
2377
+ nullifier(): Word;
2378
+ /**
2379
+ * Returns the recipient which controls when the note can be consumed.
2380
+ */
2381
+ recipient(): NoteRecipient;
2382
+ }
2383
+
2384
+ /**
2385
+ * Pair of note details and tag used when declaring expected notes.
2386
+ */
2387
+ export class NoteDetailsAndTag {
2388
+ free(): void;
2389
+ [Symbol.dispose](): void;
2390
+ /**
2391
+ * Creates a new pair from note details and tag.
2392
+ */
2393
+ constructor(note_details: NoteDetails, tag: NoteTag);
2394
+ /**
2395
+ * Returns the note details.
2396
+ */
2397
+ readonly noteDetails: NoteDetails;
2398
+ /**
2399
+ * Returns the note tag.
2400
+ */
2401
+ readonly tag: NoteTag;
2402
+ }
2403
+
2404
+ export class NoteDetailsAndTagArray {
2405
+ /**
2406
+ ** Return copy of self without private attributes.
2407
+ */
2408
+ toJSON(): Object;
2409
+ /**
2410
+ * Return stringified version of self.
2411
+ */
2412
+ toString(): string;
2413
+ free(): void;
2414
+ [Symbol.dispose](): void;
2415
+ /**
2416
+ * Get element at index, will always return a clone to avoid aliasing issues.
2417
+ */
2418
+ get(index: number): NoteDetailsAndTag;
2419
+ length(): number;
2420
+ constructor(elements?: NoteDetailsAndTag[] | null);
2421
+ push(element: NoteDetailsAndTag): void;
2422
+ /**
2423
+ * Replace the element at `index`. Borrows + clones the input
2424
+ * (mirrors `push`), so the caller's JS handle remains valid
2425
+ * after the call. Without this borrow, passing `elem` by
2426
+ * value would move the underlying Rust value out of the
2427
+ * caller's JS handle and any subsequent method on it would
2428
+ * panic with `"null pointer passed to rust"`.
2429
+ */
2430
+ replaceAt(index: number, elem: NoteDetailsAndTag): void;
2431
+ }
2432
+
2433
+ /**
2434
+ * Hint describing when a note can be consumed.
2435
+ */
2436
+ export class NoteExecutionHint {
2437
+ private constructor();
2438
+ free(): void;
2439
+ [Symbol.dispose](): void;
2440
+ /**
2441
+ * Creates a hint that activates after the given block number.
2442
+ */
2443
+ static afterBlock(block_num: number): NoteExecutionHint;
2444
+ /**
2445
+ * Creates a hint indicating the note can always be consumed.
2446
+ */
2447
+ static always(): NoteExecutionHint;
2448
+ /**
2449
+ * Returns whether the note can be consumed at the provided block height.
2450
+ */
2451
+ canBeConsumed(block_num: number): boolean;
2452
+ /**
2453
+ * Reconstructs a hint from its encoded tag and payload.
2454
+ */
2455
+ static fromParts(tag: number, payload: number): NoteExecutionHint;
2456
+ /**
2457
+ * Creates a hint that does not specify any execution constraint.
2458
+ */
2459
+ static none(): NoteExecutionHint;
2460
+ /**
2461
+ * Creates a hint that allows execution in a specific slot of a round.
2462
+ */
2463
+ static onBlockSlot(epoch_len: number, slot_len: number, slot_offset: number): NoteExecutionHint;
2464
+ }
2465
+
2466
+ export enum NoteExportFormat {
2467
+ Id = 0,
2468
+ Full = 1,
2469
+ Details = 2,
2470
+ }
2471
+
2472
+ /**
2473
+ * A serialized representation of a note.
2474
+ */
2475
+ export class NoteFile {
2476
+ private constructor();
2477
+ /**
2478
+ ** Return copy of self without private attributes.
2479
+ */
2480
+ toJSON(): Object;
2481
+ /**
2482
+ * Return stringified version of self.
2483
+ */
2484
+ toString(): string;
2485
+ free(): void;
2486
+ [Symbol.dispose](): void;
2487
+ /**
2488
+ * Returns the after-block hint when present.
2489
+ */
2490
+ afterBlockNum(): number | undefined;
2491
+ /**
2492
+ * Given a valid byte representation of a `NoteFile`,
2493
+ * return it as a struct.
2494
+ */
2495
+ static deserialize(bytes: Uint8Array): NoteFile;
2496
+ /**
2497
+ * Creates a `NoteFile` from an input note, preserving proof when available.
2498
+ */
2499
+ static fromInputNote(note: InputNote): NoteFile;
2500
+ /**
2501
+ * Creates a `NoteFile` from note details.
2502
+ */
2503
+ static fromNoteDetails(note_details: NoteDetails): NoteFile;
2504
+ /**
2505
+ * Creates a `NoteFile` from a note ID.
2506
+ */
2507
+ static fromNoteId(note_details: NoteId): NoteFile;
2508
+ /**
2509
+ * Creates a `NoteFile` from an output note, choosing details when present.
2510
+ */
2511
+ static fromOutputNote(note: OutputNote): NoteFile;
2512
+ /**
2513
+ * Returns the inclusion proof if present.
2514
+ */
2515
+ inclusionProof(): NoteInclusionProof | undefined;
2516
+ /**
2517
+ * Returns the full note when the file includes it.
2518
+ */
2519
+ note(): Note | undefined;
2520
+ /**
2521
+ * Returns the note details if present.
2522
+ */
2523
+ noteDetails(): NoteDetails | undefined;
2524
+ /**
2525
+ * Returns the note ID for any `NoteFile` variant.
2526
+ */
2527
+ noteId(): NoteId;
2528
+ /**
2529
+ * Returns the note tag hint when present.
2530
+ */
2531
+ noteTag(): NoteTag | undefined;
2532
+ /**
2533
+ * Returns this `NoteFile`'s types.
2534
+ */
2535
+ noteType(): string;
2536
+ /**
2537
+ * Returns the note nullifier when present.
2538
+ */
2539
+ nullifier(): string | undefined;
2540
+ /**
2541
+ * Turn a notefile into its byte representation.
2542
+ */
2543
+ serialize(): Uint8Array;
2544
+ }
2545
+
2546
+ /**
2547
+ * Filter options for querying notes from the store.
2548
+ */
2549
+ export class NoteFilter {
2550
+ free(): void;
2551
+ [Symbol.dispose](): void;
2552
+ /**
2553
+ * Creates a new filter for the given type and optional note IDs.
2554
+ */
2555
+ constructor(note_type: NoteFilterTypes, note_ids?: NoteId[] | null);
2556
+ }
2557
+
2558
+ export enum NoteFilterTypes {
2559
+ All = 0,
2560
+ Consumed = 1,
2561
+ Committed = 2,
2562
+ Expected = 3,
2563
+ Processing = 4,
2564
+ List = 5,
2565
+ Unique = 6,
2566
+ Nullifiers = 7,
2567
+ Unverified = 8,
2568
+ }
2569
+
2570
+ /**
2571
+ * Holds the strictly required, public information of a note.
2572
+ *
2573
+ * See `NoteId` and `NoteMetadata` for additional details.
2574
+ */
2575
+ export class NoteHeader {
2576
+ private constructor();
2577
+ free(): void;
2578
+ [Symbol.dispose](): void;
2579
+ /**
2580
+ * Returns the unique identifier for the note.
2581
+ */
2582
+ id(): NoteId;
2583
+ /**
2584
+ * Returns the public metadata attached to the note.
2585
+ */
2586
+ metadata(): NoteMetadata;
2587
+ /**
2588
+ * Returns a commitment to the note ID and metadata.
2589
+ */
2590
+ toCommitment(): Word;
2591
+ }
2592
+
2593
+ /**
2594
+ * Returns a unique identifier of a note, which is simultaneously a commitment to the note.
2595
+ *
2596
+ * Note ID is computed as:
2597
+ *
2598
+ * > `hash(recipient, asset_commitment)`
2599
+ *
2600
+ * where `recipient` is defined as:
2601
+ *
2602
+ * > `hash(hash(hash(serial_num, ZERO), script_root), input_commitment)`
2603
+ *
2604
+ * This achieves the following properties:
2605
+ * - Every note can be reduced to a single unique ID.
2606
+ * - To compute a note ID, we do not need to know the note's `serial_num`. Knowing the hash of the
2607
+ * `serial_num` (as well as script root, input commitment, and note assets) is sufficient.
2608
+ */
2609
+ export class NoteId {
2610
+ free(): void;
2611
+ [Symbol.dispose](): void;
2612
+ /**
2613
+ * Parses a note ID from its hex encoding.
2614
+ */
2615
+ static fromHex(hex: string): NoteId;
2616
+ /**
2617
+ * Builds a note ID from the recipient and asset commitments.
2618
+ */
2619
+ constructor(recipient_digest: Word, asset_commitment_digest: Word);
2620
+ /**
2621
+ * Returns the canonical hex representation of the note ID.
2622
+ */
2623
+ toString(): string;
2624
+ }
2625
+
2626
+ /**
2627
+ * Note ID paired with optional arguments for inclusion in a transaction request.
2628
+ */
2629
+ export class NoteIdAndArgs {
2630
+ free(): void;
2631
+ [Symbol.dispose](): void;
2632
+ /**
2633
+ * Creates a new NoteId/args pair.
2634
+ */
2635
+ constructor(note_id: NoteId, args?: Word | null);
2636
+ }
2637
+
2638
+ export class NoteIdAndArgsArray {
2639
+ /**
2640
+ ** Return copy of self without private attributes.
2641
+ */
2642
+ toJSON(): Object;
2643
+ /**
2644
+ * Return stringified version of self.
2645
+ */
2646
+ toString(): string;
2647
+ free(): void;
2648
+ [Symbol.dispose](): void;
2649
+ /**
2650
+ * Get element at index, will always return a clone to avoid aliasing issues.
2651
+ */
2652
+ get(index: number): NoteIdAndArgs;
2653
+ length(): number;
2654
+ constructor(elements?: NoteIdAndArgs[] | null);
2655
+ push(element: NoteIdAndArgs): void;
2656
+ /**
2657
+ * Replace the element at `index`. Borrows + clones the input
2658
+ * (mirrors `push`), so the caller's JS handle remains valid
2659
+ * after the call. Without this borrow, passing `elem` by
2660
+ * value would move the underlying Rust value out of the
2661
+ * caller's JS handle and any subsequent method on it would
2662
+ * panic with `"null pointer passed to rust"`.
2663
+ */
2664
+ replaceAt(index: number, elem: NoteIdAndArgs): void;
2665
+ }
2666
+
2667
+ /**
2668
+ * Contains the data required to prove inclusion of a note in the canonical chain.
2669
+ */
2670
+ export class NoteInclusionProof {
2671
+ private constructor();
2672
+ free(): void;
2673
+ [Symbol.dispose](): void;
2674
+ /**
2675
+ * Returns the location of the note within the tree.
2676
+ */
2677
+ location(): NoteLocation;
2678
+ /**
2679
+ * Returns the Merkle authentication path for the note.
2680
+ */
2681
+ notePath(): MerklePath;
2682
+ }
2683
+
2684
+ /**
2685
+ * Contains information about the location of a note.
2686
+ */
2687
+ export class NoteLocation {
2688
+ private constructor();
2689
+ free(): void;
2690
+ [Symbol.dispose](): void;
2691
+ /**
2692
+ * Returns the index of the note leaf within the block's note tree.
2693
+ */
2694
+ blockNoteTreeIndex(): number;
2695
+ /**
2696
+ * Returns the block height containing the note.
2697
+ */
2698
+ blockNum(): number;
2699
+ }
2700
+
2701
+ /**
2702
+ * Metadata associated with a note.
2703
+ *
2704
+ * This metadata includes the sender, note type, tag, and an optional attachment.
2705
+ * Attachments provide additional context about how notes should be processed.
2706
+ */
2707
+ export class NoteMetadata {
2708
+ free(): void;
2709
+ [Symbol.dispose](): void;
2710
+ /**
2711
+ * Returns the attachment of the note.
2712
+ */
2713
+ attachment(): NoteAttachment;
2714
+ /**
2715
+ * Creates metadata for a note.
2716
+ */
2717
+ constructor(sender: AccountId, note_type: NoteType, note_tag: NoteTag);
2718
+ /**
2719
+ * Returns whether the note is private, encrypted, or public.
2720
+ */
2721
+ noteType(): NoteType;
2722
+ /**
2723
+ * Returns the account that created the note.
2724
+ */
2725
+ sender(): AccountId;
2726
+ /**
2727
+ * Returns the tag associated with the note.
2728
+ */
2729
+ tag(): NoteTag;
2730
+ /**
2731
+ * Adds an attachment to this metadata and returns the updated metadata.
2732
+ *
2733
+ * Attachments provide additional context about how notes should be processed.
2734
+ * For example, a `NetworkAccountTarget` attachment indicates that the note
2735
+ * should be consumed by a specific network account.
2736
+ */
2737
+ withAttachment(attachment: NoteAttachment): NoteMetadata;
2738
+ /**
2739
+ * Sets the tag for this metadata and returns the updated metadata.
2740
+ */
2741
+ withTag(tag: NoteTag): NoteMetadata;
2742
+ }
2743
+
2744
+ /**
2745
+ * Value that describes under which condition a note can be consumed.
2746
+ *
2747
+ * The recipient is not an account address, instead it is a value that describes when a note can be
2748
+ * consumed. Because not all notes have predetermined consumer addresses, e.g. swap notes can be
2749
+ * consumed by anyone, the recipient is defined as the code and its storage, that when successfully
2750
+ * executed results in the note's consumption.
2751
+ *
2752
+ * Recipient is computed as a nested hash of the serial number, the script root, and the storage
2753
+ * commitment, ensuring the recipient digest binds all three pieces of data together.
2754
+ */
2755
+ export class NoteRecipient {
2756
+ free(): void;
2757
+ [Symbol.dispose](): void;
2758
+ /**
2759
+ * Returns the digest of the recipient data (used in the note commitment).
2760
+ */
2761
+ digest(): Word;
2762
+ /**
2763
+ * Creates a note recipient from its serial number, script, and storage.
2764
+ */
2765
+ constructor(serial_num: Word, note_script: NoteScript, storage: NoteStorage);
2766
+ /**
2767
+ * Returns the script that controls consumption.
2768
+ */
2769
+ script(): NoteScript;
2770
+ /**
2771
+ * Returns the serial number that prevents double spends.
2772
+ */
2773
+ serialNum(): Word;
2774
+ /**
2775
+ * Returns the storage provided to the script.
2776
+ */
2777
+ storage(): NoteStorage;
2778
+ }
2779
+
2780
+ export class NoteRecipientArray {
2781
+ /**
2782
+ ** Return copy of self without private attributes.
2783
+ */
2784
+ toJSON(): Object;
2785
+ /**
2786
+ * Return stringified version of self.
2787
+ */
2788
+ toString(): string;
2789
+ free(): void;
2790
+ [Symbol.dispose](): void;
2791
+ /**
2792
+ * Get element at index, will always return a clone to avoid aliasing issues.
2793
+ */
2794
+ get(index: number): NoteRecipient;
2795
+ length(): number;
2796
+ constructor(elements?: NoteRecipient[] | null);
2797
+ push(element: NoteRecipient): void;
2798
+ /**
2799
+ * Replace the element at `index`. Borrows + clones the input
2800
+ * (mirrors `push`), so the caller's JS handle remains valid
2801
+ * after the call. Without this borrow, passing `elem` by
2802
+ * value would move the underlying Rust value out of the
2803
+ * caller's JS handle and any subsequent method on it would
2804
+ * panic with `"null pointer passed to rust"`.
2805
+ */
2806
+ replaceAt(index: number, elem: NoteRecipient): void;
2807
+ }
2808
+
2809
+ /**
2810
+ * An executable program of a note.
2811
+ *
2812
+ * A note's script represents a program which must be executed for a note to be consumed. As such
2813
+ * it defines the rules and side effects of consuming a given note.
2814
+ */
2815
+ export class NoteScript {
2816
+ private constructor();
2817
+ free(): void;
2818
+ [Symbol.dispose](): void;
2819
+ /**
2820
+ * Deserializes a script from bytes.
2821
+ */
2822
+ static deserialize(bytes: Uint8Array): NoteScript;
2823
+ /**
2824
+ * Creates a `NoteScript` from the given `Package`.
2825
+ * The package must contain a library with exactly one procedure annotated with
2826
+ * `@note_script`.
2827
+ */
2828
+ static fromPackage(_package: Package): NoteScript;
2829
+ /**
2830
+ * Returns the well-known P2ID script.
2831
+ */
2832
+ static p2id(): NoteScript;
2833
+ /**
2834
+ * Returns the well-known P2IDE script (P2ID with execution hint).
2835
+ */
2836
+ static p2ide(): NoteScript;
2837
+ /**
2838
+ * Returns the MAST root of this script.
2839
+ */
2840
+ root(): Word;
2841
+ /**
2842
+ * Serializes the script into bytes.
2843
+ */
2844
+ serialize(): Uint8Array;
2845
+ /**
2846
+ * Returns the well-known SWAP script.
2847
+ */
2848
+ static swap(): NoteScript;
2849
+ /**
2850
+ * Pretty-prints the MAST source for this script.
2851
+ */
2852
+ toString(): string;
2853
+ }
2854
+
2855
+ /**
2856
+ * A container for note storage items.
2857
+ *
2858
+ * A note can be associated with up to 1024 storage items. Each item is represented by a single
2859
+ * field element. Thus, note storage can contain up to ~8 KB of data.
2860
+ *
2861
+ * All storage items associated with a note can be reduced to a single commitment which is
2862
+ * computed as an RPO256 hash over the storage elements.
2863
+ */
2864
+ export class NoteStorage {
2865
+ free(): void;
2866
+ [Symbol.dispose](): void;
2867
+ /**
2868
+ * Returns the raw storage items as an array of field elements.
2869
+ */
2870
+ items(): Felt[];
2871
+ /**
2872
+ * Creates note storage from a list of field elements.
2873
+ */
2874
+ constructor(felt_array: FeltArray);
2875
+ }
2876
+
2877
+ /**
2878
+ * Represents a single block's worth of note sync data.
2879
+ */
2880
+ export class NoteSyncBlock {
2881
+ private constructor();
2882
+ free(): void;
2883
+ [Symbol.dispose](): void;
2884
+ /**
2885
+ * Returns the block header for this block.
2886
+ */
2887
+ blockHeader(): BlockHeader;
2888
+ /**
2889
+ * Returns the MMR path for the block header.
2890
+ */
2891
+ mmrPath(): MerklePath;
2892
+ /**
2893
+ * Returns the committed notes in this block.
2894
+ */
2895
+ notes(): CommittedNote[];
2896
+ }
2897
+
2898
+ /**
2899
+ * Represents the response data from `syncNotes`.
2900
+ */
2901
+ export class NoteSyncInfo {
2902
+ private constructor();
2903
+ free(): void;
2904
+ [Symbol.dispose](): void;
2905
+ /**
2906
+ * Returns the first block header associated with matching notes, if any.
2907
+ */
2908
+ blockHeader(): BlockHeader | undefined;
2909
+ /**
2910
+ * Returns the last block checked by the node. Used as a cursor for pagination.
2911
+ */
2912
+ blockTo(): number;
2913
+ /**
2914
+ * Returns the blocks containing matching notes.
2915
+ */
2916
+ blocks(): NoteSyncBlock[];
2917
+ /**
2918
+ * Returns the latest block number in the chain.
2919
+ */
2920
+ chainTip(): number;
2921
+ /**
2922
+ * Returns the first block MMR path associated with matching notes, if any.
2923
+ */
2924
+ mmrPath(): MerklePath | undefined;
2925
+ /**
2926
+ * Returns the committed notes across all matching blocks.
2927
+ */
2928
+ notes(): CommittedNote[];
2929
+ }
2930
+
2931
+ /**
2932
+ * Note tags are 32-bits of data that serve as best-effort filters for notes.
2933
+ *
2934
+ * Tags enable quick lookups for notes related to particular use cases, scripts, or account
2935
+ * prefixes.
2936
+ */
2937
+ export class NoteTag {
2938
+ free(): void;
2939
+ [Symbol.dispose](): void;
2940
+ /**
2941
+ * Returns the inner u32 value of this tag.
2942
+ */
2943
+ asU32(): number;
2944
+ /**
2945
+ * Creates a new `NoteTag` from an arbitrary u32.
2946
+ */
2947
+ constructor(tag: number);
2948
+ /**
2949
+ * Constructs a note tag that targets the given account ID.
2950
+ */
2951
+ static withAccountTarget(account_id: AccountId): NoteTag;
2952
+ /**
2953
+ * Constructs a note tag that targets the given account ID with a custom tag length.
2954
+ */
2955
+ static withCustomAccountTarget(account_id: AccountId, tag_len: number): NoteTag;
2956
+ }
2957
+
2958
+ /**
2959
+ * Visibility level for note contents when published to the network.
2960
+ */
2961
+ export enum NoteType {
2962
+ /**
2963
+ * Notes with this type have only their hash published to the network.
2964
+ */
2965
+ Private = 2,
2966
+ /**
2967
+ * Notes with this type are fully shared with the network.
2968
+ */
2969
+ Public = 1,
2970
+ }
2971
+
2972
+ /**
2973
+ * Representation of a note produced by a transaction (full or partial).
2974
+ */
2975
+ export class OutputNote {
2976
+ private constructor();
2977
+ free(): void;
2978
+ [Symbol.dispose](): void;
2979
+ /**
2980
+ * Returns the assets if they are present.
2981
+ */
2982
+ assets(): NoteAssets | undefined;
2983
+ /**
2984
+ * Wraps a full note output.
2985
+ */
2986
+ static full(note: Note): OutputNote;
2987
+ /**
2988
+ * Returns the note ID for this output.
2989
+ */
2990
+ id(): NoteId;
2991
+ /**
2992
+ * Converts into a full note if the data is present.
2993
+ */
2994
+ intoFull(): Note | undefined;
2995
+ /**
2996
+ * Returns the metadata that accompanies this output.
2997
+ */
2998
+ metadata(): NoteMetadata;
2999
+ /**
3000
+ * Wraps a partial note containing assets and recipient only.
3001
+ */
3002
+ static partial(partial_note: PartialNote): OutputNote;
3003
+ /**
3004
+ * Returns the recipient digest.
3005
+ */
3006
+ recipientDigest(): Word;
3007
+ }
3008
+
3009
+ export class OutputNoteArray {
3010
+ /**
3011
+ ** Return copy of self without private attributes.
3012
+ */
3013
+ toJSON(): Object;
3014
+ /**
3015
+ * Return stringified version of self.
3016
+ */
3017
+ toString(): string;
3018
+ free(): void;
3019
+ [Symbol.dispose](): void;
3020
+ /**
3021
+ * Get element at index, will always return a clone to avoid aliasing issues.
3022
+ */
3023
+ get(index: number): OutputNote;
3024
+ length(): number;
3025
+ constructor(elements?: OutputNote[] | null);
3026
+ push(element: OutputNote): void;
3027
+ /**
3028
+ * Replace the element at `index`. Borrows + clones the input
3029
+ * (mirrors `push`), so the caller's JS handle remains valid
3030
+ * after the call. Without this borrow, passing `elem` by
3031
+ * value would move the underlying Rust value out of the
3032
+ * caller's JS handle and any subsequent method on it would
3033
+ * panic with `"null pointer passed to rust"`.
3034
+ */
3035
+ replaceAt(index: number, elem: OutputNote): void;
3036
+ }
3037
+
3038
+ /**
3039
+ * Represents an output note tracked by the client store.
3040
+ */
3041
+ export class OutputNoteRecord {
3042
+ private constructor();
3043
+ free(): void;
3044
+ [Symbol.dispose](): void;
3045
+ /**
3046
+ * Returns the note assets.
3047
+ */
3048
+ assets(): NoteAssets;
3049
+ /**
3050
+ * Returns the expected block height for the note.
3051
+ */
3052
+ expectedHeight(): number;
3053
+ /**
3054
+ * Returns the note ID.
3055
+ */
3056
+ id(): NoteId;
3057
+ /**
3058
+ * Returns the inclusion proof when the note is committed.
3059
+ */
3060
+ inclusionProof(): NoteInclusionProof | undefined;
3061
+ /**
3062
+ * Returns true if the note is committed on chain.
3063
+ */
3064
+ isCommitted(): boolean;
3065
+ /**
3066
+ * Returns true if the note has been consumed on chain.
3067
+ */
3068
+ isConsumed(): boolean;
3069
+ /**
3070
+ * Returns the note metadata.
3071
+ */
3072
+ metadata(): NoteMetadata;
3073
+ /**
3074
+ * Returns the nullifier when the recipient is known.
3075
+ */
3076
+ nullifier(): string | undefined;
3077
+ /**
3078
+ * Returns the recipient details if available.
3079
+ */
3080
+ recipient(): NoteRecipient | undefined;
3081
+ /**
3082
+ * Returns the recipient digest committed for the note.
3083
+ */
3084
+ recipientDigest(): Word;
3085
+ /**
3086
+ * Returns the current processing state for this note.
3087
+ */
3088
+ state(): OutputNoteState;
3089
+ }
3090
+
3091
+ export enum OutputNoteState {
3092
+ ExpectedPartial = 0,
3093
+ ExpectedFull = 1,
3094
+ CommittedPartial = 2,
3095
+ CommittedFull = 3,
3096
+ Consumed = 4,
3097
+ }
3098
+
3099
+ /**
3100
+ * Contains a list of output notes of a transaction. The list can be empty if the transaction does
3101
+ * not produce any notes.
3102
+ */
3103
+ export class OutputNotes {
3104
+ private constructor();
3105
+ free(): void;
3106
+ [Symbol.dispose](): void;
3107
+ /**
3108
+ * Returns the commitment to all output notes.
3109
+ */
3110
+ commitment(): Word;
3111
+ /**
3112
+ * Returns the output note at the specified index.
3113
+ */
3114
+ getNote(index: number): OutputNote;
3115
+ /**
3116
+ * Returns true if there are no output notes.
3117
+ */
3118
+ isEmpty(): boolean;
3119
+ /**
3120
+ * Returns all output notes as a vector.
3121
+ */
3122
+ notes(): OutputNote[];
3123
+ /**
3124
+ * Returns the number of notes emitted.
3125
+ */
3126
+ numNotes(): number;
3127
+ }
3128
+
3129
+ /**
3130
+ * Compiled VM package containing libraries and metadata.
3131
+ */
3132
+ export class Package {
3133
+ private constructor();
3134
+ free(): void;
3135
+ [Symbol.dispose](): void;
3136
+ /**
3137
+ * Returns the underlying library of a `Package`.
3138
+ * Fails if the package is not a library.
3139
+ */
3140
+ asLibrary(): Library;
3141
+ /**
3142
+ * Returns the underlying program of a `Package`.
3143
+ * Fails if the package is not a program.
3144
+ */
3145
+ asProgram(): Program;
3146
+ /**
3147
+ * Deserializes a package from bytes.
3148
+ */
3149
+ static deserialize(bytes: Uint8Array): Package;
3150
+ /**
3151
+ * Serializes the package into bytes.
3152
+ */
3153
+ serialize(): Uint8Array;
3154
+ }
3155
+
3156
+ /**
3157
+ * Partial information about a note.
3158
+ *
3159
+ * Partial note consists of `NoteMetadata`, `NoteAssets`, and a recipient digest (see
3160
+ * `NoteRecipient`). However, it does not contain detailed recipient info, including
3161
+ * note script, note inputs, and note's serial number. This means that a partial note is sufficient
3162
+ * to compute note ID and note header, but not sufficient to compute note nullifier, and generally
3163
+ * does not have enough info to execute the note.
3164
+ */
3165
+ export class PartialNote {
3166
+ private constructor();
3167
+ free(): void;
3168
+ [Symbol.dispose](): void;
3169
+ /**
3170
+ * Returns the assets locked in the note.
3171
+ */
3172
+ assets(): NoteAssets;
3173
+ /**
3174
+ * Returns the identifier of the partial note.
3175
+ */
3176
+ id(): NoteId;
3177
+ /**
3178
+ * Returns the metadata attached to the note.
3179
+ */
3180
+ metadata(): NoteMetadata;
3181
+ /**
3182
+ * Returns the digest of the recipient information.
3183
+ */
3184
+ recipientDigest(): Word;
3185
+ }
3186
+
3187
+ /**
3188
+ * Poseidon2 hashing helpers exposed to JavaScript.
3189
+ */
3190
+ export class Poseidon2 {
3191
+ private constructor();
3192
+ free(): void;
3193
+ [Symbol.dispose](): void;
3194
+ /**
3195
+ * Computes a Poseidon2 digest from the provided field elements.
3196
+ */
3197
+ static hashElements(felt_array: FeltArray): Word;
3198
+ }
3199
+
3200
+ export class ProcedureThreshold {
3201
+ free(): void;
3202
+ [Symbol.dispose](): void;
3203
+ constructor(proc_root: Word, threshold: number);
3204
+ readonly procRoot: Word;
3205
+ readonly threshold: number;
3206
+ }
3207
+
3208
+ export class Program {
3209
+ private constructor();
3210
+ free(): void;
3211
+ [Symbol.dispose](): void;
3212
+ }
3213
+
3214
+ /**
3215
+ * Result of executing and proving a transaction. Contains all the data required to verify that a
3216
+ * transaction was executed correctly.
3217
+ */
3218
+ export class ProvenTransaction {
3219
+ private constructor();
3220
+ free(): void;
3221
+ [Symbol.dispose](): void;
3222
+ /**
3223
+ * Returns the account ID the transaction was executed against.
3224
+ */
3225
+ accountId(): AccountId;
3226
+ /**
3227
+ * Deserializes a proven transaction from bytes.
3228
+ */
3229
+ static deserialize(bytes: Uint8Array): ProvenTransaction;
3230
+ /**
3231
+ * Returns the block number at which the transaction expires.
3232
+ */
3233
+ expirationBlockNumber(): number;
3234
+ /**
3235
+ * Returns the transaction ID.
3236
+ */
3237
+ id(): TransactionId;
3238
+ /**
3239
+ * Returns the nullifiers of the consumed input notes.
3240
+ */
3241
+ nullifiers(): Word[];
3242
+ /**
3243
+ * Returns the commitment of the reference block.
3244
+ */
3245
+ refBlockCommitment(): Word;
3246
+ /**
3247
+ * Returns the reference block number used during execution.
3248
+ */
3249
+ refBlockNumber(): number;
3250
+ /**
3251
+ * Serializes the proven transaction into bytes.
3252
+ */
3253
+ serialize(): Uint8Array;
3254
+ }
3255
+
3256
+ export class PublicKey {
3257
+ private constructor();
3258
+ free(): void;
3259
+ [Symbol.dispose](): void;
3260
+ /**
3261
+ * Deserializes a public key from bytes.
3262
+ */
3263
+ static deserialize(bytes: Uint8Array): PublicKey;
3264
+ /**
3265
+ * Recovers a public key from a signature (only supported for `RpoFalcon512`).
3266
+ */
3267
+ static recoverFrom(message: Word, signature: Signature): PublicKey;
3268
+ /**
3269
+ * Serializes the public key into bytes.
3270
+ */
3271
+ serialize(): Uint8Array;
3272
+ /**
3273
+ * Returns the commitment corresponding to this public key.
3274
+ */
3275
+ toCommitment(): Word;
3276
+ /**
3277
+ * Verifies a blind message word against the signature.
3278
+ */
3279
+ verify(message: Word, signature: Signature): boolean;
3280
+ /**
3281
+ * Verifies a signature over arbitrary signing inputs.
3282
+ */
3283
+ verifyData(signing_inputs: SigningInputs, signature: Signature): boolean;
3284
+ }
3285
+
3286
+ /**
3287
+ * RPC Client for interacting with Miden nodes directly.
3288
+ */
3289
+ export class RpcClient {
3290
+ free(): void;
3291
+ [Symbol.dispose](): void;
3292
+ /**
3293
+ * Fetches account details for a specific account ID.
3294
+ */
3295
+ getAccountDetails(account_id: AccountId): Promise<FetchedAccount>;
3296
+ /**
3297
+ * Fetches an account proof from the node.
3298
+ *
3299
+ * This is a lighter-weight alternative to `getAccountDetails` that makes a single RPC call
3300
+ * and returns the account proof alongside the account header, storage slot values, and
3301
+ * account code without reconstructing the full account state.
3302
+ *
3303
+ * For private accounts, the proof is returned but account details will not be available
3304
+ * since they are not stored on-chain.
3305
+ *
3306
+ * Useful for reading storage slot values (e.g., faucet metadata) or specific storage map
3307
+ * entries without the overhead of fetching the complete account with all vault assets and
3308
+ * storage map entries.
3309
+ *
3310
+ * @param `account_id` - The account to fetch the proof for.
3311
+ * @param `storage_requirements` - Optional storage requirements specifying which storage
3312
+ * maps and keys to include. When `undefined`, no storage map data is requested.
3313
+ * @param `block_num` - Optional block number to fetch the account state at. When `undefined`,
3314
+ * fetches the latest state (chain tip).
3315
+ * @param `known_vault_commitment` - Optional known vault commitment. When provided,
3316
+ * vault data is returned only if the account's current vault root differs from this
3317
+ * value. Use `Word.new([0, 0, 0, 0])` to always fetch. When `undefined`, vault data
3318
+ * is not requested.
3319
+ */
3320
+ getAccountProof(account_id: AccountId, storage_requirements?: AccountStorageRequirements | null, block_num?: number | null, known_vault_commitment?: Word | null): Promise<AccountProof>;
3321
+ /**
3322
+ * Fetches a block header by number. When `block_num` is undefined, returns the latest header.
3323
+ */
3324
+ getBlockHeaderByNumber(block_num?: number | null): Promise<BlockHeader>;
3325
+ /**
3326
+ * Fetches a note script by its root hash from the connected Miden node.
3327
+ *
3328
+ * @param script_root - The root hash of the note script to fetch.
3329
+ * @returns Promise that resolves to the `NoteScript`.
3330
+ */
3331
+ getNoteScriptByRoot(script_root: Word): Promise<NoteScript>;
3332
+ /**
3333
+ * Fetches notes by their IDs from the connected Miden node.
3334
+ *
3335
+ * @param note_ids - Array of [`NoteId`] objects to fetch
3336
+ * @returns Promise that resolves to different data depending on the note type:
3337
+ * - Private notes: Returns the `noteHeader`, and the `inclusionProof`. The `note` field will
3338
+ * be `null`.
3339
+ * - Public notes: Returns the full `note` with `inclusionProof`, alongside its header.
3340
+ */
3341
+ getNotesById(note_ids: NoteId[]): Promise<FetchedNote[]>;
3342
+ /**
3343
+ * Fetches the block height at which a nullifier was committed, if any.
3344
+ */
3345
+ getNullifierCommitHeight(nullifier: Word, block_num: number): Promise<number | undefined>;
3346
+ /**
3347
+ * Creates a new RPC client instance.
3348
+ *
3349
+ * @param endpoint - Endpoint to connect to.
3350
+ */
3351
+ constructor(endpoint: Endpoint);
3352
+ /**
3353
+ * Fetches notes matching the provided tags from the node.
3354
+ */
3355
+ syncNotes(block_num: number, block_to: number | null | undefined, note_tags: NoteTag[]): Promise<NoteSyncInfo>;
3356
+ /**
3357
+ * Syncs storage map updates for an account within a block range.
3358
+ *
3359
+ * This is used when `AccountProof.hasStorageMapTooManyEntries()` returns `true` for a
3360
+ * slot, indicating the storage map was too large to return inline. This endpoint fetches
3361
+ * the full storage map data with pagination support.
3362
+ *
3363
+ * @param `block_from` - The starting block number.
3364
+ * @param `block_to` - Optional ending block number. When `undefined`, syncs to chain tip.
3365
+ * @param `account_id` - The account to sync storage maps for.
3366
+ */
3367
+ syncStorageMaps(block_from: number, block_to: number | null | undefined, account_id: AccountId): Promise<StorageMapInfo>;
3368
+ }
3369
+
3370
+ /**
3371
+ * RPO256 hashing helpers exposed to JavaScript.
3372
+ */
3373
+ export class Rpo256 {
3374
+ private constructor();
3375
+ free(): void;
3376
+ [Symbol.dispose](): void;
3377
+ /**
3378
+ * Computes an RPO256 digest from the provided field elements.
3379
+ */
3380
+ static hashElements(felt_array: FeltArray): Word;
3381
+ }
3382
+
3383
+ export class SerializedInputNoteData {
3384
+ private constructor();
3385
+ free(): void;
3386
+ [Symbol.dispose](): void;
3387
+ get consumedBlockHeight(): number | undefined;
3388
+ set consumedBlockHeight(value: number | null | undefined);
3389
+ get consumedTxOrder(): number | undefined;
3390
+ set consumedTxOrder(value: number | null | undefined);
3391
+ get consumerAccountId(): string | undefined;
3392
+ set consumerAccountId(value: string | null | undefined);
3393
+ createdAt: string;
3394
+ inputs: Uint8Array;
3395
+ noteAssets: Uint8Array;
3396
+ noteId: string;
3397
+ noteScriptRoot: string;
3398
+ noteScript: Uint8Array;
3399
+ nullifier: string;
3400
+ serialNumber: Uint8Array;
3401
+ stateDiscriminant: number;
3402
+ state: Uint8Array;
3403
+ }
3404
+
3405
+ export class SerializedOutputNoteData {
3406
+ private constructor();
3407
+ free(): void;
3408
+ [Symbol.dispose](): void;
3409
+ expectedHeight: number;
3410
+ metadata: Uint8Array;
3411
+ noteAssets: Uint8Array;
3412
+ noteId: string;
3413
+ get nullifier(): string | undefined;
3414
+ set nullifier(value: string | null | undefined);
3415
+ recipientDigest: string;
3416
+ stateDiscriminant: number;
3417
+ state: Uint8Array;
3418
+ }
3419
+
3420
+ export class SerializedTransactionData {
3421
+ private constructor();
3422
+ free(): void;
3423
+ [Symbol.dispose](): void;
3424
+ blockNum: number;
3425
+ details: Uint8Array;
3426
+ id: string;
3427
+ get scriptRoot(): Uint8Array | undefined;
3428
+ set scriptRoot(value: Uint8Array | null | undefined);
3429
+ statusVariant: number;
3430
+ status: Uint8Array;
3431
+ get txScript(): Uint8Array | undefined;
3432
+ set txScript(value: Uint8Array | null | undefined);
3433
+ }
3434
+
3435
+ /**
3436
+ * Cryptographic signature produced by supported auth schemes.
3437
+ */
3438
+ export class Signature {
3439
+ private constructor();
3440
+ free(): void;
3441
+ [Symbol.dispose](): void;
3442
+ /**
3443
+ * Deserializes a signature from bytes.
3444
+ */
3445
+ static deserialize(bytes: Uint8Array): Signature;
3446
+ /**
3447
+ * Serializes the signature into bytes.
3448
+ */
3449
+ serialize(): Uint8Array;
3450
+ /**
3451
+ * Converts the signature to the prepared field elements expected by verifying code.
3452
+ */
3453
+ toPreparedSignature(message: Word): Felt[];
3454
+ }
3455
+
3456
+ export class SigningInputs {
3457
+ private constructor();
3458
+ free(): void;
3459
+ [Symbol.dispose](): void;
3460
+ /**
3461
+ * Returns the arbitrary payload as an array of felts.
3462
+ */
3463
+ arbitraryPayload(): FeltArray;
3464
+ /**
3465
+ * Returns the blind payload as a word.
3466
+ */
3467
+ blindPayload(): Word;
3468
+ /**
3469
+ * Deserializes signing inputs from bytes.
3470
+ */
3471
+ static deserialize(bytes: Uint8Array): SigningInputs;
3472
+ /**
3473
+ * Creates signing inputs from arbitrary field elements.
3474
+ */
3475
+ static newArbitrary(felts: Felt[]): SigningInputs;
3476
+ /**
3477
+ * Creates blind signing inputs from a single word.
3478
+ */
3479
+ static newBlind(word: Word): SigningInputs;
3480
+ /**
3481
+ * Creates signing inputs from a transaction summary.
3482
+ */
3483
+ static newTransactionSummary(summary: TransactionSummary): SigningInputs;
3484
+ /**
3485
+ * Serializes the signing inputs into bytes.
3486
+ */
3487
+ serialize(): Uint8Array;
3488
+ /**
3489
+ * Returns the commitment to these signing inputs.
3490
+ */
3491
+ toCommitment(): Word;
3492
+ /**
3493
+ * Returns the inputs as field elements.
3494
+ */
3495
+ toElements(): FeltArray;
3496
+ /**
3497
+ * Returns the transaction summary payload if this variant contains one.
3498
+ */
3499
+ transactionSummaryPayload(): TransactionSummary;
3500
+ /**
3501
+ * Returns which variant these signing inputs represent.
3502
+ */
3503
+ readonly variantType: SigningInputsType;
3504
+ }
3505
+
3506
+ export enum SigningInputsType {
3507
+ /**
3508
+ * Signing commitment over a transaction summary.
3509
+ */
3510
+ TransactionSummary = 0,
3511
+ /**
3512
+ * Arbitrary field elements supplied by caller.
3513
+ */
3514
+ Arbitrary = 1,
3515
+ /**
3516
+ * Blind commitment derived from a single word.
3517
+ */
3518
+ Blind = 2,
3519
+ }
3520
+
3521
+ /**
3522
+ * Storage slot index paired with map keys that must be present.
3523
+ */
3524
+ export class SlotAndKeys {
3525
+ free(): void;
3526
+ [Symbol.dispose](): void;
3527
+ /**
3528
+ * Creates a new slot-and-keys entry.
3529
+ */
3530
+ constructor(storage_slot_name: string, storage_map_keys: Word[]);
3531
+ /**
3532
+ * Returns the storage map keys required for this slot.
3533
+ */
3534
+ storage_map_keys(): Word[];
3535
+ /**
3536
+ * Returns the slot name.
3537
+ */
3538
+ storage_slot_name(): string;
3539
+ }
3540
+
3541
+ /**
3542
+ * Represents a sparse Merkle path.
3543
+ */
3544
+ export class SparseMerklePath {
3545
+ private constructor();
3546
+ free(): void;
3547
+ [Symbol.dispose](): void;
3548
+ /**
3549
+ * Returns the empty nodes mask used by this path.
3550
+ */
3551
+ emptyNodesMask(): bigint;
3552
+ /**
3553
+ * Returns the sibling nodes that make up the path.
3554
+ */
3555
+ nodes(): Word[];
3556
+ /**
3557
+ * Verifies the path against a root.
3558
+ */
3559
+ verify(index: bigint, node: Word, root: Word): boolean;
3560
+ }
3561
+
3562
+ /**
3563
+ * An account storage map is a sparse merkle tree of depth 64.
3564
+ *
3565
+ * It can be used to store a large amount of data in an account than would be otherwise possible
3566
+ * using just the account's storage slots. This works by storing the root of the map's underlying
3567
+ * SMT in one account storage slot. Each map entry is a leaf in the tree and its inclusion is
3568
+ * proven while retrieving it (e.g. via `AccountStorage::get_map_item`).
3569
+ *
3570
+ * As a side-effect, this also means that _not all_ entries of the map have to be present at
3571
+ * transaction execution time in order to access or modify the map. It is sufficient if _just_ the
3572
+ * accessed/modified items are present in the advice provider.
3573
+ *
3574
+ * Because the keys of the map are user-chosen and thus not necessarily uniformly distributed, the
3575
+ * tree could be imbalanced and made less efficient. To mitigate that, the keys used in the storage
3576
+ * map are hashed before they are inserted into the SMT, which creates a uniform distribution. The
3577
+ * original keys are retained in a separate map. This causes redundancy but allows for
3578
+ * introspection of the map, e.g. by querying the set of stored (original) keys which is useful in
3579
+ * debugging and explorer scenarios.
3580
+ */
3581
+ export class StorageMap {
3582
+ free(): void;
3583
+ [Symbol.dispose](): void;
3584
+ /**
3585
+ * Inserts a key/value pair, returning any previous value.
3586
+ */
3587
+ insert(key: Word, value: Word): Word;
3588
+ /**
3589
+ * Creates an empty storage map.
3590
+ */
3591
+ constructor();
3592
+ }
3593
+
3594
+ /**
3595
+ * A key-value entry from a storage map.
3596
+ */
3597
+ export class StorageMapEntry {
3598
+ private constructor();
3599
+ free(): void;
3600
+ [Symbol.dispose](): void;
3601
+ /**
3602
+ * Returns the storage map key.
3603
+ */
3604
+ key(): Word;
3605
+ /**
3606
+ * Returns the storage map value.
3607
+ */
3608
+ value(): Word;
3609
+ }
3610
+
3611
+ /**
3612
+ * Information about storage map updates for an account, as returned by the
3613
+ * `syncStorageMaps` RPC endpoint.
3614
+ *
3615
+ * Contains the list of storage map updates within the requested block range,
3616
+ * along with the chain tip and last processed block number.
3617
+ */
3618
+ export class StorageMapInfo {
3619
+ private constructor();
3620
+ free(): void;
3621
+ [Symbol.dispose](): void;
3622
+ /**
3623
+ * Returns the block number of the last check included in this response.
3624
+ */
3625
+ blockNumber(): number;
3626
+ /**
3627
+ * Returns the current chain tip block number.
3628
+ */
3629
+ chainTip(): number;
3630
+ /**
3631
+ * Returns the list of storage map updates.
3632
+ */
3633
+ updates(): StorageMapUpdate[];
3634
+ }
3635
+
3636
+ /**
3637
+ * A single storage map update entry, containing the block number, slot name,
3638
+ * key, and new value.
3639
+ */
3640
+ export class StorageMapUpdate {
3641
+ private constructor();
3642
+ free(): void;
3643
+ [Symbol.dispose](): void;
3644
+ /**
3645
+ * Returns the block number in which this update occurred.
3646
+ */
3647
+ blockNum(): number;
3648
+ /**
3649
+ * Returns the storage map key that was updated.
3650
+ */
3651
+ key(): Word;
3652
+ /**
3653
+ * Returns the name of the storage slot that was updated.
3654
+ */
3655
+ slotName(): string;
3656
+ /**
3657
+ * Returns the new value for this storage map key.
3658
+ */
3659
+ value(): Word;
3660
+ }
3661
+
3662
+ /**
3663
+ * A single storage slot value or map for an account component.
3664
+ */
3665
+ export class StorageSlot {
3666
+ private constructor();
3667
+ free(): void;
3668
+ [Symbol.dispose](): void;
3669
+ /**
3670
+ * Returns an empty value slot (zeroed).
3671
+ */
3672
+ static emptyValue(name: string): StorageSlot;
3673
+ /**
3674
+ * Creates a storage slot holding a single value.
3675
+ */
3676
+ static fromValue(name: string, value: Word): StorageSlot;
3677
+ /**
3678
+ * Creates a storage slot backed by a map.
3679
+ */
3680
+ static map(name: string, storage_map: StorageMap): StorageSlot;
3681
+ }
3682
+
3683
+ export class StorageSlotArray {
3684
+ /**
3685
+ ** Return copy of self without private attributes.
3686
+ */
3687
+ toJSON(): Object;
3688
+ /**
3689
+ * Return stringified version of self.
3690
+ */
3691
+ toString(): string;
3692
+ free(): void;
3693
+ [Symbol.dispose](): void;
3694
+ /**
3695
+ * Get element at index, will always return a clone to avoid aliasing issues.
3696
+ */
3697
+ get(index: number): StorageSlot;
3698
+ length(): number;
3699
+ constructor(elements?: StorageSlot[] | null);
3700
+ push(element: StorageSlot): void;
3701
+ /**
3702
+ * Replace the element at `index`. Borrows + clones the input
3703
+ * (mirrors `push`), so the caller's JS handle remains valid
3704
+ * after the call. Without this borrow, passing `elem` by
3705
+ * value would move the underlying Rust value out of the
3706
+ * caller's JS handle and any subsequent method on it would
3707
+ * panic with `"null pointer passed to rust"`.
3708
+ */
3709
+ replaceAt(index: number, elem: StorageSlot): void;
3710
+ }
3711
+
3712
+ /**
3713
+ * Contains stats about the sync operation.
3714
+ */
3715
+ export class SyncSummary {
3716
+ private constructor();
3717
+ free(): void;
3718
+ [Symbol.dispose](): void;
3719
+ /**
3720
+ * Returns the block height the summary is based on.
3721
+ */
3722
+ blockNum(): number;
3723
+ /**
3724
+ * Returns IDs of notes committed in this sync window.
3725
+ */
3726
+ committedNotes(): NoteId[];
3727
+ /**
3728
+ * Returns transactions that were committed.
3729
+ */
3730
+ committedTransactions(): TransactionId[];
3731
+ /**
3732
+ * Returns IDs of notes that were consumed.
3733
+ */
3734
+ consumedNotes(): NoteId[];
3735
+ /**
3736
+ * Deserializes a sync summary from bytes.
3737
+ */
3738
+ static deserialize(bytes: Uint8Array): SyncSummary;
3739
+ /**
3740
+ * Serializes the sync summary into bytes.
3741
+ */
3742
+ serialize(): Uint8Array;
3743
+ /**
3744
+ * Returns accounts that were updated.
3745
+ */
3746
+ updatedAccounts(): AccountId[];
3747
+ }
3748
+
3749
+ export class TestUtils {
3750
+ private constructor();
3751
+ free(): void;
3752
+ [Symbol.dispose](): void;
3753
+ static createMockAccountId(): AccountId;
3754
+ static createMockSerializedLibraryPackage(): Uint8Array;
3755
+ static createMockSerializedProgramPackage(): Uint8Array;
3756
+ }
3757
+
3758
+ /**
3759
+ * Represents a string token symbol (e.g. "POL", "ETH") as a single {@link Felt | `Felt`} value.
3760
+ *
3761
+ * Token Symbols can consists of up to 6 capital Latin characters, e.g. "C", "ETH", "MIDENC".
3762
+ */
3763
+ export class TokenSymbol {
3764
+ free(): void;
3765
+ [Symbol.dispose](): void;
3766
+ /**
3767
+ * Creates a token symbol from a string.
3768
+ */
3769
+ constructor(symbol: string);
3770
+ /**
3771
+ * Returns the validated symbol string.
3772
+ */
3773
+ toString(): string;
3774
+ }
3775
+
3776
+ /**
3777
+ * Optional transaction arguments.
3778
+ *
3779
+ * - Transaction script: a program that is executed in a transaction after all input notes scripts
3780
+ * have been executed.
3781
+ * - Note arguments: data put onto the stack right before a note script is executed. These are
3782
+ * different from note inputs, as the user executing the transaction can specify arbitrary note
3783
+ * args.
3784
+ * - Advice inputs: Provides data needed by the runtime, like the details of public output notes.
3785
+ * - Account inputs: Provides account data that will be accessed in the transaction.
3786
+ */
3787
+ export class TransactionArgs {
3788
+ private constructor();
3789
+ free(): void;
3790
+ [Symbol.dispose](): void;
3791
+ /**
3792
+ * Returns advice inputs attached to the transaction.
3793
+ */
3794
+ adviceInputs(): AdviceInputs;
3795
+ /**
3796
+ * Returns note-specific arguments for the given note ID.
3797
+ */
3798
+ getNoteArgs(note_id: NoteId): Word | undefined;
3799
+ /**
3800
+ * Returns the transaction script if provided.
3801
+ */
3802
+ txScript(): TransactionScript | undefined;
3803
+ }
3804
+
3805
+ /**
3806
+ * Filter used when querying stored transactions.
3807
+ */
3808
+ export class TransactionFilter {
3809
+ private constructor();
3810
+ free(): void;
3811
+ [Symbol.dispose](): void;
3812
+ /**
3813
+ * Matches all transactions.
3814
+ */
3815
+ static all(): TransactionFilter;
3816
+ /**
3817
+ * Matches transactions that expired before the given block number.
3818
+ */
3819
+ static expiredBefore(block_num: number): TransactionFilter;
3820
+ /**
3821
+ * Matches specific transaction IDs.
3822
+ */
3823
+ static ids(ids: TransactionId[]): TransactionFilter;
3824
+ /**
3825
+ * Matches transactions that are not yet committed.
3826
+ */
3827
+ static uncommitted(): TransactionFilter;
3828
+ }
3829
+
3830
+ /**
3831
+ * A unique identifier of a transaction.
3832
+ *
3833
+ * Transaction ID is computed as a hash of the initial and final account commitments together with
3834
+ * the commitments of the input and output notes.
3835
+ *
3836
+ * This achieves the following properties:
3837
+ * - Transactions are identical if and only if they have the same ID.
3838
+ * - Computing transaction ID can be done solely from public transaction data.
3839
+ */
3840
+ export class TransactionId {
3841
+ private constructor();
3842
+ free(): void;
3843
+ [Symbol.dispose](): void;
3844
+ /**
3845
+ * Returns the transaction ID as raw bytes.
3846
+ */
3847
+ asBytes(): Uint8Array;
3848
+ /**
3849
+ * Returns the transaction ID as field elements.
3850
+ */
3851
+ asElements(): Felt[];
3852
+ /**
3853
+ * Creates a `TransactionId` from a hex string.
3854
+ *
3855
+ * Fails if the provided string is not a valid hex representation of a `TransactionId`.
3856
+ */
3857
+ static fromHex(hex: string): TransactionId;
3858
+ /**
3859
+ * Returns the underlying word representation.
3860
+ */
3861
+ inner(): Word;
3862
+ /**
3863
+ * Returns the hexadecimal encoding of the transaction ID.
3864
+ */
3865
+ toHex(): string;
3866
+ }
3867
+
3868
+ /**
3869
+ * Wrapper over local or remote transaction proving backends.
3870
+ */
3871
+ export class TransactionProver {
3872
+ private constructor();
3873
+ free(): void;
3874
+ [Symbol.dispose](): void;
3875
+ /**
3876
+ * Reconstructs a prover from its serialized descriptor.
3877
+ *
3878
+ * Parses the format produced by `serialize()`:
3879
+ * - `"local"` for local prover
3880
+ * - `"remote|{endpoint}"` for remote prover without timeout
3881
+ * - `"remote|{endpoint}|{timeout_ms}"` for remote prover with timeout
3882
+ */
3883
+ static deserialize(payload: string): TransactionProver;
3884
+ /**
3885
+ * Returns the endpoint if this is a remote prover.
3886
+ */
3887
+ endpoint(): string | undefined;
3888
+ /**
3889
+ * Creates a prover that delegates `prove()` to a JavaScript callback.
3890
+ *
3891
+ * The callback receives the serialized [`TransactionInputs`] as a
3892
+ * `Uint8Array` and must return a `Promise<Uint8Array>` resolving to a
3893
+ * serialized [`ProvenTransaction`] (same encoding the gRPC remote
3894
+ * prover uses: `tx_inputs.to_bytes()` in, `ProvenTransaction::read_from_bytes`
3895
+ * out).
3896
+ *
3897
+ * Use case: routing prove to a native iOS / Android plugin
3898
+ * (`@miden/native-prover`) so mobile builds skip WASM prove entirely
3899
+ * — `WKWebView` can't be made cross-origin-isolated reliably and the
3900
+ * MT WASM bundle can't instantiate without `SharedArrayBuffer`, so the
3901
+ * host wraps a native Rust prover (built with the same `miden_tx`
3902
+ * crate) and exposes a JS-shaped callback over the Capacitor bridge.
3903
+ *
3904
+ * The SDK does NOT serialize the prover for persistence across
3905
+ * reloads (unlike `newRemoteProver`), since the callback is a
3906
+ * runtime JS reference. Hosts must recreate the prover on every
3907
+ * page load.
3908
+ */
3909
+ static newCallbackProver(callback: Function): TransactionProver;
3910
+ /**
3911
+ * Creates a prover that uses the local proving backend.
3912
+ */
3913
+ static newLocalProver(): TransactionProver;
3914
+ /**
3915
+ * Creates a new remote transaction prover.
3916
+ *
3917
+ * Arguments:
3918
+ * - `endpoint`: The URL of the remote prover.
3919
+ * - `timeout_ms`: The timeout in milliseconds for the remote prover.
3920
+ */
3921
+ static newRemoteProver(endpoint: string, timeout_ms?: bigint | null): TransactionProver;
3922
+ /**
3923
+ * Serializes the prover configuration into a string descriptor.
3924
+ *
3925
+ * Format:
3926
+ * - `"local"` for local prover
3927
+ * - `"remote|{endpoint}"` for remote prover without timeout
3928
+ * - `"remote|{endpoint}|{timeout_ms}"` for remote prover with timeout
3929
+ *
3930
+ * Uses `|` as delimiter since it's not a valid URL character.
3931
+ */
3932
+ serialize(): string;
3933
+ }
3934
+
3935
+ /**
3936
+ * Describes a transaction that has been executed and is being tracked on the Client.
3937
+ */
3938
+ export class TransactionRecord {
3939
+ private constructor();
3940
+ free(): void;
3941
+ [Symbol.dispose](): void;
3942
+ /**
3943
+ * Returns the account this transaction was executed against.
3944
+ */
3945
+ accountId(): AccountId;
3946
+ /**
3947
+ * Returns the block height in which the transaction was included.
3948
+ */
3949
+ blockNum(): number;
3950
+ /**
3951
+ * Returns the timestamp when the record was created.
3952
+ */
3953
+ creationTimestamp(): bigint;
3954
+ /**
3955
+ * Returns the expiration block height for the transaction.
3956
+ */
3957
+ expirationBlockNum(): number;
3958
+ /**
3959
+ * Returns the final account state commitment after execution.
3960
+ */
3961
+ finalAccountState(): Word;
3962
+ /**
3963
+ * Returns the transaction ID.
3964
+ */
3965
+ id(): TransactionId;
3966
+ /**
3967
+ * Returns the initial account state commitment before execution.
3968
+ */
3969
+ initAccountState(): Word;
3970
+ /**
3971
+ * Returns the nullifiers of the consumed input notes.
3972
+ */
3973
+ inputNoteNullifiers(): Word[];
3974
+ /**
3975
+ * Returns the output notes created by this transaction.
3976
+ */
3977
+ outputNotes(): OutputNotes;
3978
+ /**
3979
+ * Returns the block height at which the transaction was submitted.
3980
+ */
3981
+ submissionHeight(): number;
3982
+ /**
3983
+ * Returns the current status of the transaction.
3984
+ */
3985
+ transactionStatus(): TransactionStatus;
3986
+ }
3987
+
3988
+ /**
3989
+ * Specifies a transaction request that can be executed by an account.
3990
+ *
3991
+ * A request contains information about input notes to be consumed by the transaction (if any),
3992
+ * description of the transaction script to be executed (if any), and a set of notes expected to be
3993
+ * generated by the transaction or by consuming notes generated by the transaction.
3994
+ */
3995
+ export class TransactionRequest {
3996
+ private constructor();
3997
+ free(): void;
3998
+ [Symbol.dispose](): void;
3999
+ /**
4000
+ * Returns the authentication argument if present.
4001
+ */
4002
+ authArg(): Word | undefined;
4003
+ /**
4004
+ * Deserializes a transaction request from bytes.
4005
+ */
4006
+ static deserialize(bytes: Uint8Array): TransactionRequest;
4007
+ /**
4008
+ * Returns notes expected to be created in subsequent executions.
4009
+ */
4010
+ expectedFutureNotes(): NoteDetailsAndTag[];
4011
+ /**
4012
+ * Returns output notes created by the sender account.
4013
+ */
4014
+ expectedOutputOwnNotes(): Note[];
4015
+ /**
4016
+ * Returns the transaction script argument if present.
4017
+ */
4018
+ scriptArg(): Word | undefined;
4019
+ /**
4020
+ * Serializes the transaction request into bytes.
4021
+ */
4022
+ serialize(): Uint8Array;
4023
+ }
4024
+
4025
+ /**
4026
+ * A builder for a `TransactionRequest`.
4027
+ *
4028
+ * Use this builder to construct a `TransactionRequest` by adding input notes, specifying
4029
+ * scripts, and setting other transaction parameters.
4030
+ */
4031
+ export class TransactionRequestBuilder {
4032
+ free(): void;
4033
+ [Symbol.dispose](): void;
4034
+ /**
4035
+ * Finalizes the builder into a `TransactionRequest`.
4036
+ */
4037
+ build(): TransactionRequest;
4038
+ /**
4039
+ * Merges an advice map to be available during script execution.
4040
+ */
4041
+ extendAdviceMap(advice_map: AdviceMap): TransactionRequestBuilder;
4042
+ /**
4043
+ * Creates a new empty transaction request builder.
4044
+ */
4045
+ constructor();
4046
+ /**
4047
+ * Adds an authentication argument.
4048
+ */
4049
+ withAuthArg(auth_arg: Word): TransactionRequestBuilder;
4050
+ /**
4051
+ * Attaches a custom transaction script.
4052
+ */
4053
+ withCustomScript(script: TransactionScript): TransactionRequestBuilder;
4054
+ /**
4055
+ * Declares notes expected to be created in follow-up executions.
4056
+ */
4057
+ withExpectedFutureNotes(note_details_and_tag: NoteDetailsAndTagArray): TransactionRequestBuilder;
4058
+ /**
4059
+ * Declares expected output recipients (used for verification).
4060
+ */
4061
+ withExpectedOutputRecipients(recipients: NoteRecipientArray): TransactionRequestBuilder;
4062
+ /**
4063
+ * Sets the maximum number of blocks until the transaction request expires.
4064
+ */
4065
+ withExpirationDelta(expiration_delta: number): TransactionRequestBuilder;
4066
+ /**
4067
+ * Registers foreign accounts referenced by the transaction.
4068
+ */
4069
+ withForeignAccounts(foreign_accounts: ForeignAccountArray): TransactionRequestBuilder;
4070
+ /**
4071
+ * Adds input notes with optional arguments.
4072
+ */
4073
+ withInputNotes(notes: NoteAndArgsArray): TransactionRequestBuilder;
4074
+ /**
4075
+ * Adds output notes created by the sender that should be emitted by the transaction.
4076
+ */
4077
+ withOwnOutputNotes(notes: NoteArray): TransactionRequestBuilder;
4078
+ /**
4079
+ * Adds a transaction script argument.
4080
+ */
4081
+ withScriptArg(script_arg: Word): TransactionRequestBuilder;
4082
+ }
4083
+
4084
+ /**
4085
+ * Represents the result of executing a transaction by the client.
4086
+ *
4087
+ * It contains an `ExecutedTransaction`, and a list of `future_notes`
4088
+ * that we expect to receive in the future (you can check at swap notes for an example of this).
4089
+ */
4090
+ export class TransactionResult {
4091
+ private constructor();
4092
+ free(): void;
4093
+ [Symbol.dispose](): void;
4094
+ /**
4095
+ * Deserializes a transaction result from bytes.
4096
+ */
4097
+ static deserialize(bytes: Uint8Array): TransactionResult;
4098
+ /**
4099
+ * Returns the executed transaction.
4100
+ */
4101
+ executedTransaction(): ExecutedTransaction;
4102
+ /**
4103
+ * Returns notes that are expected to be created as a result of follow-up executions.
4104
+ */
4105
+ futureNotes(): NoteDetailsAndTag[];
4106
+ /**
4107
+ * Returns the ID of the transaction.
4108
+ */
4109
+ id(): TransactionId;
4110
+ /**
4111
+ * Serializes the transaction result into bytes.
4112
+ */
4113
+ serialize(): Uint8Array;
4114
+ }
4115
+
4116
+ /**
4117
+ * A transaction script is a program that is executed in a transaction after all input notes have
4118
+ * been executed.
4119
+ *
4120
+ * The `TransactionScript` object is composed of:
4121
+ * - An executable program defined by a MAST forest and an associated entrypoint.
4122
+ * - A set of transaction script inputs defined by a map of key-value inputs that are loaded into
4123
+ * the advice inputs' map such that the transaction script can access them.
4124
+ */
4125
+ export class TransactionScript {
4126
+ private constructor();
4127
+ free(): void;
4128
+ [Symbol.dispose](): void;
4129
+ /**
4130
+ * Creates a `NoteScript` from the given `Package`.
4131
+ * Throws if the package is invalid.
4132
+ */
4133
+ static fromPackage(_package: Package): TransactionScript;
4134
+ /**
4135
+ * Returns the MAST root commitment of the transaction script.
4136
+ */
4137
+ root(): Word;
4138
+ }
4139
+
4140
+ /**
4141
+ * A script argument represented as a word plus additional felts.
4142
+ */
4143
+ export class TransactionScriptInputPair {
4144
+ free(): void;
4145
+ [Symbol.dispose](): void;
4146
+ /**
4147
+ * Returns the remaining felts for the input.
4148
+ */
4149
+ felts(): FeltArray;
4150
+ /**
4151
+ * Creates a new script input pair.
4152
+ */
4153
+ constructor(word: Word, felts: FeltArray);
4154
+ /**
4155
+ * Returns the word part of the input.
4156
+ */
4157
+ word(): Word;
4158
+ }
4159
+
4160
+ export class TransactionScriptInputPairArray {
4161
+ /**
4162
+ ** Return copy of self without private attributes.
4163
+ */
4164
+ toJSON(): Object;
4165
+ /**
4166
+ * Return stringified version of self.
4167
+ */
4168
+ toString(): string;
4169
+ free(): void;
4170
+ [Symbol.dispose](): void;
4171
+ /**
4172
+ * Get element at index, will always return a clone to avoid aliasing issues.
4173
+ */
4174
+ get(index: number): TransactionScriptInputPair;
4175
+ length(): number;
4176
+ constructor(elements?: TransactionScriptInputPair[] | null);
4177
+ push(element: TransactionScriptInputPair): void;
4178
+ /**
4179
+ * Replace the element at `index`. Borrows + clones the input
4180
+ * (mirrors `push`), so the caller's JS handle remains valid
4181
+ * after the call. Without this borrow, passing `elem` by
4182
+ * value would move the underlying Rust value out of the
4183
+ * caller's JS handle and any subsequent method on it would
4184
+ * panic with `"null pointer passed to rust"`.
4185
+ */
4186
+ replaceAt(index: number, elem: TransactionScriptInputPair): void;
4187
+ }
4188
+
4189
+ /**
4190
+ * Status of a transaction in the node or store.
4191
+ */
4192
+ export class TransactionStatus {
4193
+ private constructor();
4194
+ free(): void;
4195
+ [Symbol.dispose](): void;
4196
+ /**
4197
+ * Creates a committed status with block number and timestamp.
4198
+ */
4199
+ static committed(block_num: number, commit_timestamp: bigint): TransactionStatus;
4200
+ /**
4201
+ * Creates a discarded status from a discard cause string.
4202
+ */
4203
+ static discarded(cause: string): TransactionStatus;
4204
+ /**
4205
+ * Returns the block number if the transaction was committed.
4206
+ */
4207
+ getBlockNum(): number | undefined;
4208
+ /**
4209
+ * Returns the commit timestamp if the transaction was committed.
4210
+ */
4211
+ getCommitTimestamp(): bigint | undefined;
4212
+ /**
4213
+ * Returns true if the transaction has been committed.
4214
+ */
4215
+ isCommitted(): boolean;
4216
+ /**
4217
+ * Returns true if the transaction was discarded.
4218
+ */
4219
+ isDiscarded(): boolean;
4220
+ /**
4221
+ * Returns true if the transaction is still pending.
4222
+ */
4223
+ isPending(): boolean;
4224
+ /**
4225
+ * Creates a pending transaction status.
4226
+ */
4227
+ static pending(): TransactionStatus;
4228
+ }
4229
+
4230
+ /**
4231
+ * Represents the changes that need to be applied to the client store as a result of a transaction
4232
+ * execution.
4233
+ */
4234
+ export class TransactionStoreUpdate {
4235
+ private constructor();
4236
+ free(): void;
4237
+ [Symbol.dispose](): void;
4238
+ /**
4239
+ * Returns the account delta applied by the transaction.
4240
+ */
4241
+ accountDelta(): AccountDelta;
4242
+ /**
4243
+ * Returns the output notes created by the transaction.
4244
+ */
4245
+ createdNotes(): OutputNotes;
4246
+ /**
4247
+ * Deserializes an update from bytes.
4248
+ */
4249
+ static deserialize(bytes: Uint8Array): TransactionStoreUpdate;
4250
+ /**
4251
+ * Returns the executed transaction associated with this update.
4252
+ */
4253
+ executedTransaction(): ExecutedTransaction;
4254
+ /**
4255
+ * Returns notes expected to be created in follow-up executions.
4256
+ */
4257
+ futureNotes(): NoteDetailsAndTag[];
4258
+ /**
4259
+ * Serializes the update into bytes.
4260
+ */
4261
+ serialize(): Uint8Array;
4262
+ /**
4263
+ * Returns the block height at which the transaction was submitted.
4264
+ */
4265
+ submissionHeight(): number;
4266
+ }
4267
+
4268
+ /**
4269
+ * Represents a transaction summary.
4270
+ */
4271
+ export class TransactionSummary {
4272
+ private constructor();
4273
+ free(): void;
4274
+ [Symbol.dispose](): void;
4275
+ /**
4276
+ * Returns the account delta described by the summary.
4277
+ */
4278
+ accountDelta(): AccountDelta;
4279
+ /**
4280
+ * Deserializes a summary from bytes.
4281
+ */
4282
+ static deserialize(bytes: Uint8Array): TransactionSummary;
4283
+ /**
4284
+ * Returns the input notes referenced by the summary.
4285
+ */
4286
+ inputNotes(): InputNotes;
4287
+ /**
4288
+ * Returns the output notes referenced by the summary.
4289
+ */
4290
+ outputNotes(): OutputNotes;
4291
+ /**
4292
+ * Returns the random salt mixed into the summary commitment.
4293
+ */
4294
+ salt(): Word;
4295
+ /**
4296
+ * Serializes the summary into bytes.
4297
+ */
4298
+ serialize(): Uint8Array;
4299
+ /**
4300
+ * Computes the commitment to this `TransactionSummary`.
4301
+ */
4302
+ toCommitment(): Word;
4303
+ }
4304
+
4305
+ export class WebClient {
4306
+ free(): void;
4307
+ [Symbol.dispose](): void;
4308
+ /**
4309
+ * Creates a new `AccountReader` for lazy access to account data.
4310
+ *
4311
+ * The `AccountReader` executes queries lazily - each method call fetches fresh data
4312
+ * from storage, ensuring you always see the current state.
4313
+ *
4314
+ * # Arguments
4315
+ * * `account_id` - The ID of the account to read.
4316
+ *
4317
+ * # Example
4318
+ * ```javascript
4319
+ * const reader = client.accountReader(accountId);
4320
+ * const nonce = await reader.nonce();
4321
+ * const balance = await reader.getBalance(faucetId);
4322
+ * ```
4323
+ */
4324
+ accountReader(account_id: AccountId): AccountReader;
4325
+ addTag(tag: string): Promise<void>;
4326
+ applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
4327
+ static buildSwapTag(note_type: NoteType, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint): NoteTag;
4328
+ /**
4329
+ * Creates a new `WebClient` instance with the specified configuration.
4330
+ *
4331
+ * # Arguments
4332
+ * * `node_url`: The URL of the node RPC endpoint. If `None`, defaults to the testnet endpoint.
4333
+ * * `node_note_transport_url`: Optional URL of the note transport service.
4334
+ * * `seed`: Optional seed for account initialization.
4335
+ * * `store_name`: Optional name for the web store. If `None`, the store name defaults to
4336
+ * `MidenClientDB_{network_id}`, where `network_id` is derived from the `node_url`.
4337
+ * Explicitly setting this allows for creating multiple isolated clients.
4338
+ */
4339
+ createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null, debug_mode?: boolean | null): Promise<any>;
4340
+ /**
4341
+ * Creates a new `WebClient` instance with external keystore callbacks.
4342
+ *
4343
+ * # Arguments
4344
+ * * `node_url`: The URL of the node RPC endpoint. If `None`, defaults to the testnet endpoint.
4345
+ * * `node_note_transport_url`: Optional URL of the note transport service.
4346
+ * * `seed`: Optional seed for account initialization.
4347
+ * * `store_name`: Optional name for the web store. If `None`, the store name defaults to
4348
+ * `MidenClientDB_{network_id}`, where `network_id` is derived from the `node_url`.
4349
+ * Explicitly setting this allows for creating multiple isolated clients.
4350
+ * * `get_key_cb`: Callback to retrieve the secret key bytes for a given public key.
4351
+ * * `insert_key_cb`: Callback to persist a secret key.
4352
+ * * `sign_cb`: Callback to produce serialized signature bytes for the provided inputs.
4353
+ */
4354
+ createClientWithExternalKeystore(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null, get_key_cb?: Function | null, insert_key_cb?: Function | null, sign_cb?: Function | null, debug_mode?: boolean | null): Promise<any>;
4355
+ createCodeBuilder(): CodeBuilder;
4356
+ /**
4357
+ * Creates a new client with a mock RPC API. Useful for testing purposes and proof-of-concept
4358
+ * applications as it uses a mock chain that simulates the behavior of a real node.
4359
+ */
4360
+ createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<any>;
4361
+ /**
4362
+ * Executes a transaction and returns the `TransactionSummary`.
4363
+ *
4364
+ * If the transaction is unauthorized (auth script emits the unauthorized event),
4365
+ * returns the summary from the error. If the transaction succeeds, constructs
4366
+ * a summary from the executed transaction using the `auth_arg` from the transaction
4367
+ * request as the salt (or a zero salt if not provided).
4368
+ *
4369
+ * # Errors
4370
+ * - If there is an internal failure during execution.
4371
+ */
4372
+ executeForSummary(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionSummary>;
4373
+ /**
4374
+ * Executes the provided transaction script against the specified account
4375
+ * and returns the resulting stack output. This is a local-only "view call"
4376
+ * that does not submit anything to the network.
4377
+ */
4378
+ executeProgram(account_id: AccountId, tx_script: TransactionScript, advice_inputs: AdviceInputs, foreign_accounts: ForeignAccountArray): Promise<FeltArray>;
4379
+ /**
4380
+ * Executes a transaction specified by the request against the specified account but does not
4381
+ * submit it to the network nor update the local database. The returned [`TransactionResult`]
4382
+ * retains the execution artifacts needed to continue with the transaction lifecycle.
4383
+ *
4384
+ * If the transaction utilizes foreign account data, there is a chance that the client doesn't
4385
+ * have the required block header in the local database. In these scenarios, a sync to
4386
+ * the chain tip is performed, and the required block header is retrieved.
4387
+ */
4388
+ executeTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionResult>;
4389
+ exportAccountFile(account_id: AccountId): Promise<AccountFile>;
4390
+ exportNoteFile(note_id: string, export_format: NoteExportFormat): Promise<NoteFile>;
4391
+ /**
4392
+ * Fetch all private notes from the note transport layer
4393
+ *
4394
+ * Fetches all notes stored in the transport layer, with no pagination.
4395
+ * Prefer using [`WebClient::fetch_private_notes`] for a more efficient, on-going,
4396
+ * fetching mechanism.
4397
+ */
4398
+ fetchAllPrivateNotes(): Promise<void>;
4399
+ /**
4400
+ * Fetch private notes from the note transport layer
4401
+ *
4402
+ * Uses an internal pagination mechanism to avoid fetching duplicate notes.
4403
+ */
4404
+ fetchPrivateNotes(): Promise<void>;
4405
+ /**
4406
+ * Retrieves the full account data for the given account ID, returning `null` if not found.
4407
+ *
4408
+ * This method loads the complete account state including vault, storage, and code.
4409
+ */
4410
+ getAccount(account_id: AccountId): Promise<Account | undefined>;
4411
+ /**
4412
+ * Retrieves the account code for a specific account.
4413
+ *
4414
+ * Returns `null` if the account is not found.
4415
+ */
4416
+ getAccountCode(account_id: AccountId): Promise<AccountCode | undefined>;
4417
+ /**
4418
+ * Retrieves the storage for a specific account.
4419
+ *
4420
+ * To only load a specific slot, use `accountReader` instead.
4421
+ */
4422
+ getAccountStorage(account_id: AccountId): Promise<AccountStorage>;
4423
+ /**
4424
+ * Retrieves the asset vault for a specific account.
4425
+ *
4426
+ * To check the balance for a single asset, use `accountReader` instead.
4427
+ */
4428
+ getAccountVault(account_id: AccountId): Promise<AssetVault>;
4429
+ getAccounts(): Promise<AccountHeader[]>;
4430
+ getConsumableNotes(account_id?: AccountId | null): Promise<ConsumableNoteRecord[]>;
4431
+ getInputNote(note_id: string): Promise<InputNoteRecord | undefined>;
4432
+ getInputNotes(filter: NoteFilter): Promise<InputNoteRecord[]>;
4433
+ getOutputNote(note_id: string): Promise<OutputNoteRecord>;
4434
+ getOutputNotes(filter: NoteFilter): Promise<OutputNoteRecord[]>;
4435
+ /**
4436
+ * Retrieves the setting value for `key`, or `None` if it hasn’t been set.
4437
+ */
4438
+ getSetting(key: string): Promise<any | undefined>;
4439
+ getSyncHeight(): Promise<number>;
4440
+ getTransactions(transaction_filter: TransactionFilter): Promise<TransactionRecord[]>;
4441
+ importAccountById(account_id: AccountId): Promise<any>;
4442
+ importAccountFile(account_file: AccountFile): Promise<any>;
4443
+ importNoteFile(note_file: NoteFile): Promise<NoteId>;
4444
+ importPublicAccountFromSeed(init_seed: Uint8Array, mutable: boolean, auth_scheme: AuthScheme): Promise<Account>;
4445
+ insertAccountAddress(account_id: AccountId, address: Address): Promise<void>;
4446
+ /**
4447
+ * Returns the raw JS value that the most recent sign-callback invocation
4448
+ * threw, or `null` if the last sign call succeeded (or no call has
4449
+ * happened yet).
4450
+ *
4451
+ * Combined with the serialized-call discipline enforced at the JS
4452
+ * `WebClient` wrapper, this lets a caller that caught a failed
4453
+ * `executeTransaction` / `submitNewTransaction` recover the original
4454
+ * JS error the signing callback threw — preserving any structured
4455
+ * metadata (e.g. a `reason: 'locked'` property) that the kernel-level
4456
+ * `auth::request` diagnostic would otherwise have erased.
4457
+ *
4458
+ * # Usage (TS)
4459
+ * ```ts
4460
+ * try {
4461
+ * await client.submitNewTransaction(acc, req);
4462
+ * } catch (e) {
4463
+ * const authErr = client.lastAuthError();
4464
+ * if (authErr && authErr.reason === 'locked') {
4465
+ * // wait for unlock, then retry
4466
+ * }
4467
+ * }
4468
+ * ```
4469
+ */
4470
+ lastAuthError(): any;
4471
+ /**
4472
+ * Returns all the existing setting keys from the store.
4473
+ */
4474
+ listSettingKeys(): Promise<string[]>;
4475
+ listTags(): Promise<any>;
4476
+ constructor();
4477
+ newAccount(account: Account, overwrite: boolean): Promise<void>;
4478
+ /**
4479
+ * Inserts an account and its secret key in one call, matching how
4480
+ * `newWallet` / `newFaucet` already work internally. If the key
4481
+ * insertion fails the account is still persisted (same as wallet/faucet),
4482
+ * but callers only need a single await instead of two.
4483
+ */
4484
+ newAccountWithSecretKey(account: Account, secret_key: AuthSecretKey): Promise<void>;
4485
+ newConsumeTransactionRequest(list_of_notes: Note[]): TransactionRequest;
4486
+ newFaucet(storage_mode: AccountStorageMode, non_fungible: boolean, token_symbol: string, decimals: number, max_supply: bigint, auth_scheme: AuthScheme): Promise<Account>;
4487
+ newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): TransactionRequest;
4488
+ newSendTransactionRequest(sender_account_id: AccountId, target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint, recall_height?: number | null, timelock_height?: number | null): TransactionRequest;
4489
+ newSwapTransactionRequest(sender_account_id: AccountId, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint, note_type: NoteType, payback_note_type: NoteType): TransactionRequest;
4490
+ newWallet(storage_mode: AccountStorageMode, mutable: boolean, auth_scheme: AuthScheme, init_seed?: Uint8Array | null): Promise<Account>;
4491
+ proveBlock(): void;
4492
+ /**
4493
+ * Generates a transaction proof using the client's default (local) prover.
4494
+ */
4495
+ proveTransaction(transaction_result: TransactionResult): Promise<ProvenTransaction>;
4496
+ /**
4497
+ * Generates a transaction proof using the provided prover.
4498
+ *
4499
+ * Takes the prover by reference so the JS-side handle is NOT consumed
4500
+ * by wasm-bindgen. Taking `TransactionProver` by value would transfer
4501
+ * ownership on each call, invalidating the JS object's internal WASM
4502
+ * handle; after one use, subsequent calls from JS would pass a dangling
4503
+ * handle that wasm-bindgen interprets as `None`, silently falling back
4504
+ * to the local prover.
4505
+ */
4506
+ proveTransactionWithProver(transaction_result: TransactionResult, prover: TransactionProver): Promise<ProvenTransaction>;
4507
+ /**
4508
+ * Prunes historical account states for the specified account up to the given nonce.
4509
+ *
4510
+ * Deletes all historical entries with `replaced_at_nonce <= up_to_nonce` and any
4511
+ * orphaned account code.
4512
+ *
4513
+ * Returns the total number of rows deleted, including historical entries and orphaned
4514
+ * account code.
4515
+ */
4516
+ pruneAccountHistory(account_id: AccountId, up_to_nonce: Felt): Promise<number>;
4517
+ removeAccountAddress(account_id: AccountId, address: Address): Promise<void>;
4518
+ /**
4519
+ * Deletes a setting key-value from the store.
4520
+ */
4521
+ removeSetting(key: string): Promise<void>;
4522
+ removeTag(tag: string): Promise<void>;
4523
+ /**
4524
+ * Send a private note via the note transport layer
4525
+ */
4526
+ sendPrivateNote(note: Note, address: Address): Promise<void>;
4527
+ /**
4528
+ * Returns the inner serialized mock chain if it exists.
4529
+ */
4530
+ serializeMockChain(): Uint8Array;
4531
+ /**
4532
+ * Returns the inner serialized mock note transport node if it exists.
4533
+ */
4534
+ serializeMockNoteTransportNode(): Uint8Array;
4535
+ /**
4536
+ * Sets a setting key-value in the store. It can then be retrieved using `get_setting`.
4537
+ */
4538
+ setSetting(key: string, value: any): Promise<void>;
4539
+ /**
4540
+ * Returns the identifier of the underlying store (e.g. `IndexedDB` database name, file path).
4541
+ */
4542
+ storeIdentifier(): string;
4543
+ /**
4544
+ * Executes a transaction specified by the request against the specified account,
4545
+ * proves it, submits it to the network, and updates the local database.
4546
+ *
4547
+ * Uses the prover configured for this client.
4548
+ *
4549
+ * If the transaction utilizes foreign account data, there is a chance that the client doesn't
4550
+ * have the required block header in the local database. In these scenarios, a sync to
4551
+ * the chain tip is performed, and the required block header is retrieved.
4552
+ */
4553
+ submitNewTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionId>;
4554
+ /**
4555
+ * Executes a transaction specified by the request against the specified account, proves it
4556
+ * with the user provided prover, submits it to the network, and updates the local database.
4557
+ *
4558
+ * If the transaction utilizes foreign account data, there is a chance that the client doesn't
4559
+ * have the required block header in the local database. In these scenarios, a sync to the
4560
+ * chain tip is performed, and the required block header is retrieved.
4561
+ */
4562
+ submitNewTransactionWithProver(account_id: AccountId, transaction_request: TransactionRequest, prover: TransactionProver): Promise<TransactionId>;
4563
+ submitProvenTransaction(proven_transaction: ProvenTransaction, transaction_result: TransactionResult): Promise<number>;
4564
+ /**
4565
+ * Internal implementation of `sync_state`.
4566
+ *
4567
+ * This method performs the actual sync operation. Concurrent call coordination
4568
+ * is handled at the JavaScript layer using the Web Locks API.
4569
+ *
4570
+ * **Note:** Do not call this method directly. Use `syncState()` from JavaScript instead,
4571
+ * which provides proper coordination for concurrent calls.
4572
+ */
4573
+ syncStateImpl(): Promise<SyncSummary>;
4574
+ usesMockChain(): boolean;
4575
+ /**
4576
+ * Returns a `WebKeystoreApi` handle for managing secret keys.
4577
+ *
4578
+ * The returned object can be used from JavaScript as `client.keystore`.
4579
+ */
4580
+ readonly keystore: WebKeystoreApi;
4581
+ }
4582
+
4583
+ /**
4584
+ * JavaScript API for the client's keystore.
4585
+ *
4586
+ * Manages the association between accounts and their authentication secret keys,
4587
+ * indexed by public key commitment.
4588
+ */
4589
+ export class WebKeystoreApi {
4590
+ private constructor();
4591
+ free(): void;
4592
+ [Symbol.dispose](): void;
4593
+ /**
4594
+ * Retrieves a secret key from the keystore given a public key commitment.
4595
+ *
4596
+ * Returns the associated `AuthSecretKey` if found, or `null` if not found.
4597
+ */
4598
+ get(pub_key_commitment: Word): Promise<AuthSecretKey | undefined>;
4599
+ /**
4600
+ * Returns the account ID associated with a given public key commitment,
4601
+ * or `null` if no account is found.
4602
+ */
4603
+ getAccountId(pub_key_commitment: Word): Promise<AccountId | undefined>;
4604
+ /**
4605
+ * Returns all public key commitments associated with the given account ID.
4606
+ */
4607
+ getCommitments(account_id: AccountId): Promise<Word[]>;
4608
+ /**
4609
+ * Inserts a secret key into the keystore, associating it with the given account ID.
4610
+ */
4611
+ insert(account_id: AccountId, secret_key: AuthSecretKey): Promise<void>;
4612
+ /**
4613
+ * Removes a key from the keystore by its public key commitment.
4614
+ */
4615
+ remove(pub_key_commitment: Word): Promise<void>;
4616
+ }
4617
+
4618
+ export class Word {
4619
+ free(): void;
4620
+ [Symbol.dispose](): void;
4621
+ /**
4622
+ * Deserializes a word from bytes.
4623
+ */
4624
+ static deserialize(bytes: Uint8Array): Word;
4625
+ /**
4626
+ * Creates a Word from a hex string.
4627
+ * Fails if the provided string is not a valid hex representation of a Word.
4628
+ */
4629
+ static fromHex(hex: string): Word;
4630
+ /**
4631
+ * Creates a word from four u64 values.
4632
+ */
4633
+ constructor(u64_vec: BigUint64Array);
4634
+ /**
4635
+ * Creates a word from four field elements.
4636
+ */
4637
+ static newFromFelts(felt_vec: Felt[]): Word;
4638
+ /**
4639
+ * Serializes the word into bytes.
4640
+ */
4641
+ serialize(): Uint8Array;
4642
+ /**
4643
+ * Returns the word as an array of field elements.
4644
+ */
4645
+ toFelts(): Felt[];
4646
+ /**
4647
+ * Returns the hex representation of the word.
4648
+ */
4649
+ toHex(): string;
4650
+ /**
4651
+ * Returns the word as an array of u64 values.
4652
+ */
4653
+ toU64s(): BigUint64Array;
4654
+ }
4655
+
4656
+ /**
4657
+ * Create an auth component for `Falcon512Rpo` multisig.
4658
+ */
4659
+ export function createAuthFalcon512RpoMultisig(config: AuthFalcon512RpoMultisigConfig): AccountComponent;
4660
+
4661
+ /**
4662
+ * Exports the entire contents of an `IndexedDB` store as a JSON string.
4663
+ *
4664
+ * Use together with [`import_store`].
4665
+ */
4666
+ declare function exportStore2(store_name: string): Promise<any>;
4667
+ export { exportStore2 as exportStore }
4668
+
4669
+ /**
4670
+ * Imports store contents from a JSON string, replacing all existing data.
4671
+ *
4672
+ * Use together with [`export_store`].
4673
+ */
4674
+ export function importStore(store_name: string, store_dump: string): Promise<void>;
4675
+
4676
+ export function initThreadPool(num_threads: number): Promise<any>;
4677
+
4678
+ /**
4679
+ * Synthetic parallel benchmark: sums 0..n via `par_iter()` on the global
4680
+ * rayon pool. Returns elapsed micros. If the pool is actually multi-threaded,
4681
+ * large `n` should scale ~linearly with thread count. Diagnostic for
4682
+ * confirming whether rayon is dispatching work at all.
4683
+ */
4684
+ export function parallelSumBench(n: bigint): bigint;
4685
+
4686
+ /**
4687
+ * How many rayon worker threads are visible from THIS WASM instance's view of
4688
+ * the global rayon pool. Diagnostic only — the value should equal whatever
4689
+ * `initThreadPool(n)` was called with. If it's 1, rayon is in single-threaded
4690
+ * fallback (workers never spawned, or spawned in a different WASM instance).
4691
+ */
4692
+ export function rayonThreadCount(): number;
4693
+
4694
+ /**
4695
+ * Single-threaded version of `parallel_sum_bench` for direct comparison.
4696
+ * Same workload, plain `iter()` — bypasses rayon entirely. Needs to live
4697
+ * on the WASM side rather than be reimplemented in JS so the workload is
4698
+ * bit-for-bit identical to `parallel_sum_bench` (same libm, same FP
4699
+ * determinism, same constant-folding resistance).
4700
+ */
4701
+ export function sequentialSumBench(n: bigint): bigint;
4702
+
4703
+ /**
4704
+ * Initializes the `tracing` subscriber that routes Rust log output to the
4705
+ * browser console via `console.log` / `console.warn` / `console.error`.
4706
+ *
4707
+ * `log_level` must be one of `"error"`, `"warn"`, `"info"`, `"debug"`,
4708
+ * `"trace"`, `"off"`, or `"none"` (no logging). Unknown values are treated
4709
+ * as "off".
4710
+ *
4711
+ * This is a **per-thread global** — call it once on the main thread and, if
4712
+ * you use a Web Worker, once inside the worker. Subsequent calls on the same
4713
+ * thread are harmless no-ops.
4714
+ */
4715
+ export function setupLogging(log_level: string): void;
4716
+
4717
+ export class wbg_rayon_PoolBuilder {
4718
+ private constructor();
4719
+ free(): void;
4720
+ [Symbol.dispose](): void;
4721
+ build(): void;
4722
+ numThreads(): number;
4723
+ receiver(): number;
4724
+ }
4725
+
4726
+ export function wbg_rayon_start_worker(receiver: number): void;