Merge branch 'master' of github.com:jedmccaleb/NewCoin

This commit is contained in:
JoelKatz
2013-03-07 12:18:52 -08:00
5 changed files with 27 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "ripple-lib", "name": "ripple-lib",
"version": "0.7.1", "version": "0.7.2",
"description": "Ripple JavaScript client library", "description": "Ripple JavaScript client library",
"files": [ "files": [

View File

@@ -1,9 +1,6 @@
#ifndef __PEERDOOR__ #ifndef __PEERDOOR__
#define __PEERDOOR__ #define __PEERDOOR__
#include <map>
#include <set>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/asio/ssl.hpp> #include <boost/asio/ssl.hpp>

View File

@@ -559,7 +559,7 @@ Json::Value RPCHandler::accountFromString(Ledger::ref lrLedger, RippleAddress& n
} }
// { // {
// ident : <indent>, // account: <indent>,
// account_index : <index> // optional // account_index : <index> // optional
// strict: <bool> // true, only allow public keys and addresses. false, default. // strict: <bool> // true, only allow public keys and addresses. false, default.
// ledger_hash : <ledger> // ledger_hash : <ledger>
@@ -573,10 +573,10 @@ Json::Value RPCHandler::doAccountInfo(Json::Value jvRequest)
if (!lpLedger) if (!lpLedger)
return jvResult; return jvResult;
if (!jvRequest.isMember("ident")) if (!jvRequest.isMember("account") && !jvRequest.isMember("ident"))
return rpcError(rpcINVALID_PARAMS); return rpcError(rpcINVALID_PARAMS);
std::string strIdent = jvRequest["ident"].asString(); std::string strIdent = jvRequest.isMember("account") ? jvRequest["account"].asString() : jvRequest["ident"].asString();
bool bIndex; bool bIndex;
int iIndex = jvRequest.isMember("account_index") ? jvRequest["account_index"].asUInt() : 0; int iIndex = jvRequest.isMember("account_index") ? jvRequest["account_index"].asUInt() : 0;
bool bStrict = jvRequest.isMember("strict") && jvRequest["strict"].asBool(); bool bStrict = jvRequest.isMember("strict") && jvRequest["strict"].asBool();
@@ -742,10 +742,10 @@ Json::Value RPCHandler::doNicknameInfo(Json::Value params)
// XXX This would be better if it took the ledger. // XXX This would be better if it took the ledger.
Json::Value RPCHandler::doOwnerInfo(Json::Value jvRequest) Json::Value RPCHandler::doOwnerInfo(Json::Value jvRequest)
{ {
if (!jvRequest.isMember("ident")) if (!jvRequest.isMember("account") && !jvRequest.isMember("ident"))
return rpcError(rpcINVALID_PARAMS); return rpcError(rpcINVALID_PARAMS);
std::string strIdent = jvRequest["ident"].asString(); std::string strIdent = jvRequest.isMember("account") ? jvRequest["account"].asString() : jvRequest["ident"].asString();
bool bIndex; bool bIndex;
int iIndex = jvRequest.isMember("account_index") ? jvRequest["account_index"].asUInt() : 0; int iIndex = jvRequest.isMember("account_index") ? jvRequest["account_index"].asUInt() : 0;
RippleAddress raAccount; RippleAddress raAccount;

View File

@@ -1,5 +1,7 @@
// Routines for working with an account. // Routines for working with an account.
// //
// You should not instantiate this class yourself, instead use Remote#account.
//
// Events: // Events:
// wallet_clean : True, iff the wallet has been updated. // wallet_clean : True, iff the wallet has been updated.
// wallet_dirty : True, iff the wallet needs to be updated. // wallet_dirty : True, iff the wallet needs to be updated.

View File

@@ -26,6 +26,7 @@ var OrderBook = require('./orderbook').OrderBook;
var utils = require('./utils'); var utils = require('./utils');
var config = require('./config'); var config = require('./config');
var sjcl = require('../../build/sjcl');
// Request events emitted: // Request events emitted:
// 'success' : Request successful. // 'success' : Request successful.
@@ -890,7 +891,8 @@ Remote.prototype.request_tx = function (hash) {
Remote.prototype.request_account_info = function (accountID) { Remote.prototype.request_account_info = function (accountID) {
var request = new Request(this, 'account_info'); var request = new Request(this, 'account_info');
request.message.ident = UInt160.json_rewrite(accountID); request.message.ident = UInt160.json_rewrite(accountID); // DEPRECATED
request.message.account = UInt160.json_rewrite(accountID);
return request; return request;
}; };
@@ -1030,8 +1032,13 @@ Remote.prototype._server_subscribe = function () {
self._stand_alone = !!message.stand_alone; self._stand_alone = !!message.stand_alone;
self._testnet = !!message.testnet; self._testnet = !!message.testnet;
if (message.random) if ("string" === typeof message.random) {
var rand = message.random.match(/[0-9A-F]{8}/ig);
while (rand && rand.length)
sjcl.random.addEntropy(parseInt(rand.pop(), 16));
self.emit('random', utils.hexToArray(message.random)); self.emit('random', utils.hexToArray(message.random));
}
if (message.ledger_hash && message.ledger_index) { if (message.ledger_hash && message.ledger_index) {
self._ledger_time = message.ledger_time; self._ledger_time = message.ledger_time;
@@ -1111,11 +1118,17 @@ Remote.prototype.request_owner_count = function (account, current) {
}; };
Remote.prototype.account = function (accountId) { Remote.prototype.account = function (accountId) {
var account = new Account(this, accountId); accountId = UInt160.json_rewrite(accountId);
if (!account.is_valid()) return account; if (!this._accounts[accountId]) {
var account = new Account(this, accountId);
return this._accounts[account.to_json()] = account; if (!account.is_valid()) return account;
this._accounts[accountId] = account;
}
return this._accounts[accountId];
}; };
Remote.prototype.book = function (currency_out, issuer_out, Remote.prototype.book = function (currency_out, issuer_out,
@@ -1130,7 +1143,7 @@ Remote.prototype.book = function (currency_out, issuer_out,
// Return the next account sequence if possible. // Return the next account sequence if possible.
// <-- undefined or Sequence // <-- undefined or Sequence
Remote.prototype.account_seq = function (account, advance) { Remote.prototype.account_seq = function (account, advance) {
var account = UInt160.json_rewrite(account); account = UInt160.json_rewrite(account);
var account_info = this.accounts[account]; var account_info = this.accounts[account];
var seq; var seq;