'use client'; import { useIsMounted } from '@/internal/hooks/useIsMounted'; import { cn, text } from '@/styles/theme'; import { FALLBACK_DEFAULT_MAX_SLIPPAGE } from '../constants'; import type { SwapProps } from '../types'; import { SwapAmountInput } from './SwapAmountInput'; import { SwapButton } from './SwapButton'; import { SwapMessage } from './SwapMessage'; import { SwapProvider } from './SwapProvider'; import { SwapSettings } from './SwapSettings'; import { SwapToast } from './SwapToast'; import { SwapToggleButton } from './SwapToggleButton'; function SwapDefaultContent({ to, from, disabled, }: Pick) { return ( <> ); } export function Swap({ children, config = { maxSlippage: FALLBACK_DEFAULT_MAX_SLIPPAGE, }, className, disabled, to, from, experimental = { useAggregator: false }, isSponsored = false, onError, onStatus, onSuccess, title = 'Swap', headerLeftContent, }: SwapProps) { const isMounted = useIsMounted(); // prevents SSR hydration issue if (!isMounted) { return null; } return ( {children ? (
{children}
) : (
{headerLeftContent}

{title}

)}
); }