From ef82e3eff4959440f9336d8031066cb4cac33429 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Wed, 2 Oct 2024 17:33:04 +0100 Subject: [PATCH] fix: Max approval bug --- .../confirm/info/approve/hooks/use-approve-token-simulation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/pages/confirmations/components/confirm/info/approve/hooks/use-approve-token-simulation.ts b/ui/pages/confirmations/components/confirm/info/approve/hooks/use-approve-token-simulation.ts index e05823738b5c..19f26c9c9300 100644 --- a/ui/pages/confirmations/components/confirm/info/approve/hooks/use-approve-token-simulation.ts +++ b/ui/pages/confirmations/components/confirm/info/approve/hooks/use-approve-token-simulation.ts @@ -33,13 +33,14 @@ export const useApproveTokenSimulation = ( (param) => param.value !== undefined && !isHexString(param.value) && + param.value.length === undefined && !isBoolean(param.value), ); if (paramIndex === -1) { return 0; } - return new BigNumber(value.data[0].params[paramIndex].value) + return new BigNumber(value.data[0].params[paramIndex].value.toString()) .dividedBy(new BigNumber(10).pow(Number(decimals))) .toNumber(); }, [value, decimals]);