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

token-2022: Take decimals into account for UI amount #7540

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

joncinque
Copy link
Contributor

Problem

The interest-bearing and scaled UI amount extensions don't take into account the mint decimals when printing the number, and they don't properly trim afterwards. This can be confusing.

Summary of changes

Update the UI amount conversion to take into account the decimals of precision, and then actually trim. Note that a lot of calculations become more precise because of this change!

#### Problem

The interest-bearing and scaled UI amount extensions don't take into
account the mint decimals when printing the number, and they don't
properly trim afterwards. This can be confusing.

#### Summary of changes

Update the UI amount conversion to take into account the decimals of
precision, and then actually trim. Note that a lot of calculations
become more precise because of this change!
Copy link
Contributor

@gitteri gitteri left a comment

Choose a reason for hiding this comment

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

Nice!

@joncinque joncinque merged commit a3e484f into solana-labs:master Dec 6, 2024
35 checks passed
@joncinque joncinque deleted the tk22uiamt branch December 6, 2024 12:19
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.

3 participants