diff --git a/lib/server.js b/lib/server.js index af836a4..cbbd951 100644 --- a/lib/server.js +++ b/lib/server.js @@ -1213,16 +1213,17 @@ WalletService.prototype.getUtxos = function(opts, cb) { opts = opts || {}; - opts.coin = opts.coin || Defaults.COIN; - if (!Utils.checkValueInCollection(opts.coin, Constants.COINS)) - return cb(new ClientError('Invalid coin')); + if (opts.coin) { + if (!Utils.checkValueInCollection(opts.coin, Constants.COINS)) + return cb(new ClientError('Invalid coin')); + } if (_.isUndefined(opts.addresses)) { self._getUtxosForCurrentWallet({ coin: opts.coin }, cb); } else { - self._getUtxos(opts.coin, opts.addresses, cb); + self._getUtxos(Utils.getAddressCoin(opts.addresses[0]), opts.addresses, cb); } }; diff --git a/test/integration/server.js b/test/integration/server.js index 17278ae..918988a 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -2529,12 +2529,18 @@ describe('Wallet service', function() { bch: 'CPrtPWbp8cCftTQu5fzuLG5zPJNDHMMf8X', } + var idKeyMap = { + btc: 'id44btc', + bch: 'id44bch', + }; + _.each(['bch', 'btc'], function(coin) { describe('#createTx ' + coin, function() { - var addressStr; + var addressStr, idKey; before(function() { addressStr = addrMap[coin]; + idKey = idKeyMap[coin]; }); @@ -3112,6 +3118,9 @@ describe('Wallet service', function() { describe('Fee levels', function() { it('should create a tx specifying feeLevel', function(done) { + //ToDo + var level = wallet.coin == 'btc' ? 'economy' : 'normal'; + var expected = wallet.coin == 'btc' ? 180e2 : 200e2; helpers.stubFeeLevels({ 1: 400e2, 2: 200e2, @@ -3124,13 +3133,14 @@ describe('Wallet service', function() { toAddress: addressStr, amount: 1e8, }], - feeLevel: 'economy', + // ToDo + feeLevel: level, }; server.createTx(txOpts, function(err, txp) { should.not.exist(err); should.exist(txp); - txp.feePerKb.should.equal(180e2); - txp.feeLevel.should.equal('economy'); + txp.feePerKb.should.equal(expected); + txp.feeLevel.should.equal(level); done(); }); }); @@ -3407,7 +3417,7 @@ describe('Wallet service', function() { var xPrivKey = TestData.copayers[0].xPrivKey_44H_0H_0H; var accessOpts = { - copayerId: TestData.copayers[0].id44btc, + copayerId: TestData.copayers[0][idKey], requestPubKey: reqPubKey, signature: helpers.signRequestPubKey(reqPubKey, xPrivKey), };