mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
Fix makerExchangeRate for getOrders when rippled provides quality
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* @flow */
|
||||
'use strict';
|
||||
'use strict'; // eslint-disable-line strict
|
||||
const utils = require('./utils');
|
||||
const flags = require('./flags').orderFlags;
|
||||
const parseAmount = require('./amount');
|
||||
@@ -31,11 +31,14 @@ function parseAccountOrder(address: string, order: Object): Object {
|
||||
expirationTime: utils.parseTimestamp(order.expiration)
|
||||
});
|
||||
|
||||
const makerExchangeRate = order.quality ?
|
||||
utils.adjustQualityForXRP(order.quality.toString(),
|
||||
takerGetsAmount.currency, takerPaysAmount.currency) :
|
||||
computeQuality(takerGetsAmount, takerPaysAmount);
|
||||
const properties = {
|
||||
maker: address,
|
||||
sequence: order.seq,
|
||||
makerExchangeRate: order.quality ? order.quality.toString()
|
||||
: computeQuality(takerGetsAmount, takerPaysAmount)
|
||||
makerExchangeRate: makerExchangeRate
|
||||
};
|
||||
|
||||
return {specification, properties};
|
||||
|
||||
3
test/fixtures/rippled/account-offers.js
vendored
3
test/fixtures/rippled/account-offers.js
vendored
@@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
'use strict'; // eslint-disable-line strict
|
||||
const _ = require('lodash');
|
||||
const addresses = require('../addresses');
|
||||
|
||||
@@ -160,6 +160,7 @@ module.exports = function(request, options = {}) {
|
||||
{
|
||||
'flags': 0,
|
||||
'seq': 814018,
|
||||
'quality': '16922629533.64839',
|
||||
'taker_gets': {
|
||||
'currency': 'NZD',
|
||||
'issuer': 'rsP3mgGb2tcYUrxiLFiHJiQXhsziegtwBc',
|
||||
|
||||
Reference in New Issue
Block a user