Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_token_account methods #12346

Conversation

CriesofCarrots
Copy link
Contributor

Problem

The spl-token-cli needs a quick way to get token account info beyond just the balance, cc solana-labs/solana-program-library#467

Summary of Changes

Add RpcClient::get_token_account methods that return a parsed TokenAccountType. This allows for easy client handling of SPL token Accounts, Mints, or Multisigs

Usage for the issue above would look like:

if let TokenAccountType::Account(token_account) = config
  .rpc_client
  .get_token_account_with_commitment(&address, config.commitment_config)?
  .value {
    // print all fields, etc
  }

Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

RpcError::ForUser still makes me sad. LGTM otherwise though!

@CriesofCarrots CriesofCarrots added v1.3 automerge Merge this Pull Request automatically once CI passes labels Sep 19, 2020
@codecov
Copy link

codecov bot commented Sep 19, 2020

Codecov Report

Merging #12346 into master will decrease coverage by 0.0%.
The diff coverage is 0.0%.

@@            Coverage Diff            @@
##           master   #12346     +/-   ##
=========================================
- Coverage    82.1%    82.1%   -0.1%     
=========================================
  Files         343      343             
  Lines       80448    80489     +41     
=========================================
- Hits        66109    66089     -20     
- Misses      14339    14400     +61     

@CriesofCarrots CriesofCarrots merged commit 28f2c15 into solana-labs:master Sep 19, 2020
mergify bot pushed a commit that referenced this pull request Sep 19, 2020
mergify bot added a commit that referenced this pull request Sep 19, 2020
(cherry picked from commit 28f2c15)

Co-authored-by: Tyera Eulberg <[email protected]>
@CriesofCarrots CriesofCarrots deleted the add-get-token-account-client-method branch September 24, 2020 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants