interpret empty leading zero for float as valid value

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-02-17 14:58:02 +03:00
parent d53e0242fb
commit 4fc26712a5
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
6 changed files with 36 additions and 6 deletions

View File

@ -2,7 +2,7 @@
name = "ghost-eye"
authors = ["str3tch <stretch@ghostchain.io>"]
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]

View File

@ -60,7 +60,13 @@ impl BondPopup {
fn submit_message(&mut self) {
if let Some(network_tx) = &self.network_tx {
match self.amount.value().parse::<f64>() {
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::<f64>() {
Ok(value) => {
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
let _ = if self.is_bonded {

View File

@ -56,7 +56,13 @@ impl RebondPopup {
fn submit_message(&mut self) {
if let Some(network_tx) = &self.network_tx {
match self.amount.value().parse::<f64>() {
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::<f64>() {
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));

View File

@ -56,7 +56,13 @@ impl UnbondPopup {
fn submit_message(&mut self) {
if let Some(network_tx) = &self.network_tx {
match self.amount.value().parse::<f64>() {
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::<f64>() {
Ok(value) => {
if self.is_bonded {
let amount = (value * 1_000_000_000_000_000_000.0) as u128;

View File

@ -56,7 +56,13 @@ impl ValidatePopup {
fn submit_message(&mut self) {
if let Some(network_tx) = &self.network_tx {
match self.amount.value().parse::<f64>() {
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::<f64>() {
Ok(value) => {
let amount = (value * 10_000_000.0).round() as u32;
let _ = network_tx.send(Action::ValidateFrom(self.secret_seed, amount));

View File

@ -82,7 +82,13 @@ impl Transfer {
let mut account_id = [0u8; 32];
account_id.copy_from_slice(&seed_vec);
match self.amount.value().parse::<f64>() {
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::<f64>() {
Ok(value) => {
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
let _ = network_tx.send(Action::TransferBalance(