ping-pub / explorer

A light explorer for Cosmos-based Blockchains.
https://ping.pub
GNU General Public License v2.0
322 stars 1.02k forks source link

Chains with "0" exponents showing off wrong numbers #479

Closed Kamikaza731 closed 1 year ago

Kamikaza731 commented 1 year ago

Hello For quite some time, I noticed that chains with 0 exponents such as Dyson Protocol show wrong numbers as if less zeroes. For example, you can see in ping pub v2 https://explorer.trivium.network/dyson/staking this isn't the problem. The newer version of ping pub https://ping.pub/dyson-protocol/staking from 9 digit number shows 3.

This is also present in the swap option when trying to swap with Osmo it shows meager numbers.

liangping commented 1 year ago

you can check coin metadata on Cosmos Registry or on chain metadata

Xiphiar commented 1 year ago

I noticed the same issue. Dyson's DYS exponent is set to 0 and supposed to be 0, DYS has no decimal places.

In useFormatter.ts exponent defaults to 6, but the conf exponent is only used if it is greater than 6. So although 0 exponent is correct for DYS, 6 decimal places are shown. https://github.com/ping-pub/explorer/blob/74043aee8211aac96a66c2c5b4bf0492cf409402/src/stores/useFormatter.ts#L228-L234

liangping commented 1 year ago

let me think how to improve this issue.

you can add 0 exponent entry in metadata. just like injective

liangping commented 1 year ago

fixed. changed default value from 6 to 0