junobuild_shared::mgmt::ic

Function create_canister_install_code

Source
pub async fn create_canister_install_code(
    controllers: Vec<Principal>,
    wasm_arg: &WasmArg,
    cycles: u128,
) -> Result<Principal, String>
Expand description

Asynchronously creates a new canister and installs provided Wasm code with additional cycles.

§Arguments

  • controllers: A list of Principal IDs to set as controllers of the new canister.
  • wasm_arg: Wasm binary and arguments to install in the new canister (WasmArg struct).
  • cycles: Additional cycles to deposit during canister creation on top of CREATE_CANISTER_CYCLES.

§Returns

  • Ok(Principal): On success, returns the Principal ID of the newly created canister.
  • Err(String): On failure, returns an error message.