Skip to content

Commit

Permalink
per command
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspofford-dfinity committed Nov 16, 2023
1 parent 86aa7be commit b84d835
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/dfx/src/commands/canister/deposit_cycles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ pub async fn exec(
opts: DepositCyclesOpts,
mut call_sender: &CallSender,
) -> DfxResult {
fetch_root_key_if_needed(env).await?;

let proxy_sender;

// choose default wallet if no wallet is specified
Expand All @@ -79,8 +81,6 @@ pub async fn exec(

let config = env.get_config_or_anyhow()?;

fetch_root_key_if_needed(env).await?;

if let Some(canister) = opts.canister.as_deref() {
deposit_cycles(env, canister, call_sender, cycles).await
} else if opts.all {
Expand Down
2 changes: 2 additions & 0 deletions src/dfx/src/commands/ledger/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::nns_types::account_identifier::{AccountIdentifier, Subaccount};
use crate::lib::operations::ledger;
use crate::lib::root_key::fetch_root_key_if_needed;
use anyhow::anyhow;
use candid::Principal;
use clap::Parser;
Expand All @@ -23,6 +24,7 @@ pub struct BalanceOpts {
}

pub async fn exec(env: &dyn Environment, opts: BalanceOpts) -> DfxResult {
fetch_root_key_if_needed(env).await?;
let sender = env
.get_selected_identity_principal()
.expect("Selected identity not instantiated.");
Expand Down
2 changes: 0 additions & 2 deletions src/dfx/src/commands/ledger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::network::network_opt::NetworkOpt;
use crate::lib::nns_types::icpts::ICPTs;
use crate::lib::root_key::fetch_root_key_if_needed;
use anyhow::anyhow;
use clap::Parser;
use fn_error_context::context;
Expand Down Expand Up @@ -45,7 +44,6 @@ pub fn exec(env: &dyn Environment, opts: LedgerOpts) -> DfxResult {
let agent_env = create_agent_environment(env, opts.network.to_network_name())?;
let runtime = Runtime::new().expect("Unable to create a runtime");
runtime.block_on(async {
fetch_root_key_if_needed(&agent_env).await?;
match opts.subcmd {
SubCommand::AccountId(v) => account_id::exec(&agent_env, v).await,
SubCommand::Balance(v) => balance::exec(&agent_env, v).await,
Expand Down

0 comments on commit b84d835

Please sign in to comment.