[#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
|
COMMUNITIES_ENABLED=1
|
||||||
DATABASE_MANAGEMENT_ENABLED=1
|
DATABASE_MANAGEMENT_ENABLED=1
|
||||||
METRICS_ENABLED=0
|
METRICS_ENABLED=0
|
||||||
EIP1559_ENABLED=1
|
|
||||||
DELETE_MESSAGE_ENABLED=1
|
DELETE_MESSAGE_ENABLED=1
|
||||||
COLLECTIBLES_ENABLED=1
|
COLLECTIBLES_ENABLED=1
|
||||||
|
|
1
.env.e2e
1
.env.e2e
|
@ -32,5 +32,4 @@ DATABASE_MANAGEMENT_ENABLED=1
|
||||||
COMMUNITIES_ENABLED=1
|
COMMUNITIES_ENABLED=1
|
||||||
COMMUNITIES_MANAGEMENT_ENABLED=1
|
COMMUNITIES_MANAGEMENT_ENABLED=1
|
||||||
METRICS_ENABLED=0
|
METRICS_ENABLED=0
|
||||||
EIP1559_ENABLED=1
|
|
||||||
DELETE_MESSAGE_ENABLED=1
|
DELETE_MESSAGE_ENABLED=1
|
||||||
|
|
|
@ -34,5 +34,4 @@ DATABASE_MANAGEMENT_ENABLED=1
|
||||||
COMMUNITIES_ENABLED=1
|
COMMUNITIES_ENABLED=1
|
||||||
COMMUNITIES_MANAGEMENT_ENABLED=1
|
COMMUNITIES_MANAGEMENT_ENABLED=1
|
||||||
METRICS_ENABLED=0
|
METRICS_ENABLED=0
|
||||||
EIP1559_ENABLED=1
|
|
||||||
DELETE_MESSAGE_ENABLED=1
|
DELETE_MESSAGE_ENABLED=1
|
||||||
|
|
|
@ -23,5 +23,4 @@ BLANK_PREVIEW=0
|
||||||
COMMUNITIES_ENABLED=1
|
COMMUNITIES_ENABLED=1
|
||||||
DATABASE_MANAGEMENT_ENABLED=1
|
DATABASE_MANAGEMENT_ENABLED=1
|
||||||
METRICS_ENABLED=0
|
METRICS_ENABLED=0
|
||||||
EIP1559_ENABLED=1
|
|
||||||
DELETE_MESSAGE_ENABLED=1
|
DELETE_MESSAGE_ENABLED=1
|
||||||
|
|
|
@ -19,6 +19,5 @@ ENABLE_ROOT_ALERT=1
|
||||||
MAX_IMAGES_BATCH=1
|
MAX_IMAGES_BATCH=1
|
||||||
ENABLE_REFERRAL_INVITE=0
|
ENABLE_REFERRAL_INVITE=0
|
||||||
METRICS_ENABLED=0
|
METRICS_ENABLED=0
|
||||||
EIP1559_ENABLED=1
|
|
||||||
DELETE_MESSAGE_ENABLED=1
|
DELETE_MESSAGE_ENABLED=1
|
||||||
COLLECTIBLES_ENABLED=0
|
COLLECTIBLES_ENABLED=0
|
||||||
|
|
|
@ -1,60 +1,49 @@
|
||||||
(ns status-im.signing.eip1559
|
(ns status-im.signing.eip1559
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.ethereum.json-rpc :as json-rpc]
|
[status-im.ethereum.json-rpc :as json-rpc]))
|
||||||
[status-im.utils.config :as config]
|
|
||||||
[status-im.utils.money :as money]))
|
|
||||||
|
|
||||||
(def activation-blocks
|
(defonce london-activated? (atom false))
|
||||||
{"3" (money/bignumber 10499401)})
|
|
||||||
|
|
||||||
(defonce activated? (atom {}))
|
|
||||||
|
|
||||||
(defonce activated-on-current-network? (atom nil))
|
(defonce activated-on-current-network? (atom nil))
|
||||||
|
|
||||||
(defn get-activation-block [network-id]
|
(defn london-is-definitely-activated [network-id]
|
||||||
(get activation-blocks (str network-id)))
|
(contains? #{"1" "3"} network-id))
|
||||||
|
|
||||||
(defn on-block [network-id callback header]
|
(defn on-block [callback header]
|
||||||
(let [london-activated?
|
(let [activated? (contains? header :baseFeePerGas)]
|
||||||
(boolean
|
(reset! london-activated? activated?)
|
||||||
(and
|
(callback activated?)))
|
||||||
(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 check-activation [network-id callback]
|
(defn check-activation [callback]
|
||||||
(json-rpc/call
|
(json-rpc/call
|
||||||
{:method "eth_getBlockByNumber"
|
{:method "eth_getBlockByNumber"
|
||||||
:params ["latest" false]
|
:params ["latest" false]
|
||||||
:on-success (partial on-block network-id callback)
|
:on-success (partial on-block callback)
|
||||||
:on-error #(callback nil)}))
|
:on-error #(callback nil)}))
|
||||||
|
|
||||||
(defn sync-enabled? []
|
(defn sync-enabled? [] @london-activated?)
|
||||||
config/eip1559-enabled?)
|
|
||||||
|
|
||||||
(defn enabled? [network-id enabled-callback disabled-callback]
|
(defn enabled?
|
||||||
(let [london-activated? true]
|
([] @london-activated?)
|
||||||
(cond
|
([network-id enabled-callback disabled-callback]
|
||||||
(not config/eip1559-enabled?)
|
(let [definitely-activated? (london-is-definitely-activated network-id)]
|
||||||
(disabled-callback)
|
(cond
|
||||||
|
definitely-activated?
|
||||||
|
(do
|
||||||
|
(reset! london-activated? true)
|
||||||
|
(enabled-callback))
|
||||||
|
|
||||||
(nil? london-activated?)
|
(not definitely-activated?)
|
||||||
(check-activation
|
(check-activation
|
||||||
network-id
|
(fn [activated?]
|
||||||
(fn [activated?]
|
(if activated?
|
||||||
(if activated?
|
(enabled-callback)
|
||||||
(enabled-callback)
|
(disabled-callback))))
|
||||||
(disabled-callback))))
|
|
||||||
|
|
||||||
london-activated?
|
:else
|
||||||
(enabled-callback)
|
(do
|
||||||
|
(reset! london-activated? false)
|
||||||
:else
|
(disabled-callback))))))
|
||||||
(disabled-callback))))
|
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
::check-eip1559-activation
|
::check-eip1559-activation
|
||||||
|
|
|
@ -1,31 +1,32 @@
|
||||||
(ns status-im.ui.screens.signing.views
|
(ns status-im.ui.screens.signing.views
|
||||||
(:require-macros [status-im.utils.views :as views])
|
(:require-macros [status-im.utils.views :as views])
|
||||||
(:require [status-im.ui.components.react :as react]
|
(:require [clojure.string :as string]
|
||||||
[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]
|
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
|
[quo.design-system.colors :as colors]
|
||||||
[quo.gesture-handler :as gh]
|
[quo.gesture-handler :as gh]
|
||||||
[status-im.ui.screens.signing.styles :as styles]
|
[re-frame.core :as re-frame]
|
||||||
[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]
|
|
||||||
[reagent.core :as reagent]
|
[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 []
|
(defn separator []
|
||||||
[react/view {:height 1 :background-color colors/gray-lighter}])
|
[react/view {:height 1 :background-color colors/gray-lighter}])
|
||||||
|
@ -384,15 +385,9 @@
|
||||||
:on-press #(re-frame/dispatch
|
:on-press #(re-frame/dispatch
|
||||||
[:signing.ui/open-fee-sheet
|
[:signing.ui/open-fee-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[sheets/fee-bottom-sheet-eip1559-custom fee-display-symbol])
|
(if (eip1559/enabled?)
|
||||||
:content-height 270}])
|
[sheets/fee-bottom-sheet-eip1559-custom fee-display-symbol]
|
||||||
#_(re-frame/dispatch
|
[sheets/fee-bottom-sheet fee-display-symbol]))}])}])))
|
||||||
[: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}])}])))
|
|
||||||
|
|
||||||
(views/defview network-item []
|
(views/defview network-item []
|
||||||
(views/letsubs [network-name [:network-name]]
|
(views/letsubs [network-name [:network-name]]
|
||||||
|
|
|
@ -49,7 +49,6 @@
|
||||||
(def database-management-enabled? (enabled? (get-config :DATABASE_MANAGEMENT_ENABLED "0")))
|
(def database-management-enabled? (enabled? (get-config :DATABASE_MANAGEMENT_ENABLED "0")))
|
||||||
(def debug-webview? (enabled? (get-config :DEBUG_WEBVIEW "0")))
|
(def debug-webview? (enabled? (get-config :DEBUG_WEBVIEW "0")))
|
||||||
(def metrics-enabled? (enabled? (get-config :METRICS_ENABLED "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 delete-message-enabled? (enabled? (get-config :DELETE_MESSAGE_ENABLED "0")))
|
||||||
(def collectibles-enabled? (enabled? (get-config :COLLECTIBLES_ENABLED "1")))
|
(def collectibles-enabled? (enabled? (get-config :COLLECTIBLES_ENABLED "1")))
|
||||||
(def test-stateofus? (enabled? (get-config :TEST_STATEOFUS "0")))
|
(def test-stateofus? (enabled? (get-config :TEST_STATEOFUS "0")))
|
||||||
|
|
Loading…
Reference in New Issue