Poll for balance in create project page

This commit is contained in:
IshaVenikar 2025-02-11 12:24:40 +05:30
parent ffa23fc874
commit 588ba22ee6

View File

@ -41,6 +41,7 @@ type ConfigureFormValues = ConfigureDeploymentFormValues &
const DEFAULT_MAX_PRICE = '10000'; const DEFAULT_MAX_PRICE = '10000';
const TX_APPROVAL_TIMEOUT_MS = 60000; const TX_APPROVAL_TIMEOUT_MS = 60000;
const CHECK_BALANCE_INTERVAL = 5000;
const Configure = () => { const Configure = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
@ -424,6 +425,14 @@ const Configure = () => {
useEffect(() => { useEffect(() => {
if (isAccountsDataReceived) { if (isAccountsDataReceived) {
checkBalance(); checkBalance();
const interval = setInterval(() => {
checkBalance();
}, CHECK_BALANCE_INTERVAL);
return () => {
clearInterval(interval);
};
} }
}, [amountToBePaid, selectedAccount, selectedDeployer, isAccountsDataReceived]); }, [amountToBePaid, selectedAccount, selectedDeployer, isAccountsDataReceived]);