put_code_on_the_canister function

Future<void> put_code_on_the_canister(
  1. Caller caller,
  2. Principal canister_id,
  3. Uint8List wasm_canister_bytes,
  4. String mode, [
  5. Uint8List? canister_install_arg,
])

Implementation

Future<void> put_code_on_the_canister(Caller caller, Principal canister_id, Uint8List wasm_canister_bytes, String 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.oftheMap({
                'mode': Variant.oftheMap({mode: Null()}),
                'canister_id': canister_id.candid,
                'wasm_module': Blob(wasm_canister_bytes),
                'arg': canister_install_arg != null ? Blob(canister_install_arg) : Blob([])
            })
        ])
    );
}