@miden-sdk/miden-sdk 0.13.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +194 -0
- package/dist/Cargo-15e14c5a.js +20611 -0
- package/dist/Cargo-15e14c5a.js.map +1 -0
- package/dist/assets/miden_client_web.wasm +0 -0
- package/dist/crates/miden_client_web.d.ts +1826 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.js +774 -0
- package/dist/index.js.map +1 -0
- package/dist/wasm.js +13 -0
- package/dist/wasm.js.map +1 -0
- package/dist/workers/Cargo-15e14c5a-15e14c5a.js +20611 -0
- package/dist/workers/Cargo-15e14c5a-15e14c5a.js.map +1 -0
- package/dist/workers/assets/miden_client_web.wasm +0 -0
- package/dist/workers/web-client-methods-worker.js +322 -0
- package/dist/workers/web-client-methods-worker.js.map +1 -0
- package/package.json +54 -0
|
Binary file
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
// This is a documented workaround that should avoid issues with Vite projects
|
|
2
|
+
// https://github.com/wasm-tool/rollup-plugin-rust?tab=readme-ov-file#usage-with-vite
|
|
3
|
+
// Also, this effectively disables SSR.
|
|
4
|
+
async function loadWasm() {
|
|
5
|
+
let wasmModule;
|
|
6
|
+
if (!import.meta.env || (import.meta.env && !import.meta.env.SSR)) {
|
|
7
|
+
wasmModule = await import('./Cargo-15e14c5a-15e14c5a.js');
|
|
8
|
+
}
|
|
9
|
+
return wasmModule;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const WorkerAction = Object.freeze({
|
|
13
|
+
INIT: "init",
|
|
14
|
+
CALL_METHOD: "callMethod",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const MethodName = Object.freeze({
|
|
18
|
+
CREATE_CLIENT: "createClient",
|
|
19
|
+
NEW_WALLET: "newWallet",
|
|
20
|
+
NEW_FAUCET: "newFaucet",
|
|
21
|
+
EXECUTE_TRANSACTION: "executeTransaction",
|
|
22
|
+
PROVE_TRANSACTION: "proveTransaction",
|
|
23
|
+
SUBMIT_NEW_TRANSACTION: "submitNewTransaction",
|
|
24
|
+
SUBMIT_NEW_TRANSACTION_MOCK: "submitNewTransactionMock",
|
|
25
|
+
SYNC_STATE: "syncState",
|
|
26
|
+
SYNC_STATE_MOCK: "syncStateMock",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
let wasmModule = null;
|
|
30
|
+
|
|
31
|
+
const getWasmOrThrow = async () => {
|
|
32
|
+
if (!wasmModule) {
|
|
33
|
+
wasmModule = await loadWasm();
|
|
34
|
+
}
|
|
35
|
+
if (!wasmModule) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
"Miden WASM bindings are unavailable in the worker environment."
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return wasmModule;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Worker for executing WebClient methods in a separate thread.
|
|
45
|
+
*
|
|
46
|
+
* This worker offloads computationally heavy tasks from the main thread by handling
|
|
47
|
+
* WebClient operations asynchronously. It imports the WASM module and instantiates a
|
|
48
|
+
* WASM WebClient, then listens for messages from the main thread to perform one of two actions:
|
|
49
|
+
*
|
|
50
|
+
* 1. **Initialization (init):**
|
|
51
|
+
* - The worker receives an "init" message along with user parameters (RPC URL and seed).
|
|
52
|
+
* - It instantiates the WASM WebClient and calls its createClient method.
|
|
53
|
+
* - Once initialization is complete, the worker sends a `{ ready: true }` message back to signal
|
|
54
|
+
* that it is fully initialized.
|
|
55
|
+
*
|
|
56
|
+
* 2. **Method Invocation (callMethod):**
|
|
57
|
+
* - The worker receives a "callMethod" message with a specific method name and arguments.
|
|
58
|
+
* - It uses a mapping (defined in `methodHandlers`) to route the call to the corresponding WASM WebClient method.
|
|
59
|
+
* - Complex data is serialized before being sent and deserialized upon return.
|
|
60
|
+
* - The result (or any error) is then posted back to the main thread.
|
|
61
|
+
*
|
|
62
|
+
* The worker uses a message queue to process incoming messages sequentially, ensuring that only one message
|
|
63
|
+
* is handled at a time.
|
|
64
|
+
*
|
|
65
|
+
* Additionally, the worker immediately sends a `{ loaded: true }` message upon script load. This informs the main
|
|
66
|
+
* thread that the worker script is loaded and ready to receive the "init" message.
|
|
67
|
+
*
|
|
68
|
+
* Supported actions (defined in `WorkerAction`):
|
|
69
|
+
* - "init" : Initialize the WASM WebClient with provided parameters.
|
|
70
|
+
* - "callMethod" : Invoke a designated method on the WASM WebClient.
|
|
71
|
+
*
|
|
72
|
+
* Supported method names are defined in the `MethodName` constant.
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
// Global state variables.
|
|
76
|
+
let wasmWebClient = null;
|
|
77
|
+
let wasmSeed = null; // Seed for the WASM WebClient, if needed.
|
|
78
|
+
let ready = false; // Indicates if the worker is fully initialized.
|
|
79
|
+
let messageQueue = []; // Queue for sequential processing.
|
|
80
|
+
let processing = false; // Flag to ensure one message is processed at a time.
|
|
81
|
+
|
|
82
|
+
// Define a mapping from method names to handler functions.
|
|
83
|
+
const methodHandlers = {
|
|
84
|
+
[MethodName.NEW_WALLET]: async (args) => {
|
|
85
|
+
const wasm = await getWasmOrThrow();
|
|
86
|
+
const [walletStorageModeStr, mutable, authSchemeId, seed] = args;
|
|
87
|
+
const walletStorageMode =
|
|
88
|
+
wasm.AccountStorageMode.tryFromStr(walletStorageModeStr);
|
|
89
|
+
const wallet = await wasmWebClient.newWallet(
|
|
90
|
+
walletStorageMode,
|
|
91
|
+
mutable,
|
|
92
|
+
authSchemeId,
|
|
93
|
+
seed
|
|
94
|
+
);
|
|
95
|
+
const serializedWallet = wallet.serialize();
|
|
96
|
+
return serializedWallet.buffer;
|
|
97
|
+
},
|
|
98
|
+
[MethodName.NEW_FAUCET]: async (args) => {
|
|
99
|
+
const wasm = await getWasmOrThrow();
|
|
100
|
+
const [
|
|
101
|
+
faucetStorageModeStr,
|
|
102
|
+
nonFungible,
|
|
103
|
+
tokenSymbol,
|
|
104
|
+
decimals,
|
|
105
|
+
maxSupplyStr,
|
|
106
|
+
authSchemeId,
|
|
107
|
+
] = args;
|
|
108
|
+
const faucetStorageMode =
|
|
109
|
+
wasm.AccountStorageMode.tryFromStr(faucetStorageModeStr);
|
|
110
|
+
const maxSupply = BigInt(maxSupplyStr);
|
|
111
|
+
const faucet = await wasmWebClient.newFaucet(
|
|
112
|
+
faucetStorageMode,
|
|
113
|
+
nonFungible,
|
|
114
|
+
tokenSymbol,
|
|
115
|
+
decimals,
|
|
116
|
+
maxSupply,
|
|
117
|
+
authSchemeId
|
|
118
|
+
);
|
|
119
|
+
const serializedFaucet = faucet.serialize();
|
|
120
|
+
return serializedFaucet.buffer;
|
|
121
|
+
},
|
|
122
|
+
[MethodName.SYNC_STATE]: async () => {
|
|
123
|
+
const syncSummary = await wasmWebClient.syncState();
|
|
124
|
+
const serializedSyncSummary = syncSummary.serialize();
|
|
125
|
+
return serializedSyncSummary.buffer;
|
|
126
|
+
},
|
|
127
|
+
[MethodName.EXECUTE_TRANSACTION]: async (args) => {
|
|
128
|
+
const wasm = await getWasmOrThrow();
|
|
129
|
+
const [accountIdHex, serializedTransactionRequest] = args;
|
|
130
|
+
const accountId = wasm.AccountId.fromHex(accountIdHex);
|
|
131
|
+
const transactionRequestBytes = new Uint8Array(
|
|
132
|
+
serializedTransactionRequest
|
|
133
|
+
);
|
|
134
|
+
const transactionRequest = wasm.TransactionRequest.deserialize(
|
|
135
|
+
transactionRequestBytes
|
|
136
|
+
);
|
|
137
|
+
const result = await wasmWebClient.executeTransaction(
|
|
138
|
+
accountId,
|
|
139
|
+
transactionRequest
|
|
140
|
+
);
|
|
141
|
+
const serializedResult = result.serialize();
|
|
142
|
+
return serializedResult.buffer;
|
|
143
|
+
},
|
|
144
|
+
[MethodName.PROVE_TRANSACTION]: async (args) => {
|
|
145
|
+
const wasm = await getWasmOrThrow();
|
|
146
|
+
const [serializedTransactionResult, proverPayload] = args;
|
|
147
|
+
const transactionResultBytes = new Uint8Array(serializedTransactionResult);
|
|
148
|
+
const transactionResult = wasm.TransactionResult.deserialize(
|
|
149
|
+
transactionResultBytes
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
let prover;
|
|
153
|
+
if (proverPayload) {
|
|
154
|
+
if (proverPayload === "local") {
|
|
155
|
+
prover = wasm.TransactionProver.newLocalProver();
|
|
156
|
+
} else if (proverPayload.startsWith("remote:")) {
|
|
157
|
+
const endpoint = proverPayload.slice("remote:".length);
|
|
158
|
+
if (!endpoint) {
|
|
159
|
+
throw new Error("Remote prover requires an endpoint");
|
|
160
|
+
}
|
|
161
|
+
prover = wasm.TransactionProver.newRemoteProver(endpoint);
|
|
162
|
+
} else {
|
|
163
|
+
throw new Error("Invalid prover tag received in worker");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const proven = await wasmWebClient.proveTransaction(
|
|
168
|
+
transactionResult,
|
|
169
|
+
prover
|
|
170
|
+
);
|
|
171
|
+
const serializedProven = proven.serialize();
|
|
172
|
+
return serializedProven.buffer;
|
|
173
|
+
},
|
|
174
|
+
[MethodName.SUBMIT_NEW_TRANSACTION]: async (args) => {
|
|
175
|
+
const wasm = await getWasmOrThrow();
|
|
176
|
+
const [accountIdHex, serializedTransactionRequest] = args;
|
|
177
|
+
const accountId = wasm.AccountId.fromHex(accountIdHex);
|
|
178
|
+
const transactionRequestBytes = new Uint8Array(
|
|
179
|
+
serializedTransactionRequest
|
|
180
|
+
);
|
|
181
|
+
const transactionRequest = wasm.TransactionRequest.deserialize(
|
|
182
|
+
transactionRequestBytes
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
const result = await wasmWebClient.executeTransaction(
|
|
186
|
+
accountId,
|
|
187
|
+
transactionRequest
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
const transactionId = result.id().toHex();
|
|
191
|
+
|
|
192
|
+
const proven = await wasmWebClient.proveTransaction(result);
|
|
193
|
+
const submissionHeight = await wasmWebClient.submitProvenTransaction(
|
|
194
|
+
proven,
|
|
195
|
+
result
|
|
196
|
+
);
|
|
197
|
+
const transactionUpdate = await wasmWebClient.applyTransaction(
|
|
198
|
+
result,
|
|
199
|
+
submissionHeight
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
transactionId,
|
|
204
|
+
submissionHeight,
|
|
205
|
+
serializedTransactionResult: result.serialize().buffer,
|
|
206
|
+
serializedTransactionUpdate: transactionUpdate.serialize().buffer,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// Add mock methods to the handler mapping.
|
|
212
|
+
methodHandlers[MethodName.SYNC_STATE_MOCK] = async (args) => {
|
|
213
|
+
let [serializedMockChain, serializedMockNoteTransportNode] = args;
|
|
214
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
215
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
216
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
217
|
+
: null;
|
|
218
|
+
await wasmWebClient.createMockClient(
|
|
219
|
+
wasmSeed,
|
|
220
|
+
serializedMockChain,
|
|
221
|
+
serializedMockNoteTransportNode
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
return await methodHandlers[MethodName.SYNC_STATE]();
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_MOCK] = async (args) => {
|
|
228
|
+
const wasm = await getWasmOrThrow();
|
|
229
|
+
let serializedMockNoteTransportNode = args.pop();
|
|
230
|
+
let serializedMockChain = args.pop();
|
|
231
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
232
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
233
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
234
|
+
: null;
|
|
235
|
+
|
|
236
|
+
wasmWebClient = new wasm.WebClient();
|
|
237
|
+
await wasmWebClient.createMockClient(
|
|
238
|
+
wasmSeed,
|
|
239
|
+
serializedMockChain,
|
|
240
|
+
serializedMockNoteTransportNode
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
const result = await methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION](args);
|
|
244
|
+
|
|
245
|
+
return {
|
|
246
|
+
transactionId: result.transactionId,
|
|
247
|
+
submissionHeight: result.submissionHeight,
|
|
248
|
+
serializedTransactionResult: result.serializedTransactionResult,
|
|
249
|
+
serializedTransactionUpdate: result.serializedTransactionUpdate,
|
|
250
|
+
serializedMockChain: wasmWebClient.serializeMockChain().buffer,
|
|
251
|
+
serializedMockNoteTransportNode:
|
|
252
|
+
wasmWebClient.serializeMockNoteTransportNode().buffer,
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Process a single message event.
|
|
258
|
+
*/
|
|
259
|
+
async function processMessage(event) {
|
|
260
|
+
const { action, args, methodName, requestId } = event.data;
|
|
261
|
+
try {
|
|
262
|
+
if (action === WorkerAction.INIT) {
|
|
263
|
+
const [rpcUrl, noteTransportUrl, seed] = args;
|
|
264
|
+
// Initialize the WASM WebClient.
|
|
265
|
+
const wasm = await getWasmOrThrow();
|
|
266
|
+
wasmWebClient = new wasm.WebClient();
|
|
267
|
+
await wasmWebClient.createClient(rpcUrl, noteTransportUrl, seed);
|
|
268
|
+
|
|
269
|
+
wasmSeed = seed;
|
|
270
|
+
ready = true;
|
|
271
|
+
// Signal that the worker is fully initialized.
|
|
272
|
+
self.postMessage({ ready: true });
|
|
273
|
+
return;
|
|
274
|
+
} else if (action === WorkerAction.CALL_METHOD) {
|
|
275
|
+
if (!ready) {
|
|
276
|
+
throw new Error("Worker is not ready. Please initialize first.");
|
|
277
|
+
}
|
|
278
|
+
if (!wasmWebClient) {
|
|
279
|
+
throw new Error("WebClient not initialized in worker.");
|
|
280
|
+
}
|
|
281
|
+
// Look up the handler from the mapping.
|
|
282
|
+
const handler = methodHandlers[methodName];
|
|
283
|
+
if (!handler) {
|
|
284
|
+
throw new Error(`Unsupported method: ${methodName}`);
|
|
285
|
+
}
|
|
286
|
+
const result = await handler(args);
|
|
287
|
+
self.postMessage({ requestId, result });
|
|
288
|
+
return;
|
|
289
|
+
} else {
|
|
290
|
+
throw new Error(`Unsupported action: ${action}`);
|
|
291
|
+
}
|
|
292
|
+
} catch (error) {
|
|
293
|
+
console.error(`WORKER: Error occurred - ${error}`);
|
|
294
|
+
self.postMessage({ requestId, error: error });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Process messages one at a time from the messageQueue.
|
|
300
|
+
*/
|
|
301
|
+
async function processQueue() {
|
|
302
|
+
if (processing || messageQueue.length === 0) return;
|
|
303
|
+
processing = true;
|
|
304
|
+
const event = messageQueue.shift();
|
|
305
|
+
try {
|
|
306
|
+
await processMessage(event);
|
|
307
|
+
} finally {
|
|
308
|
+
processing = false;
|
|
309
|
+
processQueue(); // Process next message in queue.
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Enqueue incoming messages and process them sequentially.
|
|
314
|
+
self.onmessage = (event) => {
|
|
315
|
+
messageQueue.push(event);
|
|
316
|
+
processQueue();
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// Immediately signal that the worker script has loaded.
|
|
320
|
+
// This tells the main thread that the file is fully loaded before sending the "init" message.
|
|
321
|
+
self.postMessage({ loaded: true });
|
|
322
|
+
//# sourceMappingURL=web-client-methods-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-client-methods-worker.js","sources":["../wasm.js","../../js/constants.js","../../js/workers/web-client-methods-worker.js"],"sourcesContent":["// This is a documented workaround that should avoid issues with Vite projects\n// https://github.com/wasm-tool/rollup-plugin-rust?tab=readme-ov-file#usage-with-vite\n// Also, this effectively disables SSR.\nasync function loadWasm() {\n let wasmModule;\n if (!import.meta.env || (import.meta.env && !import.meta.env.SSR)) {\n wasmModule = await import('./Cargo-15e14c5a.js');\n }\n return wasmModule;\n}\n\nexport { loadWasm as default };\n//# sourceMappingURL=wasm.js.map\n","export const WorkerAction = Object.freeze({\n INIT: \"init\",\n CALL_METHOD: \"callMethod\",\n});\n\nexport const MethodName = Object.freeze({\n CREATE_CLIENT: \"createClient\",\n NEW_WALLET: \"newWallet\",\n NEW_FAUCET: \"newFaucet\",\n EXECUTE_TRANSACTION: \"executeTransaction\",\n PROVE_TRANSACTION: \"proveTransaction\",\n SUBMIT_NEW_TRANSACTION: \"submitNewTransaction\",\n SUBMIT_NEW_TRANSACTION_MOCK: \"submitNewTransactionMock\",\n SYNC_STATE: \"syncState\",\n SYNC_STATE_MOCK: \"syncStateMock\",\n});\n","import loadWasm from \"../../dist/wasm.js\";\nimport { MethodName, WorkerAction } from \"../constants.js\";\n\nlet wasmModule = null;\n\nconst getWasmOrThrow = async () => {\n if (!wasmModule) {\n wasmModule = await loadWasm();\n }\n if (!wasmModule) {\n throw new Error(\n \"Miden WASM bindings are unavailable in the worker environment.\"\n );\n }\n return wasmModule;\n};\n\n/**\n * Worker for executing WebClient methods in a separate thread.\n *\n * This worker offloads computationally heavy tasks from the main thread by handling\n * WebClient operations asynchronously. It imports the WASM module and instantiates a\n * WASM WebClient, then listens for messages from the main thread to perform one of two actions:\n *\n * 1. **Initialization (init):**\n * - The worker receives an \"init\" message along with user parameters (RPC URL and seed).\n * - It instantiates the WASM WebClient and calls its createClient method.\n * - Once initialization is complete, the worker sends a `{ ready: true }` message back to signal\n * that it is fully initialized.\n *\n * 2. **Method Invocation (callMethod):**\n * - The worker receives a \"callMethod\" message with a specific method name and arguments.\n * - It uses a mapping (defined in `methodHandlers`) to route the call to the corresponding WASM WebClient method.\n * - Complex data is serialized before being sent and deserialized upon return.\n * - The result (or any error) is then posted back to the main thread.\n *\n * The worker uses a message queue to process incoming messages sequentially, ensuring that only one message\n * is handled at a time.\n *\n * Additionally, the worker immediately sends a `{ loaded: true }` message upon script load. This informs the main\n * thread that the worker script is loaded and ready to receive the \"init\" message.\n *\n * Supported actions (defined in `WorkerAction`):\n * - \"init\" : Initialize the WASM WebClient with provided parameters.\n * - \"callMethod\" : Invoke a designated method on the WASM WebClient.\n *\n * Supported method names are defined in the `MethodName` constant.\n */\n\n// Global state variables.\nlet wasmWebClient = null;\nlet wasmSeed = null; // Seed for the WASM WebClient, if needed.\nlet ready = false; // Indicates if the worker is fully initialized.\nlet messageQueue = []; // Queue for sequential processing.\nlet processing = false; // Flag to ensure one message is processed at a time.\n\n// Define a mapping from method names to handler functions.\nconst methodHandlers = {\n [MethodName.NEW_WALLET]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [walletStorageModeStr, mutable, authSchemeId, seed] = args;\n const walletStorageMode =\n wasm.AccountStorageMode.tryFromStr(walletStorageModeStr);\n const wallet = await wasmWebClient.newWallet(\n walletStorageMode,\n mutable,\n authSchemeId,\n seed\n );\n const serializedWallet = wallet.serialize();\n return serializedWallet.buffer;\n },\n [MethodName.NEW_FAUCET]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [\n faucetStorageModeStr,\n nonFungible,\n tokenSymbol,\n decimals,\n maxSupplyStr,\n authSchemeId,\n ] = args;\n const faucetStorageMode =\n wasm.AccountStorageMode.tryFromStr(faucetStorageModeStr);\n const maxSupply = BigInt(maxSupplyStr);\n const faucet = await wasmWebClient.newFaucet(\n faucetStorageMode,\n nonFungible,\n tokenSymbol,\n decimals,\n maxSupply,\n authSchemeId\n );\n const serializedFaucet = faucet.serialize();\n return serializedFaucet.buffer;\n },\n [MethodName.SYNC_STATE]: async () => {\n const syncSummary = await wasmWebClient.syncState();\n const serializedSyncSummary = syncSummary.serialize();\n return serializedSyncSummary.buffer;\n },\n [MethodName.EXECUTE_TRANSACTION]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [accountIdHex, serializedTransactionRequest] = args;\n const accountId = wasm.AccountId.fromHex(accountIdHex);\n const transactionRequestBytes = new Uint8Array(\n serializedTransactionRequest\n );\n const transactionRequest = wasm.TransactionRequest.deserialize(\n transactionRequestBytes\n );\n const result = await wasmWebClient.executeTransaction(\n accountId,\n transactionRequest\n );\n const serializedResult = result.serialize();\n return serializedResult.buffer;\n },\n [MethodName.PROVE_TRANSACTION]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [serializedTransactionResult, proverPayload] = args;\n const transactionResultBytes = new Uint8Array(serializedTransactionResult);\n const transactionResult = wasm.TransactionResult.deserialize(\n transactionResultBytes\n );\n\n let prover;\n if (proverPayload) {\n if (proverPayload === \"local\") {\n prover = wasm.TransactionProver.newLocalProver();\n } else if (proverPayload.startsWith(\"remote:\")) {\n const endpoint = proverPayload.slice(\"remote:\".length);\n if (!endpoint) {\n throw new Error(\"Remote prover requires an endpoint\");\n }\n prover = wasm.TransactionProver.newRemoteProver(endpoint);\n } else {\n throw new Error(\"Invalid prover tag received in worker\");\n }\n }\n\n const proven = await wasmWebClient.proveTransaction(\n transactionResult,\n prover\n );\n const serializedProven = proven.serialize();\n return serializedProven.buffer;\n },\n [MethodName.SUBMIT_NEW_TRANSACTION]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [accountIdHex, serializedTransactionRequest] = args;\n const accountId = wasm.AccountId.fromHex(accountIdHex);\n const transactionRequestBytes = new Uint8Array(\n serializedTransactionRequest\n );\n const transactionRequest = wasm.TransactionRequest.deserialize(\n transactionRequestBytes\n );\n\n const result = await wasmWebClient.executeTransaction(\n accountId,\n transactionRequest\n );\n\n const transactionId = result.id().toHex();\n\n const proven = await wasmWebClient.proveTransaction(result);\n const submissionHeight = await wasmWebClient.submitProvenTransaction(\n proven,\n result\n );\n const transactionUpdate = await wasmWebClient.applyTransaction(\n result,\n submissionHeight\n );\n\n return {\n transactionId,\n submissionHeight,\n serializedTransactionResult: result.serialize().buffer,\n serializedTransactionUpdate: transactionUpdate.serialize().buffer,\n };\n },\n};\n\n// Add mock methods to the handler mapping.\nmethodHandlers[MethodName.SYNC_STATE_MOCK] = async (args) => {\n let [serializedMockChain, serializedMockNoteTransportNode] = args;\n serializedMockChain = new Uint8Array(serializedMockChain);\n serializedMockNoteTransportNode = serializedMockNoteTransportNode\n ? new Uint8Array(serializedMockNoteTransportNode)\n : null;\n await wasmWebClient.createMockClient(\n wasmSeed,\n serializedMockChain,\n serializedMockNoteTransportNode\n );\n\n return await methodHandlers[MethodName.SYNC_STATE]();\n};\n\nmethodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_MOCK] = async (args) => {\n const wasm = await getWasmOrThrow();\n let serializedMockNoteTransportNode = args.pop();\n let serializedMockChain = args.pop();\n serializedMockChain = new Uint8Array(serializedMockChain);\n serializedMockNoteTransportNode = serializedMockNoteTransportNode\n ? new Uint8Array(serializedMockNoteTransportNode)\n : null;\n\n wasmWebClient = new wasm.WebClient();\n await wasmWebClient.createMockClient(\n wasmSeed,\n serializedMockChain,\n serializedMockNoteTransportNode\n );\n\n const result = await methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION](args);\n\n return {\n transactionId: result.transactionId,\n submissionHeight: result.submissionHeight,\n serializedTransactionResult: result.serializedTransactionResult,\n serializedTransactionUpdate: result.serializedTransactionUpdate,\n serializedMockChain: wasmWebClient.serializeMockChain().buffer,\n serializedMockNoteTransportNode:\n wasmWebClient.serializeMockNoteTransportNode().buffer,\n };\n};\n\n/**\n * Process a single message event.\n */\nasync function processMessage(event) {\n const { action, args, methodName, requestId } = event.data;\n try {\n if (action === WorkerAction.INIT) {\n const [rpcUrl, noteTransportUrl, seed] = args;\n // Initialize the WASM WebClient.\n const wasm = await getWasmOrThrow();\n wasmWebClient = new wasm.WebClient();\n await wasmWebClient.createClient(rpcUrl, noteTransportUrl, seed);\n\n wasmSeed = seed;\n ready = true;\n // Signal that the worker is fully initialized.\n self.postMessage({ ready: true });\n return;\n } else if (action === WorkerAction.CALL_METHOD) {\n if (!ready) {\n throw new Error(\"Worker is not ready. Please initialize first.\");\n }\n if (!wasmWebClient) {\n throw new Error(\"WebClient not initialized in worker.\");\n }\n // Look up the handler from the mapping.\n const handler = methodHandlers[methodName];\n if (!handler) {\n throw new Error(`Unsupported method: ${methodName}`);\n }\n const result = await handler(args);\n self.postMessage({ requestId, result });\n return;\n } else {\n throw new Error(`Unsupported action: ${action}`);\n }\n } catch (error) {\n console.error(`WORKER: Error occurred - ${error}`);\n self.postMessage({ requestId, error: error });\n }\n}\n\n/**\n * Process messages one at a time from the messageQueue.\n */\nasync function processQueue() {\n if (processing || messageQueue.length === 0) return;\n processing = true;\n const event = messageQueue.shift();\n try {\n await processMessage(event);\n } finally {\n processing = false;\n processQueue(); // Process next message in queue.\n }\n}\n\n// Enqueue incoming messages and process them sequentially.\nself.onmessage = (event) => {\n messageQueue.push(event);\n processQueue();\n};\n\n// Immediately signal that the worker script has loaded.\n// This tells the main thread that the file is fully loaded before sending the \"init\" message.\nself.postMessage({ loaded: true });\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA,eAAe,QAAQ,GAAG;AAC1B,EAAE,IAAI,UAAU,CAAC;AACjB,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AACrE,IAAI,UAAU,GAAG,MAAM,OAAO,8BAAqB,CAAC,CAAC;AACrD,GAAG;AACH,EAAE,OAAO,UAAU,CAAC;AACpB;;ACTO,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;AAC1C,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,WAAW,EAAE,YAAY;AAC3B,CAAC,CAAC,CAAC;AACH;AACO,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;AACxC,EAAE,aAAa,EAAE,cAAc;AAC/B,EAAE,UAAU,EAAE,WAAW;AACzB,EAAE,UAAU,EAAE,WAAW;AACzB,EAAE,mBAAmB,EAAE,oBAAoB;AAC3C,EAAE,iBAAiB,EAAE,kBAAkB;AACvC,EAAE,sBAAsB,EAAE,sBAAsB;AAChD,EAAE,2BAA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,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAClD,GAAG;AACH,CAAC;AACD;AACA;AACA;AACA;AACA,eAAe,YAAY,GAAG;AAC9B,EAAE,IAAI,UAAU,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO;AACtD,EAAE,UAAU,GAAG,IAAI,CAAC;AACpB,EAAE,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC;AACrC,EAAE,IAAI;AACN,IAAI,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;AAChC,GAAG,SAAS;AACZ,IAAI,UAAU,GAAG,KAAK,CAAC;AACvB,IAAI,YAAY,EAAE,CAAC;AACnB,GAAG;AACH,CAAC;AACD;AACA;AACA,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,KAAK;AAC5B,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3B,EAAE,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC;AACF;AACA;AACA;AACA,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@miden-sdk/miden-sdk",
|
|
3
|
+
"version": "0.13.0-next.1",
|
|
4
|
+
"description": "Miden Wasm SDK",
|
|
5
|
+
"collaborators": [
|
|
6
|
+
"Miden"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"browser": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"../LICENSE.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build-rust-client-js": "cd ../idxdb-store/src/ && yarn && yarn build",
|
|
21
|
+
"build": "rimraf dist && npm run build-rust-client-js && cross-env RUSTFLAGS=\"--cfg getrandom_backend=\\\"wasm_js\\\"\" rollup -c rollup.config.js && cpr js/types dist && node clean.js",
|
|
22
|
+
"build-dev": "npm install && MIDEN_WEB_DEV=true npm run build",
|
|
23
|
+
"check:wasm-types": "node ./scripts/check-bindgen-types.js",
|
|
24
|
+
"test": "yarn playwright install --with-deps && yarn playwright test",
|
|
25
|
+
"test:remote_prover": "yarn install && yarn playwright install --with-deps && cross-env MIDEN_WEB_DEV=true yarn run build && cross-env REMOTE_PROVER=true yarn playwright test -g 'with remote prover' ",
|
|
26
|
+
"test:clean": "yarn install && yarn playwright install --with-deps && MIDEN_WEB_DEV=true yarn run build && yarn playwright test "
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@playwright/test": "^1.55.0",
|
|
30
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
31
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
32
|
+
"@types/node": "^24.9.2",
|
|
33
|
+
"@wasm-tool/rollup-plugin-rust": "^3.0.3",
|
|
34
|
+
"chai": "^5.1.1",
|
|
35
|
+
"cpr": "^3.0.1",
|
|
36
|
+
"cross-env": "^7.0.3",
|
|
37
|
+
"esm": "^3.2.25",
|
|
38
|
+
"http-server": "^14.1.1",
|
|
39
|
+
"mocha": "^10.7.3",
|
|
40
|
+
"puppeteer": "^23.1.0",
|
|
41
|
+
"rimraf": "^6.0.1",
|
|
42
|
+
"rollup": "^3.27.2",
|
|
43
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
44
|
+
"ts-node": "^10.9.2",
|
|
45
|
+
"typedoc": "^0.28.1",
|
|
46
|
+
"typedoc-plugin-markdown": "^4.8.1",
|
|
47
|
+
"typescript": "^5.5.4"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
51
|
+
"dexie": "^4.0.1",
|
|
52
|
+
"glob": "^11.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|