@miden-sdk/miden-sdk 0.14.11 → 0.15.0-alpha.5
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/dist/mt/{Cargo-CZopJ--X.js → Cargo-smJQCGjz.js} +1111 -768
- package/dist/mt/Cargo-smJQCGjz.js.map +1 -0
- package/dist/mt/api-types.d.ts +122 -33
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/crates/miden_client_web.d.ts +376 -303
- package/dist/mt/docs-entry.d.ts +3 -0
- package/dist/mt/eager.js +7 -4
- package/dist/mt/eager.js.map +1 -1
- package/dist/mt/index.d.ts +103 -10
- package/dist/mt/index.js +669 -312
- package/dist/mt/index.js.map +1 -1
- package/dist/mt/wasm.js +1 -1
- package/dist/mt/workerHelpers.js +1 -1
- package/dist/mt/workers/{Cargo-CZopJ--X-SsyOTzpb.js → Cargo-smJQCGjz-q4GYXDiD.js} +1111 -768
- package/dist/mt/workers/Cargo-smJQCGjz-q4GYXDiD.js.map +1 -0
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +1140 -792
- package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
- package/dist/mt/workers/web-client-methods-worker.module.js +23 -19
- package/dist/mt/workers/web-client-methods-worker.module.js.map +1 -1
- package/dist/mt/workers/workerHelpers.js +1 -1
- package/dist/st/{Cargo-DC6jSekr.js → Cargo-CG4XszZo.js} +1105 -763
- package/dist/st/Cargo-CG4XszZo.js.map +1 -0
- package/dist/st/api-types.d.ts +122 -33
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/crates/miden_client_web.d.ts +376 -303
- package/dist/st/docs-entry.d.ts +3 -0
- package/dist/st/eager.js +7 -4
- package/dist/st/eager.js.map +1 -1
- package/dist/st/index.d.ts +103 -10
- package/dist/st/index.js +669 -312
- package/dist/st/index.js.map +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-DC6jSekr-BG7C7m56.js → Cargo-CG4XszZo-S7EHAZSa.js} +1105 -763
- package/dist/st/workers/Cargo-CG4XszZo-S7EHAZSa.js.map +1 -0
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +1134 -787
- package/dist/st/workers/web-client-methods-worker.js.map +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js +23 -19
- package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
- package/js/client.js +491 -0
- package/js/node/client-factory.js +117 -0
- package/js/node/loader.js +138 -0
- package/js/node/napi-compat.js +253 -0
- package/js/node-index.js +194 -0
- package/js/resources/accounts.js +222 -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 +667 -0
- package/js/standalone.js +109 -0
- package/js/utils.js +232 -0
- package/package.json +17 -2
- package/dist/mt/Cargo-CZopJ--X.js.map +0 -1
- package/dist/mt/workers/Cargo-CZopJ--X-SsyOTzpb.js.map +0 -1
- package/dist/st/Cargo-DC6jSekr.js.map +0 -1
- package/dist/st/workers/Cargo-DC6jSekr-BG7C7m56.js.map +0 -1
package/dist/st/docs-entry.d.ts
CHANGED
package/dist/st/eager.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getWasmOrThrow } from './index.js';
|
|
2
|
-
export {
|
|
3
|
-
export { Account, AccountBuilder, AccountBuilderResult, AccountCode, AccountComponent, AccountComponentCode, AccountDelta, AccountFile, AccountHeader, AccountId, AccountInterface, AccountProof, AccountReader, AccountStatus, AccountStorage, AccountStorageDelta, AccountStorageMode, AccountStorageRequirements, AccountVaultDelta, Address, AdviceInputs, AdviceMap, AssetVault, AuthFalcon512RpoMultisigConfig, AuthSecretKey, BasicFungibleFaucetComponent, BlockHeader, CodeBuilder, CommittedNote, ConsumableNoteRecord, Endpoint, ExecutedTransaction, Felt, FetchedAccount, FetchedNote, FlattenedU8Vec, ForeignAccount, FungibleAsset, FungibleAssetDelta, FungibleAssetDeltaItem, GetProceduresResultItem, InputNote, InputNoteRecord, InputNoteState, InputNotes, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, JsAccountUpdate, JsStateSyncUpdate, JsStorageMapEntry, JsStorageSlot, JsVaultAsset, Library, MerklePath, NetworkId, NetworkType, Note, NoteAndArgs, NoteAssets, NoteAttachment,
|
|
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, 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, sequentialSumBench, setupLogging } from './Cargo-CG4XszZo.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/st/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;;;;"}
|
package/dist/st/index.d.ts
CHANGED
|
@@ -4,13 +4,6 @@ export * from "./crates/miden_client_web.js";
|
|
|
4
4
|
// Re-export all simplified API types
|
|
5
5
|
export * from "./api-types.js";
|
|
6
6
|
|
|
7
|
-
// Explicit re-export to shadow the wasm-bindgen `AuthScheme` enum declared
|
|
8
|
-
// in `./crates/miden_client_web` with the user-facing string constant plus
|
|
9
|
-
// merged string-union type from `./api-types`. Without this, `export *`
|
|
10
|
-
// makes the name ambiguous and TypeScript resolves to the crates enum,
|
|
11
|
-
// breaking `AuthScheme.Falcon` / `AuthScheme.ECDSA` lookups.
|
|
12
|
-
export { AuthScheme, resolveAuthScheme } from "./api-types.js";
|
|
13
|
-
|
|
14
7
|
// Import types needed for the @internal class declarations below
|
|
15
8
|
import type {
|
|
16
9
|
WebClient as WasmWebClientBase,
|
|
@@ -40,6 +33,103 @@ export type LogLevel =
|
|
|
40
33
|
*/
|
|
41
34
|
export declare function setupLogging(logLevel: LogLevel): void;
|
|
42
35
|
|
|
36
|
+
// ════════════════════════════════════════════════════════════════
|
|
37
|
+
// StorageView — wraps WASM AccountStorage with smart getItem()
|
|
38
|
+
// ════════════════════════════════════════════════════════════════
|
|
39
|
+
|
|
40
|
+
import type { AccountStorage, Word, Felt } from "./crates/miden_client_web.js";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Result of reading a storage slot via `StorageView.getItem()`.
|
|
44
|
+
* Works for both Value and StorageMap slots.
|
|
45
|
+
*/
|
|
46
|
+
export declare class StorageResult {
|
|
47
|
+
/** True if this slot is a StorageMap. */
|
|
48
|
+
get isMap(): boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* All entries from a StorageMap slot.
|
|
52
|
+
* Each entry has `key` (hex), `value` (hex), and `word` (parsed Word or undefined).
|
|
53
|
+
* Returns undefined for Value slots.
|
|
54
|
+
*/
|
|
55
|
+
get entries():
|
|
56
|
+
| Array<{ key: string; value: string; word: Word | undefined }>
|
|
57
|
+
| undefined;
|
|
58
|
+
|
|
59
|
+
/** The underlying Word value. */
|
|
60
|
+
get word(): Word | undefined;
|
|
61
|
+
|
|
62
|
+
/** Returns all four Felts of the stored Word. Pass-through to Word.toFelts(). */
|
|
63
|
+
toFelts(): Felt[];
|
|
64
|
+
|
|
65
|
+
/** The first Felt of the stored Word. */
|
|
66
|
+
felt(): Felt | undefined;
|
|
67
|
+
|
|
68
|
+
/** First felt as a BigInt. Preserves full u64 precision. */
|
|
69
|
+
toBigInt(): bigint;
|
|
70
|
+
|
|
71
|
+
/** The Word's hex representation. */
|
|
72
|
+
toHex(): string;
|
|
73
|
+
|
|
74
|
+
/** Renders as the BigInt value (lossless). Makes `{result}` work in JSX. */
|
|
75
|
+
toString(): string;
|
|
76
|
+
|
|
77
|
+
/** Returns the value as a string for JSON precision safety. */
|
|
78
|
+
toJSON(): string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Allows arithmetic: `+result`, `result * 2`.
|
|
82
|
+
* Returns a JS number for values fitting in Number.MAX_SAFE_INTEGER.
|
|
83
|
+
* Throws RangeError for larger values — use `.toBigInt()` for exact access.
|
|
84
|
+
*/
|
|
85
|
+
valueOf(): number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Wraps WASM AccountStorage with a developer-friendly API.
|
|
90
|
+
*
|
|
91
|
+
* `getItem()` returns a `StorageResult` that works intuitively for both
|
|
92
|
+
* Value and StorageMap slots. The raw WASM AccountStorage is accessible
|
|
93
|
+
* via `.raw`.
|
|
94
|
+
*
|
|
95
|
+
* Installed on `Account.prototype.storage()` at WASM load time.
|
|
96
|
+
*/
|
|
97
|
+
export declare class StorageView {
|
|
98
|
+
/** The raw WASM AccountStorage. */
|
|
99
|
+
get raw(): AccountStorage;
|
|
100
|
+
|
|
101
|
+
/** Returns the commitment to the full account storage. */
|
|
102
|
+
commitment(): Word;
|
|
103
|
+
|
|
104
|
+
/** Returns the names of all storage slots. */
|
|
105
|
+
getSlotNames(): string[];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Smart read: returns a `StorageResult` for the given slot.
|
|
109
|
+
* For Value slots: wraps the stored Word.
|
|
110
|
+
* For StorageMap slots: wraps the first entry's value, with all entries in `.entries`.
|
|
111
|
+
*/
|
|
112
|
+
getItem(slotName: string): StorageResult | undefined;
|
|
113
|
+
|
|
114
|
+
/** Returns the value for a key in a StorageMap slot. */
|
|
115
|
+
getMapItem(slotName: string, key: Word): Word | undefined;
|
|
116
|
+
|
|
117
|
+
/** Get all key-value pairs from a StorageMap slot. */
|
|
118
|
+
getMapEntries(
|
|
119
|
+
slotName: string
|
|
120
|
+
): Array<{ key: string; value: string }> | undefined;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Returns the commitment root of a storage slot.
|
|
124
|
+
* For Value slots: the stored Word. For StorageMap slots: the Merkle root hash.
|
|
125
|
+
* Useful for proofs, state comparison, and syncing.
|
|
126
|
+
*/
|
|
127
|
+
getCommitment(slotName: string): Word | undefined;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Convert a Word's first felt to a BigInt (full u64 precision). */
|
|
131
|
+
export declare function wordToBigInt(word: Word): bigint;
|
|
132
|
+
|
|
43
133
|
// ════════════════════════════════════════════════════════════════
|
|
44
134
|
// Internal exports (not public API — for tests and advanced usage)
|
|
45
135
|
// ════════════════════════════════════════════════════════════════
|
|
@@ -83,7 +173,10 @@ export declare class MockWasmWebClient extends WasmWebClient {
|
|
|
83
173
|
logLevel?: LogLevel
|
|
84
174
|
): Promise<MockWasmWebClient>;
|
|
85
175
|
|
|
86
|
-
proveBlock(): void
|
|
87
|
-
serializeMockChain(): Uint8Array
|
|
88
|
-
serializeMockNoteTransportNode(): Uint8Array
|
|
176
|
+
proveBlock(): Promise<void>;
|
|
177
|
+
serializeMockChain(): Promise<Uint8Array>;
|
|
178
|
+
serializeMockNoteTransportNode(): Promise<Uint8Array>;
|
|
89
179
|
}
|
|
180
|
+
|
|
181
|
+
/** Alias for MockWasmWebClient — used by test apps that import MockWebClient directly. */
|
|
182
|
+
export { MockWasmWebClient as MockWebClient };
|