|
|
@ -22,6 +22,7 @@ function BlockChainExplorer(opts) { |
|
|
|
switch (provider) { |
|
|
|
case 'insight': |
|
|
|
var explorer = new Explorers.Insight(url, network); |
|
|
|
explorer.getTransaction = _.bind(getTransactionInsight, explorer, url); |
|
|
|
explorer.getTransactions = _.bind(getTransactionsInsight, explorer, url); |
|
|
|
explorer.getAddressActivity = _.bind(getAddressActivityInsight, explorer, url); |
|
|
|
explorer.initSocket = _.bind(initSocketInsight, explorer, url); |
|
|
@ -31,6 +32,19 @@ function BlockChainExplorer(opts) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
function getTransactionInsight(url, txid, cb) { |
|
|
|
var url = url + '/api/tx/' + txid; |
|
|
|
var args = { |
|
|
|
method: "GET", |
|
|
|
url: url, |
|
|
|
}; |
|
|
|
|
|
|
|
request(args, function(err, res, tx) { |
|
|
|
if (err || res.statusCode != 200) return cb(err || res); |
|
|
|
return cb(null, tx); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function getTransactionsInsight(url, addresses, from, to, cb) { |
|
|
|
var qs = []; |
|
|
|
if (_.isNumber(from)) qs.push('from=' + from); |
|
|
|