diff options
author | Florian Dold <florian@dold.me> | 2024-01-08 21:43:02 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-08 21:43:02 +0100 |
commit | e9683e5ae9d3f7e6f3e16d01a280592075861548 (patch) | |
tree | 83448e83362d88781358f707940b1f386aa7d8d9 /packages/taler-wallet-core | |
parent | 6f2b03021d7946a61d6b8e53dbba7fc10e5f9a4d (diff) | |
download | wallet-core-e9683e5ae9d3f7e6f3e16d01a280592075861548.tar.xz |
wallet-core: properly filter possible exchanges for withdrawals
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 49c0e4a14..56f1d91bb 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -35,6 +35,7 @@ import { Duration, ExchangeBatchWithdrawRequest, ExchangeListItem, + ExchangeUpdateStatus, ExchangeWireAccount, ExchangeWithdrawBatchResponse, ExchangeWithdrawRequest, @@ -1945,12 +1946,21 @@ export async function getWithdrawalDetailsForUri( } } - const possibleExchangesResp = await listExchanges(ws); + const currency = Amounts.currencyOf(info.amount); + + const listExchangesResp = await listExchanges(ws); + const possibleExchanges = listExchangesResp.exchanges.filter((x) => { + return ( + x.currency === currency && + (x.exchangeUpdateStatus === ExchangeUpdateStatus.Ready || + x.exchangeUpdateStatus === ExchangeUpdateStatus.ReadyUpdate) + ); + }); return { amount: Amounts.stringify(info.amount), defaultExchangeBaseUrl: info.suggestedExchange, - possibleExchanges: possibleExchangesResp.exchanges, + possibleExchanges, }; } |