From 945d5d3186c7a5ee7050bed838bbfe04ecc03cfd Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Thu, 7 Sep 2023 19:09:00 -0700 Subject: [PATCH] fix --- .../operations/canister/motoko_playground.rs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/dfx/src/lib/operations/canister/motoko_playground.rs b/src/dfx/src/lib/operations/canister/motoko_playground.rs index ac3bed4e1a..d9c0d43224 100644 --- a/src/dfx/src/lib/operations/canister/motoko_playground.rs +++ b/src/dfx/src/lib/operations/canister/motoko_playground.rs @@ -53,7 +53,20 @@ pub struct InstallArgs<'a> { struct InstallConfig<'a> { profiling: bool, is_whitelisted: bool, + origin: Origin<'a>, +} +#[derive(CandidType)] +struct Origin<'a> { origin: &'a str, + tags: &'a [&'a str], +} +impl<'a> Origin<'a> { + fn new() -> Self { + Self { + origin: "dfx", + tags: &[], + } + } } #[context("Failed to reserve canister '{}'.", canister_name)] @@ -78,7 +91,7 @@ pub async fn reserve_canister_with_playground( }; let mut canister_id_store = env.get_canister_id_store()?; let (timestamp, nonce) = create_nonce(); - let get_can_arg = Encode!(&GetCanisterIdArgs { timestamp, nonce }, &"dfx")?; + let get_can_arg = Encode!(&GetCanisterIdArgs { timestamp, nonce }, &Origin::new())?; let result = agent .update(&playground_canister, "getCanisterId") .with_arg(get_can_arg) @@ -157,15 +170,10 @@ pub async fn playground_install_code( mode, canister_id: canister_info.id, }; - let origin = if is_asset_canister { - "dfx:asset" - } else { - "dfx" - }; let install_config = InstallConfig { profiling: false, is_whitelisted: is_asset_canister, - origin, + origin: Origin::new(), }; let encoded_arg = encode_args((canister_info, install_arg, install_config))?; let result = agent