mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-18 03:05:48 +00:00
Compare commits
16 Commits
0.12.0
...
0.12.1-rc1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af4ed295e0 | ||
|
|
7614a03ea8 | ||
|
|
d9527726b6 | ||
|
|
05f4099709 | ||
|
|
a20a649013 | ||
|
|
0e3e64105c | ||
|
|
b2cdb1a6ae | ||
|
|
812432db96 | ||
|
|
5b2c4aef2d | ||
|
|
b7ccf424f4 | ||
|
|
77d5db168b | ||
|
|
e80cd1ff55 | ||
|
|
4ff25a21f6 | ||
|
|
f184a71360 | ||
|
|
fc38a9853d | ||
|
|
6023efed41 |
15
HISTORY.md
15
HISTORY.md
@@ -1,3 +1,18 @@
|
||||
##0.12.1
|
||||
|
||||
**Breaking Changes**
|
||||
|
||||
+ [Removed support for parsing native amounts in floating point format](https://github.com/ripple/ripple-lib/commit/e80cd1ff55deae9cd5b0ae85be957f86856b887e)
|
||||
|
||||
**Changes**
|
||||
|
||||
+ [Fix handling of false parameters in requestLedger](https://github.com/ripple/ripple-lib/commit/6023efed41b7812b3bab660a1c0dc9f0a21000b9)
|
||||
|
||||
+ [Fix order funded amount calculation](https://github.com/ripple/ripple-lib/commit/b2cdb1a6aed968b1f306e8dadbd4b7ca37e5aa03)
|
||||
|
||||
+ [Remove `Features` field requirements from `SetFee` transaction format](https://github.com/ripple/ripple-lib/commit/a20a649013646710c078d4ce1e210f87c7fe74fe)
|
||||
|
||||
|
||||
##0.12.0
|
||||
|
||||
**Breaking Changes**
|
||||
|
||||
8
npm-shrinkwrap.json
generated
8
npm-shrinkwrap.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ripple-lib",
|
||||
"version": "0.12.0",
|
||||
"version": "0.12.1-rc1",
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "0.9.0",
|
||||
@@ -8,9 +8,9 @@
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz"
|
||||
},
|
||||
"bignumber.js": {
|
||||
"version": "2.0.0",
|
||||
"from": "bignumber.js@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.0.0.tgz"
|
||||
"version": "2.0.3",
|
||||
"from": "bignumber.js@>=2.0.3 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.0.3.tgz"
|
||||
},
|
||||
"extend": {
|
||||
"version": "1.2.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ripple-lib",
|
||||
"version": "0.12.0",
|
||||
"version": "0.12.1-rc1",
|
||||
"description": "A JavaScript API for interacting with Ripple in Node.js and the browser",
|
||||
"files": [
|
||||
"src/js/*",
|
||||
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "~0.9.0",
|
||||
"bignumber.js": "^2.0.0",
|
||||
"bignumber.js": "^2.0.3",
|
||||
"extend": "~1.2.1",
|
||||
"lodash": "^3.1.0",
|
||||
"lru-cache": "~2.5.0",
|
||||
|
||||
@@ -7,16 +7,13 @@ var utils = require('./utils');
|
||||
var UInt160 = require('./uint160').UInt160;
|
||||
var Seed = require('./seed').Seed;
|
||||
var Currency = require('./currency').Currency;
|
||||
var BigNumber = require('./bignumber');
|
||||
var GlobalBigNumber = require('bignumber.js');
|
||||
|
||||
var BigNumber = GlobalBigNumber.another({
|
||||
ROUNDING_MODE: GlobalBigNumber.ROUND_HALF_UP,
|
||||
DECIMAL_PLACES: 40
|
||||
});
|
||||
|
||||
function isInteger(number) {
|
||||
return parseInt(number) === number;
|
||||
}
|
||||
|
||||
function ensureDecimalPoint(value) {
|
||||
return isInteger(value) ? String(value) + '.0' : value;
|
||||
}
|
||||
|
||||
function inverse(number) {
|
||||
return (new BigNumber(number)).toPower(-1);
|
||||
@@ -192,7 +189,7 @@ Amount.prototype.ratio_human = function(denominator, opts) {
|
||||
opts = extend({ }, opts);
|
||||
|
||||
var numerator = this;
|
||||
denominator = Amount.from_json(ensureDecimalPoint(denominator));
|
||||
denominator = Amount.from_json(denominator);
|
||||
|
||||
// If either operand is NaN, the result is NaN.
|
||||
if (!numerator.is_valid() || !denominator.is_valid()) {
|
||||
@@ -252,7 +249,7 @@ Amount.prototype.ratio_human = function(denominator, opts) {
|
||||
Amount.prototype.product_human = function(factor, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
factor = Amount.from_json(ensureDecimalPoint(factor));
|
||||
factor = Amount.from_json(factor);
|
||||
|
||||
// If either operand is NaN, the result is NaN.
|
||||
if (!this.is_valid() || !factor.is_valid()) {
|
||||
@@ -333,10 +330,7 @@ Amount.prototype.canonicalize = function(roundingMode) {
|
||||
this._value = this._value.round(6, BigNumber.ROUND_DOWN);
|
||||
} else {
|
||||
if (roundingMode) {
|
||||
var value = this._value;
|
||||
this._value = BigNumber.withRoundingMode(roundingMode, function() {
|
||||
return new BigNumber(value.toPrecision(16));
|
||||
});
|
||||
this._value = new BigNumber(this._value.toPrecision(16, roundingMode));
|
||||
} else {
|
||||
this._value = new BigNumber(this._value.toPrecision(16));
|
||||
}
|
||||
@@ -687,14 +681,13 @@ Amount.prototype.parse_json = function(j) {
|
||||
// - float = with precision 6
|
||||
// XXX Improvements: disallow leading zeros.
|
||||
Amount.prototype.parse_native = function(j) {
|
||||
if (typeof j === 'string' && j.match(/^-?\d*(\.\d{0,6})?$/)) {
|
||||
if (typeof j === 'string' && !isNaN(parseInt(j))) {
|
||||
if (j.indexOf('.') >= 0) {
|
||||
throw new Error('Native amounts must be specified in integer drops')
|
||||
}
|
||||
var value = new BigNumber(j);
|
||||
this._is_native = true;
|
||||
if (j.indexOf('.') >= 0) {
|
||||
this._set_value(value);
|
||||
} else {
|
||||
this._set_value(value.dividedBy(Amount.bi_xns_unit));
|
||||
}
|
||||
this._set_value(value.dividedBy(Amount.bi_xns_unit));
|
||||
} else {
|
||||
this._set_value(new BigNumber(NaN));
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
var BigNumber = require('bignumber.js');
|
||||
var extend = require('extend');
|
||||
|
||||
function BigNumberWrapper(value, base) {
|
||||
// reset config every time a BigNumber is instantiated so that
|
||||
// these global settings won't be overridden if another file tries
|
||||
// to set them at require-time.
|
||||
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_HALF_UP,
|
||||
DECIMAL_PLACES: 40 });
|
||||
BigNumber.call(this, value, base);
|
||||
}
|
||||
|
||||
extend(BigNumberWrapper, BigNumber); // copy class static properties
|
||||
BigNumberWrapper.prototype = BigNumber.prototype;
|
||||
|
||||
BigNumberWrapper.config = function() {
|
||||
throw new Error('BigNumber.config may only be called from bignumber.js');
|
||||
};
|
||||
|
||||
BigNumberWrapper.withRoundingMode = function(roundingMode, func) {
|
||||
var config = BigNumber.config();
|
||||
var oldRoundingMode = config.ROUNDING_MODE;
|
||||
config.ROUNDING_MODE = roundingMode;
|
||||
BigNumber.config(config);
|
||||
try {
|
||||
return func();
|
||||
} finally {
|
||||
config.ROUNDING_MODE = oldRoundingMode;
|
||||
BigNumber.config(config);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = BigNumberWrapper;
|
||||
@@ -272,7 +272,6 @@ exports.tx = {
|
||||
[ 'Feature' , REQUIRED ]
|
||||
]),
|
||||
SetFee: [101].concat(base, [
|
||||
[ 'Features' , REQUIRED ],
|
||||
[ 'BaseFee' , REQUIRED ],
|
||||
[ 'ReferenceFeeUnits' , REQUIRED ],
|
||||
[ 'ReserveBase' , REQUIRED ],
|
||||
|
||||
@@ -131,7 +131,6 @@ Meta.prototype.getNodes = function(options) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Meta.prototype.getAffectedAccounts = function(from) {
|
||||
if (this._affectedAccounts) {
|
||||
return this._affectedAccounts;
|
||||
@@ -164,7 +163,7 @@ Meta.prototype.getAffectedAccounts = function(from) {
|
||||
|
||||
this._affectedAccounts = utils.arrayUnique(accounts);
|
||||
|
||||
return this._affectedAccounts;
|
||||
return this._affectedAccounts;
|
||||
};
|
||||
|
||||
Meta.prototype.getAffectedBooks = function() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -862,7 +862,7 @@ Remote.prototype.requestLedger = function(options, callback) {
|
||||
case 'expand':
|
||||
case 'transactions':
|
||||
case 'accounts':
|
||||
request.message[o] = true;
|
||||
request.message[o] = options[o] ? true : false;
|
||||
break;
|
||||
case 'ledger':
|
||||
request.selectLedger(options.ledger);
|
||||
|
||||
@@ -11,7 +11,7 @@ var extend = require('extend');
|
||||
var binformat = require('./binformat');
|
||||
var utils = require('./utils');
|
||||
var sjcl = utils.sjcl;
|
||||
var BigNumber = require('./bignumber');
|
||||
var GlobalBigNumber = require('bignumber.js');
|
||||
|
||||
var UInt128 = require('./uint128').UInt128;
|
||||
var UInt160 = require('./uint160').UInt160;
|
||||
@@ -22,6 +22,11 @@ var amount = require('./amount');
|
||||
var Amount = amount.Amount;
|
||||
var Currency = amount.Currency;
|
||||
|
||||
var BigNumber = GlobalBigNumber.another({
|
||||
ROUNDING_MODE: GlobalBigNumber.ROUND_HALF_UP,
|
||||
DECIMAL_PLACES: 40
|
||||
});
|
||||
|
||||
var SerializedType = function (methods) {
|
||||
extend(this, methods);
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ var EventEmitter = require('events').EventEmitter;
|
||||
var Amount = require('./amount').Amount;
|
||||
var RangeSet = require('./rangeset').RangeSet;
|
||||
var log = require('./log').internal.sub('server');
|
||||
var utils = require('./utils');
|
||||
|
||||
/**
|
||||
* @constructor Server
|
||||
@@ -423,7 +424,9 @@ Server.prototype.connect = function() {
|
||||
log.info(this.getServerID(), 'connect');
|
||||
}
|
||||
|
||||
var ws = this._ws = new WebSocket(this._opts.url);
|
||||
var ws = this._ws = new WebSocket(this._opts.url, {
|
||||
headers: { 'User-Agent': 'ripple-lib/' + utils.getPackageVersion() }
|
||||
});
|
||||
|
||||
this._shouldConnect = true;
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
var packageJson = require('../../../package.json');
|
||||
|
||||
function getPackageVersion() {
|
||||
return packageJson.version;
|
||||
}
|
||||
|
||||
function getMantissaDecimalString(bignum) {
|
||||
var mantissa = bignum.toPrecision(16)
|
||||
@@ -170,6 +175,7 @@ exports.arrayUnique = arrayUnique;
|
||||
exports.toTimestamp = toTimestamp;
|
||||
exports.fromTimestamp = fromTimestamp;
|
||||
exports.getMantissaDecimalString = getMantissaDecimalString;
|
||||
exports.getPackageVersion = getPackageVersion;
|
||||
|
||||
// Going up three levels is needed to escape the src-cov folder used for the
|
||||
// test coverage stuff.
|
||||
|
||||
@@ -362,22 +362,26 @@ describe('Amount', function() {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('0').to_text_full());
|
||||
});
|
||||
it('Parse native 0.0', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('0.0').to_text_full());
|
||||
assert.throws(function() {
|
||||
Amount.from_json('0.0');
|
||||
});
|
||||
});
|
||||
it('Parse native -0', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('-0').to_text_full());
|
||||
});
|
||||
it('Parse native -0.0', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('-0.0').to_text_full());
|
||||
assert.throws(function() {
|
||||
Amount.from_json('-0.0');
|
||||
});
|
||||
});
|
||||
it('Parse native 1000', function () {
|
||||
assert.strictEqual('0.001/XRP', Amount.from_json('1000').to_text_full());
|
||||
});
|
||||
it('Parse native 12.3', function () {
|
||||
assert.strictEqual('12.3/XRP', Amount.from_json('12.3').to_text_full());
|
||||
it('Parse native 12300000', function () {
|
||||
assert.strictEqual('12.3/XRP', Amount.from_json('12300000').to_text_full());
|
||||
});
|
||||
it('Parse native -12.3', function () {
|
||||
assert.strictEqual('-12.3/XRP', Amount.from_json('-12.3').to_text_full());
|
||||
it('Parse native -12300000', function () {
|
||||
assert.strictEqual('-12.3/XRP', Amount.from_json('-12300000').to_text_full());
|
||||
});
|
||||
it('Parse 123./USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', function () {
|
||||
assert.strictEqual('123/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', Amount.from_json('123./USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh').to_text_full());
|
||||
@@ -406,23 +410,17 @@ describe('Amount', function() {
|
||||
it('Parse native 0 human', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('0').to_human_full());
|
||||
});
|
||||
it('Parse native 0.0 human', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('0.0').to_human_full());
|
||||
});
|
||||
it('Parse native -0 human', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('-0').to_human_full());
|
||||
});
|
||||
it('Parse native -0.0 human', function () {
|
||||
assert.strictEqual('0/XRP', Amount.from_json('-0.0').to_human_full());
|
||||
});
|
||||
it('Parse native 1000 human', function () {
|
||||
assert.strictEqual('0.001/XRP', Amount.from_json('1000').to_human_full());
|
||||
});
|
||||
it('Parse native 12.3 human', function () {
|
||||
assert.strictEqual('12.3/XRP', Amount.from_json('12.3').to_human_full());
|
||||
it('Parse native 12300000 human', function () {
|
||||
assert.strictEqual('12.3/XRP', Amount.from_json('12300000').to_human_full());
|
||||
});
|
||||
it('Parse native -12.3 human', function () {
|
||||
assert.strictEqual('-12.3/XRP', Amount.from_json('-12.3').to_human_full());
|
||||
it('Parse native -12300000 human', function () {
|
||||
assert.strictEqual('-12.3/XRP', Amount.from_json('-12300000').to_human_full());
|
||||
});
|
||||
it('Parse 123./USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh human', function () {
|
||||
assert.strictEqual('123/USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh', Amount.from_json('123./USD/rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh').to_human_full());
|
||||
@@ -790,7 +788,7 @@ describe('Amount', function() {
|
||||
});
|
||||
it('0 XRP == 0 XRP', function () {
|
||||
var a = Amount.from_json('0');
|
||||
var b = Amount.from_json('0.0');
|
||||
var b = Amount.from_json('0');
|
||||
assert(a.equals(b));
|
||||
assert(!a.not_equals_why(b));
|
||||
});
|
||||
@@ -819,8 +817,8 @@ describe('Amount', function() {
|
||||
assert(!a.not_equals_why(b));
|
||||
});
|
||||
it('1.1 XRP == 1.1 XRP', function () {
|
||||
var a = Amount.from_json('1.1');
|
||||
var b = Amount.from_json('11.0').ratio_human(10);
|
||||
var a = Amount.from_json('1100000');
|
||||
var b = Amount.from_json('11000000').ratio_human('10/XRP');
|
||||
assert(a.equals(b));
|
||||
assert(!a.not_equals_why(b));
|
||||
});
|
||||
|
||||
5
test/fixtures/addresses.js
vendored
Normal file
5
test/fixtures/addresses.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports.ACCOUNT = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
||||
module.exports.OTHER_ACCOUNT = 'rpZc4mVfWUif9CRoHRKKcmhu1nx2xktxBo';
|
||||
module.exports.THIRD_ACCOUNT = 'rwBYyfufTzk77zUSKEu4MvixfarC35av1J';
|
||||
module.exports.FOURTH_ACCOUNT = 'rJnZ4YHCUsHvQu7R6mZohevKJDHFzVD6Zr';
|
||||
module.exports.ISSUER = 'rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM';
|
||||
796
test/fixtures/orderbook.js
vendored
Normal file
796
test/fixtures/orderbook.js
vendored
Normal file
@@ -0,0 +1,796 @@
|
||||
var _ = require('lodash');
|
||||
var addresses = require('./addresses');
|
||||
var Meta = require('ripple-lib').Meta;
|
||||
|
||||
module.exports.FIAT_BALANCE = '10';
|
||||
module.exports.NATIVE_BALANCE = '25';
|
||||
module.exports.NATIVE_BALANCE_PREVIOUS = '100';
|
||||
|
||||
module.exports.TAKER_GETS = '19.84580331';
|
||||
module.exports.TAKER_GETS_FINAL = '18.84580331';
|
||||
module.exports.TAKER_PAYS = '3878342440';
|
||||
module.exports.TAKER_PAYS_FINAL = '3078342440';
|
||||
module.exports.OTHER_TAKER_GETS = '4.9656112525';
|
||||
module.exports.OTHER_TAKER_GETS_FINAL = '3.9656112525';
|
||||
module.exports.OTHER_TAKER_PAYS = '972251352';
|
||||
module.exports.OTHER_TAKER_PAYS_FINAL = '902251352';
|
||||
|
||||
module.exports.LEDGER_INDEX = '06AFB03237286C1566CD649CFD5388C2C1F5BEFC5C3302A1962682803A9946FA';
|
||||
module.exports.OTHER_LEDGER_INDEX = 'D3338DA77BA23122FB5647B74B53636AB54BE246D4B21707C9D6887DEB334252';
|
||||
|
||||
module.exports.TRANSFER_RATE = 1002000000;
|
||||
|
||||
module.exports.fiatOffers = function (options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account_funds: '318.3643710638508',
|
||||
other_account_funds: '235.0194163432668'
|
||||
});
|
||||
|
||||
return [
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F15E821839FB',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000001897',
|
||||
PreviousTxnID: '11BA57676711A42C2FC2191EAEE98023B04627DFA84926B0C8E9D61A9CAF13AD',
|
||||
PreviousTxnLgrSeq: 8265601,
|
||||
Sequence: 531927,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.TAKER_GETS
|
||||
},
|
||||
taker_gets_funded: '100',
|
||||
is_fully_funded: true,
|
||||
TakerPays: module.exports.TAKER_PAYS,
|
||||
index: module.exports.LEDGER_INDEX,
|
||||
owner_funds: options.account_funds,
|
||||
quality: '195423807.2109563'
|
||||
},
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '00000000000063CC',
|
||||
PreviousTxnID: 'CD77500EF28984BFC123E8A257C10E44FF486EA8FC43E1356C42BD6DB853A602',
|
||||
PreviousTxnLgrSeq: 8265523,
|
||||
Sequence: 1139002,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '4.9656112525'
|
||||
},
|
||||
taker_gets_funded: '100',
|
||||
is_fully_funded: true,
|
||||
TakerPays: '972251352',
|
||||
index: 'X2K98DB77BA23122FB5647B74B53636AB54BE246D4B21707C9D6887DEB334252',
|
||||
owner_funds: options.account_funds,
|
||||
quality: '195796912.5171664'
|
||||
},
|
||||
{
|
||||
Account: addresses.OTHER_ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '00000000000063CC',
|
||||
PreviousTxnID: 'CD77500EF28984BFC123E8A257C10E44FF486EA8FC43E1356C42BD6DB853A602',
|
||||
PreviousTxnLgrSeq: 8265523,
|
||||
Sequence: 1139002,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.OTHER_TAKER_GETS
|
||||
},
|
||||
taker_gets_funded: '100',
|
||||
is_fully_funded: true,
|
||||
TakerPays: module.exports.OTHER_TAKER_PAYS,
|
||||
index: module.exports.OTHER_LEDGER_INDEX,
|
||||
owner_funds: options.other_account_funds,
|
||||
quality: '195796912.5171664'
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
module.exports.NATIVE_OFFERS = [
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: 'DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C124AF94ED1781B',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '00000000000063CA',
|
||||
PreviousTxnID: '51C64E0B300E9C0E877BA3E79B4ED1DBD5FDDCE58FA1A8FDA5F8DDF139787A24',
|
||||
PreviousTxnLgrSeq: 8265275,
|
||||
Sequence: 1138918,
|
||||
TakerGets: '50',
|
||||
taker_gets_funded: '100',
|
||||
is_fully_funded: true,
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '5'
|
||||
},
|
||||
index: 'DC003E09AD1306FBBD1957C955EE668E429CC85B0EC0EC17297F6676E6108DE7',
|
||||
owner_funds: '162110617177',
|
||||
quality: '0.000000005148984210454555'
|
||||
},
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: 'DFA3B6DDAB58C7E8E5D944E736DA4B7046C30E4F460FD9DE4C124B054BAD1D79',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000001896',
|
||||
PreviousTxnID: '9B21C7A4B66DC1CD5FC9D85C821C4CAA8F80E437582BAD11E88A1E9E6C7AA59C',
|
||||
PreviousTxnLgrSeq: 8265118,
|
||||
Sequence: 531856,
|
||||
TakerGets: '10',
|
||||
taker_gets_funded: '100',
|
||||
is_fully_funded: true,
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '20'
|
||||
},
|
||||
index: '7AC0458676A54E99FAA5ED0A56CD0CB814D3DEFE1C7874F0BB39875D60668E41',
|
||||
owner_funds: '430527438338',
|
||||
quality: '0.000000005149035697347961'
|
||||
},
|
||||
{
|
||||
Account: addresses.OTHER_ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5D06F4C3362FE1D0',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '00000000000063CC',
|
||||
PreviousTxnID: 'CD77500EF28984BFC123E8A257C10E44FF486EA8FC43E1356C42BD6DB853A602',
|
||||
PreviousTxnLgrSeq: 8265523,
|
||||
Sequence: 1139002,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '4.9656112525'
|
||||
},
|
||||
TakerPays: '972251352',
|
||||
index: 'D3338DA77BA23122FB5647B74B53636AB54BE246D4B21707C9D6887DEB334252',
|
||||
owner_funds: '235.0194163432668',
|
||||
quality: '195796912.5171664'
|
||||
},
|
||||
];
|
||||
|
||||
module.exports.REQUEST_OFFERS = [
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711A3A4254F5000',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000000',
|
||||
PreviousTxnID: '9BB337CC8B34DC8D1A3FFF468556C8BA70977C37F7436439D8DA19610F214AD1',
|
||||
PreviousTxnLgrSeq: 8342933,
|
||||
Sequence: 195,
|
||||
TakerGets: {
|
||||
currency: 'BTC',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '0.1129232560043778'
|
||||
},
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '56.06639660617357'
|
||||
},
|
||||
index: 'B6BC3B0F87976370EE11F5575593FE63AA5DC1D602830DC96F04B2D597F044BF',
|
||||
owner_funds: '0.1129267125000245',
|
||||
quality: '496.5'
|
||||
},
|
||||
{
|
||||
Account: addresses.OTHER_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 461498565,
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
PreviousTxnID: 'C8296B9CCA6DC594C7CD271C5D8FD11FEE380021A07768B25935642CDB37048A',
|
||||
PreviousTxnLgrSeq: 8342469,
|
||||
Sequence: 29354,
|
||||
TakerGets: {
|
||||
currency: 'BTC',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '0.2'
|
||||
},
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '99.72233516476456'
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
owner_funds: '0.950363009783092',
|
||||
quality: '498.6116758238228'
|
||||
},
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 461498565,
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
PreviousTxnID: 'C8296B9CCA6DC594C7CD271C5D8FD11FEE380021A07768B25935642CDB37048A',
|
||||
PreviousTxnLgrSeq: 8342469,
|
||||
Sequence: 29356,
|
||||
TakerGets: {
|
||||
currency: 'BTC',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '0.5'
|
||||
},
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '99.72233516476456'
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
owner_funds: '0.950363009783092',
|
||||
quality: '498.6116758238228'
|
||||
},
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 461498565,
|
||||
Flags: 131078,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
PreviousTxnID: 'C8296B9CCA6DC594C7CD271C5D8FD11FEE380021A07768B25935642CDB37048A',
|
||||
PreviousTxnLgrSeq: 8342469,
|
||||
Sequence: 29354,
|
||||
TakerGets: {
|
||||
currency: 'BTC',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '0.5'
|
||||
},
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '99.72233516476456'
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
owner_funds: '0.950363009783092',
|
||||
quality: '498.6116758238228'
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.REQUEST_OFFERS_NATIVE = [
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711A3A4254F5000',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000000',
|
||||
Sequence: 195,
|
||||
TakerGets: '1000',
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '56.06639660617357'
|
||||
},
|
||||
index: 'B6BC3B0F87976370EE11F5575593FE63AA5DC1D602830DC96F04B2D597F044BF',
|
||||
owner_funds: '600'
|
||||
},
|
||||
{
|
||||
Account: addresses.OTHER_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 461498565,
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
Sequence: 29354,
|
||||
TakerGets: '2000',
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '99.72233516476456'
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
owner_funds: '4000',
|
||||
},
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 461498565,
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
Sequence: 29356,
|
||||
TakerGets: '2000',
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '99.72233516476456'
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
owner_funds: '3900',
|
||||
},
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '6EAB7C172DEFA430DBFAD120FDC373B5F5AF8B191649EC985711B6D8C62EF414',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 461498565,
|
||||
Flags: 131078,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000144',
|
||||
PreviousTxnID: 'C8296B9CCA6DC594C7CD271C5D8FD11FEE380021A07768B25935642CDB37048A',
|
||||
PreviousTxnLgrSeq: 8342469,
|
||||
Sequence: 29354,
|
||||
TakerGets: '2000',
|
||||
TakerPays: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '99.72233516476456'
|
||||
},
|
||||
index: 'A437D85DF80D250F79308F2B613CF5391C7CF8EE9099BC4E553942651CD9FA86',
|
||||
quality: '498.6116758238228'
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.bookOffersResponse = function (options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account_funds: '2010.027702881682',
|
||||
other_account_funds: '24.06086596039299',
|
||||
third_account_funds: '9071.40090264774',
|
||||
fourth_account_funds: '7244.053477923128'
|
||||
});
|
||||
|
||||
return {
|
||||
offers: [
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5C188F5B29EE1C14',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000006762',
|
||||
PreviousTxnID: '5F08192C82CD3A598D29B51FCCDE29B6709EBCB454A3CD540C32F7A79EE7CB26',
|
||||
PreviousTxnLgrSeq: 11558364,
|
||||
Sequence: 1689777,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '79.39192374'
|
||||
},
|
||||
TakerPays: '5488380479',
|
||||
index: 'D9F821C8687E0D0EDEFF05EBB53CFDC81C5F9C4C354DAACB11F6676B5E14AEF5',
|
||||
owner_funds: options.account_funds,
|
||||
quality: '69130211.4932226'
|
||||
},
|
||||
{
|
||||
Account: addresses.OTHER_ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5C18949C72B26C2A',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000001',
|
||||
PreviousTxnID: '038ED9ACC10211A8F6768729F36B74729CECCD33057837E160131675B272E532',
|
||||
PreviousTxnLgrSeq: 11558374,
|
||||
Sequence: 931088,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '24.060765960393'
|
||||
},
|
||||
TakerPays: '1664716059',
|
||||
index: '8845F212A8B53004A14C8C029FAF51B53266C66B49281A72F6A8F41CD92FDE99',
|
||||
owner_funds: options.other_account_funds,
|
||||
quality: '69187991.0116049',
|
||||
taker_gets_funded: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '24.01284027983332'
|
||||
},
|
||||
taker_pays_funded: '1661400177'
|
||||
},
|
||||
{
|
||||
Account: addresses.THIRD_ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5C18949C764EA14E',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000009',
|
||||
PreviousTxnID: '62B96C0E0D86827BCE59ABDCAD146CC0B09404FE5BC86E712FB6F4E473016C63',
|
||||
PreviousTxnLgrSeq: 11558234,
|
||||
Sequence: 617872,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '712.60995'
|
||||
},
|
||||
TakerPays: '49304051247',
|
||||
index: '9E5C13908F67146AC35A711A17E5EB75771FDDA816C9532891DC90F29A6A4C10',
|
||||
owner_funds: options.third_account_funds,
|
||||
quality: '69187991.61729358'
|
||||
},
|
||||
{
|
||||
Account: addresses.FOURTH_ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5C18AA2E761B7EE6',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000000511',
|
||||
PreviousTxnID: 'F18AED5EC1E7529EF03AF23ADA85F7625AA308278BACE1851F336443AA3DAAEA',
|
||||
PreviousTxnLgrSeq: 11558336,
|
||||
Sequence: 662712,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '288.08'
|
||||
},
|
||||
TakerPays: '20000000000',
|
||||
index: '606B3FC9199D5122F1DCC73EC1629E40C8A838D58AC67315A78D76699D960705',
|
||||
owner_funds: options.fourth_account_funds,
|
||||
quality: '69425159.67786726'
|
||||
},
|
||||
{
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5C18C3D9EF58005A',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 0,
|
||||
LedgerEntryType: 'Offer',
|
||||
OwnerNode: '0000000000006762',
|
||||
PreviousTxnID: 'E3A0240001B03E4F16C4BA6C2B0CB00C01413BE331ABE9E782B6A975DC936618',
|
||||
PreviousTxnLgrSeq: 11558318,
|
||||
Sequence: 1689755,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: '196.460002'
|
||||
},
|
||||
TakerPays: '13694716399',
|
||||
index: '9A5D0AA37EA0889B876E9A3E552CACDB28BA5A3CD482A528992CD0CCFC09F6E8',
|
||||
quality: '69707402.31897178'
|
||||
}
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.MODIFIED_NODES = [
|
||||
{
|
||||
ModifiedNode: {
|
||||
FinalFields: {
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: 'E2B91A0A170BCC2BEC5C44B492D9B672888D9267A900330F5C08953CAA35D973',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 131072,
|
||||
OwnerNode: '0000000000000001',
|
||||
Sequence: 538,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.TAKER_GETS_FINAL
|
||||
},
|
||||
TakerPays: module.exports.TAKER_PAYS_FINAL
|
||||
},
|
||||
LedgerEntryType: 'Offer',
|
||||
LedgerIndex: module.exports.LEDGER_INDEX,
|
||||
PreviousFields: {
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.TAKER_GETS
|
||||
},
|
||||
TakerPays: module.exports.TAKER_PAYS
|
||||
},
|
||||
PreviousTxnID: '5135DF8678727A70491DE512E5F0FE586E7C1E866492293B8898BF8191CFCAEB',
|
||||
PreviousTxnLgrSeq: 11676651
|
||||
}
|
||||
},
|
||||
{
|
||||
ModifiedNode: {
|
||||
FinalFields: {
|
||||
Account: addresses.OTHER_ACCOUNT,
|
||||
BookDirectory: 'E2B91A0A170BCC2BEC5C44B492D9B672888D9267A900330F5C08953CAA35D973',
|
||||
BookNode: '0000000000000000',
|
||||
Flags: 131072,
|
||||
OwnerNode: '0000000000000001',
|
||||
Sequence: 538,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.OTHER_TAKER_GETS_FINAL
|
||||
},
|
||||
TakerPays: module.exports.OTHER_TAKER_PAYS_FINAL
|
||||
},
|
||||
LedgerEntryType: 'Offer',
|
||||
LedgerIndex: module.exports.OTHER_LEDGER_INDEX,
|
||||
PreviousFields: {
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.OTHER_TAKER_GETS
|
||||
},
|
||||
TakerPays: module.exports.OTHER_TAKER_PAYS
|
||||
},
|
||||
PreviousTxnID: '5135DF8678727A70491DE512E5F0FE586E7C1E866492293B8898BF8191CFCAEB',
|
||||
PreviousTxnLgrSeq: 11676651
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.transactionWithRippleState = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
issuer: addresses.ISSUER,
|
||||
account: addresses.ACCOUNT,
|
||||
balance: module.exports.FIAT_BALANCE
|
||||
});
|
||||
|
||||
return {
|
||||
mmeta: new Meta({
|
||||
AffectedNodes: [{
|
||||
ModifiedNode: {
|
||||
FinalFields: {
|
||||
Balance: {
|
||||
currency: 'USD',
|
||||
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||
value: options.balance
|
||||
},
|
||||
Flags: 131072,
|
||||
HighLimit: {
|
||||
currency: 'USD',
|
||||
issuer: options.issuer,
|
||||
value: '100'
|
||||
},
|
||||
HighNode: '0000000000000000',
|
||||
LowLimit: {
|
||||
currency: 'USD',
|
||||
issuer: options.account,
|
||||
value: '0'
|
||||
},
|
||||
LowNode: '0000000000000000'
|
||||
},
|
||||
PreviousFields: {
|
||||
Balance: {
|
||||
currency: 'USD',
|
||||
issuer: 'rrrrrrrrrrrrrrrrrrrrBZbvji',
|
||||
value: '0'
|
||||
}
|
||||
},
|
||||
LedgerEntryType: 'RippleState',
|
||||
LedgerIndex: 'EA4BF03B4700123CDFFB6EB09DC1D6E28D5CEB7F680FB00FC24BC1C3BB2DB959',
|
||||
PreviousTxnID: '53354D84BAE8FDFC3F4DA879D984D24B929E7FEB9100D2AD9EFCD2E126BCCDC8',
|
||||
PreviousTxnLgrSeq: 343570
|
||||
}
|
||||
}]
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithAccountRoot = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account: addresses.ACCOUNT,
|
||||
balance: module.exports.NATIVE_BALANCE,
|
||||
previous_balance: module.exports.NATIVE_BALANCE_PREVIOUS
|
||||
});
|
||||
|
||||
return {
|
||||
mmeta: new Meta({
|
||||
AffectedNodes: [{
|
||||
ModifiedNode: {
|
||||
FinalFields: {
|
||||
Account: options.account,
|
||||
Balance: options.balance,
|
||||
Flags: 0,
|
||||
OwnerCount: 1,
|
||||
Sequence: 2
|
||||
},
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
LedgerIndex: '4F83A2CF7E70F77F79A307E6A472BFC2585B806A70833CCD1C26105BAE0D6E05',
|
||||
PreviousFields: {
|
||||
Balance: options.previous_balance,
|
||||
OwnerCount: 0,
|
||||
Sequence: 1
|
||||
},
|
||||
PreviousTxnID: 'B24159F8552C355D35E43623F0E5AD965ADBF034D482421529E2703904E1EC09',
|
||||
PreviousTxnLgrSeq: 16154
|
||||
}
|
||||
}]
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithInvalidAccountRoot = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account: addresses.ACCOUNT,
|
||||
balance: module.exports.NATIVE_BALANCE,
|
||||
});
|
||||
|
||||
return {
|
||||
mmeta: new Meta({
|
||||
AffectedNodes: [{
|
||||
ModifiedNode: {
|
||||
FinalFields: {
|
||||
Account: options.account,
|
||||
Balance: options.balance,
|
||||
Flags: 0,
|
||||
OwnerCount: 3,
|
||||
Sequence: 188
|
||||
},
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
LedgerIndex: 'B33FDD5CF3445E1A7F2BE9B06336BEBD73A5E3EE885D3EF93F7E3E2992E46F1A',
|
||||
PreviousTxnID: 'E9E1988A0F061679E5D14DE77DB0163CE0BBDC00F29E396FFD1DA0366E7D8904',
|
||||
PreviousTxnLgrSeq: 195455
|
||||
}
|
||||
}]
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.transactionWithCreatedOffer = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account: addresses.ACCOUNT,
|
||||
amount: '1.9951'
|
||||
});
|
||||
|
||||
var meta = new Meta({
|
||||
AffectedNodes: [
|
||||
{
|
||||
CreatedNode: {
|
||||
LedgerEntryType: 'Offer',
|
||||
LedgerIndex: 'AF3C702057C9C47DB9E809FD8C76CD22521012C5CC7AE95D914EC9E226F1D7E5',
|
||||
NewFields: {
|
||||
Account: options.account,
|
||||
BookDirectory: '7B73A610A009249B0CC0D4311E8BA7927B5A34D86634581C5F211CEE1E0697A0',
|
||||
Flags: 131072,
|
||||
Sequence: 1404,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: options.amount
|
||||
},
|
||||
TakerPays: module.exports.TAKER_PAYS
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
meta.getAffectedBooks();
|
||||
|
||||
return {
|
||||
mmeta: meta,
|
||||
transaction: {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.transactionWithDeletedOffer = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
transaction_type: 'OfferCreate'
|
||||
});
|
||||
|
||||
var meta = new Meta({
|
||||
AffectedNodes: [
|
||||
{
|
||||
DeletedNode: {
|
||||
FinalFields: {
|
||||
Account: addresses.ACCOUNT,
|
||||
BookDirectory: '3B95C29205977C2136BBC70F21895F8C8F471C8522BF446E570463F9CDB31517',
|
||||
BookNode: '0000000000000000',
|
||||
Expiration: 477086871,
|
||||
Flags: 131072,
|
||||
OwnerNode: '0000000000000979',
|
||||
PreviousTxnID: 'DDD2AB60A2AA1690A6CB99B094BFD2E39A81AFF2AA91B5E4049D2C96A4BC8EBA',
|
||||
PreviousTxnLgrSeq: 11674760,
|
||||
Sequence: 85006,
|
||||
TakerGets: {
|
||||
currency: 'USD',
|
||||
issuer: addresses.ISSUER,
|
||||
value: module.exports.TAKER_GETS
|
||||
},
|
||||
TakerPays: module.exports.TAKER_PAYS
|
||||
},
|
||||
LedgerEntryType: 'Offer',
|
||||
LedgerIndex: module.exports.LEDGER_INDEX
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
meta.getAffectedBooks();
|
||||
|
||||
return {
|
||||
mmeta: meta,
|
||||
transaction: {
|
||||
TransactionType: options.transaction_type,
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.transactionWithModifiedOffer = function() {
|
||||
var meta = new Meta({
|
||||
AffectedNodes: module.exports.MODIFIED_NODES.slice(0, 1)
|
||||
});
|
||||
|
||||
meta.getAffectedBooks();
|
||||
|
||||
return {
|
||||
mmeta: meta,
|
||||
transaction: {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.transactionWithModifiedOffers = function() {
|
||||
var meta = new Meta({
|
||||
AffectedNodes: module.exports.MODIFIED_NODES
|
||||
});
|
||||
|
||||
meta.getAffectedBooks();
|
||||
|
||||
return {
|
||||
mmeta: meta,
|
||||
transaction: {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.transactionWithNoNodes = function() {
|
||||
var meta = new Meta({
|
||||
AffectedNodes: []
|
||||
});
|
||||
|
||||
meta.getAffectedBooks();
|
||||
|
||||
return {
|
||||
mmeta: meta,
|
||||
transaction: {
|
||||
TransactionType: 'OfferCreate',
|
||||
owner_funds: '2010.027702881682'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.accountInfoResponse = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
account: addresses.ISSUER
|
||||
});
|
||||
|
||||
return {
|
||||
account_data: {
|
||||
Account: options.account,
|
||||
Balance: '6156166959471',
|
||||
Domain: '6269747374616D702E6E6574',
|
||||
EmailHash: '5B33B93C7FFE384D53450FC666BB11FB',
|
||||
Flags: 131072,
|
||||
LedgerEntryType: 'AccountRoot',
|
||||
OwnerCount: 0,
|
||||
PreviousTxnID: '6A7D0AB36CBA6884FDC398254BC67DE7E0B4887E9B0252568391102FBB854C09',
|
||||
PreviousTxnLgrSeq: 8344426,
|
||||
Sequence: 561,
|
||||
TransferRate: module.exports.TRANSFER_RATE,
|
||||
index: 'B7D526FDDF9E3B3F95C3DC97C353065B0482302500BBB8051A5C090B596C6133',
|
||||
urlgravatar: 'http:www.gravatar.com/avatar/5b33b93c7ffe384d53450fc666bb11fb'
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -33,5 +33,4 @@ describe('Meta', function() {
|
||||
assert.strictEqual(meta.nodes[idx], curr);
|
||||
}, []);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user