-
Let's say I have the following pseudo code: let provider = new ethers.providers.WebSocketProvider('geth node websocket URL');
let testProvider = async () => {
let testContract= new Contract(contractAddress, contractAbi, provider);
let startTime = tomorrow;
while (true) {
if (new Date() > startTime) {
break;
}
}
let testFunction= await testContract.testFunction();
} It appears that waiting a day for my time condition to be true causing the provider connection on my testContract to be lost. Is there a way to automatically refresh the connection or do I have to add something like: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
After some pretty extensive testing the only solution seems to be something like this: let provider = new ethers.providers.WebSocketProvider('geth node websocket URL');
let testProvider = async () => {
let testContract= new Contract(contractAddress, contractAbi, provider);
let startTime = tomorrow;
while (true) {
if (new Date() > startTime) {
break;
}
}
provider = new ethers.providers.WebSocketProvider('geth node websocket URL');
testContract= new Contract(contractAddress, contractAbi, provider);
let testFunction= await testContract.testFunction();
} This doesn't seem like intended functionality and I'd like to create an issue for this. |
Beta Was this translation helpful? Give feedback.
After some pretty extensive testing the only solution seems to be something like this:
This doesn't seem like intended functionality and I'd like to create an issue for this.