mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -3,6 +3,8 @@ exports.Amount = require('./amount').Amount;
|
||||
exports.UInt160 = require('./amount').UInt160;
|
||||
exports.Seed = require('./amount').Seed;
|
||||
|
||||
exports.utils = require('./utils');
|
||||
|
||||
// Important: We do not guarantee any specific version of SJCL or for any
|
||||
// specific features to be included. The version and configuration may change at
|
||||
// any time without warning.
|
||||
|
||||
@@ -32,7 +32,7 @@ var OrderBook = function (remote,
|
||||
if (OrderBook.subscribe_events.indexOf(type) !== -1) {
|
||||
if (!self._subs && 'open' === self._remote._online_state) {
|
||||
self._remote.request_subscribe()
|
||||
.books([self.to_json()])
|
||||
.books([self.to_json()], true)
|
||||
.request();
|
||||
}
|
||||
self._subs += 1;
|
||||
@@ -54,7 +54,7 @@ var OrderBook = function (remote,
|
||||
this._remote.on('connect', function () {
|
||||
if (self._subs) {
|
||||
self._remote.request_subscribe()
|
||||
.books([self.to_json()])
|
||||
.books([self.to_json()], true)
|
||||
.request();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -203,7 +203,7 @@ Request.prototype.rt_accounts = function (accounts) {
|
||||
return this.accounts(accounts, true);
|
||||
};
|
||||
|
||||
Request.prototype.books = function (books) {
|
||||
Request.prototype.books = function (books, state) {
|
||||
var procBooks = [];
|
||||
|
||||
for (var i = 0, l = books.length; i < l; i++) {
|
||||
@@ -221,6 +221,8 @@ Request.prototype.books = function (books) {
|
||||
json["IssuerIn"] = UInt160.json_rewrite(book["IssuerIn"]);
|
||||
}
|
||||
|
||||
if (state || book["StateNow"]) json["StateNow"] = true;
|
||||
|
||||
procBooks.push(json);
|
||||
}
|
||||
this.message.books = procBooks;
|
||||
|
||||
@@ -243,17 +243,25 @@ var STAccount = exports.Account = new SerializedType({
|
||||
});
|
||||
|
||||
var STPathSet = exports.PathSet = new SerializedType({
|
||||
typeBoundary: 0xff,
|
||||
typeEnd: 0x00,
|
||||
typeAccount: 0x01,
|
||||
typeCurrency: 0x10,
|
||||
typeIssuer: 0x20,
|
||||
serialize: function (so, val) {
|
||||
// XXX
|
||||
for (var i = 0, l = val.length; i < l; i++) {
|
||||
// Boundary
|
||||
if (i) STInt8.serialize(so, this.typeBoundary);
|
||||
|
||||
for (var j = 0, l2 = val[i].length; j < l2; j++) {
|
||||
var entry = val[i][j];
|
||||
|
||||
var type = 0;
|
||||
|
||||
if (entry.account) type |= 0x01;
|
||||
if (entry.currency) type |= 0x10;
|
||||
if (entry.issuer) type |= 0x20;
|
||||
if (entry.account) type |= this.typeAccount;
|
||||
if (entry.currency) type |= this.typeCurrency;
|
||||
if (entry.issuer) type |= this.typeIssuer;
|
||||
|
||||
STInt8.serialize(so, type);
|
||||
|
||||
@@ -268,10 +276,8 @@ var STPathSet = exports.PathSet = new SerializedType({
|
||||
so.append(UInt160.from_json(entry.issuer).to_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
if (j < l2) STInt8.serialize(so, 0xff);
|
||||
}
|
||||
STInt8.serialize(so, 0x00);
|
||||
STInt8.serialize(so, this.typeEnd);
|
||||
},
|
||||
parse: function (so) {
|
||||
// XXX
|
||||
|
||||
@@ -97,6 +97,15 @@ var assert = function (assertion, msg) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert a ripple epoch to a JavaScript timestamp.
|
||||
*
|
||||
* JavaScript timestamps are unix epoch in milliseconds.
|
||||
*/
|
||||
var toTimestamp = function (rpepoch) {
|
||||
return (rpepoch + 0x386D4380) * 1000;
|
||||
};
|
||||
|
||||
exports.trace = trace;
|
||||
exports.arraySet = arraySet;
|
||||
exports.hexToString = hexToString;
|
||||
@@ -106,5 +115,6 @@ exports.stringToHex = stringToHex;
|
||||
exports.chunkString = chunkString;
|
||||
exports.logObject = logObject;
|
||||
exports.assert = assert;
|
||||
exports.toTimestamp = toTimestamp;
|
||||
|
||||
// vim:sw=2:sts=2:ts=8:et
|
||||
|
||||
Reference in New Issue
Block a user