From 4cf78e74c654d829c107c8aeee91fcee303788f3 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Mon, 9 Dec 2024 10:46:41 +0100 Subject: [PATCH] Simplify WASM instantiation --- packages/examples/packages/wasm/snap.manifest.json | 2 +- packages/snaps-cli/src/webpack/loaders/wasm.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/examples/packages/wasm/snap.manifest.json b/packages/examples/packages/wasm/snap.manifest.json index 9239a83ff8..ccb220e551 100644 --- a/packages/examples/packages/wasm/snap.manifest.json +++ b/packages/examples/packages/wasm/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "n/JVqBQfO2/1ojbBN1WFNddejGlTvGduO9VgxYGYQQg=", + "shasum": "YtnZetn37cq3RA2PdwjDBPOjvxDSAQ5vSzOqC2zjBNw=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snaps-cli/src/webpack/loaders/wasm.ts b/packages/snaps-cli/src/webpack/loaders/wasm.ts index 67c4fdaf8f..82641fd77c 100644 --- a/packages/snaps-cli/src/webpack/loaders/wasm.ts +++ b/packages/snaps-cli/src/webpack/loaders/wasm.ts @@ -115,8 +115,7 @@ const loader: LoaderDefinitionFunction = async function loader( } const bytes = decode(b64); - const module = await WebAssembly.compile(bytes); - const instance = new WebAssembly.Instance(module, { + const { instance } = await WebAssembly.instantiate(bytes, { ${getModuleImports(imports)} });