@miden-sdk/miden-sdk 0.13.2 → 0.14.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ /**
2
+ * TypeDoc entry point — curated subset of the public API.
3
+ * Only types listed here (or transitively referenced) appear in generated docs.
4
+ * Runtime consumers should import from index.d.ts, not this file.
5
+ */
6
+
7
+ // Curated WASM re-exports: only types referenced in the public API
8
+ export {
9
+ Account,
10
+ AccountCode,
11
+ AccountFile,
12
+ AccountHeader,
13
+ AccountId,
14
+ AccountStorage,
15
+ AssetVault,
16
+ ConsumableNoteRecord,
17
+ Felt,
18
+ InputNoteRecord,
19
+ Note,
20
+ NoteExportFormat,
21
+ NoteFile,
22
+ NoteId,
23
+ NoteTag,
24
+ OutputNote,
25
+ OutputNoteRecord,
26
+ SyncSummary,
27
+ TransactionId,
28
+ TransactionProver,
29
+ TransactionRecord,
30
+ TransactionRequest,
31
+ TransactionSummary,
32
+ Word,
33
+ } from "./crates/miden_client_web";
34
+
35
+ // All simplified API types
36
+ export * from "./api-types";
package/dist/index.d.ts CHANGED
@@ -1,33 +1,19 @@
1
1
  // Re-export everything from the WASM module
2
2
  export * from "./crates/miden_client_web";
3
3
 
4
- // Import types we need for augmentation
4
+ // Re-export all simplified API types
5
+ export * from "./api-types";
6
+
7
+ // Import types needed for the @internal class declarations below
5
8
  import type {
6
- WebClient as WasmWebClient,
9
+ WebClient as WasmWebClientBase,
7
10
  SyncSummary,
8
- TransactionProver,
9
11
  } from "./crates/miden_client_web";
10
-
11
- // Import the full namespace for the MidenArrayConstructors type
12
- import type * as WasmExports from "./crates/miden_client_web";
13
-
14
- // Export the WASM WebClient type alias for users who need to reference it explicitly
15
- export type { WebClient as WasmWebClient } from "./crates/miden_client_web";
16
-
17
- // Callback types for external keystore support
18
- export type GetKeyCallback = (
19
- pubKey: Uint8Array
20
- ) => Promise<Uint8Array | null | undefined> | Uint8Array | null | undefined;
21
-
22
- export type InsertKeyCallback = (
23
- pubKey: Uint8Array,
24
- secretKey: Uint8Array
25
- ) => Promise<void> | void;
26
-
27
- export type SignCallback = (
28
- pubKey: Uint8Array,
29
- signingInputs: Uint8Array
30
- ) => Promise<Uint8Array> | Uint8Array;
12
+ import type {
13
+ GetKeyCallback,
14
+ InsertKeyCallback,
15
+ SignCallback,
16
+ } from "./api-types";
31
17
 
32
18
  export type LogLevel =
33
19
  | "error"
@@ -47,45 +33,20 @@ export type LogLevel =
47
33
  */
48
34
  export declare function setupLogging(logLevel: LogLevel): void;
49
35
 
50
- type MidenArrayConstructors = {
51
- [K in keyof typeof WasmExports as K extends `${string}Array`
52
- ? K
53
- : never]: (typeof WasmExports)[K];
54
- };
36
+ // ════════════════════════════════════════════════════════════════
37
+ // Internal exports (not public API for tests and advanced usage)
38
+ // ════════════════════════════════════════════════════════════════
55
39
 
56
- export declare const MidenArrays: MidenArrayConstructors;
57
-
58
- // WebClient wrapper class that uses a worker and forwards missing methods to WASM.
59
- export declare class WebClient extends WasmWebClient {
60
- /**
61
- * Factory method to create and initialize a new wrapped WebClient.
62
- *
63
- * @param rpcUrl - The RPC URL (optional).
64
- * @param noteTransportUrl - The note transport URL (optional).
65
- * @param seed - The seed for the account (optional).
66
- * @param network - Optional name for the store. Setting this allows multiple clients to be used in the same browser.
67
- * @returns A promise that resolves to a fully initialized WebClient.
68
- */
40
+ /** @internal Low-level WebClient wrapper. Use MidenClient instead. */
41
+ export declare class WasmWebClient extends WasmWebClientBase {
69
42
  static createClient(
70
43
  rpcUrl?: string,
71
44
  noteTransportUrl?: string,
72
45
  seed?: Uint8Array,
73
- network?: string,
46
+ storeName?: string,
74
47
  logLevel?: LogLevel
75
- ): Promise<WebClient>;
48
+ ): Promise<WasmWebClient>;
76
49
 
77
- /**
78
- * Factory method to create and initialize a new wrapped WebClient with a remote keystore.
79
- *
80
- * @param rpcUrl - The RPC URL (optional).
81
- * @param noteTransportUrl - The note transport URL (optional).
82
- * @param seed - The seed for the account (optional).
83
- * @param storeName - Optional name for the store. Setting this allows multiple clients to be used in the same browser.
84
- * @param getKeyCb - Callback used to retrieve secret keys for a given public key.
85
- * @param insertKeyCb - Callback used to persist secret keys in the external store.
86
- * @param signCb - Callback used to create signatures for the provided inputs.
87
- * @returns A promise that resolves to a fully initialized WebClient.
88
- */
89
50
  static createClientWithExternalKeystore(
90
51
  rpcUrl?: string,
91
52
  noteTransportUrl?: string,
@@ -95,66 +56,23 @@ export declare class WebClient extends WasmWebClient {
95
56
  insertKeyCb?: InsertKeyCallback,
96
57
  signCb?: SignCallback,
97
58
  logLevel?: LogLevel
98
- ): Promise<WebClient>;
59
+ ): Promise<WasmWebClient>;
99
60
 
100
- /** Returns the default transaction prover configured on the client. */
101
- defaultTransactionProver(): TransactionProver;
102
-
103
- /**
104
- * Syncs the client state with the Miden node.
105
- *
106
- * This method coordinates concurrent calls using the Web Locks API:
107
- * - If a sync is already in progress, callers wait and receive the same result
108
- * - Cross-tab coordination ensures only one sync runs at a time per database
109
- *
110
- * @returns A promise that resolves to a SyncSummary with the sync results.
111
- */
112
61
  syncState(): Promise<SyncSummary>;
113
-
114
- /**
115
- * Syncs the client state with the Miden node with an optional timeout.
116
- *
117
- * This method coordinates concurrent calls using the Web Locks API:
118
- * - If a sync is already in progress, callers wait and receive the same result
119
- * - Cross-tab coordination ensures only one sync runs at a time per database
120
- * - If a timeout is specified and exceeded, the method throws an error
121
- *
122
- * @param timeoutMs - Optional timeout in milliseconds. If 0 or not provided, waits indefinitely.
123
- * @returns A promise that resolves to a SyncSummary with the sync results.
124
- */
125
- syncStateWithTimeout(timeoutMs?: number): Promise<SyncSummary>;
126
-
127
- /**
128
- * Terminates the underlying worker.
129
- */
62
+ syncStateWithTimeout(timeoutMs: number): Promise<SyncSummary>;
130
63
  terminate(): void;
131
64
  }
132
65
 
133
- // MockWebClient class that extends the WebClient wrapper
134
- export declare class MockWebClient extends WebClient {
135
- /**
136
- * Factory method to create and initialize a new wrapped MockWebClient.
137
- *
138
- * @param serializedMockChain - Serialized mock chain (optional).
139
- * @param serializedMockNoteTransportNode - Serialized mock note transport node (optional).
140
- * @param seed - Seed for account initialization (optional).
141
- * @returns A promise that resolves to a fully initialized MockWebClient.
142
- */
66
+ /** @internal Low-level MockWebClient wrapper. Use MidenClient.createMock() instead. */
67
+ export declare class MockWasmWebClient extends WasmWebClient {
143
68
  static createClient(
144
- serializedMockChain?: ArrayBuffer | Uint8Array,
145
- serializedMockNoteTransportNode?: ArrayBuffer | Uint8Array,
69
+ serializedMockChain?: Uint8Array,
70
+ serializedMockNoteTransportNode?: Uint8Array,
146
71
  seed?: Uint8Array,
147
72
  logLevel?: LogLevel
148
- ): Promise<MockWebClient>;
149
-
150
- /** Syncs the mock state and returns the resulting summary. */
151
- syncState(): Promise<SyncSummary>;
73
+ ): Promise<MockWasmWebClient>;
152
74
 
153
- /**
154
- * Syncs the client state with the Miden node with an optional timeout.
155
- *
156
- * @param timeoutMs - Optional timeout in milliseconds. If 0 or not provided, waits indefinitely.
157
- * @returns A promise that resolves to a SyncSummary with the sync results.
158
- */
159
- syncStateWithTimeout(timeoutMs?: number): Promise<SyncSummary>;
75
+ proveBlock(): void;
76
+ serializeMockChain(): Uint8Array;
77
+ serializeMockNoteTransportNode(): Uint8Array;
160
78
  }