aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/refresh.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-02-22 11:33:32 +0100
committerFlorian Dold <florian@dold.me>2024-02-27 14:58:36 +0100
commit2ab4ad686380b3cfe5c5245312e42af8a69c01f6 (patch)
treee82af5ea7defbc4bdd7b468f714212041914dc59 /packages/taler-wallet-core/src/refresh.ts
parent41f34031ae934e8c802cdbb73fffb5a39c9c6a68 (diff)
downloadwallet-core-dev/dold/observability.tar.gz
wallet-core-dev/dold/observability.tar.bz2
wallet-core-dev/dold/observability.zip
move operation out of ws
Diffstat (limited to 'packages/taler-wallet-core/src/refresh.ts')
-rw-r--r--packages/taler-wallet-core/src/refresh.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/refresh.ts b/packages/taler-wallet-core/src/refresh.ts
index f1ee84f3e..cc5eff12c 100644
--- a/packages/taler-wallet-core/src/refresh.ts
+++ b/packages/taler-wallet-core/src/refresh.ts
@@ -99,7 +99,11 @@ import {
constructTransactionIdentifier,
notifyTransition,
} from "./transactions.js";
-import { EXCHANGE_COINS_LOCK, InternalWalletState } from "./wallet.js";
+import {
+ EXCHANGE_COINS_LOCK,
+ getDenomInfo,
+ InternalWalletState,
+} from "./wallet.js";
import { getCandidateWithdrawalDenomsTx } from "./withdraw.js";
const logger = new Logger("refresh.ts");
@@ -378,7 +382,7 @@ async function provideRefreshSession(
const { availableAmount, availableDenoms } = await ws.db.runReadOnlyTx(
["denominations"],
async (tx) => {
- const oldDenom = await ws.getDenomInfo(
+ const oldDenom = await getDenomInfo(
ws,
tx,
exch.exchangeBaseUrl,
@@ -516,7 +520,7 @@ async function refreshMelt(
const oldCoin = await tx.coins.get(refreshGroup.oldCoinPubs[coinIndex]);
checkDbInvariant(!!oldCoin, "melt coin doesn't exist");
- const oldDenom = await ws.getDenomInfo(
+ const oldDenom = await getDenomInfo(
ws,
tx,
oldCoin.exchangeBaseUrl,
@@ -530,7 +534,7 @@ async function refreshMelt(
const newCoinDenoms: RefreshNewDenomInfo[] = [];
for (const dh of refreshSession.newDenoms) {
- const newDenom = await ws.getDenomInfo(
+ const newDenom = await getDenomInfo(
ws,
tx,
oldCoin.exchangeBaseUrl,
@@ -819,7 +823,7 @@ async function refreshReveal(
const oldCoin = await tx.coins.get(refreshGroup.oldCoinPubs[coinIndex]);
checkDbInvariant(!!oldCoin, "melt coin doesn't exist");
- const oldDenom = await ws.getDenomInfo(
+ const oldDenom = await getDenomInfo(
ws,
tx,
oldCoin.exchangeBaseUrl,
@@ -833,7 +837,7 @@ async function refreshReveal(
const newCoinDenoms: RefreshNewDenomInfo[] = [];
for (const dh of refreshSession.newDenoms) {
- const newDenom = await ws.getDenomInfo(
+ const newDenom = await getDenomInfo(
ws,
tx,
oldCoin.exchangeBaseUrl,
@@ -1162,7 +1166,7 @@ export async function calculateRefreshOutput(
for (const ocp of oldCoinPubs) {
const coin = await tx.coins.get(ocp.coinPub);
checkDbInvariant(!!coin, "coin must be in database");
- const denom = await ws.getDenomInfo(
+ const denom = await getDenomInfo(
ws,
tx,
coin.exchangeBaseUrl,
@@ -1210,7 +1214,7 @@ async function applyRefresh(
for (const ocp of oldCoinPubs) {
const coin = await tx.coins.get(ocp.coinPub);
checkDbInvariant(!!coin, "coin must be in database");
- const denom = await ws.getDenomInfo(
+ const denom = await getDenomInfo(
ws,
tx,
coin.exchangeBaseUrl,
@@ -1420,7 +1424,7 @@ export async function forceRefresh(
if (!coin) {
throw Error(`coin (pubkey ${c}) not found`);
}
- const denom = await ws.getDenomInfo(
+ const denom = await getDenomInfo(
ws,
tx,
coin.exchangeBaseUrl,