Convert getAccountTransactions

This commit is contained in:
Chris Clark
2015-06-16 18:47:43 -07:00
parent ff6ac0333c
commit 8f37438a08
21 changed files with 514 additions and 229 deletions

View File

@@ -1,18 +1,19 @@
/* @flow */
'use strict';
const _ = require('lodash');
const transactionParser = require('ripple-lib-transactionparser');
const toTimestamp = require('../../../core/utils').toTimestamp;
const utils = require('../utils');
function parseTimestamp(tx) {
function parseTimestamp(tx: {date: string}): string | void {
return tx.date ? (new Date(toTimestamp(tx.date))).toISOString() : undefined;
}
function removeUndefined(obj) {
function removeUndefined(obj: ?Object): ?Object {
return obj ? _.omit(obj, _.isUndefined) : obj;
}
function parseOutcome(tx) {
function parseOutcome(tx: Object): ?Object {
if (!tx.validated) {
return undefined;
}
@@ -27,6 +28,7 @@ function parseOutcome(tx) {
balanceChanges: balanceChanges,
orderbookChanges: orderbookChanges,
ledgerVersion: tx.ledger_index,
indexInLedger: tx.meta.TransactionIndex,
sequence: tx.Sequence
};
}