-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Adapt RpcClient to recent token method changes #11519
Conversation
#[serde(skip_serializing_if = "UiTokenAmount::is_zero")] | ||
pub delegated_amount: UiTokenAmount, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub delegated_amount: Option<UiTokenAmount>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the Option, you can't deserialize a UiTokenAccount
in Rust. Ran into this in the spl-token-cli
@@ -703,103 +699,6 @@ impl RpcClient { | |||
Ok(hash) | |||
} | |||
|
|||
pub fn get_token_account(&self, pubkey: &Pubkey) -> ClientResult<Option<UiTokenAccount>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nuke things I added in for spl-token-cli but no longer need because the decimals is returned from RPC directly now
}) | ||
|
||
let config = RpcAccountInfoConfig { | ||
encoding: Some(UiAccountEncoding::JsonParsed), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need JsonParsed
to get at ui_account
: https://github.com/solana-labs/solana-program-library/pull/259/files#diff-699eaaeda047bbb52683513a93d26000R381-R399
Codecov Report
@@ Coverage Diff @@
## master #11519 +/- ##
=======================================
Coverage 81.8% 81.9%
=======================================
Files 327 327
Lines 75559 75469 -90
=======================================
+ Hits 61834 61835 +1
+ Misses 13725 13634 -91 |
Looks like CI is being held up by a Travis "PR double build" https://docs.travis-ci.com/user/pull-requests/#double-builds-on-pull-requests It should be safe to merge once reviewed |
* Avoid skip_serializing_if since that breaks deserialization * Adapt RpcClient to recent token method changes (cherry picked from commit 17645ee) # Conflicts: # client/src/rpc_client.rs
* Avoid skip_serializing_if since that breaks deserialization * Adapt RpcClient to recent token method changes (cherry picked from commit 17645ee)
* Avoid skip_serializing_if since that breaks deserialization * Adapt RpcClient to recent token method changes (cherry picked from commit 17645ee) Co-authored-by: Michael Vines <[email protected]>
* Adapt RpcClient to recent token method changes (#11519) * Avoid skip_serializing_if since that breaks deserialization * Adapt RpcClient to recent token method changes (cherry picked from commit 17645ee) # Conflicts: # client/src/rpc_client.rs * Fix conflicts Co-authored-by: Michael Vines <[email protected]> Co-authored-by: Tyera Eulberg <[email protected]>
Recent token RPC methods allow for some RpcClient clientup that
spl-token-cli
requires