'use client'; import { PressableIcon } from '@/internal/components/PressableIcon'; import { backArrowSvg } from '@/internal/svg/backArrowSvg'; import { cn, text } from '@/styles/theme'; import { Swap } from '@/swap/components/Swap'; import { SwapAmountInput } from '@/swap/components/SwapAmountInput'; import { SwapButton } from '@/swap/components/SwapButton'; import { SwapMessage } from '@/swap/components/SwapMessage'; import { SwapSettings } from '@/swap/components/SwapSettings'; import { SwapSettingsSlippageDescription } from '@/swap/components/SwapSettingsSlippageDescription'; import { SwapSettingsSlippageInput } from '@/swap/components/SwapSettingsSlippageInput'; import { SwapSettingsSlippageTitle } from '@/swap/components/SwapSettingsSlippageTitle'; import { SwapToast } from '@/swap/components/SwapToast'; import { SwapToggleButton } from '@/swap/components/SwapToggleButton'; import { useCallback } from 'react'; import { useWalletContext } from './WalletProvider'; import { SwapDefaultProps } from '@/swap/types'; export type WalletAdvancedSwapProps = { classNames?: { /** Optional className override for the swap container */ container?: string; /** Optional className override for the swap settings component */ settings?: { /** Optional className override for the swap settings container */ container?: string; /** Optional className override for the swap settings title */ slippageTitle?: string; /** Optional className override for the swap settings description */ slippageDescription?: string; /** Optional className override for the swap settings input */ slippageInput?: string; }; /** Optional className override for the swap to amount input */ toAmountInput?: string; /** Optional className override for the swap from amount input */ fromAmountInput?: string; /** Optional className override for the swap toggle button */ toggleButton?: string; /** Optional className override for the swap button */ swapButton?: string; /** Optional className override for the swap message */ message?: string; /** Optional className override for the swap toast */ toast?: string; }; } & Omit; export function WalletAdvancedSwap({ config, classNames, disabled, experimental, from, isSponsored = false, onError, onStatus, onSuccess, title, to, }: WalletAdvancedSwapProps) { const { setActiveFeature, isActiveFeatureClosing, setIsActiveFeatureClosing, } = useWalletContext(); const handleCloseSwap = useCallback(() => { setIsActiveFeatureClosing(true); }, [setIsActiveFeatureClosing]); const handleAnimationEnd = useCallback(() => { if (isActiveFeatureClosing) { setActiveFeature(null); setIsActiveFeatureClosing(false); } }, [isActiveFeatureClosing, setActiveFeature, setIsActiveFeatureClosing]); const backButton = (
{backArrowSvg}
); return (
{backButton}

{title}

Max. slippage Your swap will revert if the prices change by more than the selected percentage.
); }