diff --git a/src/status_im/common/signals/events.cljs b/src/status_im/common/signals/events.cljs index 9df594bd0765..e1cd1e07af65 100644 --- a/src/status_im/common/signals/events.cljs +++ b/src/status_im/common/signals/events.cljs @@ -69,10 +69,7 @@ "messages.new" (messages.transport/sanitize-messages-and-process-response cofx event-js true) - "wallet" (rf/dispatch [:wallet/signal-fired - (js->clj event-js - :keywordize-keys - true)]) + "wallet" (rf/dispatch [:wallet/signal-received event-js]) "local-notifications" (local-notifications/process cofx (js->clj event-js :keywordize-keys true)) "community.found" (link-preview/cache-community-preview-data (js->clj event-js diff --git a/src/status_im/contexts/wallet/signals.cljs b/src/status_im/contexts/wallet/signals.cljs index 81edc7bf1c6c..d381ef323fb0 100644 --- a/src/status_im/contexts/wallet/signals.cljs +++ b/src/status_im/contexts/wallet/signals.cljs @@ -1,20 +1,28 @@ (ns status-im.contexts.wallet.signals (:require + [oops.core :as oops] [taoensso.timbre :as log] - [utils.re-frame :as rf])) + [utils.re-frame :as rf] + [utils.transforms :as transforms])) (rf/reg-event-fx - :wallet/signal-fired - (fn [_ {:keys [type blockNumber accounts] :as event}] - (log/debug "[wallet-subs] new-wallet-event" - "event-type" type - "blockNumber" blockNumber - "accounts" accounts) - (case type - "wallet-owned-collectibles-filtering-done" {:fx [[:dispatch - [:wallet/owned-collectibles-filtering-done - event]]]} - "wallet-get-collectibles-details-done" {:fx [[:dispatch - [:wallet/get-collectible-details-done - event]]]} - (log/debug ::unknown-wallet-event :type type :event event)))) + :wallet/signal-received + (fn [_ event-js] + (let [event-type (oops/oget event-js "type") + blockNumber (oops/oget event-js "blockNumber") + accounts (oops/oget event-js "accounts")] + (log/debug "[wallet-subs] New wallet event" + {:type event-type + :block-number blockNumber + :accounts accounts}) + (case event-type + "wallet-owned-collectibles-filtering-done" + {:fx [[:dispatch + [:wallet/owned-collectibles-filtering-done + (transforms/js->clj event-js)]]]} + + "wallet-get-collectibles-details-done" + {:fx [[:dispatch + [:wallet/get-collectible-details-done + (transforms/js->clj event-js)]]]} + nil))))