From 0db2d312bb2412b35bdbb93c62a167fb88e8a432 Mon Sep 17 00:00:00 2001 From: jed Date: Mon, 3 Dec 2012 13:55:35 -0800 Subject: [PATCH 1/3] pass whole message in serverClosed --- src/cpp/ripple/RPCHandler.cpp | 4 +++- src/js/remote.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 99ce0e83d1..4b7d6aceaf 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -904,6 +904,8 @@ Json::Value RPCHandler::handleJSONSubmit(const Json::Value& jvRequest) RippleAddress raSrcAddressID; Json::Value txJSON = jvRequest["tx_json"]; + + if (!naSeed.setSeedGeneric(jvRequest["secret"].asString())) { return rpcError(rpcBAD_SEED); @@ -950,7 +952,7 @@ Json::Value RPCHandler::handleJSONSubmit(const Json::Value& jvRequest) txJSON["Fee"] = (int) theConfig.FEE_ACCOUNT_CREATE; } - if (!txJSON.isMember("Paths") && txJSON.isMember("Amount") && jvRequest.isMember("build_path")) + if (!txJSON.isMember("Paths") && txJSON.isMember("Amount") && jvRequest.isMember("build_path")) { // Need a ripple path. STPathSet spsPaths; diff --git a/src/js/remote.js b/src/js/remote.js index be7614bd4a..bc7b51d3bc 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -489,7 +489,7 @@ Remote.prototype._connect_message = function (ws, json) { this._ledger_hash = message.ledger_hash; this._ledger_current_index = message.ledger_index + 1; - this.emit('ledger_closed', message.ledger_hash, message.ledger_index); + this.emit('ledger_closed', message); break; // All other messages From 665bd4b1de1b5a272ddc287d148c6a2f1635c8cf Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Mon, 3 Dec 2012 14:28:27 -0800 Subject: [PATCH 2/3] Added set_issuer. --- src/js/amount.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/js/amount.js b/src/js/amount.js index 5bda5ddae0..2426338a9e 100644 --- a/src/js/amount.js +++ b/src/js/amount.js @@ -404,6 +404,16 @@ Amount.prototype.set_currency = function(c) { return this; }; +Amount.prototype.set_issuer = function (issuer) { + if (issuer instanceof UInt160) { + issuer.copyTo(this._issuer); + } else { + this._issuer.parse_json(issuer); + } + + return this; +}; + // Only checks the value. Not the currency and issuer. Amount.prototype.is_valid = function() { return !isNaN(this._value); From 2e49493776266b4dd671dc0fc93696e969eac290 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Mon, 3 Dec 2012 15:34:51 -0800 Subject: [PATCH 3/3] Add Amount.is_negative(); --- src/js/amount.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js/amount.js b/src/js/amount.js index 2426338a9e..b34018cf16 100644 --- a/src/js/amount.js +++ b/src/js/amount.js @@ -785,6 +785,10 @@ Amount.prototype.parse_issuer = function (issuer) { return this; }; +Amount.prototype.is_negative = function () { + return this._is_negative; +}; + // Check BigInteger NaN // Checks currency, does not check issuer. Amount.prototype.equals = function (d) {