From 2f7ce2841c367765bb5705c8dc3209854b6a5413 Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Tue, 10 Sep 2013 15:59:11 -0700 Subject: [PATCH] transaction.payment will handle human amounts --- src/js/ripple/transaction.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/js/ripple/transaction.js b/src/js/ripple/transaction.js index 13d49127..82c4bb23 100644 --- a/src/js/ripple/transaction.js +++ b/src/js/ripple/transaction.js @@ -468,7 +468,7 @@ Transaction.prototype.password_set = function (src, authorized_key, generator, p public_key = options.public_key; generator = options.generator; authorized_key = options.authorized_key; - src = options.src || options.from; + src = options.source || options.from; } if (!UInt160.is_valid(src)) { @@ -517,6 +517,10 @@ Transaction.prototype.payment = function (src, dst, amount) { throw new Error('Payment destination address invalid'); } + if (typeof amount === 'string' && !Number(amount)) { + amount = Amount.from_human(amount); + } + this._secret = this._account_secret(src); this.tx_json.TransactionType = 'Payment'; this.tx_json.Account = UInt160.json_rewrite(src); @@ -532,7 +536,7 @@ Transaction.prototype.ripple_line_set = function (src, limit, quality_in, qualit quality_out = options.quality_out; quality_in = options.quality_in; limit = options.limit; - src = options.src || options.from; + src = options.source || options.from; } if (!UInt160.is_valid(src)) { @@ -568,7 +572,7 @@ Transaction.prototype.wallet_add = function (src, amount, authorized_key, public public_key = options.public_key; authorized_key = options.authorized_key; amount = options.amount; - src = options.src || options.from; + src = options.source || options.from; } if (!UInt160.is_valid(src)) {