{
onClick?.()
- navigate(`${APP_PATHS.KYBERAI_EXPLORE}/${token.chain}/${token.address}`)
+ navigate(`${APP_PATHS.KYBERAI_EXPLORE}/${token.assetId}`)
}}
>
@@ -231,13 +229,13 @@ const TokenItem = ({ token, onClick }: { token: ITokenSearchResult; onClick?: ()
backgroundColor: theme.tableHeader,
}}
>
-
+ /> */}
@@ -322,7 +320,7 @@ const SearchWithDropdown = () => {
)
const [history, setHistory] = useLocalStorage>('kyberai-search-history')
const saveToHistory = (token: ITokenSearchResult) => {
- if (!(history && history.findIndex(t => t.address === token.address && t.chain === token.chain) >= 0)) {
+ if (!(history && history.findIndex(t => t.assetId === token.assetId) >= 0)) {
setHistory([token, ...(history || [])].slice(0, 3))
}
}
@@ -333,7 +331,7 @@ const SearchWithDropdown = () => {
const fetchHistoryTokenInfo = async () => {
const results = await Promise.all(
history.map(t => {
- return getTokenData({ q: t.address, size: 1 }, true).unwrap()
+ return getTokenData({ q: t.assetId, size: 1 }, true).unwrap()
}),
)
setHistory(results.map(res => res[0]))
@@ -407,7 +405,7 @@ const SearchWithDropdown = () => {
{searchResult.map(item => (
{
setExpanded(false)
diff --git a/src/pages/TrueSightV2/components/SwitchVariantDropdown.tsx b/src/pages/TrueSightV2/components/SwitchVariantDropdown.tsx
new file mode 100644
index 0000000000..b27552cc54
--- /dev/null
+++ b/src/pages/TrueSightV2/components/SwitchVariantDropdown.tsx
@@ -0,0 +1,150 @@
+import { AnimatePresence, motion } from 'framer-motion'
+import { useRef, useState } from 'react'
+import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'
+import { useSearchParams } from 'react-router-dom'
+import { Text } from 'rebass'
+import styled from 'styled-components'
+
+import { ReactComponent as Down } from 'assets/svg/down.svg'
+import Icon from 'components/Icons/Icon'
+import Row, { RowFit } from 'components/Row'
+import { ICON_ID } from 'constants/index'
+import { useOnClickOutside } from 'hooks/useOnClickOutside'
+import useTheme from 'hooks/useTheme'
+
+import useKyberAIAssetOverview from '../hooks/useKyberAIAssetOverview'
+
+const Wrapper = styled.div`
+ position: relative;
+`
+const SelectButton = styled(RowFit)`
+ height: 36px;
+ border-radius: 99px;
+ padding: 8px 12px;
+ background-color: ${({ theme }) => theme.buttonGray};
+ gap: 8px;
+ cursor: pointer;
+ font-size: 14px;
+ width: 135px;
+
+ :hover {
+ z-index: 10;
+ filter: brightness(1.2);
+ }
+`
+
+const DropdownWrapper = styled(motion.div)`
+ position: absolute;
+ width: 100%;
+ border-radius: 10px;
+ background-color: ${({ theme }) => theme.buttonGray};
+ left: 0;
+ top: calc(100% + 2px);
+ padding: 4px;
+ z-index: 10;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+`
+
+const DropdownItem = styled(Row)`
+ height: 32px;
+ padding: 4px 8px;
+ gap: 8px;
+ border-radius: 4px;
+ font-size: 14px;
+ cursor: pointer;
+ :hover {
+ filter: brightness(1.2);
+ background-color: ${({ theme }) => theme.background};
+ }
+`
+
+const VARIANTS: { [key: string]: { icon_id: ICON_ID; title: string } } = {
+ ethereum: { icon_id: 'eth-mono', title: 'Ethereum' },
+ bsc: { icon_id: 'bnb-mono', title: 'Binance' },
+ avalanche: { icon_id: 'ava-mono', title: 'Avalanche' },
+ polygon: { icon_id: 'matic-mono', title: 'Polygon' },
+ arbitrum: { icon_id: 'arbitrum-mono', title: 'Arbitrum' },
+ fantom: { icon_id: 'fantom-mono', title: 'Fantom' },
+ optimism: { icon_id: 'optimism-mono', title: 'Optimism' },
+}
+
+export default function SwitchVariantDropdown({
+ variants,
+ isLoading,
+}: {
+ variants?: { chain: string; address: string }[]
+ isLoading?: boolean
+}) {
+ const theme = useTheme()
+ const [show, setShow] = useState(false)
+ const ref = useRef(null)
+ const [, setSearchParams] = useSearchParams()
+ const { chain, address } = useKyberAIAssetOverview()
+ useOnClickOutside(ref, () => setShow(false))
+ const variant = variants?.find(item => item.address.toLowerCase() === address && item.chain.toLowerCase() === chain)
+ console.log('🚀 ~ file: SwitchVariantDropdown.tsx:87 ~ variant:', variant)
+ if (!variant && isLoading) {
+ return (
+
+
+
+ )
+ }
+
+ const setChainAndAdress = (variant: { chain: string; address: string }) => {
+ setSearchParams({ chain: variant.chain, address: variant.address })
+ }
+ const variantInfo = !!variant ? VARIANTS[variant?.chain] : undefined
+
+ return (
+
+ setShow(true)}>
+
+ {variantInfo && (
+ <>
+
+ {variantInfo.title}{' '}
+ >
+ )}
+
+
+
+
+ {show && !!variants?.length && (
+
+ {variants?.map(item => {
+ const itemVariant = VARIANTS[item.chain]
+ return (
+ {
+ setShow(false)
+ setChainAndAdress(item)
+ }}
+ >
+
+ {itemVariant.title}
+
+ )
+ })}
+
+ )}
+
+
+ )
+}
diff --git a/src/pages/TrueSightV2/components/TimeFrameLegend.tsx b/src/pages/TrueSightV2/components/TimeFrameLegend.tsx
index f1b9df1bc0..9bb47749a9 100644
--- a/src/pages/TrueSightV2/components/TimeFrameLegend.tsx
+++ b/src/pages/TrueSightV2/components/TimeFrameLegend.tsx
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components'
import { MIXPANEL_TYPE, useMixpanelKyberAI } from 'hooks/useMixpanel'
-import useKyberAITokenOverview from '../hooks/useKyberAITokenOverview'
+import useKyberAIAssetOverview from '../hooks/useKyberAIAssetOverview'
import { KyberAITimeframe } from '../types'
const TimeFrameWrapper = styled.div`
@@ -72,7 +72,7 @@ const TimeFrameLegend = ({
const ref = useRef(null)
const [left, setLeft] = useState(0)
const [width, setWidth] = useState(0)
- const { data: token } = useKyberAITokenOverview()
+ const { data: token } = useKyberAIAssetOverview()
const handleSelect = (t: KyberAITimeframe) => {
const wrapperEl = ref.current?.closest('section-wrapper')
diff --git a/src/pages/TrueSightV2/components/TokenListVariants.tsx b/src/pages/TrueSightV2/components/TokenListVariants.tsx
index 0bc5a4c6e0..ce3a4a807b 100644
--- a/src/pages/TrueSightV2/components/TokenListVariants.tsx
+++ b/src/pages/TrueSightV2/components/TokenListVariants.tsx
@@ -1,4 +1,20 @@
+import { useTheme } from 'styled-components'
+
import Icon from 'components/Icons/Icon'
+import Row from 'components/Row'
+import { ICON_ID } from 'constants/index'
+
+const VARIANTS: { [key: string]: { icon_id: ICON_ID; title: string } } = {
+ ethereum: { icon_id: 'eth-mono', title: 'Ethereum' },
+ bsc: { icon_id: 'bnb-mono', title: 'Binance' },
+ avalanche: { icon_id: 'ava-mono', title: 'Avalanche' },
+ polygon: { icon_id: 'matic-mono', title: 'Polygon' },
+ arbitrum: { icon_id: 'arbitrum-mono', title: 'Arbitrum' },
+ fantom: { icon_id: 'fantom-mono', title: 'Fantom' },
+ optimism: { icon_id: 'optimism-mono', title: 'Optimism' },
+}
+
+const MAX_ICONS_SHOWING = 8
export default function TokenListVariants({
tokens,
@@ -7,29 +23,16 @@ export default function TokenListVariants({
tokens: Array<{ address: string; logo: string; chain: string }>
iconSize?: number
}) {
+ const theme = useTheme()
return (
- <>
+
{tokens.map((item, index) => {
+ if (index > MAX_ICONS_SHOWING) return
+ if (index === MAX_ICONS_SHOWING) return ...
const key = item.address + '_' + index
- switch (item.chain) {
- case 'ethereum':
- return
- case 'bsc':
- return
- case 'avalanche':
- return
- case 'polygon':
- return
- case 'arbitrum':
- return
- case 'fantom':
- return
- case 'optimism':
- return
- default:
- return <>>
- }
+ const variant = VARIANTS[item.chain]
+ return
})}
- >
+
)
}
diff --git a/src/pages/TrueSightV2/components/TokenOverview.tsx b/src/pages/TrueSightV2/components/TokenOverview.tsx
index 27324dc590..cfe195c72f 100644
--- a/src/pages/TrueSightV2/components/TokenOverview.tsx
+++ b/src/pages/TrueSightV2/components/TokenOverview.tsx
@@ -21,7 +21,7 @@ import { getEtherscanLink, shortenAddress } from 'utils'
import { ShareButton } from '.'
import { MIXPANEL_KYBERAI_TAG, NETWORK_IMAGE_URL, NETWORK_TO_CHAINID } from '../constants'
-import { ITokenOverview } from '../types'
+import { IAssetOverview } from '../types'
import { calculateValueToColor, formatLocaleStringNum, formatTokenPrice } from '../utils'
import ChevronIcon from './ChevronIcon'
import KyberAIShareModal from './KyberAIShareModal'
@@ -143,7 +143,7 @@ const ExternalLink = ({ href, className, children }: { href: string; className?:
)
}
-export const TokenOverview = ({ data, isLoading }: { data?: ITokenOverview; isLoading?: boolean }) => {
+export const TokenOverview = ({ data, isLoading }: { data?: IAssetOverview; isLoading?: boolean }) => {
const theme = useTheme()
const { chain } = useParams()
const mixpanelHandler = useMixpanelKyberAI()
diff --git a/src/pages/TrueSightV2/components/chart/datafeed.tsx b/src/pages/TrueSightV2/components/chart/datafeed.tsx
index 1157417494..bccef89c3a 100644
--- a/src/pages/TrueSightV2/components/chart/datafeed.tsx
+++ b/src/pages/TrueSightV2/components/chart/datafeed.tsx
@@ -13,13 +13,13 @@ import {
import { getTradingViewTimeZone } from 'components/TradingViewChart/utils'
import { useLazyChartingDataQuery } from 'pages/TrueSightV2/hooks/useKyberAIData'
import { defaultExplorePageToken } from 'pages/TrueSightV2/pages/SingleToken'
-import { ITokenOverview, OHLCData } from 'pages/TrueSightV2/types'
+import { IAssetOverview, OHLCData } from 'pages/TrueSightV2/types'
const configurationData = {
supported_resolutions: ['1H', '4H', '1D', '4D'],
}
-export const useDatafeed = (isBTC: boolean, token?: ITokenOverview) => {
+export const useDatafeed = (isBTC: boolean, token?: IAssetOverview) => {
const intervalRef = useRef()
const { chain, address } = useParams()
const [getChartingData, { isLoading }] = useLazyChartingDataQuery()
diff --git a/src/pages/TrueSightV2/components/chart/index.tsx b/src/pages/TrueSightV2/components/chart/index.tsx
index 16fa66b24a..88099fc5d3 100644
--- a/src/pages/TrueSightV2/components/chart/index.tsx
+++ b/src/pages/TrueSightV2/components/chart/index.tsx
@@ -4,7 +4,6 @@ import { rgba } from 'polished'
import React, { ReactNode, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { isMobile } from 'react-device-detect'
import { Info } from 'react-feather'
-import { useParams } from 'react-router-dom'
import { useMedia } from 'react-use'
import { Text } from 'rebass'
import {
@@ -41,6 +40,7 @@ import { useActiveWeb3React } from 'hooks'
import useTheme from 'hooks/useTheme'
import { KYBERAI_CHART_ID, NETWORK_TO_CHAINID } from 'pages/TrueSightV2/constants'
import { CHART_STATES_ACTION_TYPE, useChartStatesContext } from 'pages/TrueSightV2/hooks/useChartStatesReducer'
+import useKyberAIAssetOverview from 'pages/TrueSightV2/hooks/useKyberAIAssetOverview'
import {
useCexesLiquidationQuery,
useHolderListQuery,
@@ -50,7 +50,6 @@ import {
useTradingVolumeQuery,
useTransferInformationQuery,
} from 'pages/TrueSightV2/hooks/useKyberAIData'
-import useKyberAITokenOverview from 'pages/TrueSightV2/hooks/useKyberAITokenOverview'
import { defaultExplorePageToken } from 'pages/TrueSightV2/pages/SingleToken'
import { TechnicalAnalysisContext } from 'pages/TrueSightV2/pages/TechnicalAnalysis'
import {
@@ -297,7 +296,7 @@ const roundNumberUp = (number: number) => {
export const NumberofTradesChart = ({ noAnimation }: { noAnimation?: boolean }) => {
const theme = useTheme()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.NUMBER_OF_TRADES, {
timeframe: KyberAITimeframe.ONE_MONTH,
showOptions: ['showSell', 'showBuy', 'showTotalTrade'],
@@ -328,11 +327,14 @@ export const NumberofTradesChart = ({ noAnimation }: { noAnimation?: boolean })
}[timeframe as string] || 604800)
return [from, now, timerange]
}, [timeframe])
- const { data, isLoading } = useTradingVolumeQuery({
- chain: chain || defaultExplorePageToken.chain,
- address: address || defaultExplorePageToken.address,
- params: { from, to },
- })
+ const { data, isLoading } = useTradingVolumeQuery(
+ {
+ chain: chain,
+ address: address,
+ params: { from, to },
+ },
+ { skip: !address || !chain },
+ )
const dataRange = useMemo(() => {
if (!data) return undefined
@@ -615,7 +617,7 @@ export const NumberofTradesChart = ({ noAnimation }: { noAnimation?: boolean })
export const TradingVolumeChart = ({ noAnimation }: { noAnimation?: boolean }) => {
const theme = useTheme()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.TRADING_VOLUME, {
timeframe: KyberAITimeframe.ONE_MONTH,
showOptions: ['showSell', 'showBuy', 'showTotalVolume'],
@@ -938,7 +940,7 @@ export const TradingVolumeChart = ({ noAnimation }: { noAnimation?: boolean }) =
export const NetflowToWhaleWallets = ({ tab, noAnimation }: { tab?: ChartTab; noAnimation?: boolean }) => {
const theme = useTheme()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.NETFLOW_TO_WHALE_WALLET, {
timeframe: KyberAITimeframe.ONE_WEEK,
showOptions: ['showInflow', 'showOutflow', 'showNetflow'],
@@ -1381,7 +1383,7 @@ export const NetflowToWhaleWallets = ({ tab, noAnimation }: { tab?: ChartTab; no
export const NetflowToCentralizedExchanges = ({ tab, noAnimation }: { tab?: ChartTab; noAnimation?: boolean }) => {
const theme = useTheme()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.NETFLOW_TO_CEX, {
timeframe: KyberAITimeframe.ONE_WEEK,
showOptions: ['showInflow', 'showOutflow', 'showNetflow'],
@@ -1773,7 +1775,7 @@ export const NetflowToCentralizedExchanges = ({ tab, noAnimation }: { tab?: Char
export const NumberofTransfers = ({ tab }: { tab: ChartTab }) => {
const theme = useTheme()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.NUMBER_OF_TRANSFERS, {
timeframe: KyberAITimeframe.ONE_MONTH,
noData: true,
@@ -1962,7 +1964,7 @@ export const NumberofTransfers = ({ tab }: { tab: ChartTab }) => {
export const NumberofHolders = () => {
const theme = useTheme()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.NUMBER_OF_HOLDERS, {
timeframe: KyberAITimeframe.ONE_MONTH,
noData: true,
@@ -2138,7 +2140,7 @@ export const NumberofHolders = () => {
const COLORS = ['#00a2f7', '#31CB9E', '#FFBB28', '#F3841E', '#FF537B', '#27AE60', '#78d5ff', '#8088E5']
const CustomLabel = ({ x, y, cx, cy, name, address, percentage, sumPercentage }: any) => {
let customY = y
- const { chain } = useParams()
+ const { chain } = useKyberAIAssetOverview()
if (Math.abs(cx - x) < 30) {
customY = cy - y > 0 ? y - 8 : y + 8
}
@@ -2177,22 +2179,11 @@ const CustomLabelLine = (props: any) => {
)}
>
)
- // if (percentage > 0.01) {
- // return (
- //
- // )
- // } else {
- // return
- // }
}
export const HoldersChartWrapper = ({ noAnimation }: { noAnimation?: boolean }) => {
const theme = useTheme()
const above768 = useMedia(`(min-width:${MEDIA_WIDTHS.upToSmall}px)`)
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { dispatch } = useChartStatesContext(KYBERAI_CHART_ID.HOLDER_PIE_CHART, {
noData: true,
})
@@ -2268,7 +2259,7 @@ export const HoldersChartWrapper = ({ noAnimation }: { noAnimation?: boolean })
export const LiquidOnCentralizedExchanges = ({ noAnimation }: { noAnimation?: boolean }) => {
const theme = useTheme()
const { account } = useActiveWeb3React()
- const { chain, address } = useParams()
+ const { chain, address } = useKyberAIAssetOverview()
const { state, dispatch } = useChartStatesContext(KYBERAI_CHART_ID.LIQUID_ON_CEX, {
timeframe: KyberAITimeframe.ONE_MONTH,
noData: true,
@@ -2303,7 +2294,7 @@ export const LiquidOnCentralizedExchanges = ({ noAnimation }: { noAnimation?: bo
},
{ skip: !address || !chain },
)
- const { data: tokenOverview } = useKyberAITokenOverview()
+ const { data: tokenOverview } = useKyberAIAssetOverview()
const [showLong, setShowLong] = useState(true)
const [showShort, setShowShort] = useState(true)
const [showPrice, setShowPrice] = useState(true)
@@ -2655,7 +2646,7 @@ export const Prochart = ({
const [fullscreen, setFullscreen] = useState(false)
const [loading, setLoading] = useState(false)
const userLocale = useUserLocale()
- const { data } = useKyberAITokenOverview()
+ const { data } = useKyberAIAssetOverview()
const datafeed = useDatafeed(isBTC || false, data)
const { SRLevels, currentPrice, resolution, setResolution, showSRLevels } = useContext(TechnicalAnalysisContext)
diff --git a/src/pages/TrueSightV2/components/index.tsx b/src/pages/TrueSightV2/components/index.tsx
index bae6270824..d053fa307a 100644
--- a/src/pages/TrueSightV2/components/index.tsx
+++ b/src/pages/TrueSightV2/components/index.tsx
@@ -18,7 +18,7 @@ import { CloseIcon, MEDIA_WIDTHS } from 'theme'
import { openFullscreen } from 'utils/index'
import { MIXPANEL_KYBERAI_TAG } from '../constants'
-import useKyberAITokenOverview from '../hooks/useKyberAITokenOverview'
+import useKyberAIAssetOverview from '../hooks/useKyberAIAssetOverview'
import { ChartTab } from '../types'
import KyberAIShareModal from './KyberAIShareModal'
@@ -144,7 +144,7 @@ export const SectionWrapper = ({
const theme = useTheme()
const mixpanelHandler = useMixpanelKyberAI()
const { chain } = useParams()
- const { data: token } = useKyberAITokenOverview()
+ const { data: token } = useKyberAIAssetOverview()
const ref = useRef(null)
const above768 = useMedia(`(min-width:${MEDIA_WIDTHS.upToSmall}px)`)
const [showText, setShowText] = useState(above768 ? true : false)
diff --git a/src/pages/TrueSightV2/components/shareContent/ExploreTopShareContent.tsx b/src/pages/TrueSightV2/components/shareContent/ExploreTopShareContent.tsx
index 1cf0e72697..c66e11bac1 100644
--- a/src/pages/TrueSightV2/components/shareContent/ExploreTopShareContent.tsx
+++ b/src/pages/TrueSightV2/components/shareContent/ExploreTopShareContent.tsx
@@ -9,7 +9,7 @@ import Column from 'components/Column'
import Divider from 'components/Divider'
import Row, { RowFit } from 'components/Row'
import { useTokenListQuery } from 'pages/TrueSightV2/hooks/useKyberAIData'
-import { ITokenOverview, KyberAIListType } from 'pages/TrueSightV2/types'
+import { IAssetOverview, KyberAIListType } from 'pages/TrueSightV2/types'
import { calculateValueToColor, formatTokenPrice } from 'pages/TrueSightV2/utils'
import ChevronIcon from '../ChevronIcon'
@@ -72,7 +72,7 @@ const PriceChart7Days = ({
)
}
-export default function ExploreShareContent({ token, mobileMode }: { token?: ITokenOverview; mobileMode?: boolean }) {
+export default function ExploreShareContent({ token, mobileMode }: { token?: IAssetOverview; mobileMode?: boolean }) {
const theme = useTheme()
const { data } = useTokenListQuery(
{ type: KyberAIListType.ALL, page: 1, pageSize: 5, keywords: token?.address },
diff --git a/src/pages/TrueSightV2/components/shareContent/KyberScoreShareContent.tsx b/src/pages/TrueSightV2/components/shareContent/KyberScoreShareContent.tsx
index d921e784f1..fcd4e2d202 100644
--- a/src/pages/TrueSightV2/components/shareContent/KyberScoreShareContent.tsx
+++ b/src/pages/TrueSightV2/components/shareContent/KyberScoreShareContent.tsx
@@ -5,7 +5,7 @@ import { Text } from 'rebass'
import Column from 'components/Column'
import Row from 'components/Row'
import useTheme from 'hooks/useTheme'
-import { ITokenOverview } from 'pages/TrueSightV2/types'
+import { IAssetOverview } from 'pages/TrueSightV2/types'
import { calculateValueToColor, formatTokenPrice } from 'pages/TrueSightV2/utils'
import KyberScoreMeter from '../KyberScoreMeter'
@@ -15,7 +15,7 @@ export default function KyberScoreShareContent({
token,
mobileMode,
}: {
- token?: ITokenOverview
+ token?: IAssetOverview
mobileMode?: boolean
}) {
const theme = useTheme()
diff --git a/src/pages/TrueSightV2/components/table/index.tsx b/src/pages/TrueSightV2/components/table/index.tsx
index 513cb40728..dee425e73b 100644
--- a/src/pages/TrueSightV2/components/table/index.tsx
+++ b/src/pages/TrueSightV2/components/table/index.tsx
@@ -6,7 +6,7 @@ import { ReactNode, useCallback, useContext, useMemo, useRef, useState } from 'r
import { isMobile } from 'react-device-detect'
import { Info } from 'react-feather'
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'
-import { useNavigate, useParams } from 'react-router-dom'
+import { useNavigate } from 'react-router-dom'
import { Text } from 'rebass'
import styled, { DefaultTheme, css } from 'styled-components'
@@ -21,9 +21,16 @@ import Row, { RowFit } from 'components/Row'
import { APP_PATHS } from 'constants/index'
import { useOnClickOutside } from 'hooks/useOnClickOutside'
import useTheme from 'hooks/useTheme'
-import { NETWORK_IMAGE_URL, NETWORK_TO_CHAINID, Z_INDEX_KYBER_AI } from 'pages/TrueSightV2/constants'
-import { useFundingRateQuery, useHolderListQuery, useLiveDexTradesQuery } from 'pages/TrueSightV2/hooks/useKyberAIData'
-import useKyberAITokenOverview from 'pages/TrueSightV2/hooks/useKyberAITokenOverview'
+import { NETWORK_IMAGE_URL, NETWORK_TO_CHAINID } from 'pages/TrueSightV2/constants'
+import useIsReachMaxLimitWatchedToken from 'pages/TrueSightV2/hooks/useIsReachMaxLimitWatchedToken'
+import useKyberAIAssetOverview from 'pages/TrueSightV2/hooks/useKyberAIAssetOverview'
+import {
+ useAddToWatchlistMutation,
+ useFundingRateQuery,
+ useHolderListQuery,
+ useLiveDexTradesQuery,
+ useRemoveFromWatchlistMutation,
+} from 'pages/TrueSightV2/hooks/useKyberAIData'
import { TechnicalAnalysisContext } from 'pages/TrueSightV2/pages/TechnicalAnalysis'
import { IHolderList, IKyberScoreChart, ILiveTrade, ITokenList, KyberAITimeframe } from 'pages/TrueSightV2/types'
import {
@@ -162,9 +169,8 @@ const LoadingHandleWrapper = ({
export const Top10HoldersTable = () => {
const theme = useTheme()
- const { chain, address } = useParams()
- const { data, isLoading } = useHolderListQuery({ address, chain })
- const { data: tokenOverview } = useKyberAITokenOverview()
+ const { data: tokenOverview, chain, address } = useKyberAIAssetOverview()
+ const { data, isLoading } = useHolderListQuery({ address, chain }, { skip: !chain || !address })
return (
0} height="400px">
@@ -363,8 +369,8 @@ function colorRateText(value: number, theme: DefaultTheme) {
export const FundingRateTable = ({ mobileMode }: { mobileMode?: boolean }) => {
const theme = useTheme()
- const { chain, address } = useParams()
- const { data, isLoading } = useFundingRateQuery({ address, chain })
+ const { chain, address } = useKyberAIAssetOverview()
+ const { data, isLoading } = useFundingRateQuery({ address, chain }, { skip: !chain || !address })
if (mobileMode) {
return (
@@ -448,15 +454,15 @@ export const FundingRateTable = ({ mobileMode }: { mobileMode?: boolean }) => {
export const LiveDEXTrades = () => {
const theme = useTheme()
const [currentPage, setCurrentPage] = useState(1)
- const { chain, address } = useParams()
+ const { data: tokenOverview, chain, address } = useKyberAIAssetOverview()
+
const { data, isLoading } = useLiveDexTradesQuery(
{
chain,
address,
},
- { pollingInterval: 10000 },
+ { pollingInterval: 10000, skip: !chain || !address },
)
- const { data: tokenOverview } = useKyberAITokenOverview()
return (
<>
@@ -586,44 +592,25 @@ const WidgetTokenRow = ({
const latestKyberScore: IKyberScoreChart | undefined = token?.ks_3d?.[token.ks_3d.length - 1]
const hasMutipleChain = token?.tokens?.length > 1
- const [showMenu, setShowMenu] = useState(false)
const [showSwapMenu, setShowSwapMenu] = useState(false)
- const [menuLeft, setMenuLeft] = useState(undefined)
- // const [isWatched, setIsWatched] = useState(!!token.isWatched)
- // const [loadingStar, setLoadingStar] = useState(false)
- // const [addToWatchlist] = useAddToWatchlistMutation()
- // const [removeFromWatchlist] = useRemoveFromWatchlistMutation()
+ const [isWatched, setIsWatched] = useState(!!token.isWatched)
+ const [loadingStar, setLoadingStar] = useState(false)
+ const [addToWatchlist] = useAddToWatchlistMutation()
+ const [removeFromWatchlist] = useRemoveFromWatchlistMutation()
const rowRef = useRef(null)
- const menuRef = useRef(null)
- useOnClickOutside(rowRef, () => setShowMenu(false))
useOnClickOutside(rowRef, () => setShowSwapMenu(false))
- const handleRowClick = (e: any) => {
- if (hasMutipleChain) {
- const left = e.clientX - (rowRef.current?.getBoundingClientRect()?.left || 0)
- const rowWidth = rowRef.current?.getBoundingClientRect()?.width || 0
- const menuWidth = menuRef.current?.getBoundingClientRect()?.width || 0
- if (left !== undefined) {
- setMenuLeft(Math.min(left, rowWidth - menuWidth))
- setShowMenu(true)
- }
- } else {
- navigate(`${APP_PATHS.KYBERAI_EXPLORE}/${token.tokens[0].chain}/${token.tokens[0].address}`)
- onClick?.()
- }
+ const handleRowClick = () => {
+ navigate(`${APP_PATHS.KYBERAI_EXPLORE}/${token.asset_id}`)
+ onClick?.()
}
const handleSwapClick = (e: any) => {
e.stopPropagation()
if (hasMutipleChain) {
- const left =
- e.clientX -
- (rowRef.current?.getBoundingClientRect()?.left || 0) -
- (menuRef.current?.getBoundingClientRect()?.width || 0)
setShowSwapMenu(true)
- setMenuLeft(left)
} else {
navigateToSwapPage({ address: token.tokens[0].address, chain: token.tokens[0].chain })
}
@@ -774,22 +761,7 @@ const WidgetTokenRow = ({
|
{hasMutipleChain && (
<>
- {
- onClick?.()
- navigate(`${APP_PATHS.KYBERAI_EXPLORE}/${chain}/${address}`)
- }}
- />
-
+
>
)}
@@ -994,7 +966,7 @@ export const Top10HoldersShareModalTable = ({
startIndex?: number
}) => {
const theme = useTheme()
- const { data: tokenOverview } = useKyberAITokenOverview()
+ const { data: tokenOverview } = useKyberAIAssetOverview()
return (
@@ -1061,7 +1033,7 @@ export const LiveTradesInShareModalTable = ({
mobileMode?: boolean
}) => {
const theme = useTheme()
- const { data: tokenOverview } = useKyberAITokenOverview()
+ const { data: tokenOverview } = useKyberAIAssetOverview()
return (
diff --git a/src/pages/TrueSightV2/hooks/useKyberAIAssetOverview.tsx b/src/pages/TrueSightV2/hooks/useKyberAIAssetOverview.tsx
new file mode 100644
index 0000000000..557d492a6d
--- /dev/null
+++ b/src/pages/TrueSightV2/hooks/useKyberAIAssetOverview.tsx
@@ -0,0 +1,22 @@
+import { useParams } from 'react-router'
+import { useSearchParams } from 'react-router-dom'
+
+import { useIsWhiteListKyberAI } from 'state/user/hooks'
+
+import { useAssetOverviewQuery } from './useKyberAIData'
+
+export default function useKyberAIAssetOverview() {
+ const { isWhiteList } = useIsWhiteListKyberAI()
+ const { assetId } = useParams()
+
+ const [searchParams] = useSearchParams()
+
+ const result = useAssetOverviewQuery({ assetId }, { skip: !assetId || !isWhiteList })
+
+ return {
+ data: result.data,
+ isLoading: result.isLoading,
+ address: searchParams.get('address') || undefined,
+ chain: searchParams.get('chain') || undefined,
+ }
+}
diff --git a/src/pages/TrueSightV2/hooks/useKyberAIData.tsx b/src/pages/TrueSightV2/hooks/useKyberAIData.tsx
index 0b9d37a940..849649ba68 100644
--- a/src/pages/TrueSightV2/hooks/useKyberAIData.tsx
+++ b/src/pages/TrueSightV2/hooks/useKyberAIData.tsx
@@ -4,6 +4,7 @@ import baseQueryOauth from 'services/baseQueryOauth'
import { BFF_API } from 'constants/env'
import {
+ IAssetOverview,
ILiquidCEX,
ILiveTrade,
INetflowToCEX,
@@ -12,7 +13,6 @@ import {
INumberOfTrades,
INumberOfTransfers,
ITokenList,
- ITokenOverview,
ITokenSearchResult,
ITradingVolume,
OHLCData,
@@ -48,7 +48,7 @@ const kyberAIApi = createApi({
},
providesTags: (result, error, arg) => (arg.watchlist === true ? ['myWatchList', 'tokenList'] : ['tokenList']),
}),
- //2.
+ //2. TODO
addToWatchlist: builder.mutation({
query: (params: { tokenAddress: string; chain: string }) => ({
url: `/watchlist`,
@@ -57,7 +57,7 @@ const kyberAIApi = createApi({
}),
invalidatesTags: (res, err, params) => [{ type: 'tokenOverview', id: params.tokenAddress }, 'myWatchList'],
}),
- //3.
+ //3. TODO
removeFromWatchlist: builder.mutation({
query: (params: { tokenAddress: string; chain: string }) => ({
url: `/watchlist`,
@@ -70,9 +70,20 @@ const kyberAIApi = createApi({
'tokenList',
],
}),
-
+ assetOverview: builder.query({
+ query: ({ assetId }: { assetId?: string }) => ({
+ url: `/assets/${assetId}`,
+ }),
+ transformResponse: (res: any) => {
+ // If token is stablecoin remove its kyberscore value
+ if (res.data && res.data.tags?.includes('stablecoin')) {
+ return { ...res.data, kyberScore: { ks3d: null, label: '', score: 0 } }
+ }
+ return res.data
+ },
+ }),
//4.
- tokenDetail: builder.query({
+ tokenOverview: builder.query({
query: ({ chain, address }: { chain?: string; address?: string }) => ({
url: `/overview/${chain}/${address}`,
}),
@@ -83,7 +94,6 @@ const kyberAIApi = createApi({
}
return res.data
},
- providesTags: result => [{ type: 'tokenOverview', id: result?.address }],
}),
//5.
numberOfTrades: builder.query({
@@ -163,7 +173,7 @@ const kyberAIApi = createApi({
//11.
chartingData: builder.query<
OHLCData[],
- { chain: string; address: string; from: number; to: number; candleSize: string; currency: string }
+ { chain?: string; address?: string; from: number; to: number; candleSize: string; currency: string }
>({
query: ({ chain, address, from, to, candleSize, currency }) => ({
url: `/ohlcv/${chain}/${address}`,
@@ -250,7 +260,8 @@ const kyberAIApi = createApi({
})
export const {
- useTokenDetailQuery,
+ useAssetOverviewQuery,
+ useTokenOverviewQuery,
useNumberOfTradesQuery,
useTradingVolumeQuery,
useNetflowToWhaleWalletsQuery,
diff --git a/src/pages/TrueSightV2/hooks/useKyberAITokenOverview.tsx b/src/pages/TrueSightV2/hooks/useKyberAITokenOverview.tsx
deleted file mode 100644
index 5548573a65..0000000000
--- a/src/pages/TrueSightV2/hooks/useKyberAITokenOverview.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { useParams } from 'react-router'
-
-import { useIsWhiteListKyberAI } from 'state/user/hooks'
-
-import { useTokenDetailQuery } from './useKyberAIData'
-
-export default function useKyberAITokenOverview() {
- const { isWhiteList } = useIsWhiteListKyberAI()
- const { chain, address } = useParams()
- const result = useTokenDetailQuery({ chain, address }, { skip: !chain || !address || !isWhiteList })
-
- return result
-}
diff --git a/src/pages/TrueSightV2/pages/SingleToken.tsx b/src/pages/TrueSightV2/pages/SingleToken.tsx
index 8573521e33..1b658513f5 100644
--- a/src/pages/TrueSightV2/pages/SingleToken.tsx
+++ b/src/pages/TrueSightV2/pages/SingleToken.tsx
@@ -3,12 +3,14 @@ import { rgba } from 'polished'
import { stringify } from 'querystring'
import { ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { ChevronLeft } from 'react-feather'
-import { useLocation, useNavigate, useParams } from 'react-router-dom'
+import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'
+import { useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom'
import { useMedia } from 'react-use'
import { Text } from 'rebass'
import styled, { css } from 'styled-components'
import { ButtonPrimary } from 'components/Button'
+import Column from 'components/Column'
import Icon from 'components/Icons/Icon'
import { DotsLoader } from 'components/Loader/DotsLoader'
import Row, { RowBetween, RowFit } from 'components/Row'
@@ -22,13 +24,16 @@ import DisplaySettings from '../components/DisplaySettings'
import FeedbackSurvey from '../components/FeedbackSurvey'
import KyberAIShareModal from '../components/KyberAIShareModal'
import SimpleTooltip from '../components/SimpleTooltip'
+import SwitchVariantDropdown from '../components/SwitchVariantDropdown'
import { TokenOverview } from '../components/TokenOverview'
import WatchlistButton from '../components/WatchlistButton'
import ExploreShareContent from '../components/shareContent/ExploreTopShareContent'
import { MIXPANEL_KYBERAI_TAG, NETWORK_IMAGE_URL, NETWORK_TO_CHAINID } from '../constants'
import useChartStatesReducer, { ChartStatesContext } from '../hooks/useChartStatesReducer'
-import useKyberAITokenOverview from '../hooks/useKyberAITokenOverview'
-import { DiscoverTokenTab, ITokenOverview } from '../types'
+import useIsReachMaxLimitWatchedToken from '../hooks/useIsReachMaxLimitWatchedToken'
+import useKyberAIAssetOverview from '../hooks/useKyberAIAssetOverview'
+import { useAddToWatchlistMutation, useRemoveFromWatchlistMutation } from '../hooks/useKyberAIData'
+import { DiscoverTokenTab, IAssetOverview } from '../types'
import { navigateToSwapPage } from '../utils'
import OnChainAnalysis from './OnChainAnalysis'
import TechnicalAnalysis from './TechnicalAnalysis'
@@ -150,7 +155,8 @@ const TabButton = styled.div<{ active?: boolean }>`
export const defaultExplorePageToken = {
chain: 'ethereum',
- address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', //TODO: remove
+ assetId: 1,
}
const StyledTokenDescription = styled.div<{ show?: boolean }>`
@@ -232,19 +238,19 @@ const TokenDescription = ({ description }: { description: string }) => {
)
}
-const TokenNameGroup = ({ token, isLoading }: { token?: ITokenOverview; isLoading?: boolean }) => {
- // const { account } = useActiveWeb3React()
+const TokenNameGroup = ({ token, isLoading }: { token?: IAssetOverview; isLoading?: boolean }) => {
+ const { account } = useActiveWeb3React()
const theme = useTheme()
// const mixpanelHandler = useMixpanelKyberAI()
const navigate = useNavigate()
const location = useLocation()
const above768 = useMedia(`(min-width:${MEDIA_WIDTHS.upToSmall}px)`)
- const { chain } = useParams()
- // const reachedMaxLimit = useIsReachMaxLimitWatchedToken()
- // const [addToWatchlist, { isLoading: loadingAddtoWatchlist }] = useAddToWatchlistMutation()
- // const [removeFromWatchlist, { isLoading: loadingRemovefromWatchlist }] = useRemoveFromWatchlistMutation()
- // const [isWatched, setIsWatched] = useState(false)
+ const { chain } = useKyberAIAssetOverview()
+ const reachedMaxLimit = useIsReachMaxLimitWatchedToken()
+ const [addToWatchlist, { isLoading: loadingAddtoWatchlist }] = useAddToWatchlistMutation()
+ const [removeFromWatchlist, { isLoading: loadingRemovefromWatchlist }] = useRemoveFromWatchlistMutation()
+ const [isWatched, setIsWatched] = useState(false)
// const handleStarClick = () => {
// if (!token || !chain || !account) return
@@ -289,15 +295,25 @@ const TokenNameGroup = ({ token, isLoading }: { token?: ITokenOverview; isLoadin
-
+
+
+
) : (
- <>
+ token && (
{token?.name} ({token?.symbol.toUpperCase()})
- >
+ )
)}
>
)
}
-const SettingButtons = ({ token, onShareClick }: { token?: ITokenOverview; onShareClick: () => void }) => {
+const SettingButtons = ({ token, onShareClick }: { token?: IAssetOverview; onShareClick: () => void }) => {
const theme = useTheme()
const navigate = useNavigate()
- const { chain } = useParams()
+ const { chain } = useKyberAIAssetOverview()
return (
<>
@@ -429,13 +445,13 @@ const TokenHeader = ({
isLoading,
onShareClick,
}: {
- token?: ITokenOverview
+ token?: IAssetOverview
isLoading?: boolean
onShareClick: () => void
}) => {
const mixpanelHandler = useMixpanelKyberAI()
const above768 = useMedia(`(min-width:${MEDIA_WIDTHS.upToSmall}px)`)
- const { chain } = useParams()
+ const { chain } = useKyberAIAssetOverview()
return above768 ? (
@@ -443,6 +459,7 @@ const TokenHeader = ({
+
(DiscoverTokenTab.TechnicalAnalysis)
- const { data: token, isLoading } = useKyberAITokenOverview()
+ const { data: token, isLoading, chain } = useKyberAIAssetOverview()
const [viewAllTag, setViewAllTag] = useState(false)
useEffect(() => {
- if (!chain || !address) {
- navigate(APP_PATHS.KYBERAI_EXPLORE + `/${defaultExplorePageToken.chain}/${defaultExplorePageToken.address}`)
+ if (!assetId) {
+ navigate(APP_PATHS.KYBERAI_EXPLORE + `/${defaultExplorePageToken.assetId}`)
setTimeout(() => {
const element = document.querySelector('#kyberai-search') as HTMLInputElement
element?.focus({
@@ -518,17 +536,44 @@ export default function SingleToken() {
})
}, 750)
}
- }, [chain, address, navigate])
+ }, [assetId, navigate])
useEffect(() => {
window.scrollTo(0, 0)
}, [])
+ useEffect(() => {
+ if (token?.addresses && token.addresses[0].address && token.addresses[0].chain) {
+ setSearchParams({ chain: token.addresses[0].chain, address: token.addresses[0].address })
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [token?.addresses])
+
return (
setShowShare(true)} />
- {isLoading ? : }
+ {isLoading ? (
+
+
+
+
+
+
+
+
+
+
+ ) : (
+
+ )}
diff --git a/src/pages/TrueSightV2/pages/TechnicalAnalysis.tsx b/src/pages/TrueSightV2/pages/TechnicalAnalysis.tsx
index 2393bf5cf1..5be2aa2547 100644
--- a/src/pages/TrueSightV2/pages/TechnicalAnalysis.tsx
+++ b/src/pages/TrueSightV2/pages/TechnicalAnalysis.tsx
@@ -1,6 +1,5 @@
import { Trans, t } from '@lingui/macro'
import { createContext, useCallback, useMemo, useState } from 'react'
-import { useParams } from 'react-router-dom'
import { Text } from 'rebass'
import styled, { useTheme } from 'styled-components'
@@ -23,11 +22,10 @@ import ProchartShareContent from '../components/shareContent/ProchartShareConten
import SupportResistanceShareContent from '../components/shareContent/SupportResistanceShareContent'
import { FundingRateTable, LiveDEXTrades, SupportResistanceLevel } from '../components/table'
import { KYBERAI_CHART_ID, NETWORK_TO_CHAINID } from '../constants'
+import useKyberAIAssetOverview from '../hooks/useKyberAIAssetOverview'
import { useChartingDataQuery } from '../hooks/useKyberAIData'
-import useKyberAITokenOverview from '../hooks/useKyberAITokenOverview'
import { ChartTab, ISRLevel, KyberAITimeframe, OHLCData } from '../types'
import { navigateToLimitPage } from '../utils'
-import { defaultExplorePageToken } from './SingleToken'
const Wrapper = styled.div`
padding: 20px 0;
@@ -82,23 +80,24 @@ export const TechnicalAnalysisContext = createContext()
const [prochartDataURL, setProchartDataURL] = useState()
const [liveChartTab, setLiveChartTab] = useState(ChartTab.First)
const [showSRLevels, setShowSRLevels] = useState(true)
const [priceChartResolution, setPriceChartResolution] = useState('4h')
const now = Math.floor(Date.now() / 60000) * 60
- const { data, isLoading } = useChartingDataQuery({
- chain: chain || defaultExplorePageToken.chain,
- address: address || defaultExplorePageToken.address,
- from: now - ({ '1h': 1080000, '4h': 4320000, '1d': 12960000 }[priceChartResolution] || 1080000),
- to: now,
- candleSize: priceChartResolution,
- currency: liveChartTab === ChartTab.First ? 'USD' : 'BTC',
- })
-
- const { data: tokenOverview } = useKyberAITokenOverview()
+ const { data, isLoading } = useChartingDataQuery(
+ {
+ chain: chain,
+ address: address,
+ from: now - ({ '1h': 1080000, '4h': 4320000, '1d': 12960000 }[priceChartResolution] || 1080000),
+ to: now,
+ candleSize: priceChartResolution,
+ currency: liveChartTab === ChartTab.First ? 'USD' : 'BTC',
+ },
+ { skip: !chain || !address },
+ )
const SRLevels: ISRLevel[] = useMemo(() => {
if (isLoading && !data) return []
diff --git a/src/pages/TrueSightV2/types/index.tsx b/src/pages/TrueSightV2/types/index.tsx
index d5378e8ed5..cbf9890300 100644
--- a/src/pages/TrueSightV2/types/index.tsx
+++ b/src/pages/TrueSightV2/types/index.tsx
@@ -4,7 +4,8 @@ export interface IKyberScoreChart {
kyber_score: number
created_at: number
}
-export interface ITokenOverview {
+export interface IAssetOverview {
+ addresses: { chain: string; address: string }[]
tags: string[]
name: string
symbol: string
@@ -37,7 +38,7 @@ export interface ITokenOverview {
export interface ITokenList {
symbol: string
name: string
- SourceTokenID: string
+ asset_id: string
tokens: Array<{ address: string; logo: string; chain: string }>
price: number
percent_change_24h: number
@@ -103,11 +104,10 @@ export interface IFundingRate {
}
export interface ITokenSearchResult {
- address: string
name: string
symbol: string
logo: string
- chain: string
+ assetId: string
price: number
priceChange24h: number
kyberScore?: {
diff --git a/src/services/baseQueryOauth.ts b/src/services/baseQueryOauth.ts
index b39f83773c..8b6c1fce8a 100644
--- a/src/services/baseQueryOauth.ts
+++ b/src/services/baseQueryOauth.ts
@@ -1,19 +1,20 @@
import { KyberOauth2Api } from '@kybernetwork/oauth2'
import { BaseQueryFn, fetchBaseQuery } from '@reduxjs/toolkit/query'
+import axios from 'axios'
-import { checkIamDown } from 'utils/iamError'
+import { checkApiDown } from 'utils/iamError'
-const queryWithToken = async (config: any, baseUrl: string) => {
+const queryWithTokenAndTracking = async (config: any, baseUrl: string, withAccessToken = true) => {
try {
if (config.method?.toLowerCase() !== 'get') {
// mapping rtk query vs axios
config.data = config.data || config.body
}
config.url = baseUrl + config.url
- const result = await KyberOauth2Api.call(config)
+ const result = await (withAccessToken ? KyberOauth2Api.call(config) : axios(config))
return { data: result.data }
} catch (err) {
- checkIamDown(err)
+ checkApiDown(err)
return {
error: {
status: err.response?.status,
@@ -25,9 +26,9 @@ const queryWithToken = async (config: any, baseUrl: string) => {
// this query is use for private api call: this will attach access token in every request, auto refresh token if expired
const baseQueryOauth =
- ({ baseUrl = '' }: { baseUrl?: string }): BaseQueryFn =>
+ ({ baseUrl = '', trackingOnly }: { baseUrl?: string; trackingOnly?: boolean }): BaseQueryFn =>
async config => {
- return queryWithToken(config, baseUrl)
+ return queryWithTokenAndTracking(config, baseUrl, !trackingOnly)
}
// same as baseQueryOauth, but has flag to revert if meet incident
@@ -39,7 +40,7 @@ export const baseQueryOauthDynamic =
const rawBaseQuery = fetchBaseQuery({ baseUrl })
return rawBaseQuery(args, WebApi, extraOptions)
}
- return queryWithToken(args, baseUrl)
+ return queryWithTokenAndTracking(args, baseUrl)
}
export default baseQueryOauth
diff --git a/src/services/earning/index.ts b/src/services/earning/index.ts
index d8e77c9d4b..18c775ecbf 100644
--- a/src/services/earning/index.ts
+++ b/src/services/earning/index.ts
@@ -55,6 +55,7 @@ const earningApi = createApi({
const positionData: GetElasticEarningResponse = (positionsRes?.data as any).data as GetElasticEarningResponse
const aggregateData = Object.keys(positionData).reduce((acc, chainName) => {
+ if (!positionData?.[chainName]) return acc
return {
...acc,
[chainName]: {
@@ -110,6 +111,7 @@ const earningApi = createApi({
const positionData: GetElasticEarningResponse = (positionsRes?.data as any).data as GetElasticEarningResponse
const aggregateData = Object.keys(positionData).reduce((acc, chainName) => {
+ if (!positionData?.[chainName]) return acc
return {
...acc,
[chainName]: {
diff --git a/src/services/earning/types.ts b/src/services/earning/types.ts
index 3813e85228..93b6e775cb 100644
--- a/src/services/earning/types.ts
+++ b/src/services/earning/types.ts
@@ -85,6 +85,18 @@ export type ElasticPositionEarningWithDetails = {
pendingRewardUSD: string[]
liquidity: string
}[]
+
+ farmV2DepositedPositions: {
+ farmV2: {
+ id: string
+ rewards: Array<{ amount: string; index: number; tokenID: string }>
+ }
+ pendingRewards: Array
+ liquidity: string
+ range: {
+ weight: string
+ }
+ }[]
} & HistoricalEarning
export type ClassicPositionEarningWithDetails = {
diff --git a/src/services/knprotocol.ts b/src/services/knprotocol.ts
new file mode 100644
index 0000000000..fe1d7c0ee7
--- /dev/null
+++ b/src/services/knprotocol.ts
@@ -0,0 +1,24 @@
+import { ChainId } from '@kyberswap/ks-sdk-core'
+import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+
+import { POOL_FARM_BASE_URL } from 'constants/env'
+import { NETWORKS_INFO } from 'constants/networks'
+import { EVMNetworkInfo } from 'constants/networks/type'
+import { SubgraphFarmV2 } from 'state/farms/elasticv2/types'
+
+const knProtocolApi = createApi({
+ reducerPath: 'knProtocol',
+ baseQuery: fetchBaseQuery({ baseUrl: POOL_FARM_BASE_URL }),
+ endpoints: builder => ({
+ getFarmV2: builder.query<{ data: { data: SubgraphFarmV2[] } }, ChainId>({
+ query: (chainId: ChainId) => ({
+ url: `/${
+ (NETWORKS_INFO[chainId] as EVMNetworkInfo).poolFarmRoute
+ }/api/v1/elastic-new/farm-v2?perPage=1000&page=1`,
+ }),
+ }),
+ }),
+})
+
+export default knProtocolApi
+export const { useLazyGetFarmV2Query } = knProtocolApi
diff --git a/src/services/ksSetting.ts b/src/services/ksSetting.ts
index 9a20c38b0d..a262d96812 100644
--- a/src/services/ksSetting.ts
+++ b/src/services/ksSetting.ts
@@ -1,7 +1,8 @@
import { ApolloClient, NormalizedCacheObject } from '@apollo/client'
import { ChainId } from '@kyberswap/ks-sdk-core'
-import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
+import { createApi } from '@reduxjs/toolkit/query/react'
import { Connection } from '@solana/web3.js'
+import baseQueryOauth from 'services/baseQueryOauth'
import { KS_SETTING_API } from 'constants/env'
import { AppJsonRpcProvider } from 'constants/providers'
@@ -11,8 +12,8 @@ import { TopToken } from 'state/topTokens/type'
export type KyberSwapConfig = {
rpc: string
- prochart: boolean
isEnableBlockService: boolean
+ isEnableKNProtocol: boolean
blockClient: ApolloClient
classicClient: ApolloClient
elasticClient: ApolloClient
@@ -23,8 +24,8 @@ export type KyberSwapConfig = {
export type KyberSwapConfigResponse = {
rpc: string
- prochart: boolean
isEnableBlockService: boolean
+ isEnableKNProtocol: boolean
blockSubgraph: string
classicSubgraph: string
elasticSubgraph: string
@@ -58,8 +59,9 @@ export interface TokenListResponse {
const ksSettingApi = createApi({
reducerPath: 'ksSettingConfigurationApi',
- baseQuery: fetchBaseQuery({
+ baseQuery: baseQueryOauth({
baseUrl: `${KS_SETTING_API}/v1`,
+ trackingOnly: true,
}),
endpoints: builder => ({
getKyberswapConfiguration: builder.query({
diff --git a/src/state/application/hooks.ts b/src/state/application/hooks.ts
index 62a76749e0..1572fc41fe 100644
--- a/src/state/application/hooks.ts
+++ b/src/state/application/hooks.ts
@@ -414,7 +414,7 @@ function getDefaultConfig(chainId: ChainId): KyberSwapConfigResponse {
const evm = isEVM(chainId)
return {
rpc: NETWORKS_INFO[chainId].defaultRpcUrl,
- prochart: false,
+ isEnableKNProtocol: false,
isEnableBlockService: false,
blockSubgraph: (evm ? NETWORKS_INFO[chainId] : ethereumInfo).defaultBlockSubgraph,
elasticSubgraph: (evm ? NETWORKS_INFO[chainId] : ethereumInfo).elastic.defaultSubgraph,
@@ -449,8 +449,8 @@ export const useKyberSwapConfig = (customChainId?: ChainId): KyberSwapConfig =>
return {
rpc: config.rpc,
isEnableBlockService: config.isEnableBlockService,
+ isEnableKNProtocol: config.isEnableKNProtocol,
readProvider,
- prochart: config.prochart,
blockClient,
elasticClient,
classicClient,
@@ -460,7 +460,7 @@ export const useKyberSwapConfig = (customChainId?: ChainId): KyberSwapConfig =>
}, [
config.rpc,
config.isEnableBlockService,
- config.prochart,
+ config.isEnableKNProtocol,
config.commonTokens,
readProvider,
blockClient,
diff --git a/src/state/application/reducer.ts b/src/state/application/reducer.ts
index 2aa47c8bb3..fc7534ad81 100644
--- a/src/state/application/reducer.ts
+++ b/src/state/application/reducer.ts
@@ -172,6 +172,7 @@ export default createReducer(initialState, builder =>
const data = action.payload.data.config
const rpc = data?.rpc || NETWORKS_INFO[chainId].defaultRpcUrl
const isEnableBlockService = data?.isEnableBlockService ?? false
+ const isEnableKNProtocol = data?.isEnableKNProtocol ?? false
const blockSubgraph = evm
? data?.blockSubgraph || NETWORKS_INFO[chainId].defaultBlockSubgraph
@@ -191,7 +192,7 @@ export default createReducer(initialState, builder =>
[chainId]: {
rpc,
isEnableBlockService,
- prochart: data?.prochart || false,
+ isEnableKNProtocol,
blockSubgraph,
elasticSubgraph,
classicSubgraph,
diff --git a/src/state/customizeDexes/updater.tsx b/src/state/customizeDexes/updater.tsx
index 139f264aa5..7c8b15863e 100644
--- a/src/state/customizeDexes/updater.tsx
+++ b/src/state/customizeDexes/updater.tsx
@@ -1,7 +1,8 @@
import { useEffect, useMemo } from 'react'
import { useDispatch } from 'react-redux'
-import { KYBERSWAP_KS_DEXES_TO_UI_DEXES, KYBERSWAP_UI_DEXES } from 'constants/dexes'
+import { isKyberSwapDex } from 'components/swapv2/LiquiditySourcesPanel'
+import { KYBERSWAP_KS_DEXES_TO_UI_DEXES, KYBERSWAP_UI_DEXES_CUSTOM } from 'constants/dexes'
import { useActiveWeb3React } from 'hooks'
import useLiquiditySources from 'hooks/useAggregatorStats'
import { AppDispatch } from 'state/index'
@@ -18,16 +19,19 @@ export default function Updater(): null {
// filterout kyberswap dexes, will hardcode
const normalizeDexes = useMemo(() => {
const dexesFormatted: Dex[] = dexes?.map(item => ({ ...item, id: item.dexId, sortId: item.id })) || []
- const dexesOutsideKyberswap = dexesFormatted.filter(item => !item.id.includes('kyberswap'))
+ const dexesOutsideKyberswap = dexesFormatted.filter(item => !isKyberSwapDex(item.id))
const dexesKyberswap = uniqueArray(
dexesFormatted.filter(dex => KYBERSWAP_KS_DEXES_TO_UI_DEXES[dex.id]),
dex => KYBERSWAP_KS_DEXES_TO_UI_DEXES[dex.id],
)
- const dexesUIKyberswap = dexesKyberswap.map(dex => ({
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- ...KYBERSWAP_UI_DEXES[KYBERSWAP_KS_DEXES_TO_UI_DEXES[dex.id]!],
- sortId: dex.sortId,
- }))
+ const dexesUIKyberswap = dexesKyberswap.map(dex => {
+ const custom = KYBERSWAP_UI_DEXES_CUSTOM[KYBERSWAP_KS_DEXES_TO_UI_DEXES[dex.id] || ''] || dex
+ return {
+ ...custom,
+ sortId: dex.sortId,
+ logoURL: 'https://kyberswap.com/favicon.ico',
+ }
+ })
return [...dexesOutsideKyberswap, ...dexesUIKyberswap]
}, [dexes])
diff --git a/src/state/farms/elastic/hooks.ts b/src/state/farms/elastic/hooks.ts
index 62303b369c..9d2b137203 100644
--- a/src/state/farms/elastic/hooks.ts
+++ b/src/state/farms/elastic/hooks.ts
@@ -3,9 +3,11 @@ import { Currency, CurrencyAmount, Token } from '@kyberswap/ks-sdk-core'
import { FeeAmount, Position, computePoolAddress } from '@kyberswap/ks-sdk-elastic'
import { t } from '@lingui/macro'
import { BigNumber } from 'ethers'
+import { Interface } from 'ethers/lib/utils'
import { useCallback, useMemo, useState } from 'react'
import { useSearchParams } from 'react-router-dom'
+import ELASTIC_FARM_ABI from 'constants/abis/v2/farm.json'
import { ELASTIC_FARM_TYPE, FARM_TAB } from 'constants/index'
import { CONTRACT_NOT_FOUND_MSG } from 'constants/messages'
import { isEVM as isEVMNetwork } from 'constants/networks'
@@ -14,8 +16,11 @@ import { useActiveWeb3React } from 'hooks'
import { useTokens } from 'hooks/Tokens'
import { useProAmmNFTPositionManagerContract, useProMMFarmContract } from 'hooks/useContract'
import { usePools } from 'hooks/usePools'
-import { FarmingPool, NFTPosition } from 'state/farms/elastic/types'
+import { useProAmmPositionsFromTokenIds } from 'hooks/useProAmmPositions'
+import { FarmingPool, NFTPosition, UserFarmInfo, UserInfo } from 'state/farms/elastic/types'
import { useAppSelector } from 'state/hooks'
+import { getPoolAddress } from 'state/mint/proamm/utils'
+import { toCallState, useCallsData, useMultipleContractSingleData } from 'state/multicall/hooks'
import { useTransactionAdder } from 'state/transactions/hooks'
import {
TRANSACTION_TYPE,
@@ -38,12 +43,13 @@ export const useElasticFarms = () => {
export const useFilteredFarms = () => {
const { isEVM, networkInfo, chainId } = useActiveWeb3React()
+ const depositedPositions = useDepositedNfts()
const [searchParams] = useSearchParams()
const filteredToken0Id = searchParams.get('token0') || undefined
const filteredToken1Id = searchParams.get('token1') || undefined
- const { farms, loading, userFarmInfo } = useElasticFarms()
+ const { farms, loading } = useElasticFarms()
const type = searchParams.get('type')
const activeTab: string = type || FARM_TAB.ACTIVE
@@ -130,10 +136,10 @@ export const useFilteredFarms = () => {
if (activeTab === FARM_TAB.MY_FARMS && isEVM) {
result = result?.map(item => {
- if (!userFarmInfo?.[item.id].depositedPositions.length) {
+ if (!depositedPositions[item.id]?.length) {
return { ...item, pools: [] }
}
- const stakedPools = userFarmInfo?.[item.id].depositedPositions.map(pos =>
+ const stakedPools = depositedPositions[item.id]?.map(pos =>
computePoolAddress({
factoryAddress: (networkInfo as EVMNetworkInfo).elastic.coreFactory,
tokenA: pos.pool.token0,
@@ -154,7 +160,7 @@ export const useFilteredFarms = () => {
search,
activeTab,
chainId,
- userFarmInfo,
+ depositedPositions,
isEVM,
networkInfo,
filteredToken0Id,
@@ -165,7 +171,6 @@ export const useFilteredFarms = () => {
return {
farms,
loading,
- userFarmInfo,
filteredFarms,
}
}
@@ -498,3 +503,176 @@ export const usePositionFilter = (positions: PositionDetails[], validPools: stri
filterOptions,
}
}
+
+const farmInterface = new Interface(ELASTIC_FARM_ABI)
+
+export function useDepositedNfts(): { [address: string]: NFTPosition[] } {
+ const { farms } = useElasticFarms()
+ const farmAddresses = useMemo(() => {
+ return farms?.map(item => item.id) || []
+ }, [farms])
+
+ const { account } = useActiveWeb3React()
+
+ const inputs = useMemo(() => [account], [account])
+ const options = useMemo(
+ () => ({
+ blocksPerFetch: 40,
+ }),
+ [],
+ )
+ const result = useMultipleContractSingleData(farmAddresses, farmInterface, 'getDepositedNFTs', inputs, options)
+
+ const nftByFarmAddress = useMemo(() => {
+ const res: { [key: string]: BigNumber[] } = {}
+ result.forEach((item, idx) => {
+ res[farmAddresses[idx]] = item.result?.listNFTs || []
+ })
+ return res
+ }, [result, farmAddresses])
+
+ const tokenIds = useMemo(() => {
+ return Object.values(nftByFarmAddress).flat()
+ }, [nftByFarmAddress])
+ const { positions = [] } = useProAmmPositionsFromTokenIds(tokenIds)
+
+ return useMemo(() => {
+ const positionByFarmAddess: { [key: string]: Array } = {}
+
+ farmAddresses.forEach(address => {
+ const { pools } = farms?.find(item => item.id === address) || {}
+
+ positionByFarmAddess[address] = (nftByFarmAddress[address] || [])
+ .map((id: BigNumber) => {
+ const position = positions.find(item => item.tokenId.toString() === id.toString())
+ const pool = pools?.find(pool => pool.poolAddress.toLowerCase() === position?.poolId.toLowerCase())?.pool
+ if (!pool || !position) return null
+ return new NFTPosition({
+ nftId: id,
+ pool,
+ liquidity: position.liquidity.toString(),
+ tickLower: position.tickLower,
+ tickUpper: position.tickUpper,
+ })
+ })
+ .filter(item => item !== null) as NFTPosition[]
+ })
+
+ return positionByFarmAddess
+ }, [farms, positions, nftByFarmAddress, farmAddresses])
+}
+
+export function useDepositedNftsByFarm(farmAddress: string): NFTPosition[] {
+ const positionByFarm = useDepositedNfts()
+ return useMemo(() => positionByFarm[farmAddress] || [], [positionByFarm, farmAddress])
+}
+
+const getUserInfoFragment = farmInterface.getFunction('getUserInfo')
+
+export function useJoinedPositions() {
+ const positions = useDepositedNfts()
+ const { farms } = useElasticFarms()
+
+ const params = useMemo(() => {
+ return (farms || []).map(farm => {
+ const calls: { address: string; callData: string; pos: NFTPosition; pid: string }[] = []
+
+ const deposited = positions[farm.id] || []
+ deposited.forEach(pos => {
+ const poolAddress = getPoolAddress(pos.pool)
+ const matchedPools = farm.pools.filter(p => p.poolAddress.toLowerCase() === poolAddress.toLowerCase())
+
+ matchedPools.forEach(pool => {
+ if (pos.liquidity.toString() !== '0')
+ calls.push({
+ address: farm.id,
+ callData: farmInterface.encodeFunctionData(getUserInfoFragment, [pos.nftId, pool.pid]),
+ pid: pool.pid.toString(),
+ pos: pos,
+ })
+ })
+ })
+ return calls
+ })
+ }, [farms, positions])
+
+ const options = useMemo(
+ () => ({
+ blocksPerFetch: 30,
+ }),
+ [],
+ )
+ const callInputs = useMemo(() => params.flat(), [params])
+ const rawRes = useCallsData(callInputs, options)
+
+ const result = useMemo(() => rawRes.map(item => toCallState(item, farmInterface, getUserInfoFragment)), [rawRes])
+
+ return useMemo(() => {
+ const userInfo: UserFarmInfo = {}
+ farms?.forEach((farm, idx) => {
+ const joinedPositions: { [pid: string]: NFTPosition[] } = {}
+ const rewardPendings: { [pid: string]: CurrencyAmount[] } = {}
+ const rewardByNft: { [pid_nftId: string]: CurrencyAmount[] } = {}
+
+ const startIdx = idx === 0 ? 0 : params.slice(0, idx + 1).reduce((acc, cur) => acc + cur.length, 0)
+ const endIdx = startIdx + params[idx].length
+
+ const res = result.slice(startIdx, endIdx)
+
+ params[idx].forEach((param, index) => {
+ const pid = param.pid.toString()
+ const nftId = param.pos.nftId
+
+ if (res[index].result) {
+ if (!joinedPositions[pid]) {
+ joinedPositions[pid] = []
+ }
+
+ const depositedPos = positions[farm.id].find(pos => pos.nftId.eq(nftId))
+ const farmingPool = farm.pools.find(p => p.pid === pid)
+
+ if (depositedPos && farmingPool) {
+ const pos = new NFTPosition({
+ nftId,
+ liquidity: res[index].result?.liquidity,
+ tickLower: depositedPos.tickLower,
+ tickUpper: depositedPos.tickUpper,
+ pool: depositedPos.pool,
+ })
+ joinedPositions[pid].push(pos)
+
+ const id = `${pid}_${nftId.toString()}`
+ if (!rewardByNft[id]) {
+ rewardByNft[id] = []
+ }
+ if (!rewardPendings[pid]) {
+ rewardPendings[pid] = []
+ }
+ farmingPool.rewardTokens.forEach((currency, i) => {
+ const amount = CurrencyAmount.fromRawAmount(currency, res[index].result?.rewardPending[i])
+ rewardByNft[id][i] = amount
+
+ if (!rewardPendings[pid][i]) {
+ rewardPendings[pid][i] = amount
+ } else {
+ rewardPendings[pid][i] = rewardPendings[pid][i].add(amount)
+ }
+ })
+ }
+ }
+ })
+
+ userInfo[farm.id] = {
+ joinedPositions,
+ rewardPendings,
+ rewardByNft,
+ }
+ })
+ return userInfo
+ }, [result, params, farms, positions])
+}
+
+export function useUserInfoByFarm(farmAddress: string): UserInfo {
+ const userFarmsInfo = useJoinedPositions()
+ return useMemo(() => userFarmsInfo[farmAddress] || {}, [userFarmsInfo, farmAddress])
+}
diff --git a/src/state/farms/elastic/index.ts b/src/state/farms/elastic/index.ts
index 0662cd98e5..9788ef976f 100644
--- a/src/state/farms/elastic/index.ts
+++ b/src/state/farms/elastic/index.ts
@@ -1,13 +1,11 @@
import { createSlice } from '@reduxjs/toolkit'
-import { ElasticFarm, UserFarmInfo } from './types'
+import { ElasticFarm } from './types'
interface ElasticFarmState {
[chainId: number]: {
loading: boolean
farms: ElasticFarm[] | null
- userFarmInfo?: UserFarmInfo
- loadingUserInfo: boolean
poolFeeLast24h: {
[poolId: string]: number
}
@@ -18,7 +16,6 @@ export const defaultChainData = {
loading: false,
farms: [],
poolFeeLast24h: {},
- loadingUserInfo: false,
} as ElasticFarmState[number]
const initialState: ElasticFarmState = {}
@@ -38,25 +35,12 @@ const slice = createSlice({
} else state[chainId] = { ...state[chainId], loading }
},
- setUserFarmInfo(
- state,
- { payload: { userInfo, chainId } }: { payload: { userInfo: UserFarmInfo; chainId: number } },
- ) {
- state[chainId].userFarmInfo = userInfo
- },
-
setPoolFeeData(state, { payload: { chainId, data } }) {
state[chainId].poolFeeLast24h = data
},
-
- setLoadingUserInfo(state, { payload: { loading, chainId } }) {
- if (!state[chainId]) {
- state[chainId] = { ...defaultChainData, loadingUserInfo: loading }
- } else state[chainId] = { ...state[chainId], loadingUserInfo: loading }
- },
},
})
-export const { setFarms, setLoading, setUserFarmInfo, setPoolFeeData, setLoadingUserInfo } = slice.actions
+export const { setFarms, setLoading, setPoolFeeData } = slice.actions
export default slice.reducer
diff --git a/src/state/farms/elastic/types.ts b/src/state/farms/elastic/types.ts
index e3c9f0c60a..cdeff655aa 100644
--- a/src/state/farms/elastic/types.ts
+++ b/src/state/farms/elastic/types.ts
@@ -50,7 +50,6 @@ export class NFTPosition extends Position {
}
export interface UserInfo {
- depositedPositions: NFTPosition[]
joinedPositions: {
[pid: string]: NFTPosition[]
}
diff --git a/src/state/farms/elastic/updaters/index.tsx b/src/state/farms/elastic/updaters/index.tsx
index 2dfa4e23a0..7dc46ae736 100644
--- a/src/state/farms/elastic/updaters/index.tsx
+++ b/src/state/farms/elastic/updaters/index.tsx
@@ -1,5 +1,4 @@
-import { CHAINS_SUPPORT_NEW_POOL_FARM_API } from 'constants/networks'
-import { useActiveWeb3React } from 'hooks'
+import { useKyberSwapConfig } from 'state/application/hooks'
import useGetUserFarmingInfo from './useGetUserElasticFarmInfo'
import FarmUpdaterV1 from './v1'
@@ -10,15 +9,11 @@ export type CommonProps = {
}
const FarmUpdater: React.FC = ({ interval = true }) => {
- const { chainId } = useActiveWeb3React()
+ const { isEnableKNProtocol } = useKyberSwapConfig()
- useGetUserFarmingInfo(interval)
+ useGetUserFarmingInfo()
- if (!chainId) {
- return null
- }
-
- if (CHAINS_SUPPORT_NEW_POOL_FARM_API.includes(chainId)) {
+ if (isEnableKNProtocol) {
return
} else {
return
diff --git a/src/state/farms/elastic/updaters/useGetUserElasticFarmInfo.ts b/src/state/farms/elastic/updaters/useGetUserElasticFarmInfo.ts
index 40ae345941..e7937aa06d 100644
--- a/src/state/farms/elastic/updaters/useGetUserElasticFarmInfo.ts
+++ b/src/state/farms/elastic/updaters/useGetUserElasticFarmInfo.ts
@@ -1,27 +1,14 @@
import { gql, useLazyQuery } from '@apollo/client'
-import { defaultAbiCoder } from '@ethersproject/abi'
-import { getCreate2Address } from '@ethersproject/address'
-import { keccak256 } from '@ethersproject/solidity'
-import { Currency, CurrencyAmount } from '@kyberswap/ks-sdk-core'
-import { BigNumber } from 'ethers'
-import { Interface } from 'ethers/lib/utils'
-import { useCallback, useEffect, useRef } from 'react'
+import { useEffect } from 'react'
import { useDispatch } from 'react-redux'
-import NFTPositionManagerABI from 'constants/abis/v2/ProAmmNFTPositionManager.json'
-import ELASTIC_FARM_ABI from 'constants/abis/v2/farm.json'
-import { NETWORKS_INFO, isEVM } from 'constants/networks'
+import { isEVM } from 'constants/networks'
import { useActiveWeb3React } from 'hooks'
-import { useMulticallContract } from 'hooks/useContract'
import { useKyberSwapConfig } from 'state/application/hooks'
import { useAppSelector } from 'state/hooks'
import { usePoolBlocks } from 'state/prommPools/hooks'
-import { setLoadingUserInfo, setPoolFeeData, setUserFarmInfo } from '..'
-import { NFTPosition, UserFarmInfo } from '../types'
-
-const farmInterface = new Interface(ELASTIC_FARM_ABI)
-const positionManagerInterface = new Interface(NFTPositionManagerABI.abi)
+import { setPoolFeeData } from '..'
const POOL_FEE_HISTORY = gql`
query poolFees($block: Int!, $poolIds: [String]!) {
@@ -32,225 +19,12 @@ const POOL_FEE_HISTORY = gql`
}
`
-const defaultChainData = {
- loading: false,
- farms: null,
- poolFeeLast24h: {},
-}
-const useGetUserFarmingInfo = (interval?: boolean) => {
+const useGetUserFarmingInfo = () => {
const dispatch = useDispatch()
- const { chainId, account } = useActiveWeb3React()
- const multicallContract = useMulticallContract()
+ const { chainId } = useActiveWeb3React()
const { elasticClient } = useKyberSwapConfig()
- const elasticFarm = useAppSelector(state => state.elasticFarm[chainId || 1]) || defaultChainData
-
- const getUserFarmInfo = useCallback(async () => {
- const farmAddresses = elasticFarm.farms?.map(farm => farm.id)
-
- if (isEVM(chainId) && account && farmAddresses?.length && multicallContract) {
- dispatch(setLoadingUserInfo({ loading: true, chainId }))
- // get userDepositedNFTs
- const userDepositedNFTsFragment = farmInterface.getFunction('getDepositedNFTs')
- const callData = farmInterface.encodeFunctionData(userDepositedNFTsFragment, [account])
-
- const chunks = farmAddresses.map(address => ({
- target: address,
- callData,
- }))
-
- const multicallRes = await multicallContract.callStatic.tryBlockAndAggregate(false, chunks)
- const returnData = multicallRes.returnData
- // listNFTs by contract
- const nftResults: Array> = returnData.map((data: [boolean, string]) => {
- try {
- return data[0] ? farmInterface.decodeFunctionResult(userDepositedNFTsFragment, data[1]).listNFTs : []
- } catch {
- return []
- }
- })
-
- /*
- * GET DETAIL NFT
- */
- const allNFTs = nftResults.flat()
- const nftDetailFragment = positionManagerInterface.getFunction('positions')
- const nftDetailChunks = allNFTs.map(id => ({
- target: NETWORKS_INFO[chainId].elastic.nonfungiblePositionManager,
- callData: positionManagerInterface.encodeFunctionData(nftDetailFragment, [id]),
- }))
-
- const detailNFTMultiCallData = (await multicallContract.callStatic.tryBlockAndAggregate(false, nftDetailChunks))
- .returnData
-
- const nftDetailResult = detailNFTMultiCallData.map((data: [boolean, string]) =>
- data[0] ? positionManagerInterface.decodeFunctionResult(nftDetailFragment, data[1]) : null,
- )
-
- type NFT_INFO = {
- [id: string]: {
- poolAddress: string
- liquidity: BigNumber
- tickLower: BigNumber
- tickUpper: BigNumber
- }
- }
- const nftInfos = nftDetailResult.reduce((acc: NFT_INFO, item: any, index: number) => {
- if (!item) return acc
- return {
- ...acc,
- [allNFTs[index].toString()]: {
- poolAddress: getCreate2Address(
- NETWORKS_INFO[chainId].elastic.coreFactory,
- keccak256(
- ['bytes'],
- [
- defaultAbiCoder.encode(
- ['address', 'address', 'uint24'],
- [item.info.token0, item.info.token1, item.info.fee],
- ),
- ],
- ),
- NETWORKS_INFO[chainId].elastic.initCodeHash,
- ),
- liquidity: item.pos.liquidity,
- tickLower: item.pos.tickLower,
- tickUpper: item.pos.tickUpper,
- },
- }
- }, {} as NFT_INFO)
-
- const promises =
- elasticFarm.farms?.map(async (farm, index) => {
- const nfts = nftResults[index]
-
- const depositedPositions: NFTPosition[] = []
- const joinedPositions: { [pid: string]: NFTPosition[] } = {}
- const rewardPendings: { [pid: string]: CurrencyAmount[] } = {}
- const rewardByNft: { [pid_nftId: string]: CurrencyAmount[] } = {}
-
- const userInfoParams: Array<[BigNumber, string]> = []
- nfts.forEach(id => {
- const matchedPools = farm.pools.filter(
- p => p.poolAddress.toLowerCase() === nftInfos[id.toString()]?.poolAddress.toLowerCase(),
- )
-
- matchedPools.forEach(pool => {
- userInfoParams.push([id, pool.pid])
- })
-
- if (matchedPools?.[0]) {
- const pos = new NFTPosition({
- nftId: id,
- pool: matchedPools[0].pool,
- liquidity: nftInfos[id.toString()].liquidity,
- tickLower: nftInfos[id.toString()].tickLower,
- tickUpper: nftInfos[id.toString()].tickUpper,
- })
- depositedPositions.push(pos)
- }
- })
-
- const getUserInfoFragment = farmInterface.getFunction('getUserInfo')
- if (nfts.length) {
- const returnData = (
- await multicallContract.callStatic.tryBlockAndAggregate(
- false,
- userInfoParams.map(params => {
- return {
- target: farm.id,
- callData: farmInterface.encodeFunctionData(getUserInfoFragment, params),
- }
- }),
- )
- ).returnData.map((item: [boolean, string]) => item[1])
-
- const result = returnData.map((data: string) => {
- try {
- return farmInterface.decodeFunctionResult(getUserInfoFragment, data)
- } catch (e) {
- return e
- }
- })
- userInfoParams.forEach((param, index) => {
- const pid = param[1].toString()
- const nftId = param[0]
- if (!(result[index] instanceof Error)) {
- if (!joinedPositions[pid]) {
- joinedPositions[pid] = []
- }
-
- const depositedPos = depositedPositions.find(pos => pos.nftId.eq(nftId))
- const farmingPool = farm.pools.find(p => p.pid === pid)
-
- if (depositedPos && farmingPool) {
- const pos = new NFTPosition({
- nftId,
- liquidity: result[index].liquidity,
- tickLower: depositedPos.tickLower,
- tickUpper: depositedPos.tickUpper,
- pool: depositedPos.pool,
- })
- joinedPositions[pid].push(pos)
-
- const id = `${pid}_${nftId.toString()}`
- if (!rewardByNft[id]) {
- rewardByNft[id] = []
- }
- if (!rewardPendings[pid]) {
- rewardPendings[pid] = []
- }
- farmingPool.rewardTokens.forEach((currency, i) => {
- const amount = CurrencyAmount.fromRawAmount(currency, result[index].rewardPending[i])
- rewardByNft[id][i] = amount
-
- if (!rewardPendings[pid][i]) {
- rewardPendings[pid][i] = amount
- } else {
- rewardPendings[pid][i] = rewardPendings[pid][i].add(amount)
- }
- })
- }
- }
- })
- }
- return {
- depositedPositions,
- joinedPositions,
- rewardPendings,
- rewardByNft,
- }
- }) || []
-
- const res = await Promise.all(promises)
-
- const userInfo = elasticFarm.farms?.reduce((userInfo, farm, index) => {
- return {
- ...userInfo,
- [farm.id]: res[index],
- }
- }, {} as UserFarmInfo)
-
- dispatch(setLoadingUserInfo({ chainId, loading: false }))
- if (userInfo) dispatch(setUserFarmInfo({ chainId, userInfo }))
- }
- }, [elasticFarm.farms, chainId, account, multicallContract, dispatch])
-
- const getUserFarmInfoRef = useRef(getUserFarmInfo)
- getUserFarmInfoRef.current = getUserFarmInfo
-
- useEffect(() => {
- getUserFarmInfoRef.current()
-
- const i = interval
- ? setInterval(() => {
- getUserFarmInfoRef.current()
- }, 10_000)
- : undefined
- return () => {
- i && clearInterval(i)
- }
- }, [interval, account, elasticFarm.farms?.length])
+ const farms = useAppSelector(state => state.elasticFarm[chainId || 1]?.farms)
const { blockLast24h } = usePoolBlocks()
const [getPoolInfo, { data: poolFeeData }] = useLazyQuery(POOL_FEE_HISTORY, {
@@ -276,7 +50,7 @@ const useGetUserFarmingInfo = (interval?: boolean) => {
useEffect(() => {
if (!isEVM(chainId)) return
- const poolIds = elasticFarm.farms?.map(item => item.pools.map(p => p.poolAddress.toLowerCase())).flat()
+ const poolIds = farms?.map(item => item.pools.map(p => p.poolAddress.toLowerCase())).flat()
if (blockLast24h && poolIds?.length) {
getPoolInfo({
@@ -286,7 +60,7 @@ const useGetUserFarmingInfo = (interval?: boolean) => {
},
})
}
- }, [elasticFarm.farms, blockLast24h, getPoolInfo, chainId])
+ }, [farms, blockLast24h, getPoolInfo, chainId])
}
export default useGetUserFarmingInfo
diff --git a/src/state/farms/elastic/updaters/v1.tsx b/src/state/farms/elastic/updaters/v1.tsx
index 028ac26b2f..6d1958b937 100644
--- a/src/state/farms/elastic/updaters/v1.tsx
+++ b/src/state/farms/elastic/updaters/v1.tsx
@@ -1,5 +1,5 @@
import { gql, useLazyQuery } from '@apollo/client'
-import { ChainId, CurrencyAmount, Token, TokenAmount, WETH } from '@kyberswap/ks-sdk-core'
+import { CurrencyAmount, Token, TokenAmount, WETH } from '@kyberswap/ks-sdk-core'
import { FeeAmount, Pool, Position } from '@kyberswap/ks-sdk-elastic'
import { useEffect } from 'react'
@@ -153,9 +153,11 @@ const FarmUpdaterV1: React.FC = ({ interval }) => {
useEffect(() => {
if (!elasticFarm.farms && !elasticFarm.loading) {
dispatch(setLoading({ chainId, loading: true }))
- getElasticFarms().finally(() => {
+ try {
+ getElasticFarms()
+ } finally {
dispatch(setLoading({ chainId, loading: false }))
- })
+ }
}
}, [elasticFarm, getElasticFarms, dispatch, chainId])
@@ -163,7 +165,7 @@ const FarmUpdaterV1: React.FC = ({ interval }) => {
const i = interval
? setInterval(() => {
getElasticFarms()
- }, 10_000)
+ }, 20_000)
: undefined
return () => {
i && clearInterval(i)
@@ -178,7 +180,7 @@ const FarmUpdaterV1: React.FC = ({ interval }) => {
}, [error, dispatch, chainId])
useEffect(() => {
- if (data?.farms && chainId) {
+ if (data?.farms && chainId && !elasticFarm?.farms?.length) {
// transform farm data
const formattedData: ElasticFarm[] = data.farms.map((farm: SubgraphFarm) => {
return {
@@ -236,7 +238,7 @@ const FarmUpdaterV1: React.FC = ({ interval }) => {
return {
startTime: Number(pool.startTime),
- endTime: chainId === ChainId.AVAXMAINNET && pool.pid === '125' ? 1680104783 : Number(pool.endTime),
+ endTime: Number(pool.endTime),
pid: pool.pid,
id: pool.id,
feeTarget: pool.feeTarget,
@@ -266,7 +268,7 @@ const FarmUpdaterV1: React.FC = ({ interval }) => {
})
dispatch(setFarms({ chainId, farms: formattedData }))
}
- }, [data, dispatch, chainId])
+ }, [data, dispatch, chainId, elasticFarm])
return null
}
diff --git a/src/state/farms/elastic/updaters/v2.tsx b/src/state/farms/elastic/updaters/v2.tsx
index 88c31bd99f..0494a5e3c5 100644
--- a/src/state/farms/elastic/updaters/v2.tsx
+++ b/src/state/farms/elastic/updaters/v2.tsx
@@ -48,7 +48,9 @@ const useGetElasticFarms = () => {
: ''
return useSWR(endpoint, (url: string) => fetch(url).then(resp => resp.json()), {
- refreshInterval: 10_000,
+ revalidateIfStale: false,
+ revalidateOnFocus: false,
+ revalidateOnReconnect: false,
})
}
diff --git a/src/state/farms/elasticv2/types.ts b/src/state/farms/elasticv2/types.ts
index 7ee3b293ea..658062c1b1 100644
--- a/src/state/farms/elasticv2/types.ts
+++ b/src/state/farms/elasticv2/types.ts
@@ -27,8 +27,6 @@ export interface ElasticFarmV2 {
token0: Currency
token1: Currency
tvl: number
- tvlToken0: CurrencyAmount
- tvlToken1: CurrencyAmount
totalRewards: Array>
ranges: Array
}
@@ -62,7 +60,8 @@ export interface SubgraphFarmV2 {
endTime: string
isSettled: boolean
liquidity: string
- depositedPositions: Array<{
+ stakedTvl?: string
+ depositedPositions?: Array<{
id: string
position: {
id: string
diff --git a/src/state/farms/elasticv2/updater.tsx b/src/state/farms/elasticv2/updater.tsx
index b6aaa41b27..643de26358 100644
--- a/src/state/farms/elasticv2/updater.tsx
+++ b/src/state/farms/elasticv2/updater.tsx
@@ -6,7 +6,8 @@ import { CurrencyAmount, Token, WETH } from '@kyberswap/ks-sdk-core'
import { FeeAmount, Pool, Position } from '@kyberswap/ks-sdk-elastic'
import { BigNumber } from 'ethers'
import { Interface } from 'ethers/lib/utils'
-import { useEffect } from 'react'
+import { useEffect, useMemo, useRef } from 'react'
+import { useLazyGetFarmV2Query } from 'services/knprotocol'
import FarmV2QuoterABI from 'constants/abis/farmv2Quoter.json'
import NFTPositionManagerABI from 'constants/abis/v2/ProAmmNFTPositionManager.json'
@@ -106,7 +107,7 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
const dispatch = useAppDispatch()
const { networkInfo, isEVM, chainId, account } = useActiveWeb3React()
const elasticFarm = useAppSelector(state => state.elasticFarmV2[chainId] || defaultChainData)
- const { elasticClient } = useKyberSwapConfig()
+ const { elasticClient, isEnableKNProtocol } = useKyberSwapConfig()
const multicallContract = useMulticallContract()
const farmv2QuoterContract = useContract(
@@ -114,30 +115,53 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
FarmV2QuoterABI,
)
- const [getElasticFarmV2, { data, error }] = useLazyQuery(queryFarms, {
+ const [getElasticFarmV2, { data: subgraphData, error: subgraphError }] = useLazyQuery(queryFarms, {
client: elasticClient,
fetchPolicy: 'network-only',
})
+ const [getElasticFarmV2FromKnProtocol, { data: knProtocolData, error: knProtocolError }] = useLazyGetFarmV2Query()
+
+ const latestKnProtocolData = useRef(knProtocolData)
+
+ const data = useMemo(() => {
+ if (isEnableKNProtocol) {
+ return {
+ farmV2S: knProtocolData?.data?.data || latestKnProtocolData.current?.data?.data || [],
+ }
+ } else return subgraphData
+ }, [isEnableKNProtocol, knProtocolData, subgraphData])
+
+ const error = useMemo(() => {
+ if (isEnableKNProtocol) return knProtocolError
+ return subgraphError
+ }, [isEnableKNProtocol, subgraphError, knProtocolError])
+
useEffect(() => {
if (isEVM && !elasticFarm?.farms && !elasticFarm?.loading) {
dispatch(setLoading({ chainId, loading: true }))
- getElasticFarmV2().finally(() => {
- dispatch(setLoading({ chainId, loading: false }))
- })
+ if (isEnableKNProtocol) {
+ getElasticFarmV2FromKnProtocol(chainId).finally(() => {
+ dispatch(setLoading({ chainId, loading: false }))
+ })
+ } else
+ getElasticFarmV2().finally(() => {
+ dispatch(setLoading({ chainId, loading: false }))
+ })
}
- }, [isEVM, chainId, dispatch, getElasticFarmV2, elasticFarm])
+ }, [isEVM, chainId, dispatch, getElasticFarmV2, elasticFarm, getElasticFarmV2FromKnProtocol, isEnableKNProtocol])
useEffect(() => {
const i = interval
? setInterval(() => {
- getElasticFarmV2()
+ if (isEnableKNProtocol) getElasticFarmV2FromKnProtocol(chainId)
+ else getElasticFarmV2()
}, 10_000)
: undefined
return () => {
i && clearInterval(i)
}
- }, [interval, dispatch, getElasticFarmV2])
+ }, [interval, chainId, dispatch, getElasticFarmV2, getElasticFarmV2FromKnProtocol, isEnableKNProtocol])
useEffect(() => {
if (error && chainId) {
@@ -148,9 +172,12 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
const { fetchPrices } = useTokenPricesWithLoading([])
+ const tokensRef = useRef([])
+ const pricesRef = useRef<{ [key: string]: number | undefined }>({})
+
useEffect(() => {
const getData = async () => {
- if (data?.farmV2S && chainId) {
+ if (data?.farmV2S.length && chainId) {
const tokens = [
...new Set(
data.farmV2S
@@ -167,7 +194,12 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
),
] as string[]
- const prices = await fetchPrices(tokens)
+ let prices = pricesRef.current
+ if (tokensRef.current.sort().join() !== tokens.sort().join()) {
+ tokensRef.current = tokens
+ prices = await fetchPrices(tokens)
+ pricesRef.current = prices
+ }
const formattedData: ElasticFarmV2[] = data.farmV2S.map((farm: SubgraphFarmV2) => {
const getToken = (t: SubgraphToken, keepWrapped = false) => {
@@ -193,23 +225,29 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
farm.pool.reinvestL,
Number(farm.pool.tick),
)
- let tvlToken0 = CurrencyAmount.fromRawAmount(token0.wrapped, 0)
- let tvlToken1 = CurrencyAmount.fromRawAmount(token1.wrapped, 0)
-
- farm.depositedPositions.forEach(pos => {
- const position = new Position({
- pool: p,
- liquidity: pos.position.liquidity,
- tickLower: Number(pos.position.tickLower.tickIdx),
- tickUpper: Number(pos.position.tickUpper.tickIdx),
- })
- tvlToken0 = tvlToken0.add(position.amount0)
- tvlToken1 = tvlToken1.add(position.amount1)
- })
- const tvl =
- Number(tvlToken0.toExact() || '0') * (prices[farm.pool.token0.id] || 0) +
- Number(tvlToken1.toExact() || '0') * (prices[farm.pool.token1.id] || 0)
+ let tvl = 0
+ if (farm.stakedTvl) {
+ tvl = +farm.stakedTvl
+ } else {
+ let tvlToken0 = CurrencyAmount.fromRawAmount(token0.wrapped, 0)
+ let tvlToken1 = CurrencyAmount.fromRawAmount(token1.wrapped, 0)
+
+ farm.depositedPositions?.forEach(pos => {
+ const position = new Position({
+ pool: p,
+ liquidity: pos.position.liquidity,
+ tickLower: Number(pos.position.tickLower.tickIdx),
+ tickUpper: Number(pos.position.tickUpper.tickIdx),
+ })
+
+ tvlToken0 = tvlToken0.add(position.amount0)
+ tvlToken1 = tvlToken1.add(position.amount1)
+ })
+ tvl =
+ Number(tvlToken0.toExact() || '0') * (prices[farm.pool.token0.id] || 0) +
+ Number(tvlToken1.toExact() || '0') * (prices[farm.pool.token1.id] || 0)
+ }
const totalRewards = farm.rewards.map(item =>
CurrencyAmount.fromRawAmount(getToken(item.token, true), item.amount),
@@ -227,8 +265,6 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
token0,
token1,
totalRewards,
- tvlToken0,
- tvlToken1,
tvl,
ranges: farm.ranges.map(r => {
// https://www.notion.so/kybernetwork/LM-v2-APR-Formula-15b8606e820745b59a5a3aded8bf46e0
diff --git a/src/state/index.ts b/src/state/index.ts
index 2d505c263e..caffdcdc0c 100644
--- a/src/state/index.ts
+++ b/src/state/index.ts
@@ -16,6 +16,7 @@ import crosschainApi from '../services/crossChain'
import earningApi from '../services/earning'
import geckoTerminalApi from '../services/geckoTermial'
import identifyApi from '../services/identity'
+import knProtocolApi from '../services/knprotocol'
import ksSettingApi from '../services/ksSetting'
import kyberDAO from '../services/kyberDAO'
import limitOrderApi from '../services/limitOrder'
@@ -118,6 +119,7 @@ const store = configureStore({
[tokenApi.reducerPath]: tokenApi.reducer,
[socialApi.reducerPath]: socialApi.reducer,
[blockServiceApi.reducerPath]: blockServiceApi.reducer,
+ [knProtocolApi.reducerPath]: knProtocolApi.reducer,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware({ thunk: true, immutableCheck: false, serializableCheck: false })
@@ -138,7 +140,8 @@ const store = configureStore({
.concat(earningApi.middleware)
.concat(socialApi.middleware)
.concat(tokenApi.middleware)
- .concat(blockServiceApi.middleware),
+ .concat(blockServiceApi.middleware)
+ .concat(knProtocolApi.middleware),
preloadedState,
})
diff --git a/src/state/mint/proamm/utils.ts b/src/state/mint/proamm/utils.ts
index a69b7d9eaf..d8efdc6afa 100644
--- a/src/state/mint/proamm/utils.ts
+++ b/src/state/mint/proamm/utils.ts
@@ -1,14 +1,20 @@
+import { defaultAbiCoder } from '@ethersproject/abi'
+import { keccak256 } from '@ethersproject/solidity'
import { Price, Token } from '@kyberswap/ks-sdk-core'
import {
FeeAmount,
+ Pool,
TICK_SPACINGS,
TickMath,
encodeSqrtRatioX96,
nearestUsableTick,
priceToClosestTick,
} from '@kyberswap/ks-sdk-elastic'
+import { getCreate2Address } from 'ethers/lib/utils'
import JSBI from 'jsbi'
+import { NETWORKS_INFO } from 'constants/networks'
+import { EVMNetworkInfo } from 'constants/networks/type'
import { rangeData } from 'pages/AddLiquidityV2/constants'
import { PairFactor } from 'state/topTokens/type'
@@ -88,3 +94,15 @@ export const getRangeTicks = (
return result
}
+
+export function getPoolAddress(pool: Pool): string {
+ const networkInfo = NETWORKS_INFO[pool.token0.chainId] as EVMNetworkInfo
+ return getCreate2Address(
+ networkInfo.elastic.coreFactory,
+ keccak256(
+ ['bytes'],
+ [defaultAbiCoder.encode(['address', 'address', 'uint24'], [pool.token0.address, pool.token1.address, pool.fee])],
+ ),
+ networkInfo.elastic.initCodeHash,
+ )
+}
diff --git a/src/state/multicall/hooks.ts b/src/state/multicall/hooks.ts
index 3b5a4b09c2..8460ae845b 100644
--- a/src/state/multicall/hooks.ts
+++ b/src/state/multicall/hooks.ts
@@ -2,12 +2,11 @@ import { FunctionFragment, Interface } from '@ethersproject/abi'
import { BigNumber } from '@ethersproject/bignumber'
import { Contract } from '@ethersproject/contracts'
import { ChainId } from '@kyberswap/ks-sdk-core'
-import { useEffect, useMemo } from 'react'
+import { useEffect, useMemo, useRef } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { EMPTY_ARRAY } from 'constants/index'
import { useActiveWeb3React } from 'hooks'
-import { useBlockNumber } from 'state/application/hooks'
import { AppDispatch, AppState } from 'state/index'
import {
@@ -53,7 +52,7 @@ export const NEVER_RELOAD: ListenerOptions = {
}
// the lowest level call for subscribing to contract data
-function useCallsData(calls: (Call | undefined)[], options?: ListenerOptions): CallResult[] {
+export function useCallsData(calls: (Call | undefined)[], options?: ListenerOptions): CallResult[] {
const { chainId, isEVM } = useActiveWeb3React()
const callResults = useSelector(
state => state.multicall.callResults?.[chainId],
@@ -98,23 +97,40 @@ function useCallsData(calls: (Call | undefined)[], options?: ListenerOptions): C
}
}, [isEVM, dispatch, options, serializedCallKeys, chainId])
- return useMemo(
- () =>
- isEVM && calls.length
- ? calls.map(call => {
- if (!call) return INVALID_RESULT
-
- const result = callResults?.[toCallKey(call)]
- let data
- if (result?.data && result?.data !== '0x') {
- data = result.data
- }
+ const lastResults = useRef([])
+ return useMemo(() => {
+ let isChanged = lastResults.current.length !== calls.length
+
+ // Construct results using a for-loop to handle sparse arrays.
+ // Array.prototype.map would skip empty entries.
+ const results: CallResult[] = []
+ for (let i = 0; i < calls.length; ++i) {
+ const call = calls[i]
+ let result = INVALID_RESULT
+ if (call) {
+ const callResult = callResults?.[toCallKey(call)]
+ result = {
+ valid: true,
+ data: callResult?.data && callResult.data !== '0x' ? callResult.data : undefined,
+ blockNumber: callResult?.blockNumber,
+ }
+ }
- return { valid: true, data, blockNumber: result?.blockNumber }
- })
- : EMPTY_ARRAY,
- [callResults, calls, isEVM],
- )
+ isChanged = isChanged || !areCallResultsEqual(result, lastResults.current[i])
+ results.push(result)
+ }
+
+ // Force the results to be referentially stable if they have not changed.
+ // This is necessary because *all* callResults are passed as deps when initially memoizing the results.
+ if (isChanged) {
+ lastResults.current = results
+ }
+ return lastResults.current
+ }, [callResults, calls])
+}
+
+function areCallResultsEqual(a: CallResult, b: CallResult) {
+ return a.valid === b.valid && a.data === b.data && a.blockNumber === b.blockNumber
}
interface CallState {
@@ -124,27 +140,24 @@ interface CallState {
// true if the result has never been fetched
readonly loading: boolean
// true if the result is not for the latest block
- readonly syncing: boolean
+ // readonly syncing: boolean
// true if the call was made and is synced, but the return data is invalid
readonly error: boolean
}
-const INVALID_CALL_STATE: CallState = { valid: false, result: undefined, loading: false, syncing: false, error: false }
-const LOADING_CALL_STATE: CallState = { valid: true, result: undefined, loading: true, syncing: true, error: false }
+const INVALID_CALL_STATE: CallState = { valid: false, result: undefined, loading: false, error: false }
+const LOADING_CALL_STATE: CallState = { valid: true, result: undefined, loading: true, error: false }
-function toCallState(
+export function toCallState(
callResult: CallResult | undefined,
contractInterface: Interface | undefined,
fragment: FunctionFragment | undefined,
- latestBlockNumber: number | undefined,
): CallState {
- if (!callResult) return INVALID_CALL_STATE
- const { valid, data, blockNumber } = callResult
- if (!valid) return INVALID_CALL_STATE
- if (valid && !blockNumber) return LOADING_CALL_STATE
- if (!contractInterface || !fragment || !latestBlockNumber) return LOADING_CALL_STATE
+ if (!callResult || !callResult.valid) return INVALID_CALL_STATE
+ const { data, blockNumber } = callResult
+ if (!blockNumber || !contractInterface || !fragment) return LOADING_CALL_STATE
const success = data && data.length > 2
- const syncing = (blockNumber ?? 0) < latestBlockNumber
+ // const syncing = blockNumber < latestBlockNumber
let result: Result | undefined = undefined
if (success && data) {
try {
@@ -155,7 +168,6 @@ function toCallState(
valid: true,
loading: false,
error: true,
- syncing,
result,
}
}
@@ -163,7 +175,6 @@ function toCallState(
return {
valid: true,
loading: false,
- syncing,
result: result,
error: !success,
}
@@ -197,11 +208,9 @@ export function useSingleContractMultipleData(
const results = useCallsData(calls, options)
- const latestBlockNumber = useBlockNumber()
-
return useMemo(() => {
- return isEVM ? results.map(result => toCallState(result, contract?.interface, fragment, latestBlockNumber)) : []
- }, [isEVM, fragment, contract, results, latestBlockNumber])
+ return isEVM ? results.map(result => toCallState(result, contract?.interface, fragment)) : []
+ }, [isEVM, fragment, contract, results])
}
export function useMultipleContractSingleData(
@@ -243,12 +252,10 @@ export function useMultipleContractSingleData(
const results = useCallsData(calls, options)
- const latestBlockNumber = useBlockNumber()
-
return useMemo(() => {
- if (isEVM) return results.map(result => toCallState(result, contractInterface, fragment, latestBlockNumber))
+ if (isEVM) return results.map(result => toCallState(result, contractInterface, fragment))
return []
- }, [isEVM, results, contractInterface, fragment, latestBlockNumber])
+ }, [isEVM, results, contractInterface, fragment])
}
export function useSingleCallResult(
@@ -276,11 +283,10 @@ export function useSingleCallResult(
}, [isEVM, contract, fragment, inputs, gasRequired])
const { valid, data, blockNumber } = useCallsData(calls, options)[0] || {}
- const latestBlockNumber = useBlockNumber()
return useMemo(() => {
- return toCallState({ valid, data, blockNumber }, contract?.interface, fragment, latestBlockNumber)
- }, [valid, data, blockNumber, contract, fragment, latestBlockNumber])
+ return toCallState({ valid, data, blockNumber }, contract?.interface, fragment)
+ }, [valid, data, blockNumber, contract, fragment])
}
export function useSingleContractWithCallData(
@@ -305,16 +311,9 @@ export function useSingleContractWithCallData(
const results = useCallsData(calls, options)
- const latestBlockNumber = useBlockNumber()
-
return useMemo(() => {
return results.map((result, i) =>
- toCallState(
- result,
- contract?.interface,
- contract?.interface?.getFunction(callDatas[i].substring(0, 10)),
- latestBlockNumber,
- ),
+ toCallState(result, contract?.interface, contract?.interface?.getFunction(callDatas[i].substring(0, 10))),
)
- }, [contract, results, latestBlockNumber, callDatas])
+ }, [contract, results, callDatas])
}
diff --git a/src/state/prommPools/useGetElasticPools/index.ts b/src/state/prommPools/useGetElasticPools/index.ts
index f78f657c1f..127cda4f38 100644
--- a/src/state/prommPools/useGetElasticPools/index.ts
+++ b/src/state/prommPools/useGetElasticPools/index.ts
@@ -1,5 +1,4 @@
-import { CHAINS_SUPPORT_NEW_POOL_FARM_API } from 'constants/networks'
-import { useActiveWeb3React } from 'hooks'
+import { useKyberSwapConfig } from 'state/application/hooks'
import { ElasticPoolDetail } from 'types/pool'
import useGetElasticPoolsV1 from './useGetElasticPoolsV1'
@@ -14,13 +13,12 @@ export type CommonReturn = {
}
const useGetElasticPools = (poolAddresses: string[]): CommonReturn => {
- const { chainId } = useActiveWeb3React()
+ const { isEnableKNProtocol } = useKyberSwapConfig()
- const shouldRunV2 = CHAINS_SUPPORT_NEW_POOL_FARM_API.includes(chainId)
- const responseV1 = useGetElasticPoolsV1(poolAddresses, shouldRunV2)
+ const responseV1 = useGetElasticPoolsV1(poolAddresses)
const responseV2 = useGetElasticPoolsV2()
- if (shouldRunV2) {
+ if (isEnableKNProtocol) {
return responseV2
}
diff --git a/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV1.ts b/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV1.ts
index 790ca9f6bc..512f9120f9 100644
--- a/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV1.ts
+++ b/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV1.ts
@@ -124,15 +124,15 @@ const parsedPoolData = (
return formatted
}
-const useGetElasticPoolsV1 = (poolAddresses: string[], skip?: boolean): CommonReturn => {
- const { elasticClient } = useKyberSwapConfig()
+const useGetElasticPoolsV1 = (poolAddresses: string[]): CommonReturn => {
+ const { elasticClient, isEnableKNProtocol } = useKyberSwapConfig()
const { blockLast24h } = usePoolBlocks()
const { loading, error, data } = useQuery(PROMM_POOLS_BULK(undefined, poolAddresses), {
client: elasticClient,
fetchPolicy: 'no-cache',
- skip,
+ skip: isEnableKNProtocol,
})
const {
@@ -142,7 +142,7 @@ const useGetElasticPoolsV1 = (poolAddresses: string[], skip?: boolean): CommonRe
} = useQuery(PROMM_POOLS_BULK(blockLast24h, poolAddresses), {
client: elasticClient,
fetchPolicy: 'no-cache',
- skip,
+ skip: isEnableKNProtocol,
})
const anyError = error24?.message.includes('Failed to decode `block.number`')
diff --git a/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV2.ts b/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV2.ts
index cdd34eeede..f071b96f8a 100644
--- a/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV2.ts
+++ b/src/state/prommPools/useGetElasticPools/useGetElasticPoolsV2.ts
@@ -1,8 +1,9 @@
import useSWRImmutable from 'swr/immutable'
import { POOL_FARM_BASE_URL } from 'constants/env'
-import { CHAINS_SUPPORT_NEW_POOL_FARM_API, NETWORKS_INFO, isEVM } from 'constants/networks'
+import { NETWORKS_INFO, isEVM } from 'constants/networks'
import { useActiveWeb3React } from 'hooks'
+import { useKyberSwapConfig } from 'state/application/hooks'
import { ElasticPoolDetail } from 'types/pool'
import { CommonReturn } from '.'
@@ -50,20 +51,20 @@ type PoolAccumulator = { [address: string]: ElasticPoolDetail }
const useGetElasticPoolsV2 = (): CommonReturn => {
const { chainId } = useActiveWeb3React()
+ const { isEnableKNProtocol } = useKyberSwapConfig()
- const shouldSkip = !isEVM(chainId) || !CHAINS_SUPPORT_NEW_POOL_FARM_API.includes(chainId)
const chainRoute = !isEVM(chainId) || NETWORKS_INFO[chainId].poolFarmRoute
const { isValidating, error, data } = useSWRImmutable(
- `${POOL_FARM_BASE_URL}/${chainRoute}/api/v1/elastic-new/pools?includeLowTvl=true&page=1&perPage=10000`,
+ `${POOL_FARM_BASE_URL}/${chainRoute}/api/v1/elastic-new/pools?includeLowTvl=true&page=1&perPage=10000&thisParamToForceRefresh=${isEnableKNProtocol}`,
async (url: string) => {
- if (shouldSkip) {
+ if (!isEnableKNProtocol) {
return Promise.resolve({})
}
return fetch(url).then(resp => resp.json())
},
{
- refreshInterval: shouldSkip ? 0 : 60_000,
+ refreshInterval: isEnableKNProtocol ? 0 : 60_000,
},
)
diff --git a/src/utils/iamError.ts b/src/utils/iamError.ts
index e75f3ec6c2..1c54307ae9 100644
--- a/src/utils/iamError.ts
+++ b/src/utils/iamError.ts
@@ -1,22 +1,29 @@
import { captureException } from '@sentry/react'
import { AxiosError } from 'axios'
-import { BFF_API, ENV_LEVEL } from 'constants/env'
+import { BFF_API, ENV_LEVEL, KS_SETTING_API } from 'constants/env'
import { AGGREGATOR_API_PATHS } from 'constants/index'
import { ENV_TYPE } from 'constants/type'
-const ErrorInfo = {
- routeApiError: 0,
- iamApoError: 0,
- errorThreshold: 2,
- sentAlertIamApi: false,
- sentAlertRouteApi: false,
+enum ErrorType {
+ ROUTE_ERROR = 'Route API',
+ IAM_ERROR = 'IAM API',
+ KS_SETTING_ERROR = 'KsSetting API',
+ NOT_TRACK = 'Not track',
}
+const ErrorInfo = Object.values(ErrorType).reduce>(
+ (rs, cur) => {
+ rs[cur] = { sentAlert: false, errorCount: 0 }
+ return rs
+ },
+ {},
+)
+
const apiDowns: string[] = []
-const isIamApiDown = () => ErrorInfo.iamApoError >= ErrorInfo.errorThreshold
-const isRouteApiDown = () => ErrorInfo.routeApiError >= ErrorInfo.errorThreshold
+const ERROR_THRESHOLD = 2
+const isApiDown = (type: ErrorType) => ErrorInfo[type]?.errorCount >= ERROR_THRESHOLD
const sendError = (name: string, apiUrl: string, trackData: any) => {
if (ENV_LEVEL < ENV_TYPE.STG) return
@@ -38,11 +45,20 @@ function onDisconnect() {
window.addEventListener('online', onConnect, false)
window.addEventListener('offline', onDisconnect, false)
+const getErrorType = (apiUrl: string) => {
+ if (apiUrl.endsWith(AGGREGATOR_API_PATHS.GET_ROUTE) || apiUrl.endsWith(AGGREGATOR_API_PATHS.BUILD_ROUTE))
+ return ErrorType.ROUTE_ERROR
+
+ if (apiUrl.startsWith(BFF_API) && !blacklistPathBff.some(path => apiUrl.endsWith(path))) return ErrorType.IAM_ERROR
+
+ if (apiUrl.startsWith(KS_SETTING_API)) return ErrorType.KS_SETTING_ERROR
+ return ErrorType.NOT_TRACK
+}
+
/**
* check error status: blocked, maybe cors issues or server down
- * only check bff api + 2 route apis
*/
-export const checkIamDown = (axiosErr: AxiosError) => {
+export const checkApiDown = (axiosErr: AxiosError) => {
const statusCode = axiosErr?.response?.status
const response = axiosErr?.response?.data
@@ -73,26 +89,14 @@ export const checkIamDown = (axiosErr: AxiosError) => {
apiDowns,
}
- const isRouteApiDie =
- isDie && (apiUrl.endsWith(AGGREGATOR_API_PATHS.GET_ROUTE) || apiUrl.endsWith(AGGREGATOR_API_PATHS.BUILD_ROUTE))
+ const errorType = getErrorType(apiUrl)
- const isIamDie = isDie && apiUrl.startsWith(BFF_API) && !blacklistPathBff.some(path => apiUrl.endsWith(path))
-
- if (isRouteApiDie) {
- ErrorInfo.routeApiError++
- if (isRouteApiDown() && !ErrorInfo.sentAlertRouteApi) {
- ErrorInfo.sentAlertRouteApi = true
- sendError('Route API', apiUrl, trackData)
- }
- }
- if (isIamDie) {
- ErrorInfo.iamApoError++
- if (isIamApiDown() && !ErrorInfo.sentAlertIamApi) {
- ErrorInfo.sentAlertIamApi = true
- sendError('IAM API', apiUrl, trackData)
+ if (isDie && errorType !== ErrorType.NOT_TRACK) {
+ ErrorInfo[errorType].errorCount++
+ if (isApiDown(errorType) && !ErrorInfo[errorType].sentAlert) {
+ ErrorInfo[errorType].sentAlert = true
+ sendError(errorType, apiUrl, trackData)
}
- }
- if (isRouteApiDie || isIamDie) {
console.error(`${apiUrl} was down`, trackData)
}
}
diff --git a/src/utils/numbers.ts b/src/utils/numbers.ts
index 69323955e8..8762f090be 100644
--- a/src/utils/numbers.ts
+++ b/src/utils/numbers.ts
@@ -92,7 +92,7 @@ const parseNum = (value: FormatValue): Fraction => {
value instanceof Price
) {
const valueStr = (() => {
- if (typeof value === 'string') return value
+ if (typeof value === 'string') return toFixed(+value)
if (typeof value === 'number') return toFixed(value)
if (value instanceof CurrencyAmount) return value.toFixed(value.currency.decimals)
if (value instanceof Price) return value.toFixed(18)
diff --git a/src/utils/tokenInfo.ts b/src/utils/tokenInfo.ts
index bfeb5844cd..53328f997e 100644
--- a/src/utils/tokenInfo.ts
+++ b/src/utils/tokenInfo.ts
@@ -59,6 +59,8 @@ export const getTokenSymbolWithHardcode = (
return 'mKNC'
}
if (chainId === ChainId.ARBITRUM && formatAddress === '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8') return 'USDC.e'
+ if (chainId === ChainId.ARBITRUM && formatAddress === '0x9cfb13e6c11054ac9fcb92ba89644f30775436e4')
+ return 'axl.wstETH'
return defaultSymbol ?? ''
}
diff --git a/tsconfig.json b/tsconfig.json
index 26277df31c..8094043b36 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -25,7 +25,10 @@
"types": ["vite/client", "vite-plugin-svgr/client"],
"typeRoots": ["./types"],
"baseUrl": "src",
- "useUnknownInCatchVariables": false
+ "useUnknownInCatchVariables": false,
+ "paths": {
+ "@/*": ["./src/*"]
+ }
},
"exclude": ["node_modules", "cypress"],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
diff --git a/vite.config.ts b/vite.config.ts
index e58c3226cb..6f9cf965cf 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,6 +1,7 @@
import GlobalPolyFill from '@esbuild-plugins/node-globals-polyfill'
import lingui from '@lingui/vite-plugin'
import react from '@vitejs/plugin-react'
+import path from 'path'
import { defineConfig } from 'vite'
import checker from 'vite-plugin-checker'
import svgrPlugin from 'vite-plugin-svgr'
@@ -13,6 +14,7 @@ export default defineConfig({
},
plugins: [
react({
+ jsxImportSource: '@welldone-software/why-did-you-render',
babel: {
// Use .babelrc files, necessary to use LinguiJS CLI
babelrc: true,
@@ -53,6 +55,9 @@ export default defineConfig({
stream: 'stream-browserify',
zlib: 'browserify-zlib',
util: 'util',
+ 'react-redux': 'react-redux/dist/react-redux.js',
+ '@': path.resolve(__dirname, './src/'),
+ "react-dom/client": "react-dom/profiling",
},
},
server: {
diff --git a/yarn.lock b/yarn.lock
index 28c71e35de..223ea84028 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -22,15 +22,7 @@
resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz#aae21cb858bbb0411949d5b7b3051f4209043f62"
integrity sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw==
-"@ampproject/remapping@^2.1.0":
- version "2.2.0"
- resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d"
- integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==
- dependencies:
- "@jridgewell/gen-mapping" "^0.1.0"
- "@jridgewell/trace-mapping" "^0.3.9"
-
-"@ampproject/remapping@^2.2.0":
+"@ampproject/remapping@^2.1.0", "@ampproject/remapping@^2.2.0":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630"
integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==
@@ -62,14 +54,14 @@
tslib "^2.3.0"
zen-observable-ts "^1.2.5"
-"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.21.4":
+"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.21.4":
version "7.21.4"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.21.4.tgz#d0fa9e4413aca81f2b23b9442797bda1826edb39"
integrity sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==
dependencies:
"@babel/highlight" "^7.18.6"
-"@babel/code-frame@^7.22.13":
+"@babel/code-frame@^7.16.7", "@babel/code-frame@^7.22.13":
version "7.22.13"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e"
integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==
@@ -159,7 +151,7 @@
jsesc "^2.5.1"
source-map "^0.5.0"
-"@babel/generator@^7.11.6", "@babel/generator@^7.17.3", "@babel/generator@^7.17.7", "@babel/generator@^7.22.0":
+"@babel/generator@^7.11.6", "@babel/generator@^7.22.0":
version "7.22.3"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.3.tgz#0ff675d2edb93d7596c5f6728b52615cfc0df01e"
integrity sha512-C17MW4wlk//ES/CJDL51kPNwl+qiBQyN7b9SKyVp11BLGFeSPoVaHrv+MNt8jwQFhQWowW88z1eeBx3pFz9v8A==
@@ -169,7 +161,7 @@
"@jridgewell/trace-mapping" "^0.3.17"
jsesc "^2.5.1"
-"@babel/generator@^7.22.15":
+"@babel/generator@^7.17.3", "@babel/generator@^7.17.7", "@babel/generator@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.15.tgz#1564189c7ec94cb8f77b5e8a90c4d200d21b2339"
integrity sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==
@@ -186,18 +178,7 @@
dependencies:
"@babel/types" "^7.18.6"
-"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.22.1":
- version "7.22.1"
- resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.1.tgz#bfcd6b7321ffebe33290d68550e2c9d7eb7c7a58"
- integrity sha512-Rqx13UM3yVB5q0D/KwQ8+SPfX/+Rnsy1Lw1k/UwOC4KC6qrzIQoY3lYnBu5EHKBlEHHcj0M0W8ltPSkD8rqfsQ==
- dependencies:
- "@babel/compat-data" "^7.22.0"
- "@babel/helper-validator-option" "^7.21.0"
- browserslist "^4.21.3"
- lru-cache "^5.1.1"
- semver "^6.3.0"
-
-"@babel/helper-compilation-targets@^7.22.15":
+"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz#0698fc44551a26cf29f18d4662d5bf545a6cfc52"
integrity sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==
@@ -208,6 +189,17 @@
lru-cache "^5.1.1"
semver "^6.3.1"
+"@babel/helper-compilation-targets@^7.22.1":
+ version "7.22.1"
+ resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.1.tgz#bfcd6b7321ffebe33290d68550e2c9d7eb7c7a58"
+ integrity sha512-Rqx13UM3yVB5q0D/KwQ8+SPfX/+Rnsy1Lw1k/UwOC4KC6qrzIQoY3lYnBu5EHKBlEHHcj0M0W8ltPSkD8rqfsQ==
+ dependencies:
+ "@babel/compat-data" "^7.22.0"
+ "@babel/helper-validator-option" "^7.21.0"
+ browserslist "^4.21.3"
+ lru-cache "^5.1.1"
+ semver "^6.3.0"
+
"@babel/helper-create-class-features-plugin@^7.21.0":
version "7.21.4"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.4.tgz#3a017163dc3c2ba7deb9a7950849a9586ea24c18"
@@ -222,17 +214,25 @@
"@babel/helper-skip-transparent-expression-wrappers" "^7.20.0"
"@babel/helper-split-export-declaration" "^7.18.6"
-"@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.22.1":
+"@babel/helper-environment-visitor@^7.16.7", "@babel/helper-environment-visitor@^7.22.5":
+ version "7.22.5"
+ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98"
+ integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==
+
+"@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.22.1":
version "7.22.1"
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.1.tgz#ac3a56dbada59ed969d712cf527bd8271fe3eba8"
integrity sha512-Z2tgopurB/kTbidvzeBrc2To3PUP/9i5MUe+fU6QJCQDyPwSH2oRapkLw3KGECDYSjhQZCNxEvNvZlLw8JjGwA==
-"@babel/helper-environment-visitor@^7.22.5":
+"@babel/helper-function-name@^7.16.7", "@babel/helper-function-name@^7.22.5":
version "7.22.5"
- resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98"
- integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==
+ resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be"
+ integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==
+ dependencies:
+ "@babel/template" "^7.22.5"
+ "@babel/types" "^7.22.5"
-"@babel/helper-function-name@^7.16.7", "@babel/helper-function-name@^7.21.0":
+"@babel/helper-function-name@^7.21.0":
version "7.21.0"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4"
integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==
@@ -240,28 +240,20 @@
"@babel/template" "^7.20.7"
"@babel/types" "^7.21.0"
-"@babel/helper-function-name@^7.22.5":
+"@babel/helper-hoist-variables@^7.16.7", "@babel/helper-hoist-variables@^7.22.5":
version "7.22.5"
- resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be"
- integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==
+ resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb"
+ integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==
dependencies:
- "@babel/template" "^7.22.5"
"@babel/types" "^7.22.5"
-"@babel/helper-hoist-variables@^7.16.7", "@babel/helper-hoist-variables@^7.18.6":
+"@babel/helper-hoist-variables@^7.18.6":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678"
integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==
dependencies:
"@babel/types" "^7.18.6"
-"@babel/helper-hoist-variables@^7.22.5":
- version "7.22.5"
- resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb"
- integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==
- dependencies:
- "@babel/types" "^7.22.5"
-
"@babel/helper-member-expression-to-functions@^7.20.7", "@babel/helper-member-expression-to-functions@^7.21.0":
version "7.21.0"
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz#319c6a940431a133897148515877d2f3269c3ba5"
@@ -283,7 +275,18 @@
dependencies:
"@babel/types" "^7.22.15"
-"@babel/helper-module-transforms@^7.17.7", "@babel/helper-module-transforms@^7.21.2", "@babel/helper-module-transforms@^7.22.1":
+"@babel/helper-module-transforms@^7.17.7":
+ version "7.22.17"
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.17.tgz#7edf129097a51ccc12443adbc6320e90eab76693"
+ integrity sha512-XouDDhQESrLHTpnBtCKExJdyY4gJCdrvH2Pyv8r8kovX2U8G0dRUOT45T9XlbLtuu9CLXP15eusnkprhoPV5iQ==
+ dependencies:
+ "@babel/helper-environment-visitor" "^7.22.5"
+ "@babel/helper-module-imports" "^7.22.15"
+ "@babel/helper-simple-access" "^7.22.5"
+ "@babel/helper-split-export-declaration" "^7.22.6"
+ "@babel/helper-validator-identifier" "^7.22.15"
+
+"@babel/helper-module-transforms@^7.21.2", "@babel/helper-module-transforms@^7.22.1":
version "7.22.1"
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.1.tgz#e0cad47fedcf3cae83c11021696376e2d5a50c63"
integrity sha512-dxAe9E7ySDGbQdCVOY/4+UcD8M9ZFqZcZhSPsPacvCG4M+9lwtDDQfI2EoaSvmf7W/8yCBkGU0m7Pvt1ru3UZw==
@@ -358,20 +361,20 @@
dependencies:
"@babel/types" "^7.20.0"
-"@babel/helper-split-export-declaration@^7.16.7", "@babel/helper-split-export-declaration@^7.18.6":
- version "7.18.6"
- resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075"
- integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==
- dependencies:
- "@babel/types" "^7.18.6"
-
-"@babel/helper-split-export-declaration@^7.22.6":
+"@babel/helper-split-export-declaration@^7.16.7", "@babel/helper-split-export-declaration@^7.22.6":
version "7.22.6"
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c"
integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==
dependencies:
"@babel/types" "^7.22.5"
+"@babel/helper-split-export-declaration@^7.18.6":
+ version "7.18.6"
+ resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075"
+ integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==
+ dependencies:
+ "@babel/types" "^7.18.6"
+
"@babel/helper-string-parser@^7.19.4", "@babel/helper-string-parser@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f"
@@ -402,16 +405,7 @@
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz#694c30dfa1d09a6534cdfcafbe56789d36aba040"
integrity sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==
-"@babel/helpers@^7.17.8", "@babel/helpers@^7.22.0":
- version "7.22.3"
- resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.3.tgz#53b74351da9684ea2f694bf0877998da26dd830e"
- integrity sha512-jBJ7jWblbgr7r6wYZHMdIqKc73ycaTcCaWRq4/2LpuPHcx7xMlZvpGQkOYc9HeSjn6rcx15CPlgVcBtZ4WZJ2w==
- dependencies:
- "@babel/template" "^7.21.9"
- "@babel/traverse" "^7.22.1"
- "@babel/types" "^7.22.3"
-
-"@babel/helpers@^7.22.15":
+"@babel/helpers@^7.17.8", "@babel/helpers@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.15.tgz#f09c3df31e86e3ea0b7ff7556d85cdebd47ea6f1"
integrity sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw==
@@ -420,6 +414,15 @@
"@babel/traverse" "^7.22.15"
"@babel/types" "^7.22.15"
+"@babel/helpers@^7.22.0":
+ version "7.22.3"
+ resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.3.tgz#53b74351da9684ea2f694bf0877998da26dd830e"
+ integrity sha512-jBJ7jWblbgr7r6wYZHMdIqKc73ycaTcCaWRq4/2LpuPHcx7xMlZvpGQkOYc9HeSjn6rcx15CPlgVcBtZ4WZJ2w==
+ dependencies:
+ "@babel/template" "^7.21.9"
+ "@babel/traverse" "^7.22.1"
+ "@babel/types" "^7.22.3"
+
"@babel/highlight@^7.18.6":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf"
@@ -448,10 +451,10 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.3.tgz#838ae31893373222cd9062568e2192c670037e00"
integrity sha512-vrukxyW/ep8UD1UDzOYpTKQ6abgjFoeG6L+4ar9+c5TN9QnlqiOi6QK7LSR5ewm/ERyGkT/Ai6VboNrxhbr9Uw==
-"@babel/parser@^7.16.4", "@babel/parser@^7.17.3", "@babel/parser@^7.17.8":
- version "7.20.5"
- resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8"
- integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==
+"@babel/parser@^7.17.3", "@babel/parser@^7.17.8", "@babel/parser@^7.20.15", "@babel/parser@^7.21.3", "@babel/parser@^7.22.16":
+ version "7.22.16"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.16.tgz#180aead7f247305cce6551bea2720934e2fa2c95"
+ integrity sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==
"@babel/parser@^7.21.2":
version "7.22.5"
@@ -588,16 +591,7 @@
dependencies:
regenerator-runtime "^0.14.0"
-"@babel/template@^7.16.7", "@babel/template@^7.20.7", "@babel/template@^7.21.9":
- version "7.21.9"
- resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb"
- integrity sha512-MK0X5k8NKOuWRamiEfc3KEJiHMTkGZNUjzMipqCGDDc6ijRl/B7RGSKVGncu4Ro/HdyzzY6cmoXuKI2Gffk7vQ==
- dependencies:
- "@babel/code-frame" "^7.21.4"
- "@babel/parser" "^7.21.9"
- "@babel/types" "^7.21.5"
-
-"@babel/template@^7.22.15", "@babel/template@^7.22.5":
+"@babel/template@^7.16.7", "@babel/template@^7.22.15", "@babel/template@^7.22.5":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38"
integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==
@@ -606,6 +600,15 @@
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"
+"@babel/template@^7.20.7", "@babel/template@^7.21.9":
+ version "7.21.9"
+ resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.21.9.tgz#bf8dad2859130ae46088a99c1f265394877446fb"
+ integrity sha512-MK0X5k8NKOuWRamiEfc3KEJiHMTkGZNUjzMipqCGDDc6ijRl/B7RGSKVGncu4Ro/HdyzzY6cmoXuKI2Gffk7vQ==
+ dependencies:
+ "@babel/code-frame" "^7.21.4"
+ "@babel/parser" "^7.21.9"
+ "@babel/types" "^7.21.5"
+
"@babel/traverse@7.17.3":
version "7.17.3"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.3.tgz#0ae0f15b27d9a92ba1f2263358ea7c4e7db47b57"
@@ -622,7 +625,23 @@
debug "^4.1.0"
globals "^11.1.0"
-"@babel/traverse@^7.17.3", "@babel/traverse@^7.20.7", "@babel/traverse@^7.22.1", "@babel/traverse@^7.4.5":
+"@babel/traverse@^7.17.3":
+ version "7.22.17"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.17.tgz#b23c203ab3707e3be816043081b4a994fcacec44"
+ integrity sha512-xK4Uwm0JnAMvxYZxOVecss85WxTEIbTa7bnGyf/+EgCL5Zt3U7htUpEOWv9detPlamGKuRzCqw74xVglDWpPdg==
+ dependencies:
+ "@babel/code-frame" "^7.22.13"
+ "@babel/generator" "^7.22.15"
+ "@babel/helper-environment-visitor" "^7.22.5"
+ "@babel/helper-function-name" "^7.22.5"
+ "@babel/helper-hoist-variables" "^7.22.5"
+ "@babel/helper-split-export-declaration" "^7.22.6"
+ "@babel/parser" "^7.22.16"
+ "@babel/types" "^7.22.17"
+ debug "^4.1.0"
+ globals "^11.1.0"
+
+"@babel/traverse@^7.20.7", "@babel/traverse@^7.22.1", "@babel/traverse@^7.4.5":
version "7.22.1"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.1.tgz#bd22c50b1439cfcfc2fa137b7fdf6c06787456e9"
integrity sha512-lAWkdCoUFnmwLBhIRLciFntGYsIIoC6vIbN8zrLPqBnJmPu7Z6nzqnKd7FsxQUNAvZfVZ0x6KdNvNp8zWIOHSQ==
@@ -671,7 +690,7 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
-"@babel/types@^7.11.5", "@babel/types@^7.17.0", "@babel/types@^7.18.6", "@babel/types@^7.20.0", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.22.0", "@babel/types@^7.22.3":
+"@babel/types@^7.11.5", "@babel/types@^7.18.6", "@babel/types@^7.20.0", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.22.0", "@babel/types@^7.22.3":
version "7.22.3"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.3.tgz#0cc6af178b91490acaeb4a2f70dcbf27cdf3d8f3"
integrity sha512-P3na3xIQHTKY4L0YOG7pM8M8uoUIB910WQaSiiMCZUC2Cy8XFEQONGABFnHWBa2gpGKODTAJcNhi5Zk0sLRrzg==
@@ -680,6 +699,15 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
+"@babel/types@^7.17.0", "@babel/types@^7.22.17":
+ version "7.22.17"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.17.tgz#f753352c4610ffddf9c8bc6823f9ff03e2303eee"
+ integrity sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg==
+ dependencies:
+ "@babel/helper-string-parser" "^7.22.5"
+ "@babel/helper-validator-identifier" "^7.22.15"
+ to-fast-properties "^2.0.0"
+
"@babel/types@^7.22.15", "@babel/types@^7.22.5":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.15.tgz#266cb21d2c5fd0b3931e7a91b6dd72d2f617d282"
@@ -2102,14 +2130,6 @@
"@walletconnect/utils" "2.0.0-rc.3"
bs58 "^5.0.0"
-"@jridgewell/gen-mapping@^0.1.0":
- version "0.1.1"
- resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996"
- integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==
- dependencies:
- "@jridgewell/set-array" "^1.0.0"
- "@jridgewell/sourcemap-codec" "^1.4.10"
-
"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2":
version "0.3.2"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9"
@@ -2129,7 +2149,7 @@
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721"
integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==
-"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1":
+"@jridgewell/set-array@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==
@@ -2147,7 +2167,7 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
-"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13":
+"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13", "@jridgewell/sourcemap-codec@^1.4.15":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
@@ -5257,63 +5277,63 @@
magic-string "^0.27.0"
react-refresh "^0.14.0"
-"@vue/compiler-core@3.2.45":
- version "3.2.45"
- resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.45.tgz#d9311207d96f6ebd5f4660be129fb99f01ddb41b"
- integrity sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==
+"@vue/compiler-core@3.3.4":
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.3.4.tgz#7fbf591c1c19e1acd28ffd284526e98b4f581128"
+ integrity sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==
dependencies:
- "@babel/parser" "^7.16.4"
- "@vue/shared" "3.2.45"
+ "@babel/parser" "^7.21.3"
+ "@vue/shared" "3.3.4"
estree-walker "^2.0.2"
- source-map "^0.6.1"
+ source-map-js "^1.0.2"
-"@vue/compiler-dom@3.2.45":
- version "3.2.45"
- resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz#c43cc15e50da62ecc16a42f2622d25dc5fd97dce"
- integrity sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==
+"@vue/compiler-dom@3.3.4":
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.3.4.tgz#f56e09b5f4d7dc350f981784de9713d823341151"
+ integrity sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==
dependencies:
- "@vue/compiler-core" "3.2.45"
- "@vue/shared" "3.2.45"
+ "@vue/compiler-core" "3.3.4"
+ "@vue/shared" "3.3.4"
"@vue/compiler-sfc@^3.2.40":
- version "3.2.45"
- resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz#7f7989cc04ec9e7c55acd406827a2c4e96872c70"
- integrity sha512-1jXDuWah1ggsnSAOGsec8cFjT/K6TMZ0sPL3o3d84Ft2AYZi2jWJgRMjw4iaK0rBfA89L5gw427H4n1RZQBu6Q==
- dependencies:
- "@babel/parser" "^7.16.4"
- "@vue/compiler-core" "3.2.45"
- "@vue/compiler-dom" "3.2.45"
- "@vue/compiler-ssr" "3.2.45"
- "@vue/reactivity-transform" "3.2.45"
- "@vue/shared" "3.2.45"
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.3.4.tgz#b19d942c71938893535b46226d602720593001df"
+ integrity sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==
+ dependencies:
+ "@babel/parser" "^7.20.15"
+ "@vue/compiler-core" "3.3.4"
+ "@vue/compiler-dom" "3.3.4"
+ "@vue/compiler-ssr" "3.3.4"
+ "@vue/reactivity-transform" "3.3.4"
+ "@vue/shared" "3.3.4"
estree-walker "^2.0.2"
- magic-string "^0.25.7"
+ magic-string "^0.30.0"
postcss "^8.1.10"
- source-map "^0.6.1"
+ source-map-js "^1.0.2"
-"@vue/compiler-ssr@3.2.45":
- version "3.2.45"
- resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz#bd20604b6e64ea15344d5b6278c4141191c983b2"
- integrity sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==
+"@vue/compiler-ssr@3.3.4":
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.3.4.tgz#9d1379abffa4f2b0cd844174ceec4a9721138777"
+ integrity sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==
dependencies:
- "@vue/compiler-dom" "3.2.45"
- "@vue/shared" "3.2.45"
+ "@vue/compiler-dom" "3.3.4"
+ "@vue/shared" "3.3.4"
-"@vue/reactivity-transform@3.2.45":
- version "3.2.45"
- resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz#07ac83b8138550c83dfb50db43cde1e0e5e8124d"
- integrity sha512-BHVmzYAvM7vcU5WmuYqXpwaBHjsS8T63jlKGWVtHxAHIoMIlmaMyurUSEs1Zcg46M4AYT5MtB1U274/2aNzjJQ==
+"@vue/reactivity-transform@3.3.4":
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.3.4.tgz#52908476e34d6a65c6c21cd2722d41ed8ae51929"
+ integrity sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==
dependencies:
- "@babel/parser" "^7.16.4"
- "@vue/compiler-core" "3.2.45"
- "@vue/shared" "3.2.45"
+ "@babel/parser" "^7.20.15"
+ "@vue/compiler-core" "3.3.4"
+ "@vue/shared" "3.3.4"
estree-walker "^2.0.2"
- magic-string "^0.25.7"
+ magic-string "^0.30.0"
-"@vue/shared@3.2.45":
- version "3.2.45"
- resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.45.tgz#a3fffa7489eafff38d984e23d0236e230c818bc2"
- integrity sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg==
+"@vue/shared@3.3.4":
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.3.4.tgz#06e83c5027f464eef861c329be81454bc8b70780"
+ integrity sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==
"@walletconnect/browser-utils@^1.8.0":
version "1.8.0"
@@ -12579,13 +12599,6 @@ macos-release@^3.1.0:
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-3.1.0.tgz#6165bb0736ae567ed6649e36ce6a24d87cbb7aca"
integrity sha512-/M/R0gCDgM+Cv1IuBG1XGdfTFnMEG6PZeT+KGWHO/OG+imqmaD9CH5vHBTycEM3+Kc4uG2Il+tFAuUWLqQOeUA==
-magic-string@^0.25.7:
- version "0.25.9"
- resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c"
- integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==
- dependencies:
- sourcemap-codec "^1.4.8"
-
magic-string@^0.27.0:
version "0.27.0"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3"
@@ -12593,6 +12606,13 @@ magic-string@^0.27.0:
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.13"
+magic-string@^0.30.0:
+ version "0.30.3"
+ resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.3.tgz#403755dfd9d6b398dfa40635d52e96c5ac095b85"
+ integrity sha512-B7xGbll2fG/VjP+SWg4sX3JynwIU0mjoTc6MPpKNuIvftk6u6vqhDnk1R80b8C2GBR6ywqy+1DcKBrevBg+bmw==
+ dependencies:
+ "@jridgewell/sourcemap-codec" "^1.4.15"
+
make-dir@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
@@ -12989,11 +13009,6 @@ nano-css@^5.2.1:
stacktrace-js "^2.0.2"
stylis "^4.0.6"
-nanoid@^3.3.4:
- version "3.3.4"
- resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
- integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
-
nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
@@ -14110,11 +14125,11 @@ postcss@^7.0.2:
source-map "^0.6.1"
postcss@^8.1.10:
- version "8.4.20"
- resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.20.tgz#64c52f509644cecad8567e949f4081d98349dc56"
- integrity sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g==
+ version "8.4.29"
+ resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.29.tgz#33bc121cf3b3688d4ddef50be869b2a54185a1dd"
+ integrity sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==
dependencies:
- nanoid "^3.3.4"
+ nanoid "^3.3.6"
picocolors "^1.0.0"
source-map-js "^1.0.2"