Skip to content

Commit

Permalink
Add sepolia testnet (#1823)
Browse files Browse the repository at this point in the history
* Add sepolia testnet

* Add testnet flag
  • Loading branch information
hieronx authored Dec 20, 2023
1 parent ab84e59 commit d13b116
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
18 changes: 18 additions & 0 deletions centrifuge-app/src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import baseLogo from '@centrifuge/fabric/assets/logos/base.svg'
import celoLogo from '@centrifuge/fabric/assets/logos/celo.svg'
import ethereumLogo from '@centrifuge/fabric/assets/logos/ethereum.svg'
import goerliLogo from '@centrifuge/fabric/assets/logos/goerli.svg'
import sepoliaLogo from '@centrifuge/fabric/assets/logos/sepolia.png'
import * as React from 'react'
import { HelmetProvider } from 'react-helmet-async'
import { QueryClient, QueryClientProvider } from 'react-query'
Expand Down Expand Up @@ -68,33 +69,46 @@ const baseEvmChains: EvmChains =
1: {
urls: [`https://mainnet.infura.io/v3/${infuraKey}`],
iconUrl: ethereumLogo,
isTestnet: false,
},
}
: {
1: {
urls: [`https://mainnet.infura.io/v3/${infuraKey}`],
iconUrl: ethereumLogo,
isTestnet: false,
},
5: {
urls: [`https://goerli.infura.io/v3/${infuraKey}`],
iconUrl: goerliLogo,
isTestnet: true,
},
}
const evmChains = {
...baseEvmChains,
11155111: {
name: 'Ethereum Sepolia',
nativeCurrency: { name: 'Sepolia Ether', symbol: 'sepETH', decimals: 18 },
blockExplorerUrl: 'https://sepolia.etherscan.io/',
urls: [`https://sepolia.infura.io/v3/${infuraKey}`],
iconUrl: sepoliaLogo,
isTestnet: true,
},
8453: {
name: 'Base',
nativeCurrency: { name: 'Base Ether', symbol: 'bETH', decimals: 18 },
blockExplorerUrl: 'https://basescan.org/',
urls: ['https://mainnet.base.org'],
iconUrl: baseLogo,
isTestnet: false,
},
84531: {
name: 'Base Goerli',
nativeCurrency: { name: 'Base Goerli Ether', symbol: 'gbETH', decimals: 18 },
blockExplorerUrl: 'https://goerli.basescan.org/',
urls: [`https://goerli.base.org`],
iconUrl: baseLogo,
isTestnet: true,
},
42161: {
name: 'Arbitrum One',
Expand All @@ -106,6 +120,7 @@ const evmChains = {
blockExplorerUrl: 'https://arbiscan.io/',
urls: ['https://arb1.arbitrum.io/rpc'],
iconUrl: arbitrumLogo,
isTestnet: false,
},
421613: {
name: 'Arbitrum Goerli',
Expand All @@ -117,6 +132,7 @@ const evmChains = {
blockExplorerUrl: 'https://goerli.arbiscan.io/',
urls: [`https://arbitrum-goerli.infura.io/v3/${infuraKey}`],
iconUrl: arbitrumLogo,
isTestnet: true,
},
42220: {
name: 'Celo',
Expand All @@ -128,6 +144,7 @@ const evmChains = {
blockExplorerUrl: 'https://celoscan.io/',
urls: ['https://forno.celo.org'],
iconUrl: celoLogo,
isTestnet: false,
},
44787: {
name: 'Celo Alfajores',
Expand All @@ -139,6 +156,7 @@ const evmChains = {
blockExplorerUrl: 'https://alfajores.celoscan.io/',
urls: ['https://alfajores-forno.celo-testnet.org'],
iconUrl: celoLogo,
isTestnet: true,
},
}
export function Root() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ const title = {

export function WalletDialog({ evmChains: allEvmChains, showAdvancedAccounts, showTestNets }: Props) {
const evmChains = Object.keys(allEvmChains)
.filter((chain) => (!showTestNets ? !['5', '84531', '421613', '43113', '44787'].includes(chain) : true))
.reduce((obj, key) => {
obj[key] = allEvmChains[key]
.filter((chainId) => (!showTestNets ? !allEvmChains[chainId].isTestnet : true))
.reduce((obj, chainId) => {
obj[chainId] = allEvmChains[chainId]
return obj
}, {}) as EvmChains
const ctx = useWallet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export function WalletProvider({
evmChains: evmChainsProp = {
1: {
urls: ['https://cloudflare-eth.com'],
isTestnet: false,
},
},
evmAdditionalConnectors,
Expand Down
3 changes: 2 additions & 1 deletion centrifuge-react/src/components/WalletProvider/evm/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { AddEthereumChainParameter } from '@web3-react/types'
type BasicChainInformation = {
urls: string[]
iconUrl?: string
isTestnet: boolean
}

type ExtendedChainInformation = BasicChainInformation & {
Expand Down Expand Up @@ -47,7 +48,7 @@ const chainExtendedInfo = {
blockExplorerUrl: 'https://etherscan.io/',
},
5: {
name: 'Görli',
name: 'Ethereum Görli',
nativeCurrency: { name: 'Görli Ether', symbol: 'görETH', decimals: 18 },
blockExplorerUrl: 'https://goerli.etherscan.io/',
},
Expand Down
Binary file added fabric/assets/logos/sepolia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d13b116

Please sign in to comment.