@miden-sdk/miden-sdk 0.14.4 → 0.15.0-alpha.4
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/LICENSE +21 -0
- package/README.md +9 -9
- package/dist/{Cargo-Bwjf7IkR.js → Cargo-CVlXCH_2.js} +7105 -6141
- package/dist/Cargo-CVlXCH_2.js.map +1 -0
- package/dist/api-types.d.ts +17 -47
- package/dist/assets/miden_client_web.wasm +0 -0
- package/dist/crates/miden_client_web.d.ts +122 -76
- package/dist/docs-entry.d.ts +5 -2
- package/dist/eager.js +7 -4
- package/dist/eager.js.map +1 -1
- package/dist/index.d.ts +107 -7
- package/dist/index.js +534 -355
- package/dist/index.js.map +1 -1
- package/dist/wasm.js +1 -1
- package/dist/workers/{Cargo-Bwjf7IkR-Cz54YuXA.js → Cargo-CVlXCH_2-CWA-5vlh.js} +7105 -6141
- package/dist/workers/Cargo-CVlXCH_2-CWA-5vlh.js.map +1 -0
- package/dist/workers/assets/miden_client_web.wasm +0 -0
- package/dist/workers/web-client-methods-worker.js +7129 -6159
- package/dist/workers/web-client-methods-worker.js.map +1 -1
- package/dist/workers/web-client-methods-worker.module.js +23 -19
- package/dist/workers/web-client-methods-worker.module.js.map +1 -1
- package/js/client.js +327 -0
- package/js/node/client-factory.js +117 -0
- package/js/node/loader.js +138 -0
- package/js/node/napi-compat.js +238 -0
- package/js/node-index.js +195 -0
- package/js/resources/accounts.js +224 -0
- package/js/resources/compiler.js +74 -0
- package/js/resources/keystore.js +54 -0
- package/js/resources/notes.js +124 -0
- package/js/resources/settings.js +30 -0
- package/js/resources/tags.js +31 -0
- package/js/resources/transactions.js +533 -0
- package/js/standalone.js +109 -0
- package/js/utils.js +232 -0
- package/lazy/package.json +4 -0
- package/package.json +62 -40
- package/dist/Cargo-Bwjf7IkR.js.map +0 -1
- package/dist/workers/Cargo-Bwjf7IkR-Cz54YuXA.js.map +0 -1
package/dist/api-types.d.ts
CHANGED
|
@@ -32,17 +32,17 @@ import type {
|
|
|
32
32
|
NoteScript,
|
|
33
33
|
AdviceInputs,
|
|
34
34
|
FeltArray,
|
|
35
|
-
} from "./crates/miden_client_web";
|
|
35
|
+
} from "./crates/miden_client_web.js";
|
|
36
36
|
|
|
37
37
|
// Import the full namespace for the MidenArrayConstructors type
|
|
38
|
-
import type * as WasmExports from "./crates/miden_client_web";
|
|
38
|
+
import type * as WasmExports from "./crates/miden_client_web.js";
|
|
39
39
|
|
|
40
40
|
// Source of truth for standalone-wrapper return types. By deriving them from
|
|
41
41
|
// the wasm-bindgen-generated namespace (rather than hand-writing `: Note`),
|
|
42
42
|
// the declarations below cannot drift from the actual runtime behavior — the
|
|
43
43
|
// exact class of bug behind #2042. Any forwarder-style wrapper should follow
|
|
44
44
|
// the same pattern: `ReturnType<WasmModule["Class"]["method"]>`.
|
|
45
|
-
type WasmModule = typeof import("./crates/miden_client_web");
|
|
45
|
+
type WasmModule = typeof import("./crates/miden_client_web.js");
|
|
46
46
|
|
|
47
47
|
// ════════════════════════════════════════════════════════════════
|
|
48
48
|
// Callback types for external keystore support
|
|
@@ -187,6 +187,8 @@ export interface ClientOptions {
|
|
|
187
187
|
storeName?: string;
|
|
188
188
|
/** Sync state on creation (default: false). */
|
|
189
189
|
autoSync?: boolean;
|
|
190
|
+
/** Enable debug mode for transaction execution (default: false). */
|
|
191
|
+
debugMode?: boolean;
|
|
190
192
|
/** External keystore callbacks. */
|
|
191
193
|
keystore?: {
|
|
192
194
|
getKey: GetKeyCallback;
|
|
@@ -436,11 +438,18 @@ export interface PreviewSwapOptions {
|
|
|
436
438
|
paybackType?: NoteVisibility;
|
|
437
439
|
}
|
|
438
440
|
|
|
441
|
+
export interface PreviewCustomOptions {
|
|
442
|
+
operation: "custom";
|
|
443
|
+
account: AccountRef;
|
|
444
|
+
request: TransactionRequest;
|
|
445
|
+
}
|
|
446
|
+
|
|
439
447
|
export type PreviewOptions =
|
|
440
448
|
| PreviewSendOptions
|
|
441
449
|
| PreviewMintOptions
|
|
442
450
|
| PreviewConsumeOptions
|
|
443
|
-
| PreviewSwapOptions
|
|
451
|
+
| PreviewSwapOptions
|
|
452
|
+
| PreviewCustomOptions;
|
|
444
453
|
|
|
445
454
|
/** Status values reported during waitFor polling. */
|
|
446
455
|
export type WaitStatus = "pending" | "submitted" | "committed";
|
|
@@ -520,12 +529,6 @@ export interface MockOptions {
|
|
|
520
529
|
serializedNoteTransport?: Uint8Array;
|
|
521
530
|
}
|
|
522
531
|
|
|
523
|
-
/** Versioned store snapshot for backup/restore. */
|
|
524
|
-
export interface StoreSnapshot {
|
|
525
|
-
version: number;
|
|
526
|
-
data: unknown;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
532
|
// ════════════════════════════════════════════════════════════════
|
|
530
533
|
// Swap tag options
|
|
531
534
|
// ════════════════════════════════════════════════════════════════
|
|
@@ -921,15 +924,6 @@ export declare class MidenClient {
|
|
|
921
924
|
static createDevnet(options?: ClientOptions): Promise<MidenClient>;
|
|
922
925
|
/** Creates a mock client for testing. */
|
|
923
926
|
static createMock(options?: MockOptions): Promise<MidenClient>;
|
|
924
|
-
/**
|
|
925
|
-
* Resolves once the WASM module is initialized and safe to use.
|
|
926
|
-
*
|
|
927
|
-
* Idempotent and shared across callers — concurrent invocations await the
|
|
928
|
-
* same in-flight promise, and post-init callers resolve immediately.
|
|
929
|
-
* Primarily useful on the `/lazy` entry (Next.js / Capacitor) where no
|
|
930
|
-
* top-level await runs at import time; harmless on the eager entry.
|
|
931
|
-
*/
|
|
932
|
-
static ready(): Promise<void>;
|
|
933
927
|
|
|
934
928
|
readonly accounts: AccountsResource;
|
|
935
929
|
readonly transactions: TransactionsResource;
|
|
@@ -943,46 +937,22 @@ export declare class MidenClient {
|
|
|
943
937
|
sync(options?: { timeout?: number }): Promise<SyncSummary>;
|
|
944
938
|
/** Returns the current sync height. */
|
|
945
939
|
getSyncHeight(): Promise<number>;
|
|
946
|
-
/**
|
|
947
|
-
* Resolves once every serialized WASM call that was already on the
|
|
948
|
-
* internal call chain when `waitForIdle()` was called (execute, submit,
|
|
949
|
-
* prove, apply, sync, or account creation) has settled. Use this from
|
|
950
|
-
* callers that need to perform a non-WASM-side action — e.g. clearing
|
|
951
|
-
* an in-memory auth key on wallet lock — after the kernel finishes, so
|
|
952
|
-
* its auth callback doesn't race with the key being cleared. Does NOT
|
|
953
|
-
* wait for calls enqueued after `waitForIdle()` returns.
|
|
954
|
-
*
|
|
955
|
-
* Caveat for `sync`: a `syncState` blocked on its sync lock (Web
|
|
956
|
-
* Locks) has not yet reached the internal chain, so `waitForIdle`
|
|
957
|
-
* does not await it. Other serialized methods are always observed.
|
|
958
|
-
*
|
|
959
|
-
* Returns immediately if nothing was in flight.
|
|
960
|
-
*/
|
|
961
|
-
waitForIdle(): Promise<void>;
|
|
962
|
-
/**
|
|
963
|
-
* Returns the raw JS value that the most recent sign-callback invocation
|
|
964
|
-
* threw, or `null` if the last sign call succeeded (or no call has
|
|
965
|
-
* happened yet). Useful for recovering structured metadata (e.g. a
|
|
966
|
-
* `reason: 'locked'` property) that the kernel-level `auth::request`
|
|
967
|
-
* diagnostic would otherwise erase.
|
|
968
|
-
*/
|
|
969
|
-
lastAuthError(): unknown;
|
|
970
940
|
/** Returns the client-level default prover. */
|
|
971
941
|
readonly defaultProver: TransactionProver | null;
|
|
972
942
|
/** Terminates the underlying Web Worker. After this, all method calls throw. */
|
|
973
943
|
terminate(): void;
|
|
974
944
|
|
|
975
945
|
/** Returns the identifier of the underlying store (e.g. IndexedDB database name, file path). */
|
|
976
|
-
storeIdentifier(): string
|
|
946
|
+
storeIdentifier(): Promise<string>;
|
|
977
947
|
|
|
978
948
|
/** Advances the mock chain by one block. Only available on mock clients. */
|
|
979
|
-
proveBlock(): void
|
|
949
|
+
proveBlock(): Promise<void>;
|
|
980
950
|
/** Returns true if this client uses a mock chain. */
|
|
981
951
|
usesMockChain(): boolean;
|
|
982
952
|
/** Serializes the mock chain state for snapshot/restore in tests. */
|
|
983
|
-
serializeMockChain(): Uint8Array
|
|
953
|
+
serializeMockChain(): Promise<Uint8Array>;
|
|
984
954
|
/** Serializes the mock note transport node state. */
|
|
985
|
-
serializeMockNoteTransportNode(): Uint8Array
|
|
955
|
+
serializeMockNoteTransportNode(): Promise<Uint8Array>;
|
|
986
956
|
|
|
987
957
|
[Symbol.dispose](): void;
|
|
988
958
|
[Symbol.asyncDispose](): Promise<void>;
|
|
Binary file
|
|
@@ -129,16 +129,17 @@ 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"`).
|
|
136
132
|
*/
|
|
137
|
-
accountType(account_type:
|
|
133
|
+
accountType(account_type: AccountType): AccountBuilder;
|
|
138
134
|
/**
|
|
139
|
-
* Builds the account
|
|
135
|
+
* Builds the account (including merged storage schema commitment metadata) and returns it
|
|
136
|
+
* together with the derived seed.
|
|
140
137
|
*/
|
|
141
138
|
build(): AccountBuilderResult;
|
|
139
|
+
/**
|
|
140
|
+
* Builds the account without adding the schema commitment component (legacy behavior).
|
|
141
|
+
*/
|
|
142
|
+
buildWithoutSchemaCommitment(): AccountBuilderResult;
|
|
142
143
|
/**
|
|
143
144
|
* Creates a new account builder from a 32-byte initial seed.
|
|
144
145
|
*/
|
|
@@ -494,7 +495,7 @@ export class AccountProof {
|
|
|
494
495
|
*
|
|
495
496
|
* Each entry contains a `key` and `value` as `Word` objects.
|
|
496
497
|
*/
|
|
497
|
-
getStorageMapEntries(slot_name: string):
|
|
498
|
+
getStorageMapEntries(slot_name: string): StorageMapEntryJs[] | undefined;
|
|
498
499
|
/**
|
|
499
500
|
* Returns the names of all storage slots that have map details available.
|
|
500
501
|
*
|
|
@@ -524,6 +525,13 @@ export class AccountProof {
|
|
|
524
525
|
* Returns the number of storage slots, if available (public accounts only).
|
|
525
526
|
*/
|
|
526
527
|
numStorageSlots(): number | undefined;
|
|
528
|
+
/**
|
|
529
|
+
* Returns the fungible assets in the account's vault, if vault details were included
|
|
530
|
+
* in the proof response.
|
|
531
|
+
*
|
|
532
|
+
* Returns `undefined` if the account is private or vault data was not requested.
|
|
533
|
+
*/
|
|
534
|
+
vaultFungibleAssets(): FungibleAsset[] | undefined;
|
|
527
535
|
}
|
|
528
536
|
|
|
529
537
|
/**
|
|
@@ -653,7 +661,7 @@ export class AccountStorage {
|
|
|
653
661
|
* Returns `undefined` if the slot isn't a map or doesn't exist.
|
|
654
662
|
* Returns `[]` if the map exists but is empty.
|
|
655
663
|
*/
|
|
656
|
-
getMapEntries(slot_name: string):
|
|
664
|
+
getMapEntries(slot_name: string): StorageMapEntry[] | undefined;
|
|
657
665
|
/**
|
|
658
666
|
* Returns the value for a key in the map stored at the given slot, if any.
|
|
659
667
|
*/
|
|
@@ -1005,15 +1013,6 @@ export class BlockHeader {
|
|
|
1005
1013
|
* Returns the commitment to the block contents.
|
|
1006
1014
|
*/
|
|
1007
1015
|
commitment(): Word;
|
|
1008
|
-
/**
|
|
1009
|
-
* Returns the account ID of the fungible faucet whose assets are accepted as the native
|
|
1010
|
-
* asset of the blockchain (i.e. the asset used for paying transaction verification fees).
|
|
1011
|
-
*
|
|
1012
|
-
* This is stored on-chain as part of the block's fee parameters, which means consumers can
|
|
1013
|
-
* discover the native faucet by reading any block header rather than hardcoding it per
|
|
1014
|
-
* network.
|
|
1015
|
-
*/
|
|
1016
|
-
nativeAssetId(): AccountId;
|
|
1017
1016
|
/**
|
|
1018
1017
|
* Returns the note commitment root.
|
|
1019
1018
|
*/
|
|
@@ -1295,7 +1294,7 @@ export class Felt {
|
|
|
1295
1294
|
*/
|
|
1296
1295
|
asInt(): bigint;
|
|
1297
1296
|
/**
|
|
1298
|
-
* Creates a new field element
|
|
1297
|
+
* Creates a new field element.
|
|
1299
1298
|
*/
|
|
1300
1299
|
constructor(value: bigint);
|
|
1301
1300
|
/**
|
|
@@ -2003,6 +2002,32 @@ export class NetworkId {
|
|
|
2003
2002
|
static testnet(): NetworkId;
|
|
2004
2003
|
}
|
|
2005
2004
|
|
|
2005
|
+
/**
|
|
2006
|
+
* Status of a network note in the node.
|
|
2007
|
+
*/
|
|
2008
|
+
export class NetworkNoteStatusInfo {
|
|
2009
|
+
private constructor();
|
|
2010
|
+
free(): void;
|
|
2011
|
+
[Symbol.dispose](): void;
|
|
2012
|
+
/**
|
|
2013
|
+
* Returns the number of processing attempts.
|
|
2014
|
+
*/
|
|
2015
|
+
readonly attemptCount: number;
|
|
2016
|
+
/**
|
|
2017
|
+
* Returns the block number of the last processing attempt, if any.
|
|
2018
|
+
*/
|
|
2019
|
+
readonly lastAttemptBlockNum: number | undefined;
|
|
2020
|
+
/**
|
|
2021
|
+
* Returns the last error message, if any.
|
|
2022
|
+
*/
|
|
2023
|
+
readonly lastError: string | undefined;
|
|
2024
|
+
/**
|
|
2025
|
+
* Returns the status as a string: `"Pending"`, `"NullifierInflight"`, `"Discarded"`, or
|
|
2026
|
+
* `"NullifierCommitted"`.
|
|
2027
|
+
*/
|
|
2028
|
+
readonly status: string;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2006
2031
|
/**
|
|
2007
2032
|
* The type of a Miden network.
|
|
2008
2033
|
*/
|
|
@@ -3240,8 +3265,23 @@ export class RpcClient {
|
|
|
3240
3265
|
getAccountProof(account_id: AccountId, storage_requirements?: AccountStorageRequirements | null, block_num?: number | null, known_vault_commitment?: Word | null): Promise<AccountProof>;
|
|
3241
3266
|
/**
|
|
3242
3267
|
* Fetches a block header by number. When `block_num` is undefined, returns the latest header.
|
|
3268
|
+
*
|
|
3269
|
+
* @param `block_num` - Optional block number. When `undefined`, returns the latest header.
|
|
3270
|
+
* @param `include_mmr_proof` - When `true`, includes the MMR proof in the response. Defaults
|
|
3271
|
+
* to `false` when `undefined`.
|
|
3272
|
+
*/
|
|
3273
|
+
getBlockHeaderByNumber(block_num?: number | null, include_mmr_proof?: boolean | null): Promise<BlockHeader>;
|
|
3274
|
+
/**
|
|
3275
|
+
* Fetches the processing status of a network note by its ID.
|
|
3276
|
+
*
|
|
3277
|
+
* Returns information about the note's current status in the network,
|
|
3278
|
+
* including whether it is pending, processed, discarded, or committed,
|
|
3279
|
+
* along with error details and attempt count.
|
|
3280
|
+
*
|
|
3281
|
+
* @param `note_id` - The ID of the note to query.
|
|
3282
|
+
* @returns Promise that resolves to a `NetworkNoteStatusInfo` object.
|
|
3243
3283
|
*/
|
|
3244
|
-
|
|
3284
|
+
getNetworkNoteStatus(note_id: NoteId): Promise<NetworkNoteStatusInfo>;
|
|
3245
3285
|
/**
|
|
3246
3286
|
* Fetches a note script by its root hash from the connected Miden node.
|
|
3247
3287
|
*
|
|
@@ -3511,10 +3551,27 @@ export class StorageMap {
|
|
|
3511
3551
|
constructor();
|
|
3512
3552
|
}
|
|
3513
3553
|
|
|
3554
|
+
export class StorageMapEntry {
|
|
3555
|
+
private constructor();
|
|
3556
|
+
/**
|
|
3557
|
+
** Return copy of self without private attributes.
|
|
3558
|
+
*/
|
|
3559
|
+
toJSON(): Object;
|
|
3560
|
+
/**
|
|
3561
|
+
* Return stringified version of self.
|
|
3562
|
+
*/
|
|
3563
|
+
toString(): string;
|
|
3564
|
+
free(): void;
|
|
3565
|
+
[Symbol.dispose](): void;
|
|
3566
|
+
key: string;
|
|
3567
|
+
root: string;
|
|
3568
|
+
value: string;
|
|
3569
|
+
}
|
|
3570
|
+
|
|
3514
3571
|
/**
|
|
3515
3572
|
* A key-value entry from a storage map.
|
|
3516
3573
|
*/
|
|
3517
|
-
export class
|
|
3574
|
+
export class StorageMapEntryJs {
|
|
3518
3575
|
private constructor();
|
|
3519
3576
|
free(): void;
|
|
3520
3577
|
[Symbol.dispose](): void;
|
|
@@ -4203,7 +4260,8 @@ export class WebClient {
|
|
|
4203
4260
|
* const balance = await reader.getBalance(faucetId);
|
|
4204
4261
|
* ```
|
|
4205
4262
|
*/
|
|
4206
|
-
accountReader(account_id: AccountId): AccountReader
|
|
4263
|
+
accountReader(account_id: AccountId): Promise<AccountReader>;
|
|
4264
|
+
addAccountSecretKeyToWebStore(account_id: AccountId, secret_key: AuthSecretKey): Promise<void>;
|
|
4207
4265
|
addTag(tag: string): Promise<void>;
|
|
4208
4266
|
applyTransaction(transaction_result: TransactionResult, submission_height: number): Promise<TransactionStoreUpdate>;
|
|
4209
4267
|
static buildSwapTag(note_type: NoteType, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint): NoteTag;
|
|
@@ -4217,6 +4275,9 @@ export class WebClient {
|
|
|
4217
4275
|
* * `store_name`: Optional name for the web store. If `None`, the store name defaults to
|
|
4218
4276
|
* `MidenClientDB_{network_id}`, where `network_id` is derived from the `node_url`.
|
|
4219
4277
|
* Explicitly setting this allows for creating multiple isolated clients.
|
|
4278
|
+
* * `debug_mode`: Optional flag to enable debug mode for transaction execution. When enabled,
|
|
4279
|
+
* the transaction executor records additional information useful for debugging. Defaults to
|
|
4280
|
+
* disabled.
|
|
4220
4281
|
*/
|
|
4221
4282
|
createClient(node_url?: string | null, node_note_transport_url?: string | null, seed?: Uint8Array | null, store_name?: string | null, debug_mode?: boolean | null): Promise<any>;
|
|
4222
4283
|
/**
|
|
@@ -4232,14 +4293,16 @@ export class WebClient {
|
|
|
4232
4293
|
* * `get_key_cb`: Callback to retrieve the secret key bytes for a given public key.
|
|
4233
4294
|
* * `insert_key_cb`: Callback to persist a secret key.
|
|
4234
4295
|
* * `sign_cb`: Callback to produce serialized signature bytes for the provided inputs.
|
|
4296
|
+
* * `debug_mode`: Optional flag to enable debug mode for transaction execution. Defaults to
|
|
4297
|
+
* disabled.
|
|
4235
4298
|
*/
|
|
4236
4299
|
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>;
|
|
4237
|
-
createCodeBuilder(): CodeBuilder
|
|
4300
|
+
createCodeBuilder(): Promise<CodeBuilder>;
|
|
4238
4301
|
/**
|
|
4239
4302
|
* Creates a new client with a mock RPC API. Useful for testing purposes and proof-of-concept
|
|
4240
4303
|
* applications as it uses a mock chain that simulates the behavior of a real node.
|
|
4241
4304
|
*/
|
|
4242
|
-
createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<
|
|
4305
|
+
createMockClient(seed?: Uint8Array | null, serialized_mock_chain?: Uint8Array | null, serialized_mock_note_transport_node?: Uint8Array | null): Promise<string>;
|
|
4243
4306
|
/**
|
|
4244
4307
|
* Executes a transaction and returns the `TransactionSummary`.
|
|
4245
4308
|
*
|
|
@@ -4290,6 +4353,18 @@ export class WebClient {
|
|
|
4290
4353
|
* This method loads the complete account state including vault, storage, and code.
|
|
4291
4354
|
*/
|
|
4292
4355
|
getAccount(account_id: AccountId): Promise<Account | undefined>;
|
|
4356
|
+
/**
|
|
4357
|
+
* Retrieves an authentication secret key from the keystore given a public key commitment.
|
|
4358
|
+
*
|
|
4359
|
+
* The public key commitment should correspond to one of the keys tracked by the keystore.
|
|
4360
|
+
* Returns the associated [`AuthSecretKey`] if found, or an error if not found.
|
|
4361
|
+
*/
|
|
4362
|
+
getAccountAuthByPubKeyCommitment(pub_key_commitment: Word): Promise<AuthSecretKey>;
|
|
4363
|
+
/**
|
|
4364
|
+
* Retrieves the full account data for the account associated with the given public key
|
|
4365
|
+
* commitment, returning `null` if no account is found.
|
|
4366
|
+
*/
|
|
4367
|
+
getAccountByKeyCommitment(pub_key_commitment: Word): Promise<Account | undefined>;
|
|
4293
4368
|
/**
|
|
4294
4369
|
* Retrieves the account code for a specific account.
|
|
4295
4370
|
*
|
|
@@ -4315,46 +4390,28 @@ export class WebClient {
|
|
|
4315
4390
|
getOutputNote(note_id: string): Promise<OutputNoteRecord>;
|
|
4316
4391
|
getOutputNotes(filter: NoteFilter): Promise<OutputNoteRecord[]>;
|
|
4317
4392
|
/**
|
|
4318
|
-
*
|
|
4393
|
+
* Returns all public key commitments associated with the given account ID.
|
|
4394
|
+
*
|
|
4395
|
+
* These commitments can be used with [`getAccountAuthByPubKeyCommitment`]
|
|
4396
|
+
* to retrieve the corresponding secret keys from the keystore.
|
|
4397
|
+
*/
|
|
4398
|
+
getPublicKeyCommitmentsOfAccount(account_id: AccountId): Promise<Word[]>;
|
|
4399
|
+
/**
|
|
4400
|
+
* Retrieves the setting value for `key`, or `None` if it hasn't been set.
|
|
4319
4401
|
*/
|
|
4320
4402
|
getSetting(key: string): Promise<any | undefined>;
|
|
4321
4403
|
getSyncHeight(): Promise<number>;
|
|
4322
4404
|
getTransactions(transaction_filter: TransactionFilter): Promise<TransactionRecord[]>;
|
|
4323
|
-
importAccountById(account_id: AccountId): Promise<
|
|
4324
|
-
importAccountFile(account_file: AccountFile): Promise<
|
|
4405
|
+
importAccountById(account_id: AccountId): Promise<void>;
|
|
4406
|
+
importAccountFile(account_file: AccountFile): Promise<string>;
|
|
4325
4407
|
importNoteFile(note_file: NoteFile): Promise<NoteId>;
|
|
4326
4408
|
importPublicAccountFromSeed(init_seed: Uint8Array, mutable: boolean, auth_scheme: AuthScheme): Promise<Account>;
|
|
4327
4409
|
insertAccountAddress(account_id: AccountId, address: Address): Promise<void>;
|
|
4328
|
-
/**
|
|
4329
|
-
* Returns the raw JS value that the most recent sign-callback invocation
|
|
4330
|
-
* threw, or `null` if the last sign call succeeded (or no call has
|
|
4331
|
-
* happened yet).
|
|
4332
|
-
*
|
|
4333
|
-
* Combined with the serialized-call discipline enforced at the JS
|
|
4334
|
-
* `WebClient` wrapper, this lets a caller that caught a failed
|
|
4335
|
-
* `executeTransaction` / `submitNewTransaction` recover the original
|
|
4336
|
-
* JS error the signing callback threw — preserving any structured
|
|
4337
|
-
* metadata (e.g. a `reason: 'locked'` property) that the kernel-level
|
|
4338
|
-
* `auth::request` diagnostic would otherwise have erased.
|
|
4339
|
-
*
|
|
4340
|
-
* # Usage (TS)
|
|
4341
|
-
* ```ts
|
|
4342
|
-
* try {
|
|
4343
|
-
* await client.submitNewTransaction(acc, req);
|
|
4344
|
-
* } catch (e) {
|
|
4345
|
-
* const authErr = client.lastAuthError();
|
|
4346
|
-
* if (authErr && authErr.reason === 'locked') {
|
|
4347
|
-
* // wait for unlock, then retry
|
|
4348
|
-
* }
|
|
4349
|
-
* }
|
|
4350
|
-
* ```
|
|
4351
|
-
*/
|
|
4352
|
-
lastAuthError(): any;
|
|
4353
4410
|
/**
|
|
4354
4411
|
* Returns all the existing setting keys from the store.
|
|
4355
4412
|
*/
|
|
4356
4413
|
listSettingKeys(): Promise<string[]>;
|
|
4357
|
-
listTags(): Promise<
|
|
4414
|
+
listTags(): Promise<string[]>;
|
|
4358
4415
|
constructor();
|
|
4359
4416
|
newAccount(account: Account, overwrite: boolean): Promise<void>;
|
|
4360
4417
|
/**
|
|
@@ -4366,26 +4423,16 @@ export class WebClient {
|
|
|
4366
4423
|
newAccountWithSecretKey(account: Account, secret_key: AuthSecretKey): Promise<void>;
|
|
4367
4424
|
newConsumeTransactionRequest(list_of_notes: Note[]): TransactionRequest;
|
|
4368
4425
|
newFaucet(storage_mode: AccountStorageMode, non_fungible: boolean, token_symbol: string, decimals: number, max_supply: bigint, auth_scheme: AuthScheme): Promise<Account>;
|
|
4369
|
-
newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): TransactionRequest
|
|
4370
|
-
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
|
|
4371
|
-
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
|
|
4426
|
+
newMintTransactionRequest(target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint): Promise<TransactionRequest>;
|
|
4427
|
+
newSendTransactionRequest(sender_account_id: AccountId, target_account_id: AccountId, faucet_id: AccountId, note_type: NoteType, amount: bigint, recall_height?: number | null, timelock_height?: number | null): Promise<TransactionRequest>;
|
|
4428
|
+
newSwapTransactionRequest(sender_account_id: AccountId, offered_asset_faucet_id: AccountId, offered_asset_amount: bigint, requested_asset_faucet_id: AccountId, requested_asset_amount: bigint, note_type: NoteType, payback_note_type: NoteType): Promise<TransactionRequest>;
|
|
4372
4429
|
newWallet(storage_mode: AccountStorageMode, mutable: boolean, auth_scheme: AuthScheme, init_seed?: Uint8Array | null): Promise<Account>;
|
|
4373
|
-
proveBlock(): void
|
|
4430
|
+
proveBlock(): Promise<void>;
|
|
4374
4431
|
/**
|
|
4375
|
-
* Generates a transaction proof using the client's default
|
|
4376
|
-
|
|
4377
|
-
proveTransaction(transaction_result: TransactionResult): Promise<ProvenTransaction>;
|
|
4378
|
-
/**
|
|
4379
|
-
* Generates a transaction proof using the provided prover.
|
|
4380
|
-
*
|
|
4381
|
-
* Takes the prover by reference so the JS-side handle is NOT consumed
|
|
4382
|
-
* by wasm-bindgen. Taking `TransactionProver` by value would transfer
|
|
4383
|
-
* ownership on each call, invalidating the JS object's internal WASM
|
|
4384
|
-
* handle; after one use, subsequent calls from JS would pass a dangling
|
|
4385
|
-
* handle that wasm-bindgen interprets as `None`, silently falling back
|
|
4386
|
-
* to the local prover.
|
|
4432
|
+
* Generates a transaction proof using either the provided prover or the client's default
|
|
4433
|
+
* prover if none is supplied.
|
|
4387
4434
|
*/
|
|
4388
|
-
|
|
4435
|
+
proveTransaction(transaction_result: TransactionResult, prover?: TransactionProver | null): Promise<ProvenTransaction>;
|
|
4389
4436
|
/**
|
|
4390
4437
|
* Prunes historical account states for the specified account up to the given nonce.
|
|
4391
4438
|
*
|
|
@@ -4409,11 +4456,11 @@ export class WebClient {
|
|
|
4409
4456
|
/**
|
|
4410
4457
|
* Returns the inner serialized mock chain if it exists.
|
|
4411
4458
|
*/
|
|
4412
|
-
serializeMockChain(): Uint8Array
|
|
4459
|
+
serializeMockChain(): Promise<Uint8Array>;
|
|
4413
4460
|
/**
|
|
4414
4461
|
* Returns the inner serialized mock note transport node if it exists.
|
|
4415
4462
|
*/
|
|
4416
|
-
serializeMockNoteTransportNode(): Uint8Array
|
|
4463
|
+
serializeMockNoteTransportNode(): Promise<Uint8Array>;
|
|
4417
4464
|
/**
|
|
4418
4465
|
* Sets a setting key-value in the store. It can then be retrieved using `get_setting`.
|
|
4419
4466
|
*/
|
|
@@ -4421,7 +4468,7 @@ export class WebClient {
|
|
|
4421
4468
|
/**
|
|
4422
4469
|
* Returns the identifier of the underlying store (e.g. `IndexedDB` database name, file path).
|
|
4423
4470
|
*/
|
|
4424
|
-
storeIdentifier(): string
|
|
4471
|
+
storeIdentifier(): Promise<string>;
|
|
4425
4472
|
/**
|
|
4426
4473
|
* Executes a transaction specified by the request against the specified account,
|
|
4427
4474
|
* proves it, submits it to the network, and updates the local database.
|
|
@@ -4453,7 +4500,7 @@ export class WebClient {
|
|
|
4453
4500
|
* which provides proper coordination for concurrent calls.
|
|
4454
4501
|
*/
|
|
4455
4502
|
syncStateImpl(): Promise<SyncSummary>;
|
|
4456
|
-
usesMockChain(): boolean
|
|
4503
|
+
usesMockChain(): Promise<boolean>;
|
|
4457
4504
|
/**
|
|
4458
4505
|
* Returns a `WebKeystoreApi` handle for managing secret keys.
|
|
4459
4506
|
*
|
|
@@ -4506,11 +4553,10 @@ export class Word {
|
|
|
4506
4553
|
static deserialize(bytes: Uint8Array): Word;
|
|
4507
4554
|
/**
|
|
4508
4555
|
* Creates a Word from a hex string.
|
|
4509
|
-
* Fails if the provided string is not a valid hex representation of a Word.
|
|
4510
4556
|
*/
|
|
4511
4557
|
static fromHex(hex: string): Word;
|
|
4512
4558
|
/**
|
|
4513
|
-
* Creates a word from four
|
|
4559
|
+
* Creates a word from four numeric values.
|
|
4514
4560
|
*/
|
|
4515
4561
|
constructor(u64_vec: BigUint64Array);
|
|
4516
4562
|
/**
|
|
@@ -4530,7 +4576,7 @@ export class Word {
|
|
|
4530
4576
|
*/
|
|
4531
4577
|
toHex(): string;
|
|
4532
4578
|
/**
|
|
4533
|
-
* Returns the word as an array of
|
|
4579
|
+
* Returns the word as an array of numeric values.
|
|
4534
4580
|
*/
|
|
4535
4581
|
toU64s(): BigUint64Array;
|
|
4536
4582
|
}
|
package/dist/docs-entry.d.ts
CHANGED
|
@@ -29,7 +29,10 @@ export {
|
|
|
29
29
|
TransactionRequest,
|
|
30
30
|
TransactionSummary,
|
|
31
31
|
Word,
|
|
32
|
-
} from "./crates/miden_client_web";
|
|
32
|
+
} from "./crates/miden_client_web.js";
|
|
33
33
|
|
|
34
34
|
// All simplified API types
|
|
35
|
-
export * from "./api-types";
|
|
35
|
+
export * from "./api-types.js";
|
|
36
|
+
|
|
37
|
+
// Storage utilities
|
|
38
|
+
export { StorageView, StorageResult, wordToBigInt } from "./index.js";
|
package/dist/eager.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getWasmOrThrow } from './index.js';
|
|
2
|
-
export { AccountType, AuthScheme, CompilerResource, Linking, MidenArrays, MidenClient, MockWasmWebClient, NoteVisibility, StorageMode, WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote } from './index.js';
|
|
3
|
-
export { Account, AccountArray, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountIdArray, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentKind, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteIdAndArgsArray, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteRecipientArray, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteArray, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapInfo, StorageMapUpdate, StorageSlot, StorageSlotArray, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionScriptInputPairArray, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, setupLogging } from './Cargo-
|
|
2
|
+
export { AccountType, AuthScheme, CompilerResource, Linking, MidenArrays, MidenClient, MockWasmWebClient, MockWasmWebClient as MockWebClient, NoteVisibility, StorageMode, StorageResult, StorageView, WasmWebClient, buildSwapTag, createP2IDENote, createP2IDNote, wordToBigInt } from './index.js';
|
|
3
|
+
export { Account, AccountArray, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountIdArray, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, ExecutedTransaction, Felt, FeltArray, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, ForeignAccountArray, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkNoteStatusInfo, NetworkType, Note, NoteAndArgs, NoteAndArgsArray, NoteArray, NoteAssets, NoteAttachment, NoteAttachmentKind, NoteAttachmentScheme, NoteConsumability, NoteConsumptionStatus, NoteDetails, NoteDetailsAndTag, NoteDetailsAndTagArray, NoteExecutionHint, NoteExportFormat, NoteFile, NoteFilter, NoteFilterTypes, NoteHeader, NoteId, NoteIdAndArgs, NoteIdAndArgsArray, NoteInclusionProof, NoteLocation, NoteMetadata, NoteRecipient, NoteRecipientArray, NoteScript, NoteStorage, NoteSyncBlock, NoteSyncInfo, NoteTag, NoteType, OutputNote, OutputNoteArray, OutputNoteRecord, OutputNoteState, OutputNotes, Package, PartialNote, Poseidon2, ProcedureThreshold, Program, ProvenTransaction, PublicKey, RpcClient, Rpo256, SerializedInputNoteData, SerializedOutputNoteData, SerializedTransactionData, Signature, SigningInputs, SigningInputsType, SlotAndKeys, SparseMerklePath, StorageMap, StorageMapEntry, StorageMapEntryJs, StorageMapInfo, StorageMapUpdate, StorageSlot, StorageSlotArray, SyncSummary, TestUtils, TokenSymbol, TransactionArgs, TransactionFilter, TransactionId, TransactionProver, TransactionRecord, TransactionRequest, TransactionRequestBuilder, TransactionResult, TransactionScript, TransactionScriptInputPair, TransactionScriptInputPairArray, TransactionStatus, TransactionStoreUpdate, TransactionSummary, WebClient, WebKeystoreApi, Word, createAuthFalcon512RpoMultisig, exportStore, importStore, initSync, setupLogging } from './Cargo-CVlXCH_2.js';
|
|
4
4
|
import './wasm.js';
|
|
5
5
|
|
|
6
|
-
// Eager entry point for @miden-sdk/miden-sdk.
|
|
6
|
+
// Eager entry point for @miden-sdk/miden-sdk (browser builds).
|
|
7
7
|
//
|
|
8
8
|
// Awaits WASM initialization at module top level, so importing this module
|
|
9
9
|
// guarantees that any wasm-bindgen constructor (`new RpcClient(...)`,
|
|
@@ -11,7 +11,10 @@ import './wasm.js';
|
|
|
11
11
|
// is safe to call synchronously on the next line. No explicit
|
|
12
12
|
// `await MidenClient.ready()` / `isReady` gate is required.
|
|
13
13
|
//
|
|
14
|
-
// This is the default entry (`@miden-sdk/miden-sdk`
|
|
14
|
+
// This is the default entry for browser bundlers (`@miden-sdk/miden-sdk`
|
|
15
|
+
// → `./dist/eager.js`). Node.js consumers resolve the `node` exports
|
|
16
|
+
// condition instead and get the napi binding via `./js/node-index.js`,
|
|
17
|
+
// bypassing this file entirely.
|
|
15
18
|
//
|
|
16
19
|
// When NOT to use this entry:
|
|
17
20
|
// - **Capacitor mobile apps** (Miden Wallet iOS/Android): Capacitor's
|
package/dist/eager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eager.js","sources":["../js/eager.js"],"sourcesContent":["// Eager entry point for @miden-sdk/miden-sdk.\n//\n// Awaits WASM initialization at module top level, so importing this module\n// guarantees that any wasm-bindgen constructor (`new RpcClient(...)`,\n// `AccountId.fromHex(...)`, `TransactionProver.newRemoteProver(...)`, etc.)\n// is safe to call synchronously on the next line. No explicit\n// `await MidenClient.ready()` / `isReady` gate is required.\n//\n// This is the default entry (`@miden-sdk/miden-sdk
|
|
1
|
+
{"version":3,"file":"eager.js","sources":["../js/eager.js"],"sourcesContent":["// Eager entry point for @miden-sdk/miden-sdk (browser builds).\n//\n// Awaits WASM initialization at module top level, so importing this module\n// guarantees that any wasm-bindgen constructor (`new RpcClient(...)`,\n// `AccountId.fromHex(...)`, `TransactionProver.newRemoteProver(...)`, etc.)\n// is safe to call synchronously on the next line. No explicit\n// `await MidenClient.ready()` / `isReady` gate is required.\n//\n// This is the default entry for browser bundlers (`@miden-sdk/miden-sdk`\n// → `./dist/eager.js`). Node.js consumers resolve the `node` exports\n// condition instead and get the napi binding via `./js/node-index.js`,\n// bypassing this file entirely.\n//\n// When NOT to use this entry:\n// - **Capacitor mobile apps** (Miden Wallet iOS/Android): Capacitor's\n// `capacitor://localhost` scheme handler interacts poorly with top-level\n// await in the main WKWebView. Verified empirically: TLA in a Capacitor\n// host WKWebView hangs module evaluation indefinitely, while the same\n// TLA in the dApp-browser WKWebView (vanilla HTTPS) resolves in <100ms.\n// - **Next.js / SSR**: TLA blocks server-side module evaluation.\n// - **Framework adapters (@miden-sdk/react, etc.)**: they manage readiness\n// via their own state machine (e.g. `isReady`) and should not impose\n// TLA on consumer bundles.\n//\n// For those contexts, import from `@miden-sdk/miden-sdk/lazy` — identical\n// API surface, no top-level await, callers are responsible for awaiting\n// `MidenClient.ready()` (or the equivalent) before touching wasm-bindgen\n// types.\nimport { getWasmOrThrow } from \"./index.js\";\n\nawait getWasmOrThrow();\n\nexport * from \"./index.js\";\n"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,MAAM,cAAc,EAAE;;;;"}
|