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

Format asset scale for UI #237

Open
tselit opened this issue Apr 29, 2024 · 0 comments
Open

Format asset scale for UI #237

tselit opened this issue Apr 29, 2024 · 0 comments
Assignees
Labels
area: popup Improvements or additions to extension popup

Comments

@tselit
Copy link

tselit commented Apr 29, 2024

Whenever the extension displays an amount on the UI, the asset scale that gets displayed must be based on the following rules:

(info: this applies to the Settings page before and after connecting to a wallet; and to the page where a user configures their hourly rate-of-pay for monetization)

While the background of the extension handles an amount in asset scale 9, and the UI displays the amount:

  • in asset scale 2 for asset codes that have an asset scale <= 2 (e.g. fiat currencies like USD, MXN, EUR etc.)
  • in asset scale 3 or 4 for asset codes that have an asset scale >2 and <= 4 (e.g. 17.018 OR 0.1234)
  • in scientific notation when the amount is < 1 and the asset code has an asset scale >= 5 and <= 9 (e.g. an amount of 0.00005 should be displayed as 5e-5) (if needed, refer to this link)
  • the entire amount in decimal point, when the amount is > 1 and the asset scale is > 4 and <= 9 (e.g. 1.000000009)

This applies to the following areas of the extension's UI:

  1. On the Settings page, before connecting the extension to a wallet, there is an "Amount" field (scientific notation not applicable)
  1. On the Settings page, when a wallet is already connected to the extension, there is a "Remaining balance" field (scientific notation applicable)
  1. When the extension is connected to a wallet, on the page where the current rate-of-pay is set, there is an hourly rate for Web Monetization; the "Remaining balance"; and the "Send amount now" for making a once-off payment (scientific notation applicable)

Summary

  1. For fiat currencies, always display asset scale 2 (i.e. this applies for all asset codes that have asset scale <= 2 e.g. EUR etc.).
  2. If the asset is crypto, display the entire amount as a decimal, or in scientific notation, depending on the asset scale rules described above.
@tselit tselit added the area: popup Improvements or additions to extension popup label Apr 29, 2024
@tselit tselit added this to the WM extension 1.0.0-alpha milestone Apr 29, 2024
@tselit tselit changed the title Display correct asset scale UI displays correct asset scale Apr 29, 2024
@tselit tselit changed the title UI displays correct asset scale Format asset scale for UI May 12, 2024
@dianafulga dianafulga self-assigned this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: popup Improvements or additions to extension popup
Projects
Status: In Progress
Development

No branches or pull requests

2 participants