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

Return delegated amount as UiTokenAmount #11475

Merged
merged 2 commits into from
Aug 8, 2020

Conversation

CriesofCarrots
Copy link
Contributor

Problem

  1. When encoding token accounts to JSON in RPC, tokenAmount is a UiAmount but delegatedAmount is a number. They should be treated the same.
  2. The delegate property is returning null when unset. I would expect it to be omitted.

Summary of Changes

  • Update delegatedAmount to return UiTokenAmount
  • Omit delegate and delegatedAmount when unset/0 respectively

Fixes #11471

jstarry
jstarry previously approved these changes Aug 8, 2020
Copy link
Member

@jstarry jstarry left a comment

Choose a reason for hiding this comment

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

Lgtm just a nit on naming

account-decoder/src/parse_token.rs Outdated Show resolved Hide resolved
@mergify mergify bot dismissed jstarry’s stale review August 8, 2020 17:59

Pull request has been modified.

@CriesofCarrots CriesofCarrots added the automerge Merge this Pull Request automatically once CI passes label Aug 8, 2020
@codecov
Copy link

codecov bot commented Aug 8, 2020

Codecov Report

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

@@            Coverage Diff            @@
##           master   #11475     +/-   ##
=========================================
- Coverage    81.8%    81.7%   -0.1%     
=========================================
  Files         323      323             
  Lines       74965    74970      +5     
=========================================
- Hits        61325    61299     -26     
- Misses      13640    13671     +31     

@mergify mergify bot merged commit 88d8d3d into solana-labs:master Aug 8, 2020
mergify bot pushed a commit that referenced this pull request Aug 8, 2020
* Return delegated amount as UiTokenAmount

* Omit delegate and delegatedAmount when none

(cherry picked from commit 88d8d3d)
mergify bot pushed a commit that referenced this pull request Aug 8, 2020
* Return delegated amount as UiTokenAmount

* Omit delegate and delegatedAmount when none

(cherry picked from commit 88d8d3d)
mergify bot added a commit that referenced this pull request Aug 9, 2020
* Return delegated amount as UiTokenAmount

* Omit delegate and delegatedAmount when none

(cherry picked from commit 88d8d3d)

Co-authored-by: Tyera Eulberg <[email protected]>
mergify bot added a commit that referenced this pull request Aug 9, 2020
* Return delegated amount as UiTokenAmount

* Omit delegate and delegatedAmount when none

(cherry picked from commit 88d8d3d)

Co-authored-by: Tyera Eulberg <[email protected]>
@CriesofCarrots CriesofCarrots deleted the delegate-ui-amount branch September 1, 2020 19:57
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.

RPC: Token account decoding issues
2 participants