Skip to content

Commit

Permalink
Decode into binary64
Browse files Browse the repository at this point in the history
  • Loading branch information
sakridge committed Aug 8, 2020
1 parent 7d79eb8 commit 2d98e4c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ use solana_account_decoder::{
get_token_account_mint, parse_token, TokenAccountType, UiMint, UiMultisig, UiTokenAccount,
UiTokenAmount,
},
UiAccount, UiAccountEncoding,
UiAccount,
UiAccountData::{Binary, Binary64},
UiAccountEncoding,
};
use solana_sdk::{
account::Account,
Expand Down Expand Up @@ -485,8 +487,13 @@ impl RpcClient {
}
let Response {
context,
value: rpc_account,
value: mut rpc_account,
} = serde_json::from_value::<Response<Option<UiAccount>>>(result_json)?;
if let Some(ref mut account) = rpc_account {
if let Binary(data) = &account.data {
account.data = Binary64(data.clone());
}
}
trace!("Response account {:?} {:?}", pubkey, rpc_account);
let account = rpc_account.and_then(|rpc_account| rpc_account.decode());
Ok(Response {
Expand Down

0 comments on commit 2d98e4c

Please sign in to comment.