@miden-sdk/miden-sdk 0.13.0-next.2 → 0.13.0-next.3

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.
@@ -1,10 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Create an auth component for `RpoFalcon512` multisig.
4
+ * Create an auth component for `Falcon512Rpo` multisig.
5
5
  */
6
- export function createAuthRpoFalcon512Multisig(config: AuthRpoFalcon512MultisigConfig): AccountComponent;
6
+ export function createAuthFalcon512RpoMultisig(config: AuthFalcon512RpoMultisigConfig): AccountComponent;
7
7
  export enum AccountInterface {
8
+ /**
9
+ * Basic wallet address interface.
10
+ */
8
11
  BasicWallet = 0,
9
12
  }
10
13
  export enum AccountType {
@@ -13,6 +16,13 @@ export enum AccountType {
13
16
  RegularAccountImmutableCode = 2,
14
17
  RegularAccountUpdatableCode = 3,
15
18
  }
19
+ /**
20
+ * Authentication schemes supported by the web client.
21
+ */
22
+ export enum AuthScheme {
23
+ AuthRpoFalcon512 = 0,
24
+ AuthEcdsaK256Keccak = 1,
25
+ }
16
26
  export enum InputNoteState {
17
27
  Expected = 0,
18
28
  Unverified = 1,
@@ -24,10 +34,34 @@ export enum InputNoteState {
24
34
  ConsumedUnauthenticatedLocal = 7,
25
35
  ConsumedExternal = 8,
26
36
  }
27
- export enum NetworkId {
37
+ /**
38
+ * The type of a Miden network.
39
+ */
40
+ export enum NetworkType {
41
+ /**
42
+ * Main network prefix (`mm`).
43
+ */
28
44
  Mainnet = 0,
45
+ /**
46
+ * Public test network prefix (`mtst`).
47
+ */
29
48
  Testnet = 1,
49
+ /**
50
+ * Developer network prefix (`mdev`).
51
+ */
30
52
  Devnet = 2,
53
+ /**
54
+ * Custom network prefix.
55
+ */
56
+ Custom = 3,
57
+ }
58
+ /**
59
+ * Defines the payload shape of a note attachment.
60
+ */
61
+ export enum NoteAttachmentKind {
62
+ None = 0,
63
+ Word = 1,
64
+ Array = 2,
31
65
  }
32
66
  export enum NoteFilterTypes {
33
67
  All = 0,
@@ -40,6 +74,9 @@ export enum NoteFilterTypes {
40
74
  Nullifiers = 7,
41
75
  Unverified = 8,
42
76
  }
77
+ /**
78
+ * Visibility level for note contents when published to the network.
79
+ */
43
80
  export enum NoteType {
44
81
  /**
45
82
  * Notes with this type have only their hash published to the network.
@@ -54,9 +91,25 @@ export enum NoteType {
54
91
  */
55
92
  Public = 1,
56
93
  }
94
+ export enum OutputNoteState {
95
+ ExpectedPartial = 0,
96
+ ExpectedFull = 1,
97
+ CommittedPartial = 2,
98
+ CommittedFull = 3,
99
+ Consumed = 4,
100
+ }
57
101
  export enum SigningInputsType {
102
+ /**
103
+ * Signing commitment over a transaction summary.
104
+ */
58
105
  TransactionSummary = 0,
106
+ /**
107
+ * Arbitrary field elements supplied by caller.
108
+ */
59
109
  Arbitrary = 1,
110
+ /**
111
+ * Blind commitment derived from a single word.
112
+ */
60
113
  Blind = 2,
61
114
  }
62
115
  /**
@@ -69,26 +122,94 @@ type AddressInterface = "BasicWallet";
69
122
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
70
123
  */
71
124
  type ReadableStreamType = "bytes";
125
+ /**
126
+ * An account which can store assets and define rules for manipulating them.
127
+ *
128
+ * An account consists of the following components:
129
+ * - Account ID, which uniquely identifies the account and also defines basic properties of the
130
+ * account.
131
+ * - Account vault, which stores assets owned by the account.
132
+ * - Account storage, which is a key-value map (both keys and values are words) used to store
133
+ * arbitrary user-defined data.
134
+ * - Account code, which is a set of Miden VM programs defining the public interface of the
135
+ * account.
136
+ * - Account nonce, a value which is incremented whenever account state is updated.
137
+ *
138
+ * Out of the above components account ID is always immutable (once defined it can never be
139
+ * changed). Other components may be mutated throughout the lifetime of the account. However,
140
+ * account state can be changed only by invoking one of account interface methods.
141
+ *
142
+ * The recommended way to build an account is through an `AccountBuilder`, which can be
143
+ * instantiated directly from a 32-byte seed.
144
+ */
72
145
  export class Account {
73
146
  private constructor();
74
147
  free(): void;
75
148
  [Symbol.dispose](): void;
76
- id(): AccountId;
149
+ /**
150
+ * Returns the commitment to the account header, storage, and code.
151
+ */
77
152
  commitment(): Word;
153
+ /**
154
+ * Returns true if this is a network-owned account.
155
+ */
156
+ isNetwork(): boolean;
157
+ /**
158
+ * Returns true if the account storage is private.
159
+ */
160
+ isPrivate(): boolean;
161
+ /**
162
+ * Restores an account from its serialized bytes.
163
+ */
164
+ static deserialize(bytes: Uint8Array): Account;
165
+ /**
166
+ * Returns true if the account can update its code.
167
+ */
168
+ isUpdatable(): boolean;
169
+ /**
170
+ * Returns true if the account is a regular account (immutable or updatable code).
171
+ */
172
+ isRegularAccount(): boolean;
173
+ /**
174
+ * Returns the public key commitments derived from the account's authentication scheme.
175
+ */
176
+ getPublicKeyCommitments(): Word[];
177
+ /**
178
+ * Returns the account identifier.
179
+ */
180
+ id(): AccountId;
181
+ /**
182
+ * Returns the code commitment for this account.
183
+ */
184
+ code(): AccountCode;
185
+ /**
186
+ * Returns the account nonce, which is incremented on every state update.
187
+ */
78
188
  nonce(): Felt;
189
+ /**
190
+ * Returns the vault commitment for this account.
191
+ */
79
192
  vault(): AssetVault;
193
+ /**
194
+ * Returns true if the account has not yet been committed to the chain.
195
+ */
196
+ isNew(): boolean;
197
+ /**
198
+ * Returns the account storage commitment.
199
+ */
80
200
  storage(): AccountStorage;
81
- code(): AccountCode;
201
+ /**
202
+ * Returns true if the account is a faucet.
203
+ */
82
204
  isFaucet(): boolean;
83
- isRegularAccount(): boolean;
84
- isUpdatable(): boolean;
205
+ /**
206
+ * Returns true if the account exposes public storage.
207
+ */
85
208
  isPublic(): boolean;
86
- isPrivate(): boolean;
87
- isNetwork(): boolean;
88
- isNew(): boolean;
209
+ /**
210
+ * Serializes the account into bytes.
211
+ */
89
212
  serialize(): Uint8Array;
90
- static deserialize(bytes: Uint8Array): Account;
91
- getPublicKeys(): Word[];
92
213
  }
93
214
  export class AccountArray {
94
215
  /**
@@ -101,114 +222,289 @@ export class AccountArray {
101
222
  toString(): string;
102
223
  free(): void;
103
224
  [Symbol.dispose](): void;
104
- constructor(elements?: Account[] | null);
225
+ replaceAt(index: number, elem: Account): void;
105
226
  /**
106
227
  * Get element at index, will always return a clone to avoid aliasing issues.
107
228
  */
108
229
  get(index: number): Account;
109
- replaceAt(index: number, elem: Account): void;
230
+ constructor(elements?: Account[] | null);
110
231
  push(element: Account): void;
111
232
  length(): number;
112
233
  }
113
234
  export class AccountBuilder {
114
235
  free(): void;
115
236
  [Symbol.dispose](): void;
116
- constructor(init_seed: Uint8Array);
237
+ /**
238
+ * Sets the account type (regular, faucet, etc.).
239
+ */
117
240
  accountType(account_type: AccountType): AccountBuilder;
241
+ /**
242
+ * Sets the storage mode (public/private) for the account.
243
+ */
118
244
  storageMode(storage_mode: AccountStorageMode): AccountBuilder;
245
+ /**
246
+ * Adds a component to the account.
247
+ */
119
248
  withComponent(account_component: AccountComponent): AccountBuilder;
249
+ /**
250
+ * Adds an authentication component to the account.
251
+ */
120
252
  withAuthComponent(account_component: AccountComponent): AccountBuilder;
253
+ /**
254
+ * Adds a no-auth component to the account (for public accounts).
255
+ */
121
256
  withNoAuthComponent(): AccountBuilder;
122
257
  withBasicWalletComponent(): AccountBuilder;
258
+ /**
259
+ * Creates a new account builder from a 32-byte initial seed.
260
+ */
261
+ constructor(init_seed: Uint8Array);
262
+ /**
263
+ * Builds the account and returns it together with the derived seed.
264
+ */
123
265
  build(): AccountBuilderResult;
124
266
  }
125
267
  export class AccountBuilderResult {
126
268
  private constructor();
127
269
  free(): void;
128
270
  [Symbol.dispose](): void;
129
- readonly account: Account;
271
+ /**
272
+ * Returns the seed used to derive the account ID.
273
+ */
130
274
  readonly seed: Word;
275
+ /**
276
+ * Returns the built account.
277
+ */
278
+ readonly account: Account;
131
279
  }
280
+ /**
281
+ * A public interface of an account.
282
+ *
283
+ * Account's public interface consists of a set of callable procedures, each committed to by its
284
+ * root hash and paired with storage bounds (offset and size).
285
+ *
286
+ * The full interface commitment hashes every procedure root together with its storage bounds so
287
+ * that the account code uniquely captures the set of available calls.
288
+ */
132
289
  export class AccountCode {
133
290
  private constructor();
134
291
  free(): void;
135
292
  [Symbol.dispose](): void;
293
+ /**
294
+ * Returns the code commitment for the account.
295
+ */
136
296
  commitment(): Word;
297
+ /**
298
+ * Returns true if the account code exports a procedure with the given MAST root.
299
+ */
137
300
  hasProcedure(mast_root: Word): boolean;
138
301
  }
139
302
  export class AccountComponent {
140
303
  private constructor();
141
304
  free(): void;
142
305
  [Symbol.dispose](): void;
143
- static compile(account_code: string, builder: ScriptBuilder, storage_slots: StorageSlot[]): AccountComponent;
144
- withSupportsAllTypes(): AccountComponent;
145
- getProcedureHash(procedure_name: string): string;
146
- getProcedures(): GetProceduresResultItem[];
147
- static createAuthComponent(secret_key: SecretKey): AccountComponent;
148
- static createAuthComponentFromCommitment(commitment: Word, auth_scheme_id: number): AccountComponent;
306
+ /**
307
+ * Creates an account component from a compiled library and storage slots.
308
+ */
309
+ static fromLibrary(library: Library, storage_slots: StorageSlot[]): AccountComponent;
310
+ /**
311
+ * Creates an account component from a compiled package and storage slots.
312
+ */
149
313
  static fromPackage(_package: Package, storage_slots: StorageSlotArray): AccountComponent;
314
+ /**
315
+ * Returns all procedures exported by this component.
316
+ */
317
+ getProcedures(): GetProceduresResultItem[];
318
+ /**
319
+ * Returns the hex-encoded MAST root for a procedure by name.
320
+ */
321
+ getProcedureHash(procedure_name: string): string;
322
+ /**
323
+ * Marks the component as supporting all account types.
324
+ */
325
+ withSupportsAllTypes(): AccountComponent;
326
+ static createAuthComponentFromCommitment(commitment: Word, auth_scheme: AuthScheme): AccountComponent;
327
+ /**
328
+ * Builds an auth component from a secret key, inferring the auth scheme from the key type.
329
+ */
330
+ static createAuthComponentFromSecretKey(secret_key: AuthSecretKey): AccountComponent;
331
+ /**
332
+ * Compiles account code with the given storage slots using the provided assembler.
333
+ */
334
+ static compile(account_code: AccountComponentCode, storage_slots: StorageSlot[]): AccountComponent;
335
+ }
336
+ /**
337
+ * A Library that has been assembled for use as component code.
338
+ */
339
+ export class AccountComponentCode {
340
+ private constructor();
341
+ free(): void;
342
+ [Symbol.dispose](): void;
343
+ /**
344
+ * Returns the underlying Library
345
+ */
346
+ asLibrary(): Library;
150
347
  }
348
+ /**
349
+ * `AccountDelta` stores the differences between two account states.
350
+ *
351
+ * The differences are represented as follows:
352
+ * - `storage`: an `AccountStorageDelta` that contains the changes to the account storage.
353
+ * - `vault`: an `AccountVaultDelta` object that contains the changes to the account vault.
354
+ * - `nonce`: if the nonce of the account has changed, the new nonce is stored here.
355
+ */
151
356
  export class AccountDelta {
152
357
  private constructor();
153
358
  free(): void;
154
359
  [Symbol.dispose](): void;
155
- serialize(): Uint8Array;
360
+ /**
361
+ * Deserializes an account delta from bytes.
362
+ */
156
363
  static deserialize(bytes: Uint8Array): AccountDelta;
364
+ /**
365
+ * Returns the nonce change.
366
+ */
367
+ nonceDelta(): Felt;
368
+ /**
369
+ * Returns the affected account ID.
370
+ */
157
371
  id(): AccountId;
158
- isEmpty(): boolean;
159
- storage(): AccountStorageDelta;
372
+ /**
373
+ * Returns the vault delta.
374
+ */
160
375
  vault(): AccountVaultDelta;
161
- nonceDelta(): Felt;
376
+ /**
377
+ * Returns the storage delta.
378
+ */
379
+ storage(): AccountStorageDelta;
380
+ /**
381
+ * Returns true if there are no changes.
382
+ */
383
+ isEmpty(): boolean;
384
+ /**
385
+ * Serializes the account delta into bytes.
386
+ */
387
+ serialize(): Uint8Array;
162
388
  }
163
389
  export class AccountFile {
164
390
  private constructor();
165
391
  free(): void;
166
392
  [Symbol.dispose](): void;
167
393
  /**
168
- * Serializes the `AccountFile` into a byte array
394
+ * Returns the account ID.
169
395
  */
170
- serialize(): Uint8Array;
396
+ accountId(): AccountId;
171
397
  /**
172
398
  * Deserializes a byte array into an `AccountFile`
173
399
  */
174
400
  static deserialize(bytes: Uint8Array): AccountFile;
401
+ /**
402
+ * Returns the number of auth secret keys included.
403
+ */
404
+ authSecretKeyCount(): number;
405
+ /**
406
+ * Returns the account data.
407
+ */
408
+ account(): Account;
409
+ /**
410
+ * Serializes the `AccountFile` into a byte array
411
+ */
412
+ serialize(): Uint8Array;
175
413
  }
414
+ /**
415
+ * A header of an account which contains information that succinctly describes the state of the
416
+ * components of the account.
417
+ *
418
+ * The account header is composed of:
419
+ * - `id`: the account ID (`AccountId`).
420
+ * - `nonce`: the nonce of the account.
421
+ * - `vault_root`: a commitment to the account's vault (`AssetVault`).
422
+ * - `storage_commitment`: a commitment to the account's storage (`AccountStorage`).
423
+ * - `code_commitment`: a commitment to the account's code (`AccountCode`).
424
+ */
176
425
  export class AccountHeader {
177
426
  private constructor();
178
427
  free(): void;
179
428
  [Symbol.dispose](): void;
429
+ /**
430
+ * Returns the full account commitment.
431
+ */
180
432
  commitment(): Word;
181
- id(): AccountId;
182
- nonce(): Felt;
433
+ /**
434
+ * Returns the code commitment.
435
+ */
436
+ codeCommitment(): Word;
437
+ /**
438
+ * Returns the vault commitment.
439
+ */
183
440
  vaultCommitment(): Word;
441
+ /**
442
+ * Returns the storage commitment.
443
+ */
184
444
  storageCommitment(): Word;
185
- codeCommitment(): Word;
445
+ /**
446
+ * Returns the account ID.
447
+ */
448
+ id(): AccountId;
449
+ /**
450
+ * Returns the current nonce.
451
+ */
452
+ nonce(): Felt;
186
453
  }
454
+ /**
455
+ * Uniquely identifies a specific account.
456
+ *
457
+ * A Miden account ID is a 120-bit value derived from the commitments to account code and storage,
458
+ * and a random user-provided seed.
459
+ */
187
460
  export class AccountId {
188
461
  private constructor();
189
462
  free(): void;
190
463
  [Symbol.dispose](): void;
464
+ /**
465
+ * Returns true if the ID is reserved for network accounts.
466
+ */
467
+ isNetwork(): boolean;
468
+ /**
469
+ * Returns true if the account uses private storage.
470
+ */
471
+ isPrivate(): boolean;
472
+ /**
473
+ * Given a bech32 encoded string, return the matching Account ID for it.
474
+ */
475
+ static fromBech32(bech_32_encoded_id: string): AccountId;
476
+ /**
477
+ * Returns true if the ID refers to a regular account.
478
+ */
479
+ isRegularAccount(): boolean;
480
+ /**
481
+ * Returns the prefix field element storing metadata about version, type, and storage mode.
482
+ */
483
+ prefix(): Felt;
484
+ /**
485
+ * Returns the suffix field element derived from the account seed.
486
+ */
487
+ suffix(): Felt;
488
+ /**
489
+ * Builds an account ID from its hex string representation.
490
+ */
191
491
  static fromHex(hex: string): AccountId;
492
+ /**
493
+ * Returns true if the ID refers to a faucet.
494
+ */
192
495
  isFaucet(): boolean;
193
- isRegularAccount(): boolean;
496
+ /**
497
+ * Returns true if the account uses public storage.
498
+ */
194
499
  isPublic(): boolean;
195
- isPrivate(): boolean;
196
- isNetwork(): boolean;
197
- toString(): string;
198
500
  /**
199
- * Will turn the Account ID into its bech32 string representation. To avoid a potential
200
- * wrongful encoding, this function will expect only IDs for either mainnet ("mm"),
201
- * testnet ("mtst") or devnet ("mdev"). To use a custom bech32 prefix, see
202
- * `Self::to_bech_32_custom`.
501
+ * Will turn the Account ID into its bech32 string representation.
203
502
  */
204
503
  toBech32(network_id: NetworkId, account_interface: AccountInterface): string;
205
504
  /**
206
- * Turn this Account ID into its bech32 string representation. This method accepts a custom
207
- * network ID.
505
+ * Returns the canonical hex representation of the account ID.
208
506
  */
209
- toBech32Custom(custom_network_id: string, account_interface: AccountInterface): string;
210
- prefix(): Felt;
211
- suffix(): Felt;
507
+ toString(): string;
212
508
  }
213
509
  export class AccountIdArray {
214
510
  /**
@@ -221,65 +517,163 @@ export class AccountIdArray {
221
517
  toString(): string;
222
518
  free(): void;
223
519
  [Symbol.dispose](): void;
224
- constructor(elements?: AccountId[] | null);
520
+ replaceAt(index: number, elem: AccountId): void;
225
521
  /**
226
522
  * Get element at index, will always return a clone to avoid aliasing issues.
227
523
  */
228
524
  get(index: number): AccountId;
229
- replaceAt(index: number, elem: AccountId): void;
525
+ constructor(elements?: AccountId[] | null);
230
526
  push(element: AccountId): void;
231
527
  length(): number;
232
528
  }
529
+ /**
530
+ * Account storage is composed of a variable number of index-addressable storage slots up to 255
531
+ * slots in total.
532
+ *
533
+ * Each slot has a type which defines its size and structure. Currently, the following types are
534
+ * supported:
535
+ * - `StorageSlot::Value`: contains a single Word of data (i.e., 32 bytes).
536
+ * - `StorageSlot::Map`: contains a `StorageMap` which is a key-value map where both keys and
537
+ * values are Words. The value of a storage slot containing a map is the commitment to the
538
+ * underlying map.
539
+ */
233
540
  export class AccountStorage {
234
541
  private constructor();
235
542
  free(): void;
236
543
  [Symbol.dispose](): void;
544
+ /**
545
+ * Returns the commitment to the full account storage.
546
+ */
237
547
  commitment(): Word;
238
- getItem(index: number): Word | undefined;
239
- getMapItem(index: number, key: Word): Word | undefined;
240
548
  /**
241
- * Get all key-value pairs from the map slot at `index`.
242
- * Returns `undefined` if the slot isn't a map or `index` is out of bounds (0-255).
549
+ * Returns the value for a key in the map stored at the given slot, if any.
550
+ */
551
+ getMapItem(slot_name: string, key: Word): Word | undefined;
552
+ /**
553
+ * Returns the names of all storage slots on this account.
554
+ */
555
+ getSlotNames(): string[];
556
+ /**
557
+ * Get all key-value pairs from the map slot identified by `slot_name`.
558
+ * Returns `undefined` if the slot isn't a map or doesn't exist.
243
559
  * Returns `[]` if the map exists but is empty.
244
560
  */
245
- getMapEntries(index: number): JsStorageMapEntry[] | undefined;
561
+ getMapEntries(slot_name: string): JsStorageMapEntry[] | undefined;
562
+ /**
563
+ * Returns the value stored at the given slot name, if any.
564
+ */
565
+ getItem(slot_name: string): Word | undefined;
246
566
  }
567
+ /**
568
+ * `AccountStorageDelta` stores the differences between two states of account storage.
569
+ *
570
+ * The delta consists of two maps:
571
+ * - A map containing the updates to value storage slots. The keys in this map are indexes of the
572
+ * updated storage slots and the values are the new values for these slots.
573
+ * - A map containing updates to storage maps. The keys in this map are indexes of the updated
574
+ * storage slots and the values are corresponding storage map delta objects.
575
+ */
247
576
  export class AccountStorageDelta {
248
577
  private constructor();
249
578
  free(): void;
250
579
  [Symbol.dispose](): void;
251
- serialize(): Uint8Array;
580
+ /**
581
+ * Deserializes a storage delta from bytes.
582
+ */
252
583
  static deserialize(bytes: Uint8Array): AccountStorageDelta;
253
- isEmpty(): boolean;
254
- values(): Word[];
584
+ /**
585
+ * Returns the new values for modified storage slots.
586
+ */
587
+ values(): Word[];
588
+ /**
589
+ * Returns true if no storage slots are changed.
590
+ */
591
+ isEmpty(): boolean;
592
+ /**
593
+ * Serializes the storage delta into bytes.
594
+ */
595
+ serialize(): Uint8Array;
255
596
  }
597
+ /**
598
+ * Storage visibility mode for an account.
599
+ */
256
600
  export class AccountStorageMode {
257
601
  private constructor();
258
602
  free(): void;
259
603
  [Symbol.dispose](): void;
260
- static private(): AccountStorageMode;
261
- static public(): AccountStorageMode;
262
- static network(): AccountStorageMode;
604
+ /**
605
+ * Parses a storage mode from its string representation.
606
+ */
263
607
  static tryFromStr(s: string): AccountStorageMode;
608
+ /**
609
+ * Returns the storage mode as a string.
610
+ */
264
611
  asStr(): string;
612
+ /**
613
+ * Creates a public storage mode.
614
+ */
615
+ static public(): AccountStorageMode;
616
+ /**
617
+ * Creates a network storage mode.
618
+ */
619
+ static network(): AccountStorageMode;
620
+ /**
621
+ * Creates a private storage mode.
622
+ */
623
+ static private(): AccountStorageMode;
265
624
  }
266
625
  export class AccountStorageRequirements {
267
626
  free(): void;
268
627
  [Symbol.dispose](): void;
269
- constructor();
628
+ /**
629
+ * Builds storage requirements from a list of slot/key pairs.
630
+ */
270
631
  static fromSlotAndKeysArray(slots_and_keys: SlotAndKeys[]): AccountStorageRequirements;
632
+ /**
633
+ * Creates empty storage requirements.
634
+ */
635
+ constructor();
271
636
  }
637
+ /**
638
+ * `AccountVaultDelta` stores the difference between the initial and final account vault states.
639
+ *
640
+ * The difference is represented as follows:
641
+ * - `fungible`: a binary tree map of fungible asset balance changes in the account vault.
642
+ * - `non_fungible`: a binary tree map of non-fungible assets that were added to or removed from
643
+ * the account vault.
644
+ */
272
645
  export class AccountVaultDelta {
273
646
  private constructor();
274
647
  free(): void;
275
648
  [Symbol.dispose](): void;
276
- serialize(): Uint8Array;
649
+ /**
650
+ * Deserializes a vault delta from bytes.
651
+ */
277
652
  static deserialize(bytes: Uint8Array): AccountVaultDelta;
278
- isEmpty(): boolean;
279
- fungible(): FungibleAssetDelta;
653
+ /**
654
+ * Returns the fungible assets that increased.
655
+ */
280
656
  addedFungibleAssets(): FungibleAsset[];
657
+ /**
658
+ * Returns the fungible assets that decreased.
659
+ */
281
660
  removedFungibleAssets(): FungibleAsset[];
661
+ /**
662
+ * Returns the fungible portion of the delta.
663
+ */
664
+ fungible(): FungibleAssetDelta;
665
+ /**
666
+ * Returns true if no assets are changed.
667
+ */
668
+ isEmpty(): boolean;
669
+ /**
670
+ * Serializes the vault delta into bytes.
671
+ */
672
+ serialize(): Uint8Array;
282
673
  }
674
+ /**
675
+ * Representation of a Miden address (account ID plus routing parameters).
676
+ */
283
677
  export class Address {
284
678
  private constructor();
285
679
  /**
@@ -292,55 +686,117 @@ export class Address {
292
686
  toString(): string;
293
687
  free(): void;
294
688
  [Symbol.dispose](): void;
295
- static fromAccountId(account_id: AccountId, _interface?: string | null): Address;
296
- static fromBech32(bech32: string): Address;
297
- interface(): AddressInterface;
689
+ /**
690
+ * Returns the account ID embedded in the address.
691
+ */
298
692
  accountId(): AccountId;
693
+ /**
694
+ * Deserializes a byte array into an `Address`.
695
+ */
696
+ static deserialize(bytes: Uint8Array): Address;
697
+ /**
698
+ * Builds an address from a bech32-encoded string.
699
+ */
700
+ static fromBech32(bech32: string): Address;
701
+ /**
702
+ * Converts the address into a note tag.
703
+ */
299
704
  toNoteTag(): NoteTag;
705
+ /**
706
+ * Builds an address from an account ID and optional interface.
707
+ */
708
+ static fromAccountId(account_id: AccountId, _interface?: string | null): Address;
709
+ /**
710
+ * Returns the address interface.
711
+ */
712
+ interface(): AddressInterface;
713
+ /**
714
+ * Encodes the address using the provided network prefix.
715
+ */
300
716
  toBech32(network_id: NetworkId): string;
301
717
  }
718
+ /**
719
+ * Advice inputs provided to a transaction or note script.
720
+ */
302
721
  export class AdviceInputs {
303
722
  private constructor();
304
723
  free(): void;
305
724
  [Symbol.dispose](): void;
306
- stack(): Felt[];
725
+ /**
726
+ * Returns mapped values for a given key if present.
727
+ */
307
728
  mappedValues(key: Word): Felt[] | undefined;
729
+ /**
730
+ * Returns the stack inputs as a vector of felts.
731
+ */
732
+ stack(): Felt[];
308
733
  }
734
+ /**
735
+ * Map of advice values keyed by words for script execution.
736
+ */
309
737
  export class AdviceMap {
310
738
  free(): void;
311
739
  [Symbol.dispose](): void;
740
+ /**
741
+ * Creates an empty advice map.
742
+ */
312
743
  constructor();
744
+ /**
745
+ * Inserts a value for the given key, returning any previous value.
746
+ */
313
747
  insert(key: Word, value: FeltArray): Felt[] | undefined;
314
748
  }
749
+ /**
750
+ * A container for an unlimited number of assets.
751
+ *
752
+ * An asset vault can contain an unlimited number of assets. The assets are stored in a Sparse
753
+ * Merkle tree as follows:
754
+ * - For fungible assets, the index of a node is defined by the issuing faucet ID, and the value of
755
+ * the node is the asset itself. Thus, for any fungible asset there will be only one node in the
756
+ * tree.
757
+ * - For non-fungible assets, the index is defined by the asset itself, and the asset is also the
758
+ * value of the node.
759
+ *
760
+ * An asset vault can be reduced to a single hash which is the root of the Sparse Merkle Tree.
761
+ */
315
762
  export class AssetVault {
316
763
  private constructor();
317
764
  free(): void;
318
765
  [Symbol.dispose](): void;
319
- root(): Word;
766
+ /**
767
+ * Returns the balance for the given fungible faucet, or zero if absent.
768
+ */
320
769
  getBalance(faucet_id: AccountId): bigint;
770
+ /**
771
+ * Returns the fungible assets contained in this vault.
772
+ */
321
773
  fungibleAssets(): FungibleAsset[];
774
+ /**
775
+ * Returns the root commitment of the asset vault tree.
776
+ */
777
+ root(): Word;
322
778
  }
323
779
  /**
324
780
  * Multisig auth configuration for `RpoFalcon512` signatures.
325
781
  */
326
- export class AuthRpoFalcon512MultisigConfig {
782
+ export class AuthFalcon512RpoMultisigConfig {
327
783
  free(): void;
328
784
  [Symbol.dispose](): void;
329
785
  /**
330
- * Build a configuration with a list of approver public key commitments and a default
331
- * threshold.
332
- *
333
- * `default_threshold` must be >= 1 and <= `approvers.length`.
786
+ * Per-procedure thresholds.
334
787
  */
335
- constructor(approvers: Word[], default_threshold: number);
788
+ getProcThresholds(): ProcedureThreshold[];
336
789
  /**
337
790
  * Attach per-procedure thresholds. Each threshold must be >= 1 and <= `approvers.length`.
338
791
  */
339
- withProcThresholds(proc_thresholds: ProcedureThreshold[]): AuthRpoFalcon512MultisigConfig;
792
+ withProcThresholds(proc_thresholds: ProcedureThreshold[]): AuthFalcon512RpoMultisigConfig;
340
793
  /**
341
- * Per-procedure thresholds.
794
+ * Build a configuration with a list of approver public key commitments and a default
795
+ * threshold.
796
+ *
797
+ * `default_threshold` must be >= 1 and <= `approvers.length`.
342
798
  */
343
- getProcThresholds(): ProcedureThreshold[];
799
+ constructor(approvers: Word[], default_threshold: number);
344
800
  readonly defaultThreshold: number;
345
801
  /**
346
802
  * Approver public key commitments as Words.
@@ -351,114 +807,116 @@ export class AuthSecretKey {
351
807
  private constructor();
352
808
  free(): void;
353
809
  [Symbol.dispose](): void;
354
- getRpoFalcon512PublicKeyAsWord(): Word;
810
+ publicKey(): PublicKey;
811
+ static deserialize(bytes: Uint8Array): AuthSecretKey;
812
+ static ecdsaWithRNG(seed?: Uint8Array | null): AuthSecretKey;
813
+ static rpoFalconWithRNG(seed?: Uint8Array | null): AuthSecretKey;
814
+ getPublicKeyAsWord(): Word;
355
815
  getRpoFalcon512SecretKeyAsFelts(): Felt[];
356
- getEcdsaK256KeccakPublicKeyAsWord(): Word;
816
+ /**
817
+ * Returns the ECDSA k256 Keccak secret key bytes encoded as felts.
818
+ */
357
819
  getEcdsaK256KeccakSecretKeyAsFelts(): Felt[];
820
+ sign(message: Word): Signature;
821
+ serialize(): Uint8Array;
822
+ signData(signing_inputs: SigningInputs): Signature;
358
823
  }
824
+ /**
825
+ * Provides metadata for a basic fungible faucet account component.
826
+ */
359
827
  export class BasicFungibleFaucetComponent {
360
828
  private constructor();
361
829
  free(): void;
362
830
  [Symbol.dispose](): void;
831
+ /**
832
+ * Returns the maximum token supply.
833
+ */
834
+ maxSupply(): Felt;
835
+ /**
836
+ * Extracts faucet metadata from an account.
837
+ */
363
838
  static fromAccount(account: Account): BasicFungibleFaucetComponent;
839
+ /**
840
+ * Returns the faucet's token symbol.
841
+ */
364
842
  symbol(): TokenSymbol;
843
+ /**
844
+ * Returns the number of decimal places for the token.
845
+ */
365
846
  decimals(): number;
366
- maxSupply(): Felt;
367
847
  }
848
+ /**
849
+ * Public header for a block, containing commitments to the chain state and the proof attesting to
850
+ * the block's validity.
851
+ *
852
+ * Key fields include the previous block commitment, block number, chain/nullifier/note roots,
853
+ * transaction commitments (including the kernel), proof commitment, and a timestamp. Two derived
854
+ * values are exposed:
855
+ * - `sub_commitment`: sequential hash of all fields except the `note_root`.
856
+ * - `commitment`: a 2-to-1 hash of the `sub_commitment` and the `note_root`.
857
+ */
368
858
  export class BlockHeader {
369
859
  private constructor();
370
860
  free(): void;
371
861
  [Symbol.dispose](): void;
372
- version(): number;
862
+ /**
863
+ * Returns the commitment to the block contents.
864
+ */
373
865
  commitment(): Word;
374
- subCommitment(): Word;
375
- prevBlockCommitment(): Word;
376
- blockNum(): number;
377
- chainCommitment(): Word;
866
+ /**
867
+ * Returns the account root commitment.
868
+ */
378
869
  accountRoot(): Word;
379
- nullifierRoot(): Word;
380
- noteRoot(): Word;
870
+ /**
871
+ * Returns the transaction commitment.
872
+ */
381
873
  txCommitment(): Word;
382
- txKernelCommitment(): Word;
383
- proofCommitment(): Word;
384
- timestamp(): number;
385
- }
386
- export class ConsumableNoteRecord {
387
- free(): void;
388
- [Symbol.dispose](): void;
389
- constructor(input_note_record: InputNoteRecord, note_consumability: NoteConsumability[]);
390
- inputNoteRecord(): InputNoteRecord;
391
- noteConsumability(): NoteConsumability[];
392
- }
393
- /**
394
- * Represents a network endpoint for connecting to Miden nodes.
395
- *
396
- * An endpoint consists of a protocol (http/https), host, and optional port.
397
- * Provides convenient constructors for common network configurations.
398
- */
399
- export class Endpoint {
400
- free(): void;
401
- [Symbol.dispose](): void;
402
874
  /**
403
- * Creates an endpoint from a URL string.
404
- *
405
- * @param url - The URL string (e.g., <https://localhost:57291>)
406
- * @throws throws an error if the URL is invalid
875
+ * Returns the nullifier root commitment.
407
876
  */
408
- constructor(url: string);
877
+ nullifierRoot(): Word;
409
878
  /**
410
- * Returns the endpoint for the Miden testnet.
879
+ * Returns the commitment to block metadata.
411
880
  */
412
- static testnet(): Endpoint;
881
+ subCommitment(): Word;
413
882
  /**
414
- * Returns the endpoint for the Miden devnet.
883
+ * Returns the chain commitment.
415
884
  */
416
- static devnet(): Endpoint;
885
+ chainCommitment(): Word;
417
886
  /**
418
- * Returns the endpoint for a local Miden node.
419
- *
420
- * Uses <http://localhost:57291>
887
+ * Returns the proof commitment.
421
888
  */
422
- static localhost(): Endpoint;
889
+ proofCommitment(): Word;
423
890
  /**
424
- * Returns the string representation of the endpoint.
891
+ * Returns the transaction kernel commitment.
425
892
  */
426
- toString(): string;
893
+ txKernelCommitment(): Word;
427
894
  /**
428
- * Returns the protocol of the endpoint.
895
+ * Returns the commitment of the previous block.
429
896
  */
430
- readonly protocol: string;
897
+ prevBlockCommitment(): Word;
431
898
  /**
432
- * Returns the host of the endpoint.
899
+ * Returns the header version.
433
900
  */
434
- readonly host: string;
901
+ version(): number;
435
902
  /**
436
- * Returns the port of the endpoint.
903
+ * Returns the block height.
437
904
  */
438
- readonly port: number | undefined;
905
+ blockNum(): number;
906
+ /**
907
+ * Returns the note commitment root.
908
+ */
909
+ noteRoot(): Word;
910
+ /**
911
+ * Returns the block timestamp.
912
+ */
913
+ timestamp(): number;
439
914
  }
440
- export class ExecutedTransaction {
915
+ /**
916
+ * Utility for linking libraries and compiling transaction/note scripts.
917
+ */
918
+ export class CodeBuilder {
441
919
  private constructor();
442
- free(): void;
443
- [Symbol.dispose](): void;
444
- id(): TransactionId;
445
- accountId(): AccountId;
446
- initialAccountHeader(): AccountHeader;
447
- finalAccountHeader(): AccountHeader;
448
- inputNotes(): InputNotes;
449
- outputNotes(): OutputNotes;
450
- txArgs(): TransactionArgs;
451
- blockHeader(): BlockHeader;
452
- accountDelta(): AccountDelta;
453
- }
454
- export class Felt {
455
- free(): void;
456
- [Symbol.dispose](): void;
457
- constructor(value: bigint);
458
- asInt(): bigint;
459
- toString(): string;
460
- }
461
- export class FeltArray {
462
920
  /**
463
921
  ** Return copy of self without private attributes.
464
922
  */
@@ -469,58 +927,348 @@ export class FeltArray {
469
927
  toString(): string;
470
928
  free(): void;
471
929
  [Symbol.dispose](): void;
472
- constructor(elements?: Felt[] | null);
473
930
  /**
474
- * Get element at index, will always return a clone to avoid aliasing issues.
931
+ * Given a module path (something like `my_lib::module`) and source code, this will
932
+ * statically link it for use with scripts to be built with this builder.
475
933
  */
476
- get(index: number): Felt;
477
- replaceAt(index: number, elem: Felt): void;
478
- push(element: Felt): void;
479
- length(): number;
480
- }
481
- /**
482
- * Represents a note fetched from a Miden node via RPC.
483
- */
484
- export class FetchedNote {
485
- free(): void;
486
- [Symbol.dispose](): void;
934
+ linkModule(module_path: string, module_code: string): void;
487
935
  /**
488
- * Create a note with an optional `InputNote`.
936
+ * Given a Library Path, and a source code, turn it into a Library.
937
+ * E.g. A path library can be `miden::my_contract`. When turned into a library,
938
+ * this can be used from another script with an import statement, following the
939
+ * previous example: `use miden::my_contract'.
489
940
  */
490
- constructor(note_id: NoteId, metadata: NoteMetadata, input_note?: InputNote | null);
941
+ buildLibrary(library_path: string, source_code: string): Library;
491
942
  /**
492
- * The unique identifier of the note.
943
+ * Given a Transaction Script's source code, compiles it with the available
944
+ * modules under this builder. Returns the compiled script.
493
945
  */
494
- readonly noteId: NoteId;
946
+ compileTxScript(tx_script: string): TransactionScript;
495
947
  /**
496
- * The note's metadata, including sender, tag, and other properties.
497
- * Available for both private and public notes.
948
+ * Given a Note Script's source code, compiles it with the available
949
+ * modules under this builder. Returns the compiled script.
498
950
  */
499
- readonly metadata: NoteMetadata;
951
+ compileNoteScript(program: string): NoteScript;
500
952
  /**
501
- * The full [`InputNote`] with inclusion proof.
953
+ * Statically links the given library.
502
954
  *
503
- * For public notes, it contains the complete note data and inclusion proof.
504
- * For private notes, it will be ``None`.
955
+ * Static linking means the library code is copied into the script code.
956
+ * Use this for most libraries that are not available on-chain.
957
+ *
958
+ * Receives as argument the library to link.
959
+ */
960
+ linkStaticLibrary(library: Library): void;
961
+ /**
962
+ * This is useful to dynamically link the {@link Library} of a foreign account
963
+ * that is invoked using foreign procedure invocation (FPI). Its code is available
964
+ * on-chain and so it does not have to be copied into the script code.
965
+ *
966
+ * For all other use cases not involving FPI, link the library statically.
967
+ * Receives as argument the library to be linked.
968
+ */
969
+ linkDynamicLibrary(library: Library): void;
970
+ /**
971
+ * Given an `AccountComponentCode`, compiles it
972
+ * with the available modules under this builder. Returns the compiled account component code.
973
+ */
974
+ compileAccountComponentCode(account_code: string): AccountComponentCode;
975
+ }
976
+ /**
977
+ * Represents a note committed on chain, as returned by `syncNotes`.
978
+ */
979
+ export class CommittedNote {
980
+ private constructor();
981
+ free(): void;
982
+ [Symbol.dispose](): void;
983
+ /**
984
+ * Returns the note index in the block's note tree.
985
+ */
986
+ noteIndex(): number;
987
+ /**
988
+ * Returns the inclusion path for the note.
989
+ */
990
+ inclusionPath(): SparseMerklePath;
991
+ /**
992
+ * Returns the note ID.
993
+ */
994
+ noteId(): NoteId;
995
+ /**
996
+ * Returns the note metadata.
997
+ */
998
+ metadata(): NoteMetadata;
999
+ }
1000
+ /**
1001
+ * Input note record annotated with consumption conditions.
1002
+ */
1003
+ export class ConsumableNoteRecord {
1004
+ free(): void;
1005
+ [Symbol.dispose](): void;
1006
+ /**
1007
+ * Returns the underlying input note record.
1008
+ */
1009
+ inputNoteRecord(): InputNoteRecord;
1010
+ /**
1011
+ * Returns the consumability entries.
1012
+ */
1013
+ noteConsumability(): NoteConsumability[];
1014
+ /**
1015
+ * Creates a new consumable note record from an input note record and consumability metadata.
1016
+ */
1017
+ constructor(input_note_record: InputNoteRecord, note_consumability: NoteConsumability[]);
1018
+ }
1019
+ /**
1020
+ * The `Endpoint` struct represents a network endpoint, consisting of a protocol, a host, and a
1021
+ * port.
1022
+ *
1023
+ * This struct is used to define the address of a Miden node that the client will connect to.
1024
+ */
1025
+ export class Endpoint {
1026
+ free(): void;
1027
+ [Symbol.dispose](): void;
1028
+ /**
1029
+ * Creates an endpoint from a URL string.
1030
+ *
1031
+ * @param url - The URL string (e.g., <https://localhost:57291>)
1032
+ * @throws throws an error if the URL is invalid
1033
+ */
1034
+ constructor(url: string);
1035
+ /**
1036
+ * Returns the endpoint for the Miden devnet.
1037
+ */
1038
+ static devnet(): Endpoint;
1039
+ /**
1040
+ * Returns the endpoint for the Miden testnet.
1041
+ */
1042
+ static testnet(): Endpoint;
1043
+ /**
1044
+ * Returns the endpoint for a local Miden node.
1045
+ *
1046
+ * Uses <http://localhost:57291>
1047
+ */
1048
+ static localhost(): Endpoint;
1049
+ /**
1050
+ * Returns the string representation of the endpoint.
1051
+ */
1052
+ toString(): string;
1053
+ /**
1054
+ * Returns the host of the endpoint.
1055
+ */
1056
+ readonly host: string;
1057
+ /**
1058
+ * Returns the port of the endpoint.
1059
+ */
1060
+ readonly port: number | undefined;
1061
+ /**
1062
+ * Returns the protocol of the endpoint.
1063
+ */
1064
+ readonly protocol: string;
1065
+ }
1066
+ /**
1067
+ * Describes the result of executing a transaction program for the Miden protocol.
1068
+ *
1069
+ * Executed transaction serves two primary purposes:
1070
+ * - It contains a complete description of the effects of the transaction. Specifically, it
1071
+ * contains all output notes created as the result of the transaction and describes all the
1072
+ * changes made to the involved account (i.e., the account delta).
1073
+ * - It contains all the information required to re-execute and prove the transaction in a
1074
+ * stateless manner. This includes all public transaction inputs, but also all nondeterministic
1075
+ * inputs that the host provided to Miden VM while executing the transaction (i.e., advice
1076
+ * witness).
1077
+ */
1078
+ export class ExecutedTransaction {
1079
+ private constructor();
1080
+ free(): void;
1081
+ [Symbol.dispose](): void;
1082
+ /**
1083
+ * Returns the account the transaction was executed against.
1084
+ */
1085
+ accountId(): AccountId;
1086
+ /**
1087
+ * Returns the input notes consumed by the transaction.
1088
+ */
1089
+ inputNotes(): InputNotes;
1090
+ /**
1091
+ * Returns the block header that included the transaction.
1092
+ */
1093
+ blockHeader(): BlockHeader;
1094
+ /**
1095
+ * Returns the output notes produced by the transaction.
1096
+ */
1097
+ outputNotes(): OutputNotes;
1098
+ /**
1099
+ * Returns the account delta resulting from execution.
1100
+ */
1101
+ accountDelta(): AccountDelta;
1102
+ /**
1103
+ * Returns the final account header after execution.
1104
+ */
1105
+ finalAccountHeader(): AccountHeader;
1106
+ /**
1107
+ * Returns the initial account header before execution.
1108
+ */
1109
+ initialAccountHeader(): AccountHeader;
1110
+ /**
1111
+ * Returns the transaction ID.
1112
+ */
1113
+ id(): TransactionId;
1114
+ /**
1115
+ * Returns the arguments passed to the transaction script.
1116
+ */
1117
+ txArgs(): TransactionArgs;
1118
+ }
1119
+ /**
1120
+ * Field element wrapper exposed to JavaScript.
1121
+ */
1122
+ export class Felt {
1123
+ free(): void;
1124
+ [Symbol.dispose](): void;
1125
+ /**
1126
+ * Creates a new field element from a u64 value.
1127
+ */
1128
+ constructor(value: bigint);
1129
+ /**
1130
+ * Returns the integer representation of the field element.
1131
+ */
1132
+ asInt(): bigint;
1133
+ /**
1134
+ * Returns the string representation of the field element.
1135
+ */
1136
+ toString(): string;
1137
+ }
1138
+ export class FeltArray {
1139
+ /**
1140
+ ** Return copy of self without private attributes.
1141
+ */
1142
+ toJSON(): Object;
1143
+ /**
1144
+ * Return stringified version of self.
1145
+ */
1146
+ toString(): string;
1147
+ free(): void;
1148
+ [Symbol.dispose](): void;
1149
+ replaceAt(index: number, elem: Felt): void;
1150
+ /**
1151
+ * Get element at index, will always return a clone to avoid aliasing issues.
1152
+ */
1153
+ get(index: number): Felt;
1154
+ constructor(elements?: Felt[] | null);
1155
+ push(element: Felt): void;
1156
+ length(): number;
1157
+ }
1158
+ /**
1159
+ * Account details returned by the node.
1160
+ */
1161
+ export class FetchedAccount {
1162
+ private constructor();
1163
+ free(): void;
1164
+ [Symbol.dispose](): void;
1165
+ /**
1166
+ * Returns the account ID.
1167
+ */
1168
+ accountId(): AccountId;
1169
+ /**
1170
+ * Returns the account commitment reported by the node.
1171
+ */
1172
+ commitment(): Word;
1173
+ /**
1174
+ * Returns true when the account is a network account.
1175
+ */
1176
+ isNetwork(): boolean;
1177
+ /**
1178
+ * Returns true when the account is private.
1179
+ */
1180
+ isPrivate(): boolean;
1181
+ /**
1182
+ * Returns the last block height where the account was updated.
1183
+ */
1184
+ lastBlockNum(): number;
1185
+ /**
1186
+ * Returns the full account data when the account is public.
1187
+ */
1188
+ account(): Account | undefined;
1189
+ /**
1190
+ * Returns true when the account is public.
1191
+ */
1192
+ isPublic(): boolean;
1193
+ }
1194
+ /**
1195
+ * Wrapper for a note fetched over RPC.
1196
+ *
1197
+ * It contains the note header and inclusion proof. The note details are only present for
1198
+ * public notes.
1199
+ */
1200
+ export class FetchedNote {
1201
+ free(): void;
1202
+ [Symbol.dispose](): void;
1203
+ /**
1204
+ * Returns an [`InputNote`] when the fetched note is public.
1205
+ *
1206
+ * Returns `undefined` when the note body is missing (e.g. private notes); in that case build
1207
+ * an `InputNote` manually using the inclusion proof and note data obtained elsewhere.
1208
+ */
1209
+ asInputNote(): InputNote | undefined;
1210
+ /**
1211
+ * Create a `FetchedNote` with an optional [`Note`].
1212
+ */
1213
+ constructor(note_id: NoteId, metadata: NoteMetadata, inclusion_proof: NoteInclusionProof, note?: Note | null);
1214
+ /**
1215
+ * The note's inclusion proof.
1216
+ *
1217
+ * Contains the data required to prove inclusion of the note in the canonical chain.
1218
+ */
1219
+ readonly inclusionProof: NoteInclusionProof;
1220
+ /**
1221
+ * The full [`Note`] data.
1222
+ *
1223
+ * For public notes, it contains the complete note data.
1224
+ * For private notes, it will be undefined.
1225
+ */
1226
+ readonly note: Note | undefined;
1227
+ /**
1228
+ * The note's header, containing the ID and metadata.
1229
+ */
1230
+ readonly header: NoteHeader;
1231
+ /**
1232
+ * The unique identifier of the note.
1233
+ */
1234
+ readonly noteId: NoteId;
1235
+ /**
1236
+ * The note's metadata, including sender, tag, and other properties.
1237
+ * Available for both private and public notes.
1238
+ */
1239
+ readonly metadata: NoteMetadata;
1240
+ /**
1241
+ * Returns whether the note is private, encrypted, or public.
505
1242
  */
506
- readonly inputNote: InputNote | undefined;
507
1243
  readonly noteType: NoteType;
508
1244
  }
509
1245
  export class FlattenedU8Vec {
510
1246
  private constructor();
511
1247
  free(): void;
512
1248
  [Symbol.dispose](): void;
1249
+ num_inner_vecs(): number;
513
1250
  data(): Uint8Array;
514
1251
  lengths(): Uint32Array;
515
- num_inner_vecs(): number;
516
1252
  }
1253
+ /**
1254
+ * Description of a foreign account referenced by a transaction.
1255
+ */
517
1256
  export class ForeignAccount {
518
1257
  private constructor();
519
1258
  free(): void;
520
1259
  [Symbol.dispose](): void;
521
- static public(account_id: AccountId, storage_requirements: AccountStorageRequirements): ForeignAccount;
522
- storage_slot_requirements(): AccountStorageRequirements;
1260
+ /**
1261
+ * Returns the ID of the foreign account.
1262
+ */
523
1263
  account_id(): AccountId;
1264
+ /**
1265
+ * Returns the required storage slots/keys for this foreign account.
1266
+ */
1267
+ storage_slot_requirements(): AccountStorageRequirements;
1268
+ /**
1269
+ * Creates a foreign account entry for a public account with given storage requirements.
1270
+ */
1271
+ static public(account_id: AccountId, storage_requirements: AccountStorageRequirements): ForeignAccount;
524
1272
  }
525
1273
  export class ForeignAccountArray {
526
1274
  /**
@@ -533,102 +1281,262 @@ export class ForeignAccountArray {
533
1281
  toString(): string;
534
1282
  free(): void;
535
1283
  [Symbol.dispose](): void;
536
- constructor(elements?: ForeignAccount[] | null);
1284
+ replaceAt(index: number, elem: ForeignAccount): void;
537
1285
  /**
538
1286
  * Get element at index, will always return a clone to avoid aliasing issues.
539
1287
  */
540
1288
  get(index: number): ForeignAccount;
541
- replaceAt(index: number, elem: ForeignAccount): void;
1289
+ constructor(elements?: ForeignAccount[] | null);
542
1290
  push(element: ForeignAccount): void;
543
1291
  length(): number;
544
1292
  }
1293
+ /**
1294
+ * A fungible asset.
1295
+ *
1296
+ * A fungible asset consists of a faucet ID of the faucet which issued the asset as well as the
1297
+ * asset amount. Asset amount is guaranteed to be 2^63 - 1 or smaller.
1298
+ */
545
1299
  export class FungibleAsset {
546
1300
  free(): void;
547
1301
  [Symbol.dispose](): void;
1302
+ /**
1303
+ * Creates a fungible asset for the given faucet and amount.
1304
+ */
548
1305
  constructor(faucet_id: AccountId, amount: bigint);
549
- faucetId(): AccountId;
1306
+ /**
1307
+ * Returns the amount of fungible units.
1308
+ */
550
1309
  amount(): bigint;
1310
+ /**
1311
+ * Returns the faucet account that minted this asset.
1312
+ */
1313
+ faucetId(): AccountId;
1314
+ /**
1315
+ * Encodes this asset into the word layout used in the vault.
1316
+ */
551
1317
  intoWord(): Word;
552
1318
  }
1319
+ /**
1320
+ * Aggregated fungible deltas keyed by faucet ID.
1321
+ */
553
1322
  export class FungibleAssetDelta {
554
1323
  private constructor();
555
1324
  free(): void;
556
1325
  [Symbol.dispose](): void;
557
- serialize(): Uint8Array;
1326
+ /**
1327
+ * Returns the number of distinct fungible assets in the delta.
1328
+ */
1329
+ numAssets(): number;
1330
+ /**
1331
+ * Deserializes a fungible delta from bytes.
1332
+ */
558
1333
  static deserialize(bytes: Uint8Array): FungibleAssetDelta;
559
- isEmpty(): boolean;
1334
+ /**
1335
+ * Returns the delta amount for a given faucet, if present.
1336
+ */
560
1337
  amount(faucet_id: AccountId): bigint | undefined;
561
- numAssets(): number;
1338
+ /**
1339
+ * Returns all fungible asset deltas as a list.
1340
+ */
562
1341
  assets(): FungibleAssetDeltaItem[];
1342
+ /**
1343
+ * Returns true if no fungible assets are affected.
1344
+ */
1345
+ isEmpty(): boolean;
1346
+ /**
1347
+ * Serializes the fungible delta into bytes.
1348
+ */
1349
+ serialize(): Uint8Array;
563
1350
  }
1351
+ /**
1352
+ * A single fungible asset change in the vault delta.
1353
+ */
564
1354
  export class FungibleAssetDeltaItem {
565
1355
  private constructor();
566
1356
  free(): void;
567
1357
  [Symbol.dispose](): void;
568
- readonly faucetId: AccountId;
1358
+ /**
1359
+ * Returns the signed amount change (positive adds assets, negative removes).
1360
+ */
569
1361
  readonly amount: bigint;
1362
+ /**
1363
+ * Returns the faucet ID this delta refers to.
1364
+ */
1365
+ readonly faucetId: AccountId;
570
1366
  }
1367
+ /**
1368
+ * Procedure digest paired with whether it is an auth procedure.
1369
+ */
571
1370
  export class GetProceduresResultItem {
572
1371
  private constructor();
573
1372
  free(): void;
574
1373
  [Symbol.dispose](): void;
1374
+ /**
1375
+ * Returns the MAST root digest for the procedure.
1376
+ */
575
1377
  readonly digest: Word;
1378
+ /**
1379
+ * Returns true if the procedure is used for authentication.
1380
+ */
576
1381
  readonly isAuth: boolean;
577
1382
  }
1383
+ /**
1384
+ * Note supplied as an input to a transaction, optionally with authentication data.
1385
+ */
578
1386
  export class InputNote {
579
1387
  private constructor();
580
1388
  free(): void;
581
1389
  [Symbol.dispose](): void;
1390
+ /**
1391
+ * Returns the commitment to the note ID and metadata.
1392
+ */
1393
+ commitment(): Word;
1394
+ /**
1395
+ * Creates an authenticated input note from a note and its inclusion proof.
1396
+ *
1397
+ * An authenticated note has a proof of inclusion in the block's note tree,
1398
+ * which is required for consuming the note in a transaction.
1399
+ */
1400
+ static authenticated(note: Note, inclusion_proof: NoteInclusionProof): InputNote;
1401
+ /**
1402
+ * Creates an unauthenticated input note from note details.
1403
+ *
1404
+ * An unauthenticated note can be consumed in a transaction as long as the note exists in the
1405
+ * network as of the transaction batch in which the consume transaction is included.
1406
+ */
1407
+ static unauthenticated(note: Note): InputNote;
1408
+ /**
1409
+ * Returns the identifier of the input note.
1410
+ */
582
1411
  id(): NoteId;
1412
+ /**
1413
+ * Returns the underlying note contents.
1414
+ */
583
1415
  note(): Note;
584
- commitment(): Word;
1416
+ /**
1417
+ * Returns the inclusion proof if the note is authenticated.
1418
+ */
585
1419
  proof(): NoteInclusionProof | undefined;
1420
+ /**
1421
+ * Returns the note's location within the commitment tree when available.
1422
+ */
586
1423
  location(): NoteLocation | undefined;
587
1424
  }
1425
+ /**
1426
+ * Represents a Note of which the Store can keep track and retrieve.
1427
+ *
1428
+ * An `InputNoteRecord` contains all the information of a `NoteDetails`, in addition to specific
1429
+ * information about the note state.
1430
+ *
1431
+ * Once a proof is received, the `InputNoteRecord` can be transformed into an `InputNote` and used
1432
+ * as input for transactions. It is also possible to convert `Note` and `InputNote` into
1433
+ * `InputNoteRecord` (we fill the `metadata` and `inclusion_proof` fields if possible).
1434
+ *
1435
+ * Notes can also be consumed as unauthenticated notes, where their existence is verified by the
1436
+ * network.
1437
+ */
588
1438
  export class InputNoteRecord {
589
1439
  private constructor();
590
1440
  free(): void;
591
1441
  [Symbol.dispose](): void;
1442
+ /**
1443
+ * Returns the note commitment (id + metadata), if available.
1444
+ */
1445
+ commitment(): Word | undefined;
1446
+ /**
1447
+ * Returns true if the note has already been consumed.
1448
+ */
1449
+ isConsumed(): boolean;
1450
+ /**
1451
+ * Returns true if the note is currently being processed.
1452
+ */
1453
+ isProcessing(): boolean;
1454
+ /**
1455
+ * Converts the record into an `InputNote` (including proof when available).
1456
+ */
1457
+ toInputNote(): InputNote;
1458
+ /**
1459
+ * Returns the inclusion proof when the note is authenticated.
1460
+ */
1461
+ inclusionProof(): NoteInclusionProof | undefined;
1462
+ /**
1463
+ * Returns true if the record contains authentication data (proof).
1464
+ */
1465
+ isAuthenticated(): boolean;
1466
+ /**
1467
+ * Returns the transaction ID that consumed this note, if any.
1468
+ */
1469
+ consumerTransactionId(): string | undefined;
1470
+ /**
1471
+ * Returns the note ID.
1472
+ */
592
1473
  id(): NoteId;
1474
+ /**
1475
+ * Returns the current processing state for this note.
1476
+ */
593
1477
  state(): InputNoteState;
1478
+ /**
1479
+ * Returns the note details, if present.
1480
+ */
594
1481
  details(): NoteDetails;
1482
+ /**
1483
+ * Converts the record into a `Note` (including proof when available).
1484
+ */
1485
+ toNote(): Note;
1486
+ /**
1487
+ * Returns the note metadata if available.
1488
+ */
595
1489
  metadata(): NoteMetadata | undefined;
596
- commitment(): Word | undefined;
597
- inclusionProof(): NoteInclusionProof | undefined;
598
- consumerTransactionId(): string | undefined;
1490
+ /**
1491
+ * Returns the nullifier for this note.
1492
+ */
599
1493
  nullifier(): string;
600
- isAuthenticated(): boolean;
601
- isConsumed(): boolean;
602
- isProcessing(): boolean;
603
- toInputNote(): InputNote;
604
1494
  }
1495
+ /**
1496
+ * Input notes for a transaction, empty if the transaction does not consume notes.
1497
+ */
605
1498
  export class InputNotes {
606
1499
  private constructor();
607
1500
  free(): void;
608
1501
  [Symbol.dispose](): void;
1502
+ /**
1503
+ * Returns the commitment to all input notes.
1504
+ */
609
1505
  commitment(): Word;
610
- numNotes(): number;
611
- isEmpty(): boolean;
612
- getNote(index: number): InputNote;
1506
+ /**
1507
+ * Returns all input notes as a vector.
1508
+ */
613
1509
  notes(): InputNote[];
1510
+ /**
1511
+ * Returns the input note at the specified index.
1512
+ */
1513
+ getNote(index: number): InputNote;
1514
+ /**
1515
+ * Returns true if there are no input notes.
1516
+ */
1517
+ isEmpty(): boolean;
1518
+ /**
1519
+ * Returns the number of input notes.
1520
+ */
1521
+ numNotes(): number;
614
1522
  }
615
1523
  export class IntoUnderlyingByteSource {
616
1524
  private constructor();
617
1525
  free(): void;
618
1526
  [Symbol.dispose](): void;
619
- start(controller: ReadableByteStreamController): void;
620
1527
  pull(controller: ReadableByteStreamController): Promise<any>;
1528
+ start(controller: ReadableByteStreamController): void;
621
1529
  cancel(): void;
622
- readonly type: ReadableStreamType;
623
1530
  readonly autoAllocateChunkSize: number;
1531
+ readonly type: ReadableStreamType;
624
1532
  }
625
1533
  export class IntoUnderlyingSink {
626
1534
  private constructor();
627
1535
  free(): void;
628
1536
  [Symbol.dispose](): void;
629
- write(chunk: any): Promise<any>;
630
- close(): Promise<any>;
631
1537
  abort(reason: any): Promise<any>;
1538
+ close(): Promise<any>;
1539
+ write(chunk: any): Promise<any>;
632
1540
  }
633
1541
  export class IntoUnderlyingSource {
634
1542
  private constructor();
@@ -711,10 +1619,9 @@ export class JsStateSyncUpdate {
711
1619
  free(): void;
712
1620
  [Symbol.dispose](): void;
713
1621
  /**
714
- * The block number for this update, stored as a string since it will be
715
- * persisted in `IndexedDB`.
1622
+ * The block number for this update.
716
1623
  */
717
- blockNum: string;
1624
+ blockNum: number;
718
1625
  /**
719
1626
  * The new block headers for this state update, serialized into a flattened byte array.
720
1627
  */
@@ -724,7 +1631,7 @@ export class JsStateSyncUpdate {
724
1631
  * This vec should have the same length as the number of headers, with each index
725
1632
  * representing the block number for the header at that same index.
726
1633
  */
727
- newBlockNums: string[];
1634
+ newBlockNums: Uint32Array;
728
1635
  /**
729
1636
  * Flattened byte array containing partial blockchain peaks used for merkle tree
730
1637
  * verification.
@@ -813,9 +1720,9 @@ export class JsStorageSlot {
813
1720
  */
814
1721
  commitment: string;
815
1722
  /**
816
- * The index of the storage slot.
1723
+ * The name of the storage slot.
817
1724
  */
818
- slotIndex: number;
1725
+ slotName: string;
819
1726
  /**
820
1727
  * The value stored in the storage slot.
821
1728
  */
@@ -862,33 +1769,112 @@ export class Library {
862
1769
  free(): void;
863
1770
  [Symbol.dispose](): void;
864
1771
  }
1772
+ /**
1773
+ * Represents a Merkle path.
1774
+ */
865
1775
  export class MerklePath {
866
1776
  private constructor();
867
1777
  free(): void;
868
1778
  [Symbol.dispose](): void;
1779
+ /**
1780
+ * Computes the root given a leaf index and value.
1781
+ */
1782
+ computeRoot(index: bigint, node: Word): Word;
1783
+ /**
1784
+ * Returns the depth of the path.
1785
+ */
869
1786
  depth(): number;
1787
+ /**
1788
+ * Returns the nodes that make up the path.
1789
+ */
870
1790
  nodes(): Word[];
871
- computeRoot(index: bigint, node: Word): Word;
1791
+ /**
1792
+ * Verifies the path against a root.
1793
+ */
872
1794
  verify(index: bigint, node: Word, root: Word): boolean;
873
1795
  }
1796
+ /**
1797
+ * The identifier of a Miden network.
1798
+ */
1799
+ export class NetworkId {
1800
+ private constructor();
1801
+ free(): void;
1802
+ [Symbol.dispose](): void;
1803
+ /**
1804
+ * Builds a custom network ID from a provided custom prefix.
1805
+ *
1806
+ * Returns an error if the prefix is invalid.
1807
+ */
1808
+ static custom(custom_prefix: string): NetworkId;
1809
+ static devnet(): NetworkId;
1810
+ static mainnet(): NetworkId;
1811
+ static testnet(): NetworkId;
1812
+ }
1813
+ /**
1814
+ * A note bundles public metadata with private details: assets, script, inputs, and a serial number
1815
+ * grouped into a recipient. The public identifier (`NoteId`) commits to those
1816
+ * details, while the nullifier stays hidden until the note is consumed. Assets move by
1817
+ * transferring them into the note; the script and inputs define how and when consumption can
1818
+ * happen. See `NoteRecipient` for the shape of the recipient data.
1819
+ */
874
1820
  export class Note {
875
1821
  free(): void;
876
1822
  [Symbol.dispose](): void;
877
- constructor(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient);
878
- serialize(): Uint8Array;
1823
+ /**
1824
+ * Returns the commitment to the note ID and metadata.
1825
+ */
1826
+ commitment(): Word;
1827
+ /**
1828
+ * Deserializes a note from its byte representation.
1829
+ */
879
1830
  static deserialize(bytes: Uint8Array): Note;
1831
+ /**
1832
+ * Builds a standard P2ID note that targets the specified account.
1833
+ */
1834
+ static createP2IDNote(sender: AccountId, target: AccountId, assets: NoteAssets, note_type: NoteType, attachment: NoteAttachment): Note;
1835
+ /**
1836
+ * Builds a P2IDE note that can be reclaimed or timelocked based on block heights.
1837
+ */
1838
+ static createP2IDENote(sender: AccountId, target: AccountId, assets: NoteAssets, reclaim_height: number | null | undefined, timelock_height: number | null | undefined, note_type: NoteType, attachment: NoteAttachment): Note;
1839
+ /**
1840
+ * Returns the unique identifier of the note.
1841
+ */
880
1842
  id(): NoteId;
881
- commitment(): Word;
882
- metadata(): NoteMetadata;
883
- recipient(): NoteRecipient;
1843
+ /**
1844
+ * Creates a new note from the provided assets, metadata, and recipient.
1845
+ */
1846
+ constructor(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient);
1847
+ /**
1848
+ * Returns the assets locked inside the note.
1849
+ */
884
1850
  assets(): NoteAssets;
1851
+ /**
1852
+ * Returns the script that guards the note.
1853
+ */
885
1854
  script(): NoteScript;
886
- static createP2IDNote(sender: AccountId, target: AccountId, assets: NoteAssets, note_type: NoteType, aux: Felt): Note;
887
- static createP2IDENote(sender: AccountId, target: AccountId, assets: NoteAssets, reclaim_height: number | null | undefined, timelock_height: number | null | undefined, note_type: NoteType, aux: Felt): Note;
1855
+ /**
1856
+ * Returns the public metadata associated with the note.
1857
+ */
1858
+ metadata(): NoteMetadata;
1859
+ /**
1860
+ * Returns the note nullifier as a word.
1861
+ */
1862
+ nullifier(): Word;
1863
+ /**
1864
+ * Returns the recipient who can consume this note.
1865
+ */
1866
+ recipient(): NoteRecipient;
1867
+ /**
1868
+ * Serializes the note into bytes.
1869
+ */
1870
+ serialize(): Uint8Array;
888
1871
  }
889
1872
  export class NoteAndArgs {
890
1873
  free(): void;
891
1874
  [Symbol.dispose](): void;
1875
+ /**
1876
+ * Creates a new note/args pair for transaction building.
1877
+ */
892
1878
  constructor(note: Note, args?: Word | null);
893
1879
  }
894
1880
  export class NoteAndArgsArray {
@@ -902,42 +1888,214 @@ export class NoteAndArgsArray {
902
1888
  toString(): string;
903
1889
  free(): void;
904
1890
  [Symbol.dispose](): void;
905
- constructor(elements?: NoteAndArgs[] | null);
1891
+ replaceAt(index: number, elem: NoteAndArgs): void;
906
1892
  /**
907
1893
  * Get element at index, will always return a clone to avoid aliasing issues.
908
1894
  */
909
1895
  get(index: number): NoteAndArgs;
910
- replaceAt(index: number, elem: NoteAndArgs): void;
1896
+ constructor(elements?: NoteAndArgs[] | null);
911
1897
  push(element: NoteAndArgs): void;
912
1898
  length(): number;
913
1899
  }
1900
+ /**
1901
+ * An asset container for a note.
1902
+ *
1903
+ * A note must contain at least 1 asset and can contain up to 256 assets. No duplicates are
1904
+ * allowed, but the order of assets is unspecified.
1905
+ *
1906
+ * All the assets in a note can be reduced to a single commitment which is computed by sequentially
1907
+ * hashing the assets. Note that the same list of assets can result in two different commitments if
1908
+ * the asset ordering is different.
1909
+ */
914
1910
  export class NoteAssets {
915
1911
  free(): void;
916
1912
  [Symbol.dispose](): void;
1913
+ /**
1914
+ * Returns all fungible assets contained in the note.
1915
+ */
1916
+ fungibleAssets(): FungibleAsset[];
1917
+ /**
1918
+ * Creates a new asset list for a note.
1919
+ */
917
1920
  constructor(assets_array?: FungibleAsset[] | null);
1921
+ /**
1922
+ * Adds a fungible asset to the collection.
1923
+ */
918
1924
  push(asset: FungibleAsset): void;
919
- fungibleAssets(): FungibleAsset[];
1925
+ }
1926
+ /**
1927
+ * An attachment to a note.
1928
+ *
1929
+ * Note attachments provide additional context about how notes should be processed.
1930
+ * For example, a network account target attachment indicates that the note should
1931
+ * be consumed by a specific network account.
1932
+ */
1933
+ export class NoteAttachment {
1934
+ free(): void;
1935
+ [Symbol.dispose](): void;
1936
+ /**
1937
+ * Returns the attachment kind.
1938
+ */
1939
+ attachmentKind(): NoteAttachmentKind;
1940
+ /**
1941
+ * Returns the attachment scheme.
1942
+ */
1943
+ attachmentScheme(): NoteAttachmentScheme;
1944
+ /**
1945
+ * Creates a new note attachment for a network account target.
1946
+ *
1947
+ * This attachment indicates that the note should be consumed by a specific network account.
1948
+ * Network accounts are accounts whose storage mode is `Network`, meaning the network (nodes)
1949
+ * can execute transactions on behalf of the account.
1950
+ *
1951
+ * # Arguments
1952
+ * * `target_id` - The ID of the network account that should consume the note
1953
+ * * `exec_hint` - A hint about when the note can be executed
1954
+ *
1955
+ * # Errors
1956
+ * Returns an error if the target account is not a network account.
1957
+ */
1958
+ static newNetworkAccountTarget(target_id: AccountId, exec_hint: NoteExecutionHint): NoteAttachment;
1959
+ /**
1960
+ * Creates a default (empty) note attachment.
1961
+ */
1962
+ constructor();
1963
+ /**
1964
+ * Returns the content as a Word if the attachment kind is Word, otherwise None.
1965
+ */
1966
+ asWord(): Word | undefined;
1967
+ /**
1968
+ * Returns the content as an array of Felts if the attachment kind is Array, otherwise None.
1969
+ */
1970
+ asArray(): FeltArray | undefined;
1971
+ /**
1972
+ * Creates a new note attachment with Word content from the provided word.
1973
+ */
1974
+ static newWord(scheme: NoteAttachmentScheme, word: Word): NoteAttachment;
1975
+ /**
1976
+ * Creates a new note attachment with Array content from the provided elements.
1977
+ */
1978
+ static newArray(scheme: NoteAttachmentScheme, elements: FeltArray): NoteAttachment;
1979
+ }
1980
+ /**
1981
+ * Describes the type of a note attachment.
1982
+ *
1983
+ * Value `0` is reserved to signal that the scheme is none or absent. Whenever the kind of
1984
+ * attachment is not standardized or interoperability is unimportant, this none value can be used.
1985
+ */
1986
+ export class NoteAttachmentScheme {
1987
+ free(): void;
1988
+ [Symbol.dispose](): void;
1989
+ /**
1990
+ * Creates a new `NoteAttachmentScheme` from a u32.
1991
+ */
1992
+ constructor(scheme: number);
1993
+ /**
1994
+ * Returns the `NoteAttachmentScheme` that signals the absence of an attachment scheme.
1995
+ */
1996
+ static none(): NoteAttachmentScheme;
1997
+ /**
1998
+ * Returns the note attachment scheme as a u32.
1999
+ */
2000
+ asU32(): number;
2001
+ /**
2002
+ * Returns true if the attachment scheme is the reserved value that signals an absent scheme.
2003
+ */
2004
+ isNone(): boolean;
920
2005
  }
921
2006
  export class NoteConsumability {
922
2007
  private constructor();
923
2008
  free(): void;
924
2009
  [Symbol.dispose](): void;
2010
+ /**
2011
+ * Returns the account that can consume the note.
2012
+ */
925
2013
  accountId(): AccountId;
2014
+ /**
2015
+ * Returns the consumption status of the note.
2016
+ */
2017
+ consumptionStatus(): NoteConsumptionStatus;
2018
+ }
2019
+ /**
2020
+ * Describes if a note could be consumed under a specific conditions: target account state and
2021
+ * block height.
2022
+ */
2023
+ export class NoteConsumptionStatus {
2024
+ private constructor();
2025
+ free(): void;
2026
+ [Symbol.dispose](): void;
2027
+ /**
2028
+ * Constructs a `NoteConsumptionStatus` that is consumable.
2029
+ */
2030
+ static consumable(): NoteConsumptionStatus;
2031
+ /**
2032
+ * Constructs a `NoteConsumptionStatus` that is consumable after a specific block height.
2033
+ */
2034
+ static consumableAfter(block_height: number): NoteConsumptionStatus;
2035
+ /**
2036
+ * Constructs a `NoteConsumptionStatus` that is never consumable.
2037
+ */
2038
+ static neverConsumable(err: string): NoteConsumptionStatus;
2039
+ /**
2040
+ * Returns the block number at which the note can be consumed.
2041
+ * Returns None if the note is already consumable or never possible
2042
+ */
926
2043
  consumableAfterBlock(): number | undefined;
2044
+ /**
2045
+ * Constructs a `NoteConsumptionStatus` that is unconsumable due to conditions.
2046
+ */
2047
+ static unconsumableConditions(): NoteConsumptionStatus;
2048
+ /**
2049
+ * Constructs a `NoteConsumptionStatus` that is consumable with authorization.
2050
+ */
2051
+ static consumableWithAuthorization(): NoteConsumptionStatus;
927
2052
  }
2053
+ /**
2054
+ * Details of a note consisting of assets, script, inputs, and a serial number.
2055
+ *
2056
+ * See the {@link Note} type for more details.
2057
+ */
928
2058
  export class NoteDetails {
929
2059
  free(): void;
930
2060
  [Symbol.dispose](): void;
931
- constructor(note_assets: NoteAssets, note_recipient: NoteRecipient);
2061
+ /**
2062
+ * Returns the note identifier derived from these details.
2063
+ */
932
2064
  id(): NoteId;
2065
+ /**
2066
+ * Creates a new set of note details from the given assets and recipient.
2067
+ */
2068
+ constructor(note_assets: NoteAssets, note_recipient: NoteRecipient);
2069
+ /**
2070
+ * Returns the assets locked by the note.
2071
+ */
933
2072
  assets(): NoteAssets;
2073
+ /**
2074
+ * Returns the note nullifier as a word.
2075
+ */
2076
+ nullifier(): Word;
2077
+ /**
2078
+ * Returns the recipient which controls when the note can be consumed.
2079
+ */
934
2080
  recipient(): NoteRecipient;
935
2081
  }
2082
+ /**
2083
+ * Pair of note details and tag used when declaring expected notes.
2084
+ */
936
2085
  export class NoteDetailsAndTag {
937
2086
  free(): void;
938
2087
  [Symbol.dispose](): void;
2088
+ /**
2089
+ * Creates a new pair from note details and tag.
2090
+ */
939
2091
  constructor(note_details: NoteDetails, tag: NoteTag);
2092
+ /**
2093
+ * Returns the note details.
2094
+ */
940
2095
  readonly noteDetails: NoteDetails;
2096
+ /**
2097
+ * Returns the note tag.
2098
+ */
941
2099
  readonly tag: NoteTag;
942
2100
  }
943
2101
  export class NoteDetailsAndTagArray {
@@ -951,33 +2109,46 @@ export class NoteDetailsAndTagArray {
951
2109
  toString(): string;
952
2110
  free(): void;
953
2111
  [Symbol.dispose](): void;
954
- constructor(elements?: NoteDetailsAndTag[] | null);
2112
+ replaceAt(index: number, elem: NoteDetailsAndTag): void;
955
2113
  /**
956
2114
  * Get element at index, will always return a clone to avoid aliasing issues.
957
2115
  */
958
2116
  get(index: number): NoteDetailsAndTag;
959
- replaceAt(index: number, elem: NoteDetailsAndTag): void;
2117
+ constructor(elements?: NoteDetailsAndTag[] | null);
960
2118
  push(element: NoteDetailsAndTag): void;
961
2119
  length(): number;
962
2120
  }
2121
+ /**
2122
+ * Hint describing when a note can be consumed.
2123
+ */
963
2124
  export class NoteExecutionHint {
964
2125
  private constructor();
965
2126
  free(): void;
966
2127
  [Symbol.dispose](): void;
967
- static none(): NoteExecutionHint;
968
- static always(): NoteExecutionHint;
2128
+ /**
2129
+ * Reconstructs a hint from its encoded tag and payload.
2130
+ */
2131
+ static fromParts(tag: number, payload: number): NoteExecutionHint;
2132
+ /**
2133
+ * Creates a hint that activates after the given block number.
2134
+ */
969
2135
  static afterBlock(block_num: number): NoteExecutionHint;
2136
+ /**
2137
+ * Creates a hint that allows execution in a specific slot of a round.
2138
+ */
970
2139
  static onBlockSlot(epoch_len: number, slot_len: number, slot_offset: number): NoteExecutionHint;
971
- static fromParts(tag: number, payload: number): NoteExecutionHint;
2140
+ /**
2141
+ * Returns whether the note can be consumed at the provided block height.
2142
+ */
972
2143
  canBeConsumed(block_num: number): boolean;
973
- }
974
- export class NoteExecutionMode {
975
- private constructor();
976
- free(): void;
977
- [Symbol.dispose](): void;
978
- static newLocal(): NoteExecutionMode;
979
- static newNetwork(): NoteExecutionMode;
980
- toString(): string;
2144
+ /**
2145
+ * Creates a hint that does not specify any execution constraint.
2146
+ */
2147
+ static none(): NoteExecutionHint;
2148
+ /**
2149
+ * Creates a hint indicating the note can always be consumed.
2150
+ */
2151
+ static always(): NoteExecutionHint;
981
2152
  }
982
2153
  /**
983
2154
  * A serialized representation of a note.
@@ -995,46 +2166,137 @@ export class NoteFile {
995
2166
  free(): void;
996
2167
  [Symbol.dispose](): void;
997
2168
  /**
998
- * Returns this `NoteFile`'s types.
2169
+ * Given a valid byte representation of a `NoteFile`,
2170
+ * return it as a struct.
999
2171
  */
1000
- noteType(): string;
2172
+ static deserialize(bytes: Uint8Array): NoteFile;
1001
2173
  /**
1002
- * Turn a notefile into its byte representation.
2174
+ * Creates a `NoteFile` from a note ID.
1003
2175
  */
1004
- serialize(): Uint8Array;
2176
+ static fromNoteId(note_details: NoteId): NoteFile;
1005
2177
  /**
1006
- * Given a valid byte representation of a `NoteFile`,
1007
- * return it as a struct.
2178
+ * Returns the note details if present.
2179
+ */
2180
+ noteDetails(): NoteDetails | undefined;
2181
+ /**
2182
+ * Returns the after-block hint when present.
2183
+ */
2184
+ afterBlockNum(): number | undefined;
2185
+ /**
2186
+ * Creates a `NoteFile` from an input note, preserving proof when available.
1008
2187
  */
1009
- static deserialize(bytes: Uint8Array): NoteFile;
1010
2188
  static fromInputNote(note: InputNote): NoteFile;
2189
+ /**
2190
+ * Returns the inclusion proof if present.
2191
+ */
2192
+ inclusionProof(): NoteInclusionProof | undefined;
2193
+ /**
2194
+ * Creates a `NoteFile` from an output note, choosing details when present.
2195
+ */
1011
2196
  static fromOutputNote(note: OutputNote): NoteFile;
2197
+ /**
2198
+ * Creates a `NoteFile` from note details.
2199
+ */
1012
2200
  static fromNoteDetails(note_details: NoteDetails): NoteFile;
1013
- static fromNoteId(note_details: NoteId): NoteFile;
2201
+ /**
2202
+ * Returns the full note when the file includes it.
2203
+ */
2204
+ note(): Note | undefined;
2205
+ /**
2206
+ * Returns the note ID for any `NoteFile` variant.
2207
+ */
2208
+ noteId(): NoteId;
2209
+ /**
2210
+ * Returns the note tag hint when present.
2211
+ */
2212
+ noteTag(): NoteTag | undefined;
2213
+ /**
2214
+ * Returns this `NoteFile`'s types.
2215
+ */
2216
+ noteType(): string;
2217
+ /**
2218
+ * Returns the note nullifier when present.
2219
+ */
2220
+ nullifier(): string | undefined;
2221
+ /**
2222
+ * Turn a notefile into its byte representation.
2223
+ */
2224
+ serialize(): Uint8Array;
1014
2225
  }
2226
+ /**
2227
+ * Filter options for querying notes from the store.
2228
+ */
1015
2229
  export class NoteFilter {
1016
2230
  free(): void;
1017
2231
  [Symbol.dispose](): void;
2232
+ /**
2233
+ * Creates a new filter for the given type and optional note IDs.
2234
+ */
1018
2235
  constructor(note_type: NoteFilterTypes, note_ids?: NoteId[] | null);
1019
2236
  }
2237
+ /**
2238
+ * Holds the strictly required, public information of a note.
2239
+ *
2240
+ * See `NoteId` and `NoteMetadata` for additional details.
2241
+ */
1020
2242
  export class NoteHeader {
1021
2243
  private constructor();
1022
2244
  free(): void;
1023
2245
  [Symbol.dispose](): void;
2246
+ /**
2247
+ * Returns a commitment to the note ID and metadata.
2248
+ */
2249
+ commitment(): Word;
2250
+ /**
2251
+ * Returns the unique identifier for the note.
2252
+ */
1024
2253
  id(): NoteId;
2254
+ /**
2255
+ * Returns the public metadata attached to the note.
2256
+ */
1025
2257
  metadata(): NoteMetadata;
1026
- commitment(): Word;
1027
2258
  }
2259
+ /**
2260
+ * Returns a unique identifier of a note, which is simultaneously a commitment to the note.
2261
+ *
2262
+ * Note ID is computed as:
2263
+ *
2264
+ * > `hash(recipient, asset_commitment)`
2265
+ *
2266
+ * where `recipient` is defined as:
2267
+ *
2268
+ * > `hash(hash(hash(serial_num, ZERO), script_root), input_commitment)`
2269
+ *
2270
+ * This achieves the following properties:
2271
+ * - Every note can be reduced to a single unique ID.
2272
+ * - To compute a note ID, we do not need to know the note's `serial_num`. Knowing the hash of the
2273
+ * `serial_num` (as well as script root, input commitment, and note assets) is sufficient.
2274
+ */
1028
2275
  export class NoteId {
1029
2276
  free(): void;
1030
2277
  [Symbol.dispose](): void;
2278
+ /**
2279
+ * Builds a note ID from the recipient and asset commitments.
2280
+ */
1031
2281
  constructor(recipient_digest: Word, asset_commitment_digest: Word);
2282
+ /**
2283
+ * Parses a note ID from its hex encoding.
2284
+ */
1032
2285
  static fromHex(hex: string): NoteId;
2286
+ /**
2287
+ * Returns the canonical hex representation of the note ID.
2288
+ */
1033
2289
  toString(): string;
1034
2290
  }
2291
+ /**
2292
+ * Note ID paired with optional arguments for inclusion in a transaction request.
2293
+ */
1035
2294
  export class NoteIdAndArgs {
1036
2295
  free(): void;
1037
2296
  [Symbol.dispose](): void;
2297
+ /**
2298
+ * Creates a new NoteId/args pair.
2299
+ */
1038
2300
  constructor(note_id: NoteId, args?: Word | null);
1039
2301
  }
1040
2302
  export class NoteIdAndArgsArray {
@@ -1048,51 +2310,137 @@ export class NoteIdAndArgsArray {
1048
2310
  toString(): string;
1049
2311
  free(): void;
1050
2312
  [Symbol.dispose](): void;
1051
- constructor(elements?: NoteIdAndArgs[] | null);
2313
+ replaceAt(index: number, elem: NoteIdAndArgs): void;
1052
2314
  /**
1053
2315
  * Get element at index, will always return a clone to avoid aliasing issues.
1054
2316
  */
1055
2317
  get(index: number): NoteIdAndArgs;
1056
- replaceAt(index: number, elem: NoteIdAndArgs): void;
2318
+ constructor(elements?: NoteIdAndArgs[] | null);
1057
2319
  push(element: NoteIdAndArgs): void;
1058
2320
  length(): number;
1059
2321
  }
2322
+ /**
2323
+ * Contains the data required to prove inclusion of a note in the canonical chain.
2324
+ */
1060
2325
  export class NoteInclusionProof {
1061
2326
  private constructor();
1062
2327
  free(): void;
1063
2328
  [Symbol.dispose](): void;
2329
+ /**
2330
+ * Returns the location of the note within the tree.
2331
+ */
1064
2332
  location(): NoteLocation;
2333
+ /**
2334
+ * Returns the Merkle authentication path for the note.
2335
+ */
1065
2336
  notePath(): MerklePath;
1066
2337
  }
2338
+ /**
2339
+ * A container for note inputs.
2340
+ *
2341
+ * A note can be associated with up to 128 input values. Each value is represented by a single
2342
+ * field element. Thus, note input values can contain up to ~1 KB of data.
2343
+ *
2344
+ * All inputs associated with a note can be reduced to a single commitment which is computed by
2345
+ * first padding the inputs with ZEROs to the next multiple of 8, and then by computing a
2346
+ * sequential hash of the resulting elements.
2347
+ */
1067
2348
  export class NoteInputs {
1068
2349
  free(): void;
1069
2350
  [Symbol.dispose](): void;
2351
+ /**
2352
+ * Creates note inputs from a list of field elements.
2353
+ */
1070
2354
  constructor(felt_array: FeltArray);
2355
+ /**
2356
+ * Returns the raw inputs as an array of field elements.
2357
+ */
1071
2358
  values(): Felt[];
1072
2359
  }
2360
+ /**
2361
+ * Contains information about the location of a note.
2362
+ */
1073
2363
  export class NoteLocation {
1074
2364
  private constructor();
1075
2365
  free(): void;
1076
2366
  [Symbol.dispose](): void;
1077
- blockNum(): number;
2367
+ /**
2368
+ * Returns the index of the note leaf within the block's note tree.
2369
+ */
1078
2370
  nodeIndexInBlock(): number;
2371
+ /**
2372
+ * Returns the block height containing the note.
2373
+ */
2374
+ blockNum(): number;
1079
2375
  }
2376
+ /**
2377
+ * Metadata associated with a note.
2378
+ *
2379
+ * This metadata includes the sender, note type, tag, and an optional attachment.
2380
+ * Attachments provide additional context about how notes should be processed.
2381
+ */
1080
2382
  export class NoteMetadata {
1081
2383
  free(): void;
1082
2384
  [Symbol.dispose](): void;
1083
- constructor(sender: AccountId, note_type: NoteType, note_tag: NoteTag, note_execution_hint: NoteExecutionHint, aux?: Felt | null);
1084
- sender(): AccountId;
2385
+ /**
2386
+ * Adds an attachment to this metadata and returns the updated metadata.
2387
+ *
2388
+ * Attachments provide additional context about how notes should be processed.
2389
+ * For example, a `NetworkAccountTarget` attachment indicates that the note
2390
+ * should be consumed by a specific network account.
2391
+ */
2392
+ withAttachment(attachment: NoteAttachment): NoteMetadata;
2393
+ /**
2394
+ * Creates metadata for a note.
2395
+ */
2396
+ constructor(sender: AccountId, note_type: NoteType, note_tag: NoteTag);
2397
+ /**
2398
+ * Returns the tag associated with the note.
2399
+ */
1085
2400
  tag(): NoteTag;
2401
+ /**
2402
+ * Returns the account that created the note.
2403
+ */
2404
+ sender(): AccountId;
2405
+ /**
2406
+ * Returns whether the note is private, encrypted, or public.
2407
+ */
1086
2408
  noteType(): NoteType;
1087
2409
  }
2410
+ /**
2411
+ * Value that describes under which condition a note can be consumed.
2412
+ *
2413
+ * The recipient is not an account address, instead it is a value that describes when a note can be
2414
+ * consumed. Because not all notes have predetermined consumer addresses, e.g. swap notes can be
2415
+ * consumed by anyone, the recipient is defined as the code and its inputs, that when successfully
2416
+ * executed results in the note's consumption.
2417
+ *
2418
+ * Recipient is computed as a nested hash of the serial number, the script root, and the inputs
2419
+ * commitment, ensuring the recipient digest binds all three pieces of data together.
2420
+ */
1088
2421
  export class NoteRecipient {
1089
2422
  free(): void;
1090
2423
  [Symbol.dispose](): void;
2424
+ /**
2425
+ * Returns the serial number that prevents double spends.
2426
+ */
2427
+ serialNum(): Word;
2428
+ /**
2429
+ * Creates a note recipient from its serial number, script, and inputs.
2430
+ */
1091
2431
  constructor(serial_num: Word, note_script: NoteScript, inputs: NoteInputs);
2432
+ /**
2433
+ * Returns the digest of the recipient data (used in the note commitment).
2434
+ */
1092
2435
  digest(): Word;
1093
- serialNum(): Word;
1094
- script(): NoteScript;
2436
+ /**
2437
+ * Returns the inputs provided to the script.
2438
+ */
1095
2439
  inputs(): NoteInputs;
2440
+ /**
2441
+ * Returns the script that controls consumption.
2442
+ */
2443
+ script(): NoteScript;
1096
2444
  }
1097
2445
  export class NoteRecipientArray {
1098
2446
  /**
@@ -1105,58 +2453,151 @@ export class NoteRecipientArray {
1105
2453
  toString(): string;
1106
2454
  free(): void;
1107
2455
  [Symbol.dispose](): void;
1108
- constructor(elements?: NoteRecipient[] | null);
2456
+ replaceAt(index: number, elem: NoteRecipient): void;
1109
2457
  /**
1110
2458
  * Get element at index, will always return a clone to avoid aliasing issues.
1111
2459
  */
1112
2460
  get(index: number): NoteRecipient;
1113
- replaceAt(index: number, elem: NoteRecipient): void;
2461
+ constructor(elements?: NoteRecipient[] | null);
1114
2462
  push(element: NoteRecipient): void;
1115
2463
  length(): number;
1116
2464
  }
2465
+ /**
2466
+ * An executable program of a note.
2467
+ *
2468
+ * A note's script represents a program which must be executed for a note to be consumed. As such
2469
+ * it defines the rules and side effects of consuming a given note.
2470
+ */
1117
2471
  export class NoteScript {
1118
2472
  private constructor();
1119
2473
  free(): void;
1120
2474
  [Symbol.dispose](): void;
1121
2475
  /**
1122
- * Print the MAST source for this script.
2476
+ * Deserializes a script from bytes.
1123
2477
  */
1124
- toString(): string;
1125
- serialize(): Uint8Array;
1126
2478
  static deserialize(bytes: Uint8Array): NoteScript;
1127
- static p2id(): NoteScript;
1128
- static p2ide(): NoteScript;
1129
- static swap(): NoteScript;
1130
- root(): Word;
1131
2479
  /**
1132
2480
  * Creates a `NoteScript` from the given `Package`.
1133
2481
  * Throws if the package is invalid.
1134
2482
  */
1135
2483
  static fromPackage(_package: Package): NoteScript;
2484
+ /**
2485
+ * Returns the well-known P2ID script.
2486
+ */
2487
+ static p2id(): NoteScript;
2488
+ /**
2489
+ * Returns the MAST root of this script.
2490
+ */
2491
+ root(): Word;
2492
+ /**
2493
+ * Returns the well-known SWAP script.
2494
+ */
2495
+ static swap(): NoteScript;
2496
+ /**
2497
+ * Returns the well-known P2IDE script (P2ID with execution hint).
2498
+ */
2499
+ static p2ide(): NoteScript;
2500
+ /**
2501
+ * Serializes the script into bytes.
2502
+ */
2503
+ serialize(): Uint8Array;
2504
+ /**
2505
+ * Pretty-prints the MAST source for this script.
2506
+ */
2507
+ toString(): string;
1136
2508
  }
1137
- export class NoteTag {
2509
+ /**
2510
+ * Represents the response data from `syncNotes`.
2511
+ */
2512
+ export class NoteSyncInfo {
1138
2513
  private constructor();
1139
2514
  free(): void;
1140
2515
  [Symbol.dispose](): void;
1141
- static fromAccountId(account_id: AccountId): NoteTag;
1142
- static forPublicUseCase(use_case_id: number, payload: number, execution: NoteExecutionMode): NoteTag;
1143
- static forLocalUseCase(use_case_id: number, payload: number): NoteTag;
1144
- isSingleTarget(): boolean;
1145
- executionMode(): NoteExecutionMode;
2516
+ /**
2517
+ * Returns the block header associated with the matching notes.
2518
+ */
2519
+ blockHeader(): BlockHeader;
2520
+ /**
2521
+ * Returns the committed notes returned by the node.
2522
+ */
2523
+ notes(): CommittedNote[];
2524
+ /**
2525
+ * Returns the MMR path for the block header.
2526
+ */
2527
+ mmrPath(): MerklePath;
2528
+ /**
2529
+ * Returns the latest block number in the chain.
2530
+ */
2531
+ chainTip(): number;
2532
+ }
2533
+ /**
2534
+ * Note tags are 32-bits of data that serve as best-effort filters for notes.
2535
+ *
2536
+ * Tags enable quick lookups for notes related to particular use cases, scripts, or account
2537
+ * prefixes.
2538
+ */
2539
+ export class NoteTag {
2540
+ free(): void;
2541
+ [Symbol.dispose](): void;
2542
+ /**
2543
+ * Constructs a note tag that targets the given account ID.
2544
+ */
2545
+ static withAccountTarget(account_id: AccountId): NoteTag;
2546
+ /**
2547
+ * Constructs a note tag that targets the given account ID with a custom tag length.
2548
+ */
2549
+ static withCustomAccountTarget(account_id: AccountId, tag_len: number): NoteTag;
2550
+ /**
2551
+ * Creates a new `NoteTag` from an arbitrary u32.
2552
+ */
2553
+ constructor(tag: number);
2554
+ /**
2555
+ * Returns the inner u32 value of this tag.
2556
+ */
1146
2557
  asU32(): number;
1147
2558
  }
2559
+ /**
2560
+ * Representation of a note produced by a transaction (full, partial, or header-only).
2561
+ */
1148
2562
  export class OutputNote {
1149
2563
  private constructor();
1150
2564
  free(): void;
1151
2565
  [Symbol.dispose](): void;
2566
+ /**
2567
+ * Returns the recipient digest if the recipient is known.
2568
+ */
2569
+ recipientDigest(): Word | undefined;
2570
+ /**
2571
+ * Returns the note ID for this output.
2572
+ */
2573
+ id(): NoteId;
2574
+ /**
2575
+ * Wraps a full note output.
2576
+ */
1152
2577
  static full(note: Note): OutputNote;
1153
- static partial(partial_note: PartialNote): OutputNote;
2578
+ /**
2579
+ * Returns the assets if they are present.
2580
+ */
2581
+ assets(): NoteAssets | undefined;
2582
+ /**
2583
+ * Wraps only the header of a note.
2584
+ */
1154
2585
  static header(note_header: NoteHeader): OutputNote;
1155
- assets(): NoteAssets | undefined;
1156
- id(): NoteId;
1157
- recipientDigest(): Word | undefined;
1158
- metadata(): NoteMetadata;
2586
+ /**
2587
+ * Returns a more compact representation if possible (e.g. dropping details).
2588
+ */
1159
2589
  shrink(): OutputNote;
2590
+ /**
2591
+ * Wraps a partial note containing assets and recipient only.
2592
+ */
2593
+ static partial(partial_note: PartialNote): OutputNote;
2594
+ /**
2595
+ * Returns the metadata that accompanies this output.
2596
+ */
2597
+ metadata(): NoteMetadata;
2598
+ /**
2599
+ * Converts into a full note if the data is present.
2600
+ */
1160
2601
  intoFull(): Note | undefined;
1161
2602
  }
1162
2603
  export class OutputNoteArray {
@@ -1170,24 +2611,95 @@ export class OutputNoteArray {
1170
2611
  toString(): string;
1171
2612
  free(): void;
1172
2613
  [Symbol.dispose](): void;
1173
- constructor(elements?: OutputNote[] | null);
2614
+ replaceAt(index: number, elem: OutputNote): void;
1174
2615
  /**
1175
2616
  * Get element at index, will always return a clone to avoid aliasing issues.
1176
2617
  */
1177
2618
  get(index: number): OutputNote;
1178
- replaceAt(index: number, elem: OutputNote): void;
2619
+ constructor(elements?: OutputNote[] | null);
1179
2620
  push(element: OutputNote): void;
1180
2621
  length(): number;
1181
2622
  }
2623
+ /**
2624
+ * Represents an output note tracked by the client store.
2625
+ */
2626
+ export class OutputNoteRecord {
2627
+ private constructor();
2628
+ free(): void;
2629
+ [Symbol.dispose](): void;
2630
+ /**
2631
+ * Returns true if the note has been consumed on chain.
2632
+ */
2633
+ isConsumed(): boolean;
2634
+ /**
2635
+ * Returns true if the note is committed on chain.
2636
+ */
2637
+ isCommitted(): boolean;
2638
+ /**
2639
+ * Returns the expected block height for the note.
2640
+ */
2641
+ expectedHeight(): number;
2642
+ /**
2643
+ * Returns the inclusion proof when the note is committed.
2644
+ */
2645
+ inclusionProof(): NoteInclusionProof | undefined;
2646
+ /**
2647
+ * Returns the recipient digest committed for the note.
2648
+ */
2649
+ recipientDigest(): Word;
2650
+ /**
2651
+ * Returns the note ID.
2652
+ */
2653
+ id(): NoteId;
2654
+ /**
2655
+ * Returns the current processing state for this note.
2656
+ */
2657
+ state(): OutputNoteState;
2658
+ /**
2659
+ * Returns the note assets.
2660
+ */
2661
+ assets(): NoteAssets;
2662
+ /**
2663
+ * Returns the note metadata.
2664
+ */
2665
+ metadata(): NoteMetadata;
2666
+ /**
2667
+ * Returns the nullifier when the recipient is known.
2668
+ */
2669
+ nullifier(): string | undefined;
2670
+ /**
2671
+ * Returns the recipient details if available.
2672
+ */
2673
+ recipient(): NoteRecipient | undefined;
2674
+ }
2675
+ /**
2676
+ * Contains a list of output notes of a transaction. The list can be empty if the transaction does
2677
+ * not produce any notes.
2678
+ */
1182
2679
  export class OutputNotes {
1183
2680
  private constructor();
1184
2681
  free(): void;
1185
2682
  [Symbol.dispose](): void;
2683
+ /**
2684
+ * Returns the commitment to all output notes.
2685
+ */
1186
2686
  commitment(): Word;
1187
- numNotes(): number;
1188
- isEmpty(): boolean;
1189
- getNote(index: number): OutputNote;
2687
+ /**
2688
+ * Returns all output notes as a vector.
2689
+ */
1190
2690
  notes(): OutputNote[];
2691
+ /**
2692
+ * Returns the output note at the specified index.
2693
+ */
2694
+ getNote(index: number): OutputNote;
2695
+ /**
2696
+ * Returns true if there are no output notes.
2697
+ */
2698
+ isEmpty(): boolean;
2699
+ /**
2700
+ * Returns the number of notes emitted.
2701
+ */
2702
+ numNotes(): number;
1191
2703
  }
1192
2704
  export class OutputNotesArray {
1193
2705
  /**
@@ -1200,21 +2712,22 @@ export class OutputNotesArray {
1200
2712
  toString(): string;
1201
2713
  free(): void;
1202
2714
  [Symbol.dispose](): void;
1203
- constructor(elements?: OutputNotes[] | null);
2715
+ replaceAt(index: number, elem: OutputNotes): void;
1204
2716
  /**
1205
2717
  * Get element at index, will always return a clone to avoid aliasing issues.
1206
2718
  */
1207
2719
  get(index: number): OutputNotes;
1208
- replaceAt(index: number, elem: OutputNotes): void;
2720
+ constructor(elements?: OutputNotes[] | null);
1209
2721
  push(element: OutputNotes): void;
1210
2722
  length(): number;
1211
2723
  }
2724
+ /**
2725
+ * Compiled VM package containing libraries and metadata.
2726
+ */
1212
2727
  export class Package {
1213
2728
  private constructor();
1214
2729
  free(): void;
1215
2730
  [Symbol.dispose](): void;
1216
- serialize(): Uint8Array;
1217
- static deserialize(bytes: Uint8Array): Package;
1218
2731
  /**
1219
2732
  * Returns the underlying library of a `Package`.
1220
2733
  * Fails if the package is not a library.
@@ -1225,15 +2738,44 @@ export class Package {
1225
2738
  * Fails if the package is not a program.
1226
2739
  */
1227
2740
  asProgram(): Program;
2741
+ /**
2742
+ * Deserializes a package from bytes.
2743
+ */
2744
+ static deserialize(bytes: Uint8Array): Package;
2745
+ /**
2746
+ * Serializes the package into bytes.
2747
+ */
2748
+ serialize(): Uint8Array;
1228
2749
  }
2750
+ /**
2751
+ * Partial information about a note.
2752
+ *
2753
+ * Partial note consists of `NoteMetadata`, `NoteAssets`, and a recipient digest (see
2754
+ * `NoteRecipient`). However, it does not contain detailed recipient info, including
2755
+ * note script, note inputs, and note's serial number. This means that a partial note is sufficient
2756
+ * to compute note ID and note header, but not sufficient to compute note nullifier, and generally
2757
+ * does not have enough info to execute the note.
2758
+ */
1229
2759
  export class PartialNote {
1230
2760
  private constructor();
1231
2761
  free(): void;
1232
2762
  [Symbol.dispose](): void;
1233
- id(): NoteId;
1234
- metadata(): NoteMetadata;
2763
+ /**
2764
+ * Returns the digest of the recipient information.
2765
+ */
1235
2766
  recipientDigest(): Word;
2767
+ /**
2768
+ * Returns the identifier of the partial note.
2769
+ */
2770
+ id(): NoteId;
2771
+ /**
2772
+ * Returns the assets locked in the note.
2773
+ */
1236
2774
  assets(): NoteAssets;
2775
+ /**
2776
+ * Returns the metadata attached to the note.
2777
+ */
2778
+ metadata(): NoteMetadata;
1237
2779
  }
1238
2780
  export class ProcedureThreshold {
1239
2781
  free(): void;
@@ -1248,59 +2790,78 @@ export class Program {
1248
2790
  [Symbol.dispose](): void;
1249
2791
  }
1250
2792
  /**
1251
- * WASM wrapper around the native [`ProvenTransaction`].
2793
+ * Result of executing and proving a transaction. Contains all the data required to verify that a
2794
+ * transaction was executed correctly.
1252
2795
  */
1253
2796
  export class ProvenTransaction {
1254
2797
  private constructor();
1255
2798
  free(): void;
1256
2799
  [Symbol.dispose](): void;
1257
2800
  /**
1258
- * Serializes the proven transaction into bytes.
2801
+ * Returns the account ID the transaction was executed against.
1259
2802
  */
1260
- serialize(): Uint8Array;
2803
+ accountId(): AccountId;
1261
2804
  /**
1262
- * Deserializes a proven transaction from bytes.
2805
+ * Returns the nullifiers of the consumed input notes.
1263
2806
  */
1264
- static deserialize(bytes: Uint8Array): ProvenTransaction;
2807
+ nullifiers(): Word[];
1265
2808
  /**
1266
- * Returns the transaction ID.
2809
+ * Deserializes a proven transaction from bytes.
1267
2810
  */
1268
- id(): TransactionId;
2811
+ static deserialize(bytes: Uint8Array): ProvenTransaction;
1269
2812
  /**
1270
- * Returns the account ID the transaction was executed against.
2813
+ * Returns notes created by this transaction.
1271
2814
  */
1272
- accountId(): AccountId;
2815
+ outputNotes(): OutputNotes;
1273
2816
  /**
1274
2817
  * Returns the reference block number used during execution.
1275
2818
  */
1276
2819
  refBlockNumber(): number;
1277
2820
  /**
1278
- * Returns the block number at which the transaction expires.
2821
+ * Returns the commitment of the reference block.
1279
2822
  */
1280
- expirationBlockNumber(): number;
2823
+ refBlockCommitment(): Word;
1281
2824
  /**
1282
- * Returns notes created by this transaction.
2825
+ * Returns the block number at which the transaction expires.
1283
2826
  */
1284
- outputNotes(): OutputNotes;
2827
+ expirationBlockNumber(): number;
1285
2828
  /**
1286
- * Returns the commitment of the reference block.
2829
+ * Returns the transaction ID.
1287
2830
  */
1288
- refBlockCommitment(): Word;
2831
+ id(): TransactionId;
1289
2832
  /**
1290
- * Returns the nullifiers of the consumed input notes.
2833
+ * Serializes the proven transaction into bytes.
1291
2834
  */
1292
- nullifiers(): Word[];
2835
+ serialize(): Uint8Array;
1293
2836
  }
1294
2837
  export class PublicKey {
1295
2838
  private constructor();
1296
2839
  free(): void;
1297
2840
  [Symbol.dispose](): void;
1298
- serialize(): Uint8Array;
2841
+ /**
2842
+ * Deserializes a public key from bytes.
2843
+ */
1299
2844
  static deserialize(bytes: Uint8Array): PublicKey;
1300
- verify(message: Word, signature: Signature): boolean;
1301
- toCommitment(): Word;
1302
- static recoverFrom(message: Word, signature: Signature): PublicKey;
2845
+ /**
2846
+ * Verifies a signature over arbitrary signing inputs.
2847
+ */
1303
2848
  verifyData(signing_inputs: SigningInputs, signature: Signature): boolean;
2849
+ /**
2850
+ * Recovers a public key from a signature (only supported for `RpoFalcon512`).
2851
+ */
2852
+ static recoverFrom(message: Word, signature: Signature): PublicKey;
2853
+ /**
2854
+ * Returns the commitment corresponding to this public key.
2855
+ */
2856
+ toCommitment(): Word;
2857
+ /**
2858
+ * Verifies a blind message word against the signature.
2859
+ */
2860
+ verify(message: Word, signature: Signature): boolean;
2861
+ /**
2862
+ * Serializes the public key into bytes.
2863
+ */
2864
+ serialize(): Uint8Array;
1304
2865
  }
1305
2866
  /**
1306
2867
  * RPC Client for interacting with Miden nodes directly.
@@ -1309,100 +2870,56 @@ export class RpcClient {
1309
2870
  free(): void;
1310
2871
  [Symbol.dispose](): void;
1311
2872
  /**
1312
- * Creates a new RPC client instance.
1313
- *
1314
- * @param endpoint - Endpoint to connect to.
2873
+ * Fetches notes matching the provided tags from the node.
1315
2874
  */
1316
- constructor(endpoint: Endpoint);
2875
+ syncNotes(block_num: number, block_to: number | null | undefined, note_tags: NoteTag[]): Promise<NoteSyncInfo>;
1317
2876
  /**
1318
2877
  * Fetches notes by their IDs from the connected Miden node.
1319
2878
  *
1320
2879
  * @param note_ids - Array of [`NoteId`] objects to fetch
1321
- * @returns Promise that resolves to different data depending on the note type:
1322
- * - Private notes: Returns only `note_id` and `metadata`. The `input_note` field will be
1323
- * `null`.
1324
- * - Public notes: Returns the full `input_note` with inclusion proof, alongside metadata and
1325
- * ID.
2880
+ * @returns Promise that resolves to different data depending on the note type:
2881
+ * - Private notes: Returns the `noteHeader`, and the `inclusionProof`. The `note` field will
2882
+ * be `null`.
2883
+ * - Public notes: Returns the full `note` with `inclusionProof`, alongside its header.
1326
2884
  */
1327
2885
  getNotesById(note_ids: NoteId[]): Promise<FetchedNote[]>;
2886
+ /**
2887
+ * Fetches account details for a specific account ID.
2888
+ */
2889
+ getAccountDetails(account_id: AccountId): Promise<FetchedAccount>;
1328
2890
  /**
1329
2891
  * Fetches a note script by its root hash from the connected Miden node.
1330
2892
  *
1331
- * @param `script_root` The root hash of the note script to fetch
1332
- * @returns Promise that resolves to the `NoteScript`
2893
+ * @param script_root - The root hash of the note script to fetch.
2894
+ * @returns Promise that resolves to the `NoteScript`.
1333
2895
  */
1334
2896
  getNoteScriptByRoot(script_root: Word): Promise<NoteScript>;
1335
- }
1336
- export class Rpo256 {
1337
- private constructor();
1338
- free(): void;
1339
- [Symbol.dispose](): void;
1340
- static hashElements(felt_array: FeltArray): Word;
1341
- }
1342
- export class ScriptBuilder {
1343
- private constructor();
1344
- /**
1345
- ** Return copy of self without private attributes.
1346
- */
1347
- toJSON(): Object;
1348
- /**
1349
- * Return stringified version of self.
1350
- */
1351
- toString(): string;
1352
- free(): void;
1353
- [Symbol.dispose](): void;
1354
2897
  /**
1355
- * Given a module path (something like `my_lib::module`) and source code, this will
1356
- * statically link it for use with scripts to be built with this builder.
2898
+ * Fetches a block header by number. When `block_num` is undefined, returns the latest header.
1357
2899
  */
1358
- linkModule(module_path: string, module_code: string): void;
2900
+ getBlockHeaderByNumber(block_num?: number | null): Promise<BlockHeader>;
1359
2901
  /**
1360
- * Statically links the given library.
1361
- *
1362
- * Static linking means the library code is copied into the script code.
1363
- * Use this for most libraries that are not available on-chain.
1364
- *
1365
- * Receives as argument the library to link.
2902
+ * Fetches the block height at which a nullifier was committed, if any.
1366
2903
  */
1367
- linkStaticLibrary(library: Library): void;
2904
+ getNullifierCommitHeight(nullifier: Word, block_num: number): Promise<number | undefined>;
1368
2905
  /**
1369
- * This is useful to dynamically link the [`Library`] of a foreign account
1370
- * that is invoked using foreign procedure invocation (FPI). Its code is available
1371
- * on-chain and so it does not have to be copied into the script code.
2906
+ * Creates a new RPC client instance.
1372
2907
  *
1373
- * For all other use cases not involving FPI, link the library statically.
1374
- * Receives as argument the library to be linked.
1375
- */
1376
- linkDynamicLibrary(library: Library): void;
1377
- /**
1378
- * Given a Transaction Script's source code, compiles it with the available
1379
- * modules under this builder. Returns the compiled script.
1380
- */
1381
- compileTxScript(tx_script: string): TransactionScript;
1382
- /**
1383
- * Given a Note Script's source code, compiles it with the available
1384
- * modules under this builder. Returns the compiled script.
1385
- */
1386
- compileNoteScript(program: string): NoteScript;
1387
- /**
1388
- * Given a Library Path, and a source code, turn it into a Library.
1389
- * E.g. A path library can be `miden::my_contract`. When turned into a library,
1390
- * this can be used from another script with an import statement, following the
1391
- * previous example: `use.miden::my_contract'.
2908
+ * @param endpoint - Endpoint to connect to.
1392
2909
  */
1393
- buildLibrary(library_path: string, source_code: string): Library;
2910
+ constructor(endpoint: Endpoint);
1394
2911
  }
1395
- export class SecretKey {
2912
+ /**
2913
+ * RPO256 hashing helpers exposed to JavaScript.
2914
+ */
2915
+ export class Rpo256 {
1396
2916
  private constructor();
1397
2917
  free(): void;
1398
2918
  [Symbol.dispose](): void;
1399
- static rpoFalconWithRNG(seed?: Uint8Array | null): SecretKey;
1400
- static ecdsaWithRNG(seed?: Uint8Array | null): SecretKey;
1401
- publicKey(): PublicKey;
1402
- sign(message: Word): Signature;
1403
- signData(signing_inputs: SigningInputs): Signature;
1404
- serialize(): Uint8Array;
1405
- static deserialize(bytes: Uint8Array): SecretKey;
2919
+ /**
2920
+ * Computes an RPO256 digest from the provided field elements.
2921
+ */
2922
+ static hashElements(felt_array: FeltArray): Word;
1406
2923
  }
1407
2924
  export class SerializedInputNoteData {
1408
2925
  private constructor();
@@ -1443,54 +2960,168 @@ export class SerializedTransactionData {
1443
2960
  set scriptRoot(value: Uint8Array | null | undefined);
1444
2961
  get txScript(): Uint8Array | undefined;
1445
2962
  set txScript(value: Uint8Array | null | undefined);
1446
- blockNum: string;
2963
+ blockNum: number;
1447
2964
  statusVariant: number;
1448
2965
  status: Uint8Array;
1449
2966
  }
2967
+ /**
2968
+ * Cryptographic signature produced by supported auth schemes.
2969
+ */
1450
2970
  export class Signature {
1451
2971
  private constructor();
1452
2972
  free(): void;
1453
2973
  [Symbol.dispose](): void;
1454
- serialize(): Uint8Array;
2974
+ /**
2975
+ * Deserializes a signature from bytes.
2976
+ */
1455
2977
  static deserialize(bytes: Uint8Array): Signature;
2978
+ /**
2979
+ * Converts the signature to the prepared field elements expected by verifying code.
2980
+ */
1456
2981
  toPreparedSignature(message: Word): Felt[];
2982
+ /**
2983
+ * Serializes the signature into bytes.
2984
+ */
2985
+ serialize(): Uint8Array;
1457
2986
  }
1458
2987
  export class SigningInputs {
1459
2988
  private constructor();
1460
2989
  free(): void;
1461
2990
  [Symbol.dispose](): void;
1462
- static newTransactionSummary(summary: TransactionSummary): SigningInputs;
2991
+ /**
2992
+ * Deserializes signing inputs from bytes.
2993
+ */
2994
+ static deserialize(bytes: Uint8Array): SigningInputs;
2995
+ /**
2996
+ * Returns the inputs as field elements.
2997
+ */
2998
+ toElements(): FeltArray;
2999
+ /**
3000
+ * Returns the blind payload as a word.
3001
+ */
3002
+ blindPayload(): Word;
3003
+ /**
3004
+ * Creates signing inputs from arbitrary field elements.
3005
+ */
1463
3006
  static newArbitrary(felts: Felt[]): SigningInputs;
3007
+ /**
3008
+ * Returns the commitment to these signing inputs.
3009
+ */
3010
+ toCommitment(): Word;
3011
+ /**
3012
+ * Returns the arbitrary payload as an array of felts.
3013
+ */
3014
+ arbitraryPayload(): FeltArray;
3015
+ /**
3016
+ * Creates signing inputs from a transaction summary.
3017
+ */
3018
+ static newTransactionSummary(summary: TransactionSummary): SigningInputs;
3019
+ /**
3020
+ * Returns the transaction summary payload if this variant contains one.
3021
+ */
3022
+ transactionSummaryPayload(): TransactionSummary;
3023
+ /**
3024
+ * Creates blind signing inputs from a single word.
3025
+ */
1464
3026
  static newBlind(word: Word): SigningInputs;
1465
- transactionSummaryPayload(): TransactionSummary;
1466
- arbitraryPayload(): FeltArray;
1467
- blindPayload(): Word;
1468
- toCommitment(): Word;
1469
- toElements(): FeltArray;
3027
+ /**
3028
+ * Serializes the signing inputs into bytes.
3029
+ */
1470
3030
  serialize(): Uint8Array;
1471
- static deserialize(bytes: Uint8Array): SigningInputs;
3031
+ /**
3032
+ * Returns which variant these signing inputs represent.
3033
+ */
1472
3034
  readonly variantType: SigningInputsType;
1473
3035
  }
3036
+ /**
3037
+ * Storage slot index paired with map keys that must be present.
3038
+ */
1474
3039
  export class SlotAndKeys {
1475
3040
  free(): void;
1476
3041
  [Symbol.dispose](): void;
1477
- constructor(storage_slot_index: number, storage_map_keys: Word[]);
1478
- storage_slot_index(): number;
3042
+ /**
3043
+ * Returns the storage map keys required for this slot.
3044
+ */
1479
3045
  storage_map_keys(): Word[];
3046
+ /**
3047
+ * Returns the slot name.
3048
+ */
3049
+ storage_slot_name(): string;
3050
+ /**
3051
+ * Creates a new slot-and-keys entry.
3052
+ */
3053
+ constructor(storage_slot_name: string, storage_map_keys: Word[]);
3054
+ }
3055
+ /**
3056
+ * Represents a sparse Merkle path.
3057
+ */
3058
+ export class SparseMerklePath {
3059
+ private constructor();
3060
+ free(): void;
3061
+ [Symbol.dispose](): void;
3062
+ /**
3063
+ * Returns the empty nodes mask used by this path.
3064
+ */
3065
+ emptyNodesMask(): bigint;
3066
+ /**
3067
+ * Returns the sibling nodes that make up the path.
3068
+ */
3069
+ nodes(): Word[];
3070
+ /**
3071
+ * Verifies the path against a root.
3072
+ */
3073
+ verify(index: bigint, node: Word, root: Word): boolean;
1480
3074
  }
3075
+ /**
3076
+ * An account storage map is a sparse merkle tree of depth 64.
3077
+ *
3078
+ * It can be used to store a large amount of data in an account than would be otherwise possible
3079
+ * using just the account's storage slots. This works by storing the root of the map's underlying
3080
+ * SMT in one account storage slot. Each map entry is a leaf in the tree and its inclusion is
3081
+ * proven while retrieving it (e.g. via `AccountStorage::get_map_item`).
3082
+ *
3083
+ * As a side-effect, this also means that _not all_ entries of the map have to be present at
3084
+ * transaction execution time in order to access or modify the map. It is sufficient if _just_ the
3085
+ * accessed/modified items are present in the advice provider.
3086
+ *
3087
+ * Because the keys of the map are user-chosen and thus not necessarily uniformly distributed, the
3088
+ * tree could be imbalanced and made less efficient. To mitigate that, the keys used in the storage
3089
+ * map are hashed before they are inserted into the SMT, which creates a uniform distribution. The
3090
+ * original keys are retained in a separate map. This causes redundancy but allows for
3091
+ * introspection of the map, e.g. by querying the set of stored (original) keys which is useful in
3092
+ * debugging and explorer scenarios.
3093
+ */
1481
3094
  export class StorageMap {
1482
3095
  free(): void;
1483
3096
  [Symbol.dispose](): void;
3097
+ /**
3098
+ * Creates an empty storage map.
3099
+ */
1484
3100
  constructor();
3101
+ /**
3102
+ * Inserts a key/value pair, returning any previous value.
3103
+ */
1485
3104
  insert(key: Word, value: Word): Word;
1486
3105
  }
3106
+ /**
3107
+ * A single storage slot value or map for an account component.
3108
+ */
1487
3109
  export class StorageSlot {
1488
3110
  private constructor();
1489
3111
  free(): void;
1490
3112
  [Symbol.dispose](): void;
1491
- static fromValue(value: Word): StorageSlot;
1492
- static emptyValue(): StorageSlot;
1493
- static map(storage_map: StorageMap): StorageSlot;
3113
+ /**
3114
+ * Creates a storage slot holding a single value.
3115
+ */
3116
+ static fromValue(name: string, value: Word): StorageSlot;
3117
+ /**
3118
+ * Returns an empty value slot (zeroed).
3119
+ */
3120
+ static emptyValue(name: string): StorageSlot;
3121
+ /**
3122
+ * Creates a storage slot backed by a map.
3123
+ */
3124
+ static map(name: string, storage_map: StorageMap): StorageSlot;
1494
3125
  }
1495
3126
  export class StorageSlotArray {
1496
3127
  /**
@@ -1503,26 +3134,50 @@ export class StorageSlotArray {
1503
3134
  toString(): string;
1504
3135
  free(): void;
1505
3136
  [Symbol.dispose](): void;
1506
- constructor(elements?: StorageSlot[] | null);
3137
+ replaceAt(index: number, elem: StorageSlot): void;
1507
3138
  /**
1508
3139
  * Get element at index, will always return a clone to avoid aliasing issues.
1509
3140
  */
1510
3141
  get(index: number): StorageSlot;
1511
- replaceAt(index: number, elem: StorageSlot): void;
3142
+ constructor(elements?: StorageSlot[] | null);
1512
3143
  push(element: StorageSlot): void;
1513
3144
  length(): number;
1514
3145
  }
3146
+ /**
3147
+ * Contains stats about the sync operation.
3148
+ */
1515
3149
  export class SyncSummary {
1516
3150
  private constructor();
1517
3151
  free(): void;
1518
3152
  [Symbol.dispose](): void;
1519
- blockNum(): number;
1520
- committedNotes(): NoteId[];
3153
+ /**
3154
+ * Deserializes a sync summary from bytes.
3155
+ */
3156
+ static deserialize(bytes: Uint8Array): SyncSummary;
3157
+ /**
3158
+ * Returns IDs of notes that were consumed.
3159
+ */
1521
3160
  consumedNotes(): NoteId[];
3161
+ /**
3162
+ * Returns IDs of notes committed in this sync window.
3163
+ */
3164
+ committedNotes(): NoteId[];
3165
+ /**
3166
+ * Returns accounts that were updated.
3167
+ */
1522
3168
  updatedAccounts(): AccountId[];
3169
+ /**
3170
+ * Returns transactions that were committed.
3171
+ */
1523
3172
  committedTransactions(): TransactionId[];
3173
+ /**
3174
+ * Returns the block height the summary is based on.
3175
+ */
3176
+ blockNum(): number;
3177
+ /**
3178
+ * Serializes the sync summary into bytes.
3179
+ */
1524
3180
  serialize(): Uint8Array;
1525
- static deserialize(bytes: Uint8Array): SyncSummary;
1526
3181
  }
1527
3182
  export class TestUtils {
1528
3183
  private constructor();
@@ -1532,133 +3187,363 @@ export class TestUtils {
1532
3187
  static createMockSerializedLibraryPackage(): Uint8Array;
1533
3188
  static createMockSerializedProgramPackage(): Uint8Array;
1534
3189
  }
3190
+ /**
3191
+ * Represents a string token symbol (e.g. "POL", "ETH") as a single {@link Felt | `Felt`} value.
3192
+ *
3193
+ * Token Symbols can consists of up to 6 capital Latin characters, e.g. "C", "ETH", "MIDENC".
3194
+ */
1535
3195
  export class TokenSymbol {
1536
3196
  free(): void;
1537
3197
  [Symbol.dispose](): void;
3198
+ /**
3199
+ * Creates a token symbol from a string.
3200
+ */
1538
3201
  constructor(symbol: string);
3202
+ /**
3203
+ * Returns the validated symbol string.
3204
+ */
1539
3205
  toString(): string;
1540
3206
  }
3207
+ /**
3208
+ * Optional transaction arguments.
3209
+ *
3210
+ * - Transaction script: a program that is executed in a transaction after all input notes scripts
3211
+ * have been executed.
3212
+ * - Note arguments: data put onto the stack right before a note script is executed. These are
3213
+ * different from note inputs, as the user executing the transaction can specify arbitrary note
3214
+ * args.
3215
+ * - Advice inputs: Provides data needed by the runtime, like the details of public output notes.
3216
+ * - Account inputs: Provides account data that will be accessed in the transaction.
3217
+ */
1541
3218
  export class TransactionArgs {
1542
3219
  private constructor();
1543
3220
  free(): void;
1544
3221
  [Symbol.dispose](): void;
1545
- txScript(): TransactionScript | undefined;
1546
- getNoteArgs(note_id: NoteId): Word | undefined;
3222
+ /**
3223
+ * Returns advice inputs attached to the transaction.
3224
+ */
1547
3225
  adviceInputs(): AdviceInputs;
3226
+ /**
3227
+ * Returns note-specific arguments for the given note ID.
3228
+ */
3229
+ getNoteArgs(note_id: NoteId): Word | undefined;
3230
+ /**
3231
+ * Returns the transaction script if provided.
3232
+ */
3233
+ txScript(): TransactionScript | undefined;
1548
3234
  }
3235
+ /**
3236
+ * Filter used when querying stored transactions.
3237
+ */
1549
3238
  export class TransactionFilter {
1550
3239
  private constructor();
1551
3240
  free(): void;
1552
3241
  [Symbol.dispose](): void;
1553
- static all(): TransactionFilter;
1554
- static ids(ids: TransactionId[]): TransactionFilter;
3242
+ /**
3243
+ * Matches transactions that are not yet committed.
3244
+ */
1555
3245
  static uncommitted(): TransactionFilter;
3246
+ /**
3247
+ * Matches transactions that expired before the given block number.
3248
+ */
1556
3249
  static expiredBefore(block_num: number): TransactionFilter;
3250
+ /**
3251
+ * Matches all transactions.
3252
+ */
3253
+ static all(): TransactionFilter;
3254
+ /**
3255
+ * Matches specific transaction IDs.
3256
+ */
3257
+ static ids(ids: TransactionId[]): TransactionFilter;
1557
3258
  }
3259
+ /**
3260
+ * A unique identifier of a transaction.
3261
+ *
3262
+ * Transaction ID is computed as a hash of the initial and final account commitments together with
3263
+ * the commitments of the input and output notes.
3264
+ *
3265
+ * This achieves the following properties:
3266
+ * - Transactions are identical if and only if they have the same ID.
3267
+ * - Computing transaction ID can be done solely from public transaction data.
3268
+ */
1558
3269
  export class TransactionId {
1559
3270
  private constructor();
1560
3271
  free(): void;
1561
3272
  [Symbol.dispose](): void;
3273
+ /**
3274
+ * Returns the transaction ID as field elements.
3275
+ */
1562
3276
  asElements(): Felt[];
1563
- asBytes(): Uint8Array;
1564
- toHex(): string;
3277
+ /**
3278
+ * Returns the underlying word representation.
3279
+ */
1565
3280
  inner(): Word;
3281
+ /**
3282
+ * Returns the hexadecimal encoding of the transaction ID.
3283
+ */
3284
+ toHex(): string;
3285
+ /**
3286
+ * Returns the transaction ID as raw bytes.
3287
+ */
3288
+ asBytes(): Uint8Array;
1566
3289
  }
3290
+ /**
3291
+ * Wrapper over local or remote transaction proving backends.
3292
+ */
1567
3293
  export class TransactionProver {
1568
3294
  private constructor();
1569
3295
  free(): void;
1570
3296
  [Symbol.dispose](): void;
3297
+ /**
3298
+ * Reconstructs a prover from its serialized descriptor.
3299
+ *
3300
+ * Parses the format produced by `serialize()`:
3301
+ * - `"local"` for local prover
3302
+ * - `"remote|{endpoint}"` for remote prover without timeout
3303
+ * - `"remote|{endpoint}|{timeout_ms}"` for remote prover with timeout
3304
+ */
3305
+ static deserialize(payload: string): TransactionProver;
3306
+ /**
3307
+ * Creates a prover that uses the local proving backend.
3308
+ */
1571
3309
  static newLocalProver(): TransactionProver;
1572
- static newRemoteProver(endpoint: string): TransactionProver;
1573
- serialize(): string;
1574
- static deserialize(prover_type: string, endpoint?: string | null): TransactionProver;
3310
+ /**
3311
+ * Creates a new remote transaction prover.
3312
+ *
3313
+ * Arguments:
3314
+ * - `endpoint`: The URL of the remote prover.
3315
+ * - `timeout_ms`: The timeout in milliseconds for the remote prover.
3316
+ */
3317
+ static newRemoteProver(endpoint: string, timeout_ms?: bigint | null): TransactionProver;
3318
+ /**
3319
+ * Returns the endpoint if this is a remote prover.
3320
+ */
1575
3321
  endpoint(): string | undefined;
3322
+ /**
3323
+ * Serializes the prover configuration into a string descriptor.
3324
+ *
3325
+ * Format:
3326
+ * - `"local"` for local prover
3327
+ * - `"remote|{endpoint}"` for remote prover without timeout
3328
+ * - `"remote|{endpoint}|{timeout_ms}"` for remote prover with timeout
3329
+ *
3330
+ * Uses `|` as delimiter since it's not a valid URL character.
3331
+ */
3332
+ serialize(): string;
1576
3333
  }
3334
+ /**
3335
+ * Describes a transaction that has been executed and is being tracked on the Client.
3336
+ */
1577
3337
  export class TransactionRecord {
1578
3338
  private constructor();
1579
3339
  free(): void;
1580
3340
  [Symbol.dispose](): void;
1581
- id(): TransactionId;
3341
+ /**
3342
+ * Returns the account this transaction was executed against.
3343
+ */
1582
3344
  accountId(): AccountId;
3345
+ /**
3346
+ * Returns the output notes created by this transaction.
3347
+ */
3348
+ outputNotes(): OutputNotes;
3349
+ /**
3350
+ * Returns the block height at which the transaction was submitted.
3351
+ */
3352
+ submissionHeight(): number;
3353
+ /**
3354
+ * Returns the timestamp when the record was created.
3355
+ */
3356
+ creationTimestamp(): bigint;
3357
+ /**
3358
+ * Returns the initial account state commitment before execution.
3359
+ */
1583
3360
  initAccountState(): Word;
3361
+ /**
3362
+ * Returns the current status of the transaction.
3363
+ */
3364
+ transactionStatus(): TransactionStatus;
3365
+ /**
3366
+ * Returns the final account state commitment after execution.
3367
+ */
1584
3368
  finalAccountState(): Word;
3369
+ /**
3370
+ * Returns the expiration block height for the transaction.
3371
+ */
3372
+ expirationBlockNum(): number;
3373
+ /**
3374
+ * Returns the nullifiers of the consumed input notes.
3375
+ */
1585
3376
  inputNoteNullifiers(): Word[];
1586
- outputNotes(): OutputNotes;
3377
+ /**
3378
+ * Returns the transaction ID.
3379
+ */
3380
+ id(): TransactionId;
3381
+ /**
3382
+ * Returns the block height in which the transaction was included.
3383
+ */
1587
3384
  blockNum(): number;
1588
- transactionStatus(): TransactionStatus;
1589
- creationTimestamp(): bigint;
1590
3385
  }
3386
+ /**
3387
+ * Specifies a transaction request that can be executed by an account.
3388
+ *
3389
+ * A request contains information about input notes to be consumed by the transaction (if any),
3390
+ * description of the transaction script to be executed (if any), and a set of notes expected to be
3391
+ * generated by the transaction or by consuming notes generated by the transaction.
3392
+ */
1591
3393
  export class TransactionRequest {
1592
3394
  private constructor();
1593
3395
  free(): void;
1594
3396
  [Symbol.dispose](): void;
1595
- serialize(): Uint8Array;
3397
+ /**
3398
+ * Returns the transaction script argument if present.
3399
+ */
3400
+ scriptArg(): Word | undefined;
3401
+ /**
3402
+ * Deserializes a transaction request from bytes.
3403
+ */
1596
3404
  static deserialize(bytes: Uint8Array): TransactionRequest;
1597
- expectedOutputOwnNotes(): Note[];
3405
+ /**
3406
+ * Returns notes expected to be created in subsequent executions.
3407
+ */
1598
3408
  expectedFutureNotes(): NoteDetailsAndTag[];
1599
- scriptArg(): Word | undefined;
3409
+ /**
3410
+ * Returns output notes created by the sender account.
3411
+ */
3412
+ expectedOutputOwnNotes(): Note[];
3413
+ /**
3414
+ * Returns the authentication argument if present.
3415
+ */
1600
3416
  authArg(): Word | undefined;
3417
+ /**
3418
+ * Serializes the transaction request into bytes.
3419
+ */
3420
+ serialize(): Uint8Array;
1601
3421
  }
3422
+ /**
3423
+ * A builder for a `TransactionRequest`.
3424
+ *
3425
+ * Use this builder to construct a `TransactionRequest` by adding input notes, specifying
3426
+ * scripts, and setting other transaction parameters.
3427
+ */
1602
3428
  export class TransactionRequestBuilder {
1603
3429
  free(): void;
1604
3430
  [Symbol.dispose](): void;
1605
- constructor();
1606
- withUnauthenticatedInputNotes(notes: NoteAndArgsArray): TransactionRequestBuilder;
1607
- withAuthenticatedInputNotes(notes: NoteIdAndArgsArray): TransactionRequestBuilder;
1608
- withOwnOutputNotes(notes: OutputNoteArray): TransactionRequestBuilder;
1609
- withCustomScript(script: TransactionScript): TransactionRequestBuilder;
1610
- withExpectedOutputRecipients(recipients: NoteRecipientArray): TransactionRequestBuilder;
1611
- withExpectedFutureNotes(note_details_and_tag: NoteDetailsAndTagArray): TransactionRequestBuilder;
3431
+ /**
3432
+ * Adds an authentication argument.
3433
+ */
3434
+ withAuthArg(auth_arg: Word): TransactionRequestBuilder;
3435
+ /**
3436
+ * Adds a transaction script argument.
3437
+ */
3438
+ withScriptArg(script_arg: Word): TransactionRequestBuilder;
3439
+ /**
3440
+ * Adds input notes with optional arguments.
3441
+ */
3442
+ withInputNotes(notes: NoteAndArgsArray): TransactionRequestBuilder;
3443
+ /**
3444
+ * Merges an advice map to be available during script execution.
3445
+ */
1612
3446
  extendAdviceMap(advice_map: AdviceMap): TransactionRequestBuilder;
3447
+ /**
3448
+ * Attaches a custom transaction script.
3449
+ */
3450
+ withCustomScript(script: TransactionScript): TransactionRequestBuilder;
3451
+ /**
3452
+ * Registers foreign accounts referenced by the transaction.
3453
+ */
1613
3454
  withForeignAccounts(foreign_accounts: ForeignAccountArray): TransactionRequestBuilder;
1614
- withScriptArg(script_arg: Word): TransactionRequestBuilder;
1615
- withAuthArg(auth_arg: Word): TransactionRequestBuilder;
3455
+ /**
3456
+ * Adds notes created by the sender that should be emitted by the transaction.
3457
+ */
3458
+ withOwnOutputNotes(notes: OutputNoteArray): TransactionRequestBuilder;
3459
+ /**
3460
+ * Declares notes expected to be created in follow-up executions.
3461
+ */
3462
+ withExpectedFutureNotes(note_details_and_tag: NoteDetailsAndTagArray): TransactionRequestBuilder;
3463
+ /**
3464
+ * Declares expected output recipients (used for verification).
3465
+ */
3466
+ withExpectedOutputRecipients(recipients: NoteRecipientArray): TransactionRequestBuilder;
3467
+ /**
3468
+ * Creates a new empty transaction request builder.
3469
+ */
3470
+ constructor();
3471
+ /**
3472
+ * Finalizes the builder into a `TransactionRequest`.
3473
+ */
1616
3474
  build(): TransactionRequest;
1617
3475
  }
1618
3476
  /**
1619
- * WASM wrapper around the native [`TransactionResult`].
3477
+ * Represents the result of executing a transaction by the client.
3478
+ *
3479
+ * It contains an `ExecutedTransaction`, and a list of `future_notes`
3480
+ * that we expect to receive in the future (you can check at swap notes for an example of this).
1620
3481
  */
1621
3482
  export class TransactionResult {
1622
3483
  private constructor();
1623
3484
  free(): void;
1624
3485
  [Symbol.dispose](): void;
1625
3486
  /**
1626
- * Returns the ID of the transaction.
3487
+ * Deserializes a transaction result from bytes.
1627
3488
  */
1628
- id(): TransactionId;
3489
+ static deserialize(bytes: Uint8Array): TransactionResult;
3490
+ /**
3491
+ * Returns notes that are expected to be created as a result of follow-up executions.
3492
+ */
3493
+ futureNotes(): NoteDetailsAndTag[];
1629
3494
  /**
1630
3495
  * Returns the executed transaction.
1631
3496
  */
1632
3497
  executedTransaction(): ExecutedTransaction;
1633
3498
  /**
1634
- * Returns notes that are expected to be created as a result of follow-up executions.
3499
+ * Returns the ID of the transaction.
1635
3500
  */
1636
- futureNotes(): NoteDetailsAndTag[];
3501
+ id(): TransactionId;
1637
3502
  /**
1638
3503
  * Serializes the transaction result into bytes.
1639
3504
  */
1640
3505
  serialize(): Uint8Array;
1641
- /**
1642
- * Deserializes a transaction result from bytes.
1643
- */
1644
- static deserialize(bytes: Uint8Array): TransactionResult;
1645
3506
  }
3507
+ /**
3508
+ * A transaction script is a program that is executed in a transaction after all input notes have
3509
+ * been executed.
3510
+ *
3511
+ * The `TransactionScript` object is composed of:
3512
+ * - An executable program defined by a MAST forest and an associated entrypoint.
3513
+ * - A set of transaction script inputs defined by a map of key-value inputs that are loaded into
3514
+ * the advice inputs' map such that the transaction script can access them.
3515
+ */
1646
3516
  export class TransactionScript {
1647
3517
  private constructor();
1648
3518
  free(): void;
1649
3519
  [Symbol.dispose](): void;
1650
- root(): Word;
1651
3520
  /**
1652
3521
  * Creates a `NoteScript` from the given `Package`.
1653
3522
  * Throws if the package is invalid.
1654
3523
  */
1655
3524
  static fromPackage(_package: Package): TransactionScript;
3525
+ /**
3526
+ * Returns the MAST root commitment of the transaction script.
3527
+ */
3528
+ root(): Word;
1656
3529
  }
3530
+ /**
3531
+ * A script argument represented as a word plus additional felts.
3532
+ */
1657
3533
  export class TransactionScriptInputPair {
1658
3534
  free(): void;
1659
3535
  [Symbol.dispose](): void;
3536
+ /**
3537
+ * Creates a new script input pair.
3538
+ */
1660
3539
  constructor(word: Word, felts: FeltArray);
3540
+ /**
3541
+ * Returns the word part of the input.
3542
+ */
1661
3543
  word(): Word;
3544
+ /**
3545
+ * Returns the remaining felts for the input.
3546
+ */
1662
3547
  felts(): FeltArray;
1663
3548
  }
1664
3549
  export class TransactionScriptInputPairArray {
@@ -1672,104 +3557,172 @@ export class TransactionScriptInputPairArray {
1672
3557
  toString(): string;
1673
3558
  free(): void;
1674
3559
  [Symbol.dispose](): void;
1675
- constructor(elements?: TransactionScriptInputPair[] | null);
3560
+ replaceAt(index: number, elem: TransactionScriptInputPair): void;
1676
3561
  /**
1677
3562
  * Get element at index, will always return a clone to avoid aliasing issues.
1678
3563
  */
1679
3564
  get(index: number): TransactionScriptInputPair;
1680
- replaceAt(index: number, elem: TransactionScriptInputPair): void;
3565
+ constructor(elements?: TransactionScriptInputPair[] | null);
1681
3566
  push(element: TransactionScriptInputPair): void;
1682
3567
  length(): number;
1683
3568
  }
3569
+ /**
3570
+ * Status of a transaction in the node or store.
3571
+ */
1684
3572
  export class TransactionStatus {
1685
3573
  private constructor();
1686
3574
  free(): void;
1687
3575
  [Symbol.dispose](): void;
1688
- static pending(): TransactionStatus;
1689
- static committed(block_num: number, commit_timestamp: bigint): TransactionStatus;
1690
- static discarded(cause: string): TransactionStatus;
3576
+ /**
3577
+ * Returns true if the transaction is still pending.
3578
+ */
1691
3579
  isPending(): boolean;
3580
+ /**
3581
+ * Returns true if the transaction has been committed.
3582
+ */
1692
3583
  isCommitted(): boolean;
3584
+ /**
3585
+ * Returns true if the transaction was discarded.
3586
+ */
1693
3587
  isDiscarded(): boolean;
3588
+ /**
3589
+ * Returns the block number if the transaction was committed.
3590
+ */
1694
3591
  getBlockNum(): number | undefined;
3592
+ /**
3593
+ * Returns the commit timestamp if the transaction was committed.
3594
+ */
1695
3595
  getCommitTimestamp(): bigint | undefined;
3596
+ /**
3597
+ * Creates a pending transaction status.
3598
+ */
3599
+ static pending(): TransactionStatus;
3600
+ /**
3601
+ * Creates a committed status with block number and timestamp.
3602
+ */
3603
+ static committed(block_num: number, commit_timestamp: bigint): TransactionStatus;
3604
+ /**
3605
+ * Creates a discarded status from a discard cause string.
3606
+ */
3607
+ static discarded(cause: string): TransactionStatus;
1696
3608
  }
3609
+ /**
3610
+ * Represents the changes that need to be applied to the client store as a result of a transaction
3611
+ * execution.
3612
+ */
1697
3613
  export class TransactionStoreUpdate {
1698
3614
  private constructor();
1699
3615
  free(): void;
1700
3616
  [Symbol.dispose](): void;
1701
- executedTransaction(): ExecutedTransaction;
1702
- submissionHeight(): number;
1703
- createdNotes(): OutputNotes;
1704
- accountDelta(): AccountDelta;
3617
+ /**
3618
+ * Deserializes an update from bytes.
3619
+ */
3620
+ static deserialize(bytes: Uint8Array): TransactionStoreUpdate;
3621
+ /**
3622
+ * Returns notes expected to be created in follow-up executions.
3623
+ */
1705
3624
  futureNotes(): NoteDetailsAndTag[];
3625
+ /**
3626
+ * Returns the account delta applied by the transaction.
3627
+ */
3628
+ accountDelta(): AccountDelta;
3629
+ /**
3630
+ * Returns the notes created by the transaction.
3631
+ */
3632
+ createdNotes(): OutputNotes;
3633
+ /**
3634
+ * Returns the block height at which the transaction was submitted.
3635
+ */
3636
+ submissionHeight(): number;
3637
+ /**
3638
+ * Returns the executed transaction associated with this update.
3639
+ */
3640
+ executedTransaction(): ExecutedTransaction;
3641
+ /**
3642
+ * Serializes the update into bytes.
3643
+ */
1706
3644
  serialize(): Uint8Array;
1707
- static deserialize(bytes: Uint8Array): TransactionStoreUpdate;
1708
3645
  }
3646
+ /**
3647
+ * Represents a transaction summary.
3648
+ */
1709
3649
  export class TransactionSummary {
1710
3650
  private constructor();
1711
3651
  free(): void;
1712
3652
  [Symbol.dispose](): void;
1713
- serialize(): Uint8Array;
3653
+ /**
3654
+ * Deserializes a summary from bytes.
3655
+ */
1714
3656
  static deserialize(bytes: Uint8Array): TransactionSummary;
1715
- accountDelta(): AccountDelta;
3657
+ /**
3658
+ * Returns the input notes referenced by the summary.
3659
+ */
1716
3660
  inputNotes(): InputNotes;
3661
+ /**
3662
+ * Returns the output notes referenced by the summary.
3663
+ */
1717
3664
  outputNotes(): OutputNotes;
1718
- salt(): Word;
3665
+ /**
3666
+ * Returns the account delta described by the summary.
3667
+ */
3668
+ accountDelta(): AccountDelta;
1719
3669
  /**
1720
3670
  * Computes the commitment to this `TransactionSummary`.
1721
3671
  */
1722
3672
  toCommitment(): Word;
3673
+ /**
3674
+ * Returns the random salt mixed into the summary commitment.
3675
+ */
3676
+ salt(): Word;
3677
+ /**
3678
+ * Serializes the summary into bytes.
3679
+ */
3680
+ serialize(): Uint8Array;
1723
3681
  }
1724
3682
  export class WebClient {
1725
3683
  free(): void;
1726
3684
  [Symbol.dispose](): void;
1727
- getAccounts(): Promise<AccountHeader[]>;
1728
- getAccount(account_id: AccountId): Promise<Account | undefined>;
1729
- getAccountAuthByPubKey(pub_key: Word): Promise<AuthSecretKey>;
1730
- insertAccountAddress(account_id: AccountId, address: Address): Promise<void>;
1731
- removeAccountAddress(account_id: AccountId, address: Address): Promise<void>;
1732
- exportNoteFile(note_id: string, export_type: string): Promise<NoteFile>;
3685
+ newFaucet(storage_mode: AccountStorageMode, non_fungible: boolean, token_symbol: string, decimals: number, max_supply: bigint, auth_scheme: AuthScheme): Promise<Account>;
3686
+ newWallet(storage_mode: AccountStorageMode, mutable: boolean, auth_scheme: AuthScheme, init_seed?: Uint8Array | null): Promise<Account>;
3687
+ newAccount(account: Account, overwrite: boolean): Promise<void>;
3688
+ addAccountSecretKeyToWebStore(account_id: AccountId, secret_key: AuthSecretKey): Promise<void>;
3689
+ getTransactions(transaction_filter: TransactionFilter): Promise<TransactionRecord[]>;
1733
3690
  /**
1734
- * Retrieves the entire underlying web store and returns it as a `JsValue`
1735
- *
1736
- * Meant to be used in conjunction with the `force_import_store` method
3691
+ * Send a private note via the note transport layer
1737
3692
  */
1738
- exportStore(): Promise<any>;
1739
- exportAccountFile(account_id: AccountId): Promise<AccountFile>;
1740
- importAccountFile(account_file: AccountFile): Promise<any>;
1741
- importPublicAccountFromSeed(init_seed: Uint8Array, mutable: boolean, auth_scheme_id: number): Promise<Account>;
1742
- importAccountById(account_id: AccountId): Promise<any>;
1743
- importNoteFile(note_file: NoteFile): Promise<NoteId>;
1744
- forceImportStore(store_dump: any): Promise<any>;
3693
+ sendPrivateNote(note: Note, address: Address): Promise<void>;
1745
3694
  /**
1746
- * Creates a new client with a mock RPC API. Useful for testing purposes and proof-of-concept
1747
- * applications as it uses a mock chain that simulates the behavior of a real node.
3695
+ * Fetch private notes from the note transport layer
3696
+ *
3697
+ * Uses an internal pagination mechanism to avoid fetching duplicate notes.
1748
3698
  */
1749
- createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<any>;
3699
+ fetchPrivateNotes(): Promise<void>;
1750
3700
  /**
1751
- * Returns the inner serialized mock chain if it exists.
3701
+ * Fetch all private notes from the note transport layer
3702
+ *
3703
+ * Fetches all notes stored in the transport layer, with no pagination.
3704
+ * Prefer using [`WebClient::fetch_private_notes`] for a more efficient, on-going,
3705
+ * fetching mechanism.
1752
3706
  */
1753
- serializeMockChain(): Uint8Array;
3707
+ fetchAllPrivateNotes(): Promise<void>;
3708
+ applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
1754
3709
  /**
1755
- * Returns the inner serialized mock note transport node if it exists.
3710
+ * Generates a transaction proof using either the provided prover or the client's default
3711
+ * prover if none is supplied.
1756
3712
  */
1757
- serializeMockNoteTransportNode(): Uint8Array;
1758
- proveBlock(): void;
1759
- usesMockChain(): boolean;
1760
- newWallet(storage_mode: AccountStorageMode, mutable: boolean, auth_scheme_id: number, init_seed?: Uint8Array | null): Promise<Account>;
1761
- newFaucet(storage_mode: AccountStorageMode, non_fungible: boolean, token_symbol: string, decimals: number, max_supply: bigint, auth_scheme_id: number): Promise<Account>;
1762
- newAccount(account: Account, overwrite: boolean): Promise<void>;
1763
- addAccountSecretKeyToWebStore(secret_key: SecretKey): Promise<void>;
3713
+ proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
1764
3714
  /**
1765
- * Executes a transaction specified by the request against the specified account,
1766
- * proves it, submits it to the network, and updates the local database.
3715
+ * Executes a transaction and returns the `TransactionSummary`.
1767
3716
  *
1768
- * If the transaction utilizes foreign account data, there is a chance that the client doesn't
1769
- * have the required block header in the local database. In these scenarios, a sync to
1770
- * the chain tip is performed, and the required block header is retrieved.
3717
+ * If the transaction is unauthorized (auth script emits the unauthorized event),
3718
+ * returns the summary from the error. If the transaction succeeds, constructs
3719
+ * a summary from the executed transaction using the `auth_arg` from the transaction
3720
+ * request as the salt (or a zero salt if not provided).
3721
+ *
3722
+ * # Errors
3723
+ * - If there is an internal failure during execution.
1771
3724
  */
1772
- submitNewTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionId>;
3725
+ executeForSummary(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionSummary>;
1773
3726
  /**
1774
3727
  * Executes a transaction specified by the request against the specified account but does not
1775
3728
  * submit it to the network nor update the local database. The returned [`TransactionResult`]
@@ -1781,51 +3734,96 @@ export class WebClient {
1781
3734
  */
1782
3735
  executeTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionResult>;
1783
3736
  /**
1784
- * Executes a transaction and returns the `TransactionSummary`.
3737
+ * Executes a transaction specified by the request against the specified account,
3738
+ * proves it, submits it to the network, and updates the local database.
1785
3739
  *
1786
- * If the transaction is unauthorized (auth script emits the unauthorized event),
1787
- * returns the summary from the error. If the transaction succeeds, constructs
1788
- * a summary from the executed transaction using the `auth_arg` from the transaction
1789
- * request as the salt (or a zero salt if not provided).
3740
+ * Uses the prover configured for this client.
1790
3741
  *
1791
- * # Errors
1792
- * - If there is an internal failure during execution.
1793
- */
1794
- executeForSummary(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionSummary>;
1795
- /**
1796
- * Generates a transaction proof using either the provided prover or the client's default
1797
- * prover if none is supplied.
3742
+ * If the transaction utilizes foreign account data, there is a chance that the client doesn't
3743
+ * have the required block header in the local database. In these scenarios, a sync to
3744
+ * the chain tip is performed, and the required block header is retrieved.
1798
3745
  */
1799
- proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
3746
+ submitNewTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionId>;
1800
3747
  submitProvenTransaction(proven_transaction: ProvenTransaction, transaction_result: TransactionResult): Promise<number>;
1801
- applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
1802
3748
  newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): TransactionRequest;
1803
3749
  newSendTransactionRequest(sender_account_id: AccountId, target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint, recall_height?: number | null, timelock_height?: number | null): TransactionRequest;
1804
- newConsumeTransactionRequest(list_of_note_ids: string[]): TransactionRequest;
1805
3750
  newSwapTransactionRequest(sender_account_id: AccountId, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint, note_type: NoteType, payback_note_type: NoteType): TransactionRequest;
3751
+ newConsumeTransactionRequest(list_of_notes: Note[]): TransactionRequest;
1806
3752
  /**
1807
- * Send a private note via the note transport layer
3753
+ * Executes a transaction specified by the request against the specified account, proves it
3754
+ * with the user provided prover, submits it to the network, and updates the local database.
3755
+ *
3756
+ * If the transaction utilizes foreign account data, there is a chance that the client doesn't
3757
+ * have the required block header in the local database. In these scenarios, a sync to the
3758
+ * chain tip is performed, and the required block header is retrieved.
1808
3759
  */
1809
- sendPrivateNote(note: Note, address: Address): Promise<void>;
3760
+ submitNewTransactionWithProver(account_id: AccountId, transaction_request: TransactionRequest, prover: TransactionProver): Promise<TransactionId>;
3761
+ proveBlock(): void;
3762
+ usesMockChain(): boolean;
1810
3763
  /**
1811
- * Fetch private notes from the note transport layer
1812
- *
1813
- * Uses an internal pagination mechanism to avoid fetching duplicate notes.
3764
+ * Creates a new client with a mock RPC API. Useful for testing purposes and proof-of-concept
3765
+ * applications as it uses a mock chain that simulates the behavior of a real node.
1814
3766
  */
1815
- fetchPrivateNotes(): Promise<void>;
3767
+ createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<any>;
1816
3768
  /**
1817
- * Fetch all private notes from the note transport layer
3769
+ * Returns the inner serialized mock chain if it exists.
3770
+ */
3771
+ serializeMockChain(): Uint8Array;
3772
+ /**
3773
+ * Returns the inner serialized mock note transport node if it exists.
3774
+ */
3775
+ serializeMockNoteTransportNode(): Uint8Array;
3776
+ static buildSwapTag(note_type: NoteType, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint): NoteTag;
3777
+ getSyncHeight(): Promise<number>;
3778
+ /**
3779
+ * Internal implementation of `sync_state`.
1818
3780
  *
1819
- * Fetches all notes stored in the transport layer, with no pagination.
1820
- * Prefer using [`WebClient::fetch_private_notes`] for a more efficient, on-going,
1821
- * fetching mechanism.
3781
+ * This method performs the actual sync operation. Concurrent call coordination
3782
+ * is handled at the JavaScript layer using the Web Locks API.
3783
+ *
3784
+ * **Note:** Do not call this method directly. Use `syncState()` from JavaScript instead,
3785
+ * which provides proper coordination for concurrent calls.
1822
3786
  */
1823
- fetchAllPrivateNotes(): Promise<void>;
1824
- getInputNotes(filter: NoteFilter): Promise<InputNoteRecord[]>;
3787
+ syncStateImpl(): Promise<SyncSummary>;
3788
+ removeTag(tag: string): Promise<void>;
3789
+ addTag(tag: string): Promise<void>;
3790
+ listTags(): Promise<any>;
1825
3791
  getInputNote(note_id: string): Promise<InputNoteRecord | undefined>;
1826
- getOutputNotes(filter: NoteFilter): Promise<any>;
1827
- getOutputNote(note_id: string): Promise<any>;
3792
+ getInputNotes(filter: NoteFilter): Promise<InputNoteRecord[]>;
3793
+ getOutputNote(note_id: string): Promise<OutputNoteRecord>;
3794
+ getOutputNotes(filter: NoteFilter): Promise<OutputNoteRecord[]>;
1828
3795
  getConsumableNotes(account_id?: AccountId | null): Promise<ConsumableNoteRecord[]>;
3796
+ /**
3797
+ * Retrieves the entire underlying web store and returns it as a `JsValue`
3798
+ *
3799
+ * Meant to be used in conjunction with the `force_import_store` method
3800
+ */
3801
+ exportStore(): Promise<any>;
3802
+ exportNoteFile(note_id: string, export_type: string): Promise<NoteFile>;
3803
+ exportAccountFile(account_id: AccountId): Promise<AccountFile>;
3804
+ importNoteFile(note_file: NoteFile): Promise<NoteId>;
3805
+ forceImportStore(store_dump: any, _store_name: string): Promise<any>;
3806
+ importAccountFile(account_file: AccountFile): Promise<any>;
3807
+ importAccountById(account_id: AccountId): Promise<any>;
3808
+ importPublicAccountFromSeed(init_seed: Uint8Array, mutable: boolean, auth_scheme: AuthScheme): Promise<Account>;
3809
+ getAccount(account_id: AccountId): Promise<Account | undefined>;
3810
+ getAccounts(): Promise<AccountHeader[]>;
3811
+ insertAccountAddress(account_id: AccountId, address: Address): Promise<void>;
3812
+ removeAccountAddress(account_id: AccountId, address: Address): Promise<void>;
3813
+ /**
3814
+ * Returns all public key commitments associated with the given account ID.
3815
+ *
3816
+ * These commitments can be used with [`getAccountAuthByPubKeyCommitment`]
3817
+ * to retrieve the corresponding secret keys from the keystore.
3818
+ */
3819
+ getPublicKeyCommitmentsOfAccount(account_id: AccountId): Promise<Word[]>;
3820
+ /**
3821
+ * Retrieves an authentication secret key from the keystore given a public key commitment.
3822
+ *
3823
+ * The public key commitment should correspond to one of the keys tracked by the keystore.
3824
+ * Returns the associated [`AuthSecretKey`] if found, or an error if not found.
3825
+ */
3826
+ getAccountAuthByPubKeyCommitment(pub_key_commitment: Word): Promise<AuthSecretKey>;
1829
3827
  /**
1830
3828
  * Retrieves the setting value for `key`, or `None` if it hasn’t been set.
1831
3829
  */
@@ -1842,39 +3840,80 @@ export class WebClient {
1842
3840
  * Returns all the existing setting keys from the store.
1843
3841
  */
1844
3842
  listSettingKeys(): Promise<string[]>;
1845
- syncState(): Promise<SyncSummary>;
1846
- getSyncHeight(): Promise<number>;
1847
- static buildSwapTag(note_type: NoteType, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint): NoteTag;
1848
- addTag(tag: string): Promise<void>;
1849
- removeTag(tag: string): Promise<void>;
1850
- listTags(): Promise<any>;
1851
- getTransactions(transaction_filter: TransactionFilter): Promise<TransactionRecord[]>;
1852
- constructor();
1853
3843
  /**
1854
- * Creates a new client with the given node URL and optional seed.
1855
- * If `node_url` is `None`, it defaults to the testnet endpoint.
3844
+ * Creates a new `WebClient` instance with the specified configuration.
3845
+ *
3846
+ * # Arguments
3847
+ * * `node_url`: The URL of the node RPC endpoint. If `None`, defaults to the testnet endpoint.
3848
+ * * `node_note_transport_url`: Optional URL of the note transport service.
3849
+ * * `seed`: Optional seed for account initialization.
3850
+ * * `store_name`: Optional name for the web store. If `None`, the store name defaults to
3851
+ * `MidenClientDB_{network_id}`, where `network_id` is derived from the `node_url`.
3852
+ * Explicitly setting this allows for creating multiple isolated clients.
1856
3853
  */
1857
- createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null): Promise<any>;
3854
+ createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null): Promise<any>;
1858
3855
  /**
1859
- * Creates a new client with the given node URL, optional seed, and external keystore
1860
- * callbacks. If `node_url` is `None`, it defaults to the testnet endpoint.
3856
+ * Sets the debug mode for transaction execution.
3857
+ *
3858
+ * When enabled, the transaction executor will record additional information useful for
3859
+ * debugging (the values on the VM stack and the state of the advice provider). This is
3860
+ * disabled by default since it adds overhead.
3861
+ *
3862
+ * Must be called before `createClient`.
1861
3863
  */
1862
- createClientWithExternalKeystore(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, get_key_cb?: Function | null, insert_key_cb?: Function | null, sign_cb?: Function | null): Promise<any>;
1863
- createScriptBuilder(): ScriptBuilder;
3864
+ setDebugMode(enabled: boolean): void;
3865
+ createCodeBuilder(): CodeBuilder;
3866
+ /**
3867
+ * Creates a new `WebClient` instance with external keystore callbacks.
3868
+ *
3869
+ * # Arguments
3870
+ * * `node_url`: The URL of the node RPC endpoint. If `None`, defaults to the testnet endpoint.
3871
+ * * `node_note_transport_url`: Optional URL of the note transport service.
3872
+ * * `seed`: Optional seed for account initialization.
3873
+ * * `store_name`: Optional name for the web store. If `None`, the store name defaults to
3874
+ * `MidenClientDB_{network_id}`, where `network_id` is derived from the `node_url`.
3875
+ * Explicitly setting this allows for creating multiple isolated clients.
3876
+ * * `get_key_cb`: Callback to retrieve the secret key bytes for a given public key.
3877
+ * * `insert_key_cb`: Callback to persist a secret key.
3878
+ * * `sign_cb`: Callback to produce serialized signature bytes for the provided inputs.
3879
+ */
3880
+ 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): Promise<any>;
3881
+ constructor();
1864
3882
  }
1865
3883
  export class Word {
1866
3884
  free(): void;
1867
3885
  [Symbol.dispose](): void;
3886
+ /**
3887
+ * Deserializes a word from bytes.
3888
+ */
3889
+ static deserialize(bytes: Uint8Array): Word;
3890
+ /**
3891
+ * Creates a word from four field elements.
3892
+ */
3893
+ static newFromFelts(felt_vec: Felt[]): Word;
3894
+ /**
3895
+ * Creates a word from four u64 values.
3896
+ */
1868
3897
  constructor(u64_vec: BigUint64Array);
3898
+ /**
3899
+ * Returns the hex representation of the word.
3900
+ */
3901
+ toHex(): string;
3902
+ /**
3903
+ * Returns the word as an array of u64 values.
3904
+ */
3905
+ toU64s(): BigUint64Array;
1869
3906
  /**
1870
3907
  * Creates a Word from a hex string.
1871
3908
  * Fails if the provided string is not a valid hex representation of a Word.
1872
3909
  */
1873
3910
  static fromHex(hex: string): Word;
1874
- static newFromFelts(felt_vec: Felt[]): Word;
1875
- toHex(): string;
1876
- serialize(): Uint8Array;
1877
- static deserialize(bytes: Uint8Array): Word;
1878
- toU64s(): BigUint64Array;
3911
+ /**
3912
+ * Returns the word as an array of field elements.
3913
+ */
1879
3914
  toFelts(): Felt[];
3915
+ /**
3916
+ * Serializes the word into bytes.
3917
+ */
3918
+ serialize(): Uint8Array;
1880
3919
  }