mirror of
https://github.com/embarklabs/EmbarkJS.git
synced 2025-01-23 18:59:05 +00:00
Merge pull request #12 from embark-framework/bug_fix/ws-only
only poll with a WS provider
This commit is contained in:
commit
9e3b66822e
25
src/utils.js
25
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 (!hash) {
|
if (web3.currentProvider.constructor.name === 'WebsocketProvider') {
|
||||||
return; // Wait until we receive the hash
|
var interval = setInterval(function () {
|
||||||
}
|
if (!hash) {
|
||||||
web3.eth.getTransactionReceipt(hash, (err, receipt) => {
|
return;
|
||||||
if (!err && !receipt) {
|
|
||||||
return; // Transaction is not yet complete
|
|
||||||
}
|
}
|
||||||
callback(err, receipt);
|
|
||||||
});
|
web3.eth.getTransactionReceipt(hash, function (err, receipt) {
|
||||||
}, 100);
|
if (!err && !receipt) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(err, receipt);
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
toSend.estimateGas()
|
toSend.estimateGas()
|
||||||
.then(gasEstimated => {
|
.then(gasEstimated => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user