Skip to content

Commit

Permalink
fix: re-add error so SwapMessage renders (#1153)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xAlec authored Aug 23, 2024
1 parent e3e88d7 commit b97b0be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/swap/components/SwapProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { useFromTo } from '../hooks/useFromTo';
import type {
LifeCycleStatus,
SwapContextType,
SwapError,
SwapProviderReact,
} from '../types';
import { isSwapError } from '../utils/isSwapError';
Expand Down Expand Up @@ -48,6 +49,7 @@ export function SwapProvider({
// Core Hooks
const config = useConfig();
const [loading, setLoading] = useState(false);
const [error, setError] = useState<SwapError>();
const [isTransactionPending, setPendingTransaction] = useState(false);
const [lifeCycleStatus, setLifeCycleStatus] = useState<LifeCycleStatus>({
statusName: 'init',
Expand All @@ -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') {
Expand Down Expand Up @@ -233,6 +236,7 @@ export function SwapProvider({
]);

const value = useValue({
error,
from,
loading,
handleAmountChange,
Expand Down

0 comments on commit b97b0be

Please sign in to comment.