From bc256a9c9bd3f0ad4dad495fbf3662738a221b0d Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 28 Jul 2023 11:12:46 +0700 Subject: [PATCH 1/4] enable all chains --- src/constants/networks.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 1a44747bc4..204d103dc3 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -205,15 +205,15 @@ export const SUPPORTED_NETWORKS_FOR_MY_EARNINGS = [ ChainId.MAINNET, ChainId.ARBITRUM, ChainId.OPTIMISM, - // ChainId.MATIC, - // ChainId.BSCMAINNET, - // ChainId.AVAXMAINNET, - // ChainId.FANTOM, - // ChainId.CRONOS, - // ChainId.BTTC, - // ChainId.VELAS, - // ChainId.AURORA, - // ChainId.OASIS, + ChainId.MATIC, + ChainId.BSCMAINNET, + ChainId.AVAXMAINNET, + ChainId.FANTOM, + ChainId.CRONOS, + ChainId.BTTC, + ChainId.VELAS, + ChainId.AURORA, + ChainId.OASIS, ] export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS = [ ChainId.MATIC, From 16df86b3abe4d29efdfbdc6619d6e7d7655afab0 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 28 Jul 2023 11:32:12 +0700 Subject: [PATCH 2/4] update env --- .env.adpr | 53 +++++++++++++++++++-------------------- src/constants/networks.ts | 13 +--------- 2 files changed, 27 insertions(+), 39 deletions(-) diff --git a/.env.adpr b/.env.adpr index 66d33fd4bb..25a41bb57f 100644 --- a/.env.adpr +++ b/.env.adpr @@ -1,45 +1,44 @@ -VITE_AGGREGATOR_API=https://aggregator-api.dev.kyberengineering.io -VITE_AGGREGATOR_STATS_API=https://aggregator-stats.dev.kyberengineering.io +VITE_AGGREGATOR_API=https://aggregator-api.kyberswap.com +VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 -VITE_SERVICE_WORKER=true +VITE_SERVICE_WORKER=false -VITE_MIXPANEL_PROJECT_TOKEN=fca28a30cb98d872c2079f214955cd5e -VITE_REWARD_SERVICE_API=https://reward.dev.kyberengineering.io/api/v1 +VITE_MIXPANEL_PROJECT_TOKEN=ff1eea26c19dcf4a7c35ebbc8631e714 +VITE_REWARD_SERVICE_API=https://rewards.kyberswap.com/api/v1 -VITE_PRICE_CHART_API=https://price-chart.dev.kyberengineering.io/api -VITE_PRICE_API=https://price.dev.kyberengineering.io +VITE_PRICE_CHART_API=https://price-chart.kyberswap.com/api +VITE_PRICE_API=https://price.kyberswap.com -VITE_NOTIFICATION_API=https://notification.dev.kyberengineering.io/api +VITE_NOTIFICATION_API=https://notification.kyberswap.com/api -VITE_CAMPAIGN_BASE_URL=https://campaigns.dev.kyberengineering.io -VITE_TYPE_AND_SWAP_URL=https://type-swap.dev.kyberengineering.io/api +VITE_CAMPAIGN_BASE_URL=https://campaigns.kyberswap.com +VITE_TYPE_AND_SWAP_URL=https://type-swap.kyberswap.com/api -VITE_TRANSAK_URL=https://staging-global.transak.com -VITE_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488 +VITE_TRANSAK_URL=https://global.transak.com +VITE_TRANSAK_API_KEY=48949c0b-2d20-4e3a-a311-51ca91ae8c0d -VITE_KS_SETTING_API=https://ks-setting.dev.kyberengineering.io/api +VITE_KS_SETTING_API=https://ks-setting.kyberswap.com/api -VITE_GTM_ID= +VITE_GTM_ID=GTM-TRQCJ8F -VITE_GOOGLE_RECAPTCHA_KEY=6Lc7yg0iAAAAALhS4C4Ez5hqMBub8hKdFvvr9sfc -VITE_POOL_FARM_BASE_URL=https://pool-farm.dev.kyberengineering.io +VITE_GOOGLE_RECAPTCHA_KEY=6LfgKRMiAAAAAPDTmXAM9LZLYAlE1zACfCJXup96 +VITE_POOL_FARM_BASE_URL=https://pool-farm.kyberswap.com -VITE_LIMIT_ORDER_API_WRITE=https://limit-order.dev.kyberengineering.io/write/api -VITE_LIMIT_ORDER_API_READ=https://limit-order.dev.kyberengineering.io/read-ks/api +VITE_LIMIT_ORDER_API_WRITE=https://limit-order.kyberswap.com/write/api +VITE_LIMIT_ORDER_API_READ=https://limit-order.kyberswap.com/read-ks/api VITE_BLOCK_SERVICE_API=https://block.kyberswap.com # Kyber DAO Apis -VITE_KYBER_DAO_STATS_API=https://kyberswap-dao-stats.dev.kyberengineering.io +VITE_KYBER_DAO_STATS_API=https://kyberswap-dao-stats.kyberengineering.io # oauth -VITE_ENV=development -VITE_OAUTH_CLIENT_ID=a2f76ad4-895f-401a-ba75-952a929d782c - -VITE_BFF_API=https://kyberswap-bff.dev.kyberengineering.io/api +VITE_ENV=production +VITE_OAUTH_CLIENT_ID=8a95ced8-1530-45d0-bc15-a5614d1d8d08 VITE_KYBER_AI_REFERRAL_ID=1 -VITE_KYBER_AI_TOPIC_ID=14 -VITE_PRICE_ALERT_TOPIC_ID=13 -VITE_ELASTIC_POOL_TOPIC_ID=12 -VITE_BUCKET_NAME=ks-setting-a3aa20b7 +VITE_KYBER_AI_TOPIC_ID=9 +VITE_PRICE_ALERT_TOPIC_ID=8 +VITE_ELASTIC_POOL_TOPIC_ID=7 +VITE_BFF_API=https://bff.kyberswap.com/api +VITE_BUCKET_NAME=ks-setting-1d682dca VITE_WALLETCONNECT_PROJECT_ID=f218207428d6efc3863adab795a9f123 diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 204d103dc3..e3f50623c3 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -215,18 +215,7 @@ export const SUPPORTED_NETWORKS_FOR_MY_EARNINGS = [ ChainId.AURORA, ChainId.OASIS, ] -export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS = [ - ChainId.MATIC, - ChainId.BSCMAINNET, - ChainId.AVAXMAINNET, - ChainId.FANTOM, - ChainId.CRONOS, - ChainId.BTTC, - ChainId.VELAS, - ChainId.AURORA, - ChainId.OASIS, - ChainId.ZKSYNC, -] +export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS = [] // by pass invalid price impact/unable to calculate price impact/price impact too large export const CHAINS_BYPASS_PRICE_IMPACT = [ChainId.LINEA_TESTNET] From 98a9a59f5daf56e7befeda26cc17ed89f726a92e Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 31 Jul 2023 14:53:39 +0700 Subject: [PATCH 3/4] disable polygon on legacy --- src/constants/networks.ts | 1 + src/pages/MyEarnings/ElasticPools/index.tsx | 6 ++++- .../MultipleChainSelect/PopoverBody.tsx | 23 +++++++++++++++---- src/pages/MyEarnings/MyEarningStats/index.tsx | 6 ++++- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 7c0b1614d2..92c63f2198 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -217,6 +217,7 @@ export const SUPPORTED_NETWORKS_FOR_MY_EARNINGS = [ ChainId.OASIS, ] export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS: ChainId[] = [] +export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY: ChainId[] = [ChainId.MATIC] // by pass invalid price impact/unable to calculate price impact/price impact too large export const CHAINS_BYPASS_PRICE_IMPACT = [ChainId.LINEA_TESTNET] diff --git a/src/pages/MyEarnings/ElasticPools/index.tsx b/src/pages/MyEarnings/ElasticPools/index.tsx index 7ce34d8335..5c93ce23ea 100644 --- a/src/pages/MyEarnings/ElasticPools/index.tsx +++ b/src/pages/MyEarnings/ElasticPools/index.tsx @@ -11,6 +11,7 @@ import styled from 'styled-components' import InfoHelper from 'components/InfoHelper' import LoaderWithKyberLogo from 'components/LocalLoader' import { EMPTY_ARRAY } from 'constants/index' +import { COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY } from 'constants/networks' import { VERSION } from 'constants/v2' import { useActiveWeb3React } from 'hooks' import useDebounce from 'hooks/useDebounce' @@ -81,7 +82,10 @@ const ElasticPools = () => { const searchText = useDebounce(originalSearchText, 300).toLowerCase().trim() const elasticEarningQueryResponse = useGetElasticEarningQuery({ account, chainIds: selectedChainIds }) - const elasticLegacyEarningQueryResponse = useGetElasticLegacyEarningQuery({ account, chainIds: selectedChainIds }) + const elasticLegacyEarningQueryResponse = useGetElasticLegacyEarningQuery({ + account, + chainIds: selectedChainIds.filter(item => !COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY.includes(item)), + }) const earningResponse = useMemo(() => { let data = elasticEarningQueryResponse.data diff --git a/src/pages/MyEarnings/MultipleChainSelect/PopoverBody.tsx b/src/pages/MyEarnings/MultipleChainSelect/PopoverBody.tsx index fd24808320..81706f63dc 100644 --- a/src/pages/MyEarnings/MultipleChainSelect/PopoverBody.tsx +++ b/src/pages/MyEarnings/MultipleChainSelect/PopoverBody.tsx @@ -11,12 +11,15 @@ import Checkbox from 'components/CheckBox' import { MouseoverTooltip } from 'components/Tooltip' import { COMING_SOON_NETWORKS_FOR_MY_EARNINGS, + COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY, NETWORKS_INFO, SUPPORTED_NETWORKS_FOR_MY_EARNINGS, } from 'constants/networks' +import { VERSION } from 'constants/v2' import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel' import useTheme from 'hooks/useTheme' import { AppState } from 'state' +import { useAppSelector } from 'state/hooks' import { selectChains } from 'state/myEarnings/actions' import { StyledLogo } from '.' @@ -103,9 +106,17 @@ const PopoverBody: React.FC = ({ onClose }) => { const selectedChains = useSelector((state: AppState) => state.myEarnings.selectedChains) const dispatch = useDispatch() - const [localSelectedChains, setLocalSelectedChains] = useState(selectedChains) + const isLegacy = useAppSelector(state => state.myEarnings.activeTab === VERSION.ELASTIC_LEGACY) - const isAllSelected = localSelectedChains.length === SUPPORTED_NETWORKS_FOR_MY_EARNINGS.length + const comingSoonList = isLegacy ? COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY : COMING_SOON_NETWORKS_FOR_MY_EARNINGS + + const [localSelectedChains, setLocalSelectedChains] = useState(() => + selectedChains.filter(item => !comingSoonList.includes(item)), + ) + + const networkList = SUPPORTED_NETWORKS_FOR_MY_EARNINGS.filter(item => !comingSoonList.includes(item)) + + const isAllSelected = localSelectedChains.length === networkList.length const handleChangeChains = (chains: ChainId[]) => { dispatch(selectChains(chains)) } @@ -124,7 +135,8 @@ const PopoverBody: React.FC = ({ onClose }) => { selectAllRef.current.indeterminate = indeterminate }, [localSelectedChains]) - const allNetworks = [...SUPPORTED_NETWORKS_FOR_MY_EARNINGS, ...COMING_SOON_NETWORKS_FOR_MY_EARNINGS] + const allNetworks = [...networkList, ...comingSoonList] + return ( = ({ onClose }) => { setLocalSelectedChains([]) } else { mixpanelHandler(MIXPANEL_TYPE.EARNING_DASHBOARD_CLICK_ALL_CHAINS_BUTTON) - setLocalSelectedChains(SUPPORTED_NETWORKS_FOR_MY_EARNINGS) + setLocalSelectedChains(networkList) } }} /> @@ -180,7 +192,8 @@ const PopoverBody: React.FC = ({ onClose }) => { {allNetworks.map((network, i) => { const config = NETWORKS_INFO[network] - const isComingSoon = COMING_SOON_NETWORKS_FOR_MY_EARNINGS.includes(network) + + const isComingSoon = comingSoonList.includes(network) const isSelected = isComingSoon ? false : localSelectedChains.includes(network) const handleClick = () => { diff --git a/src/pages/MyEarnings/MyEarningStats/index.tsx b/src/pages/MyEarnings/MyEarningStats/index.tsx index b206b73820..6193881964 100644 --- a/src/pages/MyEarnings/MyEarningStats/index.tsx +++ b/src/pages/MyEarnings/MyEarningStats/index.tsx @@ -5,6 +5,7 @@ import { Flex, Text } from 'rebass' import { useGetElasticEarningQuery, useGetElasticLegacyEarningQuery } from 'services/earning' import styled from 'styled-components' +import { COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY } from 'constants/networks' import { useActiveWeb3React } from 'hooks' import useTheme from 'hooks/useTheme' import ChainSelect from 'pages/MyEarnings/ChainSelect' @@ -79,7 +80,10 @@ const MyEarningStats = () => { const tokensByChainId = useAppSelector(state => state.lists.mapWhitelistTokens) const elasticEarningQueryResponse = useGetElasticEarningQuery({ account, chainIds: selectedChainIds }) - const elasticLegacyEarningQueryResponse = useGetElasticLegacyEarningQuery({ account, chainIds: selectedChainIds }) + const elasticLegacyEarningQueryResponse = useGetElasticLegacyEarningQuery({ + account, + chainIds: selectedChainIds.filter(item => !COMING_SOON_NETWORKS_FOR_MY_EARNINGS_LEGACY.includes(item)), + }) // const classicEarningQueryResponse = useGetClassicEarningQuery({ account, chainIds: selectedChainIds }) const isLoading = elasticEarningQueryResponse.isFetching || elasticLegacyEarningQueryResponse.isFetching From be0a61795d394c10fa3e67d80d84c744e97bc1f1 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 31 Jul 2023 15:06:06 +0700 Subject: [PATCH 4/4] revert env --- .env.adpr | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/.env.adpr b/.env.adpr index 25a41bb57f..66d33fd4bb 100644 --- a/.env.adpr +++ b/.env.adpr @@ -1,44 +1,45 @@ -VITE_AGGREGATOR_API=https://aggregator-api.kyberswap.com -VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com +VITE_AGGREGATOR_API=https://aggregator-api.dev.kyberengineering.io +VITE_AGGREGATOR_STATS_API=https://aggregator-stats.dev.kyberengineering.io VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 -VITE_SERVICE_WORKER=false +VITE_SERVICE_WORKER=true -VITE_MIXPANEL_PROJECT_TOKEN=ff1eea26c19dcf4a7c35ebbc8631e714 -VITE_REWARD_SERVICE_API=https://rewards.kyberswap.com/api/v1 +VITE_MIXPANEL_PROJECT_TOKEN=fca28a30cb98d872c2079f214955cd5e +VITE_REWARD_SERVICE_API=https://reward.dev.kyberengineering.io/api/v1 -VITE_PRICE_CHART_API=https://price-chart.kyberswap.com/api -VITE_PRICE_API=https://price.kyberswap.com +VITE_PRICE_CHART_API=https://price-chart.dev.kyberengineering.io/api +VITE_PRICE_API=https://price.dev.kyberengineering.io -VITE_NOTIFICATION_API=https://notification.kyberswap.com/api +VITE_NOTIFICATION_API=https://notification.dev.kyberengineering.io/api -VITE_CAMPAIGN_BASE_URL=https://campaigns.kyberswap.com -VITE_TYPE_AND_SWAP_URL=https://type-swap.kyberswap.com/api +VITE_CAMPAIGN_BASE_URL=https://campaigns.dev.kyberengineering.io +VITE_TYPE_AND_SWAP_URL=https://type-swap.dev.kyberengineering.io/api -VITE_TRANSAK_URL=https://global.transak.com -VITE_TRANSAK_API_KEY=48949c0b-2d20-4e3a-a311-51ca91ae8c0d +VITE_TRANSAK_URL=https://staging-global.transak.com +VITE_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488 -VITE_KS_SETTING_API=https://ks-setting.kyberswap.com/api +VITE_KS_SETTING_API=https://ks-setting.dev.kyberengineering.io/api -VITE_GTM_ID=GTM-TRQCJ8F +VITE_GTM_ID= -VITE_GOOGLE_RECAPTCHA_KEY=6LfgKRMiAAAAAPDTmXAM9LZLYAlE1zACfCJXup96 -VITE_POOL_FARM_BASE_URL=https://pool-farm.kyberswap.com +VITE_GOOGLE_RECAPTCHA_KEY=6Lc7yg0iAAAAALhS4C4Ez5hqMBub8hKdFvvr9sfc +VITE_POOL_FARM_BASE_URL=https://pool-farm.dev.kyberengineering.io -VITE_LIMIT_ORDER_API_WRITE=https://limit-order.kyberswap.com/write/api -VITE_LIMIT_ORDER_API_READ=https://limit-order.kyberswap.com/read-ks/api +VITE_LIMIT_ORDER_API_WRITE=https://limit-order.dev.kyberengineering.io/write/api +VITE_LIMIT_ORDER_API_READ=https://limit-order.dev.kyberengineering.io/read-ks/api VITE_BLOCK_SERVICE_API=https://block.kyberswap.com # Kyber DAO Apis -VITE_KYBER_DAO_STATS_API=https://kyberswap-dao-stats.kyberengineering.io +VITE_KYBER_DAO_STATS_API=https://kyberswap-dao-stats.dev.kyberengineering.io # oauth -VITE_ENV=production -VITE_OAUTH_CLIENT_ID=8a95ced8-1530-45d0-bc15-a5614d1d8d08 +VITE_ENV=development +VITE_OAUTH_CLIENT_ID=a2f76ad4-895f-401a-ba75-952a929d782c + +VITE_BFF_API=https://kyberswap-bff.dev.kyberengineering.io/api VITE_KYBER_AI_REFERRAL_ID=1 -VITE_KYBER_AI_TOPIC_ID=9 -VITE_PRICE_ALERT_TOPIC_ID=8 -VITE_ELASTIC_POOL_TOPIC_ID=7 -VITE_BFF_API=https://bff.kyberswap.com/api -VITE_BUCKET_NAME=ks-setting-1d682dca +VITE_KYBER_AI_TOPIC_ID=14 +VITE_PRICE_ALERT_TOPIC_ID=13 +VITE_ELASTIC_POOL_TOPIC_ID=12 +VITE_BUCKET_NAME=ks-setting-a3aa20b7 VITE_WALLETCONNECT_PROJECT_ID=f218207428d6efc3863adab795a9f123