diff --git a/apps/ton/package.json b/apps/ton/package.json index 7cf8abd36137c..5eb42f0705fbb 100644 --- a/apps/ton/package.json +++ b/apps/ton/package.json @@ -26,6 +26,7 @@ "@pancakeswap/ton-v2-sdk": "workspace:*", "@pancakeswap/uikit": "workspace:*", "@pancakeswap/utils": "workspace:*", + "@pancakeswap/widgets-internal": "workspace:*", "@tanstack/query-core": "^5.62.16", "@tanstack/react-query": "^5.52.1", "@ton-community/assets-sdk": "^0.0.5", diff --git a/apps/ton/src/components/TonSwap/CurrencyInputPanelSimplify/index.tsx b/apps/ton/src/components/TonSwap/CurrencyInputPanelSimplify/index.tsx index e46ebe0dbb552..850ef75f6291d 100644 --- a/apps/ton/src/components/TonSwap/CurrencyInputPanelSimplify/index.tsx +++ b/apps/ton/src/components/TonSwap/CurrencyInputPanelSimplify/index.tsx @@ -333,7 +333,7 @@ const CurrencyInputPanelSimplify = memo(function CurrencyInputPanel({ wrapperRef={wrapperRef} top={ - {title || <> } + {title} {account ? ( !isInputFocus || !onMax ? ( diff --git a/apps/ton/src/components/TonSwap/PricingAndSlippage.tsx b/apps/ton/src/components/TonSwap/PricingAndSlippage.tsx new file mode 100644 index 0000000000000..b8777c7262076 --- /dev/null +++ b/apps/ton/src/components/TonSwap/PricingAndSlippage.tsx @@ -0,0 +1,34 @@ +import { Currency, Price } from '@pancakeswap/ton-v2-sdk' +import { useModal } from '@pancakeswap/uikit' +import { useUserSlippage } from '@pancakeswap/utils/user' +import { SwapUIV2 } from '@pancakeswap/widgets-internal' +import { SettingsModal } from 'components/Modals/SettingsModal' + +interface Props { + showSlippage?: boolean + priceLoading?: boolean + price?: Price +} + +export const PricingAndSlippage = ({ priceLoading, price, showSlippage = true }: Props) => { + const [allowedSlippage] = useUserSlippage() + const [onPresentSettingsModal] = useModal() + + if (!price) { + return null + } + + const priceNode = price ? ( + <> + + + ) : null + + return ( + + ) +} diff --git a/apps/ton/src/components/TonSwap/SwapCommitButton.tsx b/apps/ton/src/components/TonSwap/SwapCommitButton.tsx index ec5bd65f714e0..08d0a2073679b 100644 --- a/apps/ton/src/components/TonSwap/SwapCommitButton.tsx +++ b/apps/ton/src/components/TonSwap/SwapCommitButton.tsx @@ -1,24 +1,38 @@ import { useTranslation } from '@pancakeswap/localization' import { Button, ButtonProps } from '@pancakeswap/uikit' -import { toNano } from '@ton/ton' import { inputCurrencyAtom, typedValueAtom } from 'atoms/swap/swapStateAtom' import { useAtomValue } from 'jotai' +import { isConnectedAtom } from 'ton/atom/isConnectedAtom' import { balanceAtom } from 'ton/logic/balanceAtom' +import { tryParseAmount } from 'utils/tryParseAmount' -interface SwapCommitButtonProps extends ButtonProps {} +interface SwapCommitButtonProps extends ButtonProps { + isLoading?: boolean +} -export const SwapCommitButton = (props: SwapCommitButtonProps) => { +export const SwapCommitButton = ({ isLoading = false, ...props }: SwapCommitButtonProps) => { const { t } = useTranslation() + const isConnected = useAtomValue(isConnectedAtom) const inputCurrency = useAtomValue(inputCurrencyAtom) + const typedValue = useAtomValue(typedValueAtom) + const typedAmount = tryParseAmount(typedValue, inputCurrency) const { data: balance0 } = useAtomValue(balanceAtom(inputCurrency)) - const isInsufficientBalance0 = balance0 < toNano(typedValue) // TODO: decimals + const isInsufficientBalance0 = inputCurrency && typedAmount ? typedAmount.greaterThan(balance0) : false return ( - ) } diff --git a/apps/ton/src/hooks/swap/useAllCommonPairs.ts b/apps/ton/src/hooks/swap/useAllCommonPairs.ts index 7164ef5c589e8..c240ea901cb9e 100644 --- a/apps/ton/src/hooks/swap/useAllCommonPairs.ts +++ b/apps/ton/src/hooks/swap/useAllCommonPairs.ts @@ -4,10 +4,16 @@ import uniqBy from 'lodash/uniqBy' import { Currency, Token, Pair, CurrencyAmount } from '@pancakeswap/ton-v2-sdk' import { ADDITIONAL_BASES, BASES_TO_CHECK_TRADES_AGAINST, CUSTOM_BASES } from 'config/constants/exchange' import { useAtomValue } from 'jotai' -import { poolDataQueriesAtom } from 'ton/atom/liquidity/poolDataQueriesAtom' +import { poolDataQueriesAtom, useRefreshPoolData } from 'ton/atom/liquidity/poolDataQueriesAtom' import { useUserAddress } from 'hooks/useUserAddress' -export function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): { isLoading: boolean; data: Pair[] } { +interface UseAllCommonPairsReturnType { + isLoading: boolean + data: Pair[] + refresh: () => void +} + +export function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): UseAllCommonPairsReturnType { const chainId = currencyA?.chainId const [tokenA, tokenB] = chainId ? [currencyA?.wrapped, currencyB?.wrapped] : [undefined, undefined] @@ -60,7 +66,7 @@ export function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): { [tokenA, tokenB, bases, basePairs, chainId], ) - const { data: allPairs, isLoading } = usePairs(allPairCombinations) + const { data: allPairs, isLoading, refresh } = usePairs(allPairCombinations) // only pass along valid pairs, non-duplicated pairs return useMemo( @@ -69,9 +75,11 @@ export function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): { ? { isLoading, data: [], + refresh, } : { isLoading, + refresh, data: allPairs ? uniqBy( allPairs.filter((result): result is NonNullable => Boolean(result)), @@ -79,7 +87,7 @@ export function useAllCommonPairs(currencyA?: Currency, currencyB?: Currency): { ) : [], }, - [allPairs, isLoading], + [allPairs, isLoading, refresh], ) } @@ -101,11 +109,17 @@ const usePairs = (pairs: [Token, Token][]) => { [pairs, userAddress], ) const result = useAtomValue(poolDataQueriesAtom(pairsAddress)) + const { refresh } = useRefreshPoolData(pairsAddress) return useMemo(() => { + const res = { + isLoading: result.isLoading, + data: result.data, + refresh, + } if (result.isLoading) { return { + ...res, isLoading: result.isLoading, - data: result.data, } } const data = pairs.map(([token0_, token1_], idx) => { @@ -124,8 +138,9 @@ const usePairs = (pairs: [Token, Token][]) => { } }) return { + ...res, isLoading: false, data, } - }, [pairs, result.data, result.isLoading]) + }, [pairs, result.data, result.isLoading, refresh]) } diff --git a/apps/ton/src/hooks/swap/useBestTrade.ts b/apps/ton/src/hooks/swap/useBestTrade.ts new file mode 100644 index 0000000000000..5ea0d848f8d8e --- /dev/null +++ b/apps/ton/src/hooks/swap/useBestTrade.ts @@ -0,0 +1,42 @@ +import { useCallback } from 'react' +import { Currency, CurrencyAmount } from '@pancakeswap/ton-v2-sdk' +import { useTradeExactIn } from './useTradeExactIn' +import { useTradeExactOut } from './useTradeExactOut' + +export const useBestTrade = ({ + isExactIn, + amount, + inputCurrency, + outputCurrency, +}: { + isExactIn: boolean + amount: CurrencyAmount | undefined + inputCurrency: Currency | undefined + outputCurrency: Currency | undefined +}) => { + const { + isLoading: isTradeExactInLoading, + data: bestTradeExactIn, + refresh: refreshTradeExactIn, + } = useTradeExactIn(isExactIn ? amount : undefined, outputCurrency ?? undefined) + + const { + isLoading: isTradeExactOutLoading, + data: bestTradeExactOut, + refresh: refreshTradeExactOut, + } = useTradeExactOut(isExactIn ? undefined : amount, inputCurrency ?? undefined) + + const trade = isExactIn ? bestTradeExactIn : bestTradeExactOut + + const refreshTrade = useCallback(() => { + refreshTradeExactIn() + refreshTradeExactOut() + }, [refreshTradeExactIn, refreshTradeExactOut]) + + return { + isTradeExactInLoading, + isTradeExactOutLoading, + trade, + refreshTrade, + } +} diff --git a/apps/ton/src/hooks/swap/useTradeExactIn.ts b/apps/ton/src/hooks/swap/useTradeExactIn.ts index 6701de62a9674..28960a783af03 100644 --- a/apps/ton/src/hooks/swap/useTradeExactIn.ts +++ b/apps/ton/src/hooks/swap/useTradeExactIn.ts @@ -12,21 +12,24 @@ import { useAllCommonPairs } from './useAllCommonPairs' export function useTradeExactIn( currencyAmountIn?: CurrencyAmount, currencyOut?: Currency, -): { isLoading: boolean; data: Trade | null } { - const { data: allowedPairs, isLoading } = useAllCommonPairs(currencyAmountIn?.currency, currencyOut) +): { isLoading: boolean; data: Trade | null; refresh: () => void } { + const { data: allowedPairs, isLoading, refresh } = useAllCommonPairs(currencyAmountIn?.currency, currencyOut) const [singleHopOnly] = useUserSingleHopOnly() return useMemo(() => { + const res = { + isLoading, + refresh, + data: null, + } if (isLoading) { - return { - isLoading, - data: null, - } + return res } if (currencyAmountIn && currencyOut && allowedPairs.length > 0) { if (singleHopOnly) { return { + ...res, isLoading: false, data: bestTradeExactIn(allowedPairs, currencyAmountIn, currencyOut, { maxHops: 1, maxNumResults: 1 })[0] ?? null, @@ -42,12 +45,13 @@ export function useTradeExactIn( bestTradeSoFar = currentTrade } } - return { isLoading: false, data: bestTradeSoFar } + return { ...res, isLoading: false, data: bestTradeSoFar } } return { + ...res, isLoading: false, data: null, } - }, [allowedPairs, currencyAmountIn, currencyOut, singleHopOnly, isLoading]) + }, [refresh, allowedPairs, currencyAmountIn, currencyOut, singleHopOnly, isLoading]) } diff --git a/apps/ton/src/hooks/swap/useTradeExactOut.ts b/apps/ton/src/hooks/swap/useTradeExactOut.ts index 721f2471b9f31..0dc00223a99d7 100644 --- a/apps/ton/src/hooks/swap/useTradeExactOut.ts +++ b/apps/ton/src/hooks/swap/useTradeExactOut.ts @@ -12,21 +12,24 @@ import { useAllCommonPairs } from './useAllCommonPairs' export function useTradeExactOut( currencyAmountOut?: CurrencyAmount, currencyIn?: Currency, -): { isLoading: boolean; data: Trade | null } { - const { data: allowedPairs, isLoading } = useAllCommonPairs(currencyIn, currencyAmountOut?.currency) +): { isLoading: boolean; data: Trade | null; refresh: () => void } { + const { data: allowedPairs, isLoading, refresh } = useAllCommonPairs(currencyIn, currencyAmountOut?.currency) const [singleHopOnly] = useUserSingleHopOnly() return useMemo(() => { + const res = { + isLoading, + refresh, + data: null, + } if (isLoading) { - return { - isLoading, - data: null, - } + return res } if (currencyIn && currencyAmountOut && allowedPairs.length > 0) { if (singleHopOnly) { return { + ...res, isLoading: false, data: bestTradeExactOut(allowedPairs, currencyIn, currencyAmountOut, { maxHops: 1, maxNumResults: 1 })[0] ?? null, @@ -42,13 +45,15 @@ export function useTradeExactOut( } } return { + ...res, isLoading: false, data: bestTradeSoFar, } } return { + ...res, isLoading: false, data: null, } - }, [currencyIn, currencyAmountOut, allowedPairs, singleHopOnly, isLoading]) + }, [currencyIn, currencyAmountOut, allowedPairs, singleHopOnly, isLoading, refresh]) } diff --git a/apps/ton/src/ton/atom/liquidity/poolDataQueriesAtom.ts b/apps/ton/src/ton/atom/liquidity/poolDataQueriesAtom.ts index f72ec78da4341..4f160b3b74d74 100644 --- a/apps/ton/src/ton/atom/liquidity/poolDataQueriesAtom.ts +++ b/apps/ton/src/ton/atom/liquidity/poolDataQueriesAtom.ts @@ -1,3 +1,5 @@ +import { useQueryClient } from '@tanstack/react-query' +import { useAtomValue } from 'jotai' import { QUERY_DEFAULT_STALE_TIME } from 'config/constants/exchange' import { atomWithQuery } from 'jotai-tanstack-query' import { atomFamily } from 'jotai/utils' @@ -11,8 +13,12 @@ interface PoolDataAtomParams { token1Address?: string } +const getKeyByPairs = (pairs: PoolDataAtomParams[]) => { + return pairs.map(({ token0Address, token1Address }) => `${token0Address}-${token1Address}`) +} + export const poolDataQueriesAtom = atomFamily((pairs: PoolDataAtomParams[]) => { - const key = pairs.map(({ token0Address, token1Address }) => `${token0Address}-${token1Address}`) + const key = getKeyByPairs(pairs) return atomWithQuery((get) => ({ queryKey: ['poolData', get(networkAtom), ...key], queryFn: async () => { @@ -38,3 +44,18 @@ export const poolDataQueriesAtom = atomFamily((pairs: PoolDataAtomParams[]) => { retry: 10, })) }, isEqual) + +export function useRefreshPoolData(pairs: PoolDataAtomParams[]) { + const queryClient = useQueryClient() + const network = useAtomValue(networkAtom) + const key = getKeyByPairs(pairs) + + const refresh = () => { + // Invalidate all queries + queryClient.invalidateQueries({ + queryKey: ['poolData', network, ...key], + }) + } + + return { refresh } +} diff --git a/apps/ton/src/views/TONSwap/SwapForm.tsx b/apps/ton/src/views/TONSwap/SwapForm.tsx index bea8cb715a9f9..3cbcde1030a59 100644 --- a/apps/ton/src/views/TONSwap/SwapForm.tsx +++ b/apps/ton/src/views/TONSwap/SwapForm.tsx @@ -1,35 +1,33 @@ -import { useTranslation } from '@pancakeswap/localization' -import { Rounding } from '@pancakeswap/swap-sdk-core' import { Native, TonNetworks } from '@pancakeswap/ton-v2-sdk' -import { Column, Text } from '@pancakeswap/uikit' -import { formatFraction } from '@pancakeswap/utils/formatFractions' +import { useCallback, useEffect, useMemo } from 'react' +import noop from 'lodash/noop' +import { Column, FlexGap, Text } from '@pancakeswap/uikit' +import { ButtonAndDetailsPanel } from 'components/TonSwap/ButtonAndDetailsPanel' +import CurrencyInputPanelSimplify from 'components/TonSwap/CurrencyInputPanelSimplify' +import { FlipButton } from 'components/TonSwap/FlipButton' import { useUserSlippage } from '@pancakeswap/utils/user' -import { toNano } from '@ton/core' +import { useTranslation } from '@pancakeswap/localization' +import { fetchListAtom } from 'atoms/lists/fetchListAtom' import { setApprovalModalAtom } from 'atoms/modals/approvalModalAtom' import { setTransactionModalAtom } from 'atoms/modals/transactionModalAtom' import { independentFieldAtom, inputCurrencyAtom, outputCurrencyAtom, typedValueAtom } from 'atoms/swap/swapStateAtom' import { TransactionActionType } from 'components/Modals/ActionModal' -import { ButtonAndDetailsPanel } from 'components/TonSwap/ButtonAndDetailsPanel' -import CurrencyInputPanelSimplify from 'components/TonSwap/CurrencyInputPanelSimplify' -import { FlipButton } from 'components/TonSwap/FlipButton' import { SwapCommitButton } from 'components/TonSwap/SwapCommitButton' import { SwapUIV2 } from 'components/widgets/swap-v2' -import { PRESET_TOKENS } from 'config/constants/tokens' import { useSwapActionHandlers } from 'hooks/swap/useSwapActionHandlers' -import { useTradeExactIn } from 'hooks/swap/useTradeExactIn' -import { useTradeExactOut } from 'hooks/swap/useTradeExactOut' import { useAtomValue, useSetAtom } from 'jotai' -import noop from 'lodash/noop' -import { useCallback, useEffect, useMemo } from 'react' -import { chainIdAtom } from 'ton/atom/chainIdAtom' import { balanceAtom } from 'ton/logic/balanceAtom' -import { useSwap } from 'ton/logic/swap/useSwap' import { Field } from 'types' +import { Rounding, _10000 } from '@pancakeswap/swap-sdk-core' +import { formatFraction } from '@pancakeswap/utils/formatFractions' import { tryParseAmount } from 'utils/tryParseAmount' +import { useSwap } from 'ton/logic/swap/useSwap' +import { RefreshButton } from '@pancakeswap/widgets-internal' +import { useBestTrade } from 'hooks/swap/useBestTrade' +import { PricingAndSlippage } from 'components/TonSwap/PricingAndSlippage' export const SwapForm = () => { const { t } = useTranslation() - const chainId = useAtomValue(chainIdAtom) const inputCurrency = useAtomValue(inputCurrencyAtom) const outputCurrency = useAtomValue(outputCurrencyAtom) @@ -38,18 +36,23 @@ export const SwapForm = () => { const isExactIn: boolean = independentField === Field.INPUT const parsedAmount = tryParseAmount(typedValue, (isExactIn ? inputCurrency : outputCurrency) ?? undefined) - const { isLoading: isTradeExactInLoading, data: bestTradeExactIn } = useTradeExactIn( - isExactIn ? parsedAmount : undefined, - outputCurrency ?? undefined, - ) - const { isLoading: isTradeExactOutLoading, data: bestTradeExactOut } = useTradeExactOut( - isExactIn ? undefined : parsedAmount, - inputCurrency ?? undefined, + + const { isTradeExactInLoading, isTradeExactOutLoading, trade, refreshTrade } = useBestTrade({ + isExactIn, + amount: parsedAmount, + inputCurrency, + outputCurrency, + }) + + const isTradeLoading = useMemo( + () => isTradeExactOutLoading || isTradeExactInLoading, + [isTradeExactOutLoading, isTradeExactInLoading], ) - const trade = isExactIn ? bestTradeExactIn : bestTradeExactOut const { onUserInput, onCurrencySelection } = useSwapActionHandlers() + const { data: activeList, isFetched } = useAtomValue(fetchListAtom) + const setApprovalModal = useSetAtom(setApprovalModalAtom) const setTransactionModal = useSetAtom(setTransactionModalAtom) const [userAllowedSlippage] = useUserSlippage() @@ -79,9 +82,9 @@ export const SwapForm = () => { const { data: balance0 } = useAtomValue(balanceAtom(inputCurrency)) const isInsufficientBalance0 = useMemo( - () => balance0 < toNano(parsedAmounts[Field.INPUT]?.toFixed() ?? '0'), + () => (parsedAmounts[Field.INPUT] ? parsedAmounts[Field.INPUT].greaterThan(balance0) : false), [balance0, parsedAmounts], - ) // TODO: decimals + ) const { swap } = useSwap() const handleSwap = useCallback(async () => { @@ -89,8 +92,7 @@ export const SwapForm = () => { return } await swap({ - // todo:@eric - minOut: '0.01', + minOut: formattedAmounts[Field.OUTPUT] ?? '0.01', amount0: formattedAmounts[Field.INPUT] ?? '0', token0: inputCurrency, token1: outputCurrency, @@ -105,11 +107,14 @@ export const SwapForm = () => { // Set default currencies on load useEffect(() => { - if (!inputCurrency && !outputCurrency) { + if (isFetched && !inputCurrency && !outputCurrency && activeList && activeList.length > 1) { onCurrencySelection(Field.INPUT, Native.onNetwork(TonNetworks.Testnet)) - onCurrencySelection(Field.OUTPUT, PRESET_TOKENS.CAKE[chainId]) + onCurrencySelection( + Field.OUTPUT, + activeList.find((item) => item.symbol === 'CAKE'), + ) } - }, [inputCurrency, outputCurrency, chainId, onCurrencySelection]) + }, [activeList, inputCurrency, outputCurrency, isFetched, onCurrencySelection]) return ( @@ -144,6 +149,7 @@ export const SwapForm = () => { { - } /> + } + pricingAndSlippage={ + + { + e.stopPropagation() + }} + alignItems="center" + flexWrap="wrap" + > + + + + + } + /> ) } diff --git a/apps/web/src/views/SwapSimplify/V4Swap/RefreshButton.tsx b/apps/web/src/views/SwapSimplify/V4Swap/RefreshButton.tsx deleted file mode 100644 index f5f23c6f8fbdd..0000000000000 --- a/apps/web/src/views/SwapSimplify/V4Swap/RefreshButton.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { ChainId } from '@pancakeswap/sdk' -import { IconButton, SwapLoading } from '@pancakeswap/uikit' - -import RefreshIcon from 'components/Svg/RefreshIcon' -import { CHAIN_REFRESH_TIME } from 'config/constants/exchange' - -export const RefreshButton: React.FC<{ - refreshDisabled: boolean - onRefresh: () => void - chainId?: ChainId - loading?: boolean -}> = ({ refreshDisabled, onRefresh, chainId, loading }) => { - return ( - - {loading ? ( - - ) : ( - - )} - - ) -} diff --git a/apps/web/src/views/SwapSimplify/V4Swap/index.tsx b/apps/web/src/views/SwapSimplify/V4Swap/index.tsx index a263903f0bd94..b44fe205b3c38 100644 --- a/apps/web/src/views/SwapSimplify/V4Swap/index.tsx +++ b/apps/web/src/views/SwapSimplify/V4Swap/index.tsx @@ -2,7 +2,7 @@ import { OrderType } from '@pancakeswap/price-api-sdk' import { SmartRouter } from '@pancakeswap/smart-router/evm' import { FlexGap } from '@pancakeswap/uikit' import { useUserSlippage } from '@pancakeswap/utils/user' -import { SwapUIV2 } from '@pancakeswap/widgets-internal' +import { RefreshButton, SwapUIV2 } from '@pancakeswap/widgets-internal' import { useTokenRisk } from 'components/AccessRisk' import { RiskDetailsPanel, useShouldRiskPanelDisplay } from 'components/AccessRisk/SwapRevampRiskDisplay' import { useCurrency } from 'hooks/Tokens' @@ -12,6 +12,7 @@ import { useMemo } from 'react' import { Field } from 'state/swap/actions' import { useSwapState } from 'state/swap/hooks' import { logger } from 'utils/datadog' +import { CHAIN_REFRESH_TIME } from 'config/constants/exchange' import { SwapType } from '../../Swap/types' import { useIsWrapping } from '../../Swap/V3Swap/hooks' import { useAllTypeBestTrade } from '../../Swap/V3Swap/hooks/useAllTypeBestTrade' @@ -23,7 +24,6 @@ import { BuyCryptoPanel } from './BuyCryptoPanel' import { CommitButton } from './CommitButton' import { FormMain } from './FormMainV4' import { PricingAndSlippage } from './PricingAndSlippage' -import { RefreshButton } from './RefreshButton' import { SwapSelection } from './SwapSelectionTab' import { TradeDetails } from './TradeDetails' import { TradingFee } from './TradingFee' @@ -167,7 +167,7 @@ export function V4SwapForm() { void; + loading?: boolean; + refreshDuration?: number; +}> = ({ refreshDisabled, onRefresh, refreshDuration, loading }) => { + return ( + + {loading ? ( + + ) : ( + + )} + + ); +}; diff --git a/apps/web/src/components/Svg/RefreshIcon.tsx b/packages/widgets-internal/swap-v2/RefreshIcon.tsx similarity index 98% rename from apps/web/src/components/Svg/RefreshIcon.tsx rename to packages/widgets-internal/swap-v2/RefreshIcon.tsx index 972c69c7531b3..06ca33d775f2a 100644 --- a/apps/web/src/components/Svg/RefreshIcon.tsx +++ b/packages/widgets-internal/swap-v2/RefreshIcon.tsx @@ -1,8 +1,8 @@ -import { Svg, SvgProps } from '@pancakeswap/uikit' +import { Svg, SvgProps } from "@pancakeswap/uikit"; // NOTE: Temporary save icon here. Will move to uikit when the feature is done -const DisabledIcon = (props) => ( +const DisabledIcon = (props: SvgProps) => ( ( -) +); const Icon = ({ disabled, @@ -35,7 +35,7 @@ const Icon = ({ @@ -105,6 +105,6 @@ const Icon = ({ repeatCount="1" /> - ) + ); -export default Icon +export default Icon; diff --git a/packages/widgets-internal/swap-v2/index.ts b/packages/widgets-internal/swap-v2/index.ts index deaa5bf542395..3b448be73989d 100644 --- a/packages/widgets-internal/swap-v2/index.ts +++ b/packages/widgets-internal/swap-v2/index.ts @@ -1 +1,2 @@ export * as SwapUIV2 from "./SwapWidgetV2"; +export { RefreshButton } from "./RefreshButton"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 92df879817e74..1544fae8bf995 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -971,6 +971,9 @@ importers: '@pancakeswap/utils': specifier: workspace:* version: link:../../packages/utils + '@pancakeswap/widgets-internal': + specifier: workspace:* + version: link:../../packages/widgets-internal '@tanstack/query-core': specifier: ^5.62.16 version: 5.62.16