mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Merge pull request #553 from darkdarkdragon/develop-master-merge
Merge OrderBook optimizations from master to develop
This commit is contained in:
17
test/fixtures/orderbook.js
vendored
17
test/fixtures/orderbook.js
vendored
@@ -1,10 +1,13 @@
|
||||
/*eslint-disable max-len, no-param-reassign*/
|
||||
/* eslint-disable max-len, no-param-reassign */
|
||||
|
||||
'use strict';
|
||||
|
||||
const _ = require('lodash');
|
||||
const addresses = require('./addresses');
|
||||
const Meta = require('ripple-lib').Meta;
|
||||
const SerializedObject = require('ripple-lib').SerializedObject;
|
||||
const Types = require('ripple-lib').types;
|
||||
const IOUValue = require('ripple-lib')._test.IOUValue;
|
||||
|
||||
module.exports.FIAT_BALANCE = '10';
|
||||
module.exports.NATIVE_BALANCE = '55';
|
||||
@@ -809,6 +812,7 @@ module.exports.transactionWithInvalidAccountRoot = function(options) {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
module.exports.transactionWithCreatedOffer = function(options) {
|
||||
options = options || {};
|
||||
_.defaults(options, {
|
||||
@@ -816,6 +820,15 @@ module.exports.transactionWithCreatedOffer = function(options) {
|
||||
amount: '1.9951'
|
||||
});
|
||||
|
||||
const takerGets = new IOUValue(options.amount);
|
||||
const takerPays = new IOUValue(module.exports.TAKER_PAYS);
|
||||
const quality = takerPays.divide(takerGets);
|
||||
|
||||
const so = new SerializedObject();
|
||||
Types.Quality.serialize(so, quality);
|
||||
|
||||
const BookDirectory = so.to_hex();
|
||||
|
||||
const meta = new Meta({
|
||||
AffectedNodes: [
|
||||
{
|
||||
@@ -824,7 +837,7 @@ module.exports.transactionWithCreatedOffer = function(options) {
|
||||
LedgerIndex: 'AF3C702057C9C47DB9E809FD8C76CD22521012C5CC7AE95D914EC9E226F1D7E5',
|
||||
NewFields: {
|
||||
Account: options.account,
|
||||
BookDirectory: '7B73A610A009249B0CC0D4311E8BA7927B5A34D86634581C5F211CEE1E0697A0',
|
||||
BookDirectory: BookDirectory,
|
||||
Flags: 131072,
|
||||
Sequence: 1404,
|
||||
TakerGets: {
|
||||
|
||||
Reference in New Issue
Block a user