diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index 05c91394eb..8a34a0bc17 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -93,7 +93,7 @@ {:events [:signing.ui/sign-is-pressed]} [{{:signing/keys [sign tx] :as db} :db :as cofx}] (let [{:keys [in-progress? password]} sign - {:keys [tx-obj gas gasPrice maxPriorityFeePerGas maxFeePerGas message]} tx + {:keys [tx-obj gas gasPrice maxPriorityFeePerGas maxFeePerGas message nonce]} tx hashed-password (ethereum/sha3 (security/safe-unmask-data password))] (if message (sign-message cofx) @@ -102,6 +102,8 @@ {:gas (str "0x" (abi-spec/number-to-hex gas))}) (when gasPrice {:gasPrice (str "0x" (abi-spec/number-to-hex gasPrice))}) + (when nonce + {:nonce (str "0x" (abi-spec/number-to-hex nonce))}) (when maxPriorityFeePerGas {:maxPriorityFeePerGas (str "0x" (abi-spec/number-to-hex (js/parseInt maxPriorityFeePerGas)))}) diff --git a/src/status_im/signing/gas.cljs b/src/status_im/signing/gas.cljs index f4db4bed1e..519537f368 100644 --- a/src/status_im/signing/gas.cljs +++ b/src/status_im/signing/gas.cljs @@ -275,6 +275,13 @@ :maxPriorityFeePerGas (money/->wei :gwei (:value-number maxPriorityFeePerGas)))} (bottom-sheet/hide-bottom-sheet))))) +(fx/defn submit-nonce + {:events [:signing.nonce/submit]} + [{db :db :as cofx} nonce] + (fx/merge cofx + {:db (assoc-in db [:signing/tx :nonce] nonce)} + (bottom-sheet/hide-bottom-sheet))) + (re-frame/reg-fx :signing/update-gas-price (fn [{:keys [success-callback error-callback network-id] :as params}] diff --git a/src/status_im/ui/screens/signing/sheets.cljs b/src/status_im/ui/screens/signing/sheets.cljs index 1c96cda7c9..c0bb3c7891 100644 --- a/src/status_im/ui/screens/signing/sheets.cljs +++ b/src/status_im/ui/screens/signing/sheets.cljs @@ -8,7 +8,8 @@ [status-im.utils.money :as money] [status-im.ui.components.icons.icons :as icons] [clojure.string :as clojure.string] - [status-im.signing.gas :as gas])) + [status-im.signing.gas :as gas] + [reagent.core :as reagent])) (views/defview fee-bottom-sheet [fee-display-symbol] (views/letsubs [{gas-edit :gas gas-price-edit :gasPrice max-fee :max-fee} [:signing/edit-fee]] @@ -377,3 +378,25 @@ :on-press #(do (re-frame/dispatch [:hide-popover]) (re-frame/dispatch [:signing.edit-fee.ui/submit true]))} (i18n/label :t/continue-anyway)]]])) + +(defn advanced [] + (let [nonce (reagent/atom nil) + default-nonce (:nonce @(re-frame/subscribe [:signing/tx]))] + (fn [] + [react/view {:padding 20} + [quo/text-input + {:label (i18n/label :t/nonce) + :accessibility-label :nonce + :keyboard-type :numeric + :default-value default-nonce + :on-change-text #(reset! nonce %) + :show-cancel false + :container-style {:margin-bottom 20}}] + [react/view {:align-items :flex-end} + [quo/button + {:type :primary + :accessibility-label :save-nonce + :theme :accent + :disabled (clojure.string/blank? @nonce) + :on-press #(re-frame/dispatch [:signing.nonce/submit @nonce])} + (i18n/label :t/save)]]]))) diff --git a/src/status_im/ui/screens/signing/views.cljs b/src/status_im/ui/screens/signing/views.cljs index 00db4ea3d1..359f988f88 100644 --- a/src/status_im/ui/screens/signing/views.cljs +++ b/src/status_im/ui/screens/signing/views.cljs @@ -402,6 +402,15 @@ :accessory :text :accessory-text network-name}])) +(defn advanced-item [] + [:<> + [separator] + [quo/list-item + {:size :small + :title (i18n/label :t/advanced) + :chevron true + :on-press #(re-frame/dispatch [:bottom-sheet/show-sheet {:content sheets/advanced}])}]]) + (views/defview sheet [{:keys [from contact amount token cancel?] :as tx}] (views/letsubs [fee [:signing/fee] @@ -413,7 +422,8 @@ prices [:prices] wallet-currency [:wallet/currency] mainnet? [:mainnet?] - prices-loading? [:prices-loading?]] + prices-loading? [:prices-loading?] + management-enabled? [:wallet/transactions-management-enabled?]] (let [display-symbol (wallet.utils/display-symbol token) fee-display-symbol (wallet.utils/display-symbol (tokens/native-currency chain))] [react/view (styles/sheet) @@ -438,6 +448,8 @@ [amount-item prices wallet-currency amount amount-error display-symbol fee-display-symbol prices-loading?]) [separator] [fee-item prices wallet-currency fee-display-symbol fee gas-error gas-error-state prices-loading?] + (when management-enabled? + [advanced-item]) (when (= :gas-is-set gas-error-state) [react/text {:style {:color colors/gray :margin-horizontal 32 :text-align :center}} (i18n/label :t/tx-fail-description1)])