By default getBalance method will query node every time it's called which generates too many api calls and it's prone to failure.
I would propose that wallet subscribes to balance updates and keeps cached balance. This would allow us to have balance healthcheck without generating api calls.
I think listener is something like:
provider.on(wallet.address, function(newBalance) {
console.log(newBalance);
});
We should verify that it uses websocket and not polling with infura
By default getBalance method will query node every time it's called which generates too many api calls and it's prone to failure.
I would propose that wallet subscribes to balance updates and keeps cached balance. This would allow us to have balance healthcheck without generating api calls.
I think listener is something like:
We should verify that it uses websocket and not polling with infura