My goal is to have a canister create a new canister and install a pre-built wasm module. Now, the install_code() function of the management canister expects type [Nat8] as an argument for the wasm module. I’ve read some related threads, but wasn’t able to get a solution from it unfortunately. If I’m not mistaken, all I need to do is to somehow convert the wasm module to a [Nat8] array and hard-code the argument for the install_code() function. My problem is that I don’t know how to convert the wasm module to an appropriate format so that I could store it in the (parent-)canister like so:
let wasmBlob : [Nat8] = [];
public shared(msg) func uploadWasm(wasm : [Nat8]) : async () {
wasmBlob := wasm;
};
So you must convert your wasm module to hexadecimal first (there are a many options online and some Unix tools to do that offline) and convert the result to be compatible with Motoko’s Text, like:
Because the wasm is chunked, I couldn’t use the governance system to accept the data via an actor as I think that would need multiple proposals for each chunk. I think I need to convert the frontend wasm to a txt file at this point? I’ve never done anything like this so at some point I will have a txt output and I will need to somehow check it is correct before uploading it to the manager canister.
I’m not exactly sure what you’re trying to achieve, but if your goal is to upload a WASM for a “child canister” within a canister governed by an SNS, I believe the process would involve the following steps: uploading the WASM to the canister, generating a hash for that specific upload, and then submitting a custom proposal with that hash. If the custom proposal is approved and executed by comparing the hash, it will populates the WASM you uploaded to the canister.
I doubt this will be of much help, but even though Juno is not a DAO (yet), this is the process I follow to upload the WASM files for the Satellites, Mission Controls, and Orbiters within the Console.
So I know the list of child canister ids, there’s only 1. So I’d run dfx deploy – ic- - by-proposal? The canister isn’t named in my dfx json so not sure if it will work.
I would suggest to read again my answers. I did not meant “use and install the dfx canister” but “you may have to implement a custom solution as for example…”.