Skip to content

Commit 49888c6

Browse files
refactor
1 parent b549591 commit 49888c6

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/status_im/constants.cljs

+4
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,7 @@
601601
{:paraswap swap-provider-paraswap})
602602

603603
(def ^:const token-for-fees-symbol "ETH")
604+
605+
(def ^:const transaction-status-success "Success")
606+
(def ^:const transaction-status-pending "Pending")
607+
(def ^:const transaction-status-failed "Failed")

src/status_im/contexts/wallet/signals.cljs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns status-im.contexts.wallet.signals
22
(:require
33
[oops.core :as oops]
4+
[status-im.constants :as constants]
45
[taoensso.timbre :as log]
56
[utils.re-frame :as rf]
67
[utils.transforms :as transforms]))
@@ -10,10 +11,14 @@
1011
(fn [{:keys [db]} [{:keys [message]}]]
1112
(let [details (transforms/json->clj message)
1213
tx-hash (:hash details)
13-
status (case (:status details)
14-
"Success" :confirmed
15-
"Pending" :pending
16-
"Failed" :failed)
14+
tx-status (:status details)
15+
status (cond
16+
(= tx-status constants/transaction-status-success)
17+
:confirmed
18+
(= tx-status constants/transaction-status-pending)
19+
:pending
20+
(= tx-status constants/transaction-status-failed)
21+
:failed)
1722
swap-approval-transaction-id (get-in db [:wallet :ui :swap :approval-transaction-id])
1823
swap-approval-transaction? (= swap-approval-transaction-id tx-hash)]
1924
(cond-> {:db (update-in db [:wallet :transactions tx-hash] assoc :status status)}

0 commit comments

Comments
 (0)