From e4ff4d26cfc492af175956dd375a3532943d4f38 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Fri, 22 Dec 2023 12:17:48 +0400 Subject: [PATCH 01/14] wallet: loading routes --- .../components/utilities/token/loader.cljs | 4 ++ .../wallet/send/input_amount/view.cljs | 43 ++++++------------- .../contexts/wallet/send/routes/view.cljs | 25 ++++++++++- .../wallet/send/select_address/style.cljs | 2 +- src/status_im/navigation/screens.cljs | 3 +- 5 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/quo/components/utilities/token/loader.cljs b/src/quo/components/utilities/token/loader.cljs index ebdd83bd57c..8bd2ec85ec5 100644 --- a/src/quo/components/utilities/token/loader.cljs +++ b/src/quo/components/utilities/token/loader.cljs @@ -9,7 +9,11 @@ [token] (let [token-symbol (cond-> token (keyword? token) name +<<<<<<< HEAD :always safe-lower-case)] +======= + :always string/lower-case)] +>>>>>>> dca438344 (wallet: loading routes) (get tokens token-symbol))) (def get-token-image (memoize get-token-image*)) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 5507959cf31..b2146e65d7b 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -7,7 +7,6 @@ [react-native.safe-area :as safe-area] [reagent.core :as reagent] [status-im.contexts.wallet.common.account-switcher.view :as account-switcher] - [status-im.contexts.wallet.common.utils :as utils] [status-im.contexts.wallet.send.input-amount.style :as style] [status-im.contexts.wallet.send.routes.view :as routes] [utils.debounce :as debounce] @@ -58,7 +57,6 @@ [{:keys [rate limit]}] (let [bottom (safe-area/get-bottom) {:keys [currency]} (rf/sub [:profile/profile]) - networks (rf/sub [:wallet/network-details]) token (rf/sub [:wallet/wallet-send-token]) loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) token-symbol (:symbol token) @@ -101,18 +99,16 @@ :or {on-confirm #(rf/dispatch [:wallet/send-select-amount {:amount @input-value :stack-id :wallet-send-input-amount}])}}] - (let [limit-label (make-limit-label @current-limit) - input-num-value (parse-double @input-value) - route (rf/sub [:wallet/wallet-send-route]) - loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) - confirm-disabled? (or - (nil? route) - (empty? @input-value) - (<= input-num-value 0) - (> input-num-value (:amount @current-limit))) - from-network (utils/id->network (get-in route [:From :chainId])) - to-network (utils/id->network (get-in route [:To :chainId])) - amount (str @input-value " " token-symbol)] + (let [limit-label (make-limit-label @current-limit) + input-num-value (parse-double @input-value) + token (rf/sub [:wallet/wallet-send-token]) + route (rf/sub [:wallet/wallet-send-route]) + confirm-disabled? (or + (nil? route) + (empty? @input-value) + (<= input-num-value 0) + (> input-num-value (:amount @current-limit))) + amount (str @input-value " " token-symbol)] (rn/use-effect (fn [] (let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!)) @@ -137,7 +133,7 @@ {:container-style style/input-container :token token-symbol :currency currency - :networks networks + :networks (:networks token) :title (i18n/label :t/send-limit {:limit limit-label}) :conversion conversion-rate :show-keyboard? false @@ -145,20 +141,9 @@ :on-swap handle-swap :on-change-text (fn [text] (handle-on-change text))}] - ;; Network routing content to be added - [rn/scroll-view - {:content-container-style {:flex-grow 1 - :align-items :center - :justify-content :center}} - (cond loading-suggested-routes? - [quo/text "Loading routes"] - (and (not loading-suggested-routes?) route) - [routes/view - {:amount amount - :from-network from-network - :to-network to-network}] - (and (not loading-suggested-routes?) (nil? route)) - [quo/text "Route not found"])] + [routes/view + {:amount amount + :route route}] [quo/bottom-actions {:actions :1-action :button-one-label (i18n/label :t/confirm) diff --git a/src/status_im/contexts/wallet/send/routes/view.cljs b/src/status_im/contexts/wallet/send/routes/view.cljs index b4087e99887..14af7b93ed6 100644 --- a/src/status_im/contexts/wallet/send/routes/view.cljs +++ b/src/status_im/contexts/wallet/send/routes/view.cljs @@ -2,10 +2,12 @@ (:require [quo.core :as quo] [react-native.core :as rn] + [status-im.contexts.wallet.common.utils :as utils] [status-im.contexts.wallet.send.routes.style :as style] - [utils.i18n :as i18n])) + [utils.i18n :as i18n] + [utils.re-frame :as rf])) -(defn view +(defn loaded-routes [{:keys [amount from-network to-network]}] [rn/view {:style style/routes-container} [rn/view {:style style/routes-header-container} @@ -30,3 +32,22 @@ :network to-network :status :default :container-style {:right 12}}]]]) + +(defn view + [{:keys [amount route]}] + (let [loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) + from-network (utils/id->network (get-in route [:From :chainId])) + to-network (utils/id->network (get-in route [:To :chainId]))] + [rn/scroll-view + {:content-container-style {:flex-grow 1 + :align-items :center + :justify-content :center}} + (cond loading-suggested-routes? + [quo/text "Loading routes"] + (and (not loading-suggested-routes?) route) + [loaded-routes + {:amount amount + :from-network from-network + :to-network to-network}] + (and (not loading-suggested-routes?) (nil? route)) + [quo/text "Route not found"])])) diff --git a/src/status_im/contexts/wallet/send/select_address/style.cljs b/src/status_im/contexts/wallet/send/select_address/style.cljs index b081b5e8fc9..f462bcc9ea0 100644 --- a/src/status_im/contexts/wallet/send/select_address/style.cljs +++ b/src/status_im/contexts/wallet/send/select_address/style.cljs @@ -17,5 +17,5 @@ (def button {:justify-self :flex-end - :margin-bottom 46 + :margin-bottom 20 :margin-horizontal 20}) diff --git a/src/status_im/navigation/screens.cljs b/src/status_im/navigation/screens.cljs index 0f4d12e0fd5..3d942de1381 100644 --- a/src/status_im/navigation/screens.cljs +++ b/src/status_im/navigation/screens.cljs @@ -339,7 +339,8 @@ {:name :wallet-send-input-amount :options {:modalPresentationStyle :overCurrentContext - :insets {:top? true}} + :insets {:top? true + :bottom? true}} :component wallet-send-input-amount/view} {:name :wallet-select-address From bf9c159826864d2d552db29a583a041c90c643e6 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Mon, 25 Dec 2023 16:24:07 +0400 Subject: [PATCH 02/14] feat: loading routes ui --- .../wallet/send/input_amount/view.cljs | 6 ++-- .../contexts/wallet/send/routes/view.cljs | 30 ++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index b2146e65d7b..1f8881852ed 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -142,8 +142,10 @@ :on-change-text (fn [text] (handle-on-change text))}] [routes/view - {:amount amount - :route route}] + {:amount amount + :route route + :input-value @input-value + :networks (:networks token)}] [quo/bottom-actions {:actions :1-action :button-one-label (i18n/label :t/confirm) diff --git a/src/status_im/contexts/wallet/send/routes/view.cljs b/src/status_im/contexts/wallet/send/routes/view.cljs index 14af7b93ed6..98d0035a5b7 100644 --- a/src/status_im/contexts/wallet/send/routes/view.cljs +++ b/src/status_im/contexts/wallet/send/routes/view.cljs @@ -7,8 +7,8 @@ [utils.i18n :as i18n] [utils.re-frame :as rf])) -(defn loaded-routes - [{:keys [amount from-network to-network]}] +(defn routes + [{:keys [amount from-network to-network status]}] [rn/view {:style style/routes-container} [rn/view {:style style/routes-header-container} [quo/section-label @@ -21,7 +21,7 @@ [quo/network-bridge {:amount amount :network from-network - :status :default}] + :status status}] [quo/network-link {:shape :linear :source from-network @@ -30,11 +30,11 @@ [quo/network-bridge {:amount amount :network to-network - :status :default + :status status :container-style {:right 12}}]]]) (defn view - [{:keys [amount route]}] + [{:keys [amount route networks input-value]}] (let [loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) from-network (utils/id->network (get-in route [:From :chainId])) to-network (utils/id->network (get-in route [:To :chainId]))] @@ -42,12 +42,14 @@ {:content-container-style {:flex-grow 1 :align-items :center :justify-content :center}} - (cond loading-suggested-routes? - [quo/text "Loading routes"] - (and (not loading-suggested-routes?) route) - [loaded-routes - {:amount amount - :from-network from-network - :to-network to-network}] - (and (not loading-suggested-routes?) (nil? route)) - [quo/text "Route not found"])])) + (when (not (empty? input-value)) + (if (and (not loading-suggested-routes?) route) + [routes + {:amount amount + :status :default + :from-network from-network + :to-network to-network}] + [routes + {:status :loading + :from-network (:network-name (nth (seq networks) 1)) + :to-network (:network-name (nth (seq networks) 1))}]))])) From 6ffb5d8857973b44781038f0ad21a3986b9edac3 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Thu, 4 Jan 2024 11:44:53 +0400 Subject: [PATCH 03/14] lint --- src/quo/components/utilities/token/loader.cljs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/quo/components/utilities/token/loader.cljs b/src/quo/components/utilities/token/loader.cljs index 8bd2ec85ec5..ebdd83bd57c 100644 --- a/src/quo/components/utilities/token/loader.cljs +++ b/src/quo/components/utilities/token/loader.cljs @@ -9,11 +9,7 @@ [token] (let [token-symbol (cond-> token (keyword? token) name -<<<<<<< HEAD :always safe-lower-case)] -======= - :always string/lower-case)] ->>>>>>> dca438344 (wallet: loading routes) (get tokens token-symbol))) (def get-token-image (memoize get-token-image*)) From 6427ff590b7352e323b8be88094bd0ca75d91a07 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Thu, 4 Jan 2024 12:55:43 +0400 Subject: [PATCH 04/14] wallet: suggested routes list --- .../wallet/send/input_amount/view.cljs | 8 +- .../contexts/wallet/send/routes/style.cljs | 6 ++ .../contexts/wallet/send/routes/view.cljs | 82 +++++++++---------- src/status_im/subs/wallet/wallet.cljs | 5 ++ translations/en.json | 4 + 5 files changed, 59 insertions(+), 46 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 1f8881852ed..721383b07bb 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -103,6 +103,7 @@ input-num-value (parse-double @input-value) token (rf/sub [:wallet/wallet-send-token]) route (rf/sub [:wallet/wallet-send-route]) + wallet-send (rf/sub [:wallet/wallet-send]) confirm-disabled? (or (nil? route) (empty? @input-value) @@ -142,10 +143,9 @@ :on-change-text (fn [text] (handle-on-change text))}] [routes/view - {:amount amount - :route route - :input-value @input-value - :networks (:networks token)}] + {:amount amount + :routes (:suggested-routes wallet-send) + :networks (:networks token)}] [quo/bottom-actions {:actions :1-action :button-one-label (i18n/label :t/confirm) diff --git a/src/status_im/contexts/wallet/send/routes/style.cljs b/src/status_im/contexts/wallet/send/routes/style.cljs index e4b73009881..ce3d604ced7 100644 --- a/src/status_im/contexts/wallet/send/routes/style.cljs +++ b/src/status_im/contexts/wallet/send/routes/style.cljs @@ -2,6 +2,7 @@ (def routes-container {:padding-horizontal 20 + :flex 1 :padding-vertical 16 :width "100%" :height "100%"}) @@ -24,3 +25,8 @@ (def network-link {:right 6 :z-index 1}) + +(def empty-container + {:flex-grow 1 + :align-items :center + :justify-content :center}) diff --git a/src/status_im/contexts/wallet/send/routes/view.cljs b/src/status_im/contexts/wallet/send/routes/view.cljs index 98d0035a5b7..83888fc54ee 100644 --- a/src/status_im/contexts/wallet/send/routes/view.cljs +++ b/src/status_im/contexts/wallet/send/routes/view.cljs @@ -7,49 +7,47 @@ [utils.i18n :as i18n] [utils.re-frame :as rf])) -(defn routes +(defn route-item [{:keys [amount from-network to-network status]}] - [rn/view {:style style/routes-container} - [rn/view {:style style/routes-header-container} - [quo/section-label - {:section (i18n/label :t/from-label) - :container-style (style/section-label 0)}] - [quo/section-label - {:section (i18n/label :t/to-label) - :container-style (style/section-label 64)}]] - [rn/view {:style style/routes-inner-container} - [quo/network-bridge - {:amount amount - :network from-network - :status status}] - [quo/network-link - {:shape :linear - :source from-network - :destination to-network - :container-style style/network-link}] - [quo/network-bridge - {:amount amount - :network to-network - :status status - :container-style {:right 12}}]]]) + [rn/view {:style style/routes-inner-container} + [quo/network-bridge + {:amount amount + :network from-network + :status status}] + [quo/network-link + {:shape :linear + :source from-network + :destination to-network + :container-style style/network-link}] + [quo/network-bridge + {:amount amount + :network to-network + :status status + :container-style {:right 12}}]]) (defn view - [{:keys [amount route networks input-value]}] + [{:keys [amount routes]}] (let [loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) - from-network (utils/id->network (get-in route [:From :chainId])) - to-network (utils/id->network (get-in route [:To :chainId]))] - [rn/scroll-view - {:content-container-style {:flex-grow 1 - :align-items :center - :justify-content :center}} - (when (not (empty? input-value)) - (if (and (not loading-suggested-routes?) route) - [routes - {:amount amount - :status :default - :from-network from-network - :to-network to-network}] - [routes - {:status :loading - :from-network (:network-name (nth (seq networks) 1)) - :to-network (:network-name (nth (seq networks) 1))}]))])) + candidates (:Candidates routes)] + (if (and (not loading-suggested-routes?) (not-empty candidates)) + [rn/flat-list + {:data candidates + :content-container-style style/routes-container + :header [rn/view {:style style/routes-header-container} + [quo/section-label + {:section (i18n/label :t/from-label) + :container-style (style/section-label 0)}] + [quo/section-label + {:section (i18n/label :t/to-label) + :container-style (style/section-label 64)}]] + :render-fn (fn [route] + [route-item + {:amount amount + :status :default + :from-network (utils/id->network (get-in route [:From :chainId])) + :to-network (utils/id->network (get-in route [:To :chainId]))}])}] + [rn/view {:style style/empty-container} + (if loading-suggested-routes? + [rn/activity-indicator] + (when (not (nil? candidates)) + [quo/text (i18n/label :t/no-routes-found)]))]))) diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index 73de9be9206..f22e40c5dbe 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -48,6 +48,11 @@ :<- [:wallet/wallet-send] :-> :route) +(rf/reg-sub + :wallet/wallet-suggested-routes + :<- [:wallet/wallet-send] + :-> :suggested-routes) + (rf/reg-sub :wallet/wallet-send-token :<- [:wallet/wallet-send] diff --git a/translations/en.json b/translations/en.json index 2743018a7f4..f27ebd722a8 100644 --- a/translations/en.json +++ b/translations/en.json @@ -2456,6 +2456,10 @@ "from-label": "From", "to-label": "To", "oops-wrong-word": "Oops! Wrong word", +<<<<<<< HEAD "time-in-mins": "{{minutes}} min", "amount-with-currency-symbol": "{{symbol}} {{amount}}" +======= + "no-routes-found": "No routes found" +>>>>>>> 2ea1e4b1d (wallet: suggested routes list) } From 1d8c1cf42306514c2ceed5b8e1a984a6b227ec1d Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Thu, 4 Jan 2024 12:58:20 +0400 Subject: [PATCH 05/14] updates --- src/status_im/subs/wallet/wallet.cljs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index f22e40c5dbe..73de9be9206 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -48,11 +48,6 @@ :<- [:wallet/wallet-send] :-> :route) -(rf/reg-sub - :wallet/wallet-suggested-routes - :<- [:wallet/wallet-send] - :-> :suggested-routes) - (rf/reg-sub :wallet/wallet-send-token :<- [:wallet/wallet-send] From 2326cfd28c346d6a6e1e580eeabcf9cbeeb74869 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Fri, 5 Jan 2024 16:17:41 +0400 Subject: [PATCH 06/14] review --- .../wallet/common/account_switcher/view.cljs | 3 +- .../wallet/send/select_address/view.cljs | 36 +++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/status_im/contexts/wallet/common/account_switcher/view.cljs b/src/status_im/contexts/wallet/common/account_switcher/view.cljs index a5fb849bb10..da90d8a0fad 100644 --- a/src/status_im/contexts/wallet/common/account_switcher/view.cljs +++ b/src/status_im/contexts/wallet/common/account_switcher/view.cljs @@ -13,7 +13,7 @@ nil)) (defn view - [{:keys [on-press accessibility-label icon-name switcher-type] + [{:keys [on-press accessibility-label icon-name switcher-type margin-top] :or {icon-name :i/close accessibility-label :top-bar switcher-type :account-options}}] @@ -21,6 +21,7 @@ networks (rf/sub [:wallet/network-details])] [quo/page-nav {:icon-name icon-name + :margin-top margin-top :background :blur :on-press on-press :accessibility-label accessibility-label diff --git a/src/status_im/contexts/wallet/send/select_address/view.cljs b/src/status_im/contexts/wallet/send/select_address/view.cljs index 1b9605b075e..e49abdc5f7d 100644 --- a/src/status_im/contexts/wallet/send/select_address/view.cljs +++ b/src/status_im/contexts/wallet/send/select_address/view.cljs @@ -3,7 +3,9 @@ [quo.core :as quo] [quo.foundations.colors :as colors] [react-native.core :as rn] + [react-native.safe-area :as safe-area] [reagent.core :as reagent] + [status-im.common.floating-button-page.view :as floating-button-page] [status-im.constants :as constants] [status-im.contexts.wallet.common.account-switcher.view :as account-switcher] [status-im.contexts.wallet.item-types :as types] @@ -127,13 +129,20 @@ (fn [] (rf/dispatch [:wallet/clean-scanned-address]) (rf/dispatch [:wallet/clean-local-suggestions])))) - [rn/scroll-view - {:content-container-style style/container - :keyboard-should-persist-taps :handled - :scroll-enabled false} - [account-switcher/view - {:on-press on-close - :switcher-type :select-account}] + [floating-button-page/view + {:header [account-switcher/view + {:on-press on-close + :margin-top (safe-area/get-top) + :switcher-type :select-account}] + :footer (when (> (count @input-value) 0) + [quo/button + {:accessibility-label :continue-button + :type :primary + :disabled? (not valid-ens-or-address?) + :on-press #(rf/dispatch [:wallet/select-send-address + {:address @input-value + :stack-id :wallet-select-address}])} + (i18n/label :t/continue)])} [quo/text-combinations {:title (i18n/label :t/send-to) :container-style style/title-container @@ -147,17 +156,7 @@ [rn/view {:style {:flex 1 :padding 8}} - [local-suggestions-list]] - (when (> (count @input-value) 0) - [quo/button - {:accessibility-label :continue-button - :type :primary - :disabled? (not valid-ens-or-address?) - :container-style style/button - :on-press #(rf/dispatch [:wallet/select-send-address - {:address @input-value - :stack-id :wallet-select-address}])} - (i18n/label :t/continue)])] + [local-suggestions-list]]] [:<> [quo/tabs {:style style/tabs @@ -173,4 +172,3 @@ (defn view [] [:f> f-view]) - From ae70c72d8dc6f28208327932798fb1686156f17f Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 07:52:47 +0400 Subject: [PATCH 07/14] review --- src/status_im/contexts/wallet/send/routes/view.cljs | 6 +++--- translations/en.json | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/status_im/contexts/wallet/send/routes/view.cljs b/src/status_im/contexts/wallet/send/routes/view.cljs index 83888fc54ee..64466781cf8 100644 --- a/src/status_im/contexts/wallet/send/routes/view.cljs +++ b/src/status_im/contexts/wallet/send/routes/view.cljs @@ -28,7 +28,7 @@ (defn view [{:keys [amount routes]}] (let [loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) - candidates (:Candidates routes)] + candidates (:candidates routes)] (if (and (not loading-suggested-routes?) (not-empty candidates)) [rn/flat-list {:data candidates @@ -44,8 +44,8 @@ [route-item {:amount amount :status :default - :from-network (utils/id->network (get-in route [:From :chainId])) - :to-network (utils/id->network (get-in route [:To :chainId]))}])}] + :from-network (utils/id->network (get-in route [:from :chain-id])) + :to-network (utils/id->network (get-in route [:to :chain-id]))}])}] [rn/view {:style style/empty-container} (if loading-suggested-routes? [rn/activity-indicator] diff --git a/translations/en.json b/translations/en.json index f27ebd722a8..740f6801f7c 100644 --- a/translations/en.json +++ b/translations/en.json @@ -2456,10 +2456,7 @@ "from-label": "From", "to-label": "To", "oops-wrong-word": "Oops! Wrong word", -<<<<<<< HEAD "time-in-mins": "{{minutes}} min", - "amount-with-currency-symbol": "{{symbol}} {{amount}}" -======= + "amount-with-currency-symbol": "{{symbol}} {{amount}}", "no-routes-found": "No routes found" ->>>>>>> 2ea1e4b1d (wallet: suggested routes list) } From 8146ab7b0db9bc0464e258816a073ec52071e08f Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 11:42:06 +0400 Subject: [PATCH 08/14] lint --- src/status_im/contexts/wallet/send/routes/view.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/status_im/contexts/wallet/send/routes/view.cljs b/src/status_im/contexts/wallet/send/routes/view.cljs index 64466781cf8..5ee5994126f 100644 --- a/src/status_im/contexts/wallet/send/routes/view.cljs +++ b/src/status_im/contexts/wallet/send/routes/view.cljs @@ -45,7 +45,8 @@ {:amount amount :status :default :from-network (utils/id->network (get-in route [:from :chain-id])) - :to-network (utils/id->network (get-in route [:to :chain-id]))}])}] + :to-network (utils/id->network (get-in route + [:to :chain-id]))}])}] [rn/view {:style style/empty-container} (if loading-suggested-routes? [rn/activity-indicator] From 8fedc9d3345937b886a125fe76a7ffa10673ba4a Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 13:53:09 +0400 Subject: [PATCH 09/14] lint --- src/status_im/contexts/wallet/send/input_amount/view.cljs | 4 ++-- src/status_im/subs/wallet/wallet.cljs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 721383b07bb..da855499157 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -102,8 +102,8 @@ (let [limit-label (make-limit-label @current-limit) input-num-value (parse-double @input-value) token (rf/sub [:wallet/wallet-send-token]) + suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes]) route (rf/sub [:wallet/wallet-send-route]) - wallet-send (rf/sub [:wallet/wallet-send]) confirm-disabled? (or (nil? route) (empty? @input-value) @@ -144,7 +144,7 @@ (handle-on-change text))}] [routes/view {:amount amount - :routes (:suggested-routes wallet-send) + :routes suggested-routes :networks (:networks token)}] [quo/bottom-actions {:actions :1-action diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index 73de9be9206..2f6864d3528 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -63,6 +63,11 @@ :<- [:wallet/wallet-send] :-> :loading-suggested-routes?) +(rf/reg-sub + :wallet/wallet-send-suggested-routes + :<- [:wallet/wallet-send] + :-> :suggested-routes) + (rf/reg-sub :wallet/watch-address-activity-state :<- [:wallet/ui] From daab89bdef4980172e8d9f9a95a419a732ba7270 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 13:54:40 +0400 Subject: [PATCH 10/14] lint --- src/status_im/subs/wallet/wallet.cljs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index 2f6864d3528..ec8b54b73b3 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -64,9 +64,9 @@ :-> :loading-suggested-routes?) (rf/reg-sub - :wallet/wallet-send-suggested-routes - :<- [:wallet/wallet-send] - :-> :suggested-routes) + :wallet/wallet-send-suggested-routes + :<- [:wallet/wallet-send] + :-> :suggested-routes) (rf/reg-sub :wallet/watch-address-activity-state From 0adcf14bc38427f426de1197ae845445cb7eeeb0 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 14:23:05 +0400 Subject: [PATCH 11/14] lint --- src/status_im/contexts/wallet/send/input_amount/view.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index da855499157..7c6947b0bb2 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -57,6 +57,7 @@ [{:keys [rate limit]}] (let [bottom (safe-area/get-bottom) {:keys [currency]} (rf/sub [:profile/profile]) + networks (rf/sub [:wallet/network-details]) token (rf/sub [:wallet/wallet-send-token]) loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) token-symbol (:symbol token) @@ -134,7 +135,7 @@ {:container-style style/input-container :token token-symbol :currency currency - :networks (:networks token) + :networks networks :title (i18n/label :t/send-limit {:limit limit-label}) :conversion conversion-rate :show-keyboard? false @@ -145,7 +146,7 @@ [routes/view {:amount amount :routes suggested-routes - :networks (:networks token)}] + :networks networks}] [quo/bottom-actions {:actions :1-action :button-one-label (i18n/label :t/confirm) From 54423c6cdbe6106fafa581c3787506c871da617d Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 14:31:37 +0400 Subject: [PATCH 12/14] lint --- src/status_im/contexts/wallet/send/input_amount/view.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 7c6947b0bb2..8700b5ea8fb 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -102,7 +102,6 @@ :stack-id :wallet-send-input-amount}])}}] (let [limit-label (make-limit-label @current-limit) input-num-value (parse-double @input-value) - token (rf/sub [:wallet/wallet-send-token]) suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes]) route (rf/sub [:wallet/wallet-send-route]) confirm-disabled? (or From b98268c72fd95f4453796299df35f3f175a85770 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 14:53:05 +0400 Subject: [PATCH 13/14] lint --- .../contexts/wallet/send/input_amount/component_spec.cljs | 3 ++- src/status_im/contexts/wallet/send/input_amount/view.cljs | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/component_spec.cljs b/src/status_im/contexts/wallet/send/input_amount/component_spec.cljs index fab13ffde6d..867cbaa089e 100644 --- a/src/status_im/contexts/wallet/send/input_amount/component_spec.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/component_spec.cljs @@ -41,7 +41,8 @@ :removed false} :wallet/wallet-send-token {:symbol :eth} :wallet/wallet-send-loading-suggested-routes? false - :wallet/wallet-send-route {:route []}}) + :wallet/wallet-send-route {:route []} + :wallet/wallet-send-suggested-routes {:candidates []}}) (h/describe "Send > input amount screen" (h/setup-restorable-re-frame) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index 8700b5ea8fb..e41414ac31f 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -57,7 +57,6 @@ [{:keys [rate limit]}] (let [bottom (safe-area/get-bottom) {:keys [currency]} (rf/sub [:profile/profile]) - networks (rf/sub [:wallet/network-details]) token (rf/sub [:wallet/wallet-send-token]) loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?]) token-symbol (:symbol token) @@ -102,6 +101,7 @@ :stack-id :wallet-send-input-amount}])}}] (let [limit-label (make-limit-label @current-limit) input-num-value (parse-double @input-value) + token (rf/sub [:wallet/wallet-send-token]) suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes]) route (rf/sub [:wallet/wallet-send-route]) confirm-disabled? (or @@ -110,6 +110,7 @@ (<= input-num-value 0) (> input-num-value (:amount @current-limit))) amount (str @input-value " " token-symbol)] + (println "sus" suggested-routes) (rn/use-effect (fn [] (let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!)) @@ -134,7 +135,7 @@ {:container-style style/input-container :token token-symbol :currency currency - :networks networks + :networks (:networks token) :title (i18n/label :t/send-limit {:limit limit-label}) :conversion conversion-rate :show-keyboard? false @@ -145,7 +146,7 @@ [routes/view {:amount amount :routes suggested-routes - :networks networks}] + :networks (:networks token)}] [quo/bottom-actions {:actions :1-action :button-one-label (i18n/label :t/confirm) From 7a1c509691c963706b70e97fe66f0e47b73ca63c Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Tue, 9 Jan 2024 15:02:34 +0400 Subject: [PATCH 14/14] lint --- src/status_im/contexts/wallet/send/input_amount/view.cljs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/status_im/contexts/wallet/send/input_amount/view.cljs b/src/status_im/contexts/wallet/send/input_amount/view.cljs index e41414ac31f..d0f2e438f90 100644 --- a/src/status_im/contexts/wallet/send/input_amount/view.cljs +++ b/src/status_im/contexts/wallet/send/input_amount/view.cljs @@ -101,7 +101,6 @@ :stack-id :wallet-send-input-amount}])}}] (let [limit-label (make-limit-label @current-limit) input-num-value (parse-double @input-value) - token (rf/sub [:wallet/wallet-send-token]) suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes]) route (rf/sub [:wallet/wallet-send-route]) confirm-disabled? (or @@ -110,7 +109,6 @@ (<= input-num-value 0) (> input-num-value (:amount @current-limit))) amount (str @input-value " " token-symbol)] - (println "sus" suggested-routes) (rn/use-effect (fn [] (let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!))