@miden-sdk/miden-sdk 0.14.1 → 0.14.2
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/{Cargo-BZOulF0S.js → Cargo-D44KIErf.js} +150 -114
- package/dist/Cargo-D44KIErf.js.map +1 -0
- package/dist/api-types.d.ts +65 -7
- package/dist/assets/miden_client_web.wasm +0 -0
- package/dist/index.js +112 -25
- package/dist/index.js.map +1 -1
- package/dist/wasm.js +1 -1
- package/dist/workers/Cargo-D44KIErf-BV9FX7WD.js +24488 -0
- package/dist/workers/Cargo-D44KIErf-BV9FX7WD.js.map +1 -0
- package/dist/workers/assets/miden_client_web.wasm +0 -0
- package/dist/workers/web-client-methods-worker.js +151 -115
- package/dist/workers/web-client-methods-worker.js.map +1 -1
- package/dist/workers/web-client-methods-worker.module.js +551 -0
- package/dist/workers/web-client-methods-worker.module.js.map +1 -0
- package/package.json +2 -1
- package/dist/Cargo-BZOulF0S.js.map +0 -1
|
@@ -0,0 +1,551 @@
|
|
|
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-D44KIErf-BV9FX7WD.js');
|
|
8
|
+
// The Cargo glue's __wbg_init TLA is stripped by the rollup build to
|
|
9
|
+
// prevent blocking WKWebView module evaluation. Call it explicitly here
|
|
10
|
+
// with the WASM URL that the Cargo glue pre-resolves (relative to its
|
|
11
|
+
// own import.meta.url, which downstream bundlers handle correctly).
|
|
12
|
+
if (wasmModule && typeof wasmModule.__wbg_init === "function") {
|
|
13
|
+
await wasmModule.__wbg_init({
|
|
14
|
+
// eslint-disable-next-line camelcase -- wasm-bindgen init API parameter name
|
|
15
|
+
module_or_path: wasmModule.__wasm_url,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return wasmModule;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const WorkerAction = Object.freeze({
|
|
23
|
+
INIT: "init",
|
|
24
|
+
INIT_MOCK: "initMock",
|
|
25
|
+
CALL_METHOD: "callMethod",
|
|
26
|
+
EXECUTE_CALLBACK: "executeCallback",
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const CallbackType = Object.freeze({
|
|
30
|
+
GET_KEY: "getKey",
|
|
31
|
+
INSERT_KEY: "insertKey",
|
|
32
|
+
SIGN: "sign",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const MethodName = Object.freeze({
|
|
36
|
+
CREATE_CLIENT: "createClient",
|
|
37
|
+
APPLY_TRANSACTION: "applyTransaction",
|
|
38
|
+
EXECUTE_TRANSACTION: "executeTransaction",
|
|
39
|
+
PROVE_TRANSACTION: "proveTransaction",
|
|
40
|
+
SUBMIT_NEW_TRANSACTION: "submitNewTransaction",
|
|
41
|
+
SUBMIT_NEW_TRANSACTION_MOCK: "submitNewTransactionMock",
|
|
42
|
+
SUBMIT_NEW_TRANSACTION_WITH_PROVER: "submitNewTransactionWithProver",
|
|
43
|
+
SUBMIT_NEW_TRANSACTION_WITH_PROVER_MOCK: "submitNewTransactionWithProverMock",
|
|
44
|
+
SYNC_STATE: "syncState",
|
|
45
|
+
SYNC_STATE_MOCK: "syncStateMock",
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
let wasmModule = null;
|
|
49
|
+
|
|
50
|
+
const getWasmOrThrow = async () => {
|
|
51
|
+
if (!wasmModule) {
|
|
52
|
+
wasmModule = await loadWasm();
|
|
53
|
+
}
|
|
54
|
+
if (!wasmModule) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"Miden WASM bindings are unavailable in the worker environment."
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return wasmModule;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const serializeUnknown = (value) => {
|
|
63
|
+
if (typeof value === "string") {
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
return JSON.stringify(value);
|
|
68
|
+
} catch {
|
|
69
|
+
return String(value);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const serializeError = (error) => {
|
|
74
|
+
if (error instanceof Error) {
|
|
75
|
+
return {
|
|
76
|
+
name: error.name,
|
|
77
|
+
message: error.message,
|
|
78
|
+
stack: error.stack,
|
|
79
|
+
cause: error.cause ? serializeError(error.cause) : undefined,
|
|
80
|
+
code: error.code,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (typeof error === "object" && error !== null) {
|
|
85
|
+
return {
|
|
86
|
+
name: error.name ?? "Error",
|
|
87
|
+
message: error.message ?? serializeUnknown(error),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
name: "Error",
|
|
93
|
+
message: serializeUnknown(error),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Worker for executing WebClient methods in a separate thread.
|
|
99
|
+
*
|
|
100
|
+
* This worker offloads computationally heavy tasks from the main thread by handling
|
|
101
|
+
* WebClient operations asynchronously. It imports the WASM module and instantiates a
|
|
102
|
+
* WASM WebClient, then listens for messages from the main thread to perform one of two actions:
|
|
103
|
+
*
|
|
104
|
+
* 1. **Initialization (init):**
|
|
105
|
+
* - The worker receives an "init" message along with user parameters (RPC URL and seed).
|
|
106
|
+
* - It instantiates the WASM WebClient and calls its createClient method.
|
|
107
|
+
* - Once initialization is complete, the worker sends a `{ ready: true }` message back to signal
|
|
108
|
+
* that it is fully initialized.
|
|
109
|
+
*
|
|
110
|
+
* 2. **Method Invocation (callMethod):**
|
|
111
|
+
* - The worker receives a "callMethod" message with a specific method name and arguments.
|
|
112
|
+
* - It uses a mapping (defined in `methodHandlers`) to route the call to the corresponding WASM WebClient method.
|
|
113
|
+
* - Complex data is serialized before being sent and deserialized upon return.
|
|
114
|
+
* - The result (or any error) is then posted back to the main thread.
|
|
115
|
+
*
|
|
116
|
+
* The worker uses a message queue to process incoming messages sequentially, ensuring that only one message
|
|
117
|
+
* is handled at a time.
|
|
118
|
+
*
|
|
119
|
+
* Additionally, the worker immediately sends a `{ loaded: true }` message upon script load. This informs the main
|
|
120
|
+
* thread that the worker script is loaded and ready to receive the "init" message.
|
|
121
|
+
*
|
|
122
|
+
* Supported actions (defined in `WorkerAction`):
|
|
123
|
+
* - "init" : Initialize the WASM WebClient with provided parameters.
|
|
124
|
+
* - "callMethod" : Invoke a designated method on the WASM WebClient.
|
|
125
|
+
*
|
|
126
|
+
* Supported method names are defined in the `MethodName` constant.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
// Global state variables.
|
|
130
|
+
let wasmWebClient = null;
|
|
131
|
+
let wasmSeed = null; // Seed for the WASM WebClient, if needed.
|
|
132
|
+
let ready = false; // Indicates if the worker is fully initialized.
|
|
133
|
+
let messageQueue = []; // Queue for sequential processing.
|
|
134
|
+
let processing = false; // Flag to ensure one message is processed at a time.
|
|
135
|
+
|
|
136
|
+
// Track pending callback requests
|
|
137
|
+
let pendingCallbacks = new Map();
|
|
138
|
+
|
|
139
|
+
// Timeout for pending callbacks (30 seconds)
|
|
140
|
+
const CALLBACK_TIMEOUT_MS = 30000;
|
|
141
|
+
|
|
142
|
+
// Define proxy functions for callbacks that communicate with main thread
|
|
143
|
+
const callbackProxies = {
|
|
144
|
+
getKey: async (pubKey) => {
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
const requestId = `${CallbackType.GET_KEY}-${Date.now()}-${Math.random()}`;
|
|
147
|
+
const timeoutId = setTimeout(() => {
|
|
148
|
+
if (pendingCallbacks.has(requestId)) {
|
|
149
|
+
pendingCallbacks.delete(requestId);
|
|
150
|
+
reject(new Error(`Callback ${requestId} timed out`));
|
|
151
|
+
}
|
|
152
|
+
}, CALLBACK_TIMEOUT_MS);
|
|
153
|
+
pendingCallbacks.set(requestId, { resolve, reject, timeoutId });
|
|
154
|
+
|
|
155
|
+
self.postMessage({
|
|
156
|
+
action: WorkerAction.EXECUTE_CALLBACK,
|
|
157
|
+
callbackType: CallbackType.GET_KEY,
|
|
158
|
+
args: [pubKey],
|
|
159
|
+
requestId,
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
insertKey: async (pubKey, secretKey) => {
|
|
164
|
+
return new Promise((resolve, reject) => {
|
|
165
|
+
const requestId = `${CallbackType.INSERT_KEY}-${Date.now()}-${Math.random()}`;
|
|
166
|
+
const timeoutId = setTimeout(() => {
|
|
167
|
+
if (pendingCallbacks.has(requestId)) {
|
|
168
|
+
pendingCallbacks.delete(requestId);
|
|
169
|
+
reject(new Error(`Callback ${requestId} timed out`));
|
|
170
|
+
}
|
|
171
|
+
}, CALLBACK_TIMEOUT_MS);
|
|
172
|
+
pendingCallbacks.set(requestId, { resolve, reject, timeoutId });
|
|
173
|
+
|
|
174
|
+
self.postMessage({
|
|
175
|
+
action: WorkerAction.EXECUTE_CALLBACK,
|
|
176
|
+
callbackType: CallbackType.INSERT_KEY,
|
|
177
|
+
args: [pubKey, secretKey],
|
|
178
|
+
requestId,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
sign: async (pubKey, signingInputs) => {
|
|
183
|
+
return new Promise((resolve, reject) => {
|
|
184
|
+
const requestId = `${CallbackType.SIGN}-${Date.now()}-${Math.random()}`;
|
|
185
|
+
const timeoutId = setTimeout(() => {
|
|
186
|
+
if (pendingCallbacks.has(requestId)) {
|
|
187
|
+
pendingCallbacks.delete(requestId);
|
|
188
|
+
reject(new Error(`Callback ${requestId} timed out`));
|
|
189
|
+
}
|
|
190
|
+
}, CALLBACK_TIMEOUT_MS);
|
|
191
|
+
pendingCallbacks.set(requestId, { resolve, reject, timeoutId });
|
|
192
|
+
|
|
193
|
+
self.postMessage({
|
|
194
|
+
action: WorkerAction.EXECUTE_CALLBACK,
|
|
195
|
+
callbackType: CallbackType.SIGN,
|
|
196
|
+
args: [pubKey, signingInputs],
|
|
197
|
+
requestId,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Define a mapping from method names to handler functions.
|
|
204
|
+
const methodHandlers = {
|
|
205
|
+
[MethodName.SYNC_STATE]: async () => {
|
|
206
|
+
// Call the internal WASM method (sync lock is handled at the JS wrapper level)
|
|
207
|
+
const syncSummary = await wasmWebClient.syncStateImpl();
|
|
208
|
+
const serializedSyncSummary = syncSummary.serialize();
|
|
209
|
+
return serializedSyncSummary.buffer;
|
|
210
|
+
},
|
|
211
|
+
[MethodName.APPLY_TRANSACTION]: async (args) => {
|
|
212
|
+
const wasm = await getWasmOrThrow();
|
|
213
|
+
const [serializedTransactionResult, submissionHeight] = args;
|
|
214
|
+
const transactionResultBytes = new Uint8Array(serializedTransactionResult);
|
|
215
|
+
const transactionResult = wasm.TransactionResult.deserialize(
|
|
216
|
+
transactionResultBytes
|
|
217
|
+
);
|
|
218
|
+
const transactionUpdate = await wasmWebClient.applyTransaction(
|
|
219
|
+
transactionResult,
|
|
220
|
+
submissionHeight
|
|
221
|
+
);
|
|
222
|
+
const serializedUpdate = transactionUpdate.serialize();
|
|
223
|
+
return serializedUpdate.buffer;
|
|
224
|
+
},
|
|
225
|
+
[MethodName.EXECUTE_TRANSACTION]: async (args) => {
|
|
226
|
+
const wasm = await getWasmOrThrow();
|
|
227
|
+
const [accountIdHex, serializedTransactionRequest] = args;
|
|
228
|
+
const accountId = wasm.AccountId.fromHex(accountIdHex);
|
|
229
|
+
const transactionRequestBytes = new Uint8Array(
|
|
230
|
+
serializedTransactionRequest
|
|
231
|
+
);
|
|
232
|
+
const transactionRequest = wasm.TransactionRequest.deserialize(
|
|
233
|
+
transactionRequestBytes
|
|
234
|
+
);
|
|
235
|
+
const result = await wasmWebClient.executeTransaction(
|
|
236
|
+
accountId,
|
|
237
|
+
transactionRequest
|
|
238
|
+
);
|
|
239
|
+
const serializedResult = result.serialize();
|
|
240
|
+
return serializedResult.buffer;
|
|
241
|
+
},
|
|
242
|
+
[MethodName.PROVE_TRANSACTION]: async (args) => {
|
|
243
|
+
const wasm = await getWasmOrThrow();
|
|
244
|
+
const [serializedTransactionResult, proverPayload] = args;
|
|
245
|
+
const transactionResultBytes = new Uint8Array(serializedTransactionResult);
|
|
246
|
+
const transactionResult = wasm.TransactionResult.deserialize(
|
|
247
|
+
transactionResultBytes
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
const prover = proverPayload
|
|
251
|
+
? wasm.TransactionProver.deserialize(proverPayload)
|
|
252
|
+
: undefined;
|
|
253
|
+
|
|
254
|
+
const proven = await wasmWebClient.proveTransaction(
|
|
255
|
+
transactionResult,
|
|
256
|
+
prover
|
|
257
|
+
);
|
|
258
|
+
const serializedProven = proven.serialize();
|
|
259
|
+
return serializedProven.buffer;
|
|
260
|
+
},
|
|
261
|
+
[MethodName.SUBMIT_NEW_TRANSACTION]: async (args) => {
|
|
262
|
+
const wasm = await getWasmOrThrow();
|
|
263
|
+
const [accountIdHex, serializedTransactionRequest] = args;
|
|
264
|
+
const accountId = wasm.AccountId.fromHex(accountIdHex);
|
|
265
|
+
const transactionRequestBytes = new Uint8Array(
|
|
266
|
+
serializedTransactionRequest
|
|
267
|
+
);
|
|
268
|
+
const transactionRequest = wasm.TransactionRequest.deserialize(
|
|
269
|
+
transactionRequestBytes
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
const result = await wasmWebClient.executeTransaction(
|
|
273
|
+
accountId,
|
|
274
|
+
transactionRequest
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
const transactionId = result.id().toHex();
|
|
278
|
+
|
|
279
|
+
const proven = await wasmWebClient.proveTransaction(result);
|
|
280
|
+
const submissionHeight = await wasmWebClient.submitProvenTransaction(
|
|
281
|
+
proven,
|
|
282
|
+
result
|
|
283
|
+
);
|
|
284
|
+
const transactionUpdate = await wasmWebClient.applyTransaction(
|
|
285
|
+
result,
|
|
286
|
+
submissionHeight
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
return {
|
|
290
|
+
transactionId,
|
|
291
|
+
submissionHeight,
|
|
292
|
+
serializedTransactionResult: result.serialize().buffer,
|
|
293
|
+
serializedTransactionUpdate: transactionUpdate.serialize().buffer,
|
|
294
|
+
};
|
|
295
|
+
},
|
|
296
|
+
[MethodName.SUBMIT_NEW_TRANSACTION_WITH_PROVER]: async (args) => {
|
|
297
|
+
const wasm = await getWasmOrThrow();
|
|
298
|
+
const [accountIdHex, serializedTransactionRequest, proverPayload] = args;
|
|
299
|
+
const accountId = wasm.AccountId.fromHex(accountIdHex);
|
|
300
|
+
const transactionRequestBytes = new Uint8Array(
|
|
301
|
+
serializedTransactionRequest
|
|
302
|
+
);
|
|
303
|
+
const transactionRequest = wasm.TransactionRequest.deserialize(
|
|
304
|
+
transactionRequestBytes
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
// Deserialize the prover from the serialized payload
|
|
308
|
+
const prover = proverPayload
|
|
309
|
+
? wasm.TransactionProver.deserialize(proverPayload)
|
|
310
|
+
: undefined;
|
|
311
|
+
|
|
312
|
+
const result = await wasmWebClient.executeTransaction(
|
|
313
|
+
accountId,
|
|
314
|
+
transactionRequest
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
const transactionId = result.id().toHex();
|
|
318
|
+
|
|
319
|
+
const proven = await wasmWebClient.proveTransaction(result, prover);
|
|
320
|
+
const submissionHeight = await wasmWebClient.submitProvenTransaction(
|
|
321
|
+
proven,
|
|
322
|
+
result
|
|
323
|
+
);
|
|
324
|
+
const transactionUpdate = await wasmWebClient.applyTransaction(
|
|
325
|
+
result,
|
|
326
|
+
submissionHeight
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
return {
|
|
330
|
+
transactionId,
|
|
331
|
+
submissionHeight,
|
|
332
|
+
serializedTransactionResult: result.serialize().buffer,
|
|
333
|
+
serializedTransactionUpdate: transactionUpdate.serialize().buffer,
|
|
334
|
+
};
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
// Add mock methods to the handler mapping.
|
|
339
|
+
methodHandlers[MethodName.SYNC_STATE_MOCK] = async (args) => {
|
|
340
|
+
let [serializedMockChain, serializedMockNoteTransportNode] = args;
|
|
341
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
342
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
343
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
344
|
+
: null;
|
|
345
|
+
await wasmWebClient.createMockClient(
|
|
346
|
+
wasmSeed,
|
|
347
|
+
serializedMockChain,
|
|
348
|
+
serializedMockNoteTransportNode
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
return await methodHandlers[MethodName.SYNC_STATE]();
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_MOCK] = async (args) => {
|
|
355
|
+
const wasm = await getWasmOrThrow();
|
|
356
|
+
let serializedMockNoteTransportNode = args.pop();
|
|
357
|
+
let serializedMockChain = args.pop();
|
|
358
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
359
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
360
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
361
|
+
: null;
|
|
362
|
+
|
|
363
|
+
wasmWebClient = new wasm.WebClient();
|
|
364
|
+
await wasmWebClient.createMockClient(
|
|
365
|
+
wasmSeed,
|
|
366
|
+
serializedMockChain,
|
|
367
|
+
serializedMockNoteTransportNode
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
const result = await methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION](args);
|
|
371
|
+
|
|
372
|
+
return {
|
|
373
|
+
transactionId: result.transactionId,
|
|
374
|
+
submissionHeight: result.submissionHeight,
|
|
375
|
+
serializedTransactionResult: result.serializedTransactionResult,
|
|
376
|
+
serializedTransactionUpdate: result.serializedTransactionUpdate,
|
|
377
|
+
serializedMockChain: wasmWebClient.serializeMockChain().buffer,
|
|
378
|
+
serializedMockNoteTransportNode:
|
|
379
|
+
wasmWebClient.serializeMockNoteTransportNode().buffer,
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_WITH_PROVER_MOCK] = async (
|
|
384
|
+
args
|
|
385
|
+
) => {
|
|
386
|
+
const wasm = await getWasmOrThrow();
|
|
387
|
+
let serializedMockNoteTransportNode = args.pop();
|
|
388
|
+
let serializedMockChain = args.pop();
|
|
389
|
+
serializedMockChain = new Uint8Array(serializedMockChain);
|
|
390
|
+
serializedMockNoteTransportNode = serializedMockNoteTransportNode
|
|
391
|
+
? new Uint8Array(serializedMockNoteTransportNode)
|
|
392
|
+
: null;
|
|
393
|
+
|
|
394
|
+
wasmWebClient = new wasm.WebClient();
|
|
395
|
+
await wasmWebClient.createMockClient(
|
|
396
|
+
wasmSeed,
|
|
397
|
+
serializedMockChain,
|
|
398
|
+
serializedMockNoteTransportNode
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
const result =
|
|
402
|
+
await methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_WITH_PROVER](args);
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
transactionId: result.transactionId,
|
|
406
|
+
submissionHeight: result.submissionHeight,
|
|
407
|
+
serializedTransactionResult: result.serializedTransactionResult,
|
|
408
|
+
serializedTransactionUpdate: result.serializedTransactionUpdate,
|
|
409
|
+
serializedMockChain: wasmWebClient.serializeMockChain().buffer,
|
|
410
|
+
serializedMockNoteTransportNode:
|
|
411
|
+
wasmWebClient.serializeMockNoteTransportNode().buffer,
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Process a single message event.
|
|
417
|
+
*/
|
|
418
|
+
async function processMessage(event) {
|
|
419
|
+
const { action, args, methodName, requestId } = event.data;
|
|
420
|
+
try {
|
|
421
|
+
if (action === WorkerAction.INIT) {
|
|
422
|
+
const [
|
|
423
|
+
rpcUrl,
|
|
424
|
+
noteTransportUrl,
|
|
425
|
+
seed,
|
|
426
|
+
storeName,
|
|
427
|
+
hasGetKeyCb,
|
|
428
|
+
hasInsertKeyCb,
|
|
429
|
+
hasSignCb,
|
|
430
|
+
logLevel,
|
|
431
|
+
] = args;
|
|
432
|
+
const wasm = await getWasmOrThrow();
|
|
433
|
+
|
|
434
|
+
if (logLevel) {
|
|
435
|
+
wasm.setupLogging(logLevel);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
wasmWebClient = new wasm.WebClient();
|
|
439
|
+
|
|
440
|
+
// Check if any callbacks are provided
|
|
441
|
+
const useExternalKeystore = hasGetKeyCb || hasInsertKeyCb || hasSignCb;
|
|
442
|
+
|
|
443
|
+
if (useExternalKeystore) {
|
|
444
|
+
// Use callback proxies that communicate with the main thread
|
|
445
|
+
await wasmWebClient.createClientWithExternalKeystore(
|
|
446
|
+
rpcUrl,
|
|
447
|
+
noteTransportUrl,
|
|
448
|
+
seed,
|
|
449
|
+
storeName,
|
|
450
|
+
hasGetKeyCb ? callbackProxies.getKey : undefined,
|
|
451
|
+
hasInsertKeyCb ? callbackProxies.insertKey : undefined,
|
|
452
|
+
hasSignCb ? callbackProxies.sign : undefined
|
|
453
|
+
);
|
|
454
|
+
} else {
|
|
455
|
+
await wasmWebClient.createClient(
|
|
456
|
+
rpcUrl,
|
|
457
|
+
noteTransportUrl,
|
|
458
|
+
seed,
|
|
459
|
+
storeName
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
wasmSeed = seed;
|
|
464
|
+
ready = true;
|
|
465
|
+
self.postMessage({ ready: true });
|
|
466
|
+
return;
|
|
467
|
+
} else if (action === WorkerAction.INIT_MOCK) {
|
|
468
|
+
const [seed, logLevel] = args;
|
|
469
|
+
const wasm = await getWasmOrThrow();
|
|
470
|
+
|
|
471
|
+
if (logLevel) {
|
|
472
|
+
wasm.setupLogging(logLevel);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
wasmWebClient = new wasm.WebClient();
|
|
476
|
+
await wasmWebClient.createMockClient(seed, undefined, undefined);
|
|
477
|
+
|
|
478
|
+
wasmSeed = seed;
|
|
479
|
+
ready = true;
|
|
480
|
+
self.postMessage({ ready: true });
|
|
481
|
+
return;
|
|
482
|
+
} else if (action === WorkerAction.CALL_METHOD) {
|
|
483
|
+
if (!ready) {
|
|
484
|
+
throw new Error("Worker is not ready. Please initialize first.");
|
|
485
|
+
}
|
|
486
|
+
if (!wasmWebClient) {
|
|
487
|
+
throw new Error("WebClient not initialized in worker.");
|
|
488
|
+
}
|
|
489
|
+
// Look up the handler from the mapping.
|
|
490
|
+
const handler = methodHandlers[methodName];
|
|
491
|
+
if (!handler) {
|
|
492
|
+
throw new Error(`Unsupported method: ${methodName}`);
|
|
493
|
+
}
|
|
494
|
+
const result = await handler(args);
|
|
495
|
+
self.postMessage({ requestId, result, methodName });
|
|
496
|
+
return;
|
|
497
|
+
} else {
|
|
498
|
+
throw new Error(`Unsupported action: ${action}`);
|
|
499
|
+
}
|
|
500
|
+
} catch (error) {
|
|
501
|
+
const serializedError = serializeError(error);
|
|
502
|
+
console.error(
|
|
503
|
+
"WORKER: Error occurred - %s",
|
|
504
|
+
serializedError.message,
|
|
505
|
+
error
|
|
506
|
+
);
|
|
507
|
+
self.postMessage({ requestId, error: serializedError, methodName });
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Process messages one at a time from the messageQueue.
|
|
513
|
+
*/
|
|
514
|
+
async function processQueue() {
|
|
515
|
+
if (processing || messageQueue.length === 0) return;
|
|
516
|
+
processing = true;
|
|
517
|
+
const event = messageQueue.shift();
|
|
518
|
+
try {
|
|
519
|
+
await processMessage(event);
|
|
520
|
+
} finally {
|
|
521
|
+
processing = false;
|
|
522
|
+
processQueue(); // Process next message in queue.
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Enqueue incoming messages and process them sequentially.
|
|
527
|
+
self.onmessage = (event) => {
|
|
528
|
+
if (
|
|
529
|
+
event.data.callbackRequestId &&
|
|
530
|
+
pendingCallbacks.has(event.data.callbackRequestId)
|
|
531
|
+
) {
|
|
532
|
+
const { callbackRequestId, callbackResult, callbackError } = event.data;
|
|
533
|
+
const { resolve, reject, timeoutId } =
|
|
534
|
+
pendingCallbacks.get(callbackRequestId);
|
|
535
|
+
clearTimeout(timeoutId);
|
|
536
|
+
pendingCallbacks.delete(callbackRequestId);
|
|
537
|
+
if (!callbackError) {
|
|
538
|
+
resolve(callbackResult);
|
|
539
|
+
} else {
|
|
540
|
+
reject(new Error(callbackError));
|
|
541
|
+
}
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
messageQueue.push(event);
|
|
545
|
+
processQueue();
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
// Immediately signal that the worker script has loaded.
|
|
549
|
+
// This tells the main thread that the file is fully loaded before sending the "init" message.
|
|
550
|
+
self.postMessage({ loaded: true });
|
|
551
|
+
//# sourceMappingURL=web-client-methods-worker.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-client-methods-worker.module.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-D44KIErf.js');\n // The Cargo glue's __wbg_init TLA is stripped by the rollup build to\n // prevent blocking WKWebView module evaluation. Call it explicitly here\n // with the WASM URL that the Cargo glue pre-resolves (relative to its\n // own import.meta.url, which downstream bundlers handle correctly).\n if (wasmModule && typeof wasmModule.__wbg_init === \"function\") {\n await wasmModule.__wbg_init({\n // eslint-disable-next-line camelcase -- wasm-bindgen init API parameter name\n module_or_path: wasmModule.__wasm_url,\n });\n }\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 INIT_MOCK: \"initMock\",\n CALL_METHOD: \"callMethod\",\n EXECUTE_CALLBACK: \"executeCallback\",\n});\n\nexport const CallbackType = Object.freeze({\n GET_KEY: \"getKey\",\n INSERT_KEY: \"insertKey\",\n SIGN: \"sign\",\n});\n\nexport const MethodName = Object.freeze({\n CREATE_CLIENT: \"createClient\",\n APPLY_TRANSACTION: \"applyTransaction\",\n EXECUTE_TRANSACTION: \"executeTransaction\",\n PROVE_TRANSACTION: \"proveTransaction\",\n SUBMIT_NEW_TRANSACTION: \"submitNewTransaction\",\n SUBMIT_NEW_TRANSACTION_MOCK: \"submitNewTransactionMock\",\n SUBMIT_NEW_TRANSACTION_WITH_PROVER: \"submitNewTransactionWithProver\",\n SUBMIT_NEW_TRANSACTION_WITH_PROVER_MOCK: \"submitNewTransactionWithProverMock\",\n SYNC_STATE: \"syncState\",\n SYNC_STATE_MOCK: \"syncStateMock\",\n});\n","import loadWasm from \"../../dist/wasm.js\";\nimport { CallbackType, 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\nconst serializeUnknown = (value) => {\n if (typeof value === \"string\") {\n return value;\n }\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n};\n\nconst serializeError = (error) => {\n if (error instanceof Error) {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n cause: error.cause ? serializeError(error.cause) : undefined,\n code: error.code,\n };\n }\n\n if (typeof error === \"object\" && error !== null) {\n return {\n name: error.name ?? \"Error\",\n message: error.message ?? serializeUnknown(error),\n };\n }\n\n return {\n name: \"Error\",\n message: serializeUnknown(error),\n };\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// Track pending callback requests\nlet pendingCallbacks = new Map();\n\n// Timeout for pending callbacks (30 seconds)\nconst CALLBACK_TIMEOUT_MS = 30000;\n\n// Define proxy functions for callbacks that communicate with main thread\nconst callbackProxies = {\n getKey: async (pubKey) => {\n return new Promise((resolve, reject) => {\n const requestId = `${CallbackType.GET_KEY}-${Date.now()}-${Math.random()}`;\n const timeoutId = setTimeout(() => {\n if (pendingCallbacks.has(requestId)) {\n pendingCallbacks.delete(requestId);\n reject(new Error(`Callback ${requestId} timed out`));\n }\n }, CALLBACK_TIMEOUT_MS);\n pendingCallbacks.set(requestId, { resolve, reject, timeoutId });\n\n self.postMessage({\n action: WorkerAction.EXECUTE_CALLBACK,\n callbackType: CallbackType.GET_KEY,\n args: [pubKey],\n requestId,\n });\n });\n },\n insertKey: async (pubKey, secretKey) => {\n return new Promise((resolve, reject) => {\n const requestId = `${CallbackType.INSERT_KEY}-${Date.now()}-${Math.random()}`;\n const timeoutId = setTimeout(() => {\n if (pendingCallbacks.has(requestId)) {\n pendingCallbacks.delete(requestId);\n reject(new Error(`Callback ${requestId} timed out`));\n }\n }, CALLBACK_TIMEOUT_MS);\n pendingCallbacks.set(requestId, { resolve, reject, timeoutId });\n\n self.postMessage({\n action: WorkerAction.EXECUTE_CALLBACK,\n callbackType: CallbackType.INSERT_KEY,\n args: [pubKey, secretKey],\n requestId,\n });\n });\n },\n sign: async (pubKey, signingInputs) => {\n return new Promise((resolve, reject) => {\n const requestId = `${CallbackType.SIGN}-${Date.now()}-${Math.random()}`;\n const timeoutId = setTimeout(() => {\n if (pendingCallbacks.has(requestId)) {\n pendingCallbacks.delete(requestId);\n reject(new Error(`Callback ${requestId} timed out`));\n }\n }, CALLBACK_TIMEOUT_MS);\n pendingCallbacks.set(requestId, { resolve, reject, timeoutId });\n\n self.postMessage({\n action: WorkerAction.EXECUTE_CALLBACK,\n callbackType: CallbackType.SIGN,\n args: [pubKey, signingInputs],\n requestId,\n });\n });\n },\n};\n\n// Define a mapping from method names to handler functions.\nconst methodHandlers = {\n [MethodName.SYNC_STATE]: async () => {\n // Call the internal WASM method (sync lock is handled at the JS wrapper level)\n const syncSummary = await wasmWebClient.syncStateImpl();\n const serializedSyncSummary = syncSummary.serialize();\n return serializedSyncSummary.buffer;\n },\n [MethodName.APPLY_TRANSACTION]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [serializedTransactionResult, submissionHeight] = args;\n const transactionResultBytes = new Uint8Array(serializedTransactionResult);\n const transactionResult = wasm.TransactionResult.deserialize(\n transactionResultBytes\n );\n const transactionUpdate = await wasmWebClient.applyTransaction(\n transactionResult,\n submissionHeight\n );\n const serializedUpdate = transactionUpdate.serialize();\n return serializedUpdate.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 const prover = proverPayload\n ? wasm.TransactionProver.deserialize(proverPayload)\n : undefined;\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 [MethodName.SUBMIT_NEW_TRANSACTION_WITH_PROVER]: async (args) => {\n const wasm = await getWasmOrThrow();\n const [accountIdHex, serializedTransactionRequest, proverPayload] = 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 // Deserialize the prover from the serialized payload\n const prover = proverPayload\n ? wasm.TransactionProver.deserialize(proverPayload)\n : undefined;\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, prover);\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\nmethodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_WITH_PROVER_MOCK] = async (\n args\n) => {\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 =\n await methodHandlers[MethodName.SUBMIT_NEW_TRANSACTION_WITH_PROVER](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 [\n rpcUrl,\n noteTransportUrl,\n seed,\n storeName,\n hasGetKeyCb,\n hasInsertKeyCb,\n hasSignCb,\n logLevel,\n ] = args;\n const wasm = await getWasmOrThrow();\n\n if (logLevel) {\n wasm.setupLogging(logLevel);\n }\n\n wasmWebClient = new wasm.WebClient();\n\n // Check if any callbacks are provided\n const useExternalKeystore = hasGetKeyCb || hasInsertKeyCb || hasSignCb;\n\n if (useExternalKeystore) {\n // Use callback proxies that communicate with the main thread\n await wasmWebClient.createClientWithExternalKeystore(\n rpcUrl,\n noteTransportUrl,\n seed,\n storeName,\n hasGetKeyCb ? callbackProxies.getKey : undefined,\n hasInsertKeyCb ? callbackProxies.insertKey : undefined,\n hasSignCb ? callbackProxies.sign : undefined\n );\n } else {\n await wasmWebClient.createClient(\n rpcUrl,\n noteTransportUrl,\n seed,\n storeName\n );\n }\n\n wasmSeed = seed;\n ready = true;\n self.postMessage({ ready: true });\n return;\n } else if (action === WorkerAction.INIT_MOCK) {\n const [seed, logLevel] = args;\n const wasm = await getWasmOrThrow();\n\n if (logLevel) {\n wasm.setupLogging(logLevel);\n }\n\n wasmWebClient = new wasm.WebClient();\n await wasmWebClient.createMockClient(seed, undefined, undefined);\n\n wasmSeed = seed;\n ready = true;\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, methodName });\n return;\n } else {\n throw new Error(`Unsupported action: ${action}`);\n }\n } catch (error) {\n const serializedError = serializeError(error);\n console.error(\n \"WORKER: Error occurred - %s\",\n serializedError.message,\n error\n );\n self.postMessage({ requestId, error: serializedError, methodName });\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 if (\n event.data.callbackRequestId &&\n pendingCallbacks.has(event.data.callbackRequestId)\n ) {\n const { callbackRequestId, callbackResult, callbackError } = event.data;\n const { resolve, reject, timeoutId } =\n pendingCallbacks.get(callbackRequestId);\n clearTimeout(timeoutId);\n pendingCallbacks.delete(callbackRequestId);\n if (!callbackError) {\n resolve(callbackResult);\n } else {\n reject(new Error(callbackError));\n }\n return;\n }\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;AAChB,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;AACpD;AACA;AACA;AACA;AACA,IAAI,IAAI,UAAU,IAAI,OAAO,UAAU,CAAC,UAAU,KAAK,UAAU,EAAE;AACnE,MAAM,MAAM,UAAU,CAAC,UAAU,CAAC;AAClC;AACA,QAAQ,cAAc,EAAE,UAAU,CAAC,UAAU;AAC7C,OAAO,CAAC;AACR,IAAI;AACJ,EAAE;AACF,EAAE,OAAO,UAAU;AACnB;;ACnBO,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;AAC1C,EAAE,IAAI,EAAE,MAAM;AACd,EAAE,SAAS,EAAE,UAAU;AACvB,EAAE,WAAW,EAAE,YAAY;AAC3B,EAAE,gBAAgB,EAAE,iBAAiB;AACrC,CAAC,CAAC;;AAEK,MAAM,YAAY,GAA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AC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miden-sdk/miden-sdk",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Miden Wasm SDK",
|
|
5
5
|
"collaborators": [
|
|
6
6
|
"Miden"
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"build-dev": "npm install && MIDEN_WEB_DEV=true npm run build",
|
|
23
23
|
"check:wasm-types": "node ./scripts/check-bindgen-types.js",
|
|
24
24
|
"check:method-classification": "node ./scripts/check-method-classification.js",
|
|
25
|
+
"check:standalone-types": "node ./scripts/check-standalone-types.js",
|
|
25
26
|
"test": "yarn playwright install --with-deps && yarn playwright test",
|
|
26
27
|
"test:ci": "yarn playwright install --with-deps chromium && yarn playwright test",
|
|
27
28
|
"test:ci:remote_prover": "yarn playwright install --with-deps && cross-env TEST_MIDEN_PROVER_URL=localhost yarn playwright test -g 'with remote prover'",
|