Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

Commit bfcee05

Browse files
authored
Merge pull request #9 from mvayngrib/fixTxByHash
fix error handling edge case
2 parents a8771d7 + e21cf8b commit bfcee05

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/init.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ module.exports = function (apiKey, chain) {
5151
return reject(data.message);
5252
}
5353

54+
if (data.error) {
55+
return reject(data.error.message);
56+
}
57+
5458
resolve(data);
5559
});
5660
});
@@ -198,11 +202,11 @@ module.exports = function (apiKey, chain) {
198202
* var res = api.proxy.eth_getTransactionByHash('0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1');
199203
* @returns {Promise.<object>}
200204
*/
201-
eth_getTransactionByHash(hash) {
205+
eth_getTransactionByHash(txhash) {
202206
const module = 'proxy';
203207
const action = 'eth_getTransactionByHash';
204208
var query = querystring.stringify({
205-
module, action, apiKey, hash
209+
module, action, apiKey, txhash
206210
});
207211
return getRequest(query);
208212
},
@@ -494,7 +498,7 @@ module.exports = function (apiKey, chain) {
494498
* var supply = api.account.tokenbalance(
495499
* '0x4366ddc115d8cf213c564da36e64c8ebaa30cdbd',
496500
* 'DGD',
497-
* ''
501+
* ''
498502
* );
499503
* @returns {Promise.<object>}
500504
*/
@@ -519,7 +523,7 @@ module.exports = function (apiKey, chain) {
519523
if (address) {
520524
queryObject.address = address;
521525
}
522-
526+
523527
var query = querystring.stringify(queryObject);
524528
return getRequest(query);
525529
},

0 commit comments

Comments
 (0)