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 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]);