|
@ -121,7 +121,10 @@ WalletUtils.parseAmount = function(text) { |
|
|
var rate = WalletUtils.UNITS[unit]; |
|
|
var rate = WalletUtils.UNITS[unit]; |
|
|
if (!rate) throw new Error('Invalid unit') |
|
|
if (!rate) throw new Error('Invalid unit') |
|
|
|
|
|
|
|
|
return Utils.strip(amount * rate); |
|
|
var amountSat = Utils.strip(amount * rate); |
|
|
|
|
|
if (amountSat != Math.round(amountSat)) throw new Error('Invalid amount'); |
|
|
|
|
|
|
|
|
|
|
|
return amountSat; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
module.exports = WalletUtils; |
|
|
module.exports = WalletUtils; |
|
|