From ffe3ef047fd9afad80c996ad1a05218589e0040f Mon Sep 17 00:00:00 2001 From: marino <102478601+kemuru@users.noreply.github.com> Date: Wed, 9 Aug 2023 10:56:31 +0200 Subject: [PATCH] fix(web): popup appear when transaction confirmed & other stakewithdraw improvements --- .../StakePanel/StakeWithdrawButton.tsx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx index 8d5c77a06..7b5c85187 100644 --- a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx +++ b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx @@ -34,7 +34,6 @@ interface IActionButton { const StakeWithdrawButton: React.FC = ({ parsedAmount, action, - setAmount, isSending, setIsSending, setIsPopupOpen, @@ -92,23 +91,18 @@ const StakeWithdrawButton: React.FC = ({ }; const { config: setStakeConfig } = usePrepareKlerosCoreSetStake({ - enabled: !isUndefined(targetStake) && !isUndefined(id), + enabled: !isUndefined(targetStake) && !isUndefined(id) && isStaking && !isAllowance, args: [BigInt(id ?? 0), targetStake], }); const { writeAsync: setStake } = useKlerosCoreSetStake(setStakeConfig); const handleStake = () => { if (typeof setStake !== "undefined") { setIsSending(true); - wrapWithToast( - async () => - await setStake().then((response) => { - setIsPopupOpen(true); - return response.hash; - }), - publicClient - ).finally(() => { - setIsSending(false); - }); + wrapWithToast(async () => await setStake().then((response) => response.hash), publicClient) + .then(() => setIsPopupOpen(true)) + .finally(() => { + setIsSending(false); + }); } }; @@ -136,7 +130,13 @@ const StakeWithdrawButton: React.FC = ({