|
|
@ -5,7 +5,7 @@ var $ = require('preconditions').singleton(); |
|
|
|
var log = require('npmlog'); |
|
|
|
log.debug = log.verbose; |
|
|
|
var io = require('socket.io-client'); |
|
|
|
var prequest = require('./request-pull'); |
|
|
|
var requestList = require('./request-list'); |
|
|
|
|
|
|
|
function Insight(opts) { |
|
|
|
$.checkArgument(opts); |
|
|
@ -44,7 +44,7 @@ Insight.prototype.getUnspentUtxos = function(addresses, cb) { |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
prequest(args, function(err, res, unspent) { |
|
|
|
requestList(args, function(err, res, unspent) { |
|
|
|
if (err || res.statusCode !== 200) return cb(_parseErr(err, res)); |
|
|
|
return cb(null, unspent); |
|
|
|
}); |
|
|
@ -63,7 +63,7 @@ Insight.prototype.broadcast = function(rawTx, cb) { |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
prequest(args, function(err, res, body) { |
|
|
|
requestList(args, function(err, res, body) { |
|
|
|
if (err || res.statusCode !== 200) return cb(_parseErr(err, res)); |
|
|
|
return cb(null, body ? body.txid : null); |
|
|
|
}); |
|
|
@ -77,7 +77,7 @@ Insight.prototype.getTransaction = function(txid, cb) { |
|
|
|
json: true, |
|
|
|
}; |
|
|
|
|
|
|
|
prequest(args, function(err, res, tx) { |
|
|
|
requestList(args, function(err, res, tx) { |
|
|
|
if (res && res.statusCode == 404) return cb(); |
|
|
|
if (err || res.statusCode !== 200) |
|
|
|
return cb(_parseErr(err, res)); |
|
|
@ -100,7 +100,7 @@ Insight.prototype.getTransactions = function(addresses, from, to, cb) { |
|
|
|
}, |
|
|
|
}; |
|
|
|
|
|
|
|
prequest(args, function(err, res, txs) { |
|
|
|
requestList(args, function(err, res, txs) { |
|
|
|
if (err || res.statusCode !== 200) return cb(_parseErr(err, res)); |
|
|
|
|
|
|
|
if (_.isObject(txs) && txs.items) |
|
|
@ -123,7 +123,7 @@ Insight.prototype.getAddressActivity = function(address, cb) { |
|
|
|
json: true, |
|
|
|
}; |
|
|
|
|
|
|
|
prequest(args, function(err, res, result) { |
|
|
|
requestList(args, function(err, res, result) { |
|
|
|
if (res && res.statusCode == 404) return cb(); |
|
|
|
if (err || res.statusCode !== 200) |
|
|
|
return cb(_parseErr(err, res)); |
|
|
@ -145,7 +145,7 @@ Insight.prototype.estimateFee = function(nbBlocks, cb) { |
|
|
|
path: path, |
|
|
|
json: true, |
|
|
|
}; |
|
|
|
prequest(args, function(err, res, body) { |
|
|
|
requestList(args, function(err, res, body) { |
|
|
|
if (err || res.statusCode !== 200) return cb(_parseErr(err, res)); |
|
|
|
return cb(null, body); |
|
|
|
}); |
|
|
|