summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/withdraw.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/withdraw.ts27
1 files changed, 10 insertions, 17 deletions
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
index a54295613..c3c3c2a8e 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -146,7 +146,7 @@ import {
WALLET_BANK_INTEGRATION_PROTOCOL_VERSION,
WALLET_EXCHANGE_PROTOCOL_VERSION,
} from "./versions.js";
-import type { InternalWalletState } from "./wallet.js";
+import { getDenomInfo, type InternalWalletState } from "./wallet.js";
/**
* Logger for this file.
@@ -678,12 +678,7 @@ async function processPlanchetGenerate(
const denomPubHash = maybeDenomPubHash;
const denom = await ws.db.runReadOnlyTx(["denominations"], async (tx) => {
- return ws.getDenomInfo(
- ws,
- tx,
- withdrawalGroup.exchangeBaseUrl,
- denomPubHash,
- );
+ return getDenomInfo(ws, tx, withdrawalGroup.exchangeBaseUrl, denomPubHash);
});
checkDbInvariant(!!denom);
const r = await ws.cryptoApi.createPlanchet({
@@ -943,7 +938,7 @@ async function processPlanchetExchangeBatchRequest(
logger.warn("processPlanchet: planchet already withdrawn");
continue;
}
- const denom = await ws.getDenomInfo(
+ const denom = await getDenomInfo(
ws,
tx,
withdrawalGroup.exchangeBaseUrl,
@@ -1057,7 +1052,7 @@ async function processPlanchetVerifyAndStoreCoin(
logger.warn("processPlanchet: planchet already withdrawn");
return;
}
- const denomInfo = await ws.getDenomInfo(
+ const denomInfo = await getDenomInfo(
ws,
tx,
withdrawalGroup.exchangeBaseUrl,
@@ -1814,7 +1809,7 @@ export async function getExchangeWithdrawalInfo(
await ws.db.runReadOnlyTx(["denominations"], async (tx) => {
for (let i = 0; i < selectedDenoms.selectedDenoms.length; i++) {
const ds = selectedDenoms.selectedDenoms[i];
- const denom = await ws.getDenomInfo(
+ const denom = await getDenomInfo(
ws,
tx,
exchangeBaseUrl,
@@ -1911,7 +1906,9 @@ export interface GetWithdrawalDetailsForUriOpts {
type WithdrawalOperationMemoryMap = {
[uri: string]: boolean | undefined;
};
+
const ongoingChecks: WithdrawalOperationMemoryMap = {};
+
/**
* Get more information about a taler://withdraw URI.
*
@@ -1964,9 +1961,10 @@ export async function getWithdrawalDetailsForUri(
info.apiBaseUrl,
ws.http,
);
- console.log(
- `waiting operation (${info.operationId}) to change from pending`,
+ logger.info(
+ `waiting for operation (${info.operationId}) to change from pending`,
);
+ // FIXME: This needs a cancellation token or timeout!
bankApi
.getWithdrawalOperationById(info.operationId, {
old_state: "pending",
@@ -1980,11 +1978,6 @@ export async function getWithdrawalDetailsForUri(
2,
)}`,
);
- ws.notify({
- type: NotificationType.WithdrawalOperationTransition,
- operationId: info.operationId,
- state: resp.type === "fail" ? info.status : resp.body.status,
- });
ongoingChecks[talerWithdrawUri] = false;
});
}