taler-typescript-core

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

commit a7b347c956727d82c119dd3fa4d7ef8ec27b142e
parent 3fd51ec65de79ac50be0e927a29eeb281ce15aff
Author: Iván Ávalos <avalos@disroot.org>
Date:   Wed, 31 Jul 2024 10:02:07 -0600

wallet-core: return currency spec in response also when there is no conversion URL

Diffstat:
Mpackages/taler-wallet-core/src/withdraw.ts | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts @@ -59,6 +59,7 @@ import { NotificationType, ObservabilityEventType, PrepareBankIntegratedWithdrawalResponse, + ScopeInfo, TalerBankIntegrationHttpClient, TalerError, TalerErrorCode, @@ -135,6 +136,7 @@ import { PlanchetRecord, PlanchetStatus, WalletDbAllStoresReadOnlyTransaction, + WalletDbHelpers, WalletDbReadOnlyTransaction, WalletDbReadWriteTransaction, WalletDbStoresArr, @@ -3536,6 +3538,7 @@ async function waitWithdrawalRegistered( async function fetchAccount( wex: WalletExecutionContext, instructedAmount: AmountJson, + scopeInfo: ScopeInfo, acct: ExchangeWireAccount, reservePub: string | undefined, cancellationToken: CancellationToken, @@ -3586,6 +3589,20 @@ async function fetchAccount( } else { paytoUri = acct.payto_uri; transferAmount = Amounts.stringify(instructedAmount); + + // fetch currency specification from DB + const resp = await wex.db.runReadOnlyTx( + { + storeNames: ["currencyInfo"], + }, + async (tx) => { + return WalletDbHelpers.getCurrencyInfo(tx, scopeInfo); + }, + ); + + if (resp) { + currencySpecification = resp.currencySpec; + } } paytoUri = addPaytoQueryParams(paytoUri, { amount: Amounts.stringify(transferAmount), @@ -3630,6 +3647,7 @@ async function fetchWithdrawalAccountInfo( const acctInfo = await fetchAccount( wex, req.instructedAmount, + req.exchange.scopeInfo, acct, req.reservePub, cancellationToken,