@miden-sdk/miden-sdk 0.13.0-next.1 → 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,6 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Create an auth component for `Falcon512Rpo` multisig.
5
+ */
6
+ export function createAuthFalcon512RpoMultisig(config: AuthFalcon512RpoMultisigConfig): AccountComponent;
3
7
  export enum AccountInterface {
8
+ /**
9
+ * Basic wallet address interface.
10
+ */
4
11
  BasicWallet = 0,
5
12
  }
6
13
  export enum AccountType {
@@ -9,6 +16,13 @@ export enum AccountType {
9
16
  RegularAccountImmutableCode = 2,
10
17
  RegularAccountUpdatableCode = 3,
11
18
  }
19
+ /**
20
+ * Authentication schemes supported by the web client.
21
+ */
22
+ export enum AuthScheme {
23
+ AuthRpoFalcon512 = 0,
24
+ AuthEcdsaK256Keccak = 1,
25
+ }
12
26
  export enum InputNoteState {
13
27
  Expected = 0,
14
28
  Unverified = 1,
@@ -20,10 +34,34 @@ export enum InputNoteState {
20
34
  ConsumedUnauthenticatedLocal = 7,
21
35
  ConsumedExternal = 8,
22
36
  }
23
- export enum NetworkId {
37
+ /**
38
+ * The type of a Miden network.
39
+ */
40
+ export enum NetworkType {
41
+ /**
42
+ * Main network prefix (`mm`).
43
+ */
24
44
  Mainnet = 0,
45
+ /**
46
+ * Public test network prefix (`mtst`).
47
+ */
25
48
  Testnet = 1,
49
+ /**
50
+ * Developer network prefix (`mdev`).
51
+ */
26
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,
27
65
  }
28
66
  export enum NoteFilterTypes {
29
67
  All = 0,
@@ -36,6 +74,9 @@ export enum NoteFilterTypes {
36
74
  Nullifiers = 7,
37
75
  Unverified = 8,
38
76
  }
77
+ /**
78
+ * Visibility level for note contents when published to the network.
79
+ */
39
80
  export enum NoteType {
40
81
  /**
41
82
  * Notes with this type have only their hash published to the network.
@@ -50,9 +91,25 @@ export enum NoteType {
50
91
  */
51
92
  Public = 1,
52
93
  }
94
+ export enum OutputNoteState {
95
+ ExpectedPartial = 0,
96
+ ExpectedFull = 1,
97
+ CommittedPartial = 2,
98
+ CommittedFull = 3,
99
+ Consumed = 4,
100
+ }
53
101
  export enum SigningInputsType {
102
+ /**
103
+ * Signing commitment over a transaction summary.
104
+ */
54
105
  TransactionSummary = 0,
106
+ /**
107
+ * Arbitrary field elements supplied by caller.
108
+ */
55
109
  Arbitrary = 1,
110
+ /**
111
+ * Blind commitment derived from a single word.
112
+ */
56
113
  Blind = 2,
57
114
  }
58
115
  /**
@@ -65,26 +122,94 @@ type AddressInterface = "BasicWallet";
65
122
  * *This API requires the following crate features to be activated: `ReadableStreamType`*
66
123
  */
67
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
+ */
68
145
  export class Account {
69
146
  private constructor();
70
147
  free(): void;
71
148
  [Symbol.dispose](): void;
72
- id(): AccountId;
149
+ /**
150
+ * Returns the commitment to the account header, storage, and code.
151
+ */
73
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
+ */
74
188
  nonce(): Felt;
189
+ /**
190
+ * Returns the vault commitment for this account.
191
+ */
75
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
+ */
76
200
  storage(): AccountStorage;
77
- code(): AccountCode;
201
+ /**
202
+ * Returns true if the account is a faucet.
203
+ */
78
204
  isFaucet(): boolean;
79
- isRegularAccount(): boolean;
80
- isUpdatable(): boolean;
205
+ /**
206
+ * Returns true if the account exposes public storage.
207
+ */
81
208
  isPublic(): boolean;
82
- isPrivate(): boolean;
83
- isNetwork(): boolean;
84
- isNew(): boolean;
209
+ /**
210
+ * Serializes the account into bytes.
211
+ */
85
212
  serialize(): Uint8Array;
86
- static deserialize(bytes: Uint8Array): Account;
87
- getPublicKeys(): Word[];
88
213
  }
89
214
  export class AccountArray {
90
215
  /**
@@ -97,114 +222,289 @@ export class AccountArray {
97
222
  toString(): string;
98
223
  free(): void;
99
224
  [Symbol.dispose](): void;
100
- constructor(elements?: Account[] | null);
225
+ replaceAt(index: number, elem: Account): void;
101
226
  /**
102
227
  * Get element at index, will always return a clone to avoid aliasing issues.
103
228
  */
104
229
  get(index: number): Account;
105
- replaceAt(index: number, elem: Account): void;
230
+ constructor(elements?: Account[] | null);
106
231
  push(element: Account): void;
107
232
  length(): number;
108
233
  }
109
234
  export class AccountBuilder {
110
235
  free(): void;
111
236
  [Symbol.dispose](): void;
112
- constructor(init_seed: Uint8Array);
237
+ /**
238
+ * Sets the account type (regular, faucet, etc.).
239
+ */
113
240
  accountType(account_type: AccountType): AccountBuilder;
241
+ /**
242
+ * Sets the storage mode (public/private) for the account.
243
+ */
114
244
  storageMode(storage_mode: AccountStorageMode): AccountBuilder;
245
+ /**
246
+ * Adds a component to the account.
247
+ */
115
248
  withComponent(account_component: AccountComponent): AccountBuilder;
249
+ /**
250
+ * Adds an authentication component to the account.
251
+ */
116
252
  withAuthComponent(account_component: AccountComponent): AccountBuilder;
253
+ /**
254
+ * Adds a no-auth component to the account (for public accounts).
255
+ */
117
256
  withNoAuthComponent(): AccountBuilder;
118
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
+ */
119
265
  build(): AccountBuilderResult;
120
266
  }
121
267
  export class AccountBuilderResult {
122
268
  private constructor();
123
269
  free(): void;
124
270
  [Symbol.dispose](): void;
125
- readonly account: Account;
271
+ /**
272
+ * Returns the seed used to derive the account ID.
273
+ */
126
274
  readonly seed: Word;
275
+ /**
276
+ * Returns the built account.
277
+ */
278
+ readonly account: Account;
127
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
+ */
128
289
  export class AccountCode {
129
290
  private constructor();
130
291
  free(): void;
131
292
  [Symbol.dispose](): void;
293
+ /**
294
+ * Returns the code commitment for the account.
295
+ */
132
296
  commitment(): Word;
297
+ /**
298
+ * Returns true if the account code exports a procedure with the given MAST root.
299
+ */
133
300
  hasProcedure(mast_root: Word): boolean;
134
301
  }
135
302
  export class AccountComponent {
136
303
  private constructor();
137
304
  free(): void;
138
305
  [Symbol.dispose](): void;
139
- static compile(account_code: string, builder: ScriptBuilder, storage_slots: StorageSlot[]): AccountComponent;
140
- withSupportsAllTypes(): AccountComponent;
141
- getProcedureHash(procedure_name: string): string;
142
- getProcedures(): GetProceduresResultItem[];
143
- static createAuthComponent(secret_key: SecretKey): AccountComponent;
144
- 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
+ */
145
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;
146
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
+ */
147
356
  export class AccountDelta {
148
357
  private constructor();
149
358
  free(): void;
150
359
  [Symbol.dispose](): void;
151
- serialize(): Uint8Array;
360
+ /**
361
+ * Deserializes an account delta from bytes.
362
+ */
152
363
  static deserialize(bytes: Uint8Array): AccountDelta;
364
+ /**
365
+ * Returns the nonce change.
366
+ */
367
+ nonceDelta(): Felt;
368
+ /**
369
+ * Returns the affected account ID.
370
+ */
153
371
  id(): AccountId;
154
- isEmpty(): boolean;
155
- storage(): AccountStorageDelta;
372
+ /**
373
+ * Returns the vault delta.
374
+ */
156
375
  vault(): AccountVaultDelta;
157
- 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;
158
388
  }
159
389
  export class AccountFile {
160
390
  private constructor();
161
391
  free(): void;
162
392
  [Symbol.dispose](): void;
163
393
  /**
164
- * Serializes the `AccountFile` into a byte array
394
+ * Returns the account ID.
165
395
  */
166
- serialize(): Uint8Array;
396
+ accountId(): AccountId;
167
397
  /**
168
398
  * Deserializes a byte array into an `AccountFile`
169
399
  */
170
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;
171
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
+ */
172
425
  export class AccountHeader {
173
426
  private constructor();
174
427
  free(): void;
175
428
  [Symbol.dispose](): void;
429
+ /**
430
+ * Returns the full account commitment.
431
+ */
176
432
  commitment(): Word;
177
- id(): AccountId;
178
- nonce(): Felt;
433
+ /**
434
+ * Returns the code commitment.
435
+ */
436
+ codeCommitment(): Word;
437
+ /**
438
+ * Returns the vault commitment.
439
+ */
179
440
  vaultCommitment(): Word;
441
+ /**
442
+ * Returns the storage commitment.
443
+ */
180
444
  storageCommitment(): Word;
181
- codeCommitment(): Word;
445
+ /**
446
+ * Returns the account ID.
447
+ */
448
+ id(): AccountId;
449
+ /**
450
+ * Returns the current nonce.
451
+ */
452
+ nonce(): Felt;
182
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
+ */
183
460
  export class AccountId {
184
461
  private constructor();
185
462
  free(): void;
186
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
+ */
187
491
  static fromHex(hex: string): AccountId;
492
+ /**
493
+ * Returns true if the ID refers to a faucet.
494
+ */
188
495
  isFaucet(): boolean;
189
- isRegularAccount(): boolean;
496
+ /**
497
+ * Returns true if the account uses public storage.
498
+ */
190
499
  isPublic(): boolean;
191
- isPrivate(): boolean;
192
- isNetwork(): boolean;
193
- toString(): string;
194
500
  /**
195
- * Will turn the Account ID into its bech32 string representation. To avoid a potential
196
- * wrongful encoding, this function will expect only IDs for either mainnet ("mm"),
197
- * testnet ("mtst") or devnet ("mdev"). To use a custom bech32 prefix, see
198
- * `Self::to_bech_32_custom`.
501
+ * Will turn the Account ID into its bech32 string representation.
199
502
  */
200
503
  toBech32(network_id: NetworkId, account_interface: AccountInterface): string;
201
504
  /**
202
- * Turn this Account ID into its bech32 string representation. This method accepts a custom
203
- * network ID.
505
+ * Returns the canonical hex representation of the account ID.
204
506
  */
205
- toBech32Custom(custom_network_id: string, account_interface: AccountInterface): string;
206
- prefix(): Felt;
207
- suffix(): Felt;
507
+ toString(): string;
208
508
  }
209
509
  export class AccountIdArray {
210
510
  /**
@@ -217,65 +517,163 @@ export class AccountIdArray {
217
517
  toString(): string;
218
518
  free(): void;
219
519
  [Symbol.dispose](): void;
220
- constructor(elements?: AccountId[] | null);
520
+ replaceAt(index: number, elem: AccountId): void;
221
521
  /**
222
522
  * Get element at index, will always return a clone to avoid aliasing issues.
223
523
  */
224
524
  get(index: number): AccountId;
225
- replaceAt(index: number, elem: AccountId): void;
525
+ constructor(elements?: AccountId[] | null);
226
526
  push(element: AccountId): void;
227
527
  length(): number;
228
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
+ */
229
540
  export class AccountStorage {
230
541
  private constructor();
231
542
  free(): void;
232
543
  [Symbol.dispose](): void;
544
+ /**
545
+ * Returns the commitment to the full account storage.
546
+ */
233
547
  commitment(): Word;
234
- getItem(index: number): Word | undefined;
235
- getMapItem(index: number, key: Word): Word | undefined;
236
548
  /**
237
- * Get all key-value pairs from the map slot at `index`.
238
- * 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.
239
559
  * Returns `[]` if the map exists but is empty.
240
560
  */
241
- 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;
242
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
+ */
243
576
  export class AccountStorageDelta {
244
577
  private constructor();
245
578
  free(): void;
246
579
  [Symbol.dispose](): void;
247
- serialize(): Uint8Array;
580
+ /**
581
+ * Deserializes a storage delta from bytes.
582
+ */
248
583
  static deserialize(bytes: Uint8Array): AccountStorageDelta;
249
- isEmpty(): boolean;
584
+ /**
585
+ * Returns the new values for modified storage slots.
586
+ */
250
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;
251
596
  }
597
+ /**
598
+ * Storage visibility mode for an account.
599
+ */
252
600
  export class AccountStorageMode {
253
601
  private constructor();
254
602
  free(): void;
255
603
  [Symbol.dispose](): void;
256
- static private(): AccountStorageMode;
257
- static public(): AccountStorageMode;
258
- static network(): AccountStorageMode;
604
+ /**
605
+ * Parses a storage mode from its string representation.
606
+ */
259
607
  static tryFromStr(s: string): AccountStorageMode;
608
+ /**
609
+ * Returns the storage mode as a string.
610
+ */
260
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;
261
624
  }
262
625
  export class AccountStorageRequirements {
263
626
  free(): void;
264
627
  [Symbol.dispose](): void;
265
- constructor();
628
+ /**
629
+ * Builds storage requirements from a list of slot/key pairs.
630
+ */
266
631
  static fromSlotAndKeysArray(slots_and_keys: SlotAndKeys[]): AccountStorageRequirements;
632
+ /**
633
+ * Creates empty storage requirements.
634
+ */
635
+ constructor();
267
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
+ */
268
645
  export class AccountVaultDelta {
269
646
  private constructor();
270
647
  free(): void;
271
648
  [Symbol.dispose](): void;
272
- serialize(): Uint8Array;
649
+ /**
650
+ * Deserializes a vault delta from bytes.
651
+ */
273
652
  static deserialize(bytes: Uint8Array): AccountVaultDelta;
274
- isEmpty(): boolean;
275
- fungible(): FungibleAssetDelta;
653
+ /**
654
+ * Returns the fungible assets that increased.
655
+ */
276
656
  addedFungibleAssets(): FungibleAsset[];
657
+ /**
658
+ * Returns the fungible assets that decreased.
659
+ */
277
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;
278
673
  }
674
+ /**
675
+ * Representation of a Miden address (account ID plus routing parameters).
676
+ */
279
677
  export class Address {
280
678
  private constructor();
281
679
  /**
@@ -288,82 +686,341 @@ export class Address {
288
686
  toString(): string;
289
687
  free(): void;
290
688
  [Symbol.dispose](): void;
291
- static fromAccountId(account_id: AccountId, _interface?: string | null): Address;
292
- static fromBech32(bech32: string): Address;
293
- interface(): AddressInterface;
689
+ /**
690
+ * Returns the account ID embedded in the address.
691
+ */
294
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
+ */
295
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
+ */
296
716
  toBech32(network_id: NetworkId): string;
297
717
  }
718
+ /**
719
+ * Advice inputs provided to a transaction or note script.
720
+ */
298
721
  export class AdviceInputs {
299
722
  private constructor();
300
723
  free(): void;
301
724
  [Symbol.dispose](): void;
302
- stack(): Felt[];
725
+ /**
726
+ * Returns mapped values for a given key if present.
727
+ */
303
728
  mappedValues(key: Word): Felt[] | undefined;
729
+ /**
730
+ * Returns the stack inputs as a vector of felts.
731
+ */
732
+ stack(): Felt[];
304
733
  }
734
+ /**
735
+ * Map of advice values keyed by words for script execution.
736
+ */
305
737
  export class AdviceMap {
306
738
  free(): void;
307
739
  [Symbol.dispose](): void;
740
+ /**
741
+ * Creates an empty advice map.
742
+ */
308
743
  constructor();
744
+ /**
745
+ * Inserts a value for the given key, returning any previous value.
746
+ */
309
747
  insert(key: Word, value: FeltArray): Felt[] | undefined;
310
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
+ */
311
762
  export class AssetVault {
312
763
  private constructor();
313
764
  free(): void;
314
765
  [Symbol.dispose](): void;
315
- root(): Word;
766
+ /**
767
+ * Returns the balance for the given fungible faucet, or zero if absent.
768
+ */
316
769
  getBalance(faucet_id: AccountId): bigint;
770
+ /**
771
+ * Returns the fungible assets contained in this vault.
772
+ */
317
773
  fungibleAssets(): FungibleAsset[];
774
+ /**
775
+ * Returns the root commitment of the asset vault tree.
776
+ */
777
+ root(): Word;
778
+ }
779
+ /**
780
+ * Multisig auth configuration for `RpoFalcon512` signatures.
781
+ */
782
+ export class AuthFalcon512RpoMultisigConfig {
783
+ free(): void;
784
+ [Symbol.dispose](): void;
785
+ /**
786
+ * Per-procedure thresholds.
787
+ */
788
+ getProcThresholds(): ProcedureThreshold[];
789
+ /**
790
+ * Attach per-procedure thresholds. Each threshold must be >= 1 and <= `approvers.length`.
791
+ */
792
+ withProcThresholds(proc_thresholds: ProcedureThreshold[]): AuthFalcon512RpoMultisigConfig;
793
+ /**
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`.
798
+ */
799
+ constructor(approvers: Word[], default_threshold: number);
800
+ readonly defaultThreshold: number;
801
+ /**
802
+ * Approver public key commitments as Words.
803
+ */
804
+ readonly approvers: Word[];
318
805
  }
319
806
  export class AuthSecretKey {
320
807
  private constructor();
321
808
  free(): void;
322
809
  [Symbol.dispose](): void;
323
- 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;
324
815
  getRpoFalcon512SecretKeyAsFelts(): Felt[];
325
- getEcdsaK256KeccakPublicKeyAsWord(): Word;
816
+ /**
817
+ * Returns the ECDSA k256 Keccak secret key bytes encoded as felts.
818
+ */
326
819
  getEcdsaK256KeccakSecretKeyAsFelts(): Felt[];
820
+ sign(message: Word): Signature;
821
+ serialize(): Uint8Array;
822
+ signData(signing_inputs: SigningInputs): Signature;
327
823
  }
824
+ /**
825
+ * Provides metadata for a basic fungible faucet account component.
826
+ */
328
827
  export class BasicFungibleFaucetComponent {
329
828
  private constructor();
330
829
  free(): void;
331
830
  [Symbol.dispose](): void;
831
+ /**
832
+ * Returns the maximum token supply.
833
+ */
834
+ maxSupply(): Felt;
835
+ /**
836
+ * Extracts faucet metadata from an account.
837
+ */
332
838
  static fromAccount(account: Account): BasicFungibleFaucetComponent;
839
+ /**
840
+ * Returns the faucet's token symbol.
841
+ */
333
842
  symbol(): TokenSymbol;
843
+ /**
844
+ * Returns the number of decimal places for the token.
845
+ */
334
846
  decimals(): number;
335
- maxSupply(): Felt;
336
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
+ */
337
858
  export class BlockHeader {
338
859
  private constructor();
339
860
  free(): void;
340
861
  [Symbol.dispose](): void;
341
- version(): number;
862
+ /**
863
+ * Returns the commitment to the block contents.
864
+ */
342
865
  commitment(): Word;
866
+ /**
867
+ * Returns the account root commitment.
868
+ */
869
+ accountRoot(): Word;
870
+ /**
871
+ * Returns the transaction commitment.
872
+ */
873
+ txCommitment(): Word;
874
+ /**
875
+ * Returns the nullifier root commitment.
876
+ */
877
+ nullifierRoot(): Word;
878
+ /**
879
+ * Returns the commitment to block metadata.
880
+ */
343
881
  subCommitment(): Word;
882
+ /**
883
+ * Returns the chain commitment.
884
+ */
885
+ chainCommitment(): Word;
886
+ /**
887
+ * Returns the proof commitment.
888
+ */
889
+ proofCommitment(): Word;
890
+ /**
891
+ * Returns the transaction kernel commitment.
892
+ */
893
+ txKernelCommitment(): Word;
894
+ /**
895
+ * Returns the commitment of the previous block.
896
+ */
344
897
  prevBlockCommitment(): Word;
898
+ /**
899
+ * Returns the header version.
900
+ */
901
+ version(): number;
902
+ /**
903
+ * Returns the block height.
904
+ */
345
905
  blockNum(): number;
346
- chainCommitment(): Word;
347
- accountRoot(): Word;
348
- nullifierRoot(): Word;
906
+ /**
907
+ * Returns the note commitment root.
908
+ */
349
909
  noteRoot(): Word;
350
- txCommitment(): Word;
351
- txKernelCommitment(): Word;
352
- proofCommitment(): Word;
910
+ /**
911
+ * Returns the block timestamp.
912
+ */
353
913
  timestamp(): number;
354
914
  }
915
+ /**
916
+ * Utility for linking libraries and compiling transaction/note scripts.
917
+ */
918
+ export class CodeBuilder {
919
+ private constructor();
920
+ /**
921
+ ** Return copy of self without private attributes.
922
+ */
923
+ toJSON(): Object;
924
+ /**
925
+ * Return stringified version of self.
926
+ */
927
+ toString(): string;
928
+ free(): void;
929
+ [Symbol.dispose](): void;
930
+ /**
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.
933
+ */
934
+ linkModule(module_path: string, module_code: string): void;
935
+ /**
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'.
940
+ */
941
+ buildLibrary(library_path: string, source_code: string): Library;
942
+ /**
943
+ * Given a Transaction Script's source code, compiles it with the available
944
+ * modules under this builder. Returns the compiled script.
945
+ */
946
+ compileTxScript(tx_script: string): TransactionScript;
947
+ /**
948
+ * Given a Note Script's source code, compiles it with the available
949
+ * modules under this builder. Returns the compiled script.
950
+ */
951
+ compileNoteScript(program: string): NoteScript;
952
+ /**
953
+ * Statically links the given library.
954
+ *
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
+ */
355
1003
  export class ConsumableNoteRecord {
356
1004
  free(): void;
357
1005
  [Symbol.dispose](): void;
358
- constructor(input_note_record: InputNoteRecord, note_consumability: NoteConsumability[]);
1006
+ /**
1007
+ * Returns the underlying input note record.
1008
+ */
359
1009
  inputNoteRecord(): InputNoteRecord;
1010
+ /**
1011
+ * Returns the consumability entries.
1012
+ */
360
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[]);
361
1018
  }
362
1019
  /**
363
- * Represents a network endpoint for connecting to Miden nodes.
1020
+ * The `Endpoint` struct represents a network endpoint, consisting of a protocol, a host, and a
1021
+ * port.
364
1022
  *
365
- * An endpoint consists of a protocol (http/https), host, and optional port.
366
- * Provides convenient constructors for common network configurations.
1023
+ * This struct is used to define the address of a Miden node that the client will connect to.
367
1024
  */
368
1025
  export class Endpoint {
369
1026
  free(): void;
@@ -375,14 +1032,14 @@ export class Endpoint {
375
1032
  * @throws throws an error if the URL is invalid
376
1033
  */
377
1034
  constructor(url: string);
378
- /**
379
- * Returns the endpoint for the Miden testnet.
380
- */
381
- static testnet(): Endpoint;
382
1035
  /**
383
1036
  * Returns the endpoint for the Miden devnet.
384
1037
  */
385
1038
  static devnet(): Endpoint;
1039
+ /**
1040
+ * Returns the endpoint for the Miden testnet.
1041
+ */
1042
+ static testnet(): Endpoint;
386
1043
  /**
387
1044
  * Returns the endpoint for a local Miden node.
388
1045
  *
@@ -393,10 +1050,6 @@ export class Endpoint {
393
1050
  * Returns the string representation of the endpoint.
394
1051
  */
395
1052
  toString(): string;
396
- /**
397
- * Returns the protocol of the endpoint.
398
- */
399
- readonly protocol: string;
400
1053
  /**
401
1054
  * Returns the host of the endpoint.
402
1055
  */
@@ -405,26 +1058,81 @@ export class Endpoint {
405
1058
  * Returns the port of the endpoint.
406
1059
  */
407
1060
  readonly port: number | undefined;
1061
+ /**
1062
+ * Returns the protocol of the endpoint.
1063
+ */
1064
+ readonly protocol: string;
408
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
+ */
409
1078
  export class ExecutedTransaction {
410
1079
  private constructor();
411
1080
  free(): void;
412
1081
  [Symbol.dispose](): void;
413
- id(): TransactionId;
1082
+ /**
1083
+ * Returns the account the transaction was executed against.
1084
+ */
414
1085
  accountId(): AccountId;
415
- initialAccountHeader(): AccountHeader;
416
- finalAccountHeader(): AccountHeader;
1086
+ /**
1087
+ * Returns the input notes consumed by the transaction.
1088
+ */
417
1089
  inputNotes(): InputNotes;
418
- outputNotes(): OutputNotes;
419
- txArgs(): TransactionArgs;
1090
+ /**
1091
+ * Returns the block header that included the transaction.
1092
+ */
420
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
+ */
421
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;
422
1118
  }
1119
+ /**
1120
+ * Field element wrapper exposed to JavaScript.
1121
+ */
423
1122
  export class Felt {
424
1123
  free(): void;
425
1124
  [Symbol.dispose](): void;
1125
+ /**
1126
+ * Creates a new field element from a u64 value.
1127
+ */
426
1128
  constructor(value: bigint);
1129
+ /**
1130
+ * Returns the integer representation of the field element.
1131
+ */
427
1132
  asInt(): bigint;
1133
+ /**
1134
+ * Returns the string representation of the field element.
1135
+ */
428
1136
  toString(): string;
429
1137
  }
430
1138
  export class FeltArray {
@@ -438,25 +1146,88 @@ export class FeltArray {
438
1146
  toString(): string;
439
1147
  free(): void;
440
1148
  [Symbol.dispose](): void;
441
- constructor(elements?: Felt[] | null);
1149
+ replaceAt(index: number, elem: Felt): void;
442
1150
  /**
443
1151
  * Get element at index, will always return a clone to avoid aliasing issues.
444
1152
  */
445
1153
  get(index: number): Felt;
446
- replaceAt(index: number, elem: Felt): void;
1154
+ constructor(elements?: Felt[] | null);
447
1155
  push(element: Felt): void;
448
1156
  length(): number;
449
1157
  }
450
1158
  /**
451
- * Represents a note fetched from a Miden node via RPC.
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.
452
1199
  */
453
1200
  export class FetchedNote {
454
1201
  free(): void;
455
1202
  [Symbol.dispose](): void;
456
1203
  /**
457
- * Create a note with an optional `InputNote`.
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.
458
1208
  */
459
- constructor(note_id: NoteId, metadata: NoteMetadata, input_note?: InputNote | null);
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;
460
1231
  /**
461
1232
  * The unique identifier of the note.
462
1233
  */
@@ -467,29 +1238,37 @@ export class FetchedNote {
467
1238
  */
468
1239
  readonly metadata: NoteMetadata;
469
1240
  /**
470
- * The full [`InputNote`] with inclusion proof.
471
- *
472
- * For public notes, it contains the complete note data and inclusion proof.
473
- * For private notes, it will be ``None`.
1241
+ * Returns whether the note is private, encrypted, or public.
474
1242
  */
475
- readonly inputNote: InputNote | undefined;
476
1243
  readonly noteType: NoteType;
477
1244
  }
478
1245
  export class FlattenedU8Vec {
479
1246
  private constructor();
480
1247
  free(): void;
481
1248
  [Symbol.dispose](): void;
1249
+ num_inner_vecs(): number;
482
1250
  data(): Uint8Array;
483
1251
  lengths(): Uint32Array;
484
- num_inner_vecs(): number;
485
1252
  }
1253
+ /**
1254
+ * Description of a foreign account referenced by a transaction.
1255
+ */
486
1256
  export class ForeignAccount {
487
1257
  private constructor();
488
1258
  free(): void;
489
1259
  [Symbol.dispose](): void;
490
- static public(account_id: AccountId, storage_requirements: AccountStorageRequirements): ForeignAccount;
491
- storage_slot_requirements(): AccountStorageRequirements;
1260
+ /**
1261
+ * Returns the ID of the foreign account.
1262
+ */
492
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;
493
1272
  }
494
1273
  export class ForeignAccountArray {
495
1274
  /**
@@ -502,102 +1281,262 @@ export class ForeignAccountArray {
502
1281
  toString(): string;
503
1282
  free(): void;
504
1283
  [Symbol.dispose](): void;
505
- constructor(elements?: ForeignAccount[] | null);
1284
+ replaceAt(index: number, elem: ForeignAccount): void;
506
1285
  /**
507
1286
  * Get element at index, will always return a clone to avoid aliasing issues.
508
1287
  */
509
1288
  get(index: number): ForeignAccount;
510
- replaceAt(index: number, elem: ForeignAccount): void;
1289
+ constructor(elements?: ForeignAccount[] | null);
511
1290
  push(element: ForeignAccount): void;
512
1291
  length(): number;
513
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
+ */
514
1299
  export class FungibleAsset {
515
1300
  free(): void;
516
1301
  [Symbol.dispose](): void;
1302
+ /**
1303
+ * Creates a fungible asset for the given faucet and amount.
1304
+ */
517
1305
  constructor(faucet_id: AccountId, amount: bigint);
518
- faucetId(): AccountId;
1306
+ /**
1307
+ * Returns the amount of fungible units.
1308
+ */
519
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
+ */
520
1317
  intoWord(): Word;
521
1318
  }
1319
+ /**
1320
+ * Aggregated fungible deltas keyed by faucet ID.
1321
+ */
522
1322
  export class FungibleAssetDelta {
523
1323
  private constructor();
524
1324
  free(): void;
525
1325
  [Symbol.dispose](): void;
526
- 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
+ */
527
1333
  static deserialize(bytes: Uint8Array): FungibleAssetDelta;
528
- isEmpty(): boolean;
1334
+ /**
1335
+ * Returns the delta amount for a given faucet, if present.
1336
+ */
529
1337
  amount(faucet_id: AccountId): bigint | undefined;
530
- numAssets(): number;
1338
+ /**
1339
+ * Returns all fungible asset deltas as a list.
1340
+ */
531
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;
532
1350
  }
1351
+ /**
1352
+ * A single fungible asset change in the vault delta.
1353
+ */
533
1354
  export class FungibleAssetDeltaItem {
534
1355
  private constructor();
535
1356
  free(): void;
536
1357
  [Symbol.dispose](): void;
537
- readonly faucetId: AccountId;
1358
+ /**
1359
+ * Returns the signed amount change (positive adds assets, negative removes).
1360
+ */
538
1361
  readonly amount: bigint;
1362
+ /**
1363
+ * Returns the faucet ID this delta refers to.
1364
+ */
1365
+ readonly faucetId: AccountId;
539
1366
  }
1367
+ /**
1368
+ * Procedure digest paired with whether it is an auth procedure.
1369
+ */
540
1370
  export class GetProceduresResultItem {
541
1371
  private constructor();
542
1372
  free(): void;
543
1373
  [Symbol.dispose](): void;
1374
+ /**
1375
+ * Returns the MAST root digest for the procedure.
1376
+ */
544
1377
  readonly digest: Word;
1378
+ /**
1379
+ * Returns true if the procedure is used for authentication.
1380
+ */
545
1381
  readonly isAuth: boolean;
546
1382
  }
1383
+ /**
1384
+ * Note supplied as an input to a transaction, optionally with authentication data.
1385
+ */
547
1386
  export class InputNote {
548
1387
  private constructor();
549
1388
  free(): void;
550
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
+ */
551
1411
  id(): NoteId;
1412
+ /**
1413
+ * Returns the underlying note contents.
1414
+ */
552
1415
  note(): Note;
553
- commitment(): Word;
1416
+ /**
1417
+ * Returns the inclusion proof if the note is authenticated.
1418
+ */
554
1419
  proof(): NoteInclusionProof | undefined;
1420
+ /**
1421
+ * Returns the note's location within the commitment tree when available.
1422
+ */
555
1423
  location(): NoteLocation | undefined;
556
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
+ */
557
1438
  export class InputNoteRecord {
558
1439
  private constructor();
559
1440
  free(): void;
560
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
+ */
561
1473
  id(): NoteId;
1474
+ /**
1475
+ * Returns the current processing state for this note.
1476
+ */
562
1477
  state(): InputNoteState;
1478
+ /**
1479
+ * Returns the note details, if present.
1480
+ */
563
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
+ */
564
1489
  metadata(): NoteMetadata | undefined;
565
- commitment(): Word | undefined;
566
- inclusionProof(): NoteInclusionProof | undefined;
567
- consumerTransactionId(): string | undefined;
1490
+ /**
1491
+ * Returns the nullifier for this note.
1492
+ */
568
1493
  nullifier(): string;
569
- isAuthenticated(): boolean;
570
- isConsumed(): boolean;
571
- isProcessing(): boolean;
572
- toInputNote(): InputNote;
573
1494
  }
1495
+ /**
1496
+ * Input notes for a transaction, empty if the transaction does not consume notes.
1497
+ */
574
1498
  export class InputNotes {
575
1499
  private constructor();
576
1500
  free(): void;
577
1501
  [Symbol.dispose](): void;
1502
+ /**
1503
+ * Returns the commitment to all input notes.
1504
+ */
578
1505
  commitment(): Word;
579
- numNotes(): number;
580
- isEmpty(): boolean;
581
- getNote(index: number): InputNote;
1506
+ /**
1507
+ * Returns all input notes as a vector.
1508
+ */
582
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;
583
1522
  }
584
1523
  export class IntoUnderlyingByteSource {
585
1524
  private constructor();
586
1525
  free(): void;
587
1526
  [Symbol.dispose](): void;
588
- start(controller: ReadableByteStreamController): void;
589
1527
  pull(controller: ReadableByteStreamController): Promise<any>;
1528
+ start(controller: ReadableByteStreamController): void;
590
1529
  cancel(): void;
591
- readonly type: ReadableStreamType;
592
1530
  readonly autoAllocateChunkSize: number;
1531
+ readonly type: ReadableStreamType;
593
1532
  }
594
1533
  export class IntoUnderlyingSink {
595
1534
  private constructor();
596
1535
  free(): void;
597
1536
  [Symbol.dispose](): void;
598
- write(chunk: any): Promise<any>;
599
- close(): Promise<any>;
600
1537
  abort(reason: any): Promise<any>;
1538
+ close(): Promise<any>;
1539
+ write(chunk: any): Promise<any>;
601
1540
  }
602
1541
  export class IntoUnderlyingSource {
603
1542
  private constructor();
@@ -680,10 +1619,9 @@ export class JsStateSyncUpdate {
680
1619
  free(): void;
681
1620
  [Symbol.dispose](): void;
682
1621
  /**
683
- * The block number for this update, stored as a string since it will be
684
- * persisted in `IndexedDB`.
1622
+ * The block number for this update.
685
1623
  */
686
- blockNum: string;
1624
+ blockNum: number;
687
1625
  /**
688
1626
  * The new block headers for this state update, serialized into a flattened byte array.
689
1627
  */
@@ -693,7 +1631,7 @@ export class JsStateSyncUpdate {
693
1631
  * This vec should have the same length as the number of headers, with each index
694
1632
  * representing the block number for the header at that same index.
695
1633
  */
696
- newBlockNums: string[];
1634
+ newBlockNums: Uint32Array;
697
1635
  /**
698
1636
  * Flattened byte array containing partial blockchain peaks used for merkle tree
699
1637
  * verification.
@@ -782,9 +1720,9 @@ export class JsStorageSlot {
782
1720
  */
783
1721
  commitment: string;
784
1722
  /**
785
- * The index of the storage slot.
1723
+ * The name of the storage slot.
786
1724
  */
787
- slotIndex: number;
1725
+ slotName: string;
788
1726
  /**
789
1727
  * The value stored in the storage slot.
790
1728
  */
@@ -831,33 +1769,112 @@ export class Library {
831
1769
  free(): void;
832
1770
  [Symbol.dispose](): void;
833
1771
  }
1772
+ /**
1773
+ * Represents a Merkle path.
1774
+ */
834
1775
  export class MerklePath {
835
1776
  private constructor();
836
1777
  free(): void;
837
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
+ */
838
1786
  depth(): number;
1787
+ /**
1788
+ * Returns the nodes that make up the path.
1789
+ */
839
1790
  nodes(): Word[];
840
- computeRoot(index: bigint, node: Word): Word;
1791
+ /**
1792
+ * Verifies the path against a root.
1793
+ */
841
1794
  verify(index: bigint, node: Word, root: Word): boolean;
842
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
+ */
843
1820
  export class Note {
844
1821
  free(): void;
845
1822
  [Symbol.dispose](): void;
846
- constructor(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient);
847
- 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
+ */
848
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
+ */
849
1842
  id(): NoteId;
850
- commitment(): Word;
851
- metadata(): NoteMetadata;
852
- 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
+ */
853
1850
  assets(): NoteAssets;
1851
+ /**
1852
+ * Returns the script that guards the note.
1853
+ */
854
1854
  script(): NoteScript;
855
- static createP2IDNote(sender: AccountId, target: AccountId, assets: NoteAssets, note_type: NoteType, aux: Felt): Note;
856
- 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;
857
1871
  }
858
1872
  export class NoteAndArgs {
859
1873
  free(): void;
860
1874
  [Symbol.dispose](): void;
1875
+ /**
1876
+ * Creates a new note/args pair for transaction building.
1877
+ */
861
1878
  constructor(note: Note, args?: Word | null);
862
1879
  }
863
1880
  export class NoteAndArgsArray {
@@ -871,42 +1888,214 @@ export class NoteAndArgsArray {
871
1888
  toString(): string;
872
1889
  free(): void;
873
1890
  [Symbol.dispose](): void;
874
- constructor(elements?: NoteAndArgs[] | null);
1891
+ replaceAt(index: number, elem: NoteAndArgs): void;
875
1892
  /**
876
1893
  * Get element at index, will always return a clone to avoid aliasing issues.
877
1894
  */
878
1895
  get(index: number): NoteAndArgs;
879
- replaceAt(index: number, elem: NoteAndArgs): void;
1896
+ constructor(elements?: NoteAndArgs[] | null);
880
1897
  push(element: NoteAndArgs): void;
881
1898
  length(): number;
882
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
+ */
883
1910
  export class NoteAssets {
884
1911
  free(): void;
885
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
+ */
886
1920
  constructor(assets_array?: FungibleAsset[] | null);
1921
+ /**
1922
+ * Adds a fungible asset to the collection.
1923
+ */
887
1924
  push(asset: FungibleAsset): void;
888
- 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;
889
2005
  }
890
2006
  export class NoteConsumability {
891
2007
  private constructor();
892
2008
  free(): void;
893
2009
  [Symbol.dispose](): void;
2010
+ /**
2011
+ * Returns the account that can consume the note.
2012
+ */
894
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
+ */
895
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;
896
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
+ */
897
2058
  export class NoteDetails {
898
2059
  free(): void;
899
2060
  [Symbol.dispose](): void;
900
- constructor(note_assets: NoteAssets, note_recipient: NoteRecipient);
2061
+ /**
2062
+ * Returns the note identifier derived from these details.
2063
+ */
901
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
+ */
902
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
+ */
903
2080
  recipient(): NoteRecipient;
904
2081
  }
2082
+ /**
2083
+ * Pair of note details and tag used when declaring expected notes.
2084
+ */
905
2085
  export class NoteDetailsAndTag {
906
2086
  free(): void;
907
2087
  [Symbol.dispose](): void;
2088
+ /**
2089
+ * Creates a new pair from note details and tag.
2090
+ */
908
2091
  constructor(note_details: NoteDetails, tag: NoteTag);
2092
+ /**
2093
+ * Returns the note details.
2094
+ */
909
2095
  readonly noteDetails: NoteDetails;
2096
+ /**
2097
+ * Returns the note tag.
2098
+ */
910
2099
  readonly tag: NoteTag;
911
2100
  }
912
2101
  export class NoteDetailsAndTagArray {
@@ -920,33 +2109,46 @@ export class NoteDetailsAndTagArray {
920
2109
  toString(): string;
921
2110
  free(): void;
922
2111
  [Symbol.dispose](): void;
923
- constructor(elements?: NoteDetailsAndTag[] | null);
2112
+ replaceAt(index: number, elem: NoteDetailsAndTag): void;
924
2113
  /**
925
2114
  * Get element at index, will always return a clone to avoid aliasing issues.
926
2115
  */
927
2116
  get(index: number): NoteDetailsAndTag;
928
- replaceAt(index: number, elem: NoteDetailsAndTag): void;
2117
+ constructor(elements?: NoteDetailsAndTag[] | null);
929
2118
  push(element: NoteDetailsAndTag): void;
930
2119
  length(): number;
931
2120
  }
2121
+ /**
2122
+ * Hint describing when a note can be consumed.
2123
+ */
932
2124
  export class NoteExecutionHint {
933
2125
  private constructor();
934
2126
  free(): void;
935
2127
  [Symbol.dispose](): void;
936
- static none(): NoteExecutionHint;
937
- 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
+ */
938
2135
  static afterBlock(block_num: number): NoteExecutionHint;
2136
+ /**
2137
+ * Creates a hint that allows execution in a specific slot of a round.
2138
+ */
939
2139
  static onBlockSlot(epoch_len: number, slot_len: number, slot_offset: number): NoteExecutionHint;
940
- static fromParts(tag: number, payload: number): NoteExecutionHint;
2140
+ /**
2141
+ * Returns whether the note can be consumed at the provided block height.
2142
+ */
941
2143
  canBeConsumed(block_num: number): boolean;
942
- }
943
- export class NoteExecutionMode {
944
- private constructor();
945
- free(): void;
946
- [Symbol.dispose](): void;
947
- static newLocal(): NoteExecutionMode;
948
- static newNetwork(): NoteExecutionMode;
949
- 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;
950
2152
  }
951
2153
  /**
952
2154
  * A serialized representation of a note.
@@ -964,46 +2166,137 @@ export class NoteFile {
964
2166
  free(): void;
965
2167
  [Symbol.dispose](): void;
966
2168
  /**
967
- * Returns this `NoteFile`'s types.
2169
+ * Given a valid byte representation of a `NoteFile`,
2170
+ * return it as a struct.
968
2171
  */
969
- noteType(): string;
2172
+ static deserialize(bytes: Uint8Array): NoteFile;
970
2173
  /**
971
- * Turn a notefile into its byte representation.
2174
+ * Creates a `NoteFile` from a note ID.
972
2175
  */
973
- serialize(): Uint8Array;
2176
+ static fromNoteId(note_details: NoteId): NoteFile;
974
2177
  /**
975
- * Given a valid byte representation of a `NoteFile`,
976
- * 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.
977
2187
  */
978
- static deserialize(bytes: Uint8Array): NoteFile;
979
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
+ */
980
2196
  static fromOutputNote(note: OutputNote): NoteFile;
2197
+ /**
2198
+ * Creates a `NoteFile` from note details.
2199
+ */
981
2200
  static fromNoteDetails(note_details: NoteDetails): NoteFile;
982
- 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;
983
2225
  }
2226
+ /**
2227
+ * Filter options for querying notes from the store.
2228
+ */
984
2229
  export class NoteFilter {
985
2230
  free(): void;
986
2231
  [Symbol.dispose](): void;
2232
+ /**
2233
+ * Creates a new filter for the given type and optional note IDs.
2234
+ */
987
2235
  constructor(note_type: NoteFilterTypes, note_ids?: NoteId[] | null);
988
2236
  }
2237
+ /**
2238
+ * Holds the strictly required, public information of a note.
2239
+ *
2240
+ * See `NoteId` and `NoteMetadata` for additional details.
2241
+ */
989
2242
  export class NoteHeader {
990
2243
  private constructor();
991
2244
  free(): void;
992
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
+ */
993
2253
  id(): NoteId;
2254
+ /**
2255
+ * Returns the public metadata attached to the note.
2256
+ */
994
2257
  metadata(): NoteMetadata;
995
- commitment(): Word;
996
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
+ */
997
2275
  export class NoteId {
998
2276
  free(): void;
999
2277
  [Symbol.dispose](): void;
2278
+ /**
2279
+ * Builds a note ID from the recipient and asset commitments.
2280
+ */
1000
2281
  constructor(recipient_digest: Word, asset_commitment_digest: Word);
2282
+ /**
2283
+ * Parses a note ID from its hex encoding.
2284
+ */
1001
2285
  static fromHex(hex: string): NoteId;
2286
+ /**
2287
+ * Returns the canonical hex representation of the note ID.
2288
+ */
1002
2289
  toString(): string;
1003
2290
  }
2291
+ /**
2292
+ * Note ID paired with optional arguments for inclusion in a transaction request.
2293
+ */
1004
2294
  export class NoteIdAndArgs {
1005
2295
  free(): void;
1006
2296
  [Symbol.dispose](): void;
2297
+ /**
2298
+ * Creates a new NoteId/args pair.
2299
+ */
1007
2300
  constructor(note_id: NoteId, args?: Word | null);
1008
2301
  }
1009
2302
  export class NoteIdAndArgsArray {
@@ -1017,51 +2310,137 @@ export class NoteIdAndArgsArray {
1017
2310
  toString(): string;
1018
2311
  free(): void;
1019
2312
  [Symbol.dispose](): void;
1020
- constructor(elements?: NoteIdAndArgs[] | null);
2313
+ replaceAt(index: number, elem: NoteIdAndArgs): void;
1021
2314
  /**
1022
2315
  * Get element at index, will always return a clone to avoid aliasing issues.
1023
2316
  */
1024
2317
  get(index: number): NoteIdAndArgs;
1025
- replaceAt(index: number, elem: NoteIdAndArgs): void;
2318
+ constructor(elements?: NoteIdAndArgs[] | null);
1026
2319
  push(element: NoteIdAndArgs): void;
1027
2320
  length(): number;
1028
2321
  }
2322
+ /**
2323
+ * Contains the data required to prove inclusion of a note in the canonical chain.
2324
+ */
1029
2325
  export class NoteInclusionProof {
1030
2326
  private constructor();
1031
2327
  free(): void;
1032
2328
  [Symbol.dispose](): void;
2329
+ /**
2330
+ * Returns the location of the note within the tree.
2331
+ */
1033
2332
  location(): NoteLocation;
2333
+ /**
2334
+ * Returns the Merkle authentication path for the note.
2335
+ */
1034
2336
  notePath(): MerklePath;
1035
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
+ */
1036
2348
  export class NoteInputs {
1037
2349
  free(): void;
1038
2350
  [Symbol.dispose](): void;
2351
+ /**
2352
+ * Creates note inputs from a list of field elements.
2353
+ */
1039
2354
  constructor(felt_array: FeltArray);
2355
+ /**
2356
+ * Returns the raw inputs as an array of field elements.
2357
+ */
1040
2358
  values(): Felt[];
1041
2359
  }
2360
+ /**
2361
+ * Contains information about the location of a note.
2362
+ */
1042
2363
  export class NoteLocation {
1043
2364
  private constructor();
1044
2365
  free(): void;
1045
2366
  [Symbol.dispose](): void;
1046
- blockNum(): number;
2367
+ /**
2368
+ * Returns the index of the note leaf within the block's note tree.
2369
+ */
1047
2370
  nodeIndexInBlock(): number;
2371
+ /**
2372
+ * Returns the block height containing the note.
2373
+ */
2374
+ blockNum(): number;
1048
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
+ */
1049
2382
  export class NoteMetadata {
1050
2383
  free(): void;
1051
2384
  [Symbol.dispose](): void;
1052
- constructor(sender: AccountId, note_type: NoteType, note_tag: NoteTag, note_execution_hint: NoteExecutionHint, aux?: Felt | null);
1053
- 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
+ */
1054
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
+ */
1055
2408
  noteType(): NoteType;
1056
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
+ */
1057
2421
  export class NoteRecipient {
1058
2422
  free(): void;
1059
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
+ */
1060
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
+ */
1061
2435
  digest(): Word;
1062
- serialNum(): Word;
1063
- script(): NoteScript;
2436
+ /**
2437
+ * Returns the inputs provided to the script.
2438
+ */
1064
2439
  inputs(): NoteInputs;
2440
+ /**
2441
+ * Returns the script that controls consumption.
2442
+ */
2443
+ script(): NoteScript;
1065
2444
  }
1066
2445
  export class NoteRecipientArray {
1067
2446
  /**
@@ -1074,58 +2453,151 @@ export class NoteRecipientArray {
1074
2453
  toString(): string;
1075
2454
  free(): void;
1076
2455
  [Symbol.dispose](): void;
1077
- constructor(elements?: NoteRecipient[] | null);
2456
+ replaceAt(index: number, elem: NoteRecipient): void;
1078
2457
  /**
1079
2458
  * Get element at index, will always return a clone to avoid aliasing issues.
1080
2459
  */
1081
2460
  get(index: number): NoteRecipient;
1082
- replaceAt(index: number, elem: NoteRecipient): void;
2461
+ constructor(elements?: NoteRecipient[] | null);
1083
2462
  push(element: NoteRecipient): void;
1084
2463
  length(): number;
1085
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
+ */
1086
2471
  export class NoteScript {
1087
2472
  private constructor();
1088
2473
  free(): void;
1089
2474
  [Symbol.dispose](): void;
1090
2475
  /**
1091
- * Print the MAST source for this script.
2476
+ * Deserializes a script from bytes.
1092
2477
  */
1093
- toString(): string;
1094
- serialize(): Uint8Array;
1095
2478
  static deserialize(bytes: Uint8Array): NoteScript;
2479
+ /**
2480
+ * Creates a `NoteScript` from the given `Package`.
2481
+ * Throws if the package is invalid.
2482
+ */
2483
+ static fromPackage(_package: Package): NoteScript;
2484
+ /**
2485
+ * Returns the well-known P2ID script.
2486
+ */
1096
2487
  static p2id(): NoteScript;
1097
- static p2ide(): NoteScript;
1098
- static swap(): NoteScript;
2488
+ /**
2489
+ * Returns the MAST root of this script.
2490
+ */
1099
2491
  root(): Word;
1100
2492
  /**
1101
- * Creates a `NoteScript` from the given `Package`.
1102
- * Throws if the package is invalid.
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;
2508
+ }
2509
+ /**
2510
+ * Represents the response data from `syncNotes`.
2511
+ */
2512
+ export class NoteSyncInfo {
2513
+ private constructor();
2514
+ free(): void;
2515
+ [Symbol.dispose](): void;
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
+ */
2557
+ asU32(): number;
2558
+ }
2559
+ /**
2560
+ * Representation of a note produced by a transaction (full, partial, or header-only).
2561
+ */
2562
+ export class OutputNote {
2563
+ private constructor();
2564
+ free(): void;
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
+ */
2577
+ static full(note: Note): 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
+ */
2585
+ static header(note_header: NoteHeader): OutputNote;
2586
+ /**
2587
+ * Returns a more compact representation if possible (e.g. dropping details).
2588
+ */
2589
+ shrink(): OutputNote;
2590
+ /**
2591
+ * Wraps a partial note containing assets and recipient only.
1103
2592
  */
1104
- static fromPackage(_package: Package): NoteScript;
1105
- }
1106
- export class NoteTag {
1107
- private constructor();
1108
- free(): void;
1109
- [Symbol.dispose](): void;
1110
- static fromAccountId(account_id: AccountId): NoteTag;
1111
- static forPublicUseCase(use_case_id: number, payload: number, execution: NoteExecutionMode): NoteTag;
1112
- static forLocalUseCase(use_case_id: number, payload: number): NoteTag;
1113
- isSingleTarget(): boolean;
1114
- executionMode(): NoteExecutionMode;
1115
- asU32(): number;
1116
- }
1117
- export class OutputNote {
1118
- private constructor();
1119
- free(): void;
1120
- [Symbol.dispose](): void;
1121
- static full(note: Note): OutputNote;
1122
2593
  static partial(partial_note: PartialNote): OutputNote;
1123
- static header(note_header: NoteHeader): OutputNote;
1124
- assets(): NoteAssets | undefined;
1125
- id(): NoteId;
1126
- recipientDigest(): Word | undefined;
2594
+ /**
2595
+ * Returns the metadata that accompanies this output.
2596
+ */
1127
2597
  metadata(): NoteMetadata;
1128
- shrink(): OutputNote;
2598
+ /**
2599
+ * Converts into a full note if the data is present.
2600
+ */
1129
2601
  intoFull(): Note | undefined;
1130
2602
  }
1131
2603
  export class OutputNoteArray {
@@ -1139,24 +2611,95 @@ export class OutputNoteArray {
1139
2611
  toString(): string;
1140
2612
  free(): void;
1141
2613
  [Symbol.dispose](): void;
1142
- constructor(elements?: OutputNote[] | null);
2614
+ replaceAt(index: number, elem: OutputNote): void;
1143
2615
  /**
1144
2616
  * Get element at index, will always return a clone to avoid aliasing issues.
1145
2617
  */
1146
2618
  get(index: number): OutputNote;
1147
- replaceAt(index: number, elem: OutputNote): void;
2619
+ constructor(elements?: OutputNote[] | null);
1148
2620
  push(element: OutputNote): void;
1149
2621
  length(): number;
1150
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
+ */
1151
2679
  export class OutputNotes {
1152
2680
  private constructor();
1153
2681
  free(): void;
1154
2682
  [Symbol.dispose](): void;
2683
+ /**
2684
+ * Returns the commitment to all output notes.
2685
+ */
1155
2686
  commitment(): Word;
1156
- numNotes(): number;
1157
- isEmpty(): boolean;
1158
- getNote(index: number): OutputNote;
2687
+ /**
2688
+ * Returns all output notes as a vector.
2689
+ */
1159
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;
1160
2703
  }
1161
2704
  export class OutputNotesArray {
1162
2705
  /**
@@ -1169,21 +2712,22 @@ export class OutputNotesArray {
1169
2712
  toString(): string;
1170
2713
  free(): void;
1171
2714
  [Symbol.dispose](): void;
1172
- constructor(elements?: OutputNotes[] | null);
2715
+ replaceAt(index: number, elem: OutputNotes): void;
1173
2716
  /**
1174
2717
  * Get element at index, will always return a clone to avoid aliasing issues.
1175
2718
  */
1176
2719
  get(index: number): OutputNotes;
1177
- replaceAt(index: number, elem: OutputNotes): void;
2720
+ constructor(elements?: OutputNotes[] | null);
1178
2721
  push(element: OutputNotes): void;
1179
2722
  length(): number;
1180
2723
  }
2724
+ /**
2725
+ * Compiled VM package containing libraries and metadata.
2726
+ */
1181
2727
  export class Package {
1182
2728
  private constructor();
1183
2729
  free(): void;
1184
2730
  [Symbol.dispose](): void;
1185
- serialize(): Uint8Array;
1186
- static deserialize(bytes: Uint8Array): Package;
1187
2731
  /**
1188
2732
  * Returns the underlying library of a `Package`.
1189
2733
  * Fails if the package is not a library.
@@ -1194,15 +2738,51 @@ export class Package {
1194
2738
  * Fails if the package is not a program.
1195
2739
  */
1196
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;
1197
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
+ */
1198
2759
  export class PartialNote {
1199
2760
  private constructor();
1200
2761
  free(): void;
1201
2762
  [Symbol.dispose](): void;
1202
- id(): NoteId;
1203
- metadata(): NoteMetadata;
2763
+ /**
2764
+ * Returns the digest of the recipient information.
2765
+ */
1204
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
+ */
1205
2774
  assets(): NoteAssets;
2775
+ /**
2776
+ * Returns the metadata attached to the note.
2777
+ */
2778
+ metadata(): NoteMetadata;
2779
+ }
2780
+ export class ProcedureThreshold {
2781
+ free(): void;
2782
+ [Symbol.dispose](): void;
2783
+ constructor(proc_root: Word, threshold: number);
2784
+ readonly procRoot: Word;
2785
+ readonly threshold: number;
1206
2786
  }
1207
2787
  export class Program {
1208
2788
  private constructor();
@@ -1210,59 +2790,78 @@ export class Program {
1210
2790
  [Symbol.dispose](): void;
1211
2791
  }
1212
2792
  /**
1213
- * 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.
1214
2795
  */
1215
2796
  export class ProvenTransaction {
1216
2797
  private constructor();
1217
2798
  free(): void;
1218
2799
  [Symbol.dispose](): void;
1219
2800
  /**
1220
- * Serializes the proven transaction into bytes.
2801
+ * Returns the account ID the transaction was executed against.
1221
2802
  */
1222
- serialize(): Uint8Array;
2803
+ accountId(): AccountId;
1223
2804
  /**
1224
- * Deserializes a proven transaction from bytes.
2805
+ * Returns the nullifiers of the consumed input notes.
1225
2806
  */
1226
- static deserialize(bytes: Uint8Array): ProvenTransaction;
2807
+ nullifiers(): Word[];
1227
2808
  /**
1228
- * Returns the transaction ID.
2809
+ * Deserializes a proven transaction from bytes.
1229
2810
  */
1230
- id(): TransactionId;
2811
+ static deserialize(bytes: Uint8Array): ProvenTransaction;
1231
2812
  /**
1232
- * Returns the account ID the transaction was executed against.
2813
+ * Returns notes created by this transaction.
1233
2814
  */
1234
- accountId(): AccountId;
2815
+ outputNotes(): OutputNotes;
1235
2816
  /**
1236
2817
  * Returns the reference block number used during execution.
1237
2818
  */
1238
2819
  refBlockNumber(): number;
1239
2820
  /**
1240
- * Returns the block number at which the transaction expires.
2821
+ * Returns the commitment of the reference block.
1241
2822
  */
1242
- expirationBlockNumber(): number;
2823
+ refBlockCommitment(): Word;
1243
2824
  /**
1244
- * Returns notes created by this transaction.
2825
+ * Returns the block number at which the transaction expires.
1245
2826
  */
1246
- outputNotes(): OutputNotes;
2827
+ expirationBlockNumber(): number;
1247
2828
  /**
1248
- * Returns the commitment of the reference block.
2829
+ * Returns the transaction ID.
1249
2830
  */
1250
- refBlockCommitment(): Word;
2831
+ id(): TransactionId;
1251
2832
  /**
1252
- * Returns the nullifiers of the consumed input notes.
2833
+ * Serializes the proven transaction into bytes.
1253
2834
  */
1254
- nullifiers(): Word[];
2835
+ serialize(): Uint8Array;
1255
2836
  }
1256
2837
  export class PublicKey {
1257
2838
  private constructor();
1258
2839
  free(): void;
1259
2840
  [Symbol.dispose](): void;
1260
- serialize(): Uint8Array;
2841
+ /**
2842
+ * Deserializes a public key from bytes.
2843
+ */
1261
2844
  static deserialize(bytes: Uint8Array): PublicKey;
1262
- verify(message: Word, signature: Signature): boolean;
1263
- toCommitment(): Word;
1264
- static recoverFrom(message: Word, signature: Signature): PublicKey;
2845
+ /**
2846
+ * Verifies a signature over arbitrary signing inputs.
2847
+ */
1265
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;
1266
2865
  }
1267
2866
  /**
1268
2867
  * RPC Client for interacting with Miden nodes directly.
@@ -1271,100 +2870,56 @@ export class RpcClient {
1271
2870
  free(): void;
1272
2871
  [Symbol.dispose](): void;
1273
2872
  /**
1274
- * Creates a new RPC client instance.
1275
- *
1276
- * @param endpoint - Endpoint to connect to.
2873
+ * Fetches notes matching the provided tags from the node.
1277
2874
  */
1278
- constructor(endpoint: Endpoint);
2875
+ syncNotes(block_num: number, block_to: number | null | undefined, note_tags: NoteTag[]): Promise<NoteSyncInfo>;
1279
2876
  /**
1280
2877
  * Fetches notes by their IDs from the connected Miden node.
1281
2878
  *
1282
2879
  * @param note_ids - Array of [`NoteId`] objects to fetch
1283
- * @returns Promise that resolves to different data depending on the note type:
1284
- * - Private notes: Returns only `note_id` and `metadata`. The `input_note` field will be
1285
- * `null`.
1286
- * - Public notes: Returns the full `input_note` with inclusion proof, alongside metadata and
1287
- * 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.
1288
2884
  */
1289
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>;
1290
2890
  /**
1291
2891
  * Fetches a note script by its root hash from the connected Miden node.
1292
2892
  *
1293
- * @param `script_root` The root hash of the note script to fetch
1294
- * @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`.
1295
2895
  */
1296
2896
  getNoteScriptByRoot(script_root: Word): Promise<NoteScript>;
1297
- }
1298
- export class Rpo256 {
1299
- private constructor();
1300
- free(): void;
1301
- [Symbol.dispose](): void;
1302
- static hashElements(felt_array: FeltArray): Word;
1303
- }
1304
- export class ScriptBuilder {
1305
- private constructor();
1306
- /**
1307
- ** Return copy of self without private attributes.
1308
- */
1309
- toJSON(): Object;
1310
- /**
1311
- * Return stringified version of self.
1312
- */
1313
- toString(): string;
1314
- free(): void;
1315
- [Symbol.dispose](): void;
1316
2897
  /**
1317
- * Given a module path (something like `my_lib::module`) and source code, this will
1318
- * 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.
1319
2899
  */
1320
- linkModule(module_path: string, module_code: string): void;
2900
+ getBlockHeaderByNumber(block_num?: number | null): Promise<BlockHeader>;
1321
2901
  /**
1322
- * Statically links the given library.
1323
- *
1324
- * Static linking means the library code is copied into the script code.
1325
- * Use this for most libraries that are not available on-chain.
1326
- *
1327
- * Receives as argument the library to link.
2902
+ * Fetches the block height at which a nullifier was committed, if any.
1328
2903
  */
1329
- linkStaticLibrary(library: Library): void;
2904
+ getNullifierCommitHeight(nullifier: Word, block_num: number): Promise<number | undefined>;
1330
2905
  /**
1331
- * This is useful to dynamically link the [`Library`] of a foreign account
1332
- * that is invoked using foreign procedure invocation (FPI). Its code is available
1333
- * on-chain and so it does not have to be copied into the script code.
2906
+ * Creates a new RPC client instance.
1334
2907
  *
1335
- * For all other use cases not involving FPI, link the library statically.
1336
- * Receives as argument the library to be linked.
1337
- */
1338
- linkDynamicLibrary(library: Library): void;
1339
- /**
1340
- * Given a Transaction Script's source code, compiles it with the available
1341
- * modules under this builder. Returns the compiled script.
1342
- */
1343
- compileTxScript(tx_script: string): TransactionScript;
1344
- /**
1345
- * Given a Note Script's source code, compiles it with the available
1346
- * modules under this builder. Returns the compiled script.
1347
- */
1348
- compileNoteScript(program: string): NoteScript;
1349
- /**
1350
- * Given a Library Path, and a source code, turn it into a Library.
1351
- * E.g. A path library can be `miden::my_contract`. When turned into a library,
1352
- * this can be used from another script with an import statement, following the
1353
- * previous example: `use.miden::my_contract'.
2908
+ * @param endpoint - Endpoint to connect to.
1354
2909
  */
1355
- buildLibrary(library_path: string, source_code: string): Library;
2910
+ constructor(endpoint: Endpoint);
1356
2911
  }
1357
- export class SecretKey {
2912
+ /**
2913
+ * RPO256 hashing helpers exposed to JavaScript.
2914
+ */
2915
+ export class Rpo256 {
1358
2916
  private constructor();
1359
2917
  free(): void;
1360
2918
  [Symbol.dispose](): void;
1361
- static rpoFalconWithRNG(seed?: Uint8Array | null): SecretKey;
1362
- static ecdsaWithRNG(seed?: Uint8Array | null): SecretKey;
1363
- publicKey(): PublicKey;
1364
- sign(message: Word): Signature;
1365
- signData(signing_inputs: SigningInputs): Signature;
1366
- serialize(): Uint8Array;
1367
- static deserialize(bytes: Uint8Array): SecretKey;
2919
+ /**
2920
+ * Computes an RPO256 digest from the provided field elements.
2921
+ */
2922
+ static hashElements(felt_array: FeltArray): Word;
1368
2923
  }
1369
2924
  export class SerializedInputNoteData {
1370
2925
  private constructor();
@@ -1405,54 +2960,168 @@ export class SerializedTransactionData {
1405
2960
  set scriptRoot(value: Uint8Array | null | undefined);
1406
2961
  get txScript(): Uint8Array | undefined;
1407
2962
  set txScript(value: Uint8Array | null | undefined);
1408
- blockNum: string;
2963
+ blockNum: number;
1409
2964
  statusVariant: number;
1410
2965
  status: Uint8Array;
1411
2966
  }
2967
+ /**
2968
+ * Cryptographic signature produced by supported auth schemes.
2969
+ */
1412
2970
  export class Signature {
1413
2971
  private constructor();
1414
2972
  free(): void;
1415
2973
  [Symbol.dispose](): void;
1416
- serialize(): Uint8Array;
2974
+ /**
2975
+ * Deserializes a signature from bytes.
2976
+ */
1417
2977
  static deserialize(bytes: Uint8Array): Signature;
2978
+ /**
2979
+ * Converts the signature to the prepared field elements expected by verifying code.
2980
+ */
1418
2981
  toPreparedSignature(message: Word): Felt[];
2982
+ /**
2983
+ * Serializes the signature into bytes.
2984
+ */
2985
+ serialize(): Uint8Array;
1419
2986
  }
1420
2987
  export class SigningInputs {
1421
2988
  private constructor();
1422
2989
  free(): void;
1423
2990
  [Symbol.dispose](): void;
1424
- static newTransactionSummary(summary: TransactionSummary): SigningInputs;
1425
- static newArbitrary(felts: Felt[]): SigningInputs;
1426
- static newBlind(word: Word): SigningInputs;
1427
- transactionSummaryPayload(): TransactionSummary;
1428
- arbitraryPayload(): FeltArray;
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
+ */
1429
3002
  blindPayload(): Word;
3003
+ /**
3004
+ * Creates signing inputs from arbitrary field elements.
3005
+ */
3006
+ static newArbitrary(felts: Felt[]): SigningInputs;
3007
+ /**
3008
+ * Returns the commitment to these signing inputs.
3009
+ */
1430
3010
  toCommitment(): Word;
1431
- toElements(): FeltArray;
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
+ */
3026
+ static newBlind(word: Word): SigningInputs;
3027
+ /**
3028
+ * Serializes the signing inputs into bytes.
3029
+ */
1432
3030
  serialize(): Uint8Array;
1433
- static deserialize(bytes: Uint8Array): SigningInputs;
3031
+ /**
3032
+ * Returns which variant these signing inputs represent.
3033
+ */
1434
3034
  readonly variantType: SigningInputsType;
1435
3035
  }
3036
+ /**
3037
+ * Storage slot index paired with map keys that must be present.
3038
+ */
1436
3039
  export class SlotAndKeys {
1437
3040
  free(): void;
1438
3041
  [Symbol.dispose](): void;
1439
- constructor(storage_slot_index: number, storage_map_keys: Word[]);
1440
- storage_slot_index(): number;
3042
+ /**
3043
+ * Returns the storage map keys required for this slot.
3044
+ */
1441
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;
1442
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
+ */
1443
3094
  export class StorageMap {
1444
3095
  free(): void;
1445
3096
  [Symbol.dispose](): void;
3097
+ /**
3098
+ * Creates an empty storage map.
3099
+ */
1446
3100
  constructor();
3101
+ /**
3102
+ * Inserts a key/value pair, returning any previous value.
3103
+ */
1447
3104
  insert(key: Word, value: Word): Word;
1448
3105
  }
3106
+ /**
3107
+ * A single storage slot value or map for an account component.
3108
+ */
1449
3109
  export class StorageSlot {
1450
3110
  private constructor();
1451
3111
  free(): void;
1452
3112
  [Symbol.dispose](): void;
1453
- static fromValue(value: Word): StorageSlot;
1454
- static emptyValue(): StorageSlot;
1455
- 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;
1456
3125
  }
1457
3126
  export class StorageSlotArray {
1458
3127
  /**
@@ -1465,26 +3134,50 @@ export class StorageSlotArray {
1465
3134
  toString(): string;
1466
3135
  free(): void;
1467
3136
  [Symbol.dispose](): void;
1468
- constructor(elements?: StorageSlot[] | null);
3137
+ replaceAt(index: number, elem: StorageSlot): void;
1469
3138
  /**
1470
3139
  * Get element at index, will always return a clone to avoid aliasing issues.
1471
3140
  */
1472
3141
  get(index: number): StorageSlot;
1473
- replaceAt(index: number, elem: StorageSlot): void;
3142
+ constructor(elements?: StorageSlot[] | null);
1474
3143
  push(element: StorageSlot): void;
1475
3144
  length(): number;
1476
3145
  }
3146
+ /**
3147
+ * Contains stats about the sync operation.
3148
+ */
1477
3149
  export class SyncSummary {
1478
3150
  private constructor();
1479
3151
  free(): void;
1480
3152
  [Symbol.dispose](): void;
1481
- blockNum(): number;
1482
- 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
+ */
1483
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
+ */
1484
3168
  updatedAccounts(): AccountId[];
3169
+ /**
3170
+ * Returns transactions that were committed.
3171
+ */
1485
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
+ */
1486
3180
  serialize(): Uint8Array;
1487
- static deserialize(bytes: Uint8Array): SyncSummary;
1488
3181
  }
1489
3182
  export class TestUtils {
1490
3183
  private constructor();
@@ -1494,133 +3187,363 @@ export class TestUtils {
1494
3187
  static createMockSerializedLibraryPackage(): Uint8Array;
1495
3188
  static createMockSerializedProgramPackage(): Uint8Array;
1496
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
+ */
1497
3195
  export class TokenSymbol {
1498
3196
  free(): void;
1499
3197
  [Symbol.dispose](): void;
3198
+ /**
3199
+ * Creates a token symbol from a string.
3200
+ */
1500
3201
  constructor(symbol: string);
3202
+ /**
3203
+ * Returns the validated symbol string.
3204
+ */
1501
3205
  toString(): string;
1502
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
+ */
1503
3218
  export class TransactionArgs {
1504
3219
  private constructor();
1505
3220
  free(): void;
1506
3221
  [Symbol.dispose](): void;
1507
- txScript(): TransactionScript | undefined;
1508
- getNoteArgs(note_id: NoteId): Word | undefined;
3222
+ /**
3223
+ * Returns advice inputs attached to the transaction.
3224
+ */
1509
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;
1510
3234
  }
3235
+ /**
3236
+ * Filter used when querying stored transactions.
3237
+ */
1511
3238
  export class TransactionFilter {
1512
3239
  private constructor();
1513
3240
  free(): void;
1514
3241
  [Symbol.dispose](): void;
1515
- static all(): TransactionFilter;
1516
- static ids(ids: TransactionId[]): TransactionFilter;
3242
+ /**
3243
+ * Matches transactions that are not yet committed.
3244
+ */
1517
3245
  static uncommitted(): TransactionFilter;
3246
+ /**
3247
+ * Matches transactions that expired before the given block number.
3248
+ */
1518
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;
1519
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
+ */
1520
3269
  export class TransactionId {
1521
3270
  private constructor();
1522
3271
  free(): void;
1523
3272
  [Symbol.dispose](): void;
3273
+ /**
3274
+ * Returns the transaction ID as field elements.
3275
+ */
1524
3276
  asElements(): Felt[];
1525
- asBytes(): Uint8Array;
1526
- toHex(): string;
3277
+ /**
3278
+ * Returns the underlying word representation.
3279
+ */
1527
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;
1528
3289
  }
3290
+ /**
3291
+ * Wrapper over local or remote transaction proving backends.
3292
+ */
1529
3293
  export class TransactionProver {
1530
3294
  private constructor();
1531
3295
  free(): void;
1532
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
+ */
1533
3309
  static newLocalProver(): TransactionProver;
1534
- static newRemoteProver(endpoint: string): TransactionProver;
1535
- serialize(): string;
1536
- 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
+ */
1537
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;
1538
3333
  }
3334
+ /**
3335
+ * Describes a transaction that has been executed and is being tracked on the Client.
3336
+ */
1539
3337
  export class TransactionRecord {
1540
3338
  private constructor();
1541
3339
  free(): void;
1542
3340
  [Symbol.dispose](): void;
1543
- id(): TransactionId;
3341
+ /**
3342
+ * Returns the account this transaction was executed against.
3343
+ */
1544
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
+ */
1545
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
+ */
1546
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
+ */
1547
3376
  inputNoteNullifiers(): Word[];
1548
- 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
+ */
1549
3384
  blockNum(): number;
1550
- transactionStatus(): TransactionStatus;
1551
- creationTimestamp(): bigint;
1552
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
+ */
1553
3393
  export class TransactionRequest {
1554
3394
  private constructor();
1555
3395
  free(): void;
1556
3396
  [Symbol.dispose](): void;
1557
- 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
+ */
1558
3404
  static deserialize(bytes: Uint8Array): TransactionRequest;
1559
- expectedOutputOwnNotes(): Note[];
3405
+ /**
3406
+ * Returns notes expected to be created in subsequent executions.
3407
+ */
1560
3408
  expectedFutureNotes(): NoteDetailsAndTag[];
1561
- 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
+ */
1562
3416
  authArg(): Word | undefined;
3417
+ /**
3418
+ * Serializes the transaction request into bytes.
3419
+ */
3420
+ serialize(): Uint8Array;
1563
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
+ */
1564
3428
  export class TransactionRequestBuilder {
1565
3429
  free(): void;
1566
3430
  [Symbol.dispose](): void;
1567
- constructor();
1568
- withUnauthenticatedInputNotes(notes: NoteAndArgsArray): TransactionRequestBuilder;
1569
- withAuthenticatedInputNotes(notes: NoteIdAndArgsArray): TransactionRequestBuilder;
1570
- withOwnOutputNotes(notes: OutputNoteArray): TransactionRequestBuilder;
1571
- withCustomScript(script: TransactionScript): TransactionRequestBuilder;
1572
- withExpectedOutputRecipients(recipients: NoteRecipientArray): TransactionRequestBuilder;
1573
- 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
+ */
1574
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
+ */
1575
3454
  withForeignAccounts(foreign_accounts: ForeignAccountArray): TransactionRequestBuilder;
1576
- withScriptArg(script_arg: Word): TransactionRequestBuilder;
1577
- 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
+ */
1578
3474
  build(): TransactionRequest;
1579
3475
  }
1580
3476
  /**
1581
- * 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).
1582
3481
  */
1583
3482
  export class TransactionResult {
1584
3483
  private constructor();
1585
3484
  free(): void;
1586
3485
  [Symbol.dispose](): void;
1587
3486
  /**
1588
- * Returns the ID of the transaction.
3487
+ * Deserializes a transaction result from bytes.
3488
+ */
3489
+ static deserialize(bytes: Uint8Array): TransactionResult;
3490
+ /**
3491
+ * Returns notes that are expected to be created as a result of follow-up executions.
1589
3492
  */
1590
- id(): TransactionId;
3493
+ futureNotes(): NoteDetailsAndTag[];
1591
3494
  /**
1592
3495
  * Returns the executed transaction.
1593
3496
  */
1594
3497
  executedTransaction(): ExecutedTransaction;
1595
3498
  /**
1596
- * Returns notes that are expected to be created as a result of follow-up executions.
3499
+ * Returns the ID of the transaction.
1597
3500
  */
1598
- futureNotes(): NoteDetailsAndTag[];
3501
+ id(): TransactionId;
1599
3502
  /**
1600
3503
  * Serializes the transaction result into bytes.
1601
3504
  */
1602
3505
  serialize(): Uint8Array;
1603
- /**
1604
- * Deserializes a transaction result from bytes.
1605
- */
1606
- static deserialize(bytes: Uint8Array): TransactionResult;
1607
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
+ */
1608
3516
  export class TransactionScript {
1609
3517
  private constructor();
1610
3518
  free(): void;
1611
3519
  [Symbol.dispose](): void;
1612
- root(): Word;
1613
3520
  /**
1614
3521
  * Creates a `NoteScript` from the given `Package`.
1615
3522
  * Throws if the package is invalid.
1616
3523
  */
1617
3524
  static fromPackage(_package: Package): TransactionScript;
3525
+ /**
3526
+ * Returns the MAST root commitment of the transaction script.
3527
+ */
3528
+ root(): Word;
1618
3529
  }
3530
+ /**
3531
+ * A script argument represented as a word plus additional felts.
3532
+ */
1619
3533
  export class TransactionScriptInputPair {
1620
3534
  free(): void;
1621
3535
  [Symbol.dispose](): void;
3536
+ /**
3537
+ * Creates a new script input pair.
3538
+ */
1622
3539
  constructor(word: Word, felts: FeltArray);
3540
+ /**
3541
+ * Returns the word part of the input.
3542
+ */
1623
3543
  word(): Word;
3544
+ /**
3545
+ * Returns the remaining felts for the input.
3546
+ */
1624
3547
  felts(): FeltArray;
1625
3548
  }
1626
3549
  export class TransactionScriptInputPairArray {
@@ -1634,100 +3557,172 @@ export class TransactionScriptInputPairArray {
1634
3557
  toString(): string;
1635
3558
  free(): void;
1636
3559
  [Symbol.dispose](): void;
1637
- constructor(elements?: TransactionScriptInputPair[] | null);
3560
+ replaceAt(index: number, elem: TransactionScriptInputPair): void;
1638
3561
  /**
1639
3562
  * Get element at index, will always return a clone to avoid aliasing issues.
1640
3563
  */
1641
3564
  get(index: number): TransactionScriptInputPair;
1642
- replaceAt(index: number, elem: TransactionScriptInputPair): void;
3565
+ constructor(elements?: TransactionScriptInputPair[] | null);
1643
3566
  push(element: TransactionScriptInputPair): void;
1644
3567
  length(): number;
1645
3568
  }
3569
+ /**
3570
+ * Status of a transaction in the node or store.
3571
+ */
1646
3572
  export class TransactionStatus {
1647
3573
  private constructor();
1648
3574
  free(): void;
1649
3575
  [Symbol.dispose](): void;
1650
- static pending(): TransactionStatus;
1651
- static committed(block_num: number, commit_timestamp: bigint): TransactionStatus;
1652
- static discarded(cause: string): TransactionStatus;
3576
+ /**
3577
+ * Returns true if the transaction is still pending.
3578
+ */
1653
3579
  isPending(): boolean;
3580
+ /**
3581
+ * Returns true if the transaction has been committed.
3582
+ */
1654
3583
  isCommitted(): boolean;
3584
+ /**
3585
+ * Returns true if the transaction was discarded.
3586
+ */
1655
3587
  isDiscarded(): boolean;
3588
+ /**
3589
+ * Returns the block number if the transaction was committed.
3590
+ */
1656
3591
  getBlockNum(): number | undefined;
3592
+ /**
3593
+ * Returns the commit timestamp if the transaction was committed.
3594
+ */
1657
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;
1658
3608
  }
3609
+ /**
3610
+ * Represents the changes that need to be applied to the client store as a result of a transaction
3611
+ * execution.
3612
+ */
1659
3613
  export class TransactionStoreUpdate {
1660
3614
  private constructor();
1661
3615
  free(): void;
1662
3616
  [Symbol.dispose](): void;
1663
- executedTransaction(): ExecutedTransaction;
1664
- submissionHeight(): number;
1665
- createdNotes(): OutputNotes;
1666
- 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
+ */
1667
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
+ */
1668
3644
  serialize(): Uint8Array;
1669
- static deserialize(bytes: Uint8Array): TransactionStoreUpdate;
1670
3645
  }
3646
+ /**
3647
+ * Represents a transaction summary.
3648
+ */
1671
3649
  export class TransactionSummary {
1672
3650
  private constructor();
1673
3651
  free(): void;
1674
3652
  [Symbol.dispose](): void;
1675
- serialize(): Uint8Array;
3653
+ /**
3654
+ * Deserializes a summary from bytes.
3655
+ */
1676
3656
  static deserialize(bytes: Uint8Array): TransactionSummary;
1677
- accountDelta(): AccountDelta;
3657
+ /**
3658
+ * Returns the input notes referenced by the summary.
3659
+ */
1678
3660
  inputNotes(): InputNotes;
3661
+ /**
3662
+ * Returns the output notes referenced by the summary.
3663
+ */
1679
3664
  outputNotes(): OutputNotes;
3665
+ /**
3666
+ * Returns the account delta described by the summary.
3667
+ */
3668
+ accountDelta(): AccountDelta;
3669
+ /**
3670
+ * Computes the commitment to this `TransactionSummary`.
3671
+ */
3672
+ toCommitment(): Word;
3673
+ /**
3674
+ * Returns the random salt mixed into the summary commitment.
3675
+ */
1680
3676
  salt(): Word;
3677
+ /**
3678
+ * Serializes the summary into bytes.
3679
+ */
3680
+ serialize(): Uint8Array;
1681
3681
  }
1682
3682
  export class WebClient {
1683
3683
  free(): void;
1684
3684
  [Symbol.dispose](): void;
1685
- getAccounts(): Promise<AccountHeader[]>;
1686
- getAccount(account_id: AccountId): Promise<Account | undefined>;
1687
- getAccountAuthByPubKey(pub_key: Word): Promise<AuthSecretKey>;
1688
- insertAccountAddress(account_id: AccountId, address: Address): Promise<void>;
1689
- removeAccountAddress(account_id: AccountId, address: Address): Promise<void>;
1690
- 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[]>;
1691
3690
  /**
1692
- * Retrieves the entire underlying web store and returns it as a `JsValue`
1693
- *
1694
- * Meant to be used in conjunction with the `force_import_store` method
3691
+ * Send a private note via the note transport layer
1695
3692
  */
1696
- exportStore(): Promise<any>;
1697
- exportAccountFile(account_id: AccountId): Promise<AccountFile>;
1698
- importAccountFile(account_file: AccountFile): Promise<any>;
1699
- importPublicAccountFromSeed(init_seed: Uint8Array, mutable: boolean, auth_scheme_id: number): Promise<Account>;
1700
- importAccountById(account_id: AccountId): Promise<any>;
1701
- importNoteFile(note_file: NoteFile): Promise<NoteId>;
1702
- forceImportStore(store_dump: any): Promise<any>;
3693
+ sendPrivateNote(note: Note, address: Address): Promise<void>;
1703
3694
  /**
1704
- * Creates a new client with a mock RPC API. Useful for testing purposes and proof-of-concept
1705
- * 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.
1706
3698
  */
1707
- createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<any>;
3699
+ fetchPrivateNotes(): Promise<void>;
1708
3700
  /**
1709
- * 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.
1710
3706
  */
1711
- serializeMockChain(): Uint8Array;
3707
+ fetchAllPrivateNotes(): Promise<void>;
3708
+ applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
1712
3709
  /**
1713
- * 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.
1714
3712
  */
1715
- serializeMockNoteTransportNode(): Uint8Array;
1716
- proveBlock(): void;
1717
- usesMockChain(): boolean;
1718
- newWallet(storage_mode: AccountStorageMode, mutable: boolean, auth_scheme_id: number, init_seed?: Uint8Array | null): Promise<Account>;
1719
- newFaucet(storage_mode: AccountStorageMode, non_fungible: boolean, token_symbol: string, decimals: number, max_supply: bigint, auth_scheme_id: number): Promise<Account>;
1720
- newAccount(account: Account, overwrite: boolean): Promise<void>;
1721
- addAccountSecretKeyToWebStore(secret_key: SecretKey): Promise<void>;
3713
+ proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
1722
3714
  /**
1723
- * Executes a transaction specified by the request against the specified account,
1724
- * proves it, submits it to the network, and updates the local database.
3715
+ * Executes a transaction and returns the `TransactionSummary`.
1725
3716
  *
1726
- * If the transaction utilizes foreign account data, there is a chance that the client doesn't
1727
- * have the required block header in the local database. In these scenarios, a sync to
1728
- * 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.
1729
3724
  */
1730
- submitNewTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionId>;
3725
+ executeForSummary(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionSummary>;
1731
3726
  /**
1732
3727
  * Executes a transaction specified by the request against the specified account but does not
1733
3728
  * submit it to the network nor update the local database. The returned [`TransactionResult`]
@@ -1739,39 +3734,96 @@ export class WebClient {
1739
3734
  */
1740
3735
  executeTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionResult>;
1741
3736
  /**
1742
- * Generates a transaction proof using either the provided prover or the client's default
1743
- * prover if none is supplied.
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.
3739
+ *
3740
+ * Uses the prover configured for this client.
3741
+ *
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.
1744
3745
  */
1745
- proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
3746
+ submitNewTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionId>;
1746
3747
  submitProvenTransaction(proven_transaction: ProvenTransaction, transaction_result: TransactionResult): Promise<number>;
1747
- applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
1748
3748
  newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): TransactionRequest;
1749
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;
1750
- newConsumeTransactionRequest(list_of_note_ids: string[]): TransactionRequest;
1751
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;
1752
3752
  /**
1753
- * 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.
1754
3759
  */
1755
- 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;
1756
3763
  /**
1757
- * Fetch private notes from the note transport layer
1758
- *
1759
- * 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.
1760
3766
  */
1761
- fetchPrivateNotes(): Promise<void>;
3767
+ createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<any>;
1762
3768
  /**
1763
- * 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`.
1764
3780
  *
1765
- * Fetches all notes stored in the transport layer, with no pagination.
1766
- * Prefer using [`WebClient::fetch_private_notes`] for a more efficient, on-going,
1767
- * 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.
1768
3786
  */
1769
- fetchAllPrivateNotes(): Promise<void>;
1770
- 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>;
1771
3791
  getInputNote(note_id: string): Promise<InputNoteRecord | undefined>;
1772
- getOutputNotes(filter: NoteFilter): Promise<any>;
1773
- 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[]>;
1774
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>;
1775
3827
  /**
1776
3828
  * Retrieves the setting value for `key`, or `None` if it hasn’t been set.
1777
3829
  */
@@ -1788,39 +3840,80 @@ export class WebClient {
1788
3840
  * Returns all the existing setting keys from the store.
1789
3841
  */
1790
3842
  listSettingKeys(): Promise<string[]>;
1791
- syncState(): Promise<SyncSummary>;
1792
- getSyncHeight(): Promise<number>;
1793
- static buildSwapTag(note_type: NoteType, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint): NoteTag;
1794
- addTag(tag: string): Promise<void>;
1795
- removeTag(tag: string): Promise<void>;
1796
- listTags(): Promise<any>;
1797
- getTransactions(transaction_filter: TransactionFilter): Promise<TransactionRecord[]>;
1798
- constructor();
1799
3843
  /**
1800
- * Creates a new client with the given node URL and optional seed.
1801
- * 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.
1802
3853
  */
1803
- 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>;
1804
3855
  /**
1805
- * Creates a new client with the given node URL, optional seed, and external keystore
1806
- * 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`.
1807
3863
  */
1808
- 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>;
1809
- 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();
1810
3882
  }
1811
3883
  export class Word {
1812
3884
  free(): void;
1813
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
+ */
1814
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;
1815
3906
  /**
1816
3907
  * Creates a Word from a hex string.
1817
3908
  * Fails if the provided string is not a valid hex representation of a Word.
1818
3909
  */
1819
3910
  static fromHex(hex: string): Word;
1820
- static newFromFelts(felt_vec: Felt[]): Word;
1821
- toHex(): string;
1822
- serialize(): Uint8Array;
1823
- static deserialize(bytes: Uint8Array): Word;
1824
- toU64s(): BigUint64Array;
3911
+ /**
3912
+ * Returns the word as an array of field elements.
3913
+ */
1825
3914
  toFelts(): Felt[];
3915
+ /**
3916
+ * Serializes the word into bytes.
3917
+ */
3918
+ serialize(): Uint8Array;
1826
3919
  }