From c7af50a5e14648c87ffcfbdb7f1eeb075b122ca6 Mon Sep 17 00:00:00 2001 From: Bran <52735957+brancoder@users.noreply.github.com> Date: Tue, 23 Jan 2024 23:35:19 +0100 Subject: [PATCH] fix: add absolute path for loading wasm files (#1002) Co-authored-by: Mario --- client/src/app/components/identity/DIDResolver.tsx | 4 ++-- client/src/helpers/hooks/useResolvedDID.ts | 2 +- client/src/index.tsx | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/app/components/identity/DIDResolver.tsx b/client/src/app/components/identity/DIDResolver.tsx index 382fbe090..0fb8b168f 100644 --- a/client/src/app/components/identity/DIDResolver.tsx +++ b/client/src/app/components/identity/DIDResolver.tsx @@ -148,8 +148,8 @@ export default IdentityStardustResolver; async function constructVerifiedDomains(resolvedDID: IDIDResolverResponse): Promise>> { const newVerifiedDomains = new Map>(); - - await ServiceFactory.get("identity").initLibrary(); + const origin = window?.location?.origin ?? ""; + await ServiceFactory.get("identity").initLibrary(origin + "/wasm/identity_wasm_bg.wasm"); const didDocument = identity.IotaDocument.fromJSON(resolvedDID.document); // Get the Linked Domain Services from the DID Document. diff --git a/client/src/helpers/hooks/useResolvedDID.ts b/client/src/helpers/hooks/useResolvedDID.ts index a21c29e32..38fa4ad5c 100644 --- a/client/src/helpers/hooks/useResolvedDID.ts +++ b/client/src/helpers/hooks/useResolvedDID.ts @@ -29,7 +29,7 @@ export function useResolvedDID(network: string, bech32Hrp: string, addressHex: s setidentityResponse(response); } }) - .then(() => identityService.initLibrary()) + .then(() => identityService.initLibrary(window?.location?.origin ?? "" + "/wasm/identity_wasm_bg.wasm")) .finally(() => { setIsLoading(false); }); diff --git a/client/src/index.tsx b/client/src/index.tsx index a7a9dfc04..48cc3a513 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -35,7 +35,8 @@ const apiEndpoint = (window as any).env.API_ENDPOINT; initialiseServices() .then(async () => { // load the wasm - await initStardustSdk("/wasm/iota_sdk_stardust_wasm_bg.wasm"); + const origin = window?.location?.origin ?? ""; + await initStardustSdk(origin + "/wasm/iota_sdk_stardust_wasm_bg.wasm"); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const container = document.querySelector("#root")!;