@miden-sdk/miden-sdk 0.13.0-next.1

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.
@@ -0,0 +1,1826 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export enum AccountInterface {
4
+ BasicWallet = 0,
5
+ }
6
+ export enum AccountType {
7
+ FungibleFaucet = 0,
8
+ NonFungibleFaucet = 1,
9
+ RegularAccountImmutableCode = 2,
10
+ RegularAccountUpdatableCode = 3,
11
+ }
12
+ export enum InputNoteState {
13
+ Expected = 0,
14
+ Unverified = 1,
15
+ Committed = 2,
16
+ Invalid = 3,
17
+ ProcessingAuthenticated = 4,
18
+ ProcessingUnauthenticated = 5,
19
+ ConsumedAuthenticatedLocal = 6,
20
+ ConsumedUnauthenticatedLocal = 7,
21
+ ConsumedExternal = 8,
22
+ }
23
+ export enum NetworkId {
24
+ Mainnet = 0,
25
+ Testnet = 1,
26
+ Devnet = 2,
27
+ }
28
+ export enum NoteFilterTypes {
29
+ All = 0,
30
+ Consumed = 1,
31
+ Committed = 2,
32
+ Expected = 3,
33
+ Processing = 4,
34
+ List = 5,
35
+ Unique = 6,
36
+ Nullifiers = 7,
37
+ Unverified = 8,
38
+ }
39
+ export enum NoteType {
40
+ /**
41
+ * Notes with this type have only their hash published to the network.
42
+ */
43
+ Private = 2,
44
+ /**
45
+ * Notes with this type are shared with the network encrypted.
46
+ */
47
+ Encrypted = 3,
48
+ /**
49
+ * Notes with this type are fully shared with the network.
50
+ */
51
+ Public = 1,
52
+ }
53
+ export enum SigningInputsType {
54
+ TransactionSummary = 0,
55
+ Arbitrary = 1,
56
+ Blind = 2,
57
+ }
58
+ /**
59
+ * Specifies which procedures an account accepts, and by extension which notes it can consume.
60
+ */
61
+ type AddressInterface = "BasicWallet";
62
+ /**
63
+ * The `ReadableStreamType` enum.
64
+ *
65
+ * *This API requires the following crate features to be activated: `ReadableStreamType`*
66
+ */
67
+ type ReadableStreamType = "bytes";
68
+ export class Account {
69
+ private constructor();
70
+ free(): void;
71
+ [Symbol.dispose](): void;
72
+ id(): AccountId;
73
+ commitment(): Word;
74
+ nonce(): Felt;
75
+ vault(): AssetVault;
76
+ storage(): AccountStorage;
77
+ code(): AccountCode;
78
+ isFaucet(): boolean;
79
+ isRegularAccount(): boolean;
80
+ isUpdatable(): boolean;
81
+ isPublic(): boolean;
82
+ isPrivate(): boolean;
83
+ isNetwork(): boolean;
84
+ isNew(): boolean;
85
+ serialize(): Uint8Array;
86
+ static deserialize(bytes: Uint8Array): Account;
87
+ getPublicKeys(): Word[];
88
+ }
89
+ export class AccountArray {
90
+ /**
91
+ ** Return copy of self without private attributes.
92
+ */
93
+ toJSON(): Object;
94
+ /**
95
+ * Return stringified version of self.
96
+ */
97
+ toString(): string;
98
+ free(): void;
99
+ [Symbol.dispose](): void;
100
+ constructor(elements?: Account[] | null);
101
+ /**
102
+ * Get element at index, will always return a clone to avoid aliasing issues.
103
+ */
104
+ get(index: number): Account;
105
+ replaceAt(index: number, elem: Account): void;
106
+ push(element: Account): void;
107
+ length(): number;
108
+ }
109
+ export class AccountBuilder {
110
+ free(): void;
111
+ [Symbol.dispose](): void;
112
+ constructor(init_seed: Uint8Array);
113
+ accountType(account_type: AccountType): AccountBuilder;
114
+ storageMode(storage_mode: AccountStorageMode): AccountBuilder;
115
+ withComponent(account_component: AccountComponent): AccountBuilder;
116
+ withAuthComponent(account_component: AccountComponent): AccountBuilder;
117
+ withNoAuthComponent(): AccountBuilder;
118
+ withBasicWalletComponent(): AccountBuilder;
119
+ build(): AccountBuilderResult;
120
+ }
121
+ export class AccountBuilderResult {
122
+ private constructor();
123
+ free(): void;
124
+ [Symbol.dispose](): void;
125
+ readonly account: Account;
126
+ readonly seed: Word;
127
+ }
128
+ export class AccountCode {
129
+ private constructor();
130
+ free(): void;
131
+ [Symbol.dispose](): void;
132
+ commitment(): Word;
133
+ hasProcedure(mast_root: Word): boolean;
134
+ }
135
+ export class AccountComponent {
136
+ private constructor();
137
+ free(): void;
138
+ [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;
145
+ static fromPackage(_package: Package, storage_slots: StorageSlotArray): AccountComponent;
146
+ }
147
+ export class AccountDelta {
148
+ private constructor();
149
+ free(): void;
150
+ [Symbol.dispose](): void;
151
+ serialize(): Uint8Array;
152
+ static deserialize(bytes: Uint8Array): AccountDelta;
153
+ id(): AccountId;
154
+ isEmpty(): boolean;
155
+ storage(): AccountStorageDelta;
156
+ vault(): AccountVaultDelta;
157
+ nonceDelta(): Felt;
158
+ }
159
+ export class AccountFile {
160
+ private constructor();
161
+ free(): void;
162
+ [Symbol.dispose](): void;
163
+ /**
164
+ * Serializes the `AccountFile` into a byte array
165
+ */
166
+ serialize(): Uint8Array;
167
+ /**
168
+ * Deserializes a byte array into an `AccountFile`
169
+ */
170
+ static deserialize(bytes: Uint8Array): AccountFile;
171
+ }
172
+ export class AccountHeader {
173
+ private constructor();
174
+ free(): void;
175
+ [Symbol.dispose](): void;
176
+ commitment(): Word;
177
+ id(): AccountId;
178
+ nonce(): Felt;
179
+ vaultCommitment(): Word;
180
+ storageCommitment(): Word;
181
+ codeCommitment(): Word;
182
+ }
183
+ export class AccountId {
184
+ private constructor();
185
+ free(): void;
186
+ [Symbol.dispose](): void;
187
+ static fromHex(hex: string): AccountId;
188
+ isFaucet(): boolean;
189
+ isRegularAccount(): boolean;
190
+ isPublic(): boolean;
191
+ isPrivate(): boolean;
192
+ isNetwork(): boolean;
193
+ toString(): string;
194
+ /**
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`.
199
+ */
200
+ toBech32(network_id: NetworkId, account_interface: AccountInterface): string;
201
+ /**
202
+ * Turn this Account ID into its bech32 string representation. This method accepts a custom
203
+ * network ID.
204
+ */
205
+ toBech32Custom(custom_network_id: string, account_interface: AccountInterface): string;
206
+ prefix(): Felt;
207
+ suffix(): Felt;
208
+ }
209
+ export class AccountIdArray {
210
+ /**
211
+ ** Return copy of self without private attributes.
212
+ */
213
+ toJSON(): Object;
214
+ /**
215
+ * Return stringified version of self.
216
+ */
217
+ toString(): string;
218
+ free(): void;
219
+ [Symbol.dispose](): void;
220
+ constructor(elements?: AccountId[] | null);
221
+ /**
222
+ * Get element at index, will always return a clone to avoid aliasing issues.
223
+ */
224
+ get(index: number): AccountId;
225
+ replaceAt(index: number, elem: AccountId): void;
226
+ push(element: AccountId): void;
227
+ length(): number;
228
+ }
229
+ export class AccountStorage {
230
+ private constructor();
231
+ free(): void;
232
+ [Symbol.dispose](): void;
233
+ commitment(): Word;
234
+ getItem(index: number): Word | undefined;
235
+ getMapItem(index: number, key: Word): Word | undefined;
236
+ /**
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).
239
+ * Returns `[]` if the map exists but is empty.
240
+ */
241
+ getMapEntries(index: number): JsStorageMapEntry[] | undefined;
242
+ }
243
+ export class AccountStorageDelta {
244
+ private constructor();
245
+ free(): void;
246
+ [Symbol.dispose](): void;
247
+ serialize(): Uint8Array;
248
+ static deserialize(bytes: Uint8Array): AccountStorageDelta;
249
+ isEmpty(): boolean;
250
+ values(): Word[];
251
+ }
252
+ export class AccountStorageMode {
253
+ private constructor();
254
+ free(): void;
255
+ [Symbol.dispose](): void;
256
+ static private(): AccountStorageMode;
257
+ static public(): AccountStorageMode;
258
+ static network(): AccountStorageMode;
259
+ static tryFromStr(s: string): AccountStorageMode;
260
+ asStr(): string;
261
+ }
262
+ export class AccountStorageRequirements {
263
+ free(): void;
264
+ [Symbol.dispose](): void;
265
+ constructor();
266
+ static fromSlotAndKeysArray(slots_and_keys: SlotAndKeys[]): AccountStorageRequirements;
267
+ }
268
+ export class AccountVaultDelta {
269
+ private constructor();
270
+ free(): void;
271
+ [Symbol.dispose](): void;
272
+ serialize(): Uint8Array;
273
+ static deserialize(bytes: Uint8Array): AccountVaultDelta;
274
+ isEmpty(): boolean;
275
+ fungible(): FungibleAssetDelta;
276
+ addedFungibleAssets(): FungibleAsset[];
277
+ removedFungibleAssets(): FungibleAsset[];
278
+ }
279
+ export class Address {
280
+ private constructor();
281
+ /**
282
+ ** Return copy of self without private attributes.
283
+ */
284
+ toJSON(): Object;
285
+ /**
286
+ * Return stringified version of self.
287
+ */
288
+ toString(): string;
289
+ free(): void;
290
+ [Symbol.dispose](): void;
291
+ static fromAccountId(account_id: AccountId, _interface?: string | null): Address;
292
+ static fromBech32(bech32: string): Address;
293
+ interface(): AddressInterface;
294
+ accountId(): AccountId;
295
+ toNoteTag(): NoteTag;
296
+ toBech32(network_id: NetworkId): string;
297
+ }
298
+ export class AdviceInputs {
299
+ private constructor();
300
+ free(): void;
301
+ [Symbol.dispose](): void;
302
+ stack(): Felt[];
303
+ mappedValues(key: Word): Felt[] | undefined;
304
+ }
305
+ export class AdviceMap {
306
+ free(): void;
307
+ [Symbol.dispose](): void;
308
+ constructor();
309
+ insert(key: Word, value: FeltArray): Felt[] | undefined;
310
+ }
311
+ export class AssetVault {
312
+ private constructor();
313
+ free(): void;
314
+ [Symbol.dispose](): void;
315
+ root(): Word;
316
+ getBalance(faucet_id: AccountId): bigint;
317
+ fungibleAssets(): FungibleAsset[];
318
+ }
319
+ export class AuthSecretKey {
320
+ private constructor();
321
+ free(): void;
322
+ [Symbol.dispose](): void;
323
+ getRpoFalcon512PublicKeyAsWord(): Word;
324
+ getRpoFalcon512SecretKeyAsFelts(): Felt[];
325
+ getEcdsaK256KeccakPublicKeyAsWord(): Word;
326
+ getEcdsaK256KeccakSecretKeyAsFelts(): Felt[];
327
+ }
328
+ export class BasicFungibleFaucetComponent {
329
+ private constructor();
330
+ free(): void;
331
+ [Symbol.dispose](): void;
332
+ static fromAccount(account: Account): BasicFungibleFaucetComponent;
333
+ symbol(): TokenSymbol;
334
+ decimals(): number;
335
+ maxSupply(): Felt;
336
+ }
337
+ export class BlockHeader {
338
+ private constructor();
339
+ free(): void;
340
+ [Symbol.dispose](): void;
341
+ version(): number;
342
+ commitment(): Word;
343
+ subCommitment(): Word;
344
+ prevBlockCommitment(): Word;
345
+ blockNum(): number;
346
+ chainCommitment(): Word;
347
+ accountRoot(): Word;
348
+ nullifierRoot(): Word;
349
+ noteRoot(): Word;
350
+ txCommitment(): Word;
351
+ txKernelCommitment(): Word;
352
+ proofCommitment(): Word;
353
+ timestamp(): number;
354
+ }
355
+ export class ConsumableNoteRecord {
356
+ free(): void;
357
+ [Symbol.dispose](): void;
358
+ constructor(input_note_record: InputNoteRecord, note_consumability: NoteConsumability[]);
359
+ inputNoteRecord(): InputNoteRecord;
360
+ noteConsumability(): NoteConsumability[];
361
+ }
362
+ /**
363
+ * Represents a network endpoint for connecting to Miden nodes.
364
+ *
365
+ * An endpoint consists of a protocol (http/https), host, and optional port.
366
+ * Provides convenient constructors for common network configurations.
367
+ */
368
+ export class Endpoint {
369
+ free(): void;
370
+ [Symbol.dispose](): void;
371
+ /**
372
+ * Creates an endpoint from a URL string.
373
+ *
374
+ * @param url - The URL string (e.g., <https://localhost:57291>)
375
+ * @throws throws an error if the URL is invalid
376
+ */
377
+ constructor(url: string);
378
+ /**
379
+ * Returns the endpoint for the Miden testnet.
380
+ */
381
+ static testnet(): Endpoint;
382
+ /**
383
+ * Returns the endpoint for the Miden devnet.
384
+ */
385
+ static devnet(): Endpoint;
386
+ /**
387
+ * Returns the endpoint for a local Miden node.
388
+ *
389
+ * Uses <http://localhost:57291>
390
+ */
391
+ static localhost(): Endpoint;
392
+ /**
393
+ * Returns the string representation of the endpoint.
394
+ */
395
+ toString(): string;
396
+ /**
397
+ * Returns the protocol of the endpoint.
398
+ */
399
+ readonly protocol: string;
400
+ /**
401
+ * Returns the host of the endpoint.
402
+ */
403
+ readonly host: string;
404
+ /**
405
+ * Returns the port of the endpoint.
406
+ */
407
+ readonly port: number | undefined;
408
+ }
409
+ export class ExecutedTransaction {
410
+ private constructor();
411
+ free(): void;
412
+ [Symbol.dispose](): void;
413
+ id(): TransactionId;
414
+ accountId(): AccountId;
415
+ initialAccountHeader(): AccountHeader;
416
+ finalAccountHeader(): AccountHeader;
417
+ inputNotes(): InputNotes;
418
+ outputNotes(): OutputNotes;
419
+ txArgs(): TransactionArgs;
420
+ blockHeader(): BlockHeader;
421
+ accountDelta(): AccountDelta;
422
+ }
423
+ export class Felt {
424
+ free(): void;
425
+ [Symbol.dispose](): void;
426
+ constructor(value: bigint);
427
+ asInt(): bigint;
428
+ toString(): string;
429
+ }
430
+ export class FeltArray {
431
+ /**
432
+ ** Return copy of self without private attributes.
433
+ */
434
+ toJSON(): Object;
435
+ /**
436
+ * Return stringified version of self.
437
+ */
438
+ toString(): string;
439
+ free(): void;
440
+ [Symbol.dispose](): void;
441
+ constructor(elements?: Felt[] | null);
442
+ /**
443
+ * Get element at index, will always return a clone to avoid aliasing issues.
444
+ */
445
+ get(index: number): Felt;
446
+ replaceAt(index: number, elem: Felt): void;
447
+ push(element: Felt): void;
448
+ length(): number;
449
+ }
450
+ /**
451
+ * Represents a note fetched from a Miden node via RPC.
452
+ */
453
+ export class FetchedNote {
454
+ free(): void;
455
+ [Symbol.dispose](): void;
456
+ /**
457
+ * Create a note with an optional `InputNote`.
458
+ */
459
+ constructor(note_id: NoteId, metadata: NoteMetadata, input_note?: InputNote | null);
460
+ /**
461
+ * The unique identifier of the note.
462
+ */
463
+ readonly noteId: NoteId;
464
+ /**
465
+ * The note's metadata, including sender, tag, and other properties.
466
+ * Available for both private and public notes.
467
+ */
468
+ readonly metadata: NoteMetadata;
469
+ /**
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`.
474
+ */
475
+ readonly inputNote: InputNote | undefined;
476
+ readonly noteType: NoteType;
477
+ }
478
+ export class FlattenedU8Vec {
479
+ private constructor();
480
+ free(): void;
481
+ [Symbol.dispose](): void;
482
+ data(): Uint8Array;
483
+ lengths(): Uint32Array;
484
+ num_inner_vecs(): number;
485
+ }
486
+ export class ForeignAccount {
487
+ private constructor();
488
+ free(): void;
489
+ [Symbol.dispose](): void;
490
+ static public(account_id: AccountId, storage_requirements: AccountStorageRequirements): ForeignAccount;
491
+ storage_slot_requirements(): AccountStorageRequirements;
492
+ account_id(): AccountId;
493
+ }
494
+ export class ForeignAccountArray {
495
+ /**
496
+ ** Return copy of self without private attributes.
497
+ */
498
+ toJSON(): Object;
499
+ /**
500
+ * Return stringified version of self.
501
+ */
502
+ toString(): string;
503
+ free(): void;
504
+ [Symbol.dispose](): void;
505
+ constructor(elements?: ForeignAccount[] | null);
506
+ /**
507
+ * Get element at index, will always return a clone to avoid aliasing issues.
508
+ */
509
+ get(index: number): ForeignAccount;
510
+ replaceAt(index: number, elem: ForeignAccount): void;
511
+ push(element: ForeignAccount): void;
512
+ length(): number;
513
+ }
514
+ export class FungibleAsset {
515
+ free(): void;
516
+ [Symbol.dispose](): void;
517
+ constructor(faucet_id: AccountId, amount: bigint);
518
+ faucetId(): AccountId;
519
+ amount(): bigint;
520
+ intoWord(): Word;
521
+ }
522
+ export class FungibleAssetDelta {
523
+ private constructor();
524
+ free(): void;
525
+ [Symbol.dispose](): void;
526
+ serialize(): Uint8Array;
527
+ static deserialize(bytes: Uint8Array): FungibleAssetDelta;
528
+ isEmpty(): boolean;
529
+ amount(faucet_id: AccountId): bigint | undefined;
530
+ numAssets(): number;
531
+ assets(): FungibleAssetDeltaItem[];
532
+ }
533
+ export class FungibleAssetDeltaItem {
534
+ private constructor();
535
+ free(): void;
536
+ [Symbol.dispose](): void;
537
+ readonly faucetId: AccountId;
538
+ readonly amount: bigint;
539
+ }
540
+ export class GetProceduresResultItem {
541
+ private constructor();
542
+ free(): void;
543
+ [Symbol.dispose](): void;
544
+ readonly digest: Word;
545
+ readonly isAuth: boolean;
546
+ }
547
+ export class InputNote {
548
+ private constructor();
549
+ free(): void;
550
+ [Symbol.dispose](): void;
551
+ id(): NoteId;
552
+ note(): Note;
553
+ commitment(): Word;
554
+ proof(): NoteInclusionProof | undefined;
555
+ location(): NoteLocation | undefined;
556
+ }
557
+ export class InputNoteRecord {
558
+ private constructor();
559
+ free(): void;
560
+ [Symbol.dispose](): void;
561
+ id(): NoteId;
562
+ state(): InputNoteState;
563
+ details(): NoteDetails;
564
+ metadata(): NoteMetadata | undefined;
565
+ commitment(): Word | undefined;
566
+ inclusionProof(): NoteInclusionProof | undefined;
567
+ consumerTransactionId(): string | undefined;
568
+ nullifier(): string;
569
+ isAuthenticated(): boolean;
570
+ isConsumed(): boolean;
571
+ isProcessing(): boolean;
572
+ toInputNote(): InputNote;
573
+ }
574
+ export class InputNotes {
575
+ private constructor();
576
+ free(): void;
577
+ [Symbol.dispose](): void;
578
+ commitment(): Word;
579
+ numNotes(): number;
580
+ isEmpty(): boolean;
581
+ getNote(index: number): InputNote;
582
+ notes(): InputNote[];
583
+ }
584
+ export class IntoUnderlyingByteSource {
585
+ private constructor();
586
+ free(): void;
587
+ [Symbol.dispose](): void;
588
+ start(controller: ReadableByteStreamController): void;
589
+ pull(controller: ReadableByteStreamController): Promise<any>;
590
+ cancel(): void;
591
+ readonly type: ReadableStreamType;
592
+ readonly autoAllocateChunkSize: number;
593
+ }
594
+ export class IntoUnderlyingSink {
595
+ private constructor();
596
+ free(): void;
597
+ [Symbol.dispose](): void;
598
+ write(chunk: any): Promise<any>;
599
+ close(): Promise<any>;
600
+ abort(reason: any): Promise<any>;
601
+ }
602
+ export class IntoUnderlyingSource {
603
+ private constructor();
604
+ free(): void;
605
+ [Symbol.dispose](): void;
606
+ pull(controller: ReadableStreamDefaultController): Promise<any>;
607
+ cancel(): void;
608
+ }
609
+ /**
610
+ * Represents an update to a single account's state.
611
+ */
612
+ export class JsAccountUpdate {
613
+ private constructor();
614
+ /**
615
+ ** Return copy of self without private attributes.
616
+ */
617
+ toJSON(): Object;
618
+ /**
619
+ * Return stringified version of self.
620
+ */
621
+ toString(): string;
622
+ free(): void;
623
+ [Symbol.dispose](): void;
624
+ /**
625
+ * The merkle root of the account's storage trie.
626
+ */
627
+ storageRoot: string;
628
+ /**
629
+ * Serialized storage slot data for this account.
630
+ */
631
+ storageSlots: JsStorageSlot[];
632
+ /**
633
+ * Serialized storage map entries for this account.
634
+ */
635
+ storageMapEntries: JsStorageMapEntry[];
636
+ /**
637
+ * The merkle root of the account's asset vault.
638
+ */
639
+ assetVaultRoot: string;
640
+ /**
641
+ * The account's asset vault.
642
+ */
643
+ assets: JsVaultAsset[];
644
+ /**
645
+ * ID for this account.
646
+ */
647
+ accountId: string;
648
+ /**
649
+ * The merkle root of the account's executable code.
650
+ */
651
+ codeRoot: string;
652
+ /**
653
+ * Whether this account update has been committed.
654
+ */
655
+ committed: boolean;
656
+ /**
657
+ * The account's transaction nonce as a string.
658
+ */
659
+ nonce: string;
660
+ /**
661
+ * The cryptographic commitment representing this account's current state.
662
+ */
663
+ accountCommitment: string;
664
+ /**
665
+ * Optional seed data for the account.
666
+ */
667
+ get accountSeed(): Uint8Array | undefined;
668
+ /**
669
+ * Optional seed data for the account.
670
+ */
671
+ set accountSeed(value: Uint8Array | null | undefined);
672
+ }
673
+ /**
674
+ * An object that contains data for a sync update,
675
+ * which will be received by the applyStateSync JS function.
676
+ * under sync.js
677
+ */
678
+ export class JsStateSyncUpdate {
679
+ private constructor();
680
+ free(): void;
681
+ [Symbol.dispose](): void;
682
+ /**
683
+ * The block number for this update, stored as a string since it will be
684
+ * persisted in `IndexedDB`.
685
+ */
686
+ blockNum: string;
687
+ /**
688
+ * The new block headers for this state update, serialized into a flattened byte array.
689
+ */
690
+ flattenedNewBlockHeaders: FlattenedU8Vec;
691
+ /**
692
+ * The block numbers corresponding to each header in `flattened_new_block_headers`.
693
+ * This vec should have the same length as the number of headers, with each index
694
+ * representing the block number for the header at that same index.
695
+ */
696
+ newBlockNums: string[];
697
+ /**
698
+ * Flattened byte array containing partial blockchain peaks used for merkle tree
699
+ * verification.
700
+ */
701
+ flattenedPartialBlockChainPeaks: FlattenedU8Vec;
702
+ /**
703
+ * For each block in this update, stores a boolean (as u8) indicating whether
704
+ * that block contains notes relevant to this client. Index i corresponds to
705
+ * the ith block, with 1 meaning relevant and 0 meaning not relevant.
706
+ */
707
+ blockHasRelevantNotes: Uint8Array;
708
+ /**
709
+ * Serialized IDs for new authentication nodes required to verify block headers.
710
+ */
711
+ serializedNodeIds: string[];
712
+ /**
713
+ * The actual authentication node data corresponding to the IDs above.
714
+ */
715
+ serializedNodes: string[];
716
+ /**
717
+ * IDs of note tags that should be removed from the client's local state.
718
+ */
719
+ committedNoteIds: string[];
720
+ /**
721
+ * Input notes for this state update in serialized form.
722
+ */
723
+ serializedInputNotes: SerializedInputNoteData[];
724
+ /**
725
+ * Output notes created in this state update in serialized form.
726
+ */
727
+ serializedOutputNotes: SerializedOutputNoteData[];
728
+ /**
729
+ * Account state updates included in this sync.
730
+ */
731
+ accountUpdates: JsAccountUpdate[];
732
+ /**
733
+ * Transaction data for transactions included in this update.
734
+ */
735
+ transactionUpdates: SerializedTransactionData[];
736
+ }
737
+ /**
738
+ * A JavaScript representation of a storage map entry in an account.
739
+ */
740
+ export class JsStorageMapEntry {
741
+ private constructor();
742
+ /**
743
+ ** Return copy of self without private attributes.
744
+ */
745
+ toJSON(): Object;
746
+ /**
747
+ * Return stringified version of self.
748
+ */
749
+ toString(): string;
750
+ free(): void;
751
+ [Symbol.dispose](): void;
752
+ /**
753
+ * The root of the storage map entry.
754
+ */
755
+ root: string;
756
+ /**
757
+ * The key of the storage map entry.
758
+ */
759
+ key: string;
760
+ /**
761
+ * The value of the storage map entry.
762
+ */
763
+ value: string;
764
+ }
765
+ /**
766
+ * A JavaScript representation of a storage slot in an account.
767
+ */
768
+ export class JsStorageSlot {
769
+ private constructor();
770
+ /**
771
+ ** Return copy of self without private attributes.
772
+ */
773
+ toJSON(): Object;
774
+ /**
775
+ * Return stringified version of self.
776
+ */
777
+ toString(): string;
778
+ free(): void;
779
+ [Symbol.dispose](): void;
780
+ /**
781
+ * Commitment of the whole account storage
782
+ */
783
+ commitment: string;
784
+ /**
785
+ * The index of the storage slot.
786
+ */
787
+ slotIndex: number;
788
+ /**
789
+ * The value stored in the storage slot.
790
+ */
791
+ slotValue: string;
792
+ /**
793
+ * The type of the storage slot.
794
+ */
795
+ slotType: number;
796
+ }
797
+ /**
798
+ * An object that contains a serialized vault asset
799
+ */
800
+ export class JsVaultAsset {
801
+ private constructor();
802
+ /**
803
+ ** Return copy of self without private attributes.
804
+ */
805
+ toJSON(): Object;
806
+ /**
807
+ * Return stringified version of self.
808
+ */
809
+ toString(): string;
810
+ free(): void;
811
+ [Symbol.dispose](): void;
812
+ /**
813
+ * The merkle root of the vault's assets.
814
+ */
815
+ root: string;
816
+ /**
817
+ * The vault key associated with the asset.
818
+ */
819
+ vaultKey: string;
820
+ /**
821
+ * Asset's faucet ID prefix.
822
+ */
823
+ faucetIdPrefix: string;
824
+ /**
825
+ * Word representing the asset.
826
+ */
827
+ asset: string;
828
+ }
829
+ export class Library {
830
+ private constructor();
831
+ free(): void;
832
+ [Symbol.dispose](): void;
833
+ }
834
+ export class MerklePath {
835
+ private constructor();
836
+ free(): void;
837
+ [Symbol.dispose](): void;
838
+ depth(): number;
839
+ nodes(): Word[];
840
+ computeRoot(index: bigint, node: Word): Word;
841
+ verify(index: bigint, node: Word, root: Word): boolean;
842
+ }
843
+ export class Note {
844
+ free(): void;
845
+ [Symbol.dispose](): void;
846
+ constructor(note_assets: NoteAssets, note_metadata: NoteMetadata, note_recipient: NoteRecipient);
847
+ serialize(): Uint8Array;
848
+ static deserialize(bytes: Uint8Array): Note;
849
+ id(): NoteId;
850
+ commitment(): Word;
851
+ metadata(): NoteMetadata;
852
+ recipient(): NoteRecipient;
853
+ assets(): NoteAssets;
854
+ 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;
857
+ }
858
+ export class NoteAndArgs {
859
+ free(): void;
860
+ [Symbol.dispose](): void;
861
+ constructor(note: Note, args?: Word | null);
862
+ }
863
+ export class NoteAndArgsArray {
864
+ /**
865
+ ** Return copy of self without private attributes.
866
+ */
867
+ toJSON(): Object;
868
+ /**
869
+ * Return stringified version of self.
870
+ */
871
+ toString(): string;
872
+ free(): void;
873
+ [Symbol.dispose](): void;
874
+ constructor(elements?: NoteAndArgs[] | null);
875
+ /**
876
+ * Get element at index, will always return a clone to avoid aliasing issues.
877
+ */
878
+ get(index: number): NoteAndArgs;
879
+ replaceAt(index: number, elem: NoteAndArgs): void;
880
+ push(element: NoteAndArgs): void;
881
+ length(): number;
882
+ }
883
+ export class NoteAssets {
884
+ free(): void;
885
+ [Symbol.dispose](): void;
886
+ constructor(assets_array?: FungibleAsset[] | null);
887
+ push(asset: FungibleAsset): void;
888
+ fungibleAssets(): FungibleAsset[];
889
+ }
890
+ export class NoteConsumability {
891
+ private constructor();
892
+ free(): void;
893
+ [Symbol.dispose](): void;
894
+ accountId(): AccountId;
895
+ consumableAfterBlock(): number | undefined;
896
+ }
897
+ export class NoteDetails {
898
+ free(): void;
899
+ [Symbol.dispose](): void;
900
+ constructor(note_assets: NoteAssets, note_recipient: NoteRecipient);
901
+ id(): NoteId;
902
+ assets(): NoteAssets;
903
+ recipient(): NoteRecipient;
904
+ }
905
+ export class NoteDetailsAndTag {
906
+ free(): void;
907
+ [Symbol.dispose](): void;
908
+ constructor(note_details: NoteDetails, tag: NoteTag);
909
+ readonly noteDetails: NoteDetails;
910
+ readonly tag: NoteTag;
911
+ }
912
+ export class NoteDetailsAndTagArray {
913
+ /**
914
+ ** Return copy of self without private attributes.
915
+ */
916
+ toJSON(): Object;
917
+ /**
918
+ * Return stringified version of self.
919
+ */
920
+ toString(): string;
921
+ free(): void;
922
+ [Symbol.dispose](): void;
923
+ constructor(elements?: NoteDetailsAndTag[] | null);
924
+ /**
925
+ * Get element at index, will always return a clone to avoid aliasing issues.
926
+ */
927
+ get(index: number): NoteDetailsAndTag;
928
+ replaceAt(index: number, elem: NoteDetailsAndTag): void;
929
+ push(element: NoteDetailsAndTag): void;
930
+ length(): number;
931
+ }
932
+ export class NoteExecutionHint {
933
+ private constructor();
934
+ free(): void;
935
+ [Symbol.dispose](): void;
936
+ static none(): NoteExecutionHint;
937
+ static always(): NoteExecutionHint;
938
+ static afterBlock(block_num: number): NoteExecutionHint;
939
+ static onBlockSlot(epoch_len: number, slot_len: number, slot_offset: number): NoteExecutionHint;
940
+ static fromParts(tag: number, payload: number): NoteExecutionHint;
941
+ 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;
950
+ }
951
+ /**
952
+ * A serialized representation of a note.
953
+ */
954
+ export class NoteFile {
955
+ private constructor();
956
+ /**
957
+ ** Return copy of self without private attributes.
958
+ */
959
+ toJSON(): Object;
960
+ /**
961
+ * Return stringified version of self.
962
+ */
963
+ toString(): string;
964
+ free(): void;
965
+ [Symbol.dispose](): void;
966
+ /**
967
+ * Returns this `NoteFile`'s types.
968
+ */
969
+ noteType(): string;
970
+ /**
971
+ * Turn a notefile into its byte representation.
972
+ */
973
+ serialize(): Uint8Array;
974
+ /**
975
+ * Given a valid byte representation of a `NoteFile`,
976
+ * return it as a struct.
977
+ */
978
+ static deserialize(bytes: Uint8Array): NoteFile;
979
+ static fromInputNote(note: InputNote): NoteFile;
980
+ static fromOutputNote(note: OutputNote): NoteFile;
981
+ static fromNoteDetails(note_details: NoteDetails): NoteFile;
982
+ static fromNoteId(note_details: NoteId): NoteFile;
983
+ }
984
+ export class NoteFilter {
985
+ free(): void;
986
+ [Symbol.dispose](): void;
987
+ constructor(note_type: NoteFilterTypes, note_ids?: NoteId[] | null);
988
+ }
989
+ export class NoteHeader {
990
+ private constructor();
991
+ free(): void;
992
+ [Symbol.dispose](): void;
993
+ id(): NoteId;
994
+ metadata(): NoteMetadata;
995
+ commitment(): Word;
996
+ }
997
+ export class NoteId {
998
+ free(): void;
999
+ [Symbol.dispose](): void;
1000
+ constructor(recipient_digest: Word, asset_commitment_digest: Word);
1001
+ static fromHex(hex: string): NoteId;
1002
+ toString(): string;
1003
+ }
1004
+ export class NoteIdAndArgs {
1005
+ free(): void;
1006
+ [Symbol.dispose](): void;
1007
+ constructor(note_id: NoteId, args?: Word | null);
1008
+ }
1009
+ export class NoteIdAndArgsArray {
1010
+ /**
1011
+ ** Return copy of self without private attributes.
1012
+ */
1013
+ toJSON(): Object;
1014
+ /**
1015
+ * Return stringified version of self.
1016
+ */
1017
+ toString(): string;
1018
+ free(): void;
1019
+ [Symbol.dispose](): void;
1020
+ constructor(elements?: NoteIdAndArgs[] | null);
1021
+ /**
1022
+ * Get element at index, will always return a clone to avoid aliasing issues.
1023
+ */
1024
+ get(index: number): NoteIdAndArgs;
1025
+ replaceAt(index: number, elem: NoteIdAndArgs): void;
1026
+ push(element: NoteIdAndArgs): void;
1027
+ length(): number;
1028
+ }
1029
+ export class NoteInclusionProof {
1030
+ private constructor();
1031
+ free(): void;
1032
+ [Symbol.dispose](): void;
1033
+ location(): NoteLocation;
1034
+ notePath(): MerklePath;
1035
+ }
1036
+ export class NoteInputs {
1037
+ free(): void;
1038
+ [Symbol.dispose](): void;
1039
+ constructor(felt_array: FeltArray);
1040
+ values(): Felt[];
1041
+ }
1042
+ export class NoteLocation {
1043
+ private constructor();
1044
+ free(): void;
1045
+ [Symbol.dispose](): void;
1046
+ blockNum(): number;
1047
+ nodeIndexInBlock(): number;
1048
+ }
1049
+ export class NoteMetadata {
1050
+ free(): void;
1051
+ [Symbol.dispose](): void;
1052
+ constructor(sender: AccountId, note_type: NoteType, note_tag: NoteTag, note_execution_hint: NoteExecutionHint, aux?: Felt | null);
1053
+ sender(): AccountId;
1054
+ tag(): NoteTag;
1055
+ noteType(): NoteType;
1056
+ }
1057
+ export class NoteRecipient {
1058
+ free(): void;
1059
+ [Symbol.dispose](): void;
1060
+ constructor(serial_num: Word, note_script: NoteScript, inputs: NoteInputs);
1061
+ digest(): Word;
1062
+ serialNum(): Word;
1063
+ script(): NoteScript;
1064
+ inputs(): NoteInputs;
1065
+ }
1066
+ export class NoteRecipientArray {
1067
+ /**
1068
+ ** Return copy of self without private attributes.
1069
+ */
1070
+ toJSON(): Object;
1071
+ /**
1072
+ * Return stringified version of self.
1073
+ */
1074
+ toString(): string;
1075
+ free(): void;
1076
+ [Symbol.dispose](): void;
1077
+ constructor(elements?: NoteRecipient[] | null);
1078
+ /**
1079
+ * Get element at index, will always return a clone to avoid aliasing issues.
1080
+ */
1081
+ get(index: number): NoteRecipient;
1082
+ replaceAt(index: number, elem: NoteRecipient): void;
1083
+ push(element: NoteRecipient): void;
1084
+ length(): number;
1085
+ }
1086
+ export class NoteScript {
1087
+ private constructor();
1088
+ free(): void;
1089
+ [Symbol.dispose](): void;
1090
+ /**
1091
+ * Print the MAST source for this script.
1092
+ */
1093
+ toString(): string;
1094
+ serialize(): Uint8Array;
1095
+ static deserialize(bytes: Uint8Array): NoteScript;
1096
+ static p2id(): NoteScript;
1097
+ static p2ide(): NoteScript;
1098
+ static swap(): NoteScript;
1099
+ root(): Word;
1100
+ /**
1101
+ * Creates a `NoteScript` from the given `Package`.
1102
+ * Throws if the package is invalid.
1103
+ */
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
+ static partial(partial_note: PartialNote): OutputNote;
1123
+ static header(note_header: NoteHeader): OutputNote;
1124
+ assets(): NoteAssets | undefined;
1125
+ id(): NoteId;
1126
+ recipientDigest(): Word | undefined;
1127
+ metadata(): NoteMetadata;
1128
+ shrink(): OutputNote;
1129
+ intoFull(): Note | undefined;
1130
+ }
1131
+ export class OutputNoteArray {
1132
+ /**
1133
+ ** Return copy of self without private attributes.
1134
+ */
1135
+ toJSON(): Object;
1136
+ /**
1137
+ * Return stringified version of self.
1138
+ */
1139
+ toString(): string;
1140
+ free(): void;
1141
+ [Symbol.dispose](): void;
1142
+ constructor(elements?: OutputNote[] | null);
1143
+ /**
1144
+ * Get element at index, will always return a clone to avoid aliasing issues.
1145
+ */
1146
+ get(index: number): OutputNote;
1147
+ replaceAt(index: number, elem: OutputNote): void;
1148
+ push(element: OutputNote): void;
1149
+ length(): number;
1150
+ }
1151
+ export class OutputNotes {
1152
+ private constructor();
1153
+ free(): void;
1154
+ [Symbol.dispose](): void;
1155
+ commitment(): Word;
1156
+ numNotes(): number;
1157
+ isEmpty(): boolean;
1158
+ getNote(index: number): OutputNote;
1159
+ notes(): OutputNote[];
1160
+ }
1161
+ export class OutputNotesArray {
1162
+ /**
1163
+ ** Return copy of self without private attributes.
1164
+ */
1165
+ toJSON(): Object;
1166
+ /**
1167
+ * Return stringified version of self.
1168
+ */
1169
+ toString(): string;
1170
+ free(): void;
1171
+ [Symbol.dispose](): void;
1172
+ constructor(elements?: OutputNotes[] | null);
1173
+ /**
1174
+ * Get element at index, will always return a clone to avoid aliasing issues.
1175
+ */
1176
+ get(index: number): OutputNotes;
1177
+ replaceAt(index: number, elem: OutputNotes): void;
1178
+ push(element: OutputNotes): void;
1179
+ length(): number;
1180
+ }
1181
+ export class Package {
1182
+ private constructor();
1183
+ free(): void;
1184
+ [Symbol.dispose](): void;
1185
+ serialize(): Uint8Array;
1186
+ static deserialize(bytes: Uint8Array): Package;
1187
+ /**
1188
+ * Returns the underlying library of a `Package`.
1189
+ * Fails if the package is not a library.
1190
+ */
1191
+ asLibrary(): Library;
1192
+ /**
1193
+ * Returns the underlying program of a `Package`.
1194
+ * Fails if the package is not a program.
1195
+ */
1196
+ asProgram(): Program;
1197
+ }
1198
+ export class PartialNote {
1199
+ private constructor();
1200
+ free(): void;
1201
+ [Symbol.dispose](): void;
1202
+ id(): NoteId;
1203
+ metadata(): NoteMetadata;
1204
+ recipientDigest(): Word;
1205
+ assets(): NoteAssets;
1206
+ }
1207
+ export class Program {
1208
+ private constructor();
1209
+ free(): void;
1210
+ [Symbol.dispose](): void;
1211
+ }
1212
+ /**
1213
+ * WASM wrapper around the native [`ProvenTransaction`].
1214
+ */
1215
+ export class ProvenTransaction {
1216
+ private constructor();
1217
+ free(): void;
1218
+ [Symbol.dispose](): void;
1219
+ /**
1220
+ * Serializes the proven transaction into bytes.
1221
+ */
1222
+ serialize(): Uint8Array;
1223
+ /**
1224
+ * Deserializes a proven transaction from bytes.
1225
+ */
1226
+ static deserialize(bytes: Uint8Array): ProvenTransaction;
1227
+ /**
1228
+ * Returns the transaction ID.
1229
+ */
1230
+ id(): TransactionId;
1231
+ /**
1232
+ * Returns the account ID the transaction was executed against.
1233
+ */
1234
+ accountId(): AccountId;
1235
+ /**
1236
+ * Returns the reference block number used during execution.
1237
+ */
1238
+ refBlockNumber(): number;
1239
+ /**
1240
+ * Returns the block number at which the transaction expires.
1241
+ */
1242
+ expirationBlockNumber(): number;
1243
+ /**
1244
+ * Returns notes created by this transaction.
1245
+ */
1246
+ outputNotes(): OutputNotes;
1247
+ /**
1248
+ * Returns the commitment of the reference block.
1249
+ */
1250
+ refBlockCommitment(): Word;
1251
+ /**
1252
+ * Returns the nullifiers of the consumed input notes.
1253
+ */
1254
+ nullifiers(): Word[];
1255
+ }
1256
+ export class PublicKey {
1257
+ private constructor();
1258
+ free(): void;
1259
+ [Symbol.dispose](): void;
1260
+ serialize(): Uint8Array;
1261
+ static deserialize(bytes: Uint8Array): PublicKey;
1262
+ verify(message: Word, signature: Signature): boolean;
1263
+ toCommitment(): Word;
1264
+ static recoverFrom(message: Word, signature: Signature): PublicKey;
1265
+ verifyData(signing_inputs: SigningInputs, signature: Signature): boolean;
1266
+ }
1267
+ /**
1268
+ * RPC Client for interacting with Miden nodes directly.
1269
+ */
1270
+ export class RpcClient {
1271
+ free(): void;
1272
+ [Symbol.dispose](): void;
1273
+ /**
1274
+ * Creates a new RPC client instance.
1275
+ *
1276
+ * @param endpoint - Endpoint to connect to.
1277
+ */
1278
+ constructor(endpoint: Endpoint);
1279
+ /**
1280
+ * Fetches notes by their IDs from the connected Miden node.
1281
+ *
1282
+ * @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.
1288
+ */
1289
+ getNotesById(note_ids: NoteId[]): Promise<FetchedNote[]>;
1290
+ /**
1291
+ * Fetches a note script by its root hash from the connected Miden node.
1292
+ *
1293
+ * @param `script_root` The root hash of the note script to fetch
1294
+ * @returns Promise that resolves to the `NoteScript`
1295
+ */
1296
+ 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
+ /**
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.
1319
+ */
1320
+ linkModule(module_path: string, module_code: string): void;
1321
+ /**
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.
1328
+ */
1329
+ linkStaticLibrary(library: Library): void;
1330
+ /**
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.
1334
+ *
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'.
1354
+ */
1355
+ buildLibrary(library_path: string, source_code: string): Library;
1356
+ }
1357
+ export class SecretKey {
1358
+ private constructor();
1359
+ free(): void;
1360
+ [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;
1368
+ }
1369
+ export class SerializedInputNoteData {
1370
+ private constructor();
1371
+ free(): void;
1372
+ [Symbol.dispose](): void;
1373
+ noteId: string;
1374
+ noteAssets: Uint8Array;
1375
+ serialNumber: Uint8Array;
1376
+ inputs: Uint8Array;
1377
+ noteScriptRoot: string;
1378
+ noteScript: Uint8Array;
1379
+ nullifier: string;
1380
+ stateDiscriminant: number;
1381
+ state: Uint8Array;
1382
+ createdAt: string;
1383
+ }
1384
+ export class SerializedOutputNoteData {
1385
+ private constructor();
1386
+ free(): void;
1387
+ [Symbol.dispose](): void;
1388
+ noteId: string;
1389
+ noteAssets: Uint8Array;
1390
+ recipientDigest: string;
1391
+ metadata: Uint8Array;
1392
+ get nullifier(): string | undefined;
1393
+ set nullifier(value: string | null | undefined);
1394
+ expectedHeight: number;
1395
+ stateDiscriminant: number;
1396
+ state: Uint8Array;
1397
+ }
1398
+ export class SerializedTransactionData {
1399
+ private constructor();
1400
+ free(): void;
1401
+ [Symbol.dispose](): void;
1402
+ id: string;
1403
+ details: Uint8Array;
1404
+ get scriptRoot(): Uint8Array | undefined;
1405
+ set scriptRoot(value: Uint8Array | null | undefined);
1406
+ get txScript(): Uint8Array | undefined;
1407
+ set txScript(value: Uint8Array | null | undefined);
1408
+ blockNum: string;
1409
+ statusVariant: number;
1410
+ status: Uint8Array;
1411
+ }
1412
+ export class Signature {
1413
+ private constructor();
1414
+ free(): void;
1415
+ [Symbol.dispose](): void;
1416
+ serialize(): Uint8Array;
1417
+ static deserialize(bytes: Uint8Array): Signature;
1418
+ toPreparedSignature(message: Word): Felt[];
1419
+ }
1420
+ export class SigningInputs {
1421
+ private constructor();
1422
+ free(): void;
1423
+ [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;
1429
+ blindPayload(): Word;
1430
+ toCommitment(): Word;
1431
+ toElements(): FeltArray;
1432
+ serialize(): Uint8Array;
1433
+ static deserialize(bytes: Uint8Array): SigningInputs;
1434
+ readonly variantType: SigningInputsType;
1435
+ }
1436
+ export class SlotAndKeys {
1437
+ free(): void;
1438
+ [Symbol.dispose](): void;
1439
+ constructor(storage_slot_index: number, storage_map_keys: Word[]);
1440
+ storage_slot_index(): number;
1441
+ storage_map_keys(): Word[];
1442
+ }
1443
+ export class StorageMap {
1444
+ free(): void;
1445
+ [Symbol.dispose](): void;
1446
+ constructor();
1447
+ insert(key: Word, value: Word): Word;
1448
+ }
1449
+ export class StorageSlot {
1450
+ private constructor();
1451
+ free(): void;
1452
+ [Symbol.dispose](): void;
1453
+ static fromValue(value: Word): StorageSlot;
1454
+ static emptyValue(): StorageSlot;
1455
+ static map(storage_map: StorageMap): StorageSlot;
1456
+ }
1457
+ export class StorageSlotArray {
1458
+ /**
1459
+ ** Return copy of self without private attributes.
1460
+ */
1461
+ toJSON(): Object;
1462
+ /**
1463
+ * Return stringified version of self.
1464
+ */
1465
+ toString(): string;
1466
+ free(): void;
1467
+ [Symbol.dispose](): void;
1468
+ constructor(elements?: StorageSlot[] | null);
1469
+ /**
1470
+ * Get element at index, will always return a clone to avoid aliasing issues.
1471
+ */
1472
+ get(index: number): StorageSlot;
1473
+ replaceAt(index: number, elem: StorageSlot): void;
1474
+ push(element: StorageSlot): void;
1475
+ length(): number;
1476
+ }
1477
+ export class SyncSummary {
1478
+ private constructor();
1479
+ free(): void;
1480
+ [Symbol.dispose](): void;
1481
+ blockNum(): number;
1482
+ committedNotes(): NoteId[];
1483
+ consumedNotes(): NoteId[];
1484
+ updatedAccounts(): AccountId[];
1485
+ committedTransactions(): TransactionId[];
1486
+ serialize(): Uint8Array;
1487
+ static deserialize(bytes: Uint8Array): SyncSummary;
1488
+ }
1489
+ export class TestUtils {
1490
+ private constructor();
1491
+ free(): void;
1492
+ [Symbol.dispose](): void;
1493
+ static createMockAccountId(): AccountId;
1494
+ static createMockSerializedLibraryPackage(): Uint8Array;
1495
+ static createMockSerializedProgramPackage(): Uint8Array;
1496
+ }
1497
+ export class TokenSymbol {
1498
+ free(): void;
1499
+ [Symbol.dispose](): void;
1500
+ constructor(symbol: string);
1501
+ toString(): string;
1502
+ }
1503
+ export class TransactionArgs {
1504
+ private constructor();
1505
+ free(): void;
1506
+ [Symbol.dispose](): void;
1507
+ txScript(): TransactionScript | undefined;
1508
+ getNoteArgs(note_id: NoteId): Word | undefined;
1509
+ adviceInputs(): AdviceInputs;
1510
+ }
1511
+ export class TransactionFilter {
1512
+ private constructor();
1513
+ free(): void;
1514
+ [Symbol.dispose](): void;
1515
+ static all(): TransactionFilter;
1516
+ static ids(ids: TransactionId[]): TransactionFilter;
1517
+ static uncommitted(): TransactionFilter;
1518
+ static expiredBefore(block_num: number): TransactionFilter;
1519
+ }
1520
+ export class TransactionId {
1521
+ private constructor();
1522
+ free(): void;
1523
+ [Symbol.dispose](): void;
1524
+ asElements(): Felt[];
1525
+ asBytes(): Uint8Array;
1526
+ toHex(): string;
1527
+ inner(): Word;
1528
+ }
1529
+ export class TransactionProver {
1530
+ private constructor();
1531
+ free(): void;
1532
+ [Symbol.dispose](): void;
1533
+ static newLocalProver(): TransactionProver;
1534
+ static newRemoteProver(endpoint: string): TransactionProver;
1535
+ serialize(): string;
1536
+ static deserialize(prover_type: string, endpoint?: string | null): TransactionProver;
1537
+ endpoint(): string | undefined;
1538
+ }
1539
+ export class TransactionRecord {
1540
+ private constructor();
1541
+ free(): void;
1542
+ [Symbol.dispose](): void;
1543
+ id(): TransactionId;
1544
+ accountId(): AccountId;
1545
+ initAccountState(): Word;
1546
+ finalAccountState(): Word;
1547
+ inputNoteNullifiers(): Word[];
1548
+ outputNotes(): OutputNotes;
1549
+ blockNum(): number;
1550
+ transactionStatus(): TransactionStatus;
1551
+ creationTimestamp(): bigint;
1552
+ }
1553
+ export class TransactionRequest {
1554
+ private constructor();
1555
+ free(): void;
1556
+ [Symbol.dispose](): void;
1557
+ serialize(): Uint8Array;
1558
+ static deserialize(bytes: Uint8Array): TransactionRequest;
1559
+ expectedOutputOwnNotes(): Note[];
1560
+ expectedFutureNotes(): NoteDetailsAndTag[];
1561
+ scriptArg(): Word | undefined;
1562
+ authArg(): Word | undefined;
1563
+ }
1564
+ export class TransactionRequestBuilder {
1565
+ free(): void;
1566
+ [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;
1574
+ extendAdviceMap(advice_map: AdviceMap): TransactionRequestBuilder;
1575
+ withForeignAccounts(foreign_accounts: ForeignAccountArray): TransactionRequestBuilder;
1576
+ withScriptArg(script_arg: Word): TransactionRequestBuilder;
1577
+ withAuthArg(auth_arg: Word): TransactionRequestBuilder;
1578
+ build(): TransactionRequest;
1579
+ }
1580
+ /**
1581
+ * WASM wrapper around the native [`TransactionResult`].
1582
+ */
1583
+ export class TransactionResult {
1584
+ private constructor();
1585
+ free(): void;
1586
+ [Symbol.dispose](): void;
1587
+ /**
1588
+ * Returns the ID of the transaction.
1589
+ */
1590
+ id(): TransactionId;
1591
+ /**
1592
+ * Returns the executed transaction.
1593
+ */
1594
+ executedTransaction(): ExecutedTransaction;
1595
+ /**
1596
+ * Returns notes that are expected to be created as a result of follow-up executions.
1597
+ */
1598
+ futureNotes(): NoteDetailsAndTag[];
1599
+ /**
1600
+ * Serializes the transaction result into bytes.
1601
+ */
1602
+ serialize(): Uint8Array;
1603
+ /**
1604
+ * Deserializes a transaction result from bytes.
1605
+ */
1606
+ static deserialize(bytes: Uint8Array): TransactionResult;
1607
+ }
1608
+ export class TransactionScript {
1609
+ private constructor();
1610
+ free(): void;
1611
+ [Symbol.dispose](): void;
1612
+ root(): Word;
1613
+ /**
1614
+ * Creates a `NoteScript` from the given `Package`.
1615
+ * Throws if the package is invalid.
1616
+ */
1617
+ static fromPackage(_package: Package): TransactionScript;
1618
+ }
1619
+ export class TransactionScriptInputPair {
1620
+ free(): void;
1621
+ [Symbol.dispose](): void;
1622
+ constructor(word: Word, felts: FeltArray);
1623
+ word(): Word;
1624
+ felts(): FeltArray;
1625
+ }
1626
+ export class TransactionScriptInputPairArray {
1627
+ /**
1628
+ ** Return copy of self without private attributes.
1629
+ */
1630
+ toJSON(): Object;
1631
+ /**
1632
+ * Return stringified version of self.
1633
+ */
1634
+ toString(): string;
1635
+ free(): void;
1636
+ [Symbol.dispose](): void;
1637
+ constructor(elements?: TransactionScriptInputPair[] | null);
1638
+ /**
1639
+ * Get element at index, will always return a clone to avoid aliasing issues.
1640
+ */
1641
+ get(index: number): TransactionScriptInputPair;
1642
+ replaceAt(index: number, elem: TransactionScriptInputPair): void;
1643
+ push(element: TransactionScriptInputPair): void;
1644
+ length(): number;
1645
+ }
1646
+ export class TransactionStatus {
1647
+ private constructor();
1648
+ free(): void;
1649
+ [Symbol.dispose](): void;
1650
+ static pending(): TransactionStatus;
1651
+ static committed(block_num: number, commit_timestamp: bigint): TransactionStatus;
1652
+ static discarded(cause: string): TransactionStatus;
1653
+ isPending(): boolean;
1654
+ isCommitted(): boolean;
1655
+ isDiscarded(): boolean;
1656
+ getBlockNum(): number | undefined;
1657
+ getCommitTimestamp(): bigint | undefined;
1658
+ }
1659
+ export class TransactionStoreUpdate {
1660
+ private constructor();
1661
+ free(): void;
1662
+ [Symbol.dispose](): void;
1663
+ executedTransaction(): ExecutedTransaction;
1664
+ submissionHeight(): number;
1665
+ createdNotes(): OutputNotes;
1666
+ accountDelta(): AccountDelta;
1667
+ futureNotes(): NoteDetailsAndTag[];
1668
+ serialize(): Uint8Array;
1669
+ static deserialize(bytes: Uint8Array): TransactionStoreUpdate;
1670
+ }
1671
+ export class TransactionSummary {
1672
+ private constructor();
1673
+ free(): void;
1674
+ [Symbol.dispose](): void;
1675
+ serialize(): Uint8Array;
1676
+ static deserialize(bytes: Uint8Array): TransactionSummary;
1677
+ accountDelta(): AccountDelta;
1678
+ inputNotes(): InputNotes;
1679
+ outputNotes(): OutputNotes;
1680
+ salt(): Word;
1681
+ }
1682
+ export class WebClient {
1683
+ free(): void;
1684
+ [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>;
1691
+ /**
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
1695
+ */
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>;
1703
+ /**
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.
1706
+ */
1707
+ createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<any>;
1708
+ /**
1709
+ * Returns the inner serialized mock chain if it exists.
1710
+ */
1711
+ serializeMockChain(): Uint8Array;
1712
+ /**
1713
+ * Returns the inner serialized mock note transport node if it exists.
1714
+ */
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>;
1722
+ /**
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.
1725
+ *
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.
1729
+ */
1730
+ submitNewTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionId>;
1731
+ /**
1732
+ * Executes a transaction specified by the request against the specified account but does not
1733
+ * submit it to the network nor update the local database. The returned [`TransactionResult`]
1734
+ * retains the execution artifacts needed to continue with the transaction lifecycle.
1735
+ *
1736
+ * If the transaction utilizes foreign account data, there is a chance that the client doesn't
1737
+ * have the required block header in the local database. In these scenarios, a sync to
1738
+ * the chain tip is performed, and the required block header is retrieved.
1739
+ */
1740
+ executeTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionResult>;
1741
+ /**
1742
+ * Generates a transaction proof using either the provided prover or the client's default
1743
+ * prover if none is supplied.
1744
+ */
1745
+ proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
1746
+ submitProvenTransaction(proven_transaction: ProvenTransaction, transaction_result: TransactionResult): Promise<number>;
1747
+ applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
1748
+ newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): TransactionRequest;
1749
+ 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
+ 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;
1752
+ /**
1753
+ * Send a private note via the note transport layer
1754
+ */
1755
+ sendPrivateNote(note: Note, address: Address): Promise<void>;
1756
+ /**
1757
+ * Fetch private notes from the note transport layer
1758
+ *
1759
+ * Uses an internal pagination mechanism to avoid fetching duplicate notes.
1760
+ */
1761
+ fetchPrivateNotes(): Promise<void>;
1762
+ /**
1763
+ * Fetch all private notes from the note transport layer
1764
+ *
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.
1768
+ */
1769
+ fetchAllPrivateNotes(): Promise<void>;
1770
+ getInputNotes(filter: NoteFilter): Promise<InputNoteRecord[]>;
1771
+ getInputNote(note_id: string): Promise<InputNoteRecord | undefined>;
1772
+ getOutputNotes(filter: NoteFilter): Promise<any>;
1773
+ getOutputNote(note_id: string): Promise<any>;
1774
+ getConsumableNotes(account_id?: AccountId | null): Promise<ConsumableNoteRecord[]>;
1775
+ /**
1776
+ * Retrieves the setting value for `key`, or `None` if it hasn’t been set.
1777
+ */
1778
+ getSetting(key: string): Promise<any | undefined>;
1779
+ /**
1780
+ * Sets a setting key-value in the store. It can then be retrieved using `get_setting`.
1781
+ */
1782
+ setSetting(key: string, value: any): Promise<void>;
1783
+ /**
1784
+ * Deletes a setting key-value from the store.
1785
+ */
1786
+ removeSetting(key: string): Promise<void>;
1787
+ /**
1788
+ * Returns all the existing setting keys from the store.
1789
+ */
1790
+ 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
+ /**
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.
1802
+ */
1803
+ createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null): Promise<any>;
1804
+ /**
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.
1807
+ */
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;
1810
+ }
1811
+ export class Word {
1812
+ free(): void;
1813
+ [Symbol.dispose](): void;
1814
+ constructor(u64_vec: BigUint64Array);
1815
+ /**
1816
+ * Creates a Word from a hex string.
1817
+ * Fails if the provided string is not a valid hex representation of a Word.
1818
+ */
1819
+ 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;
1825
+ toFelts(): Felt[];
1826
+ }