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