Skip to content

Commit f0e0c95

Browse files
feat: integrate base chain (#21876)
Signed-off-by: Brian Sztamfater <[email protected]>
1 parent ef7d977 commit f0e0c95

File tree

19 files changed

+92
-26
lines changed

19 files changed

+92
-26
lines changed
2.73 KB
Loading
4.17 KB
Loading

scripts/build-android.sh

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ SECRETS_ENV_VARS=(
3737
'ALCHEMY_ARBITRUM_SEPOLIA_TOKEN'
3838
'ALCHEMY_OPTIMISM_MAINNET_TOKEN'
3939
'ALCHEMY_OPTIMISM_SEPOLIA_TOKEN'
40+
'ALCHEMY_BASE_MAINNET_TOKEN'
41+
'ALCHEMY_BASE_SEPOLIA_TOKEN'
4042
'RARIBLE_MAINNET_API_KEY'
4143
'RARIBLE_TESTNET_API_KEY'
4244
'INFURA_TOKEN'

shadow-cljs.edn

+8-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@
8787
status-im.config/ALCHEMY_ARBITRUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ARBITRUM_MAINNET_TOKEN"
8888
status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN"
8989
status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN"
90-
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"}
90+
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"
91+
status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN"
92+
status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"}
9193
:compiler-options {:output-feature-set :es5
9294
;; We disable `:fn-deprecated` warnings because we
9395
;; are managing deprecation via clj-kondo and we
@@ -123,7 +125,9 @@
123125
status-im.config/ALCHEMY_ARBITRUM_MAINNET_TOKEN #shadow/env "ALCHEMY_ARBITRUM_MAINNET_TOKEN"
124126
status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN"
125127
status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN"
126-
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"}
128+
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"
129+
status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN"
130+
status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"}
127131
:compiler-options {:output-feature-set :es6
128132
;;disable for android build as there
129133
;;is an intermittent warning with deftype
@@ -165,6 +169,8 @@
165169
status-im.config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_ARBITRUM_SEPOLIA_TOKEN"
166170
status-im.config/ALCHEMY_OPTIMISM_MAINNET_TOKEN #shadow/env "ALCHEMY_OPTIMISM_MAINNET_TOKEN"
167171
status-im.config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN #shadow/env "ALCHEMY_OPTIMISM_SEPOLIA_TOKEN"
172+
status-im.config/ALCHEMY_BASE_MAINNET_TOKEN #shadow/env "ALCHEMY_BASE_MAINNET_TOKEN"
173+
status-im.config/ALCHEMY_BASE_SEPOLIA_TOKEN #shadow/env "ALCHEMY_BASE_SEPOLIA_TOKEN"
168174
status-im.config/WALLET_CONNECT_PROJECT_ID #shadow/env "WALLET_CONNECT_PROJECT_ID"}
169175
:compiler-options
170176
{;; needed because we override require and it

src/quo/components/wallet/summary_info/view.cljs

+15-7
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@
3030

3131
(defn networks
3232
[values theme]
33-
(let [{:keys [ethereum optimism arbitrum]} values
34-
show-optimism? (and optimism
35-
(or (pos? (:amount optimism))
36-
(= (:amount optimism) "<0.01")))
37-
show-arbitrum? (and arbitrum
38-
(or (pos? (:amount arbitrum))
39-
(= (:amount arbitrum) "<0.01")))]
33+
(let [{:keys [ethereum optimism arbitrum base]} values
34+
show-optimism? (and optimism
35+
(or (pos? (:amount optimism))
36+
(= (:amount optimism) "<0.01")))
37+
show-arbitrum? (and arbitrum
38+
(or (pos? (:amount arbitrum))
39+
(= (:amount arbitrum) "<0.01")))
40+
show-base? (and base
41+
(or (pos? (:amount base))
42+
(= (:amount base) "<0.01")))]
4043
[rn/view
4144
{:style style/networks-container
4245
:accessibility-label :networks}
@@ -56,6 +59,11 @@
5659
[network-amount
5760
{:network :arbitrum
5861
:amount (str (:amount arbitrum) " " (or (:token-symbol arbitrum) "ARB"))
62+
:theme theme}])
63+
(when show-base?
64+
[network-amount
65+
{:network :base
66+
:amount (str (:amount base) " " (or (:token-symbol base) "ETH"))
5967
:theme theme}])]))
6068

6169
(defn- view-internal

src/quo/foundations/resources.cljs

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
:hermez (js/require "../resources/images/networks/Hermez.png")
4545
:optimism (js/require "../resources/images/networks/Optimism.png")
4646
:paraswap (js/require "../resources/images/networks/Paraswap.png")
47+
:base (js/require "../resources/images/networks/Base.png")
4748
:polygon (js/require "../resources/images/networks/Polygon.png")
4849
:scroll (js/require "../resources/images/networks/Scroll.png")
4950
:taiko (js/require "../resources/images/networks/Taiko.png")

src/status_im/config.cljs

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
(goog-define ALCHEMY_ARBITRUM_SEPOLIA_TOKEN "")
2424
(goog-define ALCHEMY_OPTIMISM_MAINNET_TOKEN "")
2525
(goog-define ALCHEMY_OPTIMISM_SEPOLIA_TOKEN "")
26+
(goog-define ALCHEMY_BASE_MAINNET_TOKEN "")
27+
(goog-define ALCHEMY_BASE_SEPOLIA_TOKEN "")
2628
(goog-define WALLET_CONNECT_PROJECT_ID "87815d72a81d739d2a7ce15c2cfdefb3")
2729
(goog-define MIXPANEL_APP_ID "3350627")
2830
(goog-define MIXPANEL_TOKEN "5c73bda2d36a9f688a5ee45641fb6775")
@@ -38,9 +40,11 @@
3840
(def mainnet-tx-details-base-link "https://etherscan.io/tx")
3941
(def optimism-mainnet-tx-details-base-link "https://optimistic.etherscan.io/tx")
4042
(def arbitrum-mainnet-tx-details-base-link "https://arbiscan.io/tx")
43+
(def base-mainnet-tx-details-base-link "https://basescan.org/tx")
4144
(def mainnet-sepolia-tx-details-base-link "https://sepolia.etherscan.io/tx")
4245
(def optimism-sepolia-tx-details-base-link "https://sepolia-optimistic.etherscan.io/tx")
4346
(def arbitrum-sepolia-tx-details-base-link "https://sepolia.arbiscan.io/tx")
47+
(def base-sepolia-tx-details-base-link "https://sepolia.basescan.org/tx")
4448
(def opensea-link "https://opensea.io")
4549
(def opensea-tesnet-link "https://testnets.opensea.io")
4650

src/status_im/constants.cljs

+10-3
Original file line numberDiff line numberDiff line change
@@ -396,41 +396,48 @@
396396
(def ^:const arbitrum-sepolia-chain-id 421614)
397397
(def ^:const optimism-mainnet-chain-id 10)
398398
(def ^:const optimism-sepolia-chain-id 11155420)
399+
(def ^:const base-mainnet-chain-id 8453)
400+
(def ^:const base-sepolia-chain-id 84532)
399401

400402
(def opensea-url-names
401403
{:ethereum "ethereum"
402404
:sepolia "sepolia"})
403405

404406
(def ^:const mainnet-chain-ids
405-
#{ethereum-mainnet-chain-id arbitrum-mainnet-chain-id optimism-mainnet-chain-id})
407+
#{ethereum-mainnet-chain-id arbitrum-mainnet-chain-id optimism-mainnet-chain-id base-mainnet-chain-id})
406408

407409
(def ^:const sepolia-chain-ids
408-
#{ethereum-sepolia-chain-id arbitrum-sepolia-chain-id optimism-sepolia-chain-id})
410+
#{ethereum-sepolia-chain-id arbitrum-sepolia-chain-id optimism-sepolia-chain-id base-sepolia-chain-id})
409411

410412
(def ^:const mainnet-short-name "eth")
411413
(def ^:const ethereum-short-name "eth")
412414
(def ^:const optimism-short-name "oeth")
413415
(def ^:const arbitrum-short-name "arb1")
416+
(def ^:const base-short-name "base")
414417

415418
(def ^:const mainnet-abbreviated-name "Eth.")
416419
(def ^:const optimism-abbreviated-name "Oeth.")
417420
(def ^:const arbitrum-abbreviated-name "Arb1.")
421+
(def ^:const base-abbreviated-name "Base")
418422

419423
(def ^:const mainnet-full-name "Mainnet")
420424
(def ^:const optimism-full-name "Optimism")
421425
(def ^:const arbitrum-full-name "Arbitrum")
426+
(def ^:const base-full-name "Base")
422427

423428
(def ^:const sepolia-full-name "Sepolia")
424429

425430
(def ^:const mainnet-network-name :mainnet)
426431
(def ^:const ethereum-network-name :ethereum)
427432
(def ^:const optimism-network-name :optimism)
428433
(def ^:const arbitrum-network-name :arbitrum)
434+
(def ^:const base-network-name :base)
429435

430436
(def ^:const layer-1-network 1)
431437
(def ^:const layer-2-network 2)
432438

433-
(def ^:const default-network-names [mainnet-network-name optimism-network-name arbitrum-network-name])
439+
(def ^:const default-network-names
440+
[mainnet-network-name optimism-network-name arbitrum-network-name base-network-name])
434441

435442
(def ^:const default-network-count (count default-network-names))
436443

src/status_im/contexts/profile/config.cljs

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
:alchemyOptimismMainnetToken config/ALCHEMY_OPTIMISM_MAINNET_TOKEN
2727
:alchemyOptimismSepoliaToken config/ALCHEMY_OPTIMISM_SEPOLIA_TOKEN
2828
:alchemyArbitrumMainnetToken config/ALCHEMY_ARBITRUM_MAINNET_TOKEN
29-
:alchemyArbitrumSepoliaToken config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN})
29+
:alchemyArbitrumSepoliaToken config/ALCHEMY_ARBITRUM_SEPOLIA_TOKEN
30+
:alchemyBaseMainnetToken config/ALCHEMY_BASE_MAINNET_TOKEN
31+
:alchemyBaseSepoliaToken config/ALCHEMY_BASE_SEPOLIA_TOKEN})
3032

3133
(defn create
3234
[]

src/status_im/contexts/settings/wallet/network_settings/view.cljs

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
[{:details (:optimism networks)
4646
:testnet-mode? testnet-mode?
4747
:testnet-label (i18n/label :t/sepolia-active)}
48+
{:details (:base networks)
49+
:testnet-mode? testnet-mode?
50+
:testnet-label (i18n/label :t/sepolia-active)}
4851
{:details (:arbitrum networks)
4952
:testnet-mode? testnet-mode?
5053
:testnet-label (i18n/label :t/sepolia-active)}])

src/status_im/contexts/wallet/common/utils/external_links.cljs

+6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
constants/optimism-mainnet-chain-id
3838
config/optimism-mainnet-tx-details-base-link
3939

40+
constants/base-mainnet-chain-id
41+
config/base-mainnet-tx-details-base-link
42+
4043
constants/ethereum-sepolia-chain-id
4144
config/mainnet-sepolia-tx-details-base-link
4245

@@ -46,6 +49,9 @@
4649
constants/optimism-sepolia-chain-id
4750
config/optimism-sepolia-tx-details-base-link
4851

52+
constants/base-sepolia-chain-id
53+
config/base-sepolia-tx-details-base-link
54+
4955
config/mainnet-tx-details-base-link))
5056

5157
(defn get-link-to-tx-details

src/status_im/contexts/wallet/common/utils/networks.cljs

+25-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
constants/optimism-mainnet-chain-id constants/optimism-network-name
1616
constants/optimism-sepolia-chain-id constants/optimism-network-name
1717
constants/arbitrum-mainnet-chain-id constants/arbitrum-network-name
18-
constants/arbitrum-sepolia-chain-id constants/arbitrum-network-name})
18+
constants/arbitrum-sepolia-chain-id constants/arbitrum-network-name
19+
constants/base-mainnet-chain-id constants/base-network-name
20+
constants/base-sepolia-chain-id constants/base-network-name})
1921

2022
(defn- get-chain-id
2123
[{:keys [mainnet-chain-id sepolia-chain-id testnet-enabled?]}]
@@ -46,6 +48,12 @@
4648
(get-chain-id
4749
{:mainnet-chain-id constants/arbitrum-mainnet-chain-id
4850
:sepolia-chain-id constants/arbitrum-sepolia-chain-id
51+
:testnet-enabled? testnet-enabled?})
52+
53+
#{constants/base-network-name (keyword constants/base-short-name)}
54+
(get-chain-id
55+
{:mainnet-chain-id constants/base-mainnet-chain-id
56+
:sepolia-chain-id constants/base-sepolia-chain-id
4957
:testnet-enabled? testnet-enabled?}))))
5058

5159
(defn network-list
@@ -76,12 +84,14 @@
7684
{constants/mainnet-network-name constants/mainnet-short-name
7785
constants/optimism-network-name constants/optimism-short-name
7886
constants/arbitrum-network-name constants/arbitrum-short-name
79-
constants/ethereum-network-name constants/ethereum-short-name})
87+
constants/ethereum-network-name constants/ethereum-short-name
88+
constants/base-network-name constants/base-short-name})
8089

8190
(def short-name->network
8291
{constants/mainnet-short-name constants/mainnet-network-name
8392
constants/optimism-short-name constants/optimism-network-name
84-
constants/arbitrum-short-name constants/arbitrum-network-name})
93+
constants/arbitrum-short-name constants/arbitrum-network-name
94+
constants/base-short-name constants/base-network-name})
8595

8696
(defn short-names->network-preference-prefix
8797
[short-names]
@@ -152,6 +162,15 @@
152162
:view-on-block-explorer-label :t/view-on-oeth
153163
:link-to-block-explorer-label :t/share-link-to-oeth})
154164

165+
(def base-network-details
166+
{:source (resources/get-network constants/base-network-name)
167+
:short-name constants/base-short-name
168+
:full-name constants/base-full-name
169+
:network-name constants/base-network-name
170+
:abbreviated-name constants/base-abbreviated-name
171+
:view-on-block-explorer-label :t/view-on-base
172+
:link-to-block-explorer-label :t/share-link-to-base})
173+
155174
(defn get-network-details
156175
[chain-id]
157176
(as-> chain-id $
@@ -165,6 +184,9 @@
165184
#{constants/optimism-mainnet-chain-id constants/optimism-sepolia-chain-id}
166185
optimism-network-details
167186

187+
#{constants/base-mainnet-chain-id constants/base-sepolia-chain-id}
188+
base-network-details
189+
168190
nil)
169191
(when $
170192
(assoc $ :chain-id chain-id))))

src/status_im/contexts/wallet/send/utils.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@
135135
(def ^:private network-priority-score
136136
{:ethereum 1
137137
:optimism 2
138-
:arbitrum 3})
138+
:arbitrum 3
139+
:base 4})
139140

140141
(defn reset-loading-network-amounts-to-zero
141142
[network-amounts]

src/status_im/contexts/wallet/swap/events.cljs

+1-3
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,7 @@
279279
(fn [{:keys [db]} [{:keys [sent-transactions swap-data approval-transaction?]}]]
280280
(let [wallet-transactions (get-in db [:wallet :transactions] {})
281281
transactions (utils/transactions->hash-to-transaction-map sent-transactions)
282-
transaction-ids (->> transactions
283-
vals
284-
(map :hash))
282+
transaction-ids (keys transactions)
285283
transaction-id (first transaction-ids)
286284
transaction-details (cond-> transactions
287285
:always (assoc-in [transaction-id :tx-type] :swap)

src/status_im/subs/wallet/wallet_test.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@
840840
(swap! rf-db/app-db #(assoc % :wallet db/defaults))
841841
(is
842842
(match? (sort [constants/ethereum-mainnet-chain-id constants/arbitrum-mainnet-chain-id
843-
constants/optimism-mainnet-chain-id])
843+
constants/optimism-mainnet-chain-id constants/base-mainnet-chain-id])
844844
(sort (rf/sub [sub-name])))))
845845
(testing "selected networks -> chain-ids - specific network"
846846
(swap! rf-db/app-db #(assoc-in %

src/tests/contract_test/wallet_test.cljs

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@
5454
(is (some #(= constants/ethereum-mainnet-chain-id (get-in % [:Prod :chainId])) response))
5555
(is (some #(= constants/optimism-mainnet-chain-id (get-in % [:Prod :chainId])) response))
5656
(is (some #(= constants/arbitrum-mainnet-chain-id (get-in % [:Prod :chainId])) response))
57+
(is (some #(= constants/base-mainnet-chain-id (get-in % [:Prod :chainId])) response))
5758
(is (some #(= constants/ethereum-sepolia-chain-id (get-in % [:Test :chainId])) response))
5859
(is (some #(= constants/arbitrum-sepolia-chain-id (get-in % [:Test :chainId])) response))
59-
(is (some #(= constants/optimism-sepolia-chain-id (get-in % [:Test :chainId])) response)))
60+
(is (some #(= constants/optimism-sepolia-chain-id (get-in % [:Test :chainId])) response))
61+
(is (some #(= constants/base-sepolia-chain-id (get-in % [:Test :chainId])) response)))
6062

6163
(deftest accounts-get-chains-contract-test
6264
(h/test-async :contract/wallet_get-ethereum-chains

src/utils/ethereum/chain.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
:bsc-testnet {:id BSC-testnet-chain-id
1414
:name "BSC testnet"}
1515
:arbitrum {:id 42161 :name "Arbitrum"}
16-
:optimism {:id 10 :name "Optimism"}})
16+
:optimism {:id 10 :name "Optimism"}
17+
:base {:id 8453 :name "Base"}})
1718

1819
(defn chain-id->chain-keyword
1920
[i]

status-go-version.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
44
"owner": "status-im",
55
"repo": "status-go",
6-
"version": "v9.0.0",
7-
"commit-sha1": "59caca61960752c464cf21de99103c8649dfb0c5",
8-
"src-sha256": "008qmdkgf9vxpz0q57his9wmlkahykcnyrq6qbcpjqfvk55cq5gr"
6+
"version": "v9.1.0",
7+
"commit-sha1": "4ec885a91f2857a30d1838213000f0a5a91fd52a",
8+
"src-sha256": "1fkvhazv7v2vyqpffx3r4p3aii5ai464nx2pdfgn6b6gmb24bxdq"
99
}

translations/en.json

+3
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
"backup-through-waku": "Backup through waku",
196196
"bad-fees-description": "Your priority fee is below our suggested parameters.",
197197
"balance": "Balance",
198+
"base": "Base",
198199
"be-safe-with-secure-cold-wallet": "Be safe with secure cold wallet",
199200
"begin-set-up": "Begin setup",
200201
"below-base-fee": "max fee below base fee",
@@ -2390,6 +2391,7 @@
23902391
"share-invite-link": "Share an invite link",
23912392
"share-link": "Share link",
23922393
"share-link-to-arb": "Share link to Arbiscan",
2394+
"share-link-to-base": "Share link to Basescan",
23932395
"share-link-to-eth": "Share link to Etherscan",
23942396
"share-link-to-oeth": "Share link to Optimism Explorer",
23952397
"share-logs": "Share logs",
@@ -2818,6 +2820,7 @@
28182820
"view-gitcoin": "View in Gitcoin",
28192821
"view-members": "View members",
28202822
"view-on-arb": "View on Arbiscan",
2823+
"view-on-base": "View on Basescan",
28212824
"view-on-eth": "View on Etherscan",
28222825
"view-on-oeth": "View on Optimism Explorer",
28232826
"view-on-opensea": "View on OpenSea",

0 commit comments

Comments
 (0)