diff --git a/features/refinance/components/steps/RefinanceProductTableStep.tsx b/features/refinance/components/steps/RefinanceProductTableStep.tsx index 0f4c1c86a5..c98429ed3e 100644 --- a/features/refinance/components/steps/RefinanceProductTableStep.tsx +++ b/features/refinance/components/steps/RefinanceProductTableStep.tsx @@ -92,11 +92,7 @@ export const RefinanceProductTableStep = () => { perPage={refinanceProductHubItemsPerPage} hiddenBanners initialFilters={{ - protocol: [ - lendingProtocol === LendingProtocol.SparkV3 - ? LendingProtocol.AaveV3 - : LendingProtocol.SparkV3, - ], + protocol: lendingProtocol === LendingProtocol.SparkV3 ? [LendingProtocol.AaveV3] : [], network: [network.name], }} hiddenColumns={refinanceProductHubHiddenColumns} diff --git a/features/refinance/helpers/getRefinanceSidebarButtonStatus.ts b/features/refinance/helpers/getRefinanceSidebarButtonStatus.ts index 45bcae2295..66b6eba05e 100644 --- a/features/refinance/helpers/getRefinanceSidebarButtonStatus.ts +++ b/features/refinance/helpers/getRefinanceSidebarButtonStatus.ts @@ -47,7 +47,7 @@ export function getRefinanceSidebarButtonsStatus({ (isSimulationLoading || isTxInProgress || isTxWaitingForApproval) const isPrimaryButtonHidden = - !!(walletAddress && !isOwner) || + (walletAddress && !isOwner) || safetySwitch || [RefinanceSidebarStep.Option, RefinanceSidebarStep.Strategy].includes(currentStep) diff --git a/features/refinance/hooks/useSdkTransaction.tsx b/features/refinance/hooks/useSdkTransaction.tsx index b1608dbaec..5d14a5c2de 100644 --- a/features/refinance/hooks/useSdkTransaction.tsx +++ b/features/refinance/hooks/useSdkTransaction.tsx @@ -18,16 +18,10 @@ export function useSdkRefinanceTransaction({ const [txRefinance, setTxRefinance] = useState(null) const { - environment: { - slippage, - chainInfo, - marketPrices: { ethPrice }, - address, - }, - position: { positionId, collateralTokenData, debtTokenData, positionType, lendingProtocol }, - poolData: { poolId }, + environment: { chainInfo, address }, + position: { lendingProtocol }, form: { - state: { strategy, dpm }, + state: { dpm }, }, steps: { currentStep }, } = useRefinanceContext() @@ -43,7 +37,11 @@ export function useSdkRefinanceTransaction({ }, [currentStep]) useEffect(() => { - if (!strategy || !dpm?.address || refinanceSimulation == null) { + if ( + !dpm?.address || + refinanceSimulation == null || + (lendingProtocol === LendingProtocol.Maker && importPositionSimulation == null) + ) { return } const fetchData = async () => { @@ -87,18 +85,9 @@ export function useSdkRefinanceTransaction({ }, [ sdk, dpm?.address, - slippage, - ethPrice, address, chainInfo, - poolId, - positionId, - JSON.stringify(collateralTokenData), - JSON.stringify(debtTokenData), - positionType, - strategy?.product, - strategy?.primaryToken, - strategy?.secondaryToken, + lendingProtocol, JSON.stringify(importPositionSimulation), JSON.stringify(refinanceSimulation), ]) diff --git a/features/refinance/views/RefinanceFormView.tsx b/features/refinance/views/RefinanceFormView.tsx index 842ff3dce1..2a97ea810d 100644 --- a/features/refinance/views/RefinanceFormView.tsx +++ b/features/refinance/views/RefinanceFormView.tsx @@ -176,17 +176,19 @@ export const RefinanceFormView: FC = ({ children }) => { txDetails, }) + const primaryButton = { + label: t(primaryButtonLabel), + disabled: isPrimaryButtonDisabled, + isLoading: isPrimaryButtonLoading, + hidden: isPrimaryButtonHidden, + withoutNextLink: true, + ...primaryButtonActions, + } + const sidebarSectionProps: SidebarSectionProps = { title: sidebarTitle, content: {children}, - primaryButton: { - label: t(primaryButtonLabel), - disabled: isPrimaryButtonDisabled, - isLoading: isPrimaryButtonLoading, - hidden: isPrimaryButtonHidden, - withoutNextLink: true, - ...primaryButtonActions, - }, + primaryButton, status, withMobilePanel: false, disableMaxHeight: currentStep === RefinanceSidebarStep.Strategy,