From b3903eecdcafe5228db170fa428531ea38a638ed Mon Sep 17 00:00:00 2001 From: Paul Cramer Date: Tue, 10 Sep 2024 09:34:50 -0700 Subject: [PATCH] asf --- src/swap/components/SwapProvider.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/swap/components/SwapProvider.tsx b/src/swap/components/SwapProvider.tsx index 8634e64cf2..954f52fc62 100644 --- a/src/swap/components/SwapProvider.tsx +++ b/src/swap/components/SwapProvider.tsx @@ -145,6 +145,10 @@ export function SwapProvider({ dToken?: Token, // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: TODO Refactor this component ) => { + const maxSlippage = + lifeCycleStatus.statusName !== 'error' + ? lifeCycleStatus.statusData.maxSlippage + : DEFAULT_MAX_SLIPPAGE; const source = type === 'from' ? from : to; const destination = type === 'from' ? to : from; @@ -195,7 +199,7 @@ export function SwapProvider({ amount, amountReference: 'from', from: source.token, - lifeCycleStatus, + maxSlippage: String(maxSlippage), to: destination.token, useAggregator, }); @@ -251,6 +255,12 @@ export function SwapProvider({ if (!address || !from.token || !to.token || !from.amount) { return; } + + const maxSlippage = + lifeCycleStatus.statusName !== 'error' + ? lifeCycleStatus.statusData.maxSlippage + : DEFAULT_MAX_SLIPPAGE; + setLifeCycleStatus({ statusName: 'init', statusData: { @@ -264,7 +274,7 @@ export function SwapProvider({ amount: from.amount, fromAddress: address, from: from.token, - lifeCycleStatus, + maxSlippage: String(maxSlippage), to: to.token, useAggregator, });