Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2eb401a16 | ||
|
|
c568a51c60 |
@@ -11,28 +11,28 @@
|
||||
[{:keys [track-text customization-color auth-button-label on-auth-success on-auth-fail
|
||||
auth-button-icon-left size blur? container-style disabled? dependencies on-complete]
|
||||
:or {container-style {:flex 1}}}]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
auth-method (rf/sub [:auth-method])
|
||||
biometric-auth? (= auth-method constants/auth-method-biometric)
|
||||
on-complete-callback (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch [:standard-auth/authorize
|
||||
{:auth-button-icon-left auth-button-icon-left
|
||||
:theme theme
|
||||
:blur? blur?
|
||||
:biometric-auth? biometric-auth?
|
||||
:on-auth-success on-auth-success
|
||||
:on-auth-fail on-auth-fail
|
||||
:auth-button-label auth-button-label}]))
|
||||
(vec (conj dependencies on-auth-success on-auth-fail)))
|
||||
on-slider-complete (rn/use-callback
|
||||
(fn [reset-slider-fn]
|
||||
(js/setTimeout #(reset-slider-fn false) 500)
|
||||
(if (fn? on-complete)
|
||||
(on-complete)
|
||||
(on-complete-callback)))
|
||||
[on-complete on-complete-callback])
|
||||
biometric-type (rf/sub [:biometrics/supported-type])]
|
||||
(let [theme (quo.theme/use-theme)
|
||||
auth-method (rf/sub [:auth-method])
|
||||
biometric-auth? (= auth-method constants/auth-method-biometric)
|
||||
authorization-callback (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch [:standard-auth/authorize
|
||||
{:auth-button-icon-left auth-button-icon-left
|
||||
:theme theme
|
||||
:blur? blur?
|
||||
:biometric-auth? biometric-auth?
|
||||
:on-auth-success on-auth-success
|
||||
:on-auth-fail on-auth-fail
|
||||
:auth-button-label auth-button-label}]))
|
||||
(vec (conj dependencies on-auth-success on-auth-fail)))
|
||||
on-slider-complete (rn/use-callback
|
||||
(fn [reset-slider-fn]
|
||||
(js/setTimeout #(reset-slider-fn false) 500)
|
||||
(if (fn? on-complete)
|
||||
(on-complete)
|
||||
(authorization-callback)))
|
||||
[on-complete authorization-callback])
|
||||
biometric-type (rf/sub [:biometrics/supported-type])]
|
||||
[quo/slide-button
|
||||
{:container-style container-style
|
||||
:size size
|
||||
|
||||
@@ -129,5 +129,5 @@
|
||||
;; if you're using android simulator, I suggest set the env variable to "http://10.0.2.2:"
|
||||
(goog-define STATUS_BACKEND_SERVER_IMAGE_SERVER_URI_PREFIX "https://localhost:")
|
||||
|
||||
(def re-frisk-host (get-config :RE_FRISK_HOST "http://localhost"))
|
||||
(def re-frisk-host (get-config :RE_FRISK_HOST "localhost"))
|
||||
(def re-frisk-port (get-config :RE_FRISK_PORT "4567"))
|
||||
|
||||
@@ -448,7 +448,10 @@
|
||||
(def ^:const wallet-account-name-max-length 20)
|
||||
|
||||
|
||||
(def ^:const gas-rate-low 0)
|
||||
(def ^:const gas-rate-medium 1)
|
||||
(def ^:const gas-rate-high 2)
|
||||
(def ^:const gas-rate-custom 3)
|
||||
(def ^:const send-type-transfer 0)
|
||||
(def ^:const send-type-bridge 5)
|
||||
(def ^:const send-type-erc-721-transfer 6)
|
||||
|
||||
@@ -279,7 +279,8 @@
|
||||
:to (:to-chain new-path)
|
||||
:approval-amount-required (:approval-amount-required new-path)
|
||||
;; :cost () ;; tbd not used on desktop
|
||||
:gas-amount (:tx-gas-amount new-path)}))
|
||||
:gas-amount (:tx-gas-amount new-path)
|
||||
:router-input-params-uuid (:router-input-params-uuid new-path)}))
|
||||
|
||||
(defn tokens-never-loaded?
|
||||
[db]
|
||||
|
||||
@@ -120,6 +120,9 @@
|
||||
(rf/reg-fx
|
||||
:effects.wallet/sign-transaction-hashes
|
||||
(fn [{:keys [hashes address password on-success on-error]}]
|
||||
(tap> {:in :effects.wallet/sign-transaction-hashes
|
||||
:hashes hashes
|
||||
:password password})
|
||||
(-> (sign-transaction-hashes hashes address password)
|
||||
(promesa/then on-success)
|
||||
(promesa/catch on-error))))
|
||||
|
||||
@@ -762,6 +762,8 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/sign-transactions-signal-received
|
||||
(fn [{:keys [db]} [{send-details :sendDetails :as data}]]
|
||||
(tap> {:in :wallet/sign-transactions-signal-received
|
||||
:data data})
|
||||
(let [type (if (or (= (:fromToken send-details)
|
||||
(:toToken send-details))
|
||||
(string/blank? (:toToken send-details)))
|
||||
@@ -781,6 +783,7 @@
|
||||
(fn [{:keys [db]}
|
||||
[{sent-transactions :sentTransactions
|
||||
send-details :sendDetails}]]
|
||||
(tap> {:in :wallet/transactions-sent-signal-received})
|
||||
(let [swap? (get-in db [:wallet :ui :swap])]
|
||||
{:fx [[:dispatch
|
||||
(if-let [error-response (:errorResponse send-details)]
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.wallet.collectible.utils :as collectible.utils]
|
||||
[status-im.contexts.wallet.common.utils :as utils]
|
||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||
[status-im.contexts.wallet.common.utils.networks :as network-utils]
|
||||
[status-im.contexts.wallet.data-store :as data-store]
|
||||
[status-im.contexts.wallet.send.utils :as send-utils]
|
||||
@@ -12,7 +13,8 @@
|
||||
[utils.money :as utils.money]
|
||||
[utils.number]
|
||||
[utils.re-frame :as rf]
|
||||
[utils.security.core :as security]))
|
||||
[utils.security.core :as security]
|
||||
[status-im.contexts.wallet.wallet-connect.utils.typed-data :as typed-data]))
|
||||
|
||||
(rf/reg-event-fx :wallet/clean-send-data
|
||||
(fn [{:keys [db]}]
|
||||
@@ -386,7 +388,7 @@
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :amount] amount)
|
||||
(update-in [:wallet :ui :send] dissoc :transaction-for-signing))
|
||||
:fx [[:dispatch [:wallet/build-transactions-from-route {:request-uuid last-request-uuid}]]
|
||||
:fx [#_[:dispatch [:wallet/build-transactions-from-route {:request-uuid last-request-uuid}]]
|
||||
[:dispatch
|
||||
[:wallet/wizard-navigate-forward
|
||||
{:current-screen stack-id
|
||||
@@ -651,6 +653,8 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/build-transactions-from-route
|
||||
(fn [_ [{:keys [request-uuid slippage] :or {slippage constants/default-slippage}}]]
|
||||
(tap> {:in :wallet/build-transactions-from-route
|
||||
:request-uuid request-uuid})
|
||||
{:json-rpc/call [{:method "wallet_buildTransactionsFromRoute"
|
||||
:params [{:uuid request-uuid
|
||||
:slippagePercentage slippage}]
|
||||
@@ -666,6 +670,9 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/prepare-signatures-for-transactions
|
||||
(fn [{:keys [db]} [type sha3-pwd]]
|
||||
(tap> {:in :wallet/prepare-signatures-for-transactions
|
||||
:type type
|
||||
:sha3-pwd sha3-pwd})
|
||||
(let [{:keys [hashes address signOnKeycard]} (get-in db
|
||||
[:wallet :ui type :transaction-for-signing
|
||||
:signingDetails])
|
||||
@@ -702,6 +709,9 @@
|
||||
(rf/reg-event-fx
|
||||
:wallet/send-router-transactions-with-signatures
|
||||
(fn [{:keys [db]} [type signatures]]
|
||||
(tap> {:in :wallet/send-router-transactions-with-signatures
|
||||
:type type
|
||||
:signatures signatures})
|
||||
(let [transaction-for-signing (get-in db [:wallet :ui type :transaction-for-signing])
|
||||
signatures-map (reduce (fn [acc {:keys [message signature]}]
|
||||
(assoc acc
|
||||
@@ -842,3 +852,28 @@
|
||||
:wallet/set-nonce
|
||||
(fn [{db :db} [value]]
|
||||
{:db (assoc-in db [:wallet :ui :send :tx-settings :nonce :current] value)}))
|
||||
|
||||
(rf/reg-event-fx :wallet/quick-transaction-settings-confirmed
|
||||
(fn [_cofx [path-tx-identity fee-mode]]
|
||||
(let [params [path-tx-identity fee-mode]]
|
||||
{:json-rpc/call [{:method "wallet_setFeeMode"
|
||||
:params params
|
||||
:on-error (fn [error]
|
||||
(log/error "failed to get suggested routes (async)"
|
||||
{:event :wallet/start-get-suggested-routes
|
||||
:error (:message error)
|
||||
:params params}))}]})))
|
||||
|
||||
|
||||
#_(rf/reg-event-fx :wallet/quick-transaction-settings-confirmed
|
||||
(fn [_cofx [path-tx-identity fee-mode]]
|
||||
(let [params [path-tx-identity fee-mode]]
|
||||
{:json-rpc/call [{:method "wallet_setCustomTxDetails"
|
||||
:params params
|
||||
:on-error (fn [error]
|
||||
(tap> {:in :wallet/quick-transaction-settings-confirmed
|
||||
:error error})
|
||||
(log/error "failed to get suggested routes (async)"
|
||||
{:event :wallet/start-get-suggested-routes
|
||||
:error (:message error)
|
||||
:params params}))}]})))
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
[status-im.common.events-helper :as events-helper]
|
||||
[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.common.utils :as utils]
|
||||
[status-im.contexts.wallet.send.transaction-confirmation.style :as style]
|
||||
[status-im.contexts.wallet.send.transaction-settings.view :as transaction-settings]
|
||||
@@ -167,11 +168,19 @@
|
||||
:title title
|
||||
:subtitle subtitle}])
|
||||
|
||||
(defn quick-transaction-settings-confirmed
|
||||
[path-identity setting]
|
||||
(let [gas-rate (case setting
|
||||
:normal constants/gas-rate-low
|
||||
:fast constants/gas-rate-medium
|
||||
:urgent constants/gas-rate-high
|
||||
constants/gas-rate-low)]
|
||||
(rf/dispatch [:wallet/quick-transaction-settings-confirmed path-identity gas-rate])))
|
||||
|
||||
(defn- transaction-details
|
||||
[{:keys [estimated-time-min max-fees to-network route
|
||||
transaction-type]}]
|
||||
(let [route-loaded? (and route (seq route))
|
||||
loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
|
||||
[{:keys [estimated-time-min max-fees to-network
|
||||
transaction-type path-identity route-loaded?]}]
|
||||
(let [loading-suggested-routes? (rf/sub [:wallet/wallet-send-loading-suggested-routes?])
|
||||
amount (rf/sub [:wallet/send-total-amount-formatted])]
|
||||
[rn/view
|
||||
{:style (style/details-container
|
||||
@@ -190,9 +199,14 @@
|
||||
:inner-style {:opacity 1}
|
||||
:accessibility-label :advanced-button
|
||||
:container-style {:margin-right 8}
|
||||
:on-press #(rf/dispatch
|
||||
[:show-bottom-sheet
|
||||
{:content transaction-settings/settings-sheet}])}
|
||||
:on-press (fn []
|
||||
(rf/dispatch
|
||||
[:show-bottom-sheet
|
||||
{:content (fn []
|
||||
[transaction-settings/settings-sheet
|
||||
#(quick-transaction-settings-confirmed
|
||||
path-identity
|
||||
%)])}]))}
|
||||
:i/advanced])
|
||||
[data-item
|
||||
{:title (i18n/label :t/est-time)
|
||||
@@ -217,6 +231,7 @@
|
||||
{:keys [token-display-name collectible amount
|
||||
route
|
||||
to-address bridge-to-chain-id type
|
||||
last-request-uuid
|
||||
recipient]} send-transaction-data
|
||||
collectible? (some? collectible)
|
||||
image-url (when collectible
|
||||
@@ -248,9 +263,7 @@
|
||||
account))}
|
||||
user-props {:full-name to-address
|
||||
:address (utils/get-shortened-address
|
||||
to-address)}
|
||||
sign-on-keycard? (get-in transaction-for-signing
|
||||
[:signingDetails :signOnKeycard])]
|
||||
to-address)}]
|
||||
(hot-reload/use-safe-unmount #(rf/dispatch [:wallet/clean-route-data-for-collectible-tx]))
|
||||
;; In token send flow we already have transaction built when
|
||||
;; we reach confirmation screen. But in send collectible flow
|
||||
@@ -283,7 +296,9 @@
|
||||
:to-network bridge-to-network
|
||||
:theme theme
|
||||
:route route
|
||||
:transaction-type transaction-type}]
|
||||
:transaction-type transaction-type
|
||||
:path-identity (send-utils/path-identity first-route)
|
||||
:route-loaded? (and route (seq route))}]
|
||||
(when (and (not loading-suggested-routes?) route (seq route))
|
||||
[standard-auth/slide-button
|
||||
{:size :size-48
|
||||
@@ -291,10 +306,11 @@
|
||||
(i18n/label :t/slide-to-bridge)
|
||||
(i18n/label :t/slide-to-send))
|
||||
:container-style {:z-index 2}
|
||||
:disabled? (not transaction-for-signing)
|
||||
;; :disabled? (not transaction-for-signing)
|
||||
:customization-color account-color
|
||||
:auth-button-label (i18n/label :t/confirm)
|
||||
:on-complete (when sign-on-keycard?
|
||||
:on-complete (when (get-in transaction-for-signing
|
||||
[:signingDetails :signOnKeycard])
|
||||
#(rf/dispatch
|
||||
[:wallet/prepare-signatures-for-transactions
|
||||
:send
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
:button-one-label (i18n/label :t/confirm)}]]))
|
||||
|
||||
(defn settings-sheet
|
||||
[_]
|
||||
[on-quick-settings-confirmed]
|
||||
(let [[selected-id set-selected-id] (rn/use-state :normal)]
|
||||
[rn/view
|
||||
[quo/drawer-top
|
||||
@@ -119,7 +119,11 @@
|
||||
:preview-size :size-32}]}]
|
||||
[quo/bottom-actions
|
||||
{:actions :one-action
|
||||
:button-one-props {:on-press #(rf/dispatch [:hide-bottom-sheet])}
|
||||
:button-one-props {:on-press (fn []
|
||||
(rf/dispatch [:hide-bottom-sheet])
|
||||
(when on-quick-settings-confirmed
|
||||
(on-quick-settings-confirmed selected-id))
|
||||
)}
|
||||
:button-one-label (i18n/label :t/confirm)}]]))
|
||||
|
||||
(defn- hint
|
||||
|
||||
@@ -224,3 +224,10 @@
|
||||
{:r (subs signature 0 64)
|
||||
:s (subs signature 64 128)
|
||||
:v (subs signature 128 130)})
|
||||
|
||||
(defn path-identity
|
||||
[path]
|
||||
{:routerInputParamsUuid (:router-input-params-uuid path)
|
||||
:pathName (:bridge-name path)
|
||||
:chainID (get-in path [:to :chain-id])
|
||||
:isApprovalTx (:approval-required path)})
|
||||
|
||||
Reference in New Issue
Block a user