Commit bed144b9 authored by eddie's avatar eddie Committed by GitHub

fix: remove base goerli from chain selector (#7238)

* fix: remove base goerli from chain selector

* fix: remove all base goerli references

* fix: typecheck
parent dac334f9
...@@ -4,7 +4,6 @@ REACT_APP_AMPLITUDE_PROXY_URL="https://api.uniswap.org/v1/amplitude-proxy" ...@@ -4,7 +4,6 @@ REACT_APP_AMPLITUDE_PROXY_URL="https://api.uniswap.org/v1/amplitude-proxy"
REACT_APP_AWS_API_REGION="us-east-2" REACT_APP_AWS_API_REGION="us-east-2"
REACT_APP_AWS_API_ENDPOINT="https://beta.api.uniswap.org/v1/graphql" REACT_APP_AWS_API_ENDPOINT="https://beta.api.uniswap.org/v1/graphql"
REACT_APP_BNB_RPC_URL="https://rough-sleek-hill.bsc.quiknode.pro/413cc98cbc776cda8fdf1d0f47003583ff73d9bf" REACT_APP_BNB_RPC_URL="https://rough-sleek-hill.bsc.quiknode.pro/413cc98cbc776cda8fdf1d0f47003583ff73d9bf"
REACT_APP_BASE_GOERLI_RPC_URL="https://wiser-compatible-mansion.base-goerli.quiknode.pro/5874f36248e17020a1006149e7f68c63967e1f45/"
REACT_APP_BASE_MAINNET_RPC_URL="https://cool-white-diagram.base-mainnet.quiknode.pro/d8f036f35dfab2c68f32dfa822cd971e7a25a117/" REACT_APP_BASE_MAINNET_RPC_URL="https://cool-white-diagram.base-mainnet.quiknode.pro/d8f036f35dfab2c68f32dfa822cd971e7a25a117/"
REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847" REACT_APP_INFURA_KEY="4bf032f2d38a4ed6bb975b80d6340847"
REACT_APP_MOONPAY_API="https://api.moonpay.com" REACT_APP_MOONPAY_API="https://api.moonpay.com"
......
...@@ -21,7 +21,6 @@ export const FEE_AMOUNT_DETAIL: Record< ...@@ -21,7 +21,6 @@ export const FEE_AMOUNT_DETAIL: Record<
ChainId.POLYGON_MUMBAI, ChainId.POLYGON_MUMBAI,
ChainId.AVALANCHE, ChainId.AVALANCHE,
ChainId.BASE, ChainId.BASE,
ChainId.BASE_GOERLI,
], ],
}, },
[FeeAmount.LOW]: { [FeeAmount.LOW]: {
......
...@@ -41,7 +41,6 @@ const SHOULD_SHOW_ALERT = { ...@@ -41,7 +41,6 @@ const SHOULD_SHOW_ALERT = {
[ChainId.BNB]: true, [ChainId.BNB]: true,
[ChainId.AVALANCHE]: true, [ChainId.AVALANCHE]: true,
[ChainId.BASE]: true, [ChainId.BASE]: true,
[ChainId.BASE_GOERLI]: true,
} }
type NetworkAlertChains = keyof typeof SHOULD_SHOW_ALERT type NetworkAlertChains = keyof typeof SHOULD_SHOW_ALERT
...@@ -72,8 +71,6 @@ const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: { ...@@ -72,8 +71,6 @@ const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: {
'radial-gradient(948% 292% at 42% 0%, rgba(255, 58, 212, 0.01) 0%, rgba(255, 255, 255, 0.04) 100%),radial-gradient(98% 96% at 2% 0%, rgba(255, 39, 39, 0.01) 0%, rgba(235, 0, 255, 0.01) 96%)', 'radial-gradient(948% 292% at 42% 0%, rgba(255, 58, 212, 0.01) 0%, rgba(255, 255, 255, 0.04) 100%),radial-gradient(98% 96% at 2% 0%, rgba(255, 39, 39, 0.01) 0%, rgba(235, 0, 255, 0.01) 96%)',
[ChainId.BASE]: [ChainId.BASE]:
'radial-gradient(100% 100% at 50% 0%, rgba(10, 41, 75, 0.7) 0%, rgba(0, 82, 255, .1) 40%, rgba(0, 82, 255, 0) 100%), rgb(13, 14, 14);', 'radial-gradient(100% 100% at 50% 0%, rgba(10, 41, 75, 0.7) 0%, rgba(0, 82, 255, .1) 40%, rgba(0, 82, 255, 0) 100%), rgb(13, 14, 14);',
[ChainId.BASE_GOERLI]:
'radial-gradient(100% 100% at 50% 0%, rgba(10, 41, 75, 0.7) 0%, rgba(0, 82, 255, .1) 40%, rgba(0, 82, 255, 0) 100%), rgb(13, 14, 14);',
}, },
light: { light: {
[ChainId.POLYGON]: [ChainId.POLYGON]:
...@@ -98,8 +95,6 @@ const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: { ...@@ -98,8 +95,6 @@ const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: {
'radial-gradient(92% 105% at 50% 7%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.03) 100%),radial-gradient(100% 97% at 0% 12%, rgba(235, 0, 255, 0.1) 0%, rgba(243, 19, 19, 0.1) 100%), hsla(0, 0%, 100%, 0.1)', 'radial-gradient(92% 105% at 50% 7%, rgba(255, 58, 212, 0.04) 0%, rgba(255, 255, 255, 0.03) 100%),radial-gradient(100% 97% at 0% 12%, rgba(235, 0, 255, 0.1) 0%, rgba(243, 19, 19, 0.1) 100%), hsla(0, 0%, 100%, 0.1)',
[ChainId.BASE]: [ChainId.BASE]:
'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0.20) 0%, rgba(0, 82, 255, 0.08) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)', 'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0.20) 0%, rgba(0, 82, 255, 0.08) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)',
[ChainId.BASE_GOERLI]:
'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0.20) 0%, rgba(0, 82, 255, 0.08) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)',
}, },
} }
...@@ -161,7 +156,6 @@ const TEXT_COLORS: { [chainId in NetworkAlertChains]: string } = { ...@@ -161,7 +156,6 @@ const TEXT_COLORS: { [chainId in NetworkAlertChains]: string } = {
[ChainId.ARBITRUM_GOERLI]: '#0490ed', [ChainId.ARBITRUM_GOERLI]: '#0490ed',
[ChainId.AVALANCHE]: '#ff3856', [ChainId.AVALANCHE]: '#ff3856',
[ChainId.BASE]: colors.networkBase, [ChainId.BASE]: colors.networkBase,
[ChainId.BASE_GOERLI]: colors.networkBase,
} }
function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertChains { function shouldShowAlert(chainId: number | undefined): chainId is NetworkAlertChains {
......
...@@ -259,22 +259,6 @@ const CHAIN_INFO: ChainInfoMap = { ...@@ -259,22 +259,6 @@ const CHAIN_INFO: ChainInfoMap = {
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
color: darkTheme.chain_84531, color: darkTheme.chain_84531,
}, },
[ChainId.BASE_GOERLI]: {
networkType: NetworkType.L2,
blockWaitMsBeforeWarning: ms(`25m`),
bridge: 'https://goerli-bridge.base.org/deposit',
defaultListUrl: BASE_LIST,
docs: 'https://docs.base.org',
explorer: 'https://goerli.basescan.org/',
infoLink: 'https://info.uniswap.org/#/base/', // base testnet not supported
label: 'Base Goerli',
logoUrl: baseLogo,
statusPage: 'https://status.base.org/',
circleLogoUrl: baseLogo,
squareLogoUrl: baseSquareLogo,
nativeCurrency: { name: 'Base Goerli Ether', symbol: 'ETH', decimals: 18 },
color: darkTheme.chain_84531,
},
} as const } as const
export function getChainInfo( export function getChainInfo(
......
...@@ -14,7 +14,6 @@ const chainPriorityTestCases: [ChainId, number][] = [ ...@@ -14,7 +14,6 @@ const chainPriorityTestCases: [ChainId, number][] = [
[ChainId.POLYGON, 3], [ChainId.POLYGON, 3],
[ChainId.POLYGON_MUMBAI, 3], [ChainId.POLYGON_MUMBAI, 3],
[ChainId.BASE, 4], [ChainId.BASE, 4],
[ChainId.BASE_GOERLI, 4],
[ChainId.BNB, 5], [ChainId.BNB, 5],
[ChainId.AVALANCHE, 6], [ChainId.AVALANCHE, 6],
[ChainId.CELO, 7], [ChainId.CELO, 7],
......
...@@ -23,16 +23,18 @@ export const CHAIN_IDS_TO_NAMES = { ...@@ -23,16 +23,18 @@ export const CHAIN_IDS_TO_NAMES = {
[ChainId.BNB]: 'bnb', [ChainId.BNB]: 'bnb',
[ChainId.AVALANCHE]: 'avalanche', [ChainId.AVALANCHE]: 'avalanche',
[ChainId.BASE]: 'base', [ChainId.BASE]: 'base',
[ChainId.BASE_GOERLI]: 'base_goerli',
} as const } as const
// Include ChainIds in this array if they are not supported by the UX yet, but are already in the SDK. // Include ChainIds in this array if they are not supported by the UX yet, but are already in the SDK.
const NOT_YET_UX_SUPPORTED_CHAIN_IDS: number[] = [] const NOT_YET_UX_SUPPORTED_CHAIN_IDS: number[] = [ChainId.BASE_GOERLI]
// TODO: include BASE_GOERLI when routing is implemented
export type SupportedInterfaceChain = Exclude<SupportedChainsType, ChainId.BASE_GOERLI>
export function isSupportedChain( export function isSupportedChain(
chainId: number | null | undefined | ChainId, chainId: number | null | undefined | ChainId,
featureFlags?: Record<number, boolean> featureFlags?: Record<number, boolean>
): chainId is SupportedChainsType { ): chainId is SupportedInterfaceChain {
if (featureFlags && chainId && chainId in featureFlags) { if (featureFlags && chainId && chainId in featureFlags) {
return featureFlags[chainId] return featureFlags[chainId]
} }
...@@ -42,7 +44,7 @@ export function isSupportedChain( ...@@ -42,7 +44,7 @@ export function isSupportedChain(
export function asSupportedChain( export function asSupportedChain(
chainId: number | null | undefined | ChainId, chainId: number | null | undefined | ChainId,
featureFlags?: Record<number, boolean> featureFlags?: Record<number, boolean>
): SupportedChainsType | undefined { ): SupportedInterfaceChain | undefined {
if (!chainId) return undefined if (!chainId) return undefined
if (featureFlags && chainId in featureFlags && !featureFlags[chainId]) { if (featureFlags && chainId in featureFlags && !featureFlags[chainId]) {
return undefined return undefined
...@@ -73,7 +75,6 @@ export const TESTNET_CHAIN_IDS = [ ...@@ -73,7 +75,6 @@ export const TESTNET_CHAIN_IDS = [
ChainId.ARBITRUM_GOERLI, ChainId.ARBITRUM_GOERLI,
ChainId.OPTIMISM_GOERLI, ChainId.OPTIMISM_GOERLI,
ChainId.CELO_ALFAJORES, ChainId.CELO_ALFAJORES,
ChainId.BASE_GOERLI,
] as const ] as const
/** /**
...@@ -103,7 +104,6 @@ export const L2_CHAIN_IDS = [ ...@@ -103,7 +104,6 @@ export const L2_CHAIN_IDS = [
ChainId.OPTIMISM, ChainId.OPTIMISM,
ChainId.OPTIMISM_GOERLI, ChainId.OPTIMISM_GOERLI,
ChainId.BASE, ChainId.BASE,
ChainId.BASE_GOERLI,
] as const ] as const
export type SupportedL2ChainId = (typeof L2_CHAIN_IDS)[number] export type SupportedL2ChainId = (typeof L2_CHAIN_IDS)[number]
...@@ -129,7 +129,6 @@ export function getChainPriority(chainId: ChainId): number { ...@@ -129,7 +129,6 @@ export function getChainPriority(chainId: ChainId): number {
case ChainId.POLYGON_MUMBAI: case ChainId.POLYGON_MUMBAI:
return 3 return 3
case ChainId.BASE: case ChainId.BASE:
case ChainId.BASE_GOERLI:
return 4 return 4
case ChainId.BNB: case ChainId.BNB:
return 5 return 5
......
...@@ -8,10 +8,6 @@ const QUICKNODE_BNB_RPC_URL = process.env.REACT_APP_BNB_RPC_URL ...@@ -8,10 +8,6 @@ const QUICKNODE_BNB_RPC_URL = process.env.REACT_APP_BNB_RPC_URL
if (typeof QUICKNODE_BNB_RPC_URL === 'undefined') { if (typeof QUICKNODE_BNB_RPC_URL === 'undefined') {
throw new Error(`REACT_APP_BNB_RPC_URL must be a defined environment variable`) throw new Error(`REACT_APP_BNB_RPC_URL must be a defined environment variable`)
} }
const QUICKNODE_BASE_GOERLI_RPC_URL = process.env.REACT_APP_BASE_GOERLI_RPC_URL
if (typeof QUICKNODE_BASE_GOERLI_RPC_URL === 'undefined') {
throw new Error(`REACT_APP_BASE_GOERLI_RPC_URL must be a defined environment variable`)
}
const QUICKNODE_BASE_RPC_URL = process.env.REACT_APP_BASE_MAINNET_RPC_URL const QUICKNODE_BASE_RPC_URL = process.env.REACT_APP_BASE_MAINNET_RPC_URL
if (typeof QUICKNODE_BASE_RPC_URL === 'undefined') { if (typeof QUICKNODE_BASE_RPC_URL === 'undefined') {
throw new Error(`REACT_APP_BASE_MAINNET_RPC_URL must be a defined environment variable`) throw new Error(`REACT_APP_BASE_MAINNET_RPC_URL must be a defined environment variable`)
...@@ -121,14 +117,6 @@ export const FALLBACK_URLS = { ...@@ -121,14 +117,6 @@ export const FALLBACK_URLS = {
'https://base-mainnet.blastapi.io/b5a802d8-151d-4443-90a7-699108dc4e01', 'https://base-mainnet.blastapi.io/b5a802d8-151d-4443-90a7-699108dc4e01',
'https://svc.blockdaemon.com/base/mainnet/native?apiKey=zpka_1334e7c450464d06b6e33a972a7a4e57_75320f43', 'https://svc.blockdaemon.com/base/mainnet/native?apiKey=zpka_1334e7c450464d06b6e33a972a7a4e57_75320f43',
], ],
[ChainId.BASE_GOERLI]: [
// "Safe" URLs
'https://goerli.base.org',
// "Unsafe" URLs
QUICKNODE_BASE_GOERLI_RPC_URL,
'https://base-goerli.blastapi.io/b5a802d8-151d-4443-90a7-699108dc4e01',
'https://svc.blockdaemon.com/base/testnet/native?apiKey=zpka_1334e7c450464d06b6e33a972a7a4e57_75320f43',
],
} }
/** /**
...@@ -162,5 +150,4 @@ export const RPC_URLS = { ...@@ -162,5 +150,4 @@ export const RPC_URLS = {
[ChainId.BNB]: [QUICKNODE_BNB_RPC_URL, ...FALLBACK_URLS[ChainId.BNB]], [ChainId.BNB]: [QUICKNODE_BNB_RPC_URL, ...FALLBACK_URLS[ChainId.BNB]],
[ChainId.AVALANCHE]: [`https://avalanche-mainnet.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[ChainId.AVALANCHE]], [ChainId.AVALANCHE]: [`https://avalanche-mainnet.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[ChainId.AVALANCHE]],
[ChainId.BASE]: [`https://base-mainnet.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[ChainId.BASE]], [ChainId.BASE]: [`https://base-mainnet.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[ChainId.BASE]],
[ChainId.BASE_GOERLI]: [`https://base-goerli.infura.io/v3/${INFURA_KEY}`, ...FALLBACK_URLS[ChainId.BASE_GOERLI]],
} }
...@@ -3,10 +3,10 @@ import { deepCopy } from '@ethersproject/properties' ...@@ -3,10 +3,10 @@ import { deepCopy } from '@ethersproject/properties'
// eslint-disable-next-line @typescript-eslint/no-restricted-imports // eslint-disable-next-line @typescript-eslint/no-restricted-imports
import { StaticJsonRpcProvider } from '@ethersproject/providers' import { StaticJsonRpcProvider } from '@ethersproject/providers'
import { isPlain } from '@reduxjs/toolkit' import { isPlain } from '@reduxjs/toolkit'
import { ChainId, SupportedChainsType } from '@uniswap/sdk-core' import { ChainId } from '@uniswap/sdk-core'
import { AVERAGE_L1_BLOCK_TIME } from './chainInfo' import { AVERAGE_L1_BLOCK_TIME } from './chainInfo'
import { CHAIN_IDS_TO_NAMES } from './chains' import { CHAIN_IDS_TO_NAMES, SupportedInterfaceChain } from './chains'
import { RPC_URLS } from './networks' import { RPC_URLS } from './networks'
class AppJsonRpcProvider extends StaticJsonRpcProvider { class AppJsonRpcProvider extends StaticJsonRpcProvider {
...@@ -20,7 +20,7 @@ class AppJsonRpcProvider extends StaticJsonRpcProvider { ...@@ -20,7 +20,7 @@ class AppJsonRpcProvider extends StaticJsonRpcProvider {
return this._blockCache return this._blockCache
} }
constructor(chainId: SupportedChainsType) { constructor(chainId: SupportedInterfaceChain) {
// Including networkish allows ethers to skip the initial detectNetwork call. // Including networkish allows ethers to skip the initial detectNetwork call.
super(RPC_URLS[chainId][0], /* networkish= */ { chainId, name: CHAIN_IDS_TO_NAMES[chainId] }) super(RPC_URLS[chainId][0], /* networkish= */ { chainId, name: CHAIN_IDS_TO_NAMES[chainId] })
...@@ -57,7 +57,7 @@ class AppJsonRpcProvider extends StaticJsonRpcProvider { ...@@ -57,7 +57,7 @@ class AppJsonRpcProvider extends StaticJsonRpcProvider {
/** /**
* These are the only JsonRpcProviders used directly by the interface. * These are the only JsonRpcProviders used directly by the interface.
*/ */
export const RPC_PROVIDERS: { [key in SupportedChainsType]: StaticJsonRpcProvider } = { export const RPC_PROVIDERS: { [key in SupportedInterfaceChain]: StaticJsonRpcProvider } = {
[ChainId.MAINNET]: new AppJsonRpcProvider(ChainId.MAINNET), [ChainId.MAINNET]: new AppJsonRpcProvider(ChainId.MAINNET),
[ChainId.GOERLI]: new AppJsonRpcProvider(ChainId.GOERLI), [ChainId.GOERLI]: new AppJsonRpcProvider(ChainId.GOERLI),
[ChainId.SEPOLIA]: new AppJsonRpcProvider(ChainId.SEPOLIA), [ChainId.SEPOLIA]: new AppJsonRpcProvider(ChainId.SEPOLIA),
...@@ -72,5 +72,4 @@ export const RPC_PROVIDERS: { [key in SupportedChainsType]: StaticJsonRpcProvide ...@@ -72,5 +72,4 @@ export const RPC_PROVIDERS: { [key in SupportedChainsType]: StaticJsonRpcProvide
[ChainId.BNB]: new AppJsonRpcProvider(ChainId.BNB), [ChainId.BNB]: new AppJsonRpcProvider(ChainId.BNB),
[ChainId.AVALANCHE]: new AppJsonRpcProvider(ChainId.AVALANCHE), [ChainId.AVALANCHE]: new AppJsonRpcProvider(ChainId.AVALANCHE),
[ChainId.BASE]: new AppJsonRpcProvider(ChainId.BASE), [ChainId.BASE]: new AppJsonRpcProvider(ChainId.BASE),
[ChainId.BASE_GOERLI]: new AppJsonRpcProvider(ChainId.BASE_GOERLI),
} }
...@@ -90,7 +90,6 @@ export const COMMON_BASES: ChainCurrencyList = { ...@@ -90,7 +90,6 @@ export const COMMON_BASES: ChainCurrencyList = {
[ChainId.OPTIMISM]: [nativeOnChain(ChainId.OPTIMISM), OP, DAI_OPTIMISM, USDC_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM], [ChainId.OPTIMISM]: [nativeOnChain(ChainId.OPTIMISM), OP, DAI_OPTIMISM, USDC_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM],
[ChainId.OPTIMISM_GOERLI]: [nativeOnChain(ChainId.OPTIMISM_GOERLI)], [ChainId.OPTIMISM_GOERLI]: [nativeOnChain(ChainId.OPTIMISM_GOERLI)],
[ChainId.BASE]: [nativeOnChain(ChainId.BASE), WRAPPED_NATIVE_CURRENCY[ChainId.BASE] as Token, USDC_BASE], [ChainId.BASE]: [nativeOnChain(ChainId.BASE), WRAPPED_NATIVE_CURRENCY[ChainId.BASE] as Token, USDC_BASE],
[ChainId.BASE_GOERLI]: [nativeOnChain(ChainId.BASE_GOERLI), WRAPPED_NATIVE_CURRENCY[ChainId.BASE_GOERLI] as Token],
[ChainId.POLYGON]: [ [ChainId.POLYGON]: [
nativeOnChain(ChainId.POLYGON), nativeOnChain(ChainId.POLYGON),
WETH_POLYGON, WETH_POLYGON,
......
...@@ -277,13 +277,6 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId: number]: Token | undefined } = ...@@ -277,13 +277,6 @@ export const WRAPPED_NATIVE_CURRENCY: { [chainId: number]: Token | undefined } =
'Wrapped Ether' 'Wrapped Ether'
), ),
[ChainId.BASE]: new Token(ChainId.BASE, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), [ChainId.BASE]: new Token(ChainId.BASE, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'),
[ChainId.BASE_GOERLI]: new Token(
ChainId.BASE_GOERLI,
'0x4200000000000000000000000000000000000006',
18,
'WETH',
'Wrapped Ether'
),
[ChainId.ARBITRUM_ONE]: new Token( [ChainId.ARBITRUM_ONE]: new Token(
ChainId.ARBITRUM_ONE, ChainId.ARBITRUM_ONE,
'0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
......
import { ChainId, SupportedChainsType } from '@uniswap/sdk-core' import { ChainId } from '@uniswap/sdk-core'
import { Connector } from '@web3-react/types' import { Connector } from '@web3-react/types'
import { networkConnection, uniwalletWCV2ConnectConnection, walletConnectV2Connection } from 'connection' import { networkConnection, uniwalletWCV2ConnectConnection, walletConnectV2Connection } from 'connection'
import { getChainInfo } from 'constants/chainInfo' import { getChainInfo } from 'constants/chainInfo'
import { isSupportedChain } from 'constants/chains' import { isSupportedChain, SupportedInterfaceChain } from 'constants/chains'
import { FALLBACK_URLS, RPC_URLS } from 'constants/networks' import { FALLBACK_URLS, RPC_URLS } from 'constants/networks'
import { useCallback } from 'react' import { useCallback } from 'react'
import { useAppDispatch } from 'state/hooks' import { useAppDispatch } from 'state/hooks'
import { endSwitchingChain, startSwitchingChain } from 'state/wallets/reducer' import { endSwitchingChain, startSwitchingChain } from 'state/wallets/reducer'
function getRpcUrl(chainId: SupportedChainsType): string { function getRpcUrl(chainId: SupportedInterfaceChain): string {
switch (chainId) { switch (chainId) {
case ChainId.MAINNET: case ChainId.MAINNET:
case ChainId.GOERLI: case ChainId.GOERLI:
......
import { MaxUint256, PERMIT2_ADDRESS } from '@uniswap/permit2-sdk' import { MaxUint256, PERMIT2_ADDRESS } from '@uniswap/permit2-sdk'
import { Currency, SupportedChainsType } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import ERC20_ABI from 'abis/erc20.json' import ERC20_ABI from 'abis/erc20.json'
import { Erc20, Weth } from 'abis/types' import { Erc20, Weth } from 'abis/types'
import WETH_ABI from 'abis/weth.json' import WETH_ABI from 'abis/weth.json'
import { SupportedInterfaceChain } from 'constants/chains'
import { RPC_PROVIDERS } from 'constants/providers' import { RPC_PROVIDERS } from 'constants/providers'
import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens' import { WRAPPED_NATIVE_CURRENCY } from 'constants/tokens'
import { getContract } from 'utils' import { getContract } from 'utils'
...@@ -25,7 +26,7 @@ export async function getApproveInfo( ...@@ -25,7 +26,7 @@ export async function getApproveInfo(
// If any of these arguments aren't provided, then we cannot generate approval cost info // If any of these arguments aren't provided, then we cannot generate approval cost info
if (!account || !usdCostPerGas) return { needsApprove: false } if (!account || !usdCostPerGas) return { needsApprove: false }
const provider = RPC_PROVIDERS[currency.chainId as SupportedChainsType] const provider = RPC_PROVIDERS[currency.chainId as SupportedInterfaceChain]
const tokenContract = getContract(currency.address, ERC20_ABI, provider) as Erc20 const tokenContract = getContract(currency.address, ERC20_ABI, provider) as Erc20
let approveGasUseEstimate let approveGasUseEstimate
...@@ -51,7 +52,7 @@ export async function getApproveInfo( ...@@ -51,7 +52,7 @@ export async function getApproveInfo(
export async function getWrapInfo( export async function getWrapInfo(
needsWrap: boolean, needsWrap: boolean,
account: string | undefined, account: string | undefined,
chainId: SupportedChainsType, chainId: SupportedInterfaceChain,
amount: string, amount: string,
usdCostPerGas?: number usdCostPerGas?: number
): Promise<WrapInfo> { ): Promise<WrapInfo> {
......
...@@ -111,8 +111,7 @@ export default function RadialGradientByChainUpdater(): null { ...@@ -111,8 +111,7 @@ export default function RadialGradientByChainUpdater(): null {
backgroundRadialGradientElement.style.background = darkMode ? avaxDarkGradient : avaxLightGradient backgroundRadialGradientElement.style.background = darkMode ? avaxDarkGradient : avaxLightGradient
break break
} }
case ChainId.BASE: case ChainId.BASE: {
case ChainId.BASE_GOERLI: {
setBackground(backgroundResetStyles) setBackground(backgroundResetStyles)
const baseLightGradient = const baseLightGradient =
'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0) 0%, rgba(0, 82, 255, 0) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)' 'radial-gradient(100% 100% at 50% 0%, rgba(0, 82, 255, 0) 0%, rgba(0, 82, 255, 0) 40.0%, rgba(252, 255, 82, 0.00) 100%), rgb(255, 255, 255)'
......
...@@ -38,9 +38,4 @@ describe('#getExplorerLink', () => { ...@@ -38,9 +38,4 @@ describe('#getExplorerLink', () => {
it('base', () => { it('base', () => {
expect(getExplorerLink(ChainId.BASE, 'abc', ExplorerDataType.ADDRESS)).toEqual('https://basescan.org/address/abc') expect(getExplorerLink(ChainId.BASE, 'abc', ExplorerDataType.ADDRESS)).toEqual('https://basescan.org/address/abc')
}) })
it('base goerli', () => {
expect(getExplorerLink(ChainId.BASE_GOERLI, 'abc', ExplorerDataType.ADDRESS)).toEqual(
'https://goerli.basescan.org/address/abc'
)
})
}) })
...@@ -13,7 +13,6 @@ const BLOCK_EXPLORER_PREFIXES: { [chainId: number]: string } = { ...@@ -13,7 +13,6 @@ const BLOCK_EXPLORER_PREFIXES: { [chainId: number]: string } = {
[ChainId.BNB]: 'https://bscscan.com', [ChainId.BNB]: 'https://bscscan.com',
[ChainId.AVALANCHE]: 'https://snowtrace.io', [ChainId.AVALANCHE]: 'https://snowtrace.io',
[ChainId.BASE]: 'https://basescan.org', [ChainId.BASE]: 'https://basescan.org',
[ChainId.BASE_GOERLI]: 'https://goerli.basescan.org',
} }
export enum ExplorerDataType { export enum ExplorerDataType {
......
import { SupportedChainsType } from '@uniswap/sdk-core'
import type { SessionTypes } from '@walletconnect/types' import type { SessionTypes } from '@walletconnect/types'
import { SupportedInterfaceChain } from 'constants/chains'
// Helper function to extract chainId from string in format 'eip155:{chainId}' // Helper function to extract chainId from string in format 'eip155:{chainId}'
function getChainIdFromFormattedString(item: string): number | null { function getChainIdFromFormattedString(item: string): number | null {
...@@ -7,7 +7,7 @@ function getChainIdFromFormattedString(item: string): number | null { ...@@ -7,7 +7,7 @@ function getChainIdFromFormattedString(item: string): number | null {
return splitItem.length > 1 && !isNaN(Number(splitItem[1])) ? Number(splitItem[1]) : null return splitItem.length > 1 && !isNaN(Number(splitItem[1])) ? Number(splitItem[1]) : null
} }
export function getSupportedChainIdsFromWalletConnectSession(session?: SessionTypes.Struct): SupportedChainsType[] { export function getSupportedChainIdsFromWalletConnectSession(session?: SessionTypes.Struct): SupportedInterfaceChain[] {
if (!session?.namespaces) return [] if (!session?.namespaces) return []
const eip155Keys = Object.keys(session.namespaces) const eip155Keys = Object.keys(session.namespaces)
...@@ -31,5 +31,5 @@ export function getSupportedChainIdsFromWalletConnectSession(session?: SessionTy ...@@ -31,5 +31,5 @@ export function getSupportedChainIdsFromWalletConnectSession(session?: SessionTy
}) })
.filter((item) => item !== null) // Filter out any null values .filter((item) => item !== null) // Filter out any null values
return Array.from(new Set(allChainIds)) as SupportedChainsType[] return Array.from(new Set(allChainIds)) as SupportedInterfaceChain[]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment