Skip to content

Commit

Permalink
Discard the changes in 'diagnosis.rs'.
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-dfinity committed Dec 2, 2024
1 parent 4039698 commit 27d5c71
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/dfx/src/lib/diagnosis.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::lib::cycles_ledger_types::create_canister::CreateCanisterError;
use crate::lib::error_code;
use crate::lib::ledger_types::TransferError as ICPTransferError;
use anyhow::Error as AnyhowError;
use dfx_core::error::root_key::FetchRootKeyError;
use dfx_core::network::provider::get_network_context;
Expand Down Expand Up @@ -81,12 +80,6 @@ pub fn diagnose(err: &AnyhowError) -> Diagnosis {
}
}

if let Some(transfer_error) = err.downcast_ref::<ICPTransferError>() {
if insufficient_icp(transfer_error) {
return diagnose_insufficient_icp();
}
}

NULL_DIAGNOSIS
}

Expand Down Expand Up @@ -302,19 +295,3 @@ fn diagnose_insufficient_cycles() -> Diagnosis {
);
(Some(explanation.to_string()), Some(suggestion))
}

fn insufficient_icp(err: &ICPTransferError) -> bool {
matches!(err, ICPTransferError::InsufficientFunds { balance: _ })
}

fn diagnose_insufficient_icp() -> Diagnosis {
let explanation = "Insufficient ICP balance to finish the transfer transaction.";
let suggestion = "Please top up your ICP balance.
Please run 'dfx ledger account-id' to get your account address for receiving ICP from centralized exchanges.
(Example: a9e20b8d042cb7b73144de94e9091e8f2620dfc1e617cbfaa19d624322451b9d)
Please run 'dfx identity get-principal' to get your principal for receiving ICP from ICP wallets and decentralized exchanges.
(Exmaple: treln-6wg26-lak4v-sh7p6-qm7hn-ohcjl-ut3os-lemuf-ypxvr-zcamm-gae)";
(Some(explanation.to_string()), Some(suggestion.to_string()))
}

0 comments on commit 27d5c71

Please sign in to comment.