test caching

1f7816dd...022b6fd4
This commit is contained in:
Andrea Maria Piana 2024-08-15 17:53:58 +01:00
parent 09c4e33834
commit f4e0c69d72
5 changed files with 28 additions and 17 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 "test"))
(def status-proxy-stage-name (get-config :STATUS_PROXY_STAGE_NAME "prod"))
(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

@ -7,6 +7,7 @@
[utils.number :as number]
[utils.string]))
(def missing-price-decimals 6) ; if we don't have the monetary value of the token, we default to 6 decimals
(defn get-first-name
[full-name]
(first (string/split full-name #" ")))
@ -66,16 +67,20 @@
(defn get-standard-crypto-format
"For full details: https://github.com/status-im/status-mobile/issues/18225"
[{:keys [market-values-per-currency]} token-units]
(if (or (nil? token-units)
(nil? market-values-per-currency)
(money/equal-to token-units 0))
"0"
(let [price (-> market-values-per-currency :usd :price)
one-cent-value (if (pos? price) (/ 0.01 price) 0)
decimals-count (calc-max-crypto-decimals one-cent-value)]
(if (< token-units one-cent-value)
(str "<" (number/remove-trailing-zeroes (.toFixed one-cent-value decimals-count)))
(number/remove-trailing-zeroes (.toFixed token-units decimals-count))))))
(cond (or (nil? token-units)
(money/equal-to token-units 0))
"0"
(nil? market-values-per-currency)
(number/remove-trailing-zeroes (.toFixed token-units missing-price-decimals))
:else
(let [price (-> market-values-per-currency :usd :price)
one-cent-value (if (pos? price) (/ 0.01 price) 0)
decimals-count (calc-max-crypto-decimals one-cent-value)]
(if (< token-units one-cent-value)
(str "<" (number/remove-trailing-zeroes (.toFixed one-cent-value decimals-count)))
(number/remove-trailing-zeroes (.toFixed token-units decimals-count))))))
(defn get-market-value
[currency {:keys [market-values-per-currency]}]

View File

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

View File

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

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "release/0.182.x",
"commit-sha1": "dd787c982aac6cd2d376c9eb8c5a32a31c8f4405",
"src-sha256": "0i5s7hdy27xjwb4vfg90w6b336149sdawq8x0xa9ynix0f7i6ixc"
"version": "test/set-api-proxy-test-debug",
"commit-sha1": "022b6fd45b99819ec14baabd6d482ae85ed468bf",
"src-sha256": "03p7x3s9005ghi02x334077nxwdhwlkxmvhcnc07lsygfsnzkkzk"
}