put_code_on_the_canister function
Future<void>
put_code_on_the_canister(
- Caller caller,
- Principal canister_id,
- Uint8List wasm_module,
- CanisterInstallMode mode, [
- Uint8List? canister_install_arg,
Installs the wasm_module
onto the canister_id
using the management canister's install_code
method.
WARNING: This function does not stop or start the canister. If your canister needs to be stopped before upgrading,
make sure to call the management canister's stop_canister
method before calling this function.
The caller
must be a controller of the canister_id
.
Implementation
Future<void> put_code_on_the_canister(Caller caller, Principal canister_id, Uint8List wasm_module, CanisterInstallMode mode, [Uint8List? canister_install_arg]) async {
await SYSTEM_CANISTERS.management.call(
caller: caller,
calltype: CallType.call,
method_name: 'install_code',
put_bytes: c_forwards([
Record.of_the_map({
'mode': Variant.of_the_map({mode.name: Null()}),
'canister_id': canister_id,
'wasm_module': Blob(wasm_module),
'arg': canister_install_arg != null ? Blob(canister_install_arg) : Blob([])
})
])
);
}