Skip to content

Commit

Permalink
Merge pull request bitpay#64 from matiu/fix/send
Browse files Browse the repository at this point in the history
Fix/send
  • Loading branch information
matiu committed Jan 13, 2019
1 parent 090b468 commit b432672
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/bitcore-wallet-cli/bin/cli-utils.js
Expand Up @@ -219,7 +219,7 @@ Utils.findOneTxProposal = function(txps, id) {
return matches[0];
};

Utils.UNITS = {
Utils.UNITS2 = {
'btc': 100000000,
'bit': 100,
'sat': 1,
Expand All @@ -229,7 +229,7 @@ Utils.parseAmount = function(text) {
if (!_.isString(text))
text = text.toString();

var regex = '^(\\d*(\\.\\d{0,8})?)\\s*(' + _.keys(Utils.UNITS).join('|') + ')?$';
var regex = '^(\\d*(\\.\\d{0,8})?)\\s*(' + _.keys(Utils.UNITS2).join('|') + ')?$';
var match = new RegExp(regex, 'i').exec(text.trim());

if (!match || match.length === 0) throw new Error('Invalid amount');
Expand All @@ -238,7 +238,7 @@ Utils.parseAmount = function(text) {
if (!_.isNumber(amount) || _.isNaN(amount)) throw new Error('Invalid amount');

var unit = (match[3] || 'sat').toLowerCase();
var rate = Utils.UNITS[unit];
var rate = Utils.UNITS2[unit];
if (!rate) throw new Error('Invalid unit')

var amountSat = parseFloat((amount * rate).toPrecision(12));
Expand Down
2 changes: 1 addition & 1 deletion packages/bitcore-wallet-cli/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "bitcore-wallet",
"description": "A CLI Mutisig HD Bitcoin Wallet, demo for Bitcore Wallet Service",
"author": "BitPay Inc",
"version": "0.10.0",
"version": "1.0.0",
"keywords": [
"bitcoin",
"copay",
Expand Down

0 comments on commit b432672

Please sign in to comment.