feat(wallet): sequencers removal added as well

This commit is contained in:
Pravdyvy
2026-08-13 06:53:01 +03:00
parent e2534dd03b
commit 18da5dfe93
+17
View File
@@ -29,6 +29,8 @@ pub enum ConfigSubcommand {
user: Option<String>,
password: Option<String>,
},
/// Remove sequencer from a list.
RemoveSequencer { addr: String },
}
impl ConfigSubcommand {
@@ -202,6 +204,21 @@ impl WalletSubcommand for ConfigSubcommand {
wallet_core.config.sequencers.push(seq_connection_data);
Ok(SubcommandReturnValue::Empty)
}
Self::RemoveSequencer { addr } => {
let url_addr = addr.parse()?;
let (idx, _) = wallet_core
.config
.sequencers
.iter()
.enumerate()
.find(|(_, conn_data)| conn_data.sequencer_addr == url_addr)
.ok_or_else(|| anyhow::anyhow!("Sequencer with this addr is not found"))?;
wallet_core.config.sequencers.remove(idx);
Ok(SubcommandReturnValue::Empty)
}
}