diff --git a/Cargo.toml b/Cargo.toml index f0660ec..d42acc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ghost-eye" authors = ["str3tch "] description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost" -version = "0.3.30" +version = "0.3.31" edition = "2021" [dependencies] diff --git a/src/components/validator/bond_popup.rs b/src/components/validator/bond_popup.rs index 1a79918..a1c0550 100644 --- a/src/components/validator/bond_popup.rs +++ b/src/components/validator/bond_popup.rs @@ -60,7 +60,13 @@ impl BondPopup { fn submit_message(&mut self) { if let Some(network_tx) = &self.network_tx { - match self.amount.value().parse::() { + let str_amount = self.amount.value(); + let str_amount = if str_amount.starts_with('.') { + &format!("0{}", str_amount)[..] + } else { + str_amount + }; + match str_amount.parse::() { Ok(value) => { let amount = (value * 1_000_000_000_000_000_000.0) as u128; let _ = if self.is_bonded { diff --git a/src/components/validator/rebond_popup.rs b/src/components/validator/rebond_popup.rs index 3e9798e..f32e63c 100644 --- a/src/components/validator/rebond_popup.rs +++ b/src/components/validator/rebond_popup.rs @@ -56,7 +56,13 @@ impl RebondPopup { fn submit_message(&mut self) { if let Some(network_tx) = &self.network_tx { - match self.amount.value().parse::() { + let str_amount = self.amount.value(); + let str_amount = if str_amount.starts_with('.') { + &format!("0{}", str_amount)[..] + } else { + str_amount + }; + match str_amount.parse::() { Ok(value) => { let amount = (value * 1_000_000_000_000_000_000.0) as u128; let _ = network_tx.send(Action::RebondFrom(self.secret_seed, amount)); diff --git a/src/components/validator/unbond_popup.rs b/src/components/validator/unbond_popup.rs index 9bd691d..22d8449 100644 --- a/src/components/validator/unbond_popup.rs +++ b/src/components/validator/unbond_popup.rs @@ -56,7 +56,13 @@ impl UnbondPopup { fn submit_message(&mut self) { if let Some(network_tx) = &self.network_tx { - match self.amount.value().parse::() { + let str_amount = self.amount.value(); + let str_amount = if str_amount.starts_with('.') { + &format!("0{}", str_amount)[..] + } else { + str_amount + }; + match str_amount.parse::() { Ok(value) => { if self.is_bonded { let amount = (value * 1_000_000_000_000_000_000.0) as u128; diff --git a/src/components/validator/validate_popup.rs b/src/components/validator/validate_popup.rs index ec8f70a..19f5d9b 100644 --- a/src/components/validator/validate_popup.rs +++ b/src/components/validator/validate_popup.rs @@ -56,7 +56,13 @@ impl ValidatePopup { fn submit_message(&mut self) { if let Some(network_tx) = &self.network_tx { - match self.amount.value().parse::() { + let str_amount = self.amount.value(); + let str_amount = if str_amount.starts_with('.') { + &format!("0{}", str_amount)[..] + } else { + str_amount + }; + match str_amount.parse::() { Ok(value) => { let amount = (value * 10_000_000.0).round() as u32; let _ = network_tx.send(Action::ValidateFrom(self.secret_seed, amount)); diff --git a/src/components/wallet/transfer.rs b/src/components/wallet/transfer.rs index fc6a65e..8b06312 100644 --- a/src/components/wallet/transfer.rs +++ b/src/components/wallet/transfer.rs @@ -82,7 +82,13 @@ impl Transfer { let mut account_id = [0u8; 32]; account_id.copy_from_slice(&seed_vec); - match self.amount.value().parse::() { + let str_amount = self.amount.value(); + let str_amount = if str_amount.starts_with('.') { + &format!("0{}", str_amount)[..] + } else { + str_amount + }; + match str_amount.parse::() { Ok(value) => { let amount = (value * 1_000_000_000_000_000_000.0) as u128; let _ = network_tx.send(Action::TransferBalance(