From 25f769b65fce94a189a1a009dce27f8b272a481b Mon Sep 17 00:00:00 2001 From: Atmosfearful <88635679+Atmosfearful@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:03:23 -0700 Subject: [PATCH] Fix approvals (#2392) --- app/actions/pklima.ts | 1 + app/components/views/PKlima/index.tsx | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/actions/pklima.ts b/app/actions/pklima.ts index e5a2544e5d..6871490aa5 100644 --- a/app/actions/pklima.ts +++ b/app/actions/pklima.ts @@ -76,6 +76,7 @@ export const exerciseTransaction = async (params: { throw error; } params.onStatus("error"); + console.error(error); throw error; } }; diff --git a/app/components/views/PKlima/index.tsx b/app/components/views/PKlima/index.tsx index c4be6d4bb2..9742bd15bb 100644 --- a/app/components/views/PKlima/index.tsx +++ b/app/components/views/PKlima/index.tsx @@ -137,9 +137,18 @@ export const PKlima: FC = (props) => { }; const hasApproval = (token: "pklima" | "bct") => { + const value = Number(quantity || "0"); if (token === "pklima") - return !!exerciseAllowances && !!Number(exerciseAllowances.pklima); - return !!exerciseAllowances && !!Number(exerciseAllowances.bct); + return ( + !!exerciseAllowances && + !!Number(exerciseAllowances.pklima) && + Number(exerciseAllowances.pklima) > value + ); + return ( + !!exerciseAllowances && + !!Number(exerciseAllowances.bct) && + Number(exerciseAllowances.bct) > value + ); }; const getButtonProps = () => {