From b837fd7f53d885601a8c5f668da233b240387638 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 20 Jan 2020 12:00:57 +0100 Subject: be verbose for refreshes too --- src/operations/history.ts | 27 +++++++++++++++++++++++++++ src/types/history.ts | 20 ++++++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/operations/history.ts b/src/operations/history.ts index 54874f64f..97e3269e8 100644 --- a/src/operations/history.ts +++ b/src/operations/history.ts @@ -37,6 +37,7 @@ import { ReserveCreationDetail, VerbosePayCoinDetails, VerboseWithdrawDetails, + VerboseRefreshDetails, } from "../types/history"; import { assertUnreachable } from "../util/assertUnreachable"; import { TransactionHandle, Store } from "../util/query"; @@ -329,6 +330,31 @@ export async function getHistory( } else { amountRefreshedEffective = Amounts.sum(amountsEffective).amount; } + const outputCoins: { + value: string; + denomPub: string, + }[] = []; + for (const rs of rg.refreshSessionPerCoin) { + if (!rs) { + continue; + } + for (const nd of rs.newDenoms) { + if (!nd) { + continue; + } + const d = await tx.get(Stores.denominations, [rs.exchangeBaseUrl, nd]); + if (!d) { + continue; + } + outputCoins.push({ + denomPub: d.denomPub, + value: Amounts.toString(d.value), + }); + } + } + const verboseDetails: VerboseRefreshDetails = { + outputCoins: outputCoins, + } history.push({ type: HistoryEventType.Refreshed, refreshGroupId: rg.refreshGroupId, @@ -340,6 +366,7 @@ export async function getHistory( numInputCoins, numOutputCoins, numRefreshedInputCoins, + verboseDetails, }); }); diff --git a/src/types/history.ts b/src/types/history.ts index 7acf84dc5..ad7d98df0 100644 --- a/src/types/history.ts +++ b/src/types/history.ts @@ -466,12 +466,11 @@ export interface HistoryPaymentAbortedEvent { } export interface VerbosePayCoinDetails { - coins: - { - value: string, - contribution: string; - denomPub: string; - }[], + coins: { + value: string; + contribution: string; + denomPub: string; + }[]; } /** @@ -549,6 +548,13 @@ export interface HistoryRefunded { amountRefundedEffective: string; } +export interface VerboseRefreshDetails { + outputCoins: { + denomPub: string; + value: string; + }[]; +} + /** * Event to indicate that a group of refresh sessions has completed. */ @@ -583,6 +589,8 @@ export interface HistoryRefreshedEvent { * more refresh session IDs. */ refreshGroupId: string; + + verboseDetails: VerboseRefreshDetails; } export interface VerboseWithdrawDetails { -- cgit v1.2.3