@miden-sdk/miden-sdk 0.15.0-alpha.4 → 0.15.0-alpha.5

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