apps icon indicating copy to clipboard operation
apps copied to clipboard

Display and edit of fixed point numbers

Open blakebyrnes opened this issue 1 year ago • 2 comments

It would be really helpful to be able to view fixed point numbers (and edit them) with the actual numbers they represent. Are you open to adding additional common substrate primitives to the ui?

blakebyrnes avatar Sep 07 '24 15:09 blakebyrnes

Hey @blakebyrnes Could you please give more context?

Thanks

piggydoughnut avatar Oct 14 '24 10:10 piggydoughnut

@piggydoughnut, FixedU128, FixedU64, etc represent decimal numbers using fixed points, but when you edit them in extrinsic creations (or view them in the storage), they show up as full u128 values. For instance, these are prices from the Argon Testnet (Storage -> priceIndex -> current())

{
  btcUsdPrice: 65,926,754,199,999,998,853,120
  argonUsdPrice: 1,000,000,000,000,000,000
  argonUsdTargetPrice: 1,002,545,194,941,447,002
  tick: 8,182
}

The BTC usd price is 65,926.754.... In an ideal world, the decimal place would be visible here. And while editing, you would be able to input a variable with optional decimal precision. Below is what fixed numbers show in the extrinsic ui. As you can see, if you're just hoping to enter a percentage, this can make the it very hard to know what to input.

image

blakebyrnes avatar Oct 14 '24 21:10 blakebyrnes

This is not something I would try and implement because of the coupling between the on chain information and how apps interprets that data and sends out any extrinsic, etc.

It's a bit of a PITA - that being said I will keep this open in the case that anyone wants to tackle it.

TarikGul avatar Oct 30 '24 21:10 TarikGul

In general, Inputs generally be provided in Planck units in Polkadot Explorer. However, if an input requires non-Planck units, we are explicity telling users about it with https://github.com/polkadot-js/apps/pull/11275

Hence, Closing this issue as it appears to be outdated now. If the problem persists, a new issue can be opened with updated details.

ap211unitech avatar Feb 14 '25 07:02 ap211unitech

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

polkadot-js-bot avatar Feb 21 '25 08:02 polkadot-js-bot