fix: very small token values are being displayed in scientific format (#19349)

This commit is contained in:
Ajay Sivan 2024-03-25 18:35:53 +05:30 committed by GitHub
parent 418053b21e
commit 32a4bb1153
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 18 deletions

View File

@ -4,8 +4,8 @@
[legacy.status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils] [legacy.status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.wallet.common.utils :as wallet.utils] [utils.i18n :as i18n]
[utils.i18n :as i18n])) [utils.money :as money]))
(re-frame/reg-sub (re-frame/reg-sub
:communities/fetching-community :communities/fetching-community
@ -306,12 +306,13 @@
[checking-permissions? [checking-permissions?
token-images token-images
{:keys [satisfied criteria]}] {:keys [satisfied criteria]}]
(let [sym (:symbol criteria) (let [sym (:symbol criteria)
amount (:amount criteria)] amount-in-wei (:amountInWei criteria)
decimals (:decimals criteria)]
{:symbol sym {:symbol sym
:sufficient? satisfied :sufficient? satisfied
:loading? checking-permissions? :loading? checking-permissions?
:amount (wallet.utils/remove-trailing-zeroes amount) :amount (money/to-fixed (money/token->unit amount-in-wei decimals))
:img-src (get token-images sym)})) :img-src (get token-images sym)}))
(re-frame/reg-sub (re-frame/reg-sub

View File

@ -289,19 +289,23 @@
checks {:checking? checking-permissions? checks {:checking? checking-permissions?
:check :check
{:satisfied true {:satisfied true
:highestRole {:type constants/community-token-permission-become-admin :highestRole
:criteria [{:tokenRequirement [{:satisfied true {:type constants/community-token-permission-become-admin
:criteria {:contract_addresses :criteria [{:tokenRequirement [{:satisfied true
{:5 "0x0"} :criteria {:contract_addresses
:type 1 {:5 "0x0"}
:symbol "DAI" :type 1
:amount "5.0" :symbol "DAI"
:decimals 18}}]} :amountInWei
{:tokenRequirement [{:satisfied false "5000000000000000000"
:criteria {:type 1 :amount "5.0"
:symbol "ETH" :decimals 18}}]}
:amount "0.002" {:tokenRequirement [{:satisfied false
:decimals 18}}]}]} :criteria {:type 1
:symbol "ETH"
:amountInWei "2000000000000000"
:amount "0.002"
:decimals 18}}]}]}
:permissions :permissions
{:a3dd5b6b-d93b-452c-b22a-09a8f42ec566 {:criteria [true false {:a3dd5b6b-d93b-452c-b22a-09a8f42ec566 {:criteria [true false