http kudos token image

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-10-19 10:33:27 +02:00
parent 7d0c655441
commit e2533e9964
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 15 additions and 8 deletions

View File

@ -6,7 +6,8 @@
[re-frame.core :as re-frame]
[status-im.utils.handlers :as handlers]
[status-im.constants :as constants]
[status-im.utils.ethereum.core :as ethereum]))
[status-im.utils.ethereum.core :as ethereum]
[clojure.string :as string]))
(def kudos :KDO)
@ -23,14 +24,20 @@
#(re-frame/dispatch [:token-uri-success
tokenId
(when %2
;;TODO extra chars in rinkeby
(subs %2 (.indexOf %2 "http")))])))))
(subs %2 (.indexOf %2 "http")))]))))) ;; extra chars in rinkeby
(handlers/register-handler-fx
:token-uri-success
(fn [_ [_ tokenId token-uri]]
{:http-get {:url token-uri
:success-event-creator (fn [o]
[:load-collectible-success kudos {tokenId (http/parse-payload o)}])
:failure-event-creator (fn [o]
[:load-collectible-failure kudos {tokenId (http/parse-payload o)}])}}))
{:http-get {:url
token-uri
:success-event-creator
(fn [o]
[:load-collectible-success kudos {tokenId (update (http/parse-payload o)
:image
string/replace
#"http:"
"https:")}]) ;; http in mainnet
:failure-event-creator
(fn [o]
[:load-collectible-failure kudos {tokenId (http/parse-payload o)}])}}))