fix missing deliveredAmount data from getLedger requests

This commit is contained in:
Matthew Fettig
2016-07-19 21:29:50 -07:00
committed by Chris Clark
parent eeb6e6b39d
commit f811bd6c2d
10 changed files with 1249 additions and 17 deletions

View File

@@ -1,13 +1,15 @@
/* @flow */
'use strict';
'use strict'; // eslint-disable-line
const _ = require('lodash');
const {removeUndefined, rippleTimeToISO8601} = require('./utils');
const parseTransaction = require('./transaction');
import type {GetLedger} from '../types.js';
function parseTransactionWrapper(ledgerVersion, tx) {
const transaction = _.assign({}, _.omit(tx, 'metaData'),
{meta: tx.metaData});
const transaction = _.assign({}, _.omit(tx, 'metaData'), {
meta: tx.metaData,
ledger_index: ledgerVersion
});
const result = parseTransaction(transaction);
if (!result.outcome.ledgerVersion) {
result.outcome.ledgerVersion = ledgerVersion;

View File

@@ -1,5 +1,5 @@
/* @flow */
'use strict';
'use strict'; // eslint-disable-line
const _ = require('lodash');
const transactionParser = require('ripple-lib-transactionparser');
const utils = require('../utils');
@@ -56,19 +56,43 @@ function isPartialPayment(tx) {
}
function parseDeliveredAmount(tx: Object): Amount | void {
let deliveredAmount;
// TODO: Workaround for existing rippled bug where delivered_amount may not be
// provided for account_tx
if (tx.TransactionType === 'Payment') {
if (tx.meta.delivered_amount) {
deliveredAmount = parseAmount(tx.meta.delivered_amount);
} else if (tx.Amount && !isPartialPayment(tx)) {
deliveredAmount = parseAmount(tx.Amount);
}
if (tx.TransactionType !== 'Payment' ||
tx.meta.TransactionResult !== 'tesSUCCESS') {
return undefined;
}
return deliveredAmount;
if (tx.meta.delivered_amount &&
tx.meta.delivered_amount === 'unavailable') {
return undefined;
}
// parsable delivered_amount
if (tx.meta.delivered_amount) {
return parseAmount(tx.meta.delivered_amount);
}
// DeliveredAmount only present on partial payments
if (tx.meta.DeliveredAmount) {
return parseAmount(tx.meta.DeliveredAmount);
}
// no partial payment flag, use tx.Amount
if (tx.Amount && !isPartialPayment(tx)) {
return parseAmount(tx.Amount);
}
// DeliveredAmount field was introduced at
// ledger 4594095 - after that point its absence
// on a tx flagged as partial payment indicates
// the full amount was transferred. The amount
// transferred with a partial payment before
// that date must be derived from metadata.
if (tx.Amount && tx.ledger_index > 4594094) {
return parseAmount(tx.Amount);
}
return undefined;
}
function parseOutcome(tx: Object): ?Object {

View File

@@ -1171,6 +1171,28 @@ describe('RippleAPI', function() {
_.partial(checkResult, responses.getLedger.withSettingsTx, 'getLedger'));
});
it('getLedger - with partial payment', function() {
const request = {
includeTransactions: true,
includeAllData: true,
ledgerVersion: 100000
};
return this.api.getLedger(request).then(
_.partial(checkResult, responses.getLedger.withPartial, 'getLedger'));
});
it('getLedger - pre 2014 with partial payment', function() {
const request = {
includeTransactions: true,
includeAllData: true,
ledgerVersion: 100001
};
return this.api.getLedger(request).then(
_.partial(checkResult,
responses.getLedger.pre2014withPartial,
'getLedger'));
});
it('getLedger - full, then computeLedgerHash', function() {
const request = {
includeTransactions: true,

View File

@@ -0,0 +1,79 @@
{
"stateHash": "334EE5F2209538C3099E133D25725E5BFEB40A198EA7028E6317F13E95D533DF",
"closeTime": "2016-07-07T16:53:51.000Z",
"closeTimeResolution": 10,
"closeFlags": 0,
"ledgerHash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"ledgerVersion": 12345,
"parentLedgerHash": "4F636662B714CD9CCE965E9C23BB2E1058A2DF496F5A2416299317AE03F1CD35",
"parentCloseTime": "2016-07-07T16:53:50.000Z",
"totalDrops": "99997302532397566",
"transactionHash": "C72A2BDCB471F3AEEB917ABC6019407CAE6DA4B858903A8AB2335A0EB077125D",
"transactions": [
{
"type": "payment",
"address": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"sequence": 23295,
"id": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"specification": {
"source": {
"address": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"maxAmount": {
"currency": "USD",
"value": "10",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
"destination": {
"address": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"amount": {
"currency": "USD",
"value": "10",
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
"allowPartialPayment": true
},
"outcome": {
"result": "tesSUCCESS",
"fee": "0.01",
"balanceChanges": {
"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX": [
{
"currency": "XRP",
"value": "-0.01"
},
{
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"currency": "USD",
"value": "-10"
}
],
"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B": [
{
"counterparty": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"currency": "USD",
"value": "-9.980039920159681"
},
{
"counterparty": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"currency": "USD",
"value": "10"
}
],
"rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4": [
{
"counterparty": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"currency": "USD",
"value": "9.980039920159681"
}
]
},
"orderbookChanges": {},
"ledgerVersion": 12345,
"indexInLedger": 1
}
}
],
"rawTransactions": "[{\"Account\":\"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX\",\"Amount\":{\"currency\":\"USD\",\"issuer\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\",\"value\":\"10\"},\"Destination\":\"rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4\",\"Fee\":\"10000\",\"Flags\":131072,\"Sequence\":23295,\"SigningPubKey\":\"02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53\",\"TransactionType\":\"Payment\",\"TxnSignature\":\"3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D\",\"hash\":\"A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A\",\"metaData\":{\"AffectedNodes\":[{\"ModifiedNode\":{\"FinalFields\":{\"Account\":\"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX\",\"Balance\":\"1930599790\",\"Flags\":0,\"OwnerCount\":2,\"Sequence\":23296},\"LedgerEntryType\":\"AccountRoot\",\"LedgerIndex\":\"267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD\",\"PreviousFields\":{\"Balance\":\"1930609790\",\"Sequence\":23295},\"PreviousTxnID\":\"0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD\",\"PreviousTxnLgrSeq\":22419806}},{\"ModifiedNode\":{\"FinalFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-9.980959751659681\"},\"Flags\":2228224,\"HighLimit\":{\"currency\":\"USD\",\"issuer\":\"rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4\",\"value\":\"1000000\"},\"HighNode\":\"0000000000000000\",\"LowLimit\":{\"currency\":\"USD\",\"issuer\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\",\"value\":\"0\"},\"LowNode\":\"0000000000000423\"},\"LedgerEntryType\":\"RippleState\",\"LedgerIndex\":\"C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5\",\"PreviousFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-0.0009198315\"}},\"PreviousTxnID\":\"2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869\",\"PreviousTxnLgrSeq\":22420532}},{\"ModifiedNode\":{\"FinalFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-276666.975959\"},\"Flags\":131072,\"HighLimit\":{\"currency\":\"USD\",\"issuer\":\"rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX\",\"value\":\"1000000\"},\"HighNode\":\"0000000000000000\",\"LowLimit\":{\"currency\":\"USD\",\"issuer\":\"rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B\",\"value\":\"0\"},\"LowNode\":\"00000000000002D7\"},\"LedgerEntryType\":\"RippleState\",\"LedgerIndex\":\"FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615\",\"PreviousFields\":{\"Balance\":{\"currency\":\"USD\",\"issuer\":\"rrrrrrrrrrrrrrrrrrrrBZbvji\",\"value\":\"-276676.975959\"}},\"PreviousTxnID\":\"BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B\",\"PreviousTxnLgrSeq\":22419307}}],\"TransactionIndex\":1,\"TransactionResult\":\"tesSUCCESS\"}}]"
}

File diff suppressed because one or more lines are too long

View File

@@ -59,7 +59,9 @@ module.exports = {
header: require('./get-ledger'),
full: require('./get-ledger-full'),
withSettingsTx: require('./get-ledger-with-settings-tx'),
withStateAsHashes: require('./get-ledger-with-state-as-hashes')
withStateAsHashes: require('./get-ledger-with-state-as-hashes'),
withPartial: require('./get-ledger-with-partial-payment'),
pre2014withPartial: require('./get-ledger-pre2014-with-partial')
},
prepareOrder: {
buy: require('./prepare-order.json'),

View File

@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line
'use strict'; // eslint-disable-line
module.exports = {
submit: {
@@ -10,7 +10,9 @@ module.exports = {
notFound: require('./ledger-not-found'),
withoutCloseTime: require('./ledger-without-close-time'),
withSettingsTx: require('./ledger-with-settings-tx'),
withStateAsHashes: require('./ledger-with-state-as-hashes')
withStateAsHashes: require('./ledger-with-state-as-hashes'),
withPartialPayment: require('./ledger-with-partial-payment'),
pre2014withPartial: require('./ledger-pre2014-with-partial')
},
empty: require('./empty'),
subscribe: require('./subscribe'),

View File

@@ -0,0 +1,141 @@
{
"id": 1,
"status": "success",
"type": "response",
"result": {
"ledger": {
"accepted": true,
"account_hash": "334EE5F2209538C3099E133D25725E5BFEB40A198EA7028E6317F13E95D533DF",
"close_flags": 0,
"close_time": 521225631,
"close_time_human": "2016-Jul-07 16:53:51",
"close_time_resolution": 10,
"closed": true,
"hash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"ledger_hash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"ledger_index": "12345",
"parent_close_time": 521225630,
"parent_hash": "4F636662B714CD9CCE965E9C23BB2E1058A2DF496F5A2416299317AE03F1CD35",
"seqNum": "22420574",
"totalCoins": "99997302532397566",
"total_coins": "99997302532397566",
"transaction_hash": "C72A2BDCB471F3AEEB917ABC6019407CAE6DA4B858903A8AB2335A0EB077125D",
"transactions": [
{
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "10"
},
"Destination": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"Fee": "10000",
"Flags": 131072,
"Sequence": 23295,
"SigningPubKey": "02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53",
"TransactionType": "Payment",
"TxnSignature": "3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D",
"hash": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"metaData": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Balance": "1930599790",
"Flags": 0,
"OwnerCount": 2,
"Sequence": 23296
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD",
"PreviousFields": {
"Balance": "1930609790",
"Sequence": 23295
},
"PreviousTxnID": "0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD",
"PreviousTxnLgrSeq": 22419806
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-9.980959751659681"
},
"Flags": 2228224,
"HighLimit": {
"currency": "USD",
"issuer": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "0000000000000423"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-0.0009198315"
}
},
"PreviousTxnID": "2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869",
"PreviousTxnLgrSeq": 22420532
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276666.975959"
},
"Flags": 131072,
"HighLimit": {
"currency": "USD",
"issuer": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "00000000000002D7"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276676.975959"
}
},
"PreviousTxnID": "BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B",
"PreviousTxnLgrSeq": 22419307
}
}
],
"TransactionIndex": 1,
"TransactionResult": "tesSUCCESS"
}
}
]
},
"ledger_hash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"ledger_index": 12345,
"validated": true
}
}

View File

@@ -0,0 +1,600 @@
{
"id": 1,
"status": "success",
"type": "response",
"result": {
"ledger": {
"accepted": true,
"account_hash": "334EE5F2209538C3099E133D25725E5BFEB40A198EA7028E6317F13E95D533DF",
"close_flags": 0,
"close_time": 521225631,
"close_time_human": "2016-Jul-07 16:53:51",
"close_time_resolution": 10,
"closed": true,
"hash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"ledger_hash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"ledger_index": "22420574",
"parent_close_time": 521225630,
"parent_hash": "4F636662B714CD9CCE965E9C23BB2E1058A2DF496F5A2416299317AE03F1CD35",
"seqNum": "22420574",
"totalCoins": "99997302532397566",
"total_coins": "99997302532397566",
"transaction_hash": "C72A2BDCB471F3AEEB917ABC6019407CAE6DA4B858903A8AB2335A0EB077125D",
"transactions": [
{
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "10"
},
"Destination": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"Fee": "10000",
"Flags": 131072,
"Sequence": 23295,
"SigningPubKey": "02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53",
"TransactionType": "Payment",
"TxnSignature": "3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D",
"hash": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"metaData": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Balance": "1930599790",
"Flags": 0,
"OwnerCount": 2,
"Sequence": 23296
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD",
"PreviousFields": {
"Balance": "1930609790",
"Sequence": 23295
},
"PreviousTxnID": "0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD",
"PreviousTxnLgrSeq": 22419806
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-9.980959751659681"
},
"Flags": 2228224,
"HighLimit": {
"currency": "USD",
"issuer": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "0000000000000423"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-0.0009198315"
}
},
"PreviousTxnID": "2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869",
"PreviousTxnLgrSeq": 22420532
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276666.975959"
},
"Flags": 131072,
"HighLimit": {
"currency": "USD",
"issuer": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "00000000000002D7"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276676.975959"
}
},
"PreviousTxnID": "BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B",
"PreviousTxnLgrSeq": 22419307
}
}
],
"DeliveredAmount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "9.980039920159681"
},
"TransactionIndex": 1,
"TransactionResult": "tesSUCCESS"
}
},
{
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "10"
},
"Destination": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"Fee": "10000",
"Flags": 131072,
"Sequence": 23295,
"SigningPubKey": "02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53",
"TransactionType": "Payment",
"TxnSignature": "3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D",
"hash": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"metaData": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Balance": "1930599790",
"Flags": 0,
"OwnerCount": 2,
"Sequence": 23296
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD",
"PreviousFields": {
"Balance": "1930609790",
"Sequence": 23295
},
"PreviousTxnID": "0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD",
"PreviousTxnLgrSeq": 22419806
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-9.980959751659681"
},
"Flags": 2228224,
"HighLimit": {
"currency": "USD",
"issuer": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "0000000000000423"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-0.0009198315"
}
},
"PreviousTxnID": "2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869",
"PreviousTxnLgrSeq": 22420532
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276666.975959"
},
"Flags": 131072,
"HighLimit": {
"currency": "USD",
"issuer": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "00000000000002D7"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276676.975959"
}
},
"PreviousTxnID": "BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B",
"PreviousTxnLgrSeq": 22419307
}
}
],
"delivered_amount": "unavailable",
"TransactionIndex": 2,
"TransactionResult": "tesSUCCESS"
}
},
{
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "10"
},
"Destination": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"Fee": "10000",
"Flags": 131072,
"Sequence": 23295,
"SigningPubKey": "02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53",
"TransactionType": "Payment",
"TxnSignature": "3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D",
"hash": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"metaData": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Balance": "1930599790",
"Flags": 0,
"OwnerCount": 2,
"Sequence": 23296
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD",
"PreviousFields": {
"Balance": "1930609790",
"Sequence": 23295
},
"PreviousTxnID": "0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD",
"PreviousTxnLgrSeq": 22419806
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-9.980959751659681"
},
"Flags": 2228224,
"HighLimit": {
"currency": "USD",
"issuer": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "0000000000000423"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-0.0009198315"
}
},
"PreviousTxnID": "2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869",
"PreviousTxnLgrSeq": 22420532
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276666.975959"
},
"Flags": 131072,
"HighLimit": {
"currency": "USD",
"issuer": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "00000000000002D7"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276676.975959"
}
},
"PreviousTxnID": "BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B",
"PreviousTxnLgrSeq": 22419307
}
}
],
"DeliveredAmount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "9.980039920159681"
},
"delivered_amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "9.980039920159681"
},
"TransactionIndex": 3,
"TransactionResult": "tesSUCCESS"
}
},
{
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "10"
},
"Destination": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"Fee": "10000",
"Flags": 131072,
"Sequence": 23295,
"SigningPubKey": "02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53",
"TransactionType": "Payment",
"TxnSignature": "3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D",
"hash": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"metaData": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Balance": "1930599790",
"Flags": 0,
"OwnerCount": 2,
"Sequence": 23296
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD",
"PreviousFields": {
"Balance": "1930609790",
"Sequence": 23295
},
"PreviousTxnID": "0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD",
"PreviousTxnLgrSeq": 22419806
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-9.980959751659681"
},
"Flags": 2228224,
"HighLimit": {
"currency": "USD",
"issuer": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "0000000000000423"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-0.0009198315"
}
},
"PreviousTxnID": "2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869",
"PreviousTxnLgrSeq": 22420532
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276666.975959"
},
"Flags": 131072,
"HighLimit": {
"currency": "USD",
"issuer": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "00000000000002D7"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276676.975959"
}
},
"PreviousTxnID": "BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B",
"PreviousTxnLgrSeq": 22419307
}
}
],
"TransactionIndex": 4,
"TransactionResult": "tesSUCCESS"
}
},
{
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Amount": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "10"
},
"Destination": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"Fee": "10000",
"Flags": 0,
"Sequence": 23295,
"SigningPubKey": "02B205F4B92351AC0EEB04254B636F4C49EF922CFA3CAAD03C6477DA1E04E94B53",
"TransactionType": "Payment",
"TxnSignature": "3045022100FAF247A836D601DE74A515B2AADE31186D8B0DA9C23DE489E09753F5CF4BB81F0220477C5B5BC3AC89F2347744F9E00CCA62267E198489D747578162C4C7D156211D",
"hash": "A0A074D10355223CBE2520A42F93A52E3CC8B4D692570EB4841084F9BBB39F7A",
"metaData": {
"AffectedNodes": [
{
"ModifiedNode": {
"FinalFields": {
"Account": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"Balance": "1930599790",
"Flags": 0,
"OwnerCount": 2,
"Sequence": 23296
},
"LedgerEntryType": "AccountRoot",
"LedgerIndex": "267C16D24EC42EEF8B03D5BE4E94266B1675FA54AFCE42DE795E02AB61031CBD",
"PreviousFields": {
"Balance": "1930609790",
"Sequence": 23295
},
"PreviousTxnID": "0F5396388E91D37BB26C8E24073A57E7C5D51E79AEE4CD855653B8499AE4E3DD",
"PreviousTxnLgrSeq": 22419806
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-9.980959751659681"
},
"Flags": 2228224,
"HighLimit": {
"currency": "USD",
"issuer": "rNNuQMuExCiEjeZ4h9JJnj5PSWypdMXDj4",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "0000000000000423"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "C66957AF25229357F9C2D2BA17CE47D88169788EDA7610AD0F29AD5BCB225EE5",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-0.0009198315"
}
},
"PreviousTxnID": "2A01E994D7000000B43DD63825A081B4440A44AB2F6FA0D506158AC9CA6B2869",
"PreviousTxnLgrSeq": 22420532
}
},
{
"ModifiedNode": {
"FinalFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276666.975959"
},
"Flags": 131072,
"HighLimit": {
"currency": "USD",
"issuer": "rGFuMiw48HdbnrUbkRYuitXTmfrDBNTCnX",
"value": "1000000"
},
"HighNode": "0000000000000000",
"LowLimit": {
"currency": "USD",
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"value": "0"
},
"LowNode": "00000000000002D7"
},
"LedgerEntryType": "RippleState",
"LedgerIndex": "FFD710AE2074A98D920D00CC352F25744899F069A6C1B9E31DD32D2C6606E615",
"PreviousFields": {
"Balance": {
"currency": "USD",
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
"value": "-276676.975959"
}
},
"PreviousTxnID": "BB9DFC87E9D4ED09CA2726DDFE83A4A396ED0D6545536322DE17CDACF45C0D5B",
"PreviousTxnLgrSeq": 22419307
}
}
],
"TransactionIndex": 5,
"TransactionResult": "tesSUCCESS"
}
}
]
},
"ledger_hash": "4F6C0495378FF68A15749C0D51D097EB638DA70319FDAC7A97A27CE63E0BFFED",
"validated": true
}
}

View File

@@ -205,6 +205,12 @@ module.exports = function createMockRippled(port) {
createLedgerResponse(request, fixtures.ledger.withoutCloseTime));
} else if (request.ledger_index === 4181996) {
conn.send(createLedgerResponse(request, fixtures.ledger.withSettingsTx));
} else if (request.ledger_index === 100000) {
conn.send(
createLedgerResponse(request, fixtures.ledger.withPartialPayment));
} else if (request.ledger_index === 100001) {
conn.send(
createLedgerResponse(request, fixtures.ledger.pre2014withPartial));
} else if (request.ledger_index === 38129) {
const response = _.assign({}, fixtures.ledger.normal,
{result: {ledger: fullLedger}});