diff options
author | Sebastian <sebasjm@gmail.com> | 2023-12-01 12:01:44 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-12-01 12:01:44 -0300 |
commit | dbfa3b78bea8dfa71a219f9c01ecc32a5339e154 (patch) | |
tree | fb6b780526b064695011f31473072e6fb9d73387 /packages | |
parent | 1e5abb5b2aa9545e194f6db879e7480162f6d481 (diff) |
also query for the currency spec
Diffstat (limited to 'packages')
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 11 |
1 files 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 index 868ac3adc..24e8d3f8f 100644 --- 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) { |