From 35a7b76a7d935dc2c749fd39ac80c6af1096b795 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 16 Dec 2019 16:20:45 +0100 Subject: history WIP, DB naming --- src/operations/history.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/operations/history.ts') diff --git a/src/operations/history.ts b/src/operations/history.ts index 7e985d218..eec398f37 100644 --- a/src/operations/history.ts +++ b/src/operations/history.ts @@ -201,7 +201,7 @@ export async function getHistory( }); tx.iter(Stores.withdrawalSession).forEach(wsr => { - if (wsr.finishTimestamp) { + if (wsr.timestampFinish) { history.push({ type: HistoryEventType.Withdrawn, withdrawSessionId: wsr.withdrawSessionId, @@ -212,7 +212,8 @@ export async function getHistory( amountWithdrawnEffective: Amounts.toString(wsr.totalCoinValue), amountWithdrawnRaw: Amounts.toString(wsr.rawWithdrawalAmount), exchangeBaseUrl: wsr.exchangeBaseUrl, - timestamp: wsr.finishTimestamp, + timestamp: wsr.timestampFinish, + withdrawalSource: wsr.source, }); } }); @@ -239,7 +240,7 @@ export async function getHistory( }); await tx.iter(Stores.refreshGroups).forEachAsync(async (rg) => { - if (!rg.finishedTimestamp) { + if (!rg.timestampFinished) { return; } let numInputCoins = 0; @@ -252,8 +253,8 @@ export async function getHistory( numInputCoins++; if (session) { numRefreshedInputCoins++; - amountsRaw.push(session.valueWithFee); - amountsEffective.push(session.valueOutput); + amountsRaw.push(session.amountRefreshInput); + amountsEffective.push(session.amountRefreshOutput); numOutputCoins += session.newDenoms.length; } else { const c = await tx.get(Stores.coins, rg.oldCoinPubs[i]); @@ -274,7 +275,7 @@ export async function getHistory( type: HistoryEventType.Refreshed, refreshGroupId: rg.refreshGroupId, eventId: makeEventId(HistoryEventType.Refreshed, rg.refreshGroupId), - timestamp: rg.finishedTimestamp, + timestamp: rg.timestampFinished, refreshReason: rg.reason, amountRefreshedEffective: Amounts.toString(amountRefreshedEffective), amountRefreshedRaw: Amounts.toString(amountRefreshedRaw), @@ -305,7 +306,7 @@ export async function getHistory( eventId: makeEventId(HistoryEventType.ReserveBalanceUpdated, ru.reserveUpdateId), amountExpected: ru.amountExpected, amountReserveBalance: ru.amountReserveBalance, - timestamp: reserve.created, + timestamp: reserve.timestampCreated, newHistoryTransactions: ru.newHistoryTransactions, reserveShortInfo: { exchangeBaseUrl: reserve.exchangeBaseUrl, -- cgit v1.2.3