From 588ba22ee654a5ffef00fd34c52d3d0ee07811cb Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Tue, 11 Feb 2025 12:24:40 +0530 Subject: [PATCH] Poll for balance in create project page --- .../src/components/projects/create/Configure.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/frontend/src/components/projects/create/Configure.tsx b/packages/frontend/src/components/projects/create/Configure.tsx index edd3edc4..35ca1f44 100644 --- a/packages/frontend/src/components/projects/create/Configure.tsx +++ b/packages/frontend/src/components/projects/create/Configure.tsx @@ -41,6 +41,7 @@ type ConfigureFormValues = ConfigureDeploymentFormValues & const DEFAULT_MAX_PRICE = '10000'; const TX_APPROVAL_TIMEOUT_MS = 60000; +const CHECK_BALANCE_INTERVAL = 5000; const Configure = () => { const [isLoading, setIsLoading] = useState(false); @@ -424,6 +425,14 @@ const Configure = () => { useEffect(() => { if (isAccountsDataReceived) { checkBalance(); + + const interval = setInterval(() => { + checkBalance(); + }, CHECK_BALANCE_INTERVAL); + + return () => { + clearInterval(interval); + }; } }, [amountToBePaid, selectedAccount, selectedDeployer, isAccountsDataReceived]);