Compare commits

...
Author SHA1 Message Date
Omar Basem 02df3ac883 feat: routes 2023-12-20 14:46:33 +04:00
Omar Basem b3f0bf0b38 wallet: send routes ui 2023-12-20 14:08:56 +04:00
3 changed files with 21 additions and 12 deletions
@@ -81,6 +81,7 @@
:json-rpc/call [{:method "wallet_getSuggestedRoutes"
:params request-params
:on-success (fn [suggested-routes]
(println "sss" suggested-routes)
(rf/dispatch [:wallet/suggested-routes-success suggested-routes
now]))
:on-error (fn [error]
@@ -51,10 +51,12 @@
(defn- f-view-internal
[{:keys [rate limit]}]
(let [bottom (safe-area/get-bottom)
{:keys [currency]} (rf/sub [:profile/profile])
{: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?])
;suggested-routes (rf/sub [:wallet/wallet-send-suggested-routes])
token-symbol (:symbol token)
limit-crypto (or (:total-balance token) limit)
conversion-rate (or rate 10)
@@ -91,6 +93,7 @@
(reset! input-value (str current-limit-amount))
(reset! input-value v))
(reagent/flush))))]
;(println "qqqxxx" suggested-routes)
(fn [{:keys [on-confirm]
:or {on-confirm #(rf/dispatch [:wallet/send-select-amount
{:amount @input-value
@@ -100,21 +103,21 @@
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)))]
(nil? route)
(empty? @input-value)
(<= input-num-value 0)
(> input-num-value (:amount @current-limit)))]
(rn/use-effect
(fn []
(let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!))
app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)]
#(.remove app-keyboard-listener))))
(fn []
(let [dismiss-keyboard-fn #(when (= % "active") (rn/dismiss-keyboard!))
app-keyboard-listener (.addEventListener rn/app-state "change" dismiss-keyboard-fn)]
#(.remove app-keyboard-listener))))
(rn/use-effect (fn []
(rf/dispatch [:wallet/clean-suggested-routes])
(when-not (or
(empty? @input-value)
(<= input-num-value 0)
(> input-num-value (:amount @current-limit)))
(empty? @input-value)
(<= input-num-value 0)
(> input-num-value (:amount @current-limit)))
(debounce/debounce-and-dispatch [:wallet/get-suggested-routes @input-value]
100)))
[@input-value])
+5
View File
@@ -70,6 +70,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]