[#12681] Enable UI for signing legacy txs on networks without eip1559 support
This commit is contained in:
parent
1f357fd7c6
commit
12a99f40d2
1
.env
1
.env
|
@ -29,6 +29,5 @@ APN_TOPIC=im.status.ethereum.pr
|
|||
COMMUNITIES_ENABLED=1
|
||||
DATABASE_MANAGEMENT_ENABLED=1
|
||||
METRICS_ENABLED=0
|
||||
EIP1559_ENABLED=1
|
||||
DELETE_MESSAGE_ENABLED=1
|
||||
COLLECTIBLES_ENABLED=1
|
||||
|
|
1
.env.e2e
1
.env.e2e
|
@ -32,5 +32,4 @@ DATABASE_MANAGEMENT_ENABLED=1
|
|||
COMMUNITIES_ENABLED=1
|
||||
COMMUNITIES_MANAGEMENT_ENABLED=1
|
||||
METRICS_ENABLED=0
|
||||
EIP1559_ENABLED=1
|
||||
DELETE_MESSAGE_ENABLED=1
|
||||
|
|
|
@ -34,5 +34,4 @@ DATABASE_MANAGEMENT_ENABLED=1
|
|||
COMMUNITIES_ENABLED=1
|
||||
COMMUNITIES_MANAGEMENT_ENABLED=1
|
||||
METRICS_ENABLED=0
|
||||
EIP1559_ENABLED=1
|
||||
DELETE_MESSAGE_ENABLED=1
|
||||
|
|
|
@ -23,5 +23,4 @@ BLANK_PREVIEW=0
|
|||
COMMUNITIES_ENABLED=1
|
||||
DATABASE_MANAGEMENT_ENABLED=1
|
||||
METRICS_ENABLED=0
|
||||
EIP1559_ENABLED=1
|
||||
DELETE_MESSAGE_ENABLED=1
|
||||
|
|
|
@ -19,6 +19,5 @@ ENABLE_ROOT_ALERT=1
|
|||
MAX_IMAGES_BATCH=1
|
||||
ENABLE_REFERRAL_INVITE=0
|
||||
METRICS_ENABLED=0
|
||||
EIP1559_ENABLED=1
|
||||
DELETE_MESSAGE_ENABLED=1
|
||||
COLLECTIBLES_ENABLED=0
|
||||
|
|
|
@ -1,60 +1,49 @@
|
|||
(ns status-im.signing.eip1559
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.ethereum.json-rpc :as json-rpc]
|
||||
[status-im.utils.config :as config]
|
||||
[status-im.utils.money :as money]))
|
||||
[status-im.ethereum.json-rpc :as json-rpc]))
|
||||
|
||||
(def activation-blocks
|
||||
{"3" (money/bignumber 10499401)})
|
||||
|
||||
(defonce activated? (atom {}))
|
||||
(defonce london-activated? (atom false))
|
||||
|
||||
(defonce activated-on-current-network? (atom nil))
|
||||
|
||||
(defn get-activation-block [network-id]
|
||||
(get activation-blocks (str network-id)))
|
||||
(defn london-is-definitely-activated [network-id]
|
||||
(contains? #{"1" "3"} network-id))
|
||||
|
||||
(defn on-block [network-id callback header]
|
||||
(let [london-activated?
|
||||
(boolean
|
||||
(and
|
||||
(get-activation-block network-id)
|
||||
(money/greater-than-or-equals
|
||||
(money/bignumber (:number header))
|
||||
(get-activation-block network-id))))]
|
||||
(swap! activated? assoc network-id london-activated?)
|
||||
(reset! activated-on-current-network? london-activated?)
|
||||
(callback london-activated?)))
|
||||
(defn on-block [callback header]
|
||||
(let [activated? (contains? header :baseFeePerGas)]
|
||||
(reset! london-activated? activated?)
|
||||
(callback activated?)))
|
||||
|
||||
(defn check-activation [network-id callback]
|
||||
(defn check-activation [callback]
|
||||
(json-rpc/call
|
||||
{:method "eth_getBlockByNumber"
|
||||
:params ["latest" false]
|
||||
:on-success (partial on-block network-id callback)
|
||||
:on-success (partial on-block callback)
|
||||
:on-error #(callback nil)}))
|
||||
|
||||
(defn sync-enabled? []
|
||||
config/eip1559-enabled?)
|
||||
(defn sync-enabled? [] @london-activated?)
|
||||
|
||||
(defn enabled? [network-id enabled-callback disabled-callback]
|
||||
(let [london-activated? true]
|
||||
(cond
|
||||
(not config/eip1559-enabled?)
|
||||
(disabled-callback)
|
||||
(defn enabled?
|
||||
([] @london-activated?)
|
||||
([network-id enabled-callback disabled-callback]
|
||||
(let [definitely-activated? (london-is-definitely-activated network-id)]
|
||||
(cond
|
||||
definitely-activated?
|
||||
(do
|
||||
(reset! london-activated? true)
|
||||
(enabled-callback))
|
||||
|
||||
(nil? london-activated?)
|
||||
(check-activation
|
||||
network-id
|
||||
(fn [activated?]
|
||||
(if activated?
|
||||
(enabled-callback)
|
||||
(disabled-callback))))
|
||||
(not definitely-activated?)
|
||||
(check-activation
|
||||
(fn [activated?]
|
||||
(if activated?
|
||||
(enabled-callback)
|
||||
(disabled-callback))))
|
||||
|
||||
london-activated?
|
||||
(enabled-callback)
|
||||
|
||||
:else
|
||||
(disabled-callback))))
|
||||
:else
|
||||
(do
|
||||
(reset! london-activated? false)
|
||||
(disabled-callback))))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
::check-eip1559-activation
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
(ns status-im.ui.screens.signing.views
|
||||
(:require-macros [status-im.utils.views :as views])
|
||||
(:require [status-im.ui.components.react :as react]
|
||||
[re-frame.core :as re-frame]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[quo.design-system.colors :as colors]
|
||||
[status-im.ui.components.copyable-text :as copyable-text]
|
||||
[status-im.wallet.utils :as wallet.utils]
|
||||
[status-im.keycard.common :as keycard.common]
|
||||
[status-im.ui.screens.keycard.keycard-interaction :as keycard-sheet]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||
[status-im.ui.components.icons.icons :as icons]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.ui.screens.signing.sheets :as sheets]
|
||||
[status-im.ethereum.tokens :as tokens]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.platform :as platform]
|
||||
[clojure.string :as string]
|
||||
(:require [clojure.string :as string]
|
||||
[quo.core :as quo]
|
||||
[quo.design-system.colors :as colors]
|
||||
[quo.gesture-handler :as gh]
|
||||
[status-im.ui.screens.signing.styles :as styles]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.ui.screens.keycard.pin.views :as pin.views]
|
||||
[status-im.ui.components.bottom-panel.views :as bottom-panel]
|
||||
[status-im.utils.utils :as utils]
|
||||
[re-frame.core :as re-frame]
|
||||
[reagent.core :as reagent]
|
||||
[status-im.ui.screens.wallet.components.views :as wallet.components]))
|
||||
[status-im.ethereum.tokens :as tokens]
|
||||
[status-im.i18n.i18n :as i18n]
|
||||
[status-im.keycard.common :as keycard.common]
|
||||
[status-im.multiaccounts.core :as multiaccounts]
|
||||
[status-im.react-native.resources :as resources]
|
||||
[status-im.signing.eip1559 :as eip1559]
|
||||
[status-im.ui.components.bottom-panel.views :as bottom-panel]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon]
|
||||
[status-im.ui.components.copyable-text :as copyable-text]
|
||||
[status-im.ui.components.icons.icons :as icons]
|
||||
[status-im.ui.components.react :as react]
|
||||
[status-im.ui.screens.keycard.keycard-interaction :as keycard-sheet]
|
||||
[status-im.ui.screens.keycard.pin.views :as pin.views]
|
||||
[status-im.ui.screens.signing.sheets :as sheets]
|
||||
[status-im.ui.screens.signing.styles :as styles]
|
||||
[status-im.ui.screens.wallet.components.views :as wallet.components]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.security :as security]
|
||||
[status-im.utils.types :as types]
|
||||
[status-im.utils.utils :as utils]
|
||||
[status-im.wallet.utils :as wallet.utils]))
|
||||
|
||||
(defn separator []
|
||||
[react/view {:height 1 :background-color colors/gray-lighter}])
|
||||
|
@ -384,15 +385,9 @@
|
|||
:on-press #(re-frame/dispatch
|
||||
[:signing.ui/open-fee-sheet
|
||||
{:content (fn []
|
||||
[sheets/fee-bottom-sheet-eip1559-custom fee-display-symbol])
|
||||
:content-height 270}])
|
||||
#_(re-frame/dispatch
|
||||
[:signing.ui/open-fee-sheet
|
||||
{:content (fn []
|
||||
(if (eip1559/sync-enabled?)
|
||||
[sheets/fee-bottom-sheet-eip1559 fee-display-symbol]
|
||||
[sheets/fee-bottom-sheet fee-display-symbol]))
|
||||
:content-height 270}])}])))
|
||||
(if (eip1559/enabled?)
|
||||
[sheets/fee-bottom-sheet-eip1559-custom fee-display-symbol]
|
||||
[sheets/fee-bottom-sheet fee-display-symbol]))}])}])))
|
||||
|
||||
(views/defview network-item []
|
||||
(views/letsubs [network-name [:network-name]]
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
(def database-management-enabled? (enabled? (get-config :DATABASE_MANAGEMENT_ENABLED "0")))
|
||||
(def debug-webview? (enabled? (get-config :DEBUG_WEBVIEW "0")))
|
||||
(def metrics-enabled? (enabled? (get-config :METRICS_ENABLED "0")))
|
||||
(def eip1559-enabled? (enabled? (get-config :EIP1559_ENABLED "0")))
|
||||
(def delete-message-enabled? (enabled? (get-config :DELETE_MESSAGE_ENABLED "0")))
|
||||
(def collectibles-enabled? (enabled? (get-config :COLLECTIBLES_ENABLED "1")))
|
||||
(def test-stateofus? (enabled? (get-config :TEST_STATEOFUS "0")))
|
||||
|
|
Loading…
Reference in New Issue