taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit f7a5cd2022eee5991eb5e2504e4d469e5470892e
parent f86ecf35c1fe9a5a94d17d1af10946cd24762f92
Author: Florian Dold <florian@dold.me>
Date:   Thu,  1 Aug 2024 01:08:23 +0200

wallet-core: report reserveClosingDelay in withdrawal tx

Diffstat:
Mpackages/taler-util/src/types-taler-wallet-transactions.ts | 12+++++++++++-
Mpackages/taler-wallet-core/src/exchanges.ts | 2++
Mpackages/taler-wallet-core/src/wallet-api-types.ts | 1+
Mpackages/taler-wallet-core/src/withdraw.ts | 10+++-------
4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/packages/taler-util/src/types-taler-wallet-transactions.ts b/packages/taler-util/src/types-taler-wallet-transactions.ts @@ -37,7 +37,11 @@ import { codecForString, codecOptional, } from "./codec.js"; -import { TalerPreciseTimestamp, TalerProtocolTimestamp } from "./time.js"; +import { + TalerPreciseTimestamp, + TalerProtocolDuration, + TalerProtocolTimestamp, +} from "./time.js"; import { AmountString, InternationalizedString, @@ -274,6 +278,12 @@ interface WithdrawalDetailsForManualTransfer { * Is the reserve ready for withdrawal? */ reserveIsReady: boolean; + + /** + * How long does the exchange wait to transfer back funds from a + * reserve? + */ + reserveClosingDelay: TalerProtocolDuration; } interface WithdrawalDetailsForTalerBankIntegrationApi { diff --git a/packages/taler-wallet-core/src/exchanges.ts b/packages/taler-wallet-core/src/exchanges.ts @@ -370,6 +370,7 @@ export interface ExchangeWireDetails { exchangeBaseUrl: string; auditors: ExchangeAuditor[]; globalFees: ExchangeGlobalFees[]; + reserveClosingDelay: TalerProtocolDuration; } export async function getExchangeWireDetailsInTx( @@ -387,6 +388,7 @@ export async function getExchangeWireDetailsInTx( exchangeBaseUrl: det.exchangeBaseUrl, auditors: det.auditors, globalFees: det.globalFees, + reserveClosingDelay: det.reserveClosingDelay, }; } diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts @@ -802,6 +802,7 @@ export type CreateDepositGroupOp = { response: CreateDepositGroupResponse; }; +// FIXME: Rename to checkDeposit, as it does not create a transaction, just computes fees! export type PrepareDepositOp = { op: WalletApiOperation.PrepareDeposit; request: PrepareDepositRequest; diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts @@ -272,6 +272,7 @@ function buildTransactionForManualWithdraw( reserveIsReady: wg.status === WithdrawalGroupStatus.Done || wg.status === WithdrawalGroupStatus.PendingReady, + reserveClosingDelay: exchangeDetails?.reserveClosingDelay ?? { d_us: 0 }, }, kycUrl: wg.kycUrl, exchangeBaseUrl: wg.exchangeBaseUrl, @@ -350,12 +351,7 @@ export class WithdrawTransactionContext implements TransactionContext { * Update the metadata of the transaction in the database. */ async updateTransactionMeta( - tx: WalletDbReadWriteTransaction< - [ - "withdrawalGroups", - "transactionsMeta", - ] - >, + tx: WalletDbReadWriteTransaction<["withdrawalGroups", "transactionsMeta"]>, ): Promise<void> { const ctx = this; const wgRecord = await tx.withdrawalGroups.get(ctx.withdrawalGroupId); @@ -3380,7 +3376,7 @@ export async function confirmWithdrawal( reservePub: withdrawalGroup.reservePub, transactionId: req.transactionId as TransactionIdStr, confirmTransferUrl: withdrawalGroup.wgInfo.bankInfo.confirmUrl, - } + }; } /**