Skip to content

Commit a8813e3

Browse files
author
Andrew718PLTS
committed
Fix: Corrected if to send txs and show text properly based on skipApprove flag and corresponding hook methods
1 parent e94a940 commit a8813e3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/features/swap/SwapConfirm.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export function SwapConfirmCard({ formValues }: Props) {
147147
return
148148
}
149149

150-
if (sendApproveTx) {
150+
if (!skipApprove && sendApproveTx) {
151151
try {
152152
logger.info('Sending approve tx')
153153
const approveResult = await sendApproveTx()
@@ -251,7 +251,7 @@ export function SwapConfirmCard({ formValues }: Props) {
251251
close={() => setIsModalOpen(false)}
252252
width="max-w-[432px]"
253253
>
254-
<MentoLogoLoader needsApproval={needsApproval} />
254+
<MentoLogoLoader skipApprove={skipApprove} />
255255
</Modal>
256256
</FloatingBox>
257257
)
@@ -329,7 +329,7 @@ const ChevronRight = (props: SVGProps<SVGSVGElement>) => (
329329
</svg>
330330
)
331331

332-
const MentoLogoLoader = ({ needsApproval }: { needsApproval: boolean }) => {
332+
const MentoLogoLoader = ({ skipApprove }: { skipApprove: boolean }) => {
333333
const { connector } = useAccount()
334334

335335
return (
@@ -345,9 +345,7 @@ const MentoLogoLoader = ({ needsApproval }: { needsApproval: boolean }) => {
345345

346346
<div className="my-6">
347347
<div className="text-sm text-center text-[#636768] dark:text-[#AAB3B6]">
348-
{needsApproval
349-
? 'Sending two transactions: Approve and Swap'
350-
: 'Sending swap transaction'}
348+
{skipApprove ? 'Sending swap transaction' : 'Sending two transactions: Approve and Swap'}
351349
</div>
352350
<div className="mt-3 text-sm text-center text-[#636768] dark:text-[#AAB3B6]">
353351
{`Sign with ${connector?.name || 'wallet'} to proceed`}

0 commit comments

Comments
 (0)