function __main(registration_canister_arg) {
import registration = registration_canister_arg;
// Load the account WASM file
let account_wasm = file("./target/wasm32-unknown-unknown/debug/account.wasm");
// Log the size of the WASM file
output("deploy_account.log", stringify("Account WASM size: ", account_wasm.size(), " bytes\n"));
// Call the registration canister to load the WASM
call registration.load_wallet_wasm();
let load_result = _;
// Log the result
output("deploy_account.log", stringify("Load wallet WASM result: ", load_result, "\n"));
// Check if loading was successful
if (eq(load_result, "Ok")) {
output("deploy_account.log", "Error: Failed to load wallet WASM\n");
} else {
output("deploy_account.log", "Successfully loaded wallet WASM\n");
};
// Deploy a new account canister
call registration.deploy_account();
let deploy_result = _;
// Log the result
output("deploy_account.log", stringify("Deploy account result: ", deploy_result, "\n"));
// Check if deployment was successful
if (exist(deploy_result.Err)) {
output("deploy_account.log", stringify("Error deploying account: ", deploy_result.Err, "\n"));
} else {
output("deploy_account.log", stringify("Successfully deployed new account canister with ID: ", deploy_result, "\n"));
}
};
β ic-repl load_wasm -- "b77ix-eeaaa-aaaaa-qaada-cai"
Ping http://localhost:4943/...
Canister REPL
error: parser error
ββ load_wasm:2:27
β
2 β import registration = registration_canister_arg;
β ^^^^^^^^^^^^^^^^^^^^^^^^^ Unexpected token
β
= Expects "text"
Error: Unrecognized token `Id("registration_canister_arg")` found at 71:96
Expected one of "text"
chenyan
September 22, 2024, 9:38pm
2
Thatβs probably a bug. Import only takes raw text, not a variable. But unless you want to specify the did file, you can pass in a principal, and avoid using import
. For example
function __main(registration) {
let load_result = call registration.load_wallet_wasm();
}
$ ic-repl load_wasm -- 'principal "b77ix-eeaaa-aaaaa-qaada-cai"'
2 Likes