only poll with a WS provider
This commit is contained in:
parent
e7531dead4
commit
181b533a8a
13
src/utils.js
13
src/utils.js
|
@ -33,17 +33,22 @@ let Utils = {
|
||||||
|
|
||||||
// This interval is there to compensate for the event that sometimes doesn't get triggered when using WebSocket
|
// This interval is there to compensate for the event that sometimes doesn't get triggered when using WebSocket
|
||||||
// FIXME The issue somehow only happens when the blockchain node is started in the same terminal
|
// FIXME The issue somehow only happens when the blockchain node is started in the same terminal
|
||||||
const interval = setInterval(() => {
|
// Only poll with a Websocket provider
|
||||||
|
if (web3.currentProvider.constructor.name === 'WebsocketProvider') {
|
||||||
|
var interval = setInterval(function () {
|
||||||
if (!hash) {
|
if (!hash) {
|
||||||
return; // Wait until we receive the hash
|
return;
|
||||||
}
|
}
|
||||||
web3.eth.getTransactionReceipt(hash, (err, receipt) => {
|
|
||||||
|
web3.eth.getTransactionReceipt(hash, function (err, receipt) {
|
||||||
if (!err && !receipt) {
|
if (!err && !receipt) {
|
||||||
return; // Transaction is not yet complete
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(err, receipt);
|
callback(err, receipt);
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
toSend.estimateGas()
|
toSend.estimateGas()
|
||||||
.then(gasEstimated => {
|
.then(gasEstimated => {
|
||||||
|
|
Loading…
Reference in New Issue