wallet: load name from settings

This commit is contained in:
edouardparis 2023-10-30 13:26:21 +01:00
parent d967dc1476
commit 1cbbb8c0be

View File

@ -48,6 +48,11 @@ impl Wallet {
} }
} }
pub fn with_name(mut self, name: String) -> Self {
self.name = name;
self
}
pub fn with_key_aliases(mut self, aliases: HashMap<Fingerprint, String>) -> Self { pub fn with_key_aliases(mut self, aliases: HashMap<Fingerprint, String>) -> Self {
self.keys_aliases = aliases; self.keys_aliases = aliases;
self self
@ -101,7 +106,8 @@ impl Wallet {
let mut wallet = match settings::Settings::from_file(datadir_path.to_path_buf(), network) { let mut wallet = match settings::Settings::from_file(datadir_path.to_path_buf(), network) {
Ok(settings) => { Ok(settings) => {
if let Some(wallet_setting) = settings.wallets.first() { if let Some(wallet_setting) = settings.wallets.first() {
self.with_hardware_wallets(wallet_setting.hardware_wallets.clone()) self.with_name(wallet_setting.name.clone())
.with_hardware_wallets(wallet_setting.hardware_wallets.clone())
.with_key_aliases(wallet_setting.keys_aliases()) .with_key_aliases(wallet_setting.keys_aliases())
} else { } else {
self.with_hardware_wallets(gui_config_hws) self.with_hardware_wallets(gui_config_hws)