Revert "Make UiTokenAmount::ui_amount a String (#15447)" (#15542)

This reverts commit d14374bc9f.
This commit is contained in:
Tyera Eulberg
2021-02-25 14:53:40 -07:00
committed by GitHub
parent d521dfe63c
commit 1ad2c9f741
11 changed files with 127 additions and 152 deletions

View File

@ -5701,7 +5701,7 @@ pub mod tests {
let balance: UiTokenAmount =
serde_json::from_value(result["result"]["value"].clone()).unwrap();
let error = f64::EPSILON;
assert!((f64::from_str(&balance.ui_amount).unwrap() - 4.2).abs() < error);
assert!((balance.ui_amount - 4.2).abs() < error);
assert_eq!(balance.amount, 420.to_string());
assert_eq!(balance.decimals, 2);
@ -5726,7 +5726,7 @@ pub mod tests {
let supply: UiTokenAmount =
serde_json::from_value(result["result"]["value"].clone()).unwrap();
let error = f64::EPSILON;
assert!((f64::from_str(&supply.ui_amount).unwrap() - 5.0).abs() < error);
assert!((supply.ui_amount - 5.0).abs() < error);
assert_eq!(supply.amount, 500.to_string());
assert_eq!(supply.decimals, 2);
@ -6024,7 +6024,7 @@ pub mod tests {
RpcTokenAccountBalance {
address: token_with_different_mint_pubkey.to_string(),
amount: UiTokenAmount {
ui_amount: "0.42".to_string(),
ui_amount: 0.42,
decimals: 2,
amount: "42".to_string(),
}
@ -6032,7 +6032,7 @@ pub mod tests {
RpcTokenAccountBalance {
address: token_with_smaller_balance.to_string(),
amount: UiTokenAmount {
ui_amount: "0.1".to_string(),
ui_amount: 0.1,
decimals: 2,
amount: "10".to_string(),
}
@ -6106,7 +6106,7 @@ pub mod tests {
"mint": mint.to_string(),
"owner": owner.to_string(),
"tokenAmount": {
"uiAmount": "4.2".to_string(),
"uiAmount": 4.2,
"decimals": 2,
"amount": "420",
},
@ -6114,12 +6114,12 @@ pub mod tests {
"state": "initialized",
"isNative": true,
"rentExemptReserve": {
"uiAmount": "0.1".to_string(),
"uiAmount": 0.1,
"decimals": 2,
"amount": "10",
},
"delegatedAmount": {
"uiAmount": "0.3".to_string(),
"uiAmount": 0.3,
"decimals": 2,
"amount": "30",
},