From 64205789dfca411f5687640941c0b14effb0084d Mon Sep 17 00:00:00 2001 From: Alexander Khramov Date: Fri, 20 Sep 2024 13:35:28 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20wrap=20stETH=20=E2=80=93=20check=20allow?= =?UTF-8?q?ance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/demo-react/features/wrap-unwrap/wrap-unwrap.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/demo-react/features/wrap-unwrap/wrap-unwrap.tsx b/apps/demo-react/features/wrap-unwrap/wrap-unwrap.tsx index aae10d5d..e424a9bf 100644 --- a/apps/demo-react/features/wrap-unwrap/wrap-unwrap.tsx +++ b/apps/demo-react/features/wrap-unwrap/wrap-unwrap.tsx @@ -26,8 +26,10 @@ export const WrapUnwrap: FC = () => { const handleWrapSteth = useCallback( async (callData: WrapProps) => { - await wrap.getStethForWrapAllowance(account); // get existing allowance - await wrap.approveStethForWrap(callData); // if value is more than allowance perform approve + const allowance = await wrap.getStethForWrapAllowance(account); + if (BigInt(callData.value) > allowance) { + await wrap.approveStethForWrap(callData); + } return wrap.wrapSteth(callData); }, [account, wrap],