@miden-sdk/miden-sdk 0.15.2 → 0.15.3
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-BbpPeJYa.js → Cargo-D2qNRrNR.js} +71 -71
- package/dist/mt/{Cargo-BbpPeJYa.js.map → Cargo-D2qNRrNR.js.map} +1 -1
- package/dist/mt/assets/miden_client_web.wasm +0 -0
- package/dist/mt/eager.js +1 -1
- package/dist/mt/index.js +1 -1
- package/dist/mt/wasm.js +1 -1
- package/dist/mt/workerHelpers.js +1 -1
- package/dist/mt/workers/{Cargo-BbpPeJYa-BlSVzh6v.js → Cargo-D2qNRrNR-n_GEbq73.js} +71 -71
- package/dist/mt/workers/{Cargo-BbpPeJYa-BlSVzh6v.js.map → Cargo-D2qNRrNR-n_GEbq73.js.map} +1 -1
- package/dist/mt/workers/assets/miden_client_web.wasm +0 -0
- package/dist/mt/workers/web-client-methods-worker.js +72 -72
- package/dist/mt/workers/web-client-methods-worker.js.map +1 -1
- package/dist/mt/workers/web-client-methods-worker.module.js +1 -1
- 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-Dlo4tWNG.js → Cargo-BP7-0qVT.js} +73 -73
- package/dist/st/{Cargo-Dlo4tWNG.js.map → Cargo-BP7-0qVT.js.map} +1 -1
- package/dist/st/assets/miden_client_web.wasm +0 -0
- package/dist/st/eager.js +1 -1
- package/dist/st/index.js +1 -1
- package/dist/st/wasm.js +1 -1
- package/dist/st/workers/{Cargo-Dlo4tWNG-BPaiqKyy.js → Cargo-BP7-0qVT-CmfAy6bf.js} +73 -73
- package/dist/st/workers/{Cargo-Dlo4tWNG-BPaiqKyy.js.map → Cargo-BP7-0qVT-CmfAy6bf.js.map} +1 -1
- package/dist/st/workers/assets/miden_client_web.wasm +0 -0
- package/dist/st/workers/web-client-methods-worker.js +74 -74
- package/dist/st/workers/web-client-methods-worker.js.map +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js +1 -1
- package/dist/st/workers/web-client-methods-worker.module.js.map +1 -1
- package/js/node-index.js +149 -40
- package/package.json +6 -4
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
async function loadWasm() {
|
|
5
5
|
let wasmModule;
|
|
6
6
|
if (!import.meta.env || (import.meta.env && !import.meta.env.SSR)) {
|
|
7
|
-
wasmModule = await import('./Cargo-
|
|
7
|
+
wasmModule = await import('./Cargo-BP7-0qVT-CmfAy6bf.js');
|
|
8
8
|
// The Cargo glue's __wbg_init TLA is stripped by the rollup build to
|
|
9
9
|
// prevent blocking WKWebView module evaluation. Call it explicitly here
|
|
10
10
|
// with the WASM URL that the Cargo glue pre-resolves (relative to its
|
|
@@ -1 +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-Dlo4tWNG.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 INIT_THREAD_POOL: \"initThreadPool\",\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 SYNC_CHAIN: \"syncChain\",\n SYNC_CHAIN_MOCK: \"syncChainMock\",\n SYNC_NOTE_TRANSPORT: \"syncNoteTransport\",\n SYNC_NOTE_TRANSPORT_MOCK: \"syncNoteTransportMock\",\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.SYNC_NOTE_TRANSPORT]: async () => {\n await wasmWebClient.syncNoteTransportImpl();\n },\n [MethodName.SYNC_CHAIN]: async () => {\n const syncSummary = await wasmWebClient.syncChainImpl();\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.SYNC_CHAIN_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_CHAIN]();\n};\n\nmethodHandlers[MethodName.SYNC_NOTE_TRANSPORT_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_NOTE_TRANSPORT]();\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 const updatedMockChain = (await wasmWebClient.serializeMockChain()).buffer;\n const updatedMockNoteTransportNode = (\n await wasmWebClient.serializeMockNoteTransportNode()\n ).buffer;\n\n return {\n transactionId: result.transactionId,\n submissionHeight: result.submissionHeight,\n serializedTransactionResult: result.serializedTransactionResult,\n serializedTransactionUpdate: result.serializedTransactionUpdate,\n serializedMockChain: updatedMockChain,\n serializedMockNoteTransportNode: updatedMockNoteTransportNode,\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 const updatedMockChain = (await wasmWebClient.serializeMockChain()).buffer;\n const updatedMockNoteTransportNode = (\n await wasmWebClient.serializeMockNoteTransportNode()\n ).buffer;\n\n return {\n transactionId: result.transactionId,\n submissionHeight: result.submissionHeight,\n serializedTransactionResult: result.serializedTransactionResult,\n serializedTransactionUpdate: result.serializedTransactionUpdate,\n serializedMockChain: updatedMockChain,\n serializedMockNoteTransportNode: updatedMockNoteTransportNode,\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 numThreads,\n ] = args;\n const wasm = await getWasmOrThrow();\n\n if (logLevel) {\n wasm.setupLogging(logLevel);\n }\n\n // Initialize rayon's thread pool inside THIS worker's WASM instance.\n // The SDK runs every prove call here (NOT on the main thread), so a\n // pool initialized only in main-thread WASM does not parallelize the\n // prove. Without this, par_iter()/par_chunks() in miden-crypto +\n // p3-maybe-rayon return rayon::current_num_threads() == 1 and fall\n // through to sequential code despite the parallel features being on.\n if (\n numThreads &&\n numThreads > 1 &&\n typeof wasm.initThreadPool === \"function\"\n ) {\n await wasm.initThreadPool(numThreads);\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, numThreads] = args;\n const wasm = await getWasmOrThrow();\n\n if (logLevel) {\n wasm.setupLogging(logLevel);\n }\n\n // Initialize rayon's pool inside THIS worker's WASM instance — same\n // rationale as the INIT path above: all proving executes here, and a\n // pool initialized in any other instance does not parallelize it.\n if (\n numThreads &&\n numThreads > 1 &&\n typeof wasm.initThreadPool === \"function\"\n ) {\n await wasm.initThreadPool(numThreads);\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,gBAAgB,EAAE,gBAAgB;AACpC,EAAE,WAAW,EAAE,YAAY;AAC3B,EAAE,gBAAgB,EAAE,iBAAiB;AACrC,CAAC,CAAC;;AAEK,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;AAC1C,EAAE,OAAO,E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C,SAAS,GAAG,CAAC,KAAK,KAAK;AAC5B,EAAE;AACF,IAAI,KAAK,CAAC,IAAI,CAAC,iBAAiB;AAChC,IAAI,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB;AACrD,IAAI;AACJ,IAAI,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,IAAI;AAC3E,IAAI,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;AACxC,MAAM,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAC7C,IAAI,YAAY,CAAC,SAAS,CAAC;AAC3B,IAAI,gBAAgB,CAAC,MAAM,CAAC,iBAAiB,CAAC;AAC9C,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,MAAM,OAAO,CAAC,cAAc,CAAC;AAC7B,IAAI,CAAC,MAAM;AACX,MAAM,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AACtC,IAAI;AACJ,IAAI;AACJ,EAAE;AACF,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1B,EAAE,YAAY,EAAE;AAChB,CAAC;;AAED;AACA;AACA,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC"}
|
|
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-BP7-0qVT.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 INIT_THREAD_POOL: \"initThreadPool\",\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 SYNC_CHAIN: \"syncChain\",\n SYNC_CHAIN_MOCK: \"syncChainMock\",\n SYNC_NOTE_TRANSPORT: \"syncNoteTransport\",\n SYNC_NOTE_TRANSPORT_MOCK: \"syncNoteTransportMock\",\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.SYNC_NOTE_TRANSPORT]: async () => {\n await wasmWebClient.syncNoteTransportImpl();\n },\n [MethodName.SYNC_CHAIN]: async () => {\n const syncSummary = await wasmWebClient.syncChainImpl();\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.SYNC_CHAIN_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_CHAIN]();\n};\n\nmethodHandlers[MethodName.SYNC_NOTE_TRANSPORT_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_NOTE_TRANSPORT]();\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 const updatedMockChain = (await wasmWebClient.serializeMockChain()).buffer;\n const updatedMockNoteTransportNode = (\n await wasmWebClient.serializeMockNoteTransportNode()\n ).buffer;\n\n return {\n transactionId: result.transactionId,\n submissionHeight: result.submissionHeight,\n serializedTransactionResult: result.serializedTransactionResult,\n serializedTransactionUpdate: result.serializedTransactionUpdate,\n serializedMockChain: updatedMockChain,\n serializedMockNoteTransportNode: updatedMockNoteTransportNode,\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 const updatedMockChain = (await wasmWebClient.serializeMockChain()).buffer;\n const updatedMockNoteTransportNode = (\n await wasmWebClient.serializeMockNoteTransportNode()\n ).buffer;\n\n return {\n transactionId: result.transactionId,\n submissionHeight: result.submissionHeight,\n serializedTransactionResult: result.serializedTransactionResult,\n serializedTransactionUpdate: result.serializedTransactionUpdate,\n serializedMockChain: updatedMockChain,\n serializedMockNoteTransportNode: updatedMockNoteTransportNode,\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 numThreads,\n ] = args;\n const wasm = await getWasmOrThrow();\n\n if (logLevel) {\n wasm.setupLogging(logLevel);\n }\n\n // Initialize rayon's thread pool inside THIS worker's WASM instance.\n // The SDK runs every prove call here (NOT on the main thread), so a\n // pool initialized only in main-thread WASM does not parallelize the\n // prove. Without this, par_iter()/par_chunks() in miden-crypto +\n // p3-maybe-rayon return rayon::current_num_threads() == 1 and fall\n // through to sequential code despite the parallel features being on.\n if (\n numThreads &&\n numThreads > 1 &&\n typeof wasm.initThreadPool === \"function\"\n ) {\n await wasm.initThreadPool(numThreads);\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, numThreads] = args;\n const wasm = await getWasmOrThrow();\n\n if (logLevel) {\n wasm.setupLogging(logLevel);\n }\n\n // Initialize rayon's pool inside THIS worker's WASM instance — same\n // rationale as the INIT path above: all proving executes here, and a\n // pool initialized in any other instance does not parallelize it.\n if (\n numThreads &&\n numThreads > 1 &&\n typeof wasm.initThreadPool === \"function\"\n ) {\n await wasm.initThreadPool(numThreads);\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;AAC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|
} from "./node/client-factory.js";
|
|
17
17
|
import { MidenClient } from "./client.js";
|
|
18
|
+
import { CompilerResource } from "./resources/compiler.js";
|
|
18
19
|
import {
|
|
19
20
|
createP2IDNote,
|
|
20
21
|
createP2IDENote,
|
|
@@ -102,8 +103,18 @@ export function getWrappedSdk() {
|
|
|
102
103
|
return _wrappedSdk;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
//
|
|
106
|
-
//
|
|
106
|
+
// JS-layer exports the browser entry also provides (these are not napi classes,
|
|
107
|
+
// so they can't go through `_reexport`). `CompilerResource` already backs
|
|
108
|
+
// `MidenClient.compile` on Node, and `getWasmOrThrow` resolves to the wrapped
|
|
109
|
+
// napi sdk — the Node analogue of the browser's WASM-module accessor. Both are
|
|
110
|
+
// imported by `@miden-sdk/react` (e.g. `useCompile`).
|
|
111
|
+
export { CompilerResource };
|
|
112
|
+
export const getWasmOrThrow = async () => {
|
|
113
|
+
ensureInitialized();
|
|
114
|
+
return _wrappedSdk;
|
|
115
|
+
};
|
|
116
|
+
// ── napi re-exports ─────────────────────────────────────
|
|
117
|
+
// Lazy getter so the native module loads on first access.
|
|
107
118
|
function _reexport(name) {
|
|
108
119
|
return {
|
|
109
120
|
get [name]() {
|
|
@@ -113,79 +124,177 @@ function _reexport(name) {
|
|
|
113
124
|
}[name];
|
|
114
125
|
}
|
|
115
126
|
|
|
116
|
-
//
|
|
127
|
+
// Manual re-exports that aren't plain 1:1 napi passthroughs:
|
|
128
|
+
// - AuthSchemeNative: the napi `AuthScheme` class under a name that does not
|
|
129
|
+
// collide with the JS `AuthScheme` enum above.
|
|
130
|
+
// - Rpo / exportStore / importStore: legacy export names kept for back-compat.
|
|
131
|
+
export const AuthSchemeNative = /* @__PURE__ */ _reexport("AuthScheme");
|
|
132
|
+
export const Rpo = /* @__PURE__ */ _reexport("Rpo");
|
|
133
|
+
export const exportStore = /* @__PURE__ */ _reexport("exportStore");
|
|
134
|
+
export const importStore = /* @__PURE__ */ _reexport("importStore");
|
|
135
|
+
|
|
136
|
+
// Every other public napi class. GENERATED — do not edit by hand. Run
|
|
137
|
+
// `pnpm --filter @miden-sdk/miden-sdk gen:node-reexports` to regenerate from the
|
|
138
|
+
// native module; CI's `check:node-reexports` keeps it in lockstep with napi.
|
|
139
|
+
// <generated:napi-reexports>
|
|
117
140
|
export const Account = /* @__PURE__ */ _reexport("Account");
|
|
118
141
|
export const AccountBuilder = /* @__PURE__ */ _reexport("AccountBuilder");
|
|
142
|
+
export const AccountBuilderResult = /* @__PURE__ */ _reexport(
|
|
143
|
+
"AccountBuilderResult"
|
|
144
|
+
);
|
|
145
|
+
export const AccountCode = /* @__PURE__ */ _reexport("AccountCode");
|
|
119
146
|
export const AccountComponent = /* @__PURE__ */ _reexport("AccountComponent");
|
|
147
|
+
export const AccountComponentCode = /* @__PURE__ */ _reexport(
|
|
148
|
+
"AccountComponentCode"
|
|
149
|
+
);
|
|
150
|
+
export const AccountDelta = /* @__PURE__ */ _reexport("AccountDelta");
|
|
120
151
|
export const AccountFile = /* @__PURE__ */ _reexport("AccountFile");
|
|
121
152
|
export const AccountHeader = /* @__PURE__ */ _reexport("AccountHeader");
|
|
122
153
|
export const AccountId = /* @__PURE__ */ _reexport("AccountId");
|
|
123
154
|
export const AccountInterface = /* @__PURE__ */ _reexport("AccountInterface");
|
|
155
|
+
export const AccountProof = /* @__PURE__ */ _reexport("AccountProof");
|
|
156
|
+
export const AccountReader = /* @__PURE__ */ _reexport("AccountReader");
|
|
157
|
+
export const AccountStatus = /* @__PURE__ */ _reexport("AccountStatus");
|
|
124
158
|
export const AccountStorage = /* @__PURE__ */ _reexport("AccountStorage");
|
|
159
|
+
export const AccountStorageDelta = /* @__PURE__ */ _reexport(
|
|
160
|
+
"AccountStorageDelta"
|
|
161
|
+
);
|
|
125
162
|
export const AccountStorageMode =
|
|
126
163
|
/* @__PURE__ */ _reexport("AccountStorageMode");
|
|
127
164
|
export const AccountStorageRequirements = /* @__PURE__ */ _reexport(
|
|
128
165
|
"AccountStorageRequirements"
|
|
129
166
|
);
|
|
167
|
+
export const AccountVaultDelta = /* @__PURE__ */ _reexport("AccountVaultDelta");
|
|
130
168
|
export const Address = /* @__PURE__ */ _reexport("Address");
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
export const
|
|
169
|
+
export const AddressInterface = /* @__PURE__ */ _reexport("AddressInterface");
|
|
170
|
+
export const AdviceInputs = /* @__PURE__ */ _reexport("AdviceInputs");
|
|
171
|
+
export const AdviceMap = /* @__PURE__ */ _reexport("AdviceMap");
|
|
172
|
+
export const AssetVault = /* @__PURE__ */ _reexport("AssetVault");
|
|
173
|
+
export const AuthFalcon512RpoMultisigConfig = /* @__PURE__ */ _reexport(
|
|
174
|
+
"AuthFalcon512RpoMultisigConfig"
|
|
175
|
+
);
|
|
134
176
|
export const AuthSecretKey = /* @__PURE__ */ _reexport("AuthSecretKey");
|
|
135
|
-
|
|
136
|
-
|
|
177
|
+
export const BasicFungibleFaucetComponent = /* @__PURE__ */ _reexport(
|
|
178
|
+
"BasicFungibleFaucetComponent"
|
|
179
|
+
);
|
|
180
|
+
export const BlockHeader = /* @__PURE__ */ _reexport("BlockHeader");
|
|
181
|
+
export const CodeBuilder = /* @__PURE__ */ _reexport("CodeBuilder");
|
|
182
|
+
export const CommittedNote = /* @__PURE__ */ _reexport("CommittedNote");
|
|
183
|
+
export const ConsumableNoteRecord = /* @__PURE__ */ _reexport(
|
|
184
|
+
"ConsumableNoteRecord"
|
|
185
|
+
);
|
|
186
|
+
export const Endpoint = /* @__PURE__ */ _reexport("Endpoint");
|
|
187
|
+
export const ExecutedTransaction = /* @__PURE__ */ _reexport(
|
|
188
|
+
"ExecutedTransaction"
|
|
189
|
+
);
|
|
137
190
|
export const Felt = /* @__PURE__ */ _reexport("Felt");
|
|
138
|
-
export const
|
|
139
|
-
export const
|
|
140
|
-
export const
|
|
141
|
-
export const PublicKey = /* @__PURE__ */ _reexport("PublicKey");
|
|
142
|
-
export const Signature = /* @__PURE__ */ _reexport("Signature");
|
|
143
|
-
|
|
144
|
-
// Asset types
|
|
191
|
+
export const FetchedAccount = /* @__PURE__ */ _reexport("FetchedAccount");
|
|
192
|
+
export const FetchedNote = /* @__PURE__ */ _reexport("FetchedNote");
|
|
193
|
+
export const ForeignAccount = /* @__PURE__ */ _reexport("ForeignAccount");
|
|
145
194
|
export const FungibleAsset = /* @__PURE__ */ _reexport("FungibleAsset");
|
|
146
|
-
|
|
147
|
-
|
|
195
|
+
export const FungibleAssetDelta =
|
|
196
|
+
/* @__PURE__ */ _reexport("FungibleAssetDelta");
|
|
197
|
+
export const FungibleAssetDeltaItem = /* @__PURE__ */ _reexport(
|
|
198
|
+
"FungibleAssetDeltaItem"
|
|
199
|
+
);
|
|
200
|
+
export const GetProceduresResultItem = /* @__PURE__ */ _reexport(
|
|
201
|
+
"GetProceduresResultItem"
|
|
202
|
+
);
|
|
203
|
+
export const InputNote = /* @__PURE__ */ _reexport("InputNote");
|
|
204
|
+
export const InputNoteRecord = /* @__PURE__ */ _reexport("InputNoteRecord");
|
|
205
|
+
export const InputNoteState = /* @__PURE__ */ _reexport("InputNoteState");
|
|
206
|
+
export const InputNotes = /* @__PURE__ */ _reexport("InputNotes");
|
|
207
|
+
export const Library = /* @__PURE__ */ _reexport("Library");
|
|
208
|
+
export const MerklePath = /* @__PURE__ */ _reexport("MerklePath");
|
|
209
|
+
export const NetworkId = /* @__PURE__ */ _reexport("NetworkId");
|
|
210
|
+
export const NetworkNoteStatusInfo = /* @__PURE__ */ _reexport(
|
|
211
|
+
"NetworkNoteStatusInfo"
|
|
212
|
+
);
|
|
213
|
+
export const NetworkType = /* @__PURE__ */ _reexport("NetworkType");
|
|
148
214
|
export const Note = /* @__PURE__ */ _reexport("Note");
|
|
215
|
+
export const NoteAndArgs = /* @__PURE__ */ _reexport("NoteAndArgs");
|
|
149
216
|
export const NoteAssets = /* @__PURE__ */ _reexport("NoteAssets");
|
|
150
217
|
export const NoteAttachment = /* @__PURE__ */ _reexport("NoteAttachment");
|
|
151
|
-
export const
|
|
218
|
+
export const NoteAttachmentScheme = /* @__PURE__ */ _reexport(
|
|
219
|
+
"NoteAttachmentScheme"
|
|
220
|
+
);
|
|
221
|
+
export const NoteConsumability = /* @__PURE__ */ _reexport("NoteConsumability");
|
|
222
|
+
export const NoteConsumptionStatus = /* @__PURE__ */ _reexport(
|
|
223
|
+
"NoteConsumptionStatus"
|
|
224
|
+
);
|
|
225
|
+
export const NoteDetails = /* @__PURE__ */ _reexport("NoteDetails");
|
|
226
|
+
export const NoteDetailsAndTag = /* @__PURE__ */ _reexport("NoteDetailsAndTag");
|
|
152
227
|
export const NoteExecutionHint = /* @__PURE__ */ _reexport("NoteExecutionHint");
|
|
228
|
+
export const NoteExportFormat = /* @__PURE__ */ _reexport("NoteExportFormat");
|
|
153
229
|
export const NoteFile = /* @__PURE__ */ _reexport("NoteFile");
|
|
154
230
|
export const NoteFilter = /* @__PURE__ */ _reexport("NoteFilter");
|
|
155
231
|
export const NoteFilterTypes = /* @__PURE__ */ _reexport("NoteFilterTypes");
|
|
232
|
+
export const NoteHeader = /* @__PURE__ */ _reexport("NoteHeader");
|
|
156
233
|
export const NoteId = /* @__PURE__ */ _reexport("NoteId");
|
|
234
|
+
export const NoteIdAndArgs = /* @__PURE__ */ _reexport("NoteIdAndArgs");
|
|
235
|
+
export const NoteInclusionProof =
|
|
236
|
+
/* @__PURE__ */ _reexport("NoteInclusionProof");
|
|
237
|
+
export const NoteLocation = /* @__PURE__ */ _reexport("NoteLocation");
|
|
157
238
|
export const NoteMetadata = /* @__PURE__ */ _reexport("NoteMetadata");
|
|
158
239
|
export const NoteRecipient = /* @__PURE__ */ _reexport("NoteRecipient");
|
|
159
240
|
export const NoteScript = /* @__PURE__ */ _reexport("NoteScript");
|
|
160
241
|
export const NoteStorage = /* @__PURE__ */ _reexport("NoteStorage");
|
|
242
|
+
export const NoteSyncBlock = /* @__PURE__ */ _reexport("NoteSyncBlock");
|
|
243
|
+
export const NoteSyncInfo = /* @__PURE__ */ _reexport("NoteSyncInfo");
|
|
161
244
|
export const NoteTag = /* @__PURE__ */ _reexport("NoteTag");
|
|
162
245
|
export const NoteType = /* @__PURE__ */ _reexport("NoteType");
|
|
163
246
|
export const OutputNote = /* @__PURE__ */ _reexport("OutputNote");
|
|
164
|
-
|
|
165
|
-
|
|
247
|
+
export const OutputNoteRecord = /* @__PURE__ */ _reexport("OutputNoteRecord");
|
|
248
|
+
export const OutputNoteState = /* @__PURE__ */ _reexport("OutputNoteState");
|
|
249
|
+
export const OutputNotes = /* @__PURE__ */ _reexport("OutputNotes");
|
|
250
|
+
export const Package = /* @__PURE__ */ _reexport("Package");
|
|
251
|
+
export const PartialNote = /* @__PURE__ */ _reexport("PartialNote");
|
|
252
|
+
export const Poseidon2 = /* @__PURE__ */ _reexport("Poseidon2");
|
|
253
|
+
export const ProcedureThreshold =
|
|
254
|
+
/* @__PURE__ */ _reexport("ProcedureThreshold");
|
|
255
|
+
export const Program = /* @__PURE__ */ _reexport("Program");
|
|
256
|
+
export const ProvenTransaction = /* @__PURE__ */ _reexport("ProvenTransaction");
|
|
257
|
+
export const PswapLineageRecord =
|
|
258
|
+
/* @__PURE__ */ _reexport("PswapLineageRecord");
|
|
259
|
+
export const PswapLineageState = /* @__PURE__ */ _reexport("PswapLineageState");
|
|
260
|
+
export const PublicKey = /* @__PURE__ */ _reexport("PublicKey");
|
|
261
|
+
export const RpcClient = /* @__PURE__ */ _reexport("RpcClient");
|
|
262
|
+
export const Rpo256 = /* @__PURE__ */ _reexport("Rpo256");
|
|
263
|
+
export const Signature = /* @__PURE__ */ _reexport("Signature");
|
|
264
|
+
export const SigningInputs = /* @__PURE__ */ _reexport("SigningInputs");
|
|
265
|
+
export const SigningInputsType = /* @__PURE__ */ _reexport("SigningInputsType");
|
|
266
|
+
export const SlotAndKeys = /* @__PURE__ */ _reexport("SlotAndKeys");
|
|
267
|
+
export const SparseMerklePath = /* @__PURE__ */ _reexport("SparseMerklePath");
|
|
268
|
+
export const StorageMap = /* @__PURE__ */ _reexport("StorageMap");
|
|
269
|
+
export const StorageMapEntryJs = /* @__PURE__ */ _reexport("StorageMapEntryJs");
|
|
270
|
+
export const StorageMapInfo = /* @__PURE__ */ _reexport("StorageMapInfo");
|
|
271
|
+
export const StorageMapUpdate = /* @__PURE__ */ _reexport("StorageMapUpdate");
|
|
272
|
+
export const StorageSlot = /* @__PURE__ */ _reexport("StorageSlot");
|
|
273
|
+
export const SyncSummary = /* @__PURE__ */ _reexport("SyncSummary");
|
|
274
|
+
export const TokenSymbol = /* @__PURE__ */ _reexport("TokenSymbol");
|
|
275
|
+
export const TransactionArgs = /* @__PURE__ */ _reexport("TransactionArgs");
|
|
166
276
|
export const TransactionFilter = /* @__PURE__ */ _reexport("TransactionFilter");
|
|
277
|
+
export const TransactionId = /* @__PURE__ */ _reexport("TransactionId");
|
|
167
278
|
export const TransactionProver = /* @__PURE__ */ _reexport("TransactionProver");
|
|
279
|
+
export const TransactionRecord = /* @__PURE__ */ _reexport("TransactionRecord");
|
|
280
|
+
export const TransactionRequest =
|
|
281
|
+
/* @__PURE__ */ _reexport("TransactionRequest");
|
|
168
282
|
export const TransactionRequestBuilder = /* @__PURE__ */ _reexport(
|
|
169
283
|
"TransactionRequestBuilder"
|
|
170
284
|
);
|
|
171
|
-
|
|
172
|
-
// Network types
|
|
173
|
-
export const NetworkId = /* @__PURE__ */ _reexport("NetworkId");
|
|
174
|
-
export const RpcClient = /* @__PURE__ */ _reexport("RpcClient");
|
|
175
|
-
export const Endpoint = /* @__PURE__ */ _reexport("Endpoint");
|
|
176
|
-
|
|
177
|
-
// Transaction result / sync types
|
|
178
|
-
export const SyncSummary = /* @__PURE__ */ _reexport("SyncSummary");
|
|
179
285
|
export const TransactionResult = /* @__PURE__ */ _reexport("TransactionResult");
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
export const
|
|
189
|
-
|
|
190
|
-
export const
|
|
191
|
-
export const
|
|
286
|
+
export const TransactionScript = /* @__PURE__ */ _reexport("TransactionScript");
|
|
287
|
+
export const TransactionScriptInputPair = /* @__PURE__ */ _reexport(
|
|
288
|
+
"TransactionScriptInputPair"
|
|
289
|
+
);
|
|
290
|
+
export const TransactionStatus = /* @__PURE__ */ _reexport("TransactionStatus");
|
|
291
|
+
export const TransactionStoreUpdate = /* @__PURE__ */ _reexport(
|
|
292
|
+
"TransactionStoreUpdate"
|
|
293
|
+
);
|
|
294
|
+
export const TransactionSummary =
|
|
295
|
+
/* @__PURE__ */ _reexport("TransactionSummary");
|
|
296
|
+
export const Word = /* @__PURE__ */ _reexport("Word");
|
|
297
|
+
export const createAuthFalcon512RpoMultisig = /* @__PURE__ */ _reexport(
|
|
298
|
+
"createAuthFalcon512RpoMultisig"
|
|
299
|
+
);
|
|
300
|
+
// </generated:napi-reexports>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miden-sdk/miden-sdk",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "Miden Wasm SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"glob": "^11.0.0"
|
|
84
84
|
},
|
|
85
85
|
"optionalDependencies": {
|
|
86
|
-
"@miden-sdk/node-darwin-arm64": "0.15.
|
|
87
|
-
"@miden-sdk/node-darwin-x64": "0.15.
|
|
88
|
-
"@miden-sdk/node-linux-x64-gnu": "0.15.
|
|
86
|
+
"@miden-sdk/node-darwin-arm64": "0.15.3",
|
|
87
|
+
"@miden-sdk/node-darwin-x64": "0.15.3",
|
|
88
|
+
"@miden-sdk/node-linux-x64-gnu": "0.15.3"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
91
|
"build-rust-client-js": "pnpm --filter web_store run build",
|
|
@@ -97,6 +97,8 @@
|
|
|
97
97
|
"check:wasm-types": "node ./scripts/check-bindgen-types.js",
|
|
98
98
|
"check:method-classification": "node ./scripts/check-method-classification.js",
|
|
99
99
|
"check:standalone-types": "node ./scripts/check-standalone-types.js",
|
|
100
|
+
"gen:node-reexports": "node ./scripts/gen-node-reexports.js",
|
|
101
|
+
"check:node-reexports": "node ./scripts/gen-node-reexports.js --check",
|
|
100
102
|
"test:install": "pnpm exec playwright install --with-deps",
|
|
101
103
|
"test:install:ci": "pnpm exec playwright install --with-deps chromium",
|
|
102
104
|
"test": "pnpm exec playwright test",
|