check coin arg is valid
This commit is contained in:
parent
87ba10de84
commit
7bbc6aea82
|
@ -1322,7 +1322,7 @@ WalletService.prototype._getActiveAddresses = function(cb) {
|
||||||
/**
|
/**
|
||||||
* Get wallet balance.
|
* Get wallet balance.
|
||||||
* @param {Object} opts
|
* @param {Object} opts
|
||||||
* @param {string} [opts.coin = 'btc'] - Override wallet coin.
|
* @param {string} [opts.coin] - Override wallet coin (default wallet's coin).
|
||||||
* @param {Boolean} opts.twoStep[=false] - Optional - Use 2 step balance computation for improved performance
|
* @param {Boolean} opts.twoStep[=false] - Optional - Use 2 step balance computation for improved performance
|
||||||
* @returns {Object} balance - Total amount & locked amount.
|
* @returns {Object} balance - Total amount & locked amount.
|
||||||
*/
|
*/
|
||||||
|
@ -1331,6 +1331,11 @@ WalletService.prototype.getBalance = function(opts, cb) {
|
||||||
|
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
|
if (opts.coin) {
|
||||||
|
if (!Utils.checkValueInCollection(opts.coin, Constants.COINS))
|
||||||
|
return cb(new ClientError('Invalid coin'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!opts.twoStep)
|
if (!opts.twoStep)
|
||||||
return self._getBalanceOneStep(opts, cb);
|
return self._getBalanceOneStep(opts, cb);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue