rename method

Conflicts:
	lib/blockchainexplorers/insight.js
This commit is contained in:
Ivan Socolsky 2016-02-16 12:32:19 -03:00
parent f89c249e12
commit 3406f57bbc
5 changed files with 9 additions and 9 deletions

View File

@ -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,
};

View File

@ -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) {

View File

@ -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({

View File

@ -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);
});

View File

@ -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, {