Skip to content

Commit

Permalink
chore(wallet): move add-account funcitonality into its own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Son89 committed Apr 10, 2024
1 parent 63a168b commit 9fe5e21
Show file tree
Hide file tree
Showing 33 changed files with 91 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns status-im.contexts.wallet.add-address-to-watch.component-spec
(ns status-im.contexts.wallet.add-account.add-address-to-watch.component-spec
(:require
[status-im.contexts.wallet.add-address-to-watch.view :as add-address-to-watch]
[status-im.contexts.wallet.add-account.add-address-to-watch.view :as add-address-to-watch]
status-im.contexts.wallet.events
[test-helpers.component :as h]))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns status-im.contexts.wallet.add-address-to-watch.confirm-address.component-spec
(ns status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.component-spec
(:require
[status-im.contexts.wallet.add-address-to-watch.confirm-address.view :as confirm-address]
[status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.view :as confirm-address]
[test-helpers.component :as h]))

(h/describe "Add Watch Only Account Page"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.add-address-to-watch.confirm-address.style)
(ns status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.style)

(def container
{:flex 1})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(ns status-im.contexts.wallet.add-address-to-watch.confirm-address.view
(ns status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.foundations.colors :as colors]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.common.emoji-picker.utils :as emoji-picker.utils]
[status-im.contexts.wallet.add-address-to-watch.confirm-address.style :as style]
[status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.style :as style]
[status-im.contexts.wallet.common.screen-base.create-or-edit-account.view :as
create-or-edit-account]
[utils.i18n :as i18n]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.accounts.add-account.address-to-watch.events
(ns status-im.contexts.wallet.add-account.add-address-to-watch.events
(:require [clojure.string :as string]
[status-im.contexts.wallet.common.utils :as utils]
[taoensso.timbre :as log]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.add-address-to-watch.style)
(ns status-im.contexts.wallet.add-account.add-address-to-watch.style)

(def header-container {:padding-bottom 8})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.add-address-to-watch.view
(ns status-im.contexts.wallet.add-account.add-address-to-watch.view
(:require
[clojure.string :as string]
[quo.core :as quo]
Expand All @@ -7,7 +7,7 @@
[reagent.core :as reagent]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.constants :as constants]
[status-im.contexts.wallet.add-address-to-watch.style :as style]
[status-im.contexts.wallet.add-account.add-address-to-watch.style :as style]
[status-im.contexts.wallet.common.validation :as validation]
[status-im.subs.wallet.add-account.address-to-watch]
[utils.debounce :as debounce]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.edit-derivation-path.path-format-sheet.view
(ns status-im.contexts.wallet.add-account.create-account.edit-derivation-path.path-format-sheet.view
(:require
[quo.core :as quo]
[status-im.constants :as constants]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns status-im.contexts.wallet.create-account.edit-derivation-path.style
(ns status-im.contexts.wallet.add-account.create-account.edit-derivation-path.style
(:require [quo.foundations.colors :as colors]))


(defn screen
[top]
{:flex 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.edit-derivation-path.view
(ns status-im.contexts.wallet.add-account.create-account.edit-derivation-path.view
(:require
[clojure.string :as string]
[quo.core :as quo]
Expand All @@ -7,10 +7,10 @@
[react-native.core :as rn]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.create-account.edit-derivation-path.path-format-sheet.view :as
[status-im.contexts.wallet.add-account.create-account.edit-derivation-path.path-format-sheet.view :as
path-format-sheet]
[status-im.contexts.wallet.create-account.edit-derivation-path.style :as style]
[status-im.contexts.wallet.add-account.create-account.edit-derivation-path.style :as style]
[status-im.contexts.wallet.common.utils :as utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]
[utils.security.core :as security]))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.events
(ns status-im.contexts.wallet.add-account.create-account.events
(:require [camel-snake-kebab.extras :as cske]
[status-im.contexts.wallet.data-store :as data-store]
[utils.re-frame :as rf]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(ns status-im.contexts.wallet.create-account.events-test
(ns status-im.contexts.wallet.add-account.create-account.events-test
(:require
[cljs.test :refer-macros [deftest is]]
matcher-combinators.test
[status-im.contexts.wallet.create-account.events :as events]))
[status-im.contexts.wallet.add-account.create-account.events :as events]))

(deftest confirm-account-origin
(let [db {:wallet {:ui {:create-account {}}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.new-keypair.backup-recovery-phrase.style
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.backup-recovery-phrase.style
(:require
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.new-keypair.backup-recovery-phrase.view
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.backup-recovery-phrase.view
(:require
[clojure.string :as string]
[native-module.core :as native-module]
Expand All @@ -7,7 +7,8 @@
[react-native.blur :as blur]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.contexts.wallet.create-account.new-keypair.backup-recovery-phrase.style :as style]
[status-im.contexts.wallet.add-account.create-account.new-keypair.backup-recovery-phrase.style :as
style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.new-keypair.check-your-backup.style)
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.check-your-backup.style)

(def header-container
{:margin-horizontal 20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns status-im.contexts.wallet.create-account.new-keypair.check-your-backup.view
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.check-your-backup.view
(:require
[quo.core :as quo]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[reagent.core :as reagent]
[status-im.contexts.wallet.create-account.new-keypair.check-your-backup.style :as style]
[status-im.contexts.wallet.add-account.create-account.new-keypair.check-your-backup.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.new-keypair.keypair-name.style)
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.style)

(def header-container
{:margin-horizontal 20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns status-im.contexts.wallet.create-account.new-keypair.keypair-name.view
(ns status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.view
(:require
[quo.core :as quo]
[react-native.core :as rn]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.common.validation.general :as validators]
[status-im.contexts.wallet.create-account.new-keypair.keypair-name.style :as style]
[status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.style :as style]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.select-keypair.style)
(ns status-im.contexts.wallet.add-account.create-account.select-keypair.style)

(def header-container
{:margin-bottom 8})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns status-im.contexts.wallet.create-account.select-keypair.view
(ns status-im.contexts.wallet.add-account.create-account.select-keypair.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[react-native.core :as rn]
[status-im.constants :as constants]
[status-im.contexts.wallet.create-account.select-keypair.style :as style]
[status-im.contexts.wallet.add-account.create-account.select-keypair.style :as style]
[utils.address :as utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.style
(ns status-im.contexts.wallet.add-account.create-account.style
(:require
[quo.foundations.colors :as colors]))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.utils)
(ns status-im.contexts.wallet.add-account.create-account.utils)

(defn prepare-new-keypair
[{:keys [new-keypair address account-name account-color emoji derivation-path]}]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.create-account.view
(ns status-im.contexts.wallet.add-account.create-account.view
(:require
[clojure.string :as string]
[quo.core :as quo]
Expand All @@ -11,9 +11,9 @@
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.common.standard-authentication.core :as standard-auth]
[status-im.constants :as constants]
[status-im.contexts.wallet.add-account.create-account.style :as style]
[status-im.contexts.wallet.add-account.create-account.utils :as create-account.utils]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.create-account.style :as style]
[status-im.contexts.wallet.create-account.utils :as create-account.utils]
[status-im.contexts.wallet.sheets.account-origin.view :as account-origin]
[status-im.feature-flags :as ff]
[utils.i18n :as i18n]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.events.collectibles
(ns status-im.contexts.wallet.collectible.events
(:require [camel-snake-kebab.extras :as cske]
[taoensso.timbre :as log]
[utils.ethereum.chain :as chain]
Expand Down
22 changes: 22 additions & 0 deletions src/status_im/contexts/wallet/common/wizard/events.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(ns status-im.contexts.wallet.common.wizard.events
(:require [status-im.contexts.wallet.send.flow-config :as wallet-flow]
[utils.re-frame :as rf]))

(defn- wizard-find-next-screen
[db flow-id current-screen]
(let [flow-config (case flow-id
:wallet-flow wallet-flow/steps
nil)]
(first (filter (fn [{:keys [skip-step? screen-id]}]
(and (not= screen-id current-screen)
(not (and (fn? skip-step?) (skip-step? db)))))
flow-config))))

(rf/reg-event-fx
:wallet/wizard-navigate-forward
(fn [{:keys [db]} [{:keys [current-screen flow-id start-flow?]}]]
(let [next-screen (wizard-find-next-screen db flow-id current-screen)]
{:fx [[:dispatch
(if start-flow?
[:open-modal (:screen-id next-screen)]
[:navigate-to-within-stack [(:screen-id next-screen) current-screen]])]]})))
2 changes: 0 additions & 2 deletions src/status_im/contexts/wallet/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
[react-native.background-timer :as background-timer]
[react-native.platform :as platform]
[status-im.constants :as constants]
[status-im.contexts.wallet.accounts.add-account.address-to-watch.events]
[status-im.contexts.wallet.common.utils :as utils]
[status-im.contexts.wallet.data-store :as data-store]
[status-im.contexts.wallet.db :as db]
[status-im.contexts.wallet.events.collectibles]
[status-im.contexts.wallet.item-types :as item-types]
[taoensso.timbre :as log]
[utils.collection]
Expand Down
11 changes: 6 additions & 5 deletions src/status_im/contexts/wallet/events_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[cljs.test :refer-macros [deftest is testing]]
matcher-combinators.test
[status-im.constants :as constants]
[status-im.contexts.wallet.collectible.events :as collectible-events]
[status-im.contexts.wallet.db :as db]
[status-im.contexts.wallet.events :as events]
[status-im.contexts.wallet.events.collectibles :as collectibles]))
[status-im.contexts.wallet.events :as events]))

(def address "0x2f88d65f3cb52605a54a833ae118fb1363acccd2")

Expand Down Expand Up @@ -47,7 +47,7 @@
:accounts {"0x1" {:collectibles (list collectible-1 collectible-2)}
"0x2" {:collectibles (list collectible-3)}
"0x3" {}}}}
result-db (:db (collectibles/flush-collectibles {:db db}))]
result-db (:db (collectible-events/flush-collectibles {:db db}))]

(is (match? result-db expected-db)))))

Expand All @@ -60,7 +60,7 @@
(let [expected-db {:wallet {:accounts {"0x1" {}
"0x2" {"some other stuff" "with any value"}
"0x3" {}}}}
effects (collectibles/clear-stored-collectibles {:db db})
effects (collectible-events/clear-stored-collectibles {:db db})
result-db (:db effects)]

(is (match? result-db expected-db))))))
Expand All @@ -72,7 +72,8 @@
:image-url "https://..."}
expected-db {:wallet {:last-collectible-details {:description "Pandaria"
:image-url "https://..."}}}
effects (collectibles/store-last-collectible-details {:db db} [last-collectible])
effects (collectible-events/store-last-collectible-details {:db db}
[last-collectible])
result-db (:db effects)]
(is (match? result-db expected-db)))))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.events.saved-addresses
(ns status-im.contexts.wallet.save-address.events
(:require
[status-im.constants :as constants]
[utils.re-frame :as rf]))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(ns status-im.contexts.wallet.send.save-address.style)
(ns status-im.contexts.wallet.save-address.style)

(def title-input-container
{:padding-horizontal 20
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(ns status-im.contexts.wallet.send.save-address.view
(ns status-im.contexts.wallet.save-address.view
(:require
[clojure.string :as string]
[quo.core :as quo]
[quo.theme]
[react-native.core :as rn]
[status-im.common.floating-button-page.view :as floating-button-page]
[status-im.contexts.wallet.send.save-address.style :as style]
[status-im.contexts.wallet.save-address.style :as style]
[status-im.contexts.wallet.sheets.network-preferences.view
:as network-preferences]
[utils.i18n :as i18n]
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/core_spec.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
[status-im.contexts.chat.messenger.messages.content.audio.component-spec]
[status-im.contexts.communities.actions.community-options.component-spec]
[status-im.contexts.shell.share.wallet.component-spec]
[status-im.contexts.wallet.add-address-to-watch.component-spec]
[status-im.contexts.wallet.add-address-to-watch.confirm-address.component-spec]
[status-im.contexts.wallet.add-account.add-address-to-watch.component-spec]
[status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.component-spec]
[status-im.contexts.wallet.send.input-amount.component-spec]))
6 changes: 4 additions & 2 deletions src/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
status-im.contexts.shell.qr-reader.events
status-im.contexts.shell.share.events
status-im.contexts.syncing.events
status-im.contexts.wallet.common.wizard
status-im.contexts.wallet.create-account.events
status-im.contexts.wallet.add-account.add-address-to-watch.events
status-im.contexts.wallet.add-account.create-account.events
status-im.contexts.wallet.collectible.events
status-im.contexts.wallet.common.wizard.events
status-im.contexts.wallet.effects
status-im.contexts.wallet.events
status-im.contexts.wallet.send.events
Expand Down
24 changes: 13 additions & 11 deletions src/status_im/navigation/screens.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,26 @@
[status-im.contexts.wallet.account.edit-account.view :as wallet-edit-account]
[status-im.contexts.wallet.account.share-address.view :as wallet-share-address]
[status-im.contexts.wallet.account.view :as wallet-accounts]
[status-im.contexts.wallet.add-address-to-watch.confirm-address.view :as
[status-im.contexts.wallet.add-account.add-address-to-watch.confirm-address.view :as
wallet-confirm-address-to-watch]
[status-im.contexts.wallet.add-address-to-watch.view :as wallet-add-address-to-watch]
[status-im.contexts.wallet.add-account.add-address-to-watch.view :as wallet-add-address-to-watch]
[status-im.contexts.wallet.add-account.create-account.edit-derivation-path.view :as
wallet-edit-derivation-path]
[status-im.contexts.wallet.add-account.create-account.new-keypair.backup-recovery-phrase.view :as
wallet-backup-recovery-phrase]
[status-im.contexts.wallet.add-account.create-account.new-keypair.check-your-backup.view :as
wallet-check-your-backup]
[status-im.contexts.wallet.add-account.create-account.new-keypair.keypair-name.view :as
wallet-keypair-name]
[status-im.contexts.wallet.add-account.create-account.select-keypair.view :as wallet-select-keypair]
[status-im.contexts.wallet.add-account.create-account.view :as wallet-create-account]
[status-im.contexts.wallet.bridge.bridge-to.view :as wallet-bridge-to]
[status-im.contexts.wallet.bridge.input-amount.view :as wallet-bridge-input-amount]
[status-im.contexts.wallet.bridge.select-asset.view :as wallet-bridge-select-asset]
[status-im.contexts.wallet.collectible.view :as wallet-collectible]
[status-im.contexts.wallet.common.scan-account.view :as wallet-scan-address]
[status-im.contexts.wallet.create-account.edit-derivation-path.view :as wallet-edit-derivation-path]
[status-im.contexts.wallet.create-account.new-keypair.backup-recovery-phrase.view :as
wallet-backup-recovery-phrase]
[status-im.contexts.wallet.create-account.new-keypair.check-your-backup.view :as
wallet-check-your-backup]
[status-im.contexts.wallet.create-account.new-keypair.keypair-name.view :as wallet-keypair-name]
[status-im.contexts.wallet.create-account.select-keypair.view :as wallet-select-keypair]
[status-im.contexts.wallet.create-account.view :as wallet-create-account]
[status-im.contexts.wallet.save-address.view :as wallet-save-address]
[status-im.contexts.wallet.send.from.view :as wallet-select-from]
[status-im.contexts.wallet.send.save-address.view :as wallet-save-address]
[status-im.contexts.wallet.send.select-address.view :as wallet-select-address]
[status-im.contexts.wallet.send.select-asset.view :as wallet-select-asset]
[status-im.contexts.wallet.send.select-collectible-amount.view :as wallet-select-collectible-amount]
Expand Down

0 comments on commit 9fe5e21

Please sign in to comment.