Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when initilize wasm #53

Open
ManyRios opened this issue Dec 4, 2024 · 6 comments
Open

Error when initilize wasm #53

ManyRios opened this issue Dec 4, 2024 · 6 comments
Assignees

Comments

@ManyRios
Copy link

ManyRios commented Dec 4, 2024

Hi guys. I get this error when I tried to initilize wasm in my ts/js file:

Uncaught (in promise) CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0

the code is the usual code as the examples:

AppWallet.tsx

import initWasm,{ initThreadPool, WebWallet } from "@webzjs/webz-wallet";

export async function AppWallet() {
  const MAINNET_LIGHTWALLETD_PROXY = "https://zcash-mainnet.chainsafe.dev"
  await initWasm();
  await initThreadPool(10); 

  const wallet = new WebWallet("main", MAINNET_LIGHTWALLETD_PROXY, 10)
  console.log(wallet, 'Wallet')
}

Or

AppWallet.tsx

import  initWebzWallet, { initThreadPool, WebWallet } from "@webzjs/webz-wallet";

export async function AppWallet() {
  const MAINNET_LIGHTWALLETD_PROXY = "https://zcash-mainnet.chainsafe.dev"
  await initWebzWallet();
  await initThreadPool(10); 

  const wallet = new WebWallet("main", MAINNET_LIGHTWALLETD_PROXY, 10)
  console.log(wallet, 'Wallet')
}

I already run the webzjs repo and run demo wallet with no problems... the thing is when I want to use the library in my own project

@ec2
Copy link
Member

ec2 commented Dec 4, 2024

What browser are you attempting to run this in?

@ec2 ec2 self-assigned this Dec 4, 2024
@ManyRios
Copy link
Author

ManyRios commented Dec 4, 2024

What browser are you attempting to run this in?
Brave / Chrome

Image

@ec2
Copy link
Member

ec2 commented Dec 4, 2024

Based on some quick searching, it seems like youre not actually loading the WASM blob probably because it didnt build (WebAssembly/spec#1031).

I would make sure you've built it properly and importing everything properly.

Things around the library are a little rough around the edges still, our primary goal at the moment is building the Snaps, so we haven't taken all the steps to make sure its easily consumable by 3rd parties

@ManyRios
Copy link
Author

ManyRios commented Dec 4, 2024

Based on some quick searching, it seems like youre not actually loading the WASM blob probably because it didnt build (WebAssembly/spec#1031).

I would make sure you've built it properly and importing everything properly.

Things around the library are a little rough around the edges still, our primary goal at the moment is building the Snaps, so we haven't taken all the steps to make sure its easily consumable by 3rd parties

Image

Maybe missing something that I skipped ....?

@Lykhoyda
Copy link
Collaborator

Lykhoyda commented Dec 5, 2024

@ManyRios can you please specify which bundler you are using? I assume it didn't load the wasm file properly. Can you please also share your repo if it's open source?

@ManyRios
Copy link
Author

ManyRios commented Dec 5, 2024

@ManyRios can you please specify which bundler you are using? I assume it didn't load the wasm file properly. Can you please also share your repo if it's open source?

https://github.com/ManyRios/EduZEC/blob/main/src/components/AppWallet/AppWallet.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants