@miden-sdk/miden-sdk 0.14.0-alpha → 0.14.0
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.
- package/README.md +2 -2
- package/dist/{Cargo-D064yzd4.js → Cargo-M1xGvXNQ.js} +1679 -754
- package/dist/Cargo-M1xGvXNQ.js.map +1 -0
- package/dist/api-types.d.ts +461 -53
- package/dist/assets/miden_client_web.wasm +0 -0
- package/dist/crates/miden_client_web.d.ts +351 -107
- package/dist/docs-entry.d.ts +1 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +616 -96
- package/dist/index.js.map +1 -1
- package/dist/wasm.js +1 -1
- package/dist/workers/{Cargo-D064yzd4-D064yzd4.js → Cargo-M1xGvXNQ-M1xGvXNQ.js} +1679 -754
- package/dist/workers/Cargo-M1xGvXNQ-M1xGvXNQ.js.map +1 -0
- package/dist/workers/assets/miden_client_web.wasm +0 -0
- package/dist/workers/web-client-methods-worker.js +2 -2
- package/dist/workers/web-client-methods-worker.js.map +1 -1
- package/package.json +8 -4
- package/dist/Cargo-D064yzd4.js.map +0 -1
- package/dist/workers/Cargo-D064yzd4-D064yzd4.js.map +0 -1
|
@@ -129,8 +129,12 @@ export class AccountBuilder {
|
|
|
129
129
|
[Symbol.dispose](): void;
|
|
130
130
|
/**
|
|
131
131
|
* Sets the account type (regular, faucet, etc.).
|
|
132
|
+
*
|
|
133
|
+
* Accepts either a numeric WASM enum value (0–3) or a string name
|
|
134
|
+
* (`"FungibleFaucet"`, `"NonFungibleFaucet"`,
|
|
135
|
+
* `"RegularAccountImmutableCode"`, `"RegularAccountUpdatableCode"`).
|
|
132
136
|
*/
|
|
133
|
-
accountType(account_type:
|
|
137
|
+
accountType(account_type: any): AccountBuilder;
|
|
134
138
|
/**
|
|
135
139
|
* Builds the account and returns it together with the derived seed.
|
|
136
140
|
*/
|
|
@@ -218,6 +222,10 @@ export class AccountComponent {
|
|
|
218
222
|
static fromPackage(_package: Package, storage_slots: StorageSlotArray): AccountComponent;
|
|
219
223
|
/**
|
|
220
224
|
* Returns the hex-encoded MAST root for a procedure by name.
|
|
225
|
+
*
|
|
226
|
+
* Matches by full path, relative path, or local name (after the last `::`).
|
|
227
|
+
* When matching by local name, if multiple procedures share the same local
|
|
228
|
+
* name across modules, the first match is returned.
|
|
221
229
|
*/
|
|
222
230
|
getProcedureHash(procedure_name: string): string;
|
|
223
231
|
/**
|
|
@@ -372,6 +380,15 @@ export class AccountId {
|
|
|
372
380
|
* Returns an error if the provided string is not a valid hex-encoded account ID.
|
|
373
381
|
*/
|
|
374
382
|
static fromHex(hex: string): AccountId;
|
|
383
|
+
/**
|
|
384
|
+
* Builds an account ID from its prefix and suffix field elements.
|
|
385
|
+
*
|
|
386
|
+
* This is useful when the account ID components are stored separately (e.g., in storage
|
|
387
|
+
* maps) and need to be recombined into an `AccountId`.
|
|
388
|
+
*
|
|
389
|
+
* Returns an error if the provided felts do not form a valid account ID.
|
|
390
|
+
*/
|
|
391
|
+
static fromPrefixSuffix(prefix: Felt, suffix: Felt): AccountId;
|
|
375
392
|
/**
|
|
376
393
|
* Returns true if the ID refers to a faucet.
|
|
377
394
|
*/
|
|
@@ -441,7 +458,8 @@ export enum AccountInterface {
|
|
|
441
458
|
/**
|
|
442
459
|
* Proof of existence of an account's state at a specific block number, as returned by the node.
|
|
443
460
|
*
|
|
444
|
-
* For public accounts, this includes the account header, storage slot values
|
|
461
|
+
* For public accounts, this includes the account header, storage slot values, account code,
|
|
462
|
+
* and optionally storage map entries for the requested storage maps.
|
|
445
463
|
* For private accounts, only the account commitment and merkle proof are available.
|
|
446
464
|
*/
|
|
447
465
|
export class AccountProof {
|
|
@@ -468,6 +486,22 @@ export class AccountProof {
|
|
|
468
486
|
* Returns the block number at which this proof was retrieved.
|
|
469
487
|
*/
|
|
470
488
|
blockNum(): number;
|
|
489
|
+
/**
|
|
490
|
+
* Returns storage map entries for a given slot name, if available.
|
|
491
|
+
*
|
|
492
|
+
* Returns `undefined` if the account is private, the slot was not requested in the
|
|
493
|
+
* storage requirements, or the slot is not a map.
|
|
494
|
+
*
|
|
495
|
+
* Each entry contains a `key` and `value` as `Word` objects.
|
|
496
|
+
*/
|
|
497
|
+
getStorageMapEntries(slot_name: string): StorageMapEntry[] | undefined;
|
|
498
|
+
/**
|
|
499
|
+
* Returns the names of all storage slots that have map details available.
|
|
500
|
+
*
|
|
501
|
+
* This can be used to discover which storage maps were included in the proof response.
|
|
502
|
+
* Returns `undefined` if the account is private.
|
|
503
|
+
*/
|
|
504
|
+
getStorageMapSlotNames(): string[] | undefined;
|
|
471
505
|
/**
|
|
472
506
|
* Returns the value of a storage slot by name, if available.
|
|
473
507
|
*
|
|
@@ -477,6 +511,15 @@ export class AccountProof {
|
|
|
477
511
|
* Returns `undefined` if the account is private or the slot name is not found.
|
|
478
512
|
*/
|
|
479
513
|
getStorageSlotValue(slot_name: string): Word | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Returns whether a storage map slot had too many entries to return inline.
|
|
516
|
+
*
|
|
517
|
+
* When this returns `true`, use `RpcClient.syncStorageMaps()` to fetch the full
|
|
518
|
+
* storage map data.
|
|
519
|
+
*
|
|
520
|
+
* Returns `undefined` if the slot was not found or the account is private.
|
|
521
|
+
*/
|
|
522
|
+
hasStorageMapTooManyEntries(slot_name: string): boolean | undefined;
|
|
480
523
|
/**
|
|
481
524
|
* Returns the number of storage slots, if available (public accounts only).
|
|
482
525
|
*/
|
|
@@ -788,13 +831,17 @@ export class Address {
|
|
|
788
831
|
* Advice inputs provided to a transaction or note script.
|
|
789
832
|
*/
|
|
790
833
|
export class AdviceInputs {
|
|
791
|
-
private constructor();
|
|
792
834
|
free(): void;
|
|
793
835
|
[Symbol.dispose](): void;
|
|
794
836
|
/**
|
|
795
837
|
* Returns mapped values for a given key if present.
|
|
796
838
|
*/
|
|
797
839
|
mappedValues(key: Word): Felt[] | undefined;
|
|
840
|
+
/**
|
|
841
|
+
* `wasm_bindgen` requires an explicit constructor; `#[derive(Default)]` alone
|
|
842
|
+
* is not callable from JS.
|
|
843
|
+
*/
|
|
844
|
+
constructor();
|
|
798
845
|
/**
|
|
799
846
|
* Returns the stack inputs as a vector of felts.
|
|
800
847
|
*/
|
|
@@ -1059,18 +1106,29 @@ export class CodeBuilder {
|
|
|
1059
1106
|
}
|
|
1060
1107
|
|
|
1061
1108
|
/**
|
|
1062
|
-
* Represents a note committed on chain
|
|
1109
|
+
* Represents a note committed on chain.
|
|
1063
1110
|
*/
|
|
1064
1111
|
export class CommittedNote {
|
|
1065
1112
|
private constructor();
|
|
1066
1113
|
free(): void;
|
|
1067
1114
|
[Symbol.dispose](): void;
|
|
1068
1115
|
/**
|
|
1069
|
-
* Returns the
|
|
1116
|
+
* Returns the full note metadata when the attachment payload is available.
|
|
1117
|
+
*/
|
|
1118
|
+
fullMetadata(): NoteMetadata | undefined;
|
|
1119
|
+
/**
|
|
1120
|
+
* Returns the inclusion path for the note in the block's note tree.
|
|
1070
1121
|
*/
|
|
1071
1122
|
inclusionPath(): SparseMerklePath;
|
|
1123
|
+
/**
|
|
1124
|
+
* Returns the inclusion proof for this note.
|
|
1125
|
+
*/
|
|
1126
|
+
inclusionProof(): NoteInclusionProof;
|
|
1072
1127
|
/**
|
|
1073
1128
|
* Returns the note metadata.
|
|
1129
|
+
*
|
|
1130
|
+
* If only metadata headers are available, the returned metadata contains
|
|
1131
|
+
* the sender, note type, and tag without attachment payload.
|
|
1074
1132
|
*/
|
|
1075
1133
|
metadata(): NoteMetadata;
|
|
1076
1134
|
/**
|
|
@@ -1081,6 +1139,18 @@ export class CommittedNote {
|
|
|
1081
1139
|
* Returns the note index in the block's note tree.
|
|
1082
1140
|
*/
|
|
1083
1141
|
noteIndex(): number;
|
|
1142
|
+
/**
|
|
1143
|
+
* Returns the note type (public, private, etc.).
|
|
1144
|
+
*/
|
|
1145
|
+
noteType(): NoteType;
|
|
1146
|
+
/**
|
|
1147
|
+
* Returns the note sender, even when only header metadata is available.
|
|
1148
|
+
*/
|
|
1149
|
+
sender(): AccountId;
|
|
1150
|
+
/**
|
|
1151
|
+
* Returns the note tag.
|
|
1152
|
+
*/
|
|
1153
|
+
tag(): number;
|
|
1084
1154
|
}
|
|
1085
1155
|
|
|
1086
1156
|
/**
|
|
@@ -1869,10 +1939,6 @@ export class JsVaultAsset {
|
|
|
1869
1939
|
* Word representing the asset.
|
|
1870
1940
|
*/
|
|
1871
1941
|
asset: string;
|
|
1872
|
-
/**
|
|
1873
|
-
* Asset's faucet ID prefix.
|
|
1874
|
-
*/
|
|
1875
|
-
faucetIdPrefix: string;
|
|
1876
1942
|
/**
|
|
1877
1943
|
* The vault key associated with the asset.
|
|
1878
1944
|
*/
|
|
@@ -2040,6 +2106,27 @@ export class NoteAndArgsArray {
|
|
|
2040
2106
|
replaceAt(index: number, elem: NoteAndArgs): void;
|
|
2041
2107
|
}
|
|
2042
2108
|
|
|
2109
|
+
export class NoteArray {
|
|
2110
|
+
/**
|
|
2111
|
+
** Return copy of self without private attributes.
|
|
2112
|
+
*/
|
|
2113
|
+
toJSON(): Object;
|
|
2114
|
+
/**
|
|
2115
|
+
* Return stringified version of self.
|
|
2116
|
+
*/
|
|
2117
|
+
toString(): string;
|
|
2118
|
+
free(): void;
|
|
2119
|
+
[Symbol.dispose](): void;
|
|
2120
|
+
/**
|
|
2121
|
+
* Get element at index, will always return a clone to avoid aliasing issues.
|
|
2122
|
+
*/
|
|
2123
|
+
get(index: number): Note;
|
|
2124
|
+
length(): number;
|
|
2125
|
+
constructor(elements?: Note[] | null);
|
|
2126
|
+
push(element: Note): void;
|
|
2127
|
+
replaceAt(index: number, elem: Note): void;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2043
2130
|
/**
|
|
2044
2131
|
* An asset container for a note.
|
|
2045
2132
|
*
|
|
@@ -2424,10 +2511,6 @@ export class NoteHeader {
|
|
|
2424
2511
|
private constructor();
|
|
2425
2512
|
free(): void;
|
|
2426
2513
|
[Symbol.dispose](): void;
|
|
2427
|
-
/**
|
|
2428
|
-
* Returns a commitment to the note ID and metadata.
|
|
2429
|
-
*/
|
|
2430
|
-
commitment(): Word;
|
|
2431
2514
|
/**
|
|
2432
2515
|
* Returns the unique identifier for the note.
|
|
2433
2516
|
*/
|
|
@@ -2436,6 +2519,10 @@ export class NoteHeader {
|
|
|
2436
2519
|
* Returns the public metadata attached to the note.
|
|
2437
2520
|
*/
|
|
2438
2521
|
metadata(): NoteMetadata;
|
|
2522
|
+
/**
|
|
2523
|
+
* Returns a commitment to the note ID and metadata.
|
|
2524
|
+
*/
|
|
2525
|
+
toCommitment(): Word;
|
|
2439
2526
|
}
|
|
2440
2527
|
|
|
2441
2528
|
/**
|
|
@@ -2529,13 +2616,13 @@ export class NoteLocation {
|
|
|
2529
2616
|
free(): void;
|
|
2530
2617
|
[Symbol.dispose](): void;
|
|
2531
2618
|
/**
|
|
2532
|
-
* Returns the
|
|
2619
|
+
* Returns the index of the note leaf within the block's note tree.
|
|
2533
2620
|
*/
|
|
2534
|
-
|
|
2621
|
+
blockNoteTreeIndex(): number;
|
|
2535
2622
|
/**
|
|
2536
|
-
* Returns the
|
|
2623
|
+
* Returns the block height containing the note.
|
|
2537
2624
|
*/
|
|
2538
|
-
|
|
2625
|
+
blockNum(): number;
|
|
2539
2626
|
}
|
|
2540
2627
|
|
|
2541
2628
|
/**
|
|
@@ -2654,7 +2741,8 @@ export class NoteScript {
|
|
|
2654
2741
|
static deserialize(bytes: Uint8Array): NoteScript;
|
|
2655
2742
|
/**
|
|
2656
2743
|
* Creates a `NoteScript` from the given `Package`.
|
|
2657
|
-
*
|
|
2744
|
+
* The package must contain a library with exactly one procedure annotated with
|
|
2745
|
+
* `@note_script`.
|
|
2658
2746
|
*/
|
|
2659
2747
|
static fromPackage(_package: Package): NoteScript;
|
|
2660
2748
|
/**
|
|
@@ -2705,6 +2793,27 @@ export class NoteStorage {
|
|
|
2705
2793
|
constructor(felt_array: FeltArray);
|
|
2706
2794
|
}
|
|
2707
2795
|
|
|
2796
|
+
/**
|
|
2797
|
+
* Represents a single block's worth of note sync data.
|
|
2798
|
+
*/
|
|
2799
|
+
export class NoteSyncBlock {
|
|
2800
|
+
private constructor();
|
|
2801
|
+
free(): void;
|
|
2802
|
+
[Symbol.dispose](): void;
|
|
2803
|
+
/**
|
|
2804
|
+
* Returns the block header for this block.
|
|
2805
|
+
*/
|
|
2806
|
+
blockHeader(): BlockHeader;
|
|
2807
|
+
/**
|
|
2808
|
+
* Returns the MMR path for the block header.
|
|
2809
|
+
*/
|
|
2810
|
+
mmrPath(): MerklePath;
|
|
2811
|
+
/**
|
|
2812
|
+
* Returns the committed notes in this block.
|
|
2813
|
+
*/
|
|
2814
|
+
notes(): CommittedNote[];
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2708
2817
|
/**
|
|
2709
2818
|
* Represents the response data from `syncNotes`.
|
|
2710
2819
|
*/
|
|
@@ -2713,19 +2822,27 @@ export class NoteSyncInfo {
|
|
|
2713
2822
|
free(): void;
|
|
2714
2823
|
[Symbol.dispose](): void;
|
|
2715
2824
|
/**
|
|
2716
|
-
* Returns the block header associated with
|
|
2825
|
+
* Returns the first block header associated with matching notes, if any.
|
|
2717
2826
|
*/
|
|
2718
|
-
blockHeader(): BlockHeader;
|
|
2827
|
+
blockHeader(): BlockHeader | undefined;
|
|
2828
|
+
/**
|
|
2829
|
+
* Returns the last block checked by the node. Used as a cursor for pagination.
|
|
2830
|
+
*/
|
|
2831
|
+
blockTo(): number;
|
|
2832
|
+
/**
|
|
2833
|
+
* Returns the blocks containing matching notes.
|
|
2834
|
+
*/
|
|
2835
|
+
blocks(): NoteSyncBlock[];
|
|
2719
2836
|
/**
|
|
2720
2837
|
* Returns the latest block number in the chain.
|
|
2721
2838
|
*/
|
|
2722
2839
|
chainTip(): number;
|
|
2723
2840
|
/**
|
|
2724
|
-
* Returns the MMR path
|
|
2841
|
+
* Returns the first block MMR path associated with matching notes, if any.
|
|
2725
2842
|
*/
|
|
2726
|
-
mmrPath(): MerklePath;
|
|
2843
|
+
mmrPath(): MerklePath | undefined;
|
|
2727
2844
|
/**
|
|
2728
|
-
* Returns the committed notes
|
|
2845
|
+
* Returns the committed notes across all matching blocks.
|
|
2729
2846
|
*/
|
|
2730
2847
|
notes(): CommittedNote[];
|
|
2731
2848
|
}
|
|
@@ -2772,7 +2889,7 @@ export enum NoteType {
|
|
|
2772
2889
|
}
|
|
2773
2890
|
|
|
2774
2891
|
/**
|
|
2775
|
-
* Representation of a note produced by a transaction (full
|
|
2892
|
+
* Representation of a note produced by a transaction (full or partial).
|
|
2776
2893
|
*/
|
|
2777
2894
|
export class OutputNote {
|
|
2778
2895
|
private constructor();
|
|
@@ -2786,10 +2903,6 @@ export class OutputNote {
|
|
|
2786
2903
|
* Wraps a full note output.
|
|
2787
2904
|
*/
|
|
2788
2905
|
static full(note: Note): OutputNote;
|
|
2789
|
-
/**
|
|
2790
|
-
* Wraps only the header of a note.
|
|
2791
|
-
*/
|
|
2792
|
-
static header(note_header: NoteHeader): OutputNote;
|
|
2793
2906
|
/**
|
|
2794
2907
|
* Returns the note ID for this output.
|
|
2795
2908
|
*/
|
|
@@ -2807,13 +2920,9 @@ export class OutputNote {
|
|
|
2807
2920
|
*/
|
|
2808
2921
|
static partial(partial_note: PartialNote): OutputNote;
|
|
2809
2922
|
/**
|
|
2810
|
-
* Returns the recipient digest
|
|
2811
|
-
*/
|
|
2812
|
-
recipientDigest(): Word | undefined;
|
|
2813
|
-
/**
|
|
2814
|
-
* Returns a more compact representation if possible (e.g. dropping details).
|
|
2923
|
+
* Returns the recipient digest.
|
|
2815
2924
|
*/
|
|
2816
|
-
|
|
2925
|
+
recipientDigest(): Word;
|
|
2817
2926
|
}
|
|
2818
2927
|
|
|
2819
2928
|
export class OutputNoteArray {
|
|
@@ -2928,27 +3037,6 @@ export class OutputNotes {
|
|
|
2928
3037
|
numNotes(): number;
|
|
2929
3038
|
}
|
|
2930
3039
|
|
|
2931
|
-
export class OutputNotesArray {
|
|
2932
|
-
/**
|
|
2933
|
-
** Return copy of self without private attributes.
|
|
2934
|
-
*/
|
|
2935
|
-
toJSON(): Object;
|
|
2936
|
-
/**
|
|
2937
|
-
* Return stringified version of self.
|
|
2938
|
-
*/
|
|
2939
|
-
toString(): string;
|
|
2940
|
-
free(): void;
|
|
2941
|
-
[Symbol.dispose](): void;
|
|
2942
|
-
/**
|
|
2943
|
-
* Get element at index, will always return a clone to avoid aliasing issues.
|
|
2944
|
-
*/
|
|
2945
|
-
get(index: number): OutputNotes;
|
|
2946
|
-
length(): number;
|
|
2947
|
-
constructor(elements?: OutputNotes[] | null);
|
|
2948
|
-
push(element: OutputNotes): void;
|
|
2949
|
-
replaceAt(index: number, elem: OutputNotes): void;
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
3040
|
/**
|
|
2953
3041
|
* Compiled VM package containing libraries and metadata.
|
|
2954
3042
|
*/
|
|
@@ -3007,6 +3095,19 @@ export class PartialNote {
|
|
|
3007
3095
|
recipientDigest(): Word;
|
|
3008
3096
|
}
|
|
3009
3097
|
|
|
3098
|
+
/**
|
|
3099
|
+
* Poseidon2 hashing helpers exposed to JavaScript.
|
|
3100
|
+
*/
|
|
3101
|
+
export class Poseidon2 {
|
|
3102
|
+
private constructor();
|
|
3103
|
+
free(): void;
|
|
3104
|
+
[Symbol.dispose](): void;
|
|
3105
|
+
/**
|
|
3106
|
+
* Computes a Poseidon2 digest from the provided field elements.
|
|
3107
|
+
*/
|
|
3108
|
+
static hashElements(felt_array: FeltArray): Word;
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3010
3111
|
export class ProcedureThreshold {
|
|
3011
3112
|
free(): void;
|
|
3012
3113
|
[Symbol.dispose](): void;
|
|
@@ -3049,10 +3150,6 @@ export class ProvenTransaction {
|
|
|
3049
3150
|
* Returns the nullifiers of the consumed input notes.
|
|
3050
3151
|
*/
|
|
3051
3152
|
nullifiers(): Word[];
|
|
3052
|
-
/**
|
|
3053
|
-
* Returns notes created by this transaction.
|
|
3054
|
-
*/
|
|
3055
|
-
outputNotes(): OutputNotes;
|
|
3056
3153
|
/**
|
|
3057
3154
|
* Returns the commitment of the reference block.
|
|
3058
3155
|
*/
|
|
@@ -3111,16 +3208,27 @@ export class RpcClient {
|
|
|
3111
3208
|
* Fetches an account proof from the node.
|
|
3112
3209
|
*
|
|
3113
3210
|
* This is a lighter-weight alternative to `getAccountDetails` that makes a single RPC call
|
|
3114
|
-
* and returns the account proof
|
|
3115
|
-
*
|
|
3211
|
+
* and returns the account proof alongside the account header, storage slot values, and
|
|
3212
|
+
* account code without reconstructing the full account state.
|
|
3116
3213
|
*
|
|
3117
3214
|
* For private accounts, the proof is returned but account details will not be available
|
|
3118
3215
|
* since they are not stored on-chain.
|
|
3119
3216
|
*
|
|
3120
|
-
* Useful for reading storage slot values (e.g., faucet metadata)
|
|
3121
|
-
* fetching the complete account with all vault assets and
|
|
3122
|
-
|
|
3123
|
-
|
|
3217
|
+
* Useful for reading storage slot values (e.g., faucet metadata) or specific storage map
|
|
3218
|
+
* entries without the overhead of fetching the complete account with all vault assets and
|
|
3219
|
+
* storage map entries.
|
|
3220
|
+
*
|
|
3221
|
+
* @param `account_id` - The account to fetch the proof for.
|
|
3222
|
+
* @param `storage_requirements` - Optional storage requirements specifying which storage
|
|
3223
|
+
* maps and keys to include. When `undefined`, no storage map data is requested.
|
|
3224
|
+
* @param `block_num` - Optional block number to fetch the account state at. When `undefined`,
|
|
3225
|
+
* fetches the latest state (chain tip).
|
|
3226
|
+
* @param `known_vault_commitment` - Optional known vault commitment. When provided,
|
|
3227
|
+
* vault data is returned only if the account's current vault root differs from this
|
|
3228
|
+
* value. Use `Word.new([0, 0, 0, 0])` to always fetch. When `undefined`, vault data
|
|
3229
|
+
* is not requested.
|
|
3230
|
+
*/
|
|
3231
|
+
getAccountProof(account_id: AccountId, storage_requirements?: AccountStorageRequirements | null, block_num?: number | null, known_vault_commitment?: Word | null): Promise<AccountProof>;
|
|
3124
3232
|
/**
|
|
3125
3233
|
* Fetches a block header by number. When `block_num` is undefined, returns the latest header.
|
|
3126
3234
|
*/
|
|
@@ -3156,6 +3264,18 @@ export class RpcClient {
|
|
|
3156
3264
|
* Fetches notes matching the provided tags from the node.
|
|
3157
3265
|
*/
|
|
3158
3266
|
syncNotes(block_num: number, block_to: number | null | undefined, note_tags: NoteTag[]): Promise<NoteSyncInfo>;
|
|
3267
|
+
/**
|
|
3268
|
+
* Syncs storage map updates for an account within a block range.
|
|
3269
|
+
*
|
|
3270
|
+
* This is used when `AccountProof.hasStorageMapTooManyEntries()` returns `true` for a
|
|
3271
|
+
* slot, indicating the storage map was too large to return inline. This endpoint fetches
|
|
3272
|
+
* the full storage map data with pagination support.
|
|
3273
|
+
*
|
|
3274
|
+
* @param `block_from` - The starting block number.
|
|
3275
|
+
* @param `block_to` - Optional ending block number. When `undefined`, syncs to chain tip.
|
|
3276
|
+
* @param `account_id` - The account to sync storage maps for.
|
|
3277
|
+
*/
|
|
3278
|
+
syncStorageMaps(block_from: number, block_to: number | null | undefined, account_id: AccountId): Promise<StorageMapInfo>;
|
|
3159
3279
|
}
|
|
3160
3280
|
|
|
3161
3281
|
/**
|
|
@@ -3175,6 +3295,12 @@ export class SerializedInputNoteData {
|
|
|
3175
3295
|
private constructor();
|
|
3176
3296
|
free(): void;
|
|
3177
3297
|
[Symbol.dispose](): void;
|
|
3298
|
+
get consumedBlockHeight(): number | undefined;
|
|
3299
|
+
set consumedBlockHeight(value: number | null | undefined);
|
|
3300
|
+
get consumedTxOrder(): number | undefined;
|
|
3301
|
+
set consumedTxOrder(value: number | null | undefined);
|
|
3302
|
+
get consumerAccountId(): string | undefined;
|
|
3303
|
+
set consumerAccountId(value: string | null | undefined);
|
|
3178
3304
|
createdAt: string;
|
|
3179
3305
|
inputs: Uint8Array;
|
|
3180
3306
|
noteAssets: Uint8Array;
|
|
@@ -3376,6 +3502,74 @@ export class StorageMap {
|
|
|
3376
3502
|
constructor();
|
|
3377
3503
|
}
|
|
3378
3504
|
|
|
3505
|
+
/**
|
|
3506
|
+
* A key-value entry from a storage map.
|
|
3507
|
+
*/
|
|
3508
|
+
export class StorageMapEntry {
|
|
3509
|
+
private constructor();
|
|
3510
|
+
free(): void;
|
|
3511
|
+
[Symbol.dispose](): void;
|
|
3512
|
+
/**
|
|
3513
|
+
* Returns the storage map key.
|
|
3514
|
+
*/
|
|
3515
|
+
key(): Word;
|
|
3516
|
+
/**
|
|
3517
|
+
* Returns the storage map value.
|
|
3518
|
+
*/
|
|
3519
|
+
value(): Word;
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
/**
|
|
3523
|
+
* Information about storage map updates for an account, as returned by the
|
|
3524
|
+
* `syncStorageMaps` RPC endpoint.
|
|
3525
|
+
*
|
|
3526
|
+
* Contains the list of storage map updates within the requested block range,
|
|
3527
|
+
* along with the chain tip and last processed block number.
|
|
3528
|
+
*/
|
|
3529
|
+
export class StorageMapInfo {
|
|
3530
|
+
private constructor();
|
|
3531
|
+
free(): void;
|
|
3532
|
+
[Symbol.dispose](): void;
|
|
3533
|
+
/**
|
|
3534
|
+
* Returns the block number of the last check included in this response.
|
|
3535
|
+
*/
|
|
3536
|
+
blockNumber(): number;
|
|
3537
|
+
/**
|
|
3538
|
+
* Returns the current chain tip block number.
|
|
3539
|
+
*/
|
|
3540
|
+
chainTip(): number;
|
|
3541
|
+
/**
|
|
3542
|
+
* Returns the list of storage map updates.
|
|
3543
|
+
*/
|
|
3544
|
+
updates(): StorageMapUpdate[];
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
/**
|
|
3548
|
+
* A single storage map update entry, containing the block number, slot name,
|
|
3549
|
+
* key, and new value.
|
|
3550
|
+
*/
|
|
3551
|
+
export class StorageMapUpdate {
|
|
3552
|
+
private constructor();
|
|
3553
|
+
free(): void;
|
|
3554
|
+
[Symbol.dispose](): void;
|
|
3555
|
+
/**
|
|
3556
|
+
* Returns the block number in which this update occurred.
|
|
3557
|
+
*/
|
|
3558
|
+
blockNum(): number;
|
|
3559
|
+
/**
|
|
3560
|
+
* Returns the storage map key that was updated.
|
|
3561
|
+
*/
|
|
3562
|
+
key(): Word;
|
|
3563
|
+
/**
|
|
3564
|
+
* Returns the name of the storage slot that was updated.
|
|
3565
|
+
*/
|
|
3566
|
+
slotName(): string;
|
|
3567
|
+
/**
|
|
3568
|
+
* Returns the new value for this storage map key.
|
|
3569
|
+
*/
|
|
3570
|
+
value(): Word;
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3379
3573
|
/**
|
|
3380
3574
|
* A single storage slot value or map for an account component.
|
|
3381
3575
|
*/
|
|
@@ -3746,6 +3940,10 @@ export class TransactionRequestBuilder {
|
|
|
3746
3940
|
* Declares expected output recipients (used for verification).
|
|
3747
3941
|
*/
|
|
3748
3942
|
withExpectedOutputRecipients(recipients: NoteRecipientArray): TransactionRequestBuilder;
|
|
3943
|
+
/**
|
|
3944
|
+
* Sets the maximum number of blocks until the transaction request expires.
|
|
3945
|
+
*/
|
|
3946
|
+
withExpirationDelta(expiration_delta: number): TransactionRequestBuilder;
|
|
3749
3947
|
/**
|
|
3750
3948
|
* Registers foreign accounts referenced by the transaction.
|
|
3751
3949
|
*/
|
|
@@ -3755,9 +3953,9 @@ export class TransactionRequestBuilder {
|
|
|
3755
3953
|
*/
|
|
3756
3954
|
withInputNotes(notes: NoteAndArgsArray): TransactionRequestBuilder;
|
|
3757
3955
|
/**
|
|
3758
|
-
* Adds notes created by the sender that should be emitted by the transaction.
|
|
3956
|
+
* Adds output notes created by the sender that should be emitted by the transaction.
|
|
3759
3957
|
*/
|
|
3760
|
-
withOwnOutputNotes(notes:
|
|
3958
|
+
withOwnOutputNotes(notes: NoteArray): TransactionRequestBuilder;
|
|
3761
3959
|
/**
|
|
3762
3960
|
* Adds a transaction script argument.
|
|
3763
3961
|
*/
|
|
@@ -3915,7 +4113,7 @@ export class TransactionStoreUpdate {
|
|
|
3915
4113
|
*/
|
|
3916
4114
|
accountDelta(): AccountDelta;
|
|
3917
4115
|
/**
|
|
3918
|
-
* Returns the notes created by the transaction.
|
|
4116
|
+
* Returns the output notes created by the transaction.
|
|
3919
4117
|
*/
|
|
3920
4118
|
createdNotes(): OutputNotes;
|
|
3921
4119
|
/**
|
|
@@ -3997,7 +4195,6 @@ export class WebClient {
|
|
|
3997
4195
|
* ```
|
|
3998
4196
|
*/
|
|
3999
4197
|
accountReader(account_id: AccountId): AccountReader;
|
|
4000
|
-
addAccountSecretKeyToWebStore(account_id: AccountId, secret_key: AuthSecretKey): Promise<void>;
|
|
4001
4198
|
addTag(tag: string): Promise<void>;
|
|
4002
4199
|
applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
|
|
4003
4200
|
static buildSwapTag(note_type: NoteType, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint): NoteTag;
|
|
@@ -4012,7 +4209,7 @@ export class WebClient {
|
|
|
4012
4209
|
* `MidenClientDB_{network_id}`, where `network_id` is derived from the `node_url`.
|
|
4013
4210
|
* Explicitly setting this allows for creating multiple isolated clients.
|
|
4014
4211
|
*/
|
|
4015
|
-
createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null): Promise<any>;
|
|
4212
|
+
createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null, debug_mode?: boolean | null): Promise<any>;
|
|
4016
4213
|
/**
|
|
4017
4214
|
* Creates a new `WebClient` instance with external keystore callbacks.
|
|
4018
4215
|
*
|
|
@@ -4027,7 +4224,7 @@ export class WebClient {
|
|
|
4027
4224
|
* * `insert_key_cb`: Callback to persist a secret key.
|
|
4028
4225
|
* * `sign_cb`: Callback to produce serialized signature bytes for the provided inputs.
|
|
4029
4226
|
*/
|
|
4030
|
-
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>;
|
|
4227
|
+
createClientWithExternalKeystore(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null, get_key_cb?: Function | null, insert_key_cb?: Function | null, sign_cb?: Function | null, debug_mode?: boolean | null): Promise<any>;
|
|
4031
4228
|
createCodeBuilder(): CodeBuilder;
|
|
4032
4229
|
/**
|
|
4033
4230
|
* Creates a new client with a mock RPC API. Useful for testing purposes and proof-of-concept
|
|
@@ -4046,6 +4243,12 @@ export class WebClient {
|
|
|
4046
4243
|
* - If there is an internal failure during execution.
|
|
4047
4244
|
*/
|
|
4048
4245
|
executeForSummary(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionSummary>;
|
|
4246
|
+
/**
|
|
4247
|
+
* Executes the provided transaction script against the specified account
|
|
4248
|
+
* and returns the resulting stack output. This is a local-only "view call"
|
|
4249
|
+
* that does not submit anything to the network.
|
|
4250
|
+
*/
|
|
4251
|
+
executeProgram(account_id: AccountId, tx_script: TransactionScript, advice_inputs: AdviceInputs, foreign_accounts: ForeignAccountArray): Promise<FeltArray>;
|
|
4049
4252
|
/**
|
|
4050
4253
|
* Executes a transaction specified by the request against the specified account but does not
|
|
4051
4254
|
* submit it to the network nor update the local database. The returned [`TransactionResult`]
|
|
@@ -4058,12 +4261,6 @@ export class WebClient {
|
|
|
4058
4261
|
executeTransaction(account_id: AccountId, transaction_request: TransactionRequest): Promise<TransactionResult>;
|
|
4059
4262
|
exportAccountFile(account_id: AccountId): Promise<AccountFile>;
|
|
4060
4263
|
exportNoteFile(note_id: string, export_format: NoteExportFormat): Promise<NoteFile>;
|
|
4061
|
-
/**
|
|
4062
|
-
* Retrieves the entire underlying web store and returns it as a `JsValue`
|
|
4063
|
-
*
|
|
4064
|
-
* Meant to be used in conjunction with the `force_import_store` method
|
|
4065
|
-
*/
|
|
4066
|
-
exportStore(): Promise<any>;
|
|
4067
4264
|
/**
|
|
4068
4265
|
* Fetch all private notes from the note transport layer
|
|
4069
4266
|
*
|
|
@@ -4078,25 +4275,12 @@ export class WebClient {
|
|
|
4078
4275
|
* Uses an internal pagination mechanism to avoid fetching duplicate notes.
|
|
4079
4276
|
*/
|
|
4080
4277
|
fetchPrivateNotes(): Promise<void>;
|
|
4081
|
-
forceImportStore(store_dump: any, _store_name: string): Promise<any>;
|
|
4082
4278
|
/**
|
|
4083
4279
|
* Retrieves the full account data for the given account ID, returning `null` if not found.
|
|
4084
4280
|
*
|
|
4085
4281
|
* This method loads the complete account state including vault, storage, and code.
|
|
4086
4282
|
*/
|
|
4087
4283
|
getAccount(account_id: AccountId): Promise<Account | undefined>;
|
|
4088
|
-
/**
|
|
4089
|
-
* Retrieves an authentication secret key from the keystore given a public key commitment.
|
|
4090
|
-
*
|
|
4091
|
-
* The public key commitment should correspond to one of the keys tracked by the keystore.
|
|
4092
|
-
* Returns the associated [`AuthSecretKey`] if found, or an error if not found.
|
|
4093
|
-
*/
|
|
4094
|
-
getAccountAuthByPubKeyCommitment(pub_key_commitment: Word): Promise<AuthSecretKey>;
|
|
4095
|
-
/**
|
|
4096
|
-
* Retrieves the full account data for the account associated with the given public key
|
|
4097
|
-
* commitment, returning `null` if no account is found.
|
|
4098
|
-
*/
|
|
4099
|
-
getAccountByKeyCommitment(pub_key_commitment: Word): Promise<Account | undefined>;
|
|
4100
4284
|
/**
|
|
4101
4285
|
* Retrieves the account code for a specific account.
|
|
4102
4286
|
*
|
|
@@ -4121,13 +4305,6 @@ export class WebClient {
|
|
|
4121
4305
|
getInputNotes(filter: NoteFilter): Promise<InputNoteRecord[]>;
|
|
4122
4306
|
getOutputNote(note_id: string): Promise<OutputNoteRecord>;
|
|
4123
4307
|
getOutputNotes(filter: NoteFilter): Promise<OutputNoteRecord[]>;
|
|
4124
|
-
/**
|
|
4125
|
-
* Returns all public key commitments associated with the given account ID.
|
|
4126
|
-
*
|
|
4127
|
-
* These commitments can be used with [`getAccountAuthByPubKeyCommitment`]
|
|
4128
|
-
* to retrieve the corresponding secret keys from the keystore.
|
|
4129
|
-
*/
|
|
4130
|
-
getPublicKeyCommitmentsOfAccount(account_id: AccountId): Promise<Word[]>;
|
|
4131
4308
|
/**
|
|
4132
4309
|
* Retrieves the setting value for `key`, or `None` if it hasn’t been set.
|
|
4133
4310
|
*/
|
|
@@ -4146,6 +4323,13 @@ export class WebClient {
|
|
|
4146
4323
|
listTags(): Promise<any>;
|
|
4147
4324
|
constructor();
|
|
4148
4325
|
newAccount(account: Account, overwrite: boolean): Promise<void>;
|
|
4326
|
+
/**
|
|
4327
|
+
* Inserts an account and its secret key in one call, matching how
|
|
4328
|
+
* `newWallet` / `newFaucet` already work internally. If the key
|
|
4329
|
+
* insertion fails the account is still persisted (same as wallet/faucet),
|
|
4330
|
+
* but callers only need a single await instead of two.
|
|
4331
|
+
*/
|
|
4332
|
+
newAccountWithSecretKey(account: Account, secret_key: AuthSecretKey): Promise<void>;
|
|
4149
4333
|
newConsumeTransactionRequest(list_of_notes: Note[]): TransactionRequest;
|
|
4150
4334
|
newFaucet(storage_mode: AccountStorageMode, non_fungible: boolean, token_symbol: string, decimals: number, max_supply: bigint, auth_scheme: AuthScheme): Promise<Account>;
|
|
4151
4335
|
newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): TransactionRequest;
|
|
@@ -4158,6 +4342,16 @@ export class WebClient {
|
|
|
4158
4342
|
* prover if none is supplied.
|
|
4159
4343
|
*/
|
|
4160
4344
|
proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
|
|
4345
|
+
/**
|
|
4346
|
+
* Prunes historical account states for the specified account up to the given nonce.
|
|
4347
|
+
*
|
|
4348
|
+
* Deletes all historical entries with `replaced_at_nonce <= up_to_nonce` and any
|
|
4349
|
+
* orphaned account code.
|
|
4350
|
+
*
|
|
4351
|
+
* Returns the total number of rows deleted, including historical entries and orphaned
|
|
4352
|
+
* account code.
|
|
4353
|
+
*/
|
|
4354
|
+
pruneAccountHistory(account_id: AccountId, up_to_nonce: Felt): Promise<number>;
|
|
4161
4355
|
removeAccountAddress(account_id: AccountId, address: Address): Promise<void>;
|
|
4162
4356
|
/**
|
|
4163
4357
|
* Deletes a setting key-value from the store.
|
|
@@ -4176,20 +4370,14 @@ export class WebClient {
|
|
|
4176
4370
|
* Returns the inner serialized mock note transport node if it exists.
|
|
4177
4371
|
*/
|
|
4178
4372
|
serializeMockNoteTransportNode(): Uint8Array;
|
|
4179
|
-
/**
|
|
4180
|
-
* Sets the debug mode for transaction execution.
|
|
4181
|
-
*
|
|
4182
|
-
* When enabled, the transaction executor will record additional information useful for
|
|
4183
|
-
* debugging (the values on the VM stack and the state of the advice provider). This is
|
|
4184
|
-
* disabled by default since it adds overhead.
|
|
4185
|
-
*
|
|
4186
|
-
* Must be called before `createClient`.
|
|
4187
|
-
*/
|
|
4188
|
-
setDebugMode(enabled: boolean): void;
|
|
4189
4373
|
/**
|
|
4190
4374
|
* Sets a setting key-value in the store. It can then be retrieved using `get_setting`.
|
|
4191
4375
|
*/
|
|
4192
4376
|
setSetting(key: string, value: any): Promise<void>;
|
|
4377
|
+
/**
|
|
4378
|
+
* Returns the identifier of the underlying store (e.g. `IndexedDB` database name, file path).
|
|
4379
|
+
*/
|
|
4380
|
+
storeIdentifier(): string;
|
|
4193
4381
|
/**
|
|
4194
4382
|
* Executes a transaction specified by the request against the specified account,
|
|
4195
4383
|
* proves it, submits it to the network, and updates the local database.
|
|
@@ -4222,6 +4410,47 @@ export class WebClient {
|
|
|
4222
4410
|
*/
|
|
4223
4411
|
syncStateImpl(): Promise<SyncSummary>;
|
|
4224
4412
|
usesMockChain(): boolean;
|
|
4413
|
+
/**
|
|
4414
|
+
* Returns a `WebKeystoreApi` handle for managing secret keys.
|
|
4415
|
+
*
|
|
4416
|
+
* The returned object can be used from JavaScript as `client.keystore`.
|
|
4417
|
+
*/
|
|
4418
|
+
readonly keystore: WebKeystoreApi;
|
|
4419
|
+
}
|
|
4420
|
+
|
|
4421
|
+
/**
|
|
4422
|
+
* JavaScript API for the client's keystore.
|
|
4423
|
+
*
|
|
4424
|
+
* Manages the association between accounts and their authentication secret keys,
|
|
4425
|
+
* indexed by public key commitment.
|
|
4426
|
+
*/
|
|
4427
|
+
export class WebKeystoreApi {
|
|
4428
|
+
private constructor();
|
|
4429
|
+
free(): void;
|
|
4430
|
+
[Symbol.dispose](): void;
|
|
4431
|
+
/**
|
|
4432
|
+
* Retrieves a secret key from the keystore given a public key commitment.
|
|
4433
|
+
*
|
|
4434
|
+
* Returns the associated `AuthSecretKey` if found, or `null` if not found.
|
|
4435
|
+
*/
|
|
4436
|
+
get(pub_key_commitment: Word): Promise<AuthSecretKey | undefined>;
|
|
4437
|
+
/**
|
|
4438
|
+
* Returns the account ID associated with a given public key commitment,
|
|
4439
|
+
* or `null` if no account is found.
|
|
4440
|
+
*/
|
|
4441
|
+
getAccountId(pub_key_commitment: Word): Promise<AccountId | undefined>;
|
|
4442
|
+
/**
|
|
4443
|
+
* Returns all public key commitments associated with the given account ID.
|
|
4444
|
+
*/
|
|
4445
|
+
getCommitments(account_id: AccountId): Promise<Word[]>;
|
|
4446
|
+
/**
|
|
4447
|
+
* Inserts a secret key into the keystore, associating it with the given account ID.
|
|
4448
|
+
*/
|
|
4449
|
+
insert(account_id: AccountId, secret_key: AuthSecretKey): Promise<void>;
|
|
4450
|
+
/**
|
|
4451
|
+
* Removes a key from the keystore by its public key commitment.
|
|
4452
|
+
*/
|
|
4453
|
+
remove(pub_key_commitment: Word): Promise<void>;
|
|
4225
4454
|
}
|
|
4226
4455
|
|
|
4227
4456
|
export class Word {
|
|
@@ -4267,6 +4496,21 @@ export class Word {
|
|
|
4267
4496
|
*/
|
|
4268
4497
|
export function createAuthFalcon512RpoMultisig(config: AuthFalcon512RpoMultisigConfig): AccountComponent;
|
|
4269
4498
|
|
|
4499
|
+
/**
|
|
4500
|
+
* Exports the entire contents of an `IndexedDB` store as a JSON string.
|
|
4501
|
+
*
|
|
4502
|
+
* Use together with [`import_store`].
|
|
4503
|
+
*/
|
|
4504
|
+
declare function exportStore2(store_name: string): Promise<any>;
|
|
4505
|
+
export { exportStore2 as exportStore }
|
|
4506
|
+
|
|
4507
|
+
/**
|
|
4508
|
+
* Imports store contents from a JSON string, replacing all existing data.
|
|
4509
|
+
*
|
|
4510
|
+
* Use together with [`export_store`].
|
|
4511
|
+
*/
|
|
4512
|
+
export function importStore(store_name: string, store_dump: string): Promise<void>;
|
|
4513
|
+
|
|
4270
4514
|
/**
|
|
4271
4515
|
* Initializes the `tracing` subscriber that routes Rust log output to the
|
|
4272
4516
|
* browser console via `console.log` / `console.warn` / `console.error`.
|