From a1d8aafad89bc9492cba36967a1dd143e2a92a1f Mon Sep 17 00:00:00 2001 From: Danh Date: Thu, 13 Jul 2023 16:32:20 +0700 Subject: [PATCH 01/25] docs url --- src/pages/NotificationCenter/Profile/WarningSignMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/NotificationCenter/Profile/WarningSignMessage.tsx b/src/pages/NotificationCenter/Profile/WarningSignMessage.tsx index 02983da9cb..189673d167 100644 --- a/src/pages/NotificationCenter/Profile/WarningSignMessage.tsx +++ b/src/pages/NotificationCenter/Profile/WarningSignMessage.tsx @@ -27,7 +27,7 @@ const WarningWrapper = styled.div` padding: 12px 14px; `} ` -const DOC_URL = 'https://docs.kyberswap.com/kyberswap-solutions/kyberswap-interface/profiles/profile-customization' +const DOC_URL = 'https://docs.kyberswap.com/kyberswap-solutions/kyberswap-interface/profiles' const WarningSignMessage = () => { const { signIn } = useLogin() const { pendingAuthentication } = useSessionInfo() From 0a8ff6b82a1e8b64084bfc0d49cc4ae799bf33b6 Mon Sep 17 00:00:00 2001 From: Danh Date: Thu, 13 Jul 2023 17:09:53 +0700 Subject: [PATCH 02/25] refresh list noti when change profike --- src/components/Announcement/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Announcement/index.tsx b/src/components/Announcement/index.tsx index 6ca21f5c0d..af93fc0ec9 100644 --- a/src/components/Announcement/index.tsx +++ b/src/components/Announcement/index.tsx @@ -143,9 +143,9 @@ export default function AnnouncementComponent() { numberOfUnread, pagination: { totalItems: totalPrivateAnnouncement }, } = isError ? responseDefault : respPrivateAnnouncement - const refreshAnnouncement = () => { + const refreshAnnouncement = useCallback(() => { fetchAnnouncementsByTab(true) - } + }, [fetchAnnouncementsByTab]) const loadMoreAnnouncements = useCallback(() => { fetchAnnouncementsByTab() @@ -226,8 +226,9 @@ export default function AnnouncementComponent() { useEffect(() => { if (userInfo?.identityId) { invalidateTag(ANNOUNCEMENT_TAGS) + refreshAnnouncement() } - }, [userInfo?.identityId, invalidateTag]) + }, [userInfo?.identityId, invalidateTag, refreshAnnouncement]) useInterval(prefetchPrivateAnnouncements, 10_000) From d4a9f1e60b45a7bc87d615937d80ede74977b3bc Mon Sep 17 00:00:00 2001 From: Danh Date: Thu, 13 Jul 2023 17:56:58 +0700 Subject: [PATCH 03/25] add threast hold token search --- src/components/SearchModal/CurrencyList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SearchModal/CurrencyList.tsx b/src/components/SearchModal/CurrencyList.tsx index f6a55b37f2..43e39fdadf 100644 --- a/src/components/SearchModal/CurrencyList.tsx +++ b/src/components/SearchModal/CurrencyList.tsx @@ -304,7 +304,7 @@ function CurrencyList({
{({ height, width }) => ( - + {({ onItemsRendered, ref }) => ( Date: Thu, 13 Jul 2023 18:04:41 +0700 Subject: [PATCH 04/25] fix: loading. for ever --- .../NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx index 7b55a82e86..28f55b9fef 100644 --- a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx +++ b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx @@ -17,7 +17,7 @@ import SingleAlert from './SingleAlert' const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolean) => void }) => { const { userInfo } = useSessionInfo() const [page, setPage] = useState(1) - const { data, isLoading, refetch } = useGetListAlertsQuery({ + const { data, isFetching, refetch } = useGetListAlertsQuery({ page, pageSize: ITEMS_PER_PAGE, sort: 'is_enabled:desc,created_at:desc', @@ -51,8 +51,8 @@ const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolea const totalAlert = data?.alerts?.length ?? 0 - if (!totalAlert || isLoading) { - return + if (!totalAlert || isFetching) { + return } return ( From 1e5d0ef81e317a3f6de061634d7ce52ccbc8a53c Mon Sep 17 00:00:00 2001 From: Danh Date: Thu, 13 Jul 2023 18:17:29 +0700 Subject: [PATCH 05/25] add log --- src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx index 28f55b9fef..c438d7bc6f 100644 --- a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx +++ b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx @@ -50,6 +50,7 @@ const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolea }, [userInfo?.identityId, refetch, refetchStat]) const totalAlert = data?.alerts?.length ?? 0 + console.log({ isFetching }) if (!totalAlert || isFetching) { return From f50a353f7871b51161954016c74c8275f740b838 Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 09:48:57 +0700 Subject: [PATCH 06/25] STG --- .env.adpr | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/.env.adpr b/.env.adpr index 74879a263b..326145bd06 100644 --- a/.env.adpr +++ b/.env.adpr @@ -1,46 +1,43 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.dev.kyberengineering.io -VITE_AGGREGATOR_API=https://aggregator-api.dev.kyberengineering.io -VITE_AGGREGATOR_STATS_API=https://aggregator-stats.dev.kyberengineering.io +VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.stg.kyberengineering.io +VITE_AGGREGATOR_API=https://aggregator-api.stg.kyberengineering.io +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=ff1eea26c19dcf4a7c35ebbc8631e714 +VITE_REWARD_SERVICE_API=https://reward.stg.kyberengineering.io/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.stg.kyberengineering.io -VITE_PRICE_CHART_API=https://price-chart.dev.kyberengineering.io/api -VITE_PRICE_API=https://price.dev.kyberengineering.io +VITE_NOTIFICATION_API=https://notification.stg.kyberengineering.io/api -VITE_NOTIFICATION_API=https://notification.dev.kyberengineering.io/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.stg.kyberengineering.io +VITE_TYPE_AND_SWAP_URL=https://type-swap.stg.kyberengineering.io/api VITE_TRANSAK_URL=https://staging-global.transak.com VITE_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488 -VITE_KS_SETTING_API=https://ks-setting.dev.kyberengineering.io/api +VITE_KS_SETTING_API=https://ks-setting.stg.kyberengineering.io/api VITE_GTM_ID= VITE_GOOGLE_RECAPTCHA_KEY=6Lc7yg0iAAAAALhS4C4Ez5hqMBub8hKdFvvr9sfc -VITE_POOL_FARM_BASE_URL=https://pool-farm.dev.kyberengineering.io +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.stg.kyberengineering.io/write/api +VITE_LIMIT_ORDER_API_READ=https://limit-order.stg.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.dev.kyberengineering.io - +VITE_KYBER_DAO_STATS_API=https://kyberswap-dao-stats.stg.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=staging +VITE_OAUTH_CLIENT_ID=bce9bf52-b788-4c25-9c6c-a07dff080403 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=11 +VITE_PRICE_ALERT_TOPIC_ID=9 +VITE_ELASTIC_POOL_TOPIC_ID=4,5 +VITE_BFF_API=https://kyberswap-bff.stg.kyberengineering.io/api +VITE_BUCKET_NAME=ks-setting-6d114fd1 VITE_WALLETCONNECT_PROJECT_ID=f218207428d6efc3863adab795a9f123 From cf9b9dbbb6c84236ff24e07ce1db57a2686c90d0 Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 10:02:26 +0700 Subject: [PATCH 07/25] test --- .../NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx index c438d7bc6f..fff53a0b29 100644 --- a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx +++ b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx @@ -17,7 +17,7 @@ import SingleAlert from './SingleAlert' const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolean) => void }) => { const { userInfo } = useSessionInfo() const [page, setPage] = useState(1) - const { data, isFetching, refetch } = useGetListAlertsQuery({ + const { data, isFetching, isLoading, refetch } = useGetListAlertsQuery({ page, pageSize: ITEMS_PER_PAGE, sort: 'is_enabled:desc,created_at:desc', @@ -50,7 +50,7 @@ const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolea }, [userInfo?.identityId, refetch, refetchStat]) const totalAlert = data?.alerts?.length ?? 0 - console.log({ isFetching }) + console.log({ isFetching, data, isLoading }) if (!totalAlert || isFetching) { return From 7ecf93b2d9e9893c8162714827640491b59847ff Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 10:40:14 +0700 Subject: [PATCH 08/25] fix wrong address sign in --- src/hooks/useLogin.tsx | 24 +++++++++++++++--------- src/hooks/useSessionExpire.ts | 6 +++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/hooks/useLogin.tsx b/src/hooks/useLogin.tsx index 2bf245999f..b3c94ce5bf 100644 --- a/src/hooks/useLogin.tsx +++ b/src/hooks/useLogin.tsx @@ -165,6 +165,16 @@ const useLogin = (autoLogin = false) => { [setLoading, signInAnonymous, getProfile, saveSignedAccount, showSignInSuccess], ) + const redirectSignIn = useCallback( + (account: string) => { + setLoginRedirectUrl(window.location.href) + setTimeout(() => { + KyberOauth2.authenticate(isEVM ? { wallet_address: account } : {}) // navigate to login page + }, 1000) + }, + [isEVM, setLoginRedirectUrl], + ) + // check account info and redirect if needed const [, setAutoSignIn] = useIsAutoLoginAfterConnectWallet() const signIn = useCallback( @@ -186,26 +196,21 @@ const useLogin = (autoLogin = false) => { return } - const redirectSignIn = () => { - setLoginRedirectUrl(window.location.href) - setTimeout(() => { - KyberOauth2.authenticate(isEVM ? { wallet_address: desireAccount || account || '' } : {}) // navigate to login page - }, 1000) - } + const formatAccount = desireAccount || account || '' if (showSessionExpired && isSelectAccount && !isTokenExist) { showConfirm({ isOpen: true, content: t`Your session has expired. Please sign-in to continue.`, title: t`Session Expired`, confirmText: t`Sign-in`, - onConfirm: () => redirectSignIn(), + onConfirm: () => redirectSignIn(formatAccount), cancelText: t`Cancel`, }) return } - redirectSignIn() + redirectSignIn(formatAccount) }, - [account, isEVM, checkSessionSignIn, toggleWalletModal, showConfirm, setLoginRedirectUrl, setAutoSignIn], + [account, checkSessionSignIn, toggleWalletModal, showConfirm, setAutoSignIn, redirectSignIn], ) const showSignOutSuccess = useCallback(() => { @@ -307,6 +312,7 @@ const useLogin = (autoLogin = false) => { return { signOut: signOutWrapped, signIn: signInWrapped, + redirectSignIn, signOutAll, importGuestAccount, checkSessionSignIn, diff --git a/src/hooks/useSessionExpire.ts b/src/hooks/useSessionExpire.ts index 3f6bbb3d81..63f7ec24ea 100644 --- a/src/hooks/useSessionExpire.ts +++ b/src/hooks/useSessionExpire.ts @@ -12,7 +12,7 @@ import { useSignedAccountInfo } from 'state/profile/hooks' export default function useSessionExpiredGlobal() { const { pathname } = useLocation() const showConfirm = useShowConfirm() - const { signIn } = useLogin() + const { signIn, redirectSignIn } = useLogin() const navigate = useNavigate() const { signedAccount, signedMethod } = useSignedAccountInfo() @@ -25,7 +25,7 @@ export default function useSessionExpiredGlobal() { title: t`Session Expired`, confirmText: t`Sign-in`, cancelText: t`Cancel`, - onConfirm: () => signIn(), + onConfirm: () => redirectSignIn(accountId || signedAccount), } const isKyberAIPage = pathname.toLowerCase().startsWith(APP_PATHS.KYBERAI.toLowerCase()) && @@ -38,7 +38,7 @@ export default function useSessionExpiredGlobal() { } KyberOauth2.on(KyberOauth2Event.SESSION_EXPIRED, listener) return () => KyberOauth2.off(KyberOauth2Event.SESSION_EXPIRED, listener) - }, [pathname, showConfirm, signIn, navigate, signedAccount]) + }, [pathname, showConfirm, redirectSignIn, navigate, signedAccount]) useEffect(() => { const listener = () => { From 0546640d0ef8efeb1f34585bfb607db14500df16 Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 11:32:28 +0700 Subject: [PATCH 09/25] fix infinite loading price alert --- .../PriceAlerts/ActiveAlerts/index.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx index fff53a0b29..17c0309009 100644 --- a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx +++ b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx @@ -1,11 +1,9 @@ import { t } from '@lingui/macro' import { useEffect, useState } from 'react' import { Flex } from 'rebass' -import priceAlertApi, { useGetAlertStatsQuery, useGetListAlertsQuery } from 'services/priceAlert' +import { useGetAlertStatsQuery, useGetListAlertsQuery } from 'services/priceAlert' -import { useInvalidateTags } from 'components/Announcement/helper' import { PrivateAnnouncementType } from 'components/Announcement/type' -import { RTK_QUERY_TAGS } from 'constants/index' import NoData from 'pages/NotificationCenter/NoData' import CommonPagination from 'pages/NotificationCenter/PriceAlerts/CommonPagination' import { ITEMS_PER_PAGE } from 'pages/NotificationCenter/const' @@ -25,12 +23,12 @@ const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolea const { data: alertStat, refetch: refetchStat } = useGetAlertStatsQuery() const isMaxQuotaActiveAlert = alertStat ? alertStat.totalActiveAlerts >= alertStat.maxActiveAlerts : false - const invalidateTag = useInvalidateTags(priceAlertApi.reducerPath) useEffect(() => { - if (userInfo?.identityId) { - invalidateTag([RTK_QUERY_TAGS.GET_ALERTS, RTK_QUERY_TAGS.GET_ALERTS_STAT]) - } - }, [userInfo?.identityId, invalidateTag]) + try { + refetch() + refetchStat() + } catch (error) {} + }, [userInfo?.identityId, refetch, refetchStat]) useEffect(() => { setDisabledClearAll(!data?.alerts?.length) From 5006057222bbf8bcdeb7e73d6700cbf27f037f1e Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 11:42:04 +0700 Subject: [PATCH 10/25] rm log --- .../PriceAlerts/ActiveAlerts/index.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx index 17c0309009..96f4076927 100644 --- a/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx +++ b/src/pages/NotificationCenter/PriceAlerts/ActiveAlerts/index.tsx @@ -4,6 +4,7 @@ import { Flex } from 'rebass' import { useGetAlertStatsQuery, useGetListAlertsQuery } from 'services/priceAlert' import { PrivateAnnouncementType } from 'components/Announcement/type' +import useDebounce from 'hooks/useDebounce' import NoData from 'pages/NotificationCenter/NoData' import CommonPagination from 'pages/NotificationCenter/PriceAlerts/CommonPagination' import { ITEMS_PER_PAGE } from 'pages/NotificationCenter/const' @@ -15,11 +16,12 @@ import SingleAlert from './SingleAlert' const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolean) => void }) => { const { userInfo } = useSessionInfo() const [page, setPage] = useState(1) - const { data, isFetching, isLoading, refetch } = useGetListAlertsQuery({ + const { data, isFetching, refetch } = useGetListAlertsQuery({ page, pageSize: ITEMS_PER_PAGE, sort: 'is_enabled:desc,created_at:desc', }) + const isLoading = useDebounce(isFetching, 300) const { data: alertStat, refetch: refetchStat } = useGetAlertStatsQuery() const isMaxQuotaActiveAlert = alertStat ? alertStat.totalActiveAlerts >= alertStat.maxActiveAlerts : false @@ -48,10 +50,9 @@ const ActiveAlerts = ({ setDisabledClearAll }: { setDisabledClearAll: (v: boolea }, [userInfo?.identityId, refetch, refetchStat]) const totalAlert = data?.alerts?.length ?? 0 - console.log({ isFetching, data, isLoading }) - if (!totalAlert || isFetching) { - return + if (!totalAlert || isLoading) { + return } return ( From 3c092ee2d7cd24bb402c09cb2ba3f792becbb39d Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 17:04:52 +0700 Subject: [PATCH 11/25] fix crosschain too long --- src/pages/Bridge/ComfirmBridgeModal.tsx | 28 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/pages/Bridge/ComfirmBridgeModal.tsx b/src/pages/Bridge/ComfirmBridgeModal.tsx index 8260098b24..5d18de085c 100644 --- a/src/pages/Bridge/ComfirmBridgeModal.tsx +++ b/src/pages/Bridge/ComfirmBridgeModal.tsx @@ -426,16 +426,26 @@ export const ConfirmCrossChainModal = memo(function ConfirmCrossChainModal({ outputAmount && currencyIn && currencyOut && ( - - -   - {uint256ToFraction(inputAmount, currencyIn?.decimals).toSignificant(RESERVE_USD_DECIMALS)} - {currencyIn?.symbol} + + + +   + {uint256ToFraction(inputAmount, currencyIn?.decimals).toSignificant(RESERVE_USD_DECIMALS)} + {currencyIn?.symbol} + + - -   - {uint256ToFraction(outputAmount, currencyOut?.decimals).toSignificant(RESERVE_USD_DECIMALS)} - {currencyOut?.symbol} + + + +   + {uint256ToFraction(outputAmount, currencyOut?.decimals).toSignificant(RESERVE_USD_DECIMALS)} + {currencyOut?.symbol} + ) } From 1a3918b8d0673aee24da5068efaaf04f36e50fde Mon Sep 17 00:00:00 2001 From: Danh Date: Fri, 14 Jul 2023 17:37:53 +0700 Subject: [PATCH 12/25] fix ux session expired --- src/components/Header/web3/SignWallet/ProfileContent.tsx | 7 ++++++- src/hooks/useSessionExpire.ts | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/Header/web3/SignWallet/ProfileContent.tsx b/src/components/Header/web3/SignWallet/ProfileContent.tsx index 20824faf12..5514030ad2 100644 --- a/src/components/Header/web3/SignWallet/ProfileContent.tsx +++ b/src/components/Header/web3/SignWallet/ProfileContent.tsx @@ -226,7 +226,12 @@ const ProfileContent = ({ scroll, toggleModal }: { scroll?: boolean; toggleModal 1}> {!KyberOauth2.getConnectedAccounts().includes(account?.toLowerCase() ?? '') && isEVM && ( - signIn()}> + { + toggleModal() + signIn() + }} + > Add Account )} diff --git a/src/hooks/useSessionExpire.ts b/src/hooks/useSessionExpire.ts index 63f7ec24ea..82e8faa1c9 100644 --- a/src/hooks/useSessionExpire.ts +++ b/src/hooks/useSessionExpire.ts @@ -12,7 +12,7 @@ import { useSignedAccountInfo } from 'state/profile/hooks' export default function useSessionExpiredGlobal() { const { pathname } = useLocation() const showConfirm = useShowConfirm() - const { signIn, redirectSignIn } = useLogin() + const { signIn, redirectSignIn, signInAnonymous } = useLogin() const navigate = useNavigate() const { signedAccount, signedMethod } = useSignedAccountInfo() @@ -26,6 +26,9 @@ export default function useSessionExpiredGlobal() { confirmText: t`Sign-in`, cancelText: t`Cancel`, onConfirm: () => redirectSignIn(accountId || signedAccount), + onCancel: () => { + signInAnonymous(KyberOauth2.getConnectedAnonymousAccounts()[0]) + }, } const isKyberAIPage = pathname.toLowerCase().startsWith(APP_PATHS.KYBERAI.toLowerCase()) && @@ -38,7 +41,7 @@ export default function useSessionExpiredGlobal() { } KyberOauth2.on(KyberOauth2Event.SESSION_EXPIRED, listener) return () => KyberOauth2.off(KyberOauth2Event.SESSION_EXPIRED, listener) - }, [pathname, showConfirm, redirectSignIn, navigate, signedAccount]) + }, [pathname, showConfirm, redirectSignIn, navigate, signedAccount, signInAnonymous]) useEffect(() => { const listener = () => { From 39607b0413cc567b93b70b39fba847bc9e339cc6 Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 17 Jul 2023 09:50:55 +0700 Subject: [PATCH 13/25] add space --- src/components/Header/index.tsx | 4 ++-- src/components/Header/web3/SelectWallet.tsx | 7 +++---- src/components/swapv2/LimitOrder/LimitOrderForm.tsx | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 93de1f68ff..bad526a90b 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -180,7 +180,7 @@ export default function Header() { const [holidayMode] = useHolidayMode() const theme = useTheme() const { mixpanelHandler } = useMixpanel() - const uptoSmall = useMedia(`(max-width: ${MEDIA_WIDTHS.upToSmall}px)`) + const upToExtraSmall = useMedia(`(max-width: ${MEDIA_WIDTHS.upToExtraSmall}px)`) const menu = ( @@ -228,7 +228,7 @@ export default function Header() { - {uptoSmall ? ( + {upToExtraSmall ? ( diff --git a/src/components/Header/web3/SelectWallet.tsx b/src/components/Header/web3/SelectWallet.tsx index ed7a83626f..02757c52c5 100644 --- a/src/components/Header/web3/SelectWallet.tsx +++ b/src/components/Header/web3/SelectWallet.tsx @@ -163,9 +163,8 @@ function Web3StatusInner() { text={ - You are not signed in with this wallet address. If you wish, you can - { e.stopPropagation() @@ -173,7 +172,7 @@ function Web3StatusInner() { }} > sign-in - + {' '} to link your wallet to a profile. This will allow us to offer you a better experience diff --git a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx index 222ef5dc08..7e08da9da1 100644 --- a/src/components/swapv2/LimitOrder/LimitOrderForm.tsx +++ b/src/components/swapv2/LimitOrder/LimitOrderForm.tsx @@ -653,7 +653,7 @@ const LimitOrderForm = function LimitOrderForm({ messages.push( - Your order may only be filled when market price of {currencyIn?.symbol} to {currencyOut?.symbol} is < + Your order may only be filled when market price of {currencyIn?.symbol} to {currencyOut?.symbol} is <{' '} {formattedNum(String(tradeInfo?.marketRate), true)}, as estimated gas fee to fill your order is ~${removeTrailingZero(tradeInfo?.gasFee?.toPrecision(6) ?? '0')}. From b1e10274a144959717901be0c9625e81c788266c Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 17 Jul 2023 09:58:14 +0700 Subject: [PATCH 14/25] check wallet kyberai --- src/state/user/hooks.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/state/user/hooks.tsx b/src/state/user/hooks.tsx index 39227c98bf..ff1dac0025 100644 --- a/src/state/user/hooks.tsx +++ b/src/state/user/hooks.tsx @@ -524,12 +524,14 @@ export const useIsWhiteListKyberAI = () => { const loadingDebounced = useDebounce(isLoading, 500) || connectingWallet const participantInfo = isError || loadingDebounced || !account ? participantDefault : rawData - + // isWhitelist, isWaitList check account is hotfix for now, will remove utils backend fixed bug return { loading: loadingDebounced, isWhiteList: - isLogin && (participantInfo?.status === ParticipantStatus.WHITELISTED || userInfo?.data?.hasAccessToKyberAI), - isWaitList: isLogin && participantInfo?.status === ParticipantStatus.WAITLISTED, + !!account && + isLogin && + (participantInfo?.status === ParticipantStatus.WHITELISTED || userInfo?.data?.hasAccessToKyberAI), + isWaitList: !!account && isLogin && participantInfo?.status === ParticipantStatus.WAITLISTED, refetch, } } From 0ee992ee1f1abbd7a38ffaa232735030bc0f3525 Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 17 Jul 2023 10:19:56 +0700 Subject: [PATCH 15/25] add err desc --- src/utils/iamError.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index 5eab6bd7be..7160927d74 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -47,6 +47,8 @@ export const checkIamDown = (axiosErr: AxiosError) => { }, response, statusCode, + message: axiosErr?.message, + code: axiosErr?.code, } const apiUrl = axiosErr?.config?.url ?? '' From f74a6ea72749bfd022b6efd4773d234de19aace8 Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 17 Jul 2023 10:33:51 +0700 Subject: [PATCH 16/25] not required email when sub --- .../SubscribeButton/NotificationPreference/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/SubscribeButton/NotificationPreference/index.tsx b/src/components/SubscribeButton/NotificationPreference/index.tsx index 7f92a81bb7..7eea548da9 100644 --- a/src/components/SubscribeButton/NotificationPreference/index.tsx +++ b/src/components/SubscribeButton/NotificationPreference/index.tsx @@ -175,8 +175,6 @@ function NotificationPreference({ const [selectedTopic, setSelectedTopic] = useState([]) - const notFillEmail = !inputEmail - const updateTopicGroupsLocal = useCallback( (subIds: number[], unsubIds: number[]) => { const newTopicGroups = topicGroupsGlobal.map(group => { @@ -295,7 +293,7 @@ function NotificationPreference({ const isVerifiedEmail = userInfo?.email && inputEmail === userInfo?.email const needVerifyEmail = inputEmail && inputEmail !== userInfo?.email - const disableCheckbox = needVerifyEmail || notFillEmail || hasErrorInput + const disableCheckbox = false // needVerifyEmail || notFillEmail || hasErrorInput const isIncludePriceAlert = useCallback(() => { const changedData = getDiffChangeTopics(topicGroups) return ( From 69d43435ac0fcd8136e33ec3fa1ab831574b070b Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 17 Jul 2023 10:34:45 +0700 Subject: [PATCH 17/25] env dev --- .env.adpr | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/.env.adpr b/.env.adpr index 326145bd06..74879a263b 100644 --- a/.env.adpr +++ b/.env.adpr @@ -1,43 +1,46 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.stg.kyberengineering.io -VITE_AGGREGATOR_API=https://aggregator-api.stg.kyberengineering.io -VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com +VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.dev.kyberengineering.io +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_MIXPANEL_PROJECT_TOKEN=ff1eea26c19dcf4a7c35ebbc8631e714 -VITE_REWARD_SERVICE_API=https://reward.stg.kyberengineering.io/api/v1 +VITE_SERVICE_WORKER=true -VITE_PRICE_CHART_API=https://price-chart.kyberswap.com/api -VITE_PRICE_API=https://price.stg.kyberengineering.io +VITE_MIXPANEL_PROJECT_TOKEN=fca28a30cb98d872c2079f214955cd5e +VITE_REWARD_SERVICE_API=https://reward.dev.kyberengineering.io/api/v1 -VITE_NOTIFICATION_API=https://notification.stg.kyberengineering.io/api +VITE_PRICE_CHART_API=https://price-chart.dev.kyberengineering.io/api +VITE_PRICE_API=https://price.dev.kyberengineering.io -VITE_CAMPAIGN_BASE_URL=https://campaigns.stg.kyberengineering.io -VITE_TYPE_AND_SWAP_URL=https://type-swap.stg.kyberengineering.io/api +VITE_NOTIFICATION_API=https://notification.dev.kyberengineering.io/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://staging-global.transak.com VITE_TRANSAK_API_KEY=327b8b63-626b-4376-baf2-70a304c48488 -VITE_KS_SETTING_API=https://ks-setting.stg.kyberengineering.io/api +VITE_KS_SETTING_API=https://ks-setting.dev.kyberengineering.io/api VITE_GTM_ID= VITE_GOOGLE_RECAPTCHA_KEY=6Lc7yg0iAAAAALhS4C4Ez5hqMBub8hKdFvvr9sfc -VITE_POOL_FARM_BASE_URL=https://pool-farm.kyberswap.com +VITE_POOL_FARM_BASE_URL=https://pool-farm.dev.kyberengineering.io -VITE_LIMIT_ORDER_API_WRITE=https://limit-order.stg.kyberengineering.io/write/api -VITE_LIMIT_ORDER_API_READ=https://limit-order.stg.kyberengineering.io/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.stg.kyberengineering.io +VITE_KYBER_DAO_STATS_API=https://kyberswap-dao-stats.dev.kyberengineering.io + # oauth -VITE_ENV=staging -VITE_OAUTH_CLIENT_ID=bce9bf52-b788-4c25-9c6c-a07dff080403 +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=11 -VITE_PRICE_ALERT_TOPIC_ID=9 -VITE_ELASTIC_POOL_TOPIC_ID=4,5 -VITE_BFF_API=https://kyberswap-bff.stg.kyberengineering.io/api -VITE_BUCKET_NAME=ks-setting-6d114fd1 +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 From 141f3dc6ff0c9ef6faf41a8fb34413e958bd37ef Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 17 Jul 2023 10:41:48 +0700 Subject: [PATCH 18/25] only verify email when enter email --- .../SubscribeButton/NotificationPreference/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SubscribeButton/NotificationPreference/index.tsx b/src/components/SubscribeButton/NotificationPreference/index.tsx index 7eea548da9..f6d7253857 100644 --- a/src/components/SubscribeButton/NotificationPreference/index.tsx +++ b/src/components/SubscribeButton/NotificationPreference/index.tsx @@ -293,7 +293,7 @@ function NotificationPreference({ const isVerifiedEmail = userInfo?.email && inputEmail === userInfo?.email const needVerifyEmail = inputEmail && inputEmail !== userInfo?.email - const disableCheckbox = false // needVerifyEmail || notFillEmail || hasErrorInput + const disableCheckbox = hasErrorInput const isIncludePriceAlert = useCallback(() => { const changedData = getDiffChangeTopics(topicGroups) return ( @@ -313,7 +313,7 @@ function NotificationPreference({ const checkProfileAndSave = () => { if (disableButtonSave) return - if (!userInfo?.email && !isIncludePriceAlert()) { + if (needVerifyEmail && !isIncludePriceAlert()) { showVerifyModal() return } From d1cae339de64fd907905d5edb7f585543a7aab36 Mon Sep 17 00:00:00 2001 From: Danh Date: Tue, 18 Jul 2023 17:06:30 +0700 Subject: [PATCH 19/25] add more tracking data --- src/utils/iamError.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index e00f46b848..9127340a2a 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -1,7 +1,7 @@ import { captureException } from '@sentry/react' import { AxiosError } from 'axios' -import { BFF_API, ENV_LEVEL } from 'constants/env' +import { BFF_API, ENV_KEY, ENV_LEVEL } from 'constants/env' import { AGGREGATOR_API_PATHS } from 'constants/index' import { ENV_TYPE } from 'constants/type' @@ -52,6 +52,9 @@ export const checkIamDown = (axiosErr: AxiosError) => { statusCode, message: axiosErr?.message, code: axiosErr?.code, + tokenInfoSignIn: localStorage[`${ENV_KEY}_o2_sign_in`], + tokenInfoGuest: localStorage[`${ENV_KEY}_o2_guest`], + profileInfo: localStorage.redux_localstorage_simple_profile, } const apiUrl = axiosErr?.config?.url ?? '' From 1d73a9f42ea534aeaa4d10c3dc0d96bcb61ebe91 Mon Sep 17 00:00:00 2001 From: Danh Date: Tue, 18 Jul 2023 17:06:58 +0700 Subject: [PATCH 20/25] test --- src/utils/iamError.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index 9127340a2a..9b49bc400d 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -17,7 +17,7 @@ const isIamApiDown = () => ErrorInfo.iamApoError >= ErrorInfo.errorThreshold const isRouteApiDown = () => ErrorInfo.routeApiError >= ErrorInfo.errorThreshold const sendError = (name: string, apiUrl: string, trackData: any) => { - if (ENV_LEVEL < ENV_TYPE.STG) return + if (ENV_LEVEL < ENV_TYPE.DEV) return const error = new Error(`${name} Error: ${apiUrl}`) error.name = `${name} was down` captureException(error, { level: 'fatal', extra: { args: JSON.stringify(trackData, null, 2) } }) From fd43acd0e4ebf0957689acd2fd9ade4f0f943fd9 Mon Sep 17 00:00:00 2001 From: Danh Date: Tue, 18 Jul 2023 17:06:30 +0700 Subject: [PATCH 21/25] add more tracking data --- src/utils/iamError.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index e00f46b848..9127340a2a 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -1,7 +1,7 @@ import { captureException } from '@sentry/react' import { AxiosError } from 'axios' -import { BFF_API, ENV_LEVEL } from 'constants/env' +import { BFF_API, ENV_KEY, ENV_LEVEL } from 'constants/env' import { AGGREGATOR_API_PATHS } from 'constants/index' import { ENV_TYPE } from 'constants/type' @@ -52,6 +52,9 @@ export const checkIamDown = (axiosErr: AxiosError) => { statusCode, message: axiosErr?.message, code: axiosErr?.code, + tokenInfoSignIn: localStorage[`${ENV_KEY}_o2_sign_in`], + tokenInfoGuest: localStorage[`${ENV_KEY}_o2_guest`], + profileInfo: localStorage.redux_localstorage_simple_profile, } const apiUrl = axiosErr?.config?.url ?? '' From 9a4f3f873ec7377941e7539bfc8ae26a18882404 Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 19 Jul 2023 08:54:05 +0700 Subject: [PATCH 22/25] update ui inconsistent --- .../swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx | 6 +++--- src/utils/iamError.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx b/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx index 766820b96e..1b6f2d105b 100644 --- a/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx +++ b/src/components/swapv2/SwapSettingsPanel/GasPriceTrackerSetting.tsx @@ -4,7 +4,7 @@ import { isMobile } from 'react-device-detect' import { ChevronRight } from 'react-feather' import styled from 'styled-components' -import SettingLabel from 'components/swapv2/SwapSettingsPanel/SettingLabel' +import { TextDashed } from 'components/Tooltip' import useGasPriceFromDeBank, { GasLevel } from 'hooks/useGasPriceFromDeBank' import useTheme from 'hooks/useTheme' @@ -62,9 +62,9 @@ const GasPriceTrackerSetting: React.FC = ({ onClick }) => { return ( - + Gas Price Tracker - + {getPriceInGweiText(data[GasLevel.NORMAL].gasPriceInGwei)} diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index 9127340a2a..ccf46f6087 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -24,7 +24,7 @@ const sendError = (name: string, apiUrl: string, trackData: any) => { } // hot fix to prevent spam for now. -const blacklistPathBff = ['/v1/notification/me'] +const blacklistPathBff = ['/v1/notification/me', '/v1/tokens/score'] /** * check error status: blocked, maybe cors issues or server down From 4fbdd49e1f19595ae0a18f5cdb0c14638f6efa73 Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 19 Jul 2023 09:03:46 +0700 Subject: [PATCH 23/25] default aggregator api --- .env.adpr | 1 - .env.dev | 1 - .env.production | 1 - .env.stg | 1 - src/constants/env.ts | 1 - src/hooks/useKyberSwapConfig.ts | 4 ++-- 6 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.env.adpr b/.env.adpr index 74879a263b..66d33fd4bb 100644 --- a/.env.adpr +++ b/.env.adpr @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.dev.kyberengineering.io 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 diff --git a/.env.dev b/.env.dev index 74879a263b..66d33fd4bb 100644 --- a/.env.dev +++ b/.env.dev @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.dev.kyberengineering.io 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 diff --git a/.env.production b/.env.production index 5f433581ea..25a41bb57f 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator-api.kyberswap.com 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 diff --git a/.env.stg b/.env.stg index 326145bd06..df9dddb900 100644 --- a/.env.stg +++ b/.env.stg @@ -1,4 +1,3 @@ -VITE_DEFAULT_AGGREGATOR_API=https://meta-aggregator.stg.kyberengineering.io VITE_AGGREGATOR_API=https://aggregator-api.stg.kyberengineering.io VITE_AGGREGATOR_STATS_API=https://aggregator-stats.kyberswap.com VITE_SENTRY_DNS=https://d94ee2d3c22043bdaec966758680b5a8@sentry.ops.kyberengineering.io/4 diff --git a/src/constants/env.ts b/src/constants/env.ts index a99a4387df..27501c13fb 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -13,7 +13,6 @@ const required = (envKey: string): string => { export const GOOGLE_RECAPTCHA_KEY = required('GOOGLE_RECAPTCHA_KEY') export const PRICE_API = required('PRICE_API') -export const DEFAULT_AGGREGATOR_API = required('DEFAULT_AGGREGATOR_API') export const AGGREGATOR_API = required('AGGREGATOR_API') export const SENTRY_DNS = required('SENTRY_DNS') export const REWARD_SERVICE_API = required('REWARD_SERVICE_API') diff --git a/src/hooks/useKyberSwapConfig.ts b/src/hooks/useKyberSwapConfig.ts index 5ef8e6e7c0..4bf08985bc 100644 --- a/src/hooks/useKyberSwapConfig.ts +++ b/src/hooks/useKyberSwapConfig.ts @@ -12,7 +12,7 @@ import { useLazyGetKyberswapConfigurationQuery, } from 'services/ksSetting' -import { DEFAULT_AGGREGATOR_API } from 'constants/env' +import { AGGREGATOR_API } from 'constants/env' import { NETWORKS_INFO, SUPPORTED_NETWORKS, isEVM, isSolana } from 'constants/networks' import ethereumInfo from 'constants/networks/ethereum' import solanaInfo from 'constants/networks/solana' @@ -65,7 +65,7 @@ const parseGlobalResponse = ( chainId: ChainId, ): KyberswapGlobalConfig => { const data = responseData?.data?.config - const aggregatorDomain = data?.aggregator ?? DEFAULT_AGGREGATOR_API + const aggregatorDomain = data?.aggregator ?? AGGREGATOR_API const isEnableAuthenAggregator = !data ? true : !!data?.isEnableAuthenAggregator return { aggregatorDomain, From 980c0968ad16ad46ca3925862290a6266230190c Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 19 Jul 2023 09:11:27 +0700 Subject: [PATCH 24/25] update default authen --- src/hooks/useKyberSwapConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useKyberSwapConfig.ts b/src/hooks/useKyberSwapConfig.ts index 4bf08985bc..60170afc8e 100644 --- a/src/hooks/useKyberSwapConfig.ts +++ b/src/hooks/useKyberSwapConfig.ts @@ -66,7 +66,7 @@ const parseGlobalResponse = ( ): KyberswapGlobalConfig => { const data = responseData?.data?.config const aggregatorDomain = data?.aggregator ?? AGGREGATOR_API - const isEnableAuthenAggregator = !data ? true : !!data?.isEnableAuthenAggregator + const isEnableAuthenAggregator = !!data?.isEnableAuthenAggregator return { aggregatorDomain, aggregatorAPI: `${aggregatorDomain}/${NETWORKS_INFO[chainId].aggregatorRoute}/route/encode`, From d445051bdab6237ddae84b8657063654800a003c Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 19 Jul 2023 11:06:11 +0700 Subject: [PATCH 25/25] revert --- src/utils/iamError.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts index c091665220..ccf46f6087 100644 --- a/src/utils/iamError.ts +++ b/src/utils/iamError.ts @@ -17,7 +17,7 @@ const isIamApiDown = () => ErrorInfo.iamApoError >= ErrorInfo.errorThreshold const isRouteApiDown = () => ErrorInfo.routeApiError >= ErrorInfo.errorThreshold const sendError = (name: string, apiUrl: string, trackData: any) => { - if (ENV_LEVEL < ENV_TYPE.DEV) return + if (ENV_LEVEL < ENV_TYPE.STG) return const error = new Error(`${name} Error: ${apiUrl}`) error.name = `${name} was down` captureException(error, { level: 'fatal', extra: { args: JSON.stringify(trackData, null, 2) } })