check for receipt address before calling back
This commit is contained in:
parent
f9f25f33c8
commit
50b0376954
|
@ -245,15 +245,18 @@ class Blockchain {
|
||||||
let hash;
|
let hash;
|
||||||
let calledBacked = false;
|
let calledBacked = false;
|
||||||
|
|
||||||
function callback() {
|
function callback(err, receipt) {
|
||||||
if (calledBacked) {
|
if (calledBacked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!err && !receipt.contractAddress) {
|
||||||
|
return; // Not deployed yet. Need to wait
|
||||||
|
}
|
||||||
if (interval) {
|
if (interval) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
}
|
}
|
||||||
calledBacked = true;
|
calledBacked = true;
|
||||||
cb(...arguments);
|
cb(err, receipt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|
Loading…
Reference in New Issue