Adapt RpcClient to recent token method changes#11519
Adapt RpcClient to recent token method changes#11519CriesofCarrots merged 2 commits intosolana-labs:masterfrom
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.
Without the Option, you can't deserialize a UiTokenAccount in Rust. Ran into this in the spl-token-cli
| Ok(hash) | ||
| } | ||
|
|
||
| pub fn get_token_account(&self, pubkey: &Pubkey) -> ClientResult<Option<UiTokenAccount>> { |
There was a problem hiding this comment.
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.
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)
* 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 <mvines@gmail.com> Co-authored-by: Tyera Eulberg <tyera@solana.com>
Recent token RPC methods allow for some RpcClient clientup that
spl-token-clirequires