diff --git a/.gitignore b/.gitignore index 27f815f66..78086f34b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ application-data /api/.env /api/logs/ /client/build -/client/public/iota_sdk_wasm_bg.wasm +/client/public/wasm config.dev.json config.local.json diff --git a/client/package.json b/client/package.json index dabddfeff..edc270229 100644 --- a/client/package.json +++ b/client/package.json @@ -10,7 +10,7 @@ }, "license": "Apache-2.0", "scripts": { - "postinstall": "copyfiles -u 5 ./node_modules/@iota/sdk-wasm/web/wasm/iota_sdk_wasm_bg.wasm ./public", + "postinstall": "./script/postinstall.sh", "start": "vite", "preview": "vite preview", "lint": "eslint src --ext .tsx,.ts", diff --git a/client/script/postinstall.sh b/client/script/postinstall.sh new file mode 100755 index 000000000..33d4fa7c1 --- /dev/null +++ b/client/script/postinstall.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +NODE_MODULES="./node_modules" +TARGET="./public/wasm" + +mkdir -p "$TARGET" + +# stardust +cp "$NODE_MODULES/@iota/sdk-wasm/web/wasm/iota_sdk_wasm_bg.wasm" "$TARGET/iota_sdk_stardust_wasm_bg.wasm" + diff --git a/client/src/index.tsx b/client/src/index.tsx index b1b3676d2..e6a065165 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -2,7 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ // needed for features from @iota/sdk which use reflection (decorators) import "reflect-metadata"; -import init from "@iota/sdk-wasm/web"; +import initStardustSdk from "@iota/sdk-wasm/web"; import React from "react"; import { createRoot } from "react-dom/client"; import { BrowserRouter, Route, RouteComponentProps } from "react-router-dom"; @@ -34,7 +34,7 @@ const apiEndpoint = (window as any).env.API_ENDPOINT; initialiseServices().then(async () => { // load the wasm - await init("/iota_sdk_wasm_bg.wasm"); + await initStardustSdk("/wasm/iota_sdk_stardust_wasm_bg.wasm"); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const container = document.querySelector("#root")!;