rename method
Conflicts: lib/blockchainexplorers/insight.js
This commit is contained in:
parent
f89c249e12
commit
3406f57bbc
|
@ -34,7 +34,8 @@ Insight.prototype.getConnectionInfo = function() {
|
|||
/**
|
||||
* Retrieve a list of unspent outputs associated with an address or set of addresses
|
||||
*/
|
||||
Insight.prototype.getUnspentUtxos = function(addresses, cb) {
|
||||
Insight.prototype.getUtxos = function(addresses, cb) {
|
||||
var url = this.url + this.apiPrefix + '/addrs/utxo';
|
||||
var args = {
|
||||
method: 'POST',
|
||||
hosts: this.hosts,
|
||||
|
@ -73,7 +74,7 @@ Insight.prototype.getTransaction = function(txid, cb) {
|
|||
var args = {
|
||||
method: 'GET',
|
||||
hosts: this.hosts,
|
||||
path: this.apiPrefix + '/tx/' + txid,
|
||||
path: this.apiPrefix + '/tx/' + txid,
|
||||
json: true,
|
||||
};
|
||||
|
||||
|
|
|
@ -876,7 +876,7 @@ WalletService.prototype._getUtxos = function(addresses, cb) {
|
|||
var networkName = Bitcore.Address(addresses[0]).toObject().network;
|
||||
|
||||
var bc = self._getBlockchainExplorer(networkName);
|
||||
bc.getUnspentUtxos(addresses, function(err, utxos) {
|
||||
bc.getUtxos(addresses, function(err, utxos) {
|
||||
if (err) return cb(err);
|
||||
|
||||
var utxos = _.map(utxos, function(utxo) {
|
||||
|
|
|
@ -15,10 +15,9 @@ describe('Blockchain explorer', function() {
|
|||
});
|
||||
should.exist(exp);
|
||||
exp.should.respondTo('broadcast');
|
||||
exp.should.respondTo('getUnspentUtxos');
|
||||
exp.should.respondTo('getUtxos');
|
||||
exp.should.respondTo('getTransactions');
|
||||
exp.should.respondTo('getAddressActivity');
|
||||
exp.should.respondTo('getUnspentUtxos');
|
||||
exp.should.respondTo('estimateFee');
|
||||
exp.should.respondTo('initSocket');
|
||||
var exp = new BlockchainExplorer({
|
||||
|
|
|
@ -271,7 +271,7 @@ helpers.stubUtxos = function(server, wallet, amounts, opts, cb) {
|
|||
helpers._utxos = utxos;
|
||||
}
|
||||
|
||||
blockchainExplorer.getUnspentUtxos = function(addresses, cb) {
|
||||
blockchainExplorer.getUtxos = function(addresses, cb) {
|
||||
var selected = _.filter(helpers._utxos, function(utxo) {
|
||||
return _.contains(addresses, utxo.address);
|
||||
});
|
||||
|
|
|
@ -1452,7 +1452,7 @@ describe('Wallet service', function() {
|
|||
});
|
||||
});
|
||||
it('should get balance when there are no funds', function(done) {
|
||||
blockchainExplorer.getUnspentUtxos = sinon.stub().callsArgWith(1, null, []);
|
||||
blockchainExplorer.getUtxos = sinon.stub().callsArgWith(1, null, []);
|
||||
server.createAddress({}, function(err, address) {
|
||||
should.not.exist(err);
|
||||
server.getBalance({}, function(err, balance) {
|
||||
|
@ -1495,7 +1495,7 @@ describe('Wallet service', function() {
|
|||
});
|
||||
});
|
||||
it('should fail gracefully when blockchain is unreachable', function(done) {
|
||||
blockchainExplorer.getUnspentUtxos = sinon.stub().callsArgWith(1, 'dummy error');
|
||||
blockchainExplorer.getUtxos = sinon.stub().callsArgWith(1, 'dummy error');
|
||||
server.createAddress({}, function(err, address) {
|
||||
should.not.exist(err);
|
||||
server.getBalance({}, function(err, balance) {
|
||||
|
@ -2135,7 +2135,7 @@ describe('Wallet service', function() {
|
|||
});
|
||||
|
||||
it('should fail gracefully if unable to reach the blockchain', function(done) {
|
||||
blockchainExplorer.getUnspentUtxos = sinon.stub().callsArgWith(1, 'dummy error');
|
||||
blockchainExplorer.getUtxos = sinon.stub().callsArgWith(1, 'dummy error');
|
||||
server.createAddress({}, function(err, address) {
|
||||
should.not.exist(err);
|
||||
var txOpts = helpers.createSimpleProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 80, TestData.copayers[0].privKey_1H_0, {
|
||||
|
|
Loading…
Reference in New Issue