🔗 Enable explorer links in wallet->about (#18406)

This commit is contained in:
Shivek Khurana 2024-01-08 12:00:41 +00:00 committed by GitHub
parent 5915dd42bd
commit b3a2f397f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 5 deletions

View File

@ -19,6 +19,9 @@
(def mainnet-rpc-url (str "https://eth-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN)) (def mainnet-rpc-url (str "https://eth-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN))
(def goerli-rpc-url (str "https://goerli-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN)) (def goerli-rpc-url (str "https://goerli-archival.gateway.pokt.network/v1/lb/" POKT_TOKEN))
(def mainnet-chain-explorer-link "https://etherscan.io/address/")
(def optimism-mainnet-chain-explorer-link "https://optimistic.etherscan.io/address/")
(def arbitrum-mainnet-chain-explorer-link "https://arbiscan.io/address/")
(def opensea-api-key OPENSEA_API_KEY) (def opensea-api-key OPENSEA_API_KEY)
(def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1"))) (def bootnodes-settings-enabled? (enabled? (get-config :BOOTNODES_SETTINGS_ENABLED "1")))
(def mailserver-confirmations-enabled? (enabled? (get-config :MAILSERVER_CONFIRMATIONS_ENABLED))) (def mailserver-confirmations-enabled? (enabled? (get-config :MAILSERVER_CONFIRMATIONS_ENABLED)))
@ -91,7 +94,7 @@
(def mainnet-networks (def mainnet-networks
[{:id "mainnet_rpc" [{:id "mainnet_rpc"
:chain-explorer-link "https://etherscan.io/address/" :chain-explorer-link mainnet-chain-explorer-link
:name "Mainnet with upstream RPC" :name "Mainnet with upstream RPC"
:config {:NetworkId (chain/chain-keyword->chain-id :mainnet) :config {:NetworkId (chain/chain-keyword->chain-id :mainnet)
:DataDir "/ethereum/mainnet_rpc" :DataDir "/ethereum/mainnet_rpc"

View File

@ -5,6 +5,7 @@
[react-native.core :as rn] [react-native.core :as rn]
[react-native.platform :as platform] [react-native.platform :as platform]
[react-native.share :as share] [react-native.share :as share]
[status-im.config :as config]
[status-im.contexts.profile.utils :as profile.utils] [status-im.contexts.profile.utils :as profile.utils]
[status-im.contexts.wallet.account.tabs.about.style :as style] [status-im.contexts.wallet.account.tabs.about.style :as style]
[utils.i18n :as i18n] [utils.i18n :as i18n]
@ -18,15 +19,27 @@
[[{:icon :i/link [[{:icon :i/link
:accessibility-label :view-on-eth :accessibility-label :view-on-eth
:label (i18n/label :t/view-on-eth) :label (i18n/label :t/view-on-eth)
:right-icon :i/external} :right-icon :i/external
:on-press #(rf/dispatch
[:wallet/navigate-to-chain-explorer-from-bottom-sheet
config/mainnet-chain-explorer-link
address])}
{:icon :i/link {:icon :i/link
:accessibility-label :view-on-opt :accessibility-label :view-on-opt
:label (i18n/label :t/view-on-opt) :label (i18n/label :t/view-on-opt)
:right-icon :i/external} :right-icon :i/external
:on-press #(rf/dispatch
[:wallet/navigate-to-chain-explorer-from-bottom-sheet
config/optimism-mainnet-chain-explorer-link
address])}
{:icon :i/link {:icon :i/link
:accessibility-label :view-on-arb :accessibility-label :view-on-arb
:label (i18n/label :t/view-on-arb) :label (i18n/label :t/view-on-arb)
:right-icon :i/external} :right-icon :i/external
:on-press #(rf/dispatch
[:wallet/navigate-to-chain-explorer-from-bottom-sheet
config/arbitrum-mainnet-chain-explorer-link
address])}
{:icon :i/copy {:icon :i/copy
:accessibility-label :copy-address :accessibility-label :copy-address
:label (i18n/label :t/copy-address) :label (i18n/label :t/copy-address)

View File

@ -321,3 +321,9 @@
:on-error #(log/info "failed to get address details" :on-error #(log/info "failed to get address details"
{:error % {:error %
:event :wallet/get-address-details})}]]]})) :event :wallet/get-address-details})}]]]}))
(rf/reg-event-fx
:wallet/navigate-to-chain-explorer-from-bottom-sheet
(fn [_ [explorer-link address]]
{:fx [[:dispatch [:hide-bottom-sheet]]
[:dispatch [:browser.ui/open-url (str explorer-link "/" address)]]]}))

View File

@ -11,7 +11,9 @@
:bsc {:id BSC-mainnet-chain-id :bsc {:id BSC-mainnet-chain-id
:name "BSC"} :name "BSC"}
:bsc-testnet {:id BSC-testnet-chain-id :bsc-testnet {:id BSC-testnet-chain-id
:name "BSC tetnet"}}) :name "BSC testnet"}
:arbitrum {:id 42161 :name "Arbitrum"}
:optimism {:id 10 :name "Optimism"}})
(defn chain-id->chain-keyword (defn chain-id->chain-keyword
[i] [i]