I am working on a front end of an app what interacts with the NEAR protocol. The workflow I am creating is:
Parts 1 and 2 are working fine. for part 3 I have the following code.
//Deploy the contract.
let response;
try {
response = await subaccount.deployContract(wasamContract);
}catch(err){
console.log("Error deploying the contract: ", err)
}
console.log("Contract deployed: ", response)
And using the following to import the wasm file:
import wasamContract from "../../assets/main.wasm";
However I get an error on the file import.
./src/assets/main.wasm
Module parse failed: magic header not detected
File was processed with these loaders:
* ./node_modules/file-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
Error: magic header not detected
So how would I import the wasm file to be used in the above code?
this example should help you, it's an experimental application that deploys smart contracts to any account that registers