diff --git a/src/status_im/events.cljs b/src/status_im/events.cljs index ce124dda17..24eeea4cb8 100644 --- a/src/status_im/events.cljs +++ b/src/status_im/events.cljs @@ -1694,8 +1694,8 @@ (handlers/register-handler-fx :stickers/load-pack - (fn [cofx [_ proto-code hash id price open?]] - (stickers/load-pack cofx proto-code hash id price open?))) + (fn [cofx [_ url id price open?]] + (stickers/load-pack cofx url id price open?))) (handlers/register-handler-fx :stickers/select-pack diff --git a/src/status_im/stickers/core.cljs b/src/status_im/stickers/core.cljs index cfbb8095a6..720287d505 100644 --- a/src/status_im/stickers/core.cljs +++ b/src/status_im/stickers/core.cljs @@ -2,26 +2,21 @@ (:require [cljs.reader :as edn] [re-frame.core :as re-frame] [status-im.multiaccounts.core :as multiaccounts] - [status-im.constants :as constants] [status-im.ethereum.abi-spec :as abi-spec] [status-im.ethereum.contracts :as contracts] [status-im.ethereum.core :as ethereum] [status-im.ethereum.json-rpc :as json-rpc] [status-im.ui.screens.navigation :as navigation] [status-im.utils.fx :as fx] - [status-im.utils.multihash :as multihash] [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 [id open?] (fn [[category owner mintable timestamp price contenthash]] - (let [proto-code (subs contenthash 2 4) - hash (when contenthash - (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?]))))) + (when-let [url (contenthash/url contenthash)] + (re-frame/dispatch [:stickers/load-pack url id price open?])))) (re-frame/reg-fx :stickers/set-pending-timout-fx @@ -134,11 +129,8 @@ {:stickers/pack-data-fx [contract-address id]}))))) (fx/defn load-pack - [cofx proto-code hash id price open?] - {:http-get {:url (str (if (= constants/swarm-proto-code proto-code) - "https://swarm-gateways.net/bzz:/" - "https://ipfs.infura.io/ipfs/") - hash) + [cofx url id price open?] + {:http-get {:url url :success-event-creator (fn [o] [:stickers/load-sticker-pack-success o id price open?])}})