Comparing version 0.3.4 to 0.3.5
@@ -1,3 +0,7 @@ | ||
# 0.3.4 -- getTransactionSuccess | ||
# 0.3.5 -- Fix getTransactionSuccess unhandled promise rejection | ||
1. Fix getTx unhandled promise rejection | ||
# 0.3.4 -- EthJS-RPC | ||
1. Fix RPC unhandled promise rejection. | ||
@@ -4,0 +8,0 @@ |
@@ -9,6 +9,4 @@ "use strict"; | ||
var interval = eth.options.interval || 7000; | ||
var noop = function noop() {}; | ||
var cb = callback || noop; | ||
return new Promise(function (resolve, reject) { | ||
var prom = new Promise(function (resolve, reject) { | ||
var txInterval = setInterval(function () { | ||
@@ -18,3 +16,2 @@ eth.getTransactionReceipt(txHash, function (err, result) { | ||
clearInterval(txInterval); | ||
cb(err, null); | ||
reject(err); | ||
@@ -25,3 +22,2 @@ } | ||
clearInterval(txInterval); | ||
cb(null, result); | ||
resolve(result); | ||
@@ -34,3 +30,2 @@ } | ||
var errMessage = "Receipt timeout waiting for tx hash: " + txHash; | ||
cb(errMessage, null); | ||
reject(errMessage); | ||
@@ -42,3 +37,13 @@ } | ||
}); | ||
if (callback) { | ||
prom.then(function (res) { | ||
return callback(null, res); | ||
})["catch"](function (err) { | ||
return callback(err, null); | ||
}); | ||
} | ||
return callback ? null : prom; | ||
}; | ||
}; |
@@ -225,3 +225,3 @@ { | ||
}, | ||
"version": "0.3.4" | ||
"version": "0.3.5" | ||
} |
@@ -6,6 +6,4 @@ module.exports = eth => (txHash, callback) => { | ||
const interval = eth.options.interval || 7000; | ||
const noop = () => {}; | ||
const cb = callback || noop; | ||
return new Promise((resolve, reject) => { | ||
const prom = new Promise((resolve, reject) => { | ||
const txInterval = setInterval(() => { | ||
@@ -15,3 +13,2 @@ eth.getTransactionReceipt(txHash, (err, result) => { | ||
clearInterval(txInterval); | ||
cb(err, null); | ||
reject(err); | ||
@@ -22,3 +19,2 @@ } | ||
clearInterval(txInterval); | ||
cb(null, result); | ||
resolve(result); | ||
@@ -31,3 +27,2 @@ } | ||
const errMessage = `Receipt timeout waiting for tx hash: ${txHash}`; | ||
cb(errMessage, null); | ||
reject(errMessage); | ||
@@ -39,2 +34,8 @@ } | ||
}); | ||
if (callback) { | ||
prom.then(res => callback(null, res)).catch(err => callback(err, null)); | ||
} | ||
return callback ? null : prom; | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
696576
8990