From 34fc7f4573cf962c36245eaddc27d2ba08f4e3b6 Mon Sep 17 00:00:00 2001 From: Alissa Crane Date: Wed, 12 Jun 2024 18:45:08 -0400 Subject: [PATCH] remove error handling --- src/swap/components/Swap.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/swap/components/Swap.tsx b/src/swap/components/Swap.tsx index 3a337f4526..85d2f9f35f 100644 --- a/src/swap/components/Swap.tsx +++ b/src/swap/components/Swap.tsx @@ -1,27 +1,22 @@ import { useCallback, useMemo, useState } from 'react'; import { cn } from '../../lib/utils'; import { SwapContext } from '../context'; -import type { SwapError, SwapReact } from '../types'; -import type { Token } from '../../token'; import { useGetSwapQuote } from '../hooks/useGetSwapQuote'; +import type { SwapReact } from '../types'; +import type { Token } from '../../token'; export function Swap({ account, children, onError }: SwapReact) { const [fromAmount, setFromAmount] = useState(''); const [fromToken, setFromToken] = useState(); const [toAmount, setToAmount] = useState(''); const [toToken, setToToken] = useState(); - const [swapQuoteError, setSwapQuoteError] = useState(''); - const [swapTransactionError, setSwapTransactionError] = useState(''); const [lastTokenAmountUpdated, setLastTokenAmountUpdated] = useState<'to' | 'from' | undefined>(); useGetSwapQuote({ amountReference: lastTokenAmountUpdated, fromAmount, fromToken, - onError: (response: SwapError) => { - onError?.(response); - setSwapQuoteError(response?.error); - }, + onError, onSuccess: () => setLastTokenAmountUpdated(undefined), setToAmount, setFromAmount, @@ -84,11 +79,6 @@ export function Swap({ account, children, onError }: SwapReact) { > Swap - {(swapQuoteError || swapTransactionError) && ( -

- {swapQuoteError || swapTransactionError} -

- )} {children}