From b97b0be0cc55b5135f3f74a3eb51b15317af6841 Mon Sep 17 00:00:00 2001 From: alec <93971719+0xAlec@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:50:13 -0400 Subject: [PATCH] fix: re-add `error` so `SwapMessage` renders (#1153) --- src/swap/components/SwapProvider.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/swap/components/SwapProvider.tsx b/src/swap/components/SwapProvider.tsx index 43a9abaa33..b37ec88a44 100644 --- a/src/swap/components/SwapProvider.tsx +++ b/src/swap/components/SwapProvider.tsx @@ -17,6 +17,7 @@ import { useFromTo } from '../hooks/useFromTo'; import type { LifeCycleStatus, SwapContextType, + SwapError, SwapProviderReact, } from '../types'; import { isSwapError } from '../utils/isSwapError'; @@ -48,6 +49,7 @@ export function SwapProvider({ // Core Hooks const config = useConfig(); const [loading, setLoading] = useState(false); + const [error, setError] = useState(); const [isTransactionPending, setPendingTransaction] = useState(false); const [lifeCycleStatus, setLifeCycleStatus] = useState({ statusName: 'init', @@ -62,6 +64,7 @@ export function SwapProvider({ if (lifeCycleStatus.statusName === 'error') { setLoading(false); setPendingTransaction(false); + setError(lifeCycleStatus.statusData); onError?.(lifeCycleStatus.statusData); } if (lifeCycleStatus.statusName === 'transactionPending') { @@ -233,6 +236,7 @@ export function SwapProvider({ ]); const value = useValue({ + error, from, loading, handleAmountChange,