This reverts commit d14374bc9f
.
This commit is contained in:
@ -104,8 +104,6 @@ pub struct UiTokenAmount {
|
||||
pub decimals: u32,
|
||||
#[prost(string, tag = "3")]
|
||||
pub amount: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub ui_amount_string: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Reward {
|
||||
|
@ -70,7 +70,6 @@ message UiTokenAmount {
|
||||
double ui_amount = 1;
|
||||
uint32 decimals = 2;
|
||||
string amount = 3;
|
||||
string ui_amount_string = 4;
|
||||
}
|
||||
|
||||
enum RewardType {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::StoredExtendedRewards;
|
||||
use solana_account_decoder::parse_token::{real_number_string_trimmed, UiTokenAmount};
|
||||
use solana_account_decoder::parse_token::UiTokenAmount;
|
||||
use solana_sdk::{
|
||||
hash::Hash,
|
||||
instruction::CompiledInstruction,
|
||||
@ -14,10 +14,7 @@ use solana_transaction_status::{
|
||||
ConfirmedBlock, InnerInstructions, Reward, RewardType, TransactionByAddrInfo,
|
||||
TransactionStatusMeta, TransactionTokenBalance, TransactionWithStatusMeta,
|
||||
};
|
||||
use std::{
|
||||
convert::{TryFrom, TryInto},
|
||||
str::FromStr,
|
||||
};
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
|
||||
pub mod generated {
|
||||
include!(concat!(
|
||||
@ -386,10 +383,9 @@ impl From<TransactionTokenBalance> for generated::TokenBalance {
|
||||
account_index: value.account_index as u32,
|
||||
mint: value.mint,
|
||||
ui_token_amount: Some(generated::UiTokenAmount {
|
||||
ui_amount: value.ui_token_amount.ui_amount,
|
||||
decimals: value.ui_token_amount.decimals as u32,
|
||||
amount: value.ui_token_amount.amount,
|
||||
ui_amount_string: value.ui_token_amount.ui_amount,
|
||||
..generated::UiTokenAmount::default()
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -402,14 +398,7 @@ impl From<generated::TokenBalance> for TransactionTokenBalance {
|
||||
account_index: value.account_index as u8,
|
||||
mint: value.mint,
|
||||
ui_token_amount: UiTokenAmount {
|
||||
ui_amount: if !ui_token_amount.ui_amount_string.is_empty() {
|
||||
ui_token_amount.ui_amount_string
|
||||
} else {
|
||||
real_number_string_trimmed(
|
||||
u64::from_str(&ui_token_amount.amount).unwrap_or(0),
|
||||
ui_token_amount.decimals as u8,
|
||||
)
|
||||
},
|
||||
ui_amount: ui_token_amount.ui_amount,
|
||||
decimals: ui_token_amount.decimals as u8,
|
||||
amount: ui_token_amount.amount,
|
||||
},
|
||||
|
Reference in New Issue
Block a user