Skip to content

Commit

Permalink
Remove paused from/to chainId constants
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds committed Apr 29, 2024
1 parent 3fba2a3 commit 3917328
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useConnectModal } from '@rainbow-me/rainbowkit'
import { stringToBigInt } from '@/utils/bigint/format'
import { useBridgeDisplayState, useBridgeState } from '@/slices/bridge/hooks'
import { usePortfolioBalances } from '@/slices/portfolio/hooks'
import { PAUSED_FROM_CHAIN_IDS, PAUSED_TO_CHAIN_IDS } from '@/constants/chains'
import { useAppDispatch } from '@/store/hooks'
import {
setIsDestinationWarningAccepted,
Expand Down Expand Up @@ -74,8 +73,6 @@ export const BridgeTransactionButton = ({
bridgeQuote === EMPTY_BRIDGE_QUOTE ||
(destinationAddress && !isAddress(destinationAddress)) ||
(isConnected && !sufficientBalance) ||
PAUSED_FROM_CHAIN_IDS.includes(fromChainId) ||
PAUSED_TO_CHAIN_IDS.includes(toChainId) ||
isBridgePaused

let buttonProperties
Expand All @@ -102,14 +99,6 @@ export const BridgeTransactionButton = ({
label: 'Please select Destination network',
onClick: null,
}
} else if (
PAUSED_FROM_CHAIN_IDS.includes(fromChainId) ||
PAUSED_TO_CHAIN_IDS.includes(toChainId)
) {
buttonProperties = {
label: `Bridge unavailable`,
onClick: null,
}
} else if (!fromToken) {
buttonProperties = {
label: `Please select an Origin token`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import _ from 'lodash'
import Fuse from 'fuse.js'

import * as ALL_CHAINS from '@/constants/chains/master'
import {
CHAINS_BY_ID,
sortChains,
PAUSED_FROM_CHAIN_IDS,
} from '@/constants/chains'
import { CHAINS_BY_ID, sortChains } from '@/constants/chains'
import { useBridgeState } from '@/slices/bridge/hooks'

export const useFromChainListArray = (searchStr: string = '') => {
Expand All @@ -16,7 +12,6 @@ export const useFromChainListArray = (searchStr: string = '') => {
.pickBy((value) => _.includes(fromChainIds, value.id))
.values()
.value()
.filter((chain) => !PAUSED_FROM_CHAIN_IDS.includes(chain.id))

possibleChains = sortChains(possibleChains)

Expand All @@ -25,7 +20,7 @@ export const useFromChainListArray = (searchStr: string = '') => {
Object.keys(CHAINS_BY_ID).map((id) => CHAINS_BY_ID[id]),
fromChainIds?.map((id) => CHAINS_BY_ID[id])
)
).filter((chain) => !PAUSED_FROM_CHAIN_IDS.includes(chain.id))
)

const possibleChainsWithSource = possibleChains.map((chain) => ({
...chain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import _ from 'lodash'
import Fuse from 'fuse.js'

import * as ALL_CHAINS from '@/constants/chains/master'
import {
CHAINS_BY_ID,
sortChains,
PAUSED_TO_CHAIN_IDS,
} from '@/constants/chains'
import { CHAINS_BY_ID, sortChains } from '@/constants/chains'
import { useBridgeState } from '@/slices/bridge/hooks'

export const useToChainListArray = (searchStr: string = '') => {
Expand All @@ -16,7 +12,6 @@ export const useToChainListArray = (searchStr: string = '') => {
.pickBy((value) => _.includes(toChainIds, value.id))
.values()
.value()
.filter((chain) => !PAUSED_TO_CHAIN_IDS.includes(chain.id))

possibleChains = sortChains(possibleChains)

Expand All @@ -25,7 +20,7 @@ export const useToChainListArray = (searchStr: string = '') => {
Object.keys(CHAINS_BY_ID).map((id) => CHAINS_BY_ID[id]),
toChainIds?.map((id) => CHAINS_BY_ID[id])
)
).filter((chain) => !PAUSED_TO_CHAIN_IDS.includes(chain.id))
)

const possibleChainsWithSource = possibleChains.map((chain) => ({
...chain,
Expand Down
4 changes: 0 additions & 4 deletions packages/synapse-interface/constants/chains/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ export const CHAIN_IDS = getids() // used to be ids
export const CHAINS_BY_ID = getChainsByID()
export const ORDERED_CHAINS_BY_ID = CHAINS_ARR.map((chain) => String(chain.id))

export const PAUSED_FROM_CHAIN_IDS = []
// export const PAUSED_TO_CHAIN_IDS = [all.DOGE.id]
export const PAUSED_TO_CHAIN_IDS = []

export const ChainId = {
ETH: 1,
ROPSTEN: 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getToChainIds } from './getToChainIds'
import { getFromChainIds } from './getFromChainIds'
import { getFromTokens } from './getFromTokens'
import { getToTokens } from './getToTokens'
import { PAUSED_TO_CHAIN_IDS } from '@/constants/chains'
import { findTokenByRouteSymbol } from '../findTokenByRouteSymbol'

export interface RouteQueryFields {
Expand Down Expand Up @@ -57,9 +56,7 @@ export const getRoutePossibilities = ({
fromTokenRouteSymbol,
toChainId,
toTokenRouteSymbol,
})
?.filter((chainId) => !PAUSED_TO_CHAIN_IDS.includes(chainId))
.filter((chainId) => chainId !== fromChainId)
}).filter((chainId) => chainId !== fromChainId)

const toTokens: Token[] = _(
getToTokens({
Expand All @@ -70,9 +67,6 @@ export const getRoutePossibilities = ({
})
)
.difference(flattenPausedTokens())
.filter((token) => {
return !PAUSED_TO_CHAIN_IDS.some((value) => token.endsWith(`-${value}`))
})
.map(getSymbol)
.uniq()
.map((symbol) => findTokenByRouteSymbol(symbol))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Token } from '../types'
import { getSwapFromChainIds } from './getSwapFromChainIds'
import { getSwapFromTokens } from './getSwapFromTokens'
import { getSwapToTokens } from './getSwapToTokens'
import { PAUSED_TO_CHAIN_IDS } from '@/constants/chains'
import { findTokenByRouteSymbol } from '../findTokenByRouteSymbol'
import { getSymbol } from '@/utils/getSymbol'

Expand Down Expand Up @@ -61,9 +60,6 @@ export const getSwapPossibilities = ({
})
)
.difference(flattenPausedTokens())
.filter((token) => {
return !PAUSED_TO_CHAIN_IDS.some((value) => token.endsWith(`-${value}`))
})
.map(getSymbol)
.uniq()
.map((symbol) => findTokenByRouteSymbol(symbol))
Expand Down

0 comments on commit 3917328

Please sign in to comment.