diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-07-31 10:02:07 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-07-31 10:02:33 -0600 |
commit | a7b347c956727d82c119dd3fa4d7ef8ec27b142e (patch) | |
tree | ab08bb4b11baaddf7f6304628f356ae438152986 | |
parent | 3fd51ec65de79ac50be0e927a29eeb281ce15aff (diff) |
wallet-core: return currency spec in response also when there is no conversion URL
-rw-r--r-- | packages/taler-wallet-core/src/withdraw.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index 1d55fe08c..939070a9e 100644 --- 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, |