diff --git a/src/cpp/ripple/main.cpp b/src/cpp/ripple/main.cpp index 4faab81028..3b57ced1f9 100644 --- a/src/cpp/ripple/main.cpp +++ b/src/cpp/ripple/main.cpp @@ -68,6 +68,7 @@ void printHelp(const po::options_description& desc) cerr << "Commands: " << endl; cerr << " account_domain_set []" << endl; cerr << " account_email_set []" << endl; + cerr << " account_tx || |( )" << endl; cerr << " account_lines || []" << endl; cerr << " account_offers || []" << endl; cerr << " account_info |" << endl; diff --git a/src/js/account.js b/src/js/account.js index 93347682a0..59eb95c911 100644 --- a/src/js/account.js +++ b/src/js/account.js @@ -29,22 +29,22 @@ var Account = function (remote, account) { this.on('newListener', function (type, listener) { if (Account.subscribe_events.indexOf(type) !== -1) { - if (!this._subs && 'open' === this._remote._online_state) { - this._remote.request_subscribe() - .accounts(this._account_id) + if (!self._subs && 'open' === self._remote._online_state) { + self._remote.request_subscribe() + .accounts(self._account_id) .request(); } - this._subs += 1; + self._subs += 1; } }); this.on('removeListener', function (type, listener) { if (Account.subscribe_events.indexOf(type) !== -1) { - this._subs -= 1; + self._subs -= 1; - if (!this._subs && 'open' === this._remote._online_state) { - this._remote.request_unsubscribe() - .accounts(this._account_id) + if (!self._subs && 'open' === self._remote._online_state) { + self._remote.request_unsubscribe() + .accounts(self._account_id) .request(); } } @@ -52,8 +52,8 @@ var Account = function (remote, account) { this._remote.on('connect', function () { if (self._subs) { - this._remote.request_subscribe() - .accounts(this._account_id) + self._remote.request_subscribe() + .accounts(self._account_id) .request(); } }); diff --git a/src/js/amount.js b/src/js/amount.js index bbaea1bbc5..a242d82474 100644 --- a/src/js/amount.js +++ b/src/js/amount.js @@ -111,7 +111,17 @@ Amount.prototype.add = function (v) { result._is_negative = s.compareTo(BigInteger.ZERO) < 0; result._value = result._is_negative ? s.negate() : s; } - else { + else if (v.is_zero()) { + result = this; + } + else if (this.is_zero()) { + result = v.clone(); + // YYY Why are these cloned? We never modify them. + result._currency = this._currency.clone(); + result._issuer = this._issuer.clone(); + } + else + { var v1 = this._is_negative ? this._value.negate() : this._value; var o1 = this._offset; var v2 = v._is_negative ? v._value.negate() : v._value; @@ -418,6 +428,10 @@ Amount.prototype.is_negative = function () { : false; // NaN is not negative }; +Amount.prototype.is_positive = function () { + return !this.is_zero() && !this.is_negative(); +}; + // Only checks the value. Not the currency and issuer. Amount.prototype.is_valid = function () { return this._value instanceof BigInteger; @@ -695,6 +709,7 @@ Amount.prototype.set_currency = function (c) { { c.copyTo(this._currency); } + this._is_native = this._currency.is_native(); return this; }; diff --git a/src/js/uint.js b/src/js/uint.js index c02d8b27ca..d95ccb51fa 100644 --- a/src/js/uint.js +++ b/src/js/uint.js @@ -20,8 +20,8 @@ var UInt = function () { this._value = NaN; }; -UInt.json_rewrite = function (j) { - return this.from_json(j).to_json(); +UInt.json_rewrite = function (j, opts) { + return this.from_json(j).to_json(opts); }; // Return a new UInt from j. diff --git a/src/js/uint160.js b/src/js/uint160.js index ee17524dc6..12c7ff04c6 100644 --- a/src/js/uint160.js +++ b/src/js/uint160.js @@ -59,8 +59,8 @@ UInt160.prototype.to_json = function (opts) { var output = Base.encode_check(Base.VER_ACCOUNT_ID, this.to_bytes()); - if (config.gateways && output in config.gateways && !opts.no_gateway) - output = config.gateways[output]; + if (opts.gateways && output in opts.gateways) + output = opts.gateways[output]; return output; };