diff options
author | Florian Dold <florian@dold.me> | 2021-06-02 13:23:51 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2021-06-02 13:24:28 +0200 |
commit | 02f1d4b08116c24f0af1f32cb6d82be292fa6d10 (patch) | |
tree | 1fbcc1675e09584a74896909e1d4d0882d10be8e /packages/taler-wallet-core/src/operations/deposits.ts | |
parent | c6c17a1c0aaa2c76616ec93df3ebe6621b547cd9 (diff) | |
download | wallet-core-02f1d4b08116c24f0af1f32cb6d82be292fa6d10.tar.xz |
support multiple exchange details per base URL
Diffstat (limited to 'packages/taler-wallet-core/src/operations/deposits.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/deposits.ts | 14 |
1 files changed, 9 insertions, 5 deletions
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, }); } |