taler-typescript-core

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

commit dbfa3b78bea8dfa71a219f9c01ecc32a5339e154
parent 1e5abb5b2aa9545e194f6db879e7480162f6d481
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri,  1 Dec 2023 12:01:44 -0300

also query for the currency spec

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

diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -29,6 +29,7 @@ import { BankWithdrawDetails, CancellationToken, CoinStatus, + CurrencySpecification, DenomKeyType, DenomSelectionState, Duration, @@ -61,6 +62,7 @@ import { canonicalizeBaseUrl, codecForBankWithdrawalOperationPostResponse, codecForCashinConversionResponse, + codecForConversionBankConfig, codecForExchangeWithdrawBatchResponse, codecForIntegrationBankConfig, codecForReserveStatus, @@ -2600,6 +2602,7 @@ async function fetchWithdrawalAccountInfo( for (let acct of exchangeDetails.wireInfo.accounts) { let paytoUri: string; let transferAmount: AmountString | undefined = undefined; + let currencySpecification: CurrencySpecification | undefined = undefined; if (acct.conversion_url != null) { const reqUrl = new URL("cashin-rate", acct.conversion_url); reqUrl.searchParams.set( @@ -2613,6 +2616,13 @@ async function fetchWithdrawalAccountInfo( ); paytoUri = acct.payto_uri; transferAmount = resp.amount_debit; + const configUrl = new URL("config", acct.conversion_url); + const configResp = await ws.http.fetch(configUrl.href); + const configParsed = await readSuccessResponseJsonOrThrow( + configResp, + codecForConversionBankConfig(), + ); + currencySpecification = configParsed.fiat_currency_specification if (req.reservePub) { } } else { @@ -2630,6 +2640,7 @@ async function fetchWithdrawalAccountInfo( const acctInfo: WithdrawalExchangeAccountDetails = { paytoUri, transferAmount, + currencySpecification, creditRestrictions: acct.credit_restrictions, }; if (transferAmount != null) {