|
9 | 9 | use crate::commands::nodectl::{ |
10 | 10 | output_format::OutputFormat, |
11 | 11 | utils::{ |
12 | | - SEND_TIMEOUT, check_ton_api_connection, get_wallet_config, load_config_vault, |
13 | | - load_config_vault_rpc_client, make_wallet, save_config, wait_for_seqno_change, |
14 | | - wallet_address, wallet_info, warn_missing_secret, warn_ton_api_unavailable, |
| 12 | + MASTER_WALLET_RESERVED_NAME, SEND_TIMEOUT, check_ton_api_connection, get_wallet_config, |
| 13 | + load_config_vault, load_config_vault_rpc_client, make_wallet, save_config, |
| 14 | + wait_for_seqno_change, wallet_address, wallet_info, warn_missing_secret, |
| 15 | + warn_ton_api_unavailable, |
15 | 16 | }, |
16 | 17 | }; |
17 | 18 | use anyhow::Context; |
@@ -138,7 +139,7 @@ impl WalletCmd { |
138 | 139 |
|
139 | 140 | impl WalletAddCmd { |
140 | 141 | pub async fn run(&self, path: &Path) -> anyhow::Result<()> { |
141 | | - if self.name == "master_wallet" { |
| 142 | + if self.name == MASTER_WALLET_RESERVED_NAME { |
142 | 143 | anyhow::bail!("'master_wallet' is a reserved name"); |
143 | 144 | } |
144 | 145 |
|
@@ -196,7 +197,7 @@ impl WalletLsCmd { |
196 | 197 | let mut all_wallets: Vec<(&str, &WalletConfig)> = |
197 | 198 | config.wallets.iter().map(|(k, v)| (k.as_str(), v)).collect(); |
198 | 199 | if let Some(mw) = config.master_wallet.as_ref() { |
199 | | - all_wallets.push(("master_wallet", mw)); |
| 200 | + all_wallets.push((MASTER_WALLET_RESERVED_NAME, mw)); |
200 | 201 | } |
201 | 202 |
|
202 | 203 | if all_wallets.is_empty() { |
@@ -326,6 +327,10 @@ async fn print_wallets_table( |
326 | 327 |
|
327 | 328 | impl WalletRmCmd { |
328 | 329 | pub async fn run(&self, path: &Path) -> anyhow::Result<()> { |
| 330 | + if self.name == MASTER_WALLET_RESERVED_NAME { |
| 331 | + anyhow::bail!("The master wallet cannot be removed"); |
| 332 | + } |
| 333 | + |
329 | 334 | let mut config = AppConfig::load(path)?; |
330 | 335 |
|
331 | 336 | if !config.wallets.contains_key(&self.name) { |
|
0 commit comments