Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(explorer): get rid of config yaml file #3593

Merged
merged 21 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions apps/explorer/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
// this is not used for now. we use "craco test", but eventually we will
import { loadConfig } from './loadConfig'

const CONFIG = loadConfig()

/* eslint-disable */
export default {
displayName: 'explorer',
Expand All @@ -15,5 +11,4 @@ export default {
coverageDirectory: '../../coverage/explorer',
setupFilesAfterEnv: ['../../jest.setup.ts'],
setupFiles: ['dotenv/config'],
globals: { CONFIG },
}
17 changes: 0 additions & 17 deletions apps/explorer/src/api/thegraph/index.ts

This file was deleted.

39 changes: 2 additions & 37 deletions apps/explorer/src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,51 +107,16 @@ export const MEDIA = {
},
}

export const ELLIPSIS = '...'

let infuraId
if (process.env.INFURA_ID) {
infuraId = process.env.INFURA_ID
} else if (CONFIG.defaultProviderConfig.type === 'infura') {
const { config } = CONFIG.defaultProviderConfig
infuraId = config.infuraId
} else {
infuraId = ''
}

export const INFURA_ID = infuraId
export const WALLET_CONNECT_BRIDGE = process.env.WALLET_CONNECT_BRIDGE || CONFIG.walletConnect.bridge
export const STORAGE_KEY_CUSTOM_WC_OPTIONS = 'CustomWCOptions'

let ethNodeUrl
if (process.env.ETH_NODE_URL) {
ethNodeUrl = process.env.ETH_NODE_URL
} else if (CONFIG.defaultProviderConfig.type === 'infura') {
const { config } = CONFIG.defaultProviderConfig
ethNodeUrl = config.infuraEndpoint + config.infuraId
} else if (CONFIG.defaultProviderConfig.type === 'url') {
const { config } = CONFIG.defaultProviderConfig
ethNodeUrl = config.ethNodeUrl
} else {
throw new Error('Default provider URL is not set. Either provide ETH_NODE_URL env var or use the config.')
}

export const ETH_NODE_URL = ethNodeUrl

export const STORAGE_KEY_LAST_PROVIDER = 'lastProvider'
export const STORAGE_KEY_DISABLED_TOKENS_ADDRESSES = 'disabledTokens'

export const TRADES_LOCAL_STORAGE_KEY = 'TRADES_PER_ACCOUNT'
export const INFURA_ID = process.env.INFURA_ID || 'e941376b017d4dada26dc7891456fa3b'
export const ETH_NODE_URL = process.env.ETH_NODE_URL || 'wss://mainnet.infura.io/ws/v3/' + INFURA_ID

const LIQUIDITY_TOKEN_LIST_VALUES = process.env.LIQUIDITY_TOKEN_LIST || 'USDT,TUSD,USDC,PAX,GUSD,DAI,sUSD'
export const LIQUIDITY_TOKEN_LIST = new Set(LIQUIDITY_TOKEN_LIST_VALUES.split(',').map((symbol) => symbol.trim()))
export const INPUT_PRECISION_SIZE = 6

export const WETH_ADDRESS_MAINNET = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
export const WETH_ADDRESS_GOERLI = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6'
export const WETH_ADDRESS_SEPOLIA = '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14'
export const WXDAI_ADDRESS_XDAI = '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d'
export const WETH_ADDRESS_XDAI = '0x6A023CCd1ff6F2045C3309768eAd9E68F978f6e1'
export const NATIVE_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'
export const NATIVE_TOKEN_ADDRESS_LOWERCASE = NATIVE_TOKEN_ADDRESS.toLowerCase()

Expand Down
25 changes: 0 additions & 25 deletions apps/explorer/src/test/api/getProviderByNetwork.test.ts

This file was deleted.

5 changes: 0 additions & 5 deletions apps/explorer/src/types/global-config.d.ts

This file was deleted.

Loading