From 02f1d4b08116c24f0af1f32cb6d82be292fa6d10 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 2 Jun 2021 13:23:51 +0200 Subject: support multiple exchange details per base URL --- packages/taler-wallet-core/src/operations/deposits.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-core/src/operations/deposits.ts') diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 4c87f122f..59c27b9cc 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -58,6 +58,7 @@ import { InternalWalletState } from "./state"; import { Logger } from "../util/logging.js"; import { DepositGroupRecord, Stores } from "../db.js"; import { guardOperationException } from "./errors.js"; +import { getExchangeDetails } from "./exchanges.js"; /** * Logger. @@ -308,14 +309,17 @@ export async function createDepositGroup( const allExchanges = await ws.db.iter(Stores.exchanges).toArray(); const exchangeInfos: { url: string; master_pub: string }[] = []; for (const e of allExchanges) { - if (!e.details) { - continue; - } - if (e.details.currency != amount.currency) { + const details = await ws.db.runWithReadTransaction( + [Stores.exchanges, Stores.exchangeDetails], + async (tx) => { + return getExchangeDetails(tx, e.baseUrl); + }, + ); + if (!details) { continue; } exchangeInfos.push({ - master_pub: e.details.masterPublicKey, + master_pub: details.masterPublicKey, url: e.baseUrl, }); } -- cgit v1.2.3