I want to implement an architecture where by i want to create a canister to every new user register. Open chat does it but i can’t understand how it did it in rust . Motoko has actor classes but is there anything similar in Rust.
I’m working on this topic recently/
Here’s the example from SaorsaLabs
It a factory to create canister using Rust
You need to get the wasm from canister you want to create then you this kind of script to convert it to Nat8 array in my case I use Typescript. but you can use Rust also
export const loadWasm = async () => {
console.log("Loading wasm...");
const currentPath = process.cwd();
const buffer = await readFile(
path.join(currentPath, "canister.wasm")
);
return [...new Uint8Array(buffer)];
};
export const callUploadWasm = async () => {
const wasm = await loadWasm();
const actor = createActor("factory canister", {
agent,
})
const result = await actor.add_wasm(
wasm,
"canister name store in runtime",
[] //optional
);
console.log(result);
}
callUploadWasm();