mirror of
https://github.com/status-im/status-react.git
synced 2025-01-23 09:19:59 +00:00
feat: integrate base chain (#21876)
Signed-off-by: Brian Sztamfater <brian@status.im>
This commit is contained in:
parent
ef7d977299
commit
f0e0c95fe0
BIN
resources/images/networks/Base@2x.png
Normal file
BIN
resources/images/networks/Base@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
resources/images/networks/Base@3x.png
Normal file
BIN
resources/images/networks/Base@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@ -37,6 +37,8 @@ SECRETS_ENV_VARS=(
|
||||
'ALCHEMY_ARBITRUM_SEPOLIA_TOKEN'
|
||||
'ALCHEMY_OPTIMISM_MAINNET_TOKEN'
|
||||
'ALCHEMY_OPTIMISM_SEPOLIA_TOKEN'
|
||||
'ALCHEMY_BASE_MAINNET_TOKEN'
|
||||
'ALCHEMY_BASE_SEPOLIA_TOKEN'
|
||||
'RARIBLE_MAINNET_API_KEY'
|
||||
'RARIBLE_TESTNET_API_KEY'
|
||||
'INFURA_TOKEN'
|
||||
|
@ -87,7 +87,9 @@
|
||||
status-im.config/ALCHEMY_ARBITRUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ARBITRUM_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN"
|
||||
status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"}
|
||||
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"
|
||||
status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"}
|
||||
:compiler-options {:output-feature-set :es5
|
||||
;; We disable `:fn-deprecated` warnings because we
|
||||
;; are managing deprecation via clj-kondo and we
|
||||
@ -123,7 +125,9 @@
|
||||
status-im.config/ALCHEMY_ARBITRUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ARBITRUM_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN"
|
||||
status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"}
|
||||
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"
|
||||
status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"}
|
||||
:compiler-options {:output-feature-set :es6
|
||||
;;disable for android build as there
|
||||
;;is an intermittent warning with deftype
|
||||
@ -165,6 +169,8 @@
|
||||
status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN"
|
||||
status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"
|
||||
status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN"
|
||||
status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"
|
||||
status-im.config/WALLET_CONNECT_PROJECT_ID #shadow/env "WALLET_CONNECT_PROJECT_ID"}
|
||||
:compiler-options
|
||||
{;; needed because we override require and it
|
||||
|
@ -30,13 +30,16 @@
|
||||
|
||||
(defn networks
|
||||
[values theme]
|
||||
(let [{:keys [ethereum optimism arbitrum]} values
|
||||
show-optimism? (and optimism
|
||||
(or (pos? (:amount optimism))
|
||||
(= (:amount optimism) "<0.01")))
|
||||
show-arbitrum? (and arbitrum
|
||||
(or (pos? (:amount arbitrum))
|
||||
(= (:amount arbitrum) "<0.01")))]
|
||||
(let [{:keys [ethereum optimism arbitrum base]} values
|
||||
show-optimism? (and optimism
|
||||
(or (pos? (:amount optimism))
|
||||
(= (:amount optimism) "<0.01")))
|
||||
show-arbitrum? (and arbitrum
|
||||
(or (pos? (:amount arbitrum))
|
||||
(= (:amount arbitrum) "<0.01")))
|
||||
show-base? (and base
|
||||
(or (pos? (:amount base))
|
||||
(= (:amount base) "<0.01")))]
|
||||
[rn/view
|
||||
{:style style/networks-container
|
||||
:accessibility-label :networks}
|
||||
@ -56,6 +59,11 @@
|
||||
[network-amount
|
||||
{:network :arbitrum
|
||||
:amount (str (:amount arbitrum) " " (or (:token-symbol arbitrum) "ARB"))
|
||||
:theme theme}])
|
||||
(when show-base?
|
||||
[network-amount
|
||||
{:network :base
|
||||
:amount (str (:amount base) " " (or (:token-symbol base) "ETH"))
|
||||
:theme theme}])]))
|
||||
|
||||
(defn- view-internal
|
||||
|
@ -44,6 +44,7 @@
|
||||
:hermez (js/require "../resources/images/networks/Hermez.png")
|
||||
:optimism (js/require "../resources/images/networks/Optimism.png")
|
||||
:paraswap (js/require "../resources/images/networks/Paraswap.png")
|
||||
:base (js/require "../resources/images/networks/Base.png")
|
||||
:polygon (js/require "../resources/images/networks/Polygon.png")
|
||||
:scroll (js/require "../resources/images/networks/Scroll.png")
|
||||
:taiko (js/require "../resources/images/networks/Taiko.png")
|
||||
|
@ -23,6 +23,8 @@
|
||||
(goog-define ALCHEMY_ARBITRUM_SEPOLIA_TOKEN "")
|
||||
(goog-define ALCHEMY_OPTIMISM_MAINNET_TOKEN "")
|
||||
(goog-define ALCHEMY_OPTIMISM_SEPOLIA_TOKEN "")
|
||||
(goog-define ALCHEMY_BASE_MAINNET_TOKEN "")
|
||||
(goog-define ALCHEMY_BASE_SEPOLIA_TOKEN "")
|
||||
(goog-define WALLET_CONNECT_PROJECT_ID "87815d72a81d739d2a7ce15c2cfdefb3")
|
||||
(goog-define MIXPANEL_APP_ID "3350627")
|
||||
(goog-define MIXPANEL_TOKEN "5c73bda2d36a9f688a5ee45641fb6775")
|
||||
@ -38,9 +40,11 @@
|
||||
(def mainnet-tx-details-base-link "https://etherscan.io/tx")
|
||||
(def optimism-mainnet-tx-details-base-link "https://optimistic.etherscan.io/tx")
|
||||
(def arbitrum-mainnet-tx-details-base-link "https://arbiscan.io/tx")
|
||||
(def base-mainnet-tx-details-base-link "https://basescan.org/tx")
|
||||
(def mainnet-sepolia-tx-details-base-link "https://sepolia.etherscan.io/tx")
|
||||
(def optimism-sepolia-tx-details-base-link "https://sepolia-optimistic.etherscan.io/tx")
|
||||
(def arbitrum-sepolia-tx-details-base-link "https://sepolia.arbiscan.io/tx")
|
||||
(def base-sepolia-tx-details-base-link "https://sepolia.basescan.org/tx")
|
||||
(def opensea-link "https://opensea.io")
|
||||
(def opensea-tesnet-link "https://testnets.opensea.io")
|
||||
|
||||
|
@ -396,29 +396,34 @@
|
||||
(def ^:const arbitrum-sepolia-chain-id 421614)
|
||||
(def ^:const optimism-mainnet-chain-id 10)
|
||||
(def ^:const optimism-sepolia-chain-id 11155420)
|
||||
(def ^:const base-mainnet-chain-id 8453)
|
||||
(def ^:const base-sepolia-chain-id 84532)
|
||||
|
||||
(def opensea-url-names
|
||||
{:ethereum "ethereum"
|
||||
:sepolia "sepolia"})
|
||||
|
||||
(def ^:const mainnet-chain-ids
|
||||
#{ethereum-mainnet-chain-id arbitrum-mainnet-chain-id optimism-mainnet-chain-id})
|
||||
#{ethereum-mainnet-chain-id arbitrum-mainnet-chain-id optimism-mainnet-chain-id base-mainnet-chain-id})
|
||||
|
||||
(def ^:const sepolia-chain-ids
|
||||
#{ethereum-sepolia-chain-id arbitrum-sepolia-chain-id optimism-sepolia-chain-id})
|
||||
#{ethereum-sepolia-chain-id arbitrum-sepolia-chain-id optimism-sepolia-chain-id base-sepolia-chain-id})
|
||||
|
||||
(def ^:const mainnet-short-name "eth")
|
||||
(def ^:const ethereum-short-name "eth")
|
||||
(def ^:const optimism-short-name "oeth")
|
||||
(def ^:const arbitrum-short-name "arb1")
|
||||
(def ^:const base-short-name "base")
|
||||
|
||||
(def ^:const mainnet-abbreviated-name "Eth.")
|
||||
(def ^:const optimism-abbreviated-name "Oeth.")
|
||||
(def ^:const arbitrum-abbreviated-name "Arb1.")
|
||||
(def ^:const base-abbreviated-name "Base")
|
||||
|
||||
(def ^:const mainnet-full-name "Mainnet")
|
||||
(def ^:const optimism-full-name "Optimism")
|
||||
(def ^:const arbitrum-full-name "Arbitrum")
|
||||
(def ^:const base-full-name "Base")
|
||||
|
||||
(def ^:const sepolia-full-name "Sepolia")
|
||||
|
||||
@ -426,11 +431,13 @@
|
||||
(def ^:const ethereum-network-name :ethereum)
|
||||
(def ^:const optimism-network-name :optimism)
|
||||
(def ^:const arbitrum-network-name :arbitrum)
|
||||
(def ^:const base-network-name :base)
|
||||
|
||||
(def ^:const layer-1-network 1)
|
||||
(def ^:const layer-2-network 2)
|
||||
|
||||
(def ^:const default-network-names [mainnet-network-name optimism-network-name arbitrum-network-name])
|
||||
(def ^:const default-network-names
|
||||
[mainnet-network-name optimism-network-name arbitrum-network-name base-network-name])
|
||||
|
||||
(def ^:const default-network-count (count default-network-names))
|
||||
|
||||
|
@ -26,7 +26,9 @@
|
||||
:alchemyOptimismMainnetToken config/ALCHEMY_OPTIMISM_MAINNET_TOKEN
|
||||
:alchemyOptimismSepoliaToken config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN
|
||||
:alchemyArbitrumMainnetToken config/ALCHEMY_ARBITRUM_MAINNET_TOKEN
|
||||
:alchemyArbitrumSepoliaToken config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN})
|
||||
:alchemyArbitrumSepoliaToken config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN
|
||||
:alchemyBaseMainnetToken config/ALCHEMY_BASE_MAINNET_TOKEN
|
||||
:alchemyBaseSepoliaToken config/ALCHEMY_BASE_SEPOLIA_TOKEN})
|
||||
|
||||
(defn create
|
||||
[]
|
||||
|
@ -45,6 +45,9 @@
|
||||
[{:details (:optimism networks)
|
||||
:testnet-mode? testnet-mode?
|
||||
:testnet-label (i18n/label :t/sepolia-active)}
|
||||
{:details (:base networks)
|
||||
:testnet-mode? testnet-mode?
|
||||
:testnet-label (i18n/label :t/sepolia-active)}
|
||||
{:details (:arbitrum networks)
|
||||
:testnet-mode? testnet-mode?
|
||||
:testnet-label (i18n/label :t/sepolia-active)}])
|
||||
|
@ -37,6 +37,9 @@
|
||||
constants/optimism-mainnet-chain-id
|
||||
config/optimism-mainnet-tx-details-base-link
|
||||
|
||||
constants/base-mainnet-chain-id
|
||||
config/base-mainnet-tx-details-base-link
|
||||
|
||||
constants/ethereum-sepolia-chain-id
|
||||
config/mainnet-sepolia-tx-details-base-link
|
||||
|
||||
@ -46,6 +49,9 @@
|
||||
constants/optimism-sepolia-chain-id
|
||||
config/optimism-sepolia-tx-details-base-link
|
||||
|
||||
constants/base-sepolia-chain-id
|
||||
config/base-sepolia-tx-details-base-link
|
||||
|
||||
config/mainnet-tx-details-base-link))
|
||||
|
||||
(defn get-link-to-tx-details
|
||||
|
@ -15,7 +15,9 @@
|
||||
constants/optimism-mainnet-chain-id constants/optimism-network-name
|
||||
constants/optimism-sepolia-chain-id constants/optimism-network-name
|
||||
constants/arbitrum-mainnet-chain-id constants/arbitrum-network-name
|
||||
constants/arbitrum-sepolia-chain-id constants/arbitrum-network-name})
|
||||
constants/arbitrum-sepolia-chain-id constants/arbitrum-network-name
|
||||
constants/base-mainnet-chain-id constants/base-network-name
|
||||
constants/base-sepolia-chain-id constants/base-network-name})
|
||||
|
||||
(defn- get-chain-id
|
||||
[{:keys [mainnet-chain-id sepolia-chain-id testnet-enabled?]}]
|
||||
@ -46,6 +48,12 @@
|
||||
(get-chain-id
|
||||
{:mainnet-chain-id constants/arbitrum-mainnet-chain-id
|
||||
:sepolia-chain-id constants/arbitrum-sepolia-chain-id
|
||||
:testnet-enabled? testnet-enabled?})
|
||||
|
||||
#{constants/base-network-name (keyword constants/base-short-name)}
|
||||
(get-chain-id
|
||||
{:mainnet-chain-id constants/base-mainnet-chain-id
|
||||
:sepolia-chain-id constants/base-sepolia-chain-id
|
||||
:testnet-enabled? testnet-enabled?}))))
|
||||
|
||||
(defn network-list
|
||||
@ -76,12 +84,14 @@
|
||||
{constants/mainnet-network-name constants/mainnet-short-name
|
||||
constants/optimism-network-name constants/optimism-short-name
|
||||
constants/arbitrum-network-name constants/arbitrum-short-name
|
||||
constants/ethereum-network-name constants/ethereum-short-name})
|
||||
constants/ethereum-network-name constants/ethereum-short-name
|
||||
constants/base-network-name constants/base-short-name})
|
||||
|
||||
(def short-name->network
|
||||
{constants/mainnet-short-name constants/mainnet-network-name
|
||||
constants/optimism-short-name constants/optimism-network-name
|
||||
constants/arbitrum-short-name constants/arbitrum-network-name})
|
||||
constants/arbitrum-short-name constants/arbitrum-network-name
|
||||
constants/base-short-name constants/base-network-name})
|
||||
|
||||
(defn short-names->network-preference-prefix
|
||||
[short-names]
|
||||
@ -152,6 +162,15 @@
|
||||
:view-on-block-explorer-label :t/view-on-oeth
|
||||
:link-to-block-explorer-label :t/share-link-to-oeth})
|
||||
|
||||
(def base-network-details
|
||||
{:source (resources/get-network constants/base-network-name)
|
||||
:short-name constants/base-short-name
|
||||
:full-name constants/base-full-name
|
||||
:network-name constants/base-network-name
|
||||
:abbreviated-name constants/base-abbreviated-name
|
||||
:view-on-block-explorer-label :t/view-on-base
|
||||
:link-to-block-explorer-label :t/share-link-to-base})
|
||||
|
||||
(defn get-network-details
|
||||
[chain-id]
|
||||
(as-> chain-id $
|
||||
@ -165,6 +184,9 @@
|
||||
#{constants/optimism-mainnet-chain-id constants/optimism-sepolia-chain-id}
|
||||
optimism-network-details
|
||||
|
||||
#{constants/base-mainnet-chain-id constants/base-sepolia-chain-id}
|
||||
base-network-details
|
||||
|
||||
nil)
|
||||
(when $
|
||||
(assoc $ :chain-id chain-id))))
|
||||
|
@ -135,7 +135,8 @@
|
||||
(def ^:private network-priority-score
|
||||
{:ethereum 1
|
||||
:optimism 2
|
||||
:arbitrum 3})
|
||||
:arbitrum 3
|
||||
:base 4})
|
||||
|
||||
(defn reset-loading-network-amounts-to-zero
|
||||
[network-amounts]
|
||||
|
@ -279,9 +279,7 @@
|
||||
(fn [{:keys [db]} [{:keys [sent-transactions swap-data approval-transaction?]}]]
|
||||
(let [wallet-transactions (get-in db [:wallet :transactions] {})
|
||||
transactions (utils/transactions->hash-to-transaction-map sent-transactions)
|
||||
transaction-ids (->> transactions
|
||||
vals
|
||||
(map :hash))
|
||||
transaction-ids (keys transactions)
|
||||
transaction-id (first transaction-ids)
|
||||
transaction-details (cond-> transactions
|
||||
:always (assoc-in [transaction-id :tx-type] :swap)
|
||||
|
@ -840,7 +840,7 @@
|
||||
(swap! rf-db/app-db #(assoc % :wallet db/defaults))
|
||||
(is
|
||||
(match? (sort [constants/ethereum-mainnet-chain-id constants/arbitrum-mainnet-chain-id
|
||||
constants/optimism-mainnet-chain-id])
|
||||
constants/optimism-mainnet-chain-id constants/base-mainnet-chain-id])
|
||||
(sort (rf/sub [sub-name])))))
|
||||
(testing "selected networks -> chain-ids - specific network"
|
||||
(swap! rf-db/app-db #(assoc-in %
|
||||
|
@ -54,9 +54,11 @@
|
||||
(is (some #(= constants/ethereum-mainnet-chain-id (get-in % [:Prod :chainId])) response))
|
||||
(is (some #(= constants/optimism-mainnet-chain-id (get-in % [:Prod :chainId])) response))
|
||||
(is (some #(= constants/arbitrum-mainnet-chain-id (get-in % [:Prod :chainId])) response))
|
||||
(is (some #(= constants/base-mainnet-chain-id (get-in % [:Prod :chainId])) response))
|
||||
(is (some #(= constants/ethereum-sepolia-chain-id (get-in % [:Test :chainId])) response))
|
||||
(is (some #(= constants/arbitrum-sepolia-chain-id (get-in % [:Test :chainId])) response))
|
||||
(is (some #(= constants/optimism-sepolia-chain-id (get-in % [:Test :chainId])) response)))
|
||||
(is (some #(= constants/optimism-sepolia-chain-id (get-in % [:Test :chainId])) response))
|
||||
(is (some #(= constants/base-sepolia-chain-id (get-in % [:Test :chainId])) response)))
|
||||
|
||||
(deftest accounts-get-chains-contract-test
|
||||
(h/test-async :contract/wallet_get-ethereum-chains
|
||||
|
@ -13,7 +13,8 @@
|
||||
:bsc-testnet {:id BSC-testnet-chain-id
|
||||
:name "BSC testnet"}
|
||||
:arbitrum {:id 42161 :name "Arbitrum"}
|
||||
:optimism {:id 10 :name "Optimism"}})
|
||||
:optimism {:id 10 :name "Optimism"}
|
||||
:base {:id 8453 :name "Base"}})
|
||||
|
||||
(defn chain-id->chain-keyword
|
||||
[i]
|
||||
|
@ -3,7 +3,7 @@
|
||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v9.0.0",
|
||||
"commit-sha1": "59caca61960752c464cf21de99103c8649dfb0c5",
|
||||
"src-sha256": "008qmdkgf9vxpz0q57his9wmlkahykcnyrq6qbcpjqfvk55cq5gr"
|
||||
"version": "v9.1.0",
|
||||
"commit-sha1": "4ec885a91f2857a30d1838213000f0a5a91fd52a",
|
||||
"src-sha256": "1fkvhazv7v2vyqpffx3r4p3aii5ai464nx2pdfgn6b6gmb24bxdq"
|
||||
}
|
||||
|
@ -195,6 +195,7 @@
|
||||
"backup-through-waku": "Backup through waku",
|
||||
"bad-fees-description": "Your priority fee is below our suggested parameters.",
|
||||
"balance": "Balance",
|
||||
"base": "Base",
|
||||
"be-safe-with-secure-cold-wallet": "Be safe with secure cold wallet",
|
||||
"begin-set-up": "Begin setup",
|
||||
"below-base-fee": "max fee below base fee",
|
||||
@ -2390,6 +2391,7 @@
|
||||
"share-invite-link": "Share an invite link",
|
||||
"share-link": "Share link",
|
||||
"share-link-to-arb": "Share link to Arbiscan",
|
||||
"share-link-to-base": "Share link to Basescan",
|
||||
"share-link-to-eth": "Share link to Etherscan",
|
||||
"share-link-to-oeth": "Share link to Optimism Explorer",
|
||||
"share-logs": "Share logs",
|
||||
@ -2818,6 +2820,7 @@
|
||||
"view-gitcoin": "View in Gitcoin",
|
||||
"view-members": "View members",
|
||||
"view-on-arb": "View on Arbiscan",
|
||||
"view-on-base": "View on Basescan",
|
||||
"view-on-eth": "View on Etherscan",
|
||||
"view-on-oeth": "View on Optimism Explorer",
|
||||
"view-on-opensea": "View on OpenSea",
|
||||
|
Loading…
x
Reference in New Issue
Block a user