[#10041] Request token price after adding

This commit is contained in:
Roman Volosovskyi 2020-02-14 13:18:42 +02:00
parent 3f6051c22b
commit 965dce053d
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 10 additions and 3 deletions

View File

@ -1,7 +1,8 @@
(ns status-im.utils.prices (ns status-im.utils.prices
(:require [status-im.utils.http :as http] (:require [clojure.string :as string]
[status-im.utils.http :as http]
[status-im.utils.types :as types] [status-im.utils.types :as types]
[status-im.utils.config :as config])) [taoensso.timbre :as log]))
;; Responsible for interacting with Cryptocompare API to get current prices for ;; Responsible for interacting with Cryptocompare API to get current prices for
;; currencies and tokens. ;; currencies and tokens.
@ -15,7 +16,7 @@
(def status-identifier "extraParams=Status.im") (def status-identifier "extraParams=Status.im")
(defn- ->url-param-syms [syms] (defn- ->url-param-syms [syms]
((comp (partial clojure.string/join ",") (partial map name)) syms)) ((comp (partial string/join ",") (partial map name)) syms))
(defn- gen-price-url [fsyms tsyms chaos-mode?] (defn- gen-price-url [fsyms tsyms chaos-mode?]
(if chaos-mode? (if chaos-mode?
@ -40,6 +41,11 @@
:last-day (:OPEN24HOUR entry)}}))})))) :last-day (:OPEN24HOUR entry)}}))}))))
(defn get-prices [from to mainnet? on-success on-error chaos-mode?] (defn get-prices [from to mainnet? on-success on-error chaos-mode?]
(log/debug "[prices] get-prices"
"from" from
"to" to
"mainnet?" mainnet?
"chaos-mode?" chaos-mode?)
(http/get (http/get
(gen-price-url from to chaos-mode?) (gen-price-url from to chaos-mode?)
(fn [resp] (on-success (format-price-resp resp mainnet?))) (fn [resp] (on-success (format-price-resp resp mainnet?)))

View File

@ -183,6 +183,7 @@
:params [new-token] :params [new-token]
:on-success #()}]} :on-success #()}]}
(wallet/add-custom-token new-token) (wallet/add-custom-token new-token)
(wallet/update-prices)
(navigation/navigate-back)))) (navigation/navigate-back))))
(fx/defn remove-custom-token (fx/defn remove-custom-token