interpret empty leading zero for float as valid value
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
d53e0242fb
commit
4fc26712a5
@ -2,7 +2,7 @@
|
|||||||
name = "ghost-eye"
|
name = "ghost-eye"
|
||||||
authors = ["str3tch <stretch@ghostchain.io>"]
|
authors = ["str3tch <stretch@ghostchain.io>"]
|
||||||
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
|
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"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -60,7 +60,13 @@ impl BondPopup {
|
|||||||
|
|
||||||
fn submit_message(&mut self) {
|
fn submit_message(&mut self) {
|
||||||
if let Some(network_tx) = &self.network_tx {
|
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) => {
|
Ok(value) => {
|
||||||
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
||||||
let _ = if self.is_bonded {
|
let _ = if self.is_bonded {
|
||||||
|
@ -56,7 +56,13 @@ impl RebondPopup {
|
|||||||
|
|
||||||
fn submit_message(&mut self) {
|
fn submit_message(&mut self) {
|
||||||
if let Some(network_tx) = &self.network_tx {
|
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) => {
|
Ok(value) => {
|
||||||
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
||||||
let _ = network_tx.send(Action::RebondFrom(self.secret_seed, amount));
|
let _ = network_tx.send(Action::RebondFrom(self.secret_seed, amount));
|
||||||
|
@ -56,7 +56,13 @@ impl UnbondPopup {
|
|||||||
|
|
||||||
fn submit_message(&mut self) {
|
fn submit_message(&mut self) {
|
||||||
if let Some(network_tx) = &self.network_tx {
|
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) => {
|
Ok(value) => {
|
||||||
if self.is_bonded {
|
if self.is_bonded {
|
||||||
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
||||||
|
@ -56,7 +56,13 @@ impl ValidatePopup {
|
|||||||
|
|
||||||
fn submit_message(&mut self) {
|
fn submit_message(&mut self) {
|
||||||
if let Some(network_tx) = &self.network_tx {
|
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) => {
|
Ok(value) => {
|
||||||
let amount = (value * 10_000_000.0).round() as u32;
|
let amount = (value * 10_000_000.0).round() as u32;
|
||||||
let _ = network_tx.send(Action::ValidateFrom(self.secret_seed, amount));
|
let _ = network_tx.send(Action::ValidateFrom(self.secret_seed, amount));
|
||||||
|
@ -82,7 +82,13 @@ impl Transfer {
|
|||||||
let mut account_id = [0u8; 32];
|
let mut account_id = [0u8; 32];
|
||||||
account_id.copy_from_slice(&seed_vec);
|
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) => {
|
Ok(value) => {
|
||||||
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
let amount = (value * 1_000_000_000_000_000_000.0) as u128;
|
||||||
let _ = network_tx.send(Action::TransferBalance(
|
let _ = network_tx.send(Action::TransferBalance(
|
||||||
|
Loading…
Reference in New Issue
Block a user