[#8648] Packs aren't shown in mainnet but we have them in the contract

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2019-07-26 12:29:17 +02:00
parent 89abc8ab11
commit 808aa793e5
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 8 additions and 16 deletions

View File

@ -1694,8 +1694,8 @@
(handlers/register-handler-fx (handlers/register-handler-fx
:stickers/load-pack :stickers/load-pack
(fn [cofx [_ proto-code hash id price open?]] (fn [cofx [_ url id price open?]]
(stickers/load-pack cofx proto-code hash id price open?))) (stickers/load-pack cofx url id price open?)))
(handlers/register-handler-fx (handlers/register-handler-fx
:stickers/select-pack :stickers/select-pack

View File

@ -2,26 +2,21 @@
(:require [cljs.reader :as edn] (:require [cljs.reader :as edn]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.multiaccounts.core :as multiaccounts] [status-im.multiaccounts.core :as multiaccounts]
[status-im.constants :as constants]
[status-im.ethereum.abi-spec :as abi-spec] [status-im.ethereum.abi-spec :as abi-spec]
[status-im.ethereum.contracts :as contracts] [status-im.ethereum.contracts :as contracts]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.ethereum.json-rpc :as json-rpc] [status-im.ethereum.json-rpc :as json-rpc]
[status-im.ui.screens.navigation :as navigation] [status-im.ui.screens.navigation :as navigation]
[status-im.utils.fx :as fx] [status-im.utils.fx :as fx]
[status-im.utils.multihash :as multihash]
[status-im.utils.utils :as utils] [status-im.utils.utils :as utils]
[status-im.signing.core :as signing])) [status-im.signing.core :as signing]
[status-im.utils.contenthash :as contenthash]))
(defn pack-data-callback (defn pack-data-callback
[id open?] [id open?]
(fn [[category owner mintable timestamp price contenthash]] (fn [[category owner mintable timestamp price contenthash]]
(let [proto-code (subs contenthash 2 4) (when-let [url (contenthash/url contenthash)]
hash (when contenthash (re-frame/dispatch [:stickers/load-pack url id price open?]))))
(multihash/base58 (multihash/create :sha2-256 (subs contenthash 12))))]
(when (and (#{constants/swarm-proto-code constants/ipfs-proto-code}
proto-code) hash)
(re-frame/dispatch [:stickers/load-pack proto-code hash id price open?])))))
(re-frame/reg-fx (re-frame/reg-fx
:stickers/set-pending-timout-fx :stickers/set-pending-timout-fx
@ -134,11 +129,8 @@
{:stickers/pack-data-fx [contract-address id]}))))) {:stickers/pack-data-fx [contract-address id]})))))
(fx/defn load-pack (fx/defn load-pack
[cofx proto-code hash id price open?] [cofx url id price open?]
{:http-get {:url (str (if (= constants/swarm-proto-code proto-code) {:http-get {:url url
"https://swarm-gateways.net/bzz:/"
"https://ipfs.infura.io/ipfs/")
hash)
:success-event-creator :success-event-creator
(fn [o] (fn [o]
[:stickers/load-sticker-pack-success o id price open?])}}) [:stickers/load-sticker-pack-success o id price open?])}})