Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Adapt RpcClient to recent token method changes#11519

Merged
CriesofCarrots merged 2 commits intosolana-labs:masterfrom
mvines:rpc
Aug 11, 2020
Merged

Adapt RpcClient to recent token method changes#11519
CriesofCarrots merged 2 commits intosolana-labs:masterfrom
mvines:rpc

Conversation

@mvines
Copy link
Copy Markdown
Contributor

@mvines mvines commented Aug 11, 2020

Recent token RPC methods allow for some RpcClient clientup that spl-token-cli requires

#[serde(skip_serializing_if = "UiTokenAmount::is_zero")]
pub delegated_amount: UiTokenAmount,
#[serde(skip_serializing_if = "Option::is_none")]
pub delegated_amount: Option<UiTokenAmount>,
Copy link
Copy Markdown
Contributor Author

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

Comment thread client/src/rpc_client.rs
Ok(hash)
}

pub fn get_token_account(&self, pubkey: &Pubkey) -> ClientResult<Option<UiTokenAccount>> {
Copy link
Copy Markdown
Contributor Author

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

Comment thread client/src/rpc_client.rs
})

let config = RpcAccountInfoConfig {
encoding: Some(UiAccountEncoding::JsonParsed),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvines mvines added the CI Pull Request is ready to enter CI label Aug 11, 2020
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Aug 11, 2020
@mvines mvines closed this Aug 11, 2020
@mvines mvines reopened this Aug 11, 2020
@mvines mvines added the CI Pull Request is ready to enter CI label Aug 11, 2020
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Aug 11, 2020
@mvines mvines added the CI Pull Request is ready to enter CI label Aug 11, 2020
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Aug 11, 2020
@mvines mvines added the CI Pull Request is ready to enter CI label Aug 11, 2020
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Aug 11, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 11, 2020

Codecov Report

Merging #11519 into master will increase coverage by 0.0%.
The diff coverage is 37.5%.

@@           Coverage Diff           @@
##           master   #11519   +/-   ##
=======================================
  Coverage    81.8%    81.9%           
=======================================
  Files         327      327           
  Lines       75559    75469   -90     
=======================================
+ Hits        61834    61835    +1     
+ Misses      13725    13634   -91     

@t-nelson
Copy link
Copy Markdown
Contributor

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

@CriesofCarrots CriesofCarrots merged commit 17645ee into solana-labs:master Aug 11, 2020
mergify Bot pushed a commit that referenced this pull request Aug 11, 2020
* 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
mergify Bot pushed a commit that referenced this pull request Aug 11, 2020
* Avoid skip_serializing_if since that breaks deserialization

* Adapt RpcClient to recent token method changes

(cherry picked from commit 17645ee)
mergify Bot added a commit that referenced this pull request Aug 11, 2020
* 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 <mvines@gmail.com>
mergify Bot added a commit that referenced this pull request Aug 11, 2020
* 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants