I want to be able to call a function of a contract every 60-120 seconds, in my JavaScript code I have a set timer that runs for down a timer from 120 seconds down to 0 by subtracting 0.01 every 10 milliseconds, when the timer hits 0 it should be able to call a function from my solidity code then set timer variable to 120 again. Is this possible ? Tried using async await but it seems like it is ignoring that and calling the contract multiple times.
1 Answer
If you want to schedule a contract call to be performed every 60 seconds in javascript use the following:
setInterval(callContract, 60000);
function callContract() {
// Contract call logic here
}