From 23bb85d294644366f343b12c97986ead11cc0ddc Mon Sep 17 00:00:00 2001 From: Matias Poblete Date: Wed, 14 Aug 2024 08:28:58 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20copy=20hash=20&=20view=20o?= =?UTF-8?q?n=20explorer=20on=20SDEX=20swap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Swap/PendingModalContent/index.tsx | 8 ++++++-- src/hooks/useSwapCallback.tsx | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/Swap/PendingModalContent/index.tsx b/src/components/Swap/PendingModalContent/index.tsx index a3576a04..f96604c3 100644 --- a/src/components/Swap/PendingModalContent/index.tsx +++ b/src/components/Swap/PendingModalContent/index.tsx @@ -121,6 +121,10 @@ interface PendingModalContentProps { revocationPending?: boolean; } +interface SuccessfullSwapResponseWithSDEXHash extends SuccessfullSwapResponse { + hash: string; +} + interface ContentArgs { step: PendingConfirmModalState; approvalCurrency?: TokenType; @@ -130,7 +134,7 @@ interface ContentArgs { wrapPending: boolean; tokenApprovalPending: boolean; revocationPending: boolean; - swapResult?: SuccessfullSwapResponse; //SwapResult + swapResult?: SuccessfullSwapResponseWithSDEXHash; //SwapResult chainId?: number; order?: any; //UniswapXOrderDetails } @@ -188,7 +192,7 @@ function getContent(args: ContentArgs): PendingModalStep { let label: React.ReactNode | null | string = null; if (swapConfirmed && swapResult) { - label = ; + label = ; } else if (swapPending) { label = `Proceed in your wallet`; } diff --git a/src/hooks/useSwapCallback.tsx b/src/hooks/useSwapCallback.tsx index d963c502..d207860e 100644 --- a/src/hooks/useSwapCallback.tsx +++ b/src/hooks/useSwapCallback.tsx @@ -229,7 +229,8 @@ export function useSwapCallback( trade.outputAmount?.value ?? '0', )} ${trade?.outputAmount?.currency.code}`; sendNotification(notificationMessage, 'Swapped', SnackbarIconType.SWAP, SnackbarContext); - return result!; + if (!result) throw new Error('Cannot create path payment') + return result; } catch (error: any) { console.error(error); // If error comes from throw new Error("Try increasing slippage"); throw that error