Add caching of token amounts

1f7816dd...022b6fd4
This commit is contained in:
Andrea Maria Piana 2024-08-16 11:44:11 +01:00
parent ce87945736
commit bed2057d97
4 changed files with 9 additions and 10 deletions

View File

@ -48,7 +48,7 @@
(def opensea-api-key OPENSEA_API_KEY)
(def status-proxy-enabled? true)
(def status-proxy-stage-name (get-config :STATUS_PROXY_STAGE_NAME "prod"))
(def status-proxy-stage-name (get-config :STATUS_PROXY_STAGE_NAME "test"))
(def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1")))
(def mailserver-confirmations-enabled? (enabled? (get-config :MAILSERVER_CONFIRMATIONS_ENABLED)))
(def pairing-popup-disabled? (enabled? (get-config :PAIRING_POPUP_DISABLED "0")))

View File

@ -64,6 +64,11 @@
(is (= (utils/get-standard-crypto-format {:market-values-per-currency market-values-per-currency}
token-units)
"0.005")))
(let [market-values-per-currency {:usd {:price nil}}
token-units (money/bignumber 0.0123456)]
(is (= (utils/get-standard-crypto-format {:market-values-per-currency market-values-per-currency}
token-units)
"0.012346")))
(let [market-values-per-currency {:usd {:price 0.005}}
token-units (money/bignumber 0.01)]
(is (= (utils/get-standard-crypto-format {:market-values-per-currency market-values-per-currency}

View File

@ -190,9 +190,7 @@
:fx [[:json-rpc/call
[{:method "wallet_getWalletToken"
:params [[address]]
:on-success #(do
(println "RESPONSE HERE" %)
(rf/dispatch [:wallet/store-wallet-token address %]))
:on-success [:wallet/store-wallet-token address]
:on-error [:wallet/get-wallet-token-for-account-failed address]}]]]}))
(rf/reg-event-fx

View File

@ -340,14 +340,10 @@
:<- [:profile/currency]
:<- [:wallet/selected-networks->chain-ids]
(fn [[accounts currency chain-ids]]
(println "CHAINS" currency chain-ids)
(zipmap (map :address accounts)
(map #(do
(println "HERE" chain-ids (:tokens %))
(println "HERE2" %)
(utils/calculate-balance-from-tokens {:currency currency
(map #(utils/calculate-balance-from-tokens {:currency currency
:tokens (:tokens %)
:chain-ids chain-ids}))
:chain-ids chain-ids})
accounts))))
(rf/reg-sub