summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/reserves.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-11-19 14:46:32 -0300
committerSebastian <sebasjm@gmail.com>2021-11-19 14:51:35 -0300
commit60cfb0e78f3afed92f315c1394da717329db9564 (patch)
treeb5289f340797db23c1fb18e6f8dcd21af67511db /packages/taler-wallet-core/src/operations/reserves.ts
parent494154688607ee1bfbece5e439348a912bb1e82b (diff)
downloadwallet-core-60cfb0e78f3afed92f315c1394da717329db9564.tar.gz
wallet-core-60cfb0e78f3afed92f315c1394da717329db9564.tar.bz2
wallet-core-60cfb0e78f3afed92f315c1394da717329db9564.zip
add reservePub to the withdrawal transaction info
Diffstat (limited to 'packages/taler-wallet-core/src/operations/reserves.ts')
-rw-r--r--packages/taler-wallet-core/src/operations/reserves.ts67
1 files changed, 20 insertions, 47 deletions
diff --git a/packages/taler-wallet-core/src/operations/reserves.ts b/packages/taler-wallet-core/src/operations/reserves.ts
index 4b5862bef..43e0d7d36 100644
--- a/packages/taler-wallet-core/src/operations/reserves.ts
+++ b/packages/taler-wallet-core/src/operations/reserves.ts
@@ -15,62 +15,36 @@
*/
import {
- CreateReserveRequest,
- CreateReserveResponse,
- TalerErrorDetails,
- AcceptWithdrawalResponse,
- Amounts,
- codecForBankWithdrawalOperationPostResponse,
+ AcceptWithdrawalResponse, addPaytoQueryParams, Amounts, canonicalizeBaseUrl, codecForBankWithdrawalOperationPostResponse,
codecForReserveStatus,
- codecForWithdrawOperationStatusResponse,
- Duration,
+ codecForWithdrawOperationStatusResponse, CreateReserveRequest,
+ CreateReserveResponse, Duration,
durationMax,
- durationMin,
- getTimestampNow,
- NotificationType,
- ReserveTransactionType,
- TalerErrorCode,
- addPaytoQueryParams,
+ durationMin, encodeCrock, getRandomBytes, getTimestampNow, Logger, NotificationType, randomBytes, ReserveTransactionType,
+ TalerErrorCode, TalerErrorDetails, URL
} from "@gnu-taler/taler-util";
-import { randomBytes } from "@gnu-taler/taler-util";
+import { InternalWalletState } from "../common.js";
import {
- ReserveRecordStatus,
ReserveBankInfo,
- ReserveRecord,
- WithdrawalGroupRecord,
- WalletStoresV1,
+ ReserveRecord, ReserveRecordStatus, WalletStoresV1, WithdrawalGroupRecord
} from "../db.js";
+import { guardOperationException, OperationFailedError } from "../errors.js";
import { assertUnreachable } from "../util/assertUnreachable.js";
-import { canonicalizeBaseUrl } from "@gnu-taler/taler-util";
import {
- initRetryInfo,
- getRetryDuration,
- updateRetryInfoTimeout,
+ readSuccessResponseJsonOrErrorCode,
+ readSuccessResponseJsonOrThrow,
+ throwUnexpectedRequestError
+} from "../util/http.js";
+import { GetReadOnlyAccess } from "../util/query.js";
+import {
+ getRetryDuration, initRetryInfo, updateRetryInfoTimeout
} from "../util/retries.js";
-import { guardOperationException, OperationFailedError } from "../errors.js";
import {
- updateExchangeFromUrl,
- getExchangePaytoUri,
- getExchangeDetails,
- getExchangeTrust,
+ getExchangeDetails, getExchangePaytoUri, getExchangeTrust, updateExchangeFromUrl
} from "./exchanges.js";
-import { InternalWalletState } from "../common.js";
import {
- updateWithdrawalDenoms,
- getCandidateWithdrawalDenoms,
- selectWithdrawalDenominations,
- denomSelectionInfoToState,
- processWithdrawGroup,
- getBankWithdrawalInfo,
+ denomSelectionInfoToState, getBankWithdrawalInfo, getCandidateWithdrawalDenoms, processWithdrawGroup, selectWithdrawalDenominations, updateWithdrawalDenoms
} from "./withdraw.js";
-import { encodeCrock, getRandomBytes } from "@gnu-taler/taler-util";
-import { Logger, URL } from "@gnu-taler/taler-util";
-import {
- readSuccessResponseJsonOrErrorCode,
- readSuccessResponseJsonOrThrow,
- throwUnexpectedRequestError,
-} from "../util/http.js";
-import { GetReadOnlyAccess } from "../util/query.js";
const logger = new Logger("reserves.ts");
@@ -540,7 +514,7 @@ async function updateReserve(
if (
resp.status === 404 &&
result.talerErrorResponse.code ===
- TalerErrorCode.EXCHANGE_RESERVES_GET_STATUS_UNKNOWN
+ TalerErrorCode.EXCHANGE_RESERVES_GET_STATUS_UNKNOWN
) {
ws.notify({
type: NotificationType.ReserveNotYetFound,
@@ -643,8 +617,7 @@ async function updateReserve(
logger.trace(
`Remaining unclaimed amount in reseve is ${Amounts.stringify(
remainingAmount,
- )} and can be withdrawn with ${
- denomSelInfo.selectedDenoms.length
+ )} and can be withdrawn with ${denomSelInfo.selectedDenoms.length
} coins`,
);
@@ -731,7 +704,7 @@ async function processReserveImpl(
case ReserveRecordStatus.REGISTERING_BANK:
await processReserveBankStatus(ws, reservePub);
return await processReserveImpl(ws, reservePub, true);
- case ReserveRecordStatus.QUERYING_STATUS:
+ case ReserveRecordStatus.QUERYING_STATUS:
const res = await updateReserve(ws, reservePub);
if (res.ready) {
return await processReserveImpl(ws, reservePub, true);