Skip to content

Commit

Permalink
chore: remove old wallet signals and move signals to status-im ns (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 authored Feb 5, 2024
1 parent b6ce60e commit 0964424
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 100 deletions.
93 changes: 0 additions & 93 deletions src/legacy/status_im/ethereum/subscriptions.cljs

This file was deleted.

1 change: 0 additions & 1 deletion src/legacy/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
legacy.status-im.chat.models.loading
legacy.status-im.contact.block
legacy.status-im.currency.core
legacy.status-im.ethereum.subscriptions
legacy.status-im.fleet.core
[legacy.status-im.keycard.core :as keycard]
legacy.status-im.log-level.core
Expand Down
6 changes: 1 addition & 5 deletions src/status_im/common/signals/events.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns status-im.common.signals.events
(:require
[legacy.status-im.chat.models.message :as models.message]
[legacy.status-im.ethereum.subscriptions :as ethereum.subscriptions]
[legacy.status-im.mailserver.core :as mailserver]
[legacy.status-im.visibility-status-updates.core :as visibility-status-updates]
[status-im.common.pairing.events :as pairing]
Expand Down Expand Up @@ -70,10 +69,7 @@
"messages.new" (messages.transport/sanitize-messages-and-process-response cofx
event-js
true)
"wallet" (ethereum.subscriptions/new-wallet-event cofx
(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
Expand Down
38 changes: 37 additions & 1 deletion src/status_im/contexts/wallet/signals.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
(ns status-im.contexts.wallet.signals
(:require [utils.re-frame :as rf]))
(:require
[oops.core :as oops]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))

(rf/reg-event-fx
:wallet/pending-transaction-status-changed-received
Expand All @@ -8,3 +11,36 @@
tx-hash (:hash details)]
{:db (update-in db [:wallet :transactions tx-hash] assoc :status :confirmed :blocks 1)})))

(rf/reg-event-fx
: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
"pending-transaction-status-changed" {:fx
[[:dispatch
[:wallet/pending-transaction-status-changed-received
(js->clj event-js
:keywordize-keys
true)]]]}
"wallet-owned-collectibles-filtering-done" {:fx [[:dispatch
[:wallet/owned-collectibles-filtering-done
(js->clj event-js
:keywordize-keys
true)]]]}
"wallet-get-collectibles-details-done" {:fx [[:dispatch
[:wallet/get-collectible-details-done
(js->clj event-js
:keywordize-keys
true)]]]}
"wallet-tick-reload" {:fx [[:dispatch [:wallet/reload]]]}
(log/debug ::unknown-wallet-event
:type type
:event (js->clj event-js
:keywordize-keys
true))))))

0 comments on commit 0964424

Please sign in to comment.