Skip to content

Commit

Permalink
chore: remove legacy wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 committed Feb 7, 2024
1 parent 07feff6 commit 7de6f8e
Show file tree
Hide file tree
Showing 68 changed files with 27 additions and 7,781 deletions.
4 changes: 1 addition & 3 deletions src/legacy/status_im/currency/core.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(ns legacy.status-im.currency.core
(:require
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[legacy.status-im.wallet.prices :as prices]
[utils.re-frame :as rf]))

(defn get-currency
Expand All @@ -16,5 +15,4 @@
:currency
currency
;; on changing currency, we should fetch tokens prices again
{:on-success #(rf/dispatch [:wallet/get-wallet-token])})
(prices/update-prices)))
{:on-success #(rf/dispatch [:wallet/get-wallet-token])})))
3 changes: 1 addition & 2 deletions src/legacy/status_im/ens/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[legacy.status-im.ethereum.ens :as ens]
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[legacy.status-im.utils.random :as random]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[status-im.constants :as constants]
[status-im.navigation.events :as navigation]
Expand Down Expand Up @@ -126,7 +125,7 @@
{:events [::set-pub-key]}
[{:keys [db]}]
(let [{:keys [username address custom-domain?]} (:ens/registration db)
address (or address (wallet.utils/default-address db))
address address
{:keys [public-key]} (:profile/profile db)
chain-id (chain/chain-id db)
username (fullname custom-domain? username)]
Expand Down
17 changes: 2 additions & 15 deletions src/legacy/status_im/ethereum/transactions/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[legacy.status-im.ethereum.decode :as decode]
[legacy.status-im.ethereum.encode :as encode]
[legacy.status-im.utils.mobile-sync :as utils.mobile-sync]
[legacy.status-im.wallet.core :as wallet]
[re-frame.core :as re-frame]
[status-im.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log]
Expand Down Expand Up @@ -256,24 +255,13 @@
(let [checksum (eip55/address->checksum address)
max-known-block (get-max-block-with-transfers db address)
effects (cond-> [(when (seq transfers)
(set-lowest-fetched-block checksum transfers))
(wallet/set-max-block-with-transfers checksum transfers)]
(set-lowest-fetched-block checksum transfers))]

(seq transfers)
(concat
[]
(mapv add-transfer transfers))

(and max-known-block
(some #(> (:block %) max-known-block) transfers))
(conj (wallet/update-balances
[address]
(zero? max-known-block)))

(and (zero? max-known-block)
(empty? transfers))
(conj (wallet/set-zero-balances {:address address}))

(< (count transfers) limit)
(conj (tx-history-end-reached checksum)))]
(apply rf/merge cofx (tx-fetching-ended [checksum]) effects)))
Expand All @@ -282,8 +270,7 @@
{:events [::new-transfers]}
[cofx transfers params]
(rf/merge cofx
(handle-new-transfer transfers params)
(wallet/stop-fetching-on-empty-tx-history transfers)))
(handle-new-transfer transfers params)))

(rf/defn tx-fetching-failed
{:events [::tx-fetching-failed]}
Expand Down
7 changes: 0 additions & 7 deletions src/legacy/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
legacy.status-im.visibility-status-popover.core
legacy.status-im.visibility-status-updates.core
legacy.status-im.waku.core
legacy.status-im.wallet.accounts.core
legacy.status-im.wallet.choose-recipient.core
[legacy.status-im.wallet.core :as wallet]
legacy.status-im.wallet.custom-tokens.core
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[react-native.core :as rn]
Expand Down Expand Up @@ -141,7 +137,6 @@
(rf/merge cofx
{:db (dissoc db :app-in-background-since)}
(mailserver/process-next-messages-request)
(wallet/restart-wallet-service-after-background app-in-background-since)
(when-not new-account?
(universal-links/process-stored-event))
#(when-let [chat-id (:current-chat-id db)]
Expand Down Expand Up @@ -198,10 +193,8 @@
:reset-card (keycard/reset-card-screen-did-load %)
:enter-pin-settings (keycard/enter-pin-screen-did-load %)
:keycard-login-pin (keycard/login-pin-screen-did-load %)
:add-new-account-pin (keycard/enter-pin-screen-did-load %)
:keycard-authentication-method (keycard/authentication-method-screen-did-load %)
:multiaccounts (keycard/multiaccounts-screen-did-load %)
:wallet-legacy (wallet/wallet-will-focus %)
nil)))

;;TODO :replace by named events
Expand Down
11 changes: 4 additions & 7 deletions src/legacy/status_im/keycard/card.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,12 @@
(merge
args
{:on-success
(fn [response]
(fn [_response]
(log/debug "[keycard response succ] export-key")
(re-frame/dispatch [:keycard.callback/on-export-key-success
response]))
(js/alert "feature no longer supported"))
:on-failure
(fn [response]
(log/debug "[keycard response fail] export-key")
(re-frame/dispatch [:keycard.callback/on-export-key-error
(error-object->map response)]))})))
(fn [_response]
(log/debug "[keycard response fail] export-key"))})))

(defn unpair-and-delete
[args]
Expand Down
5 changes: 0 additions & 5 deletions src/legacy/status_im/keycard/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
[legacy.status-im.keycard.recovery :as recovery]
[legacy.status-im.keycard.sign :as sign]
legacy.status-im.keycard.unpair
[legacy.status-im.keycard.wallet :as wallet]
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[re-frame.db]
[status-im.navigation.events :as navigation]
Expand Down Expand Up @@ -401,10 +400,6 @@
(= pin-code-length numbers-entered))
(common/verify-pin {:pin-step :current})

(and (= enter-step :export-key)
(= pin-code-length numbers-entered))
(wallet/verify-pin-with-delay)

(and (= enter-step :sign)
(= pin-code-length numbers-entered))
(sign/prepare-to-sign)
Expand Down
38 changes: 0 additions & 38 deletions src/legacy/status_im/keycard/export_key.cljs
Original file line number Diff line number Diff line change
@@ -1,51 +1,13 @@
(ns legacy.status-im.keycard.export-key
(:require
[legacy.status-im.keycard.common :as common]
[legacy.status-im.keycard.wallet :as wallet]
[taoensso.timbre :as log]
[utils.re-frame :as rf]))

(rf/defn on-export-key-error
{:events [:keycard.callback/on-export-key-error]}
[{:keys [db] :as cofx} error]
(log/debug "[keycard] export key error" error)
(let [tag-was-lost? (common/tag-lost? (:error error))
pin-retries (common/pin-retries (:error error))]
(cond
tag-was-lost?
(rf/merge cofx
{:db (assoc-in db [:keycard :pin :status] nil)}
(common/set-on-card-connected :wallet-legacy.accounts/generate-new-keycard-account))

(not (nil? pin-retries))
(rf/merge cofx
{:db (-> db
(assoc-in [:keycard :application-info :pin-retry-counter] pin-retries)
(update-in [:keycard :pin]
assoc
:status :error
:enter-step :export-key
:puk []
:current []
:original []
:confirmation []
:sign []
:export-key []
:error-label :t/pin-mismatch))}
(common/hide-connection-sheet)
(when (zero? pin-retries) (common/frozen-keycard-popup)))
:else
(rf/merge cofx
(common/show-wrong-keycard-alert)
(common/clear-pin)
(common/hide-connection-sheet)))))

(rf/defn on-export-key-success
{:events [:keycard.callback/on-export-key-success]}
[{:keys [db] :as cofx} pubkey]
(let [callback-fn (get-in db [:keycard :on-export-success])]
(rf/merge cofx
{:dispatch (callback-fn pubkey)}
(wallet/hide-pin-sheet)
(common/clear-pin)
(common/hide-connection-sheet))))
4 changes: 1 addition & 3 deletions src/legacy/status_im/keycard/sign.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[clojure.string :as string]
[legacy.status-im.keycard.common :as common]
[legacy.status-im.utils.deprecated-types :as types]
[legacy.status-im.wallet.utils :as wallet.utils]
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
[utils.address :as address]
Expand All @@ -24,8 +23,7 @@
typed? (get-in db [:keycard :typed?])
pin (common/vector->string (get-in db [:keycard :pin :sign]))
from (or (get-in db [:signing/tx :from :address])
(get-in db [:signing/tx :message :from])
(wallet.utils/default-address db))
(get-in db [:signing/tx :message :from]))
path (reduce
(fn [_ {:keys [address path]}]
(when (address/address= from address)
Expand Down
76 changes: 0 additions & 76 deletions src/legacy/status_im/keycard/wallet.cljs

This file was deleted.

5 changes: 1 addition & 4 deletions src/legacy/status_im/mobile_sync_settings/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[legacy.status-im.multiaccounts.model :as multiaccounts.model]
[legacy.status-im.multiaccounts.update.core :as multiaccounts.update]
[legacy.status-im.utils.mobile-sync :as utils]
[legacy.status-im.wallet.core :as wallet]
[status-im.contexts.chat.home.add-new-contact.events :as add-new-contact]
[status-im.navigation.events :as navigation]
[taoensso.timbre :as log]
Expand Down Expand Up @@ -35,7 +34,6 @@
(and logged-in? initialized?)
[(mailserver/process-next-messages-request)
(bottom-sheet/hide-bottom-sheet-old)
(wallet/restart-wallet-service nil)
(add-new-contact/set-new-identity-reconnected)]

logged-in?
Expand Down Expand Up @@ -67,8 +65,7 @@
(boolean remember-choice?)
{})
(when (and cellular? sync?)
(mailserver/process-next-messages-request))
(wallet/restart-wallet-service nil))))))
(mailserver/process-next-messages-request)))))))

(rf/defn mobile-network-continue-syncing
{:events [:mobile-network/continue-syncing]}
Expand Down
2 changes: 0 additions & 2 deletions src/legacy/status_im/multiaccounts/logout/core.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns legacy.status-im.multiaccounts.logout.core
(:require
[legacy.status-im.wallet.core :as wallet]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[status-im.common.keychain.events :as keychain]
Expand Down Expand Up @@ -40,7 +39,6 @@
:profile/get-profiles-overview #(rf/dispatch
[:profile/get-profiles-overview-success %])}
(keychain/save-auth-method key-uid auth-method)
(wallet/clear-timeouts)
(initialize-app-db))))

(rf/defn logout
Expand Down
5 changes: 1 addition & 4 deletions src/legacy/status_im/network/net_info.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
["@react-native-community/netinfo" :default net-info]
[legacy.status-im.mobile-sync-settings.core :as mobile-network]
[legacy.status-im.wallet.core :as wallet]
[native-module.core :as native-module]
[re-frame.core :as re-frame]
[taoensso.timbre :as log]
Expand All @@ -14,9 +13,7 @@
{:db (assoc db :network-status (if is-connected? :online :offline))}
(when (and is-connected?
(or (not= (count (get-in db [:wallet-legacy :accounts]))
(count (get db :profile/wallet-accounts)))
(wallet/has-empty-balances? db)))
(wallet/update-balances nil nil))))
(count (get db :profile/wallet-accounts))))))))

(rf/defn change-network-type
[{:keys [db] :as cofx} old-network-type network-type expensive?]
Expand Down
Loading

0 comments on commit 7de6f8e

Please sign in to comment.