diff options
author | Florian Dold <florian@dold.me> | 2024-01-08 21:17:00 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-01-08 21:17:08 +0100 |
commit | 6f2b03021d7946a61d6b8e53dbba7fc10e5f9a4d (patch) | |
tree | 82a3985ab7267e6f4a57c0b275f1929558b5e572 /packages/taler-wallet-core/src/util/instructedAmountConversion.ts | |
parent | c019f4c040e82baebdbbda8208f10be2fbc19566 (diff) | |
download | wallet-core-6f2b03021d7946a61d6b8e53dbba7fc10e5f9a4d.tar.xz |
wallet-core: exchange management cleanup
Diffstat (limited to 'packages/taler-wallet-core/src/util/instructedAmountConversion.ts')
-rw-r--r-- | packages/taler-wallet-core/src/util/instructedAmountConversion.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/packages/taler-wallet-core/src/util/instructedAmountConversion.ts b/packages/taler-wallet-core/src/util/instructedAmountConversion.ts index 4365e6d32..caa3fdca5 100644 --- a/packages/taler-wallet-core/src/util/instructedAmountConversion.ts +++ b/packages/taler-wallet-core/src/util/instructedAmountConversion.ts @@ -33,7 +33,7 @@ import { import { DenominationRecord, InternalWalletState, - getExchangeDetails, + getExchangeWireDetailsInTx, timestampProtocolFromDb, } from "../index.js"; import { CoinInfo } from "./coinSelection.js"; @@ -61,8 +61,8 @@ function getOperationType(txType: TransactionType): OperationType { txType === TransactionType.Withdrawal ? OperationType.Credit : txType === TransactionType.Deposit - ? OperationType.Debit - : undefined; + ? OperationType.Debit + : undefined; if (!operationType) { throw Error(`operation type ${txType} not yet supported`); } @@ -155,7 +155,10 @@ async function getAvailableDenoms( filters.exchanges ?? databaseExchanges.map((e) => e.baseUrl); for (const exchangeBaseUrl of filteredExchanges) { - const exchangeDetails = await getExchangeDetails(tx, exchangeBaseUrl); + const exchangeDetails = await getExchangeWireDetailsInTx( + tx, + exchangeBaseUrl, + ); // 1.- exchange has same currency if (exchangeDetails?.currency !== currency) { continue; @@ -221,9 +224,10 @@ async function getAvailableDenoms( //4.- filter coins restricted by age if (operationType === OperationType.Credit) { // FIXME: Use denom groups instead of querying all denominations! - const ds = await tx.denominations.indexes.byExchangeBaseUrl.getAll( - exchangeBaseUrl, - ); + const ds = + await tx.denominations.indexes.byExchangeBaseUrl.getAll( + exchangeBaseUrl, + ); for (const denom of ds) { const expiresWithdraw = AbsoluteTime.fromProtocolTimestamp( timestampProtocolFromDb(denom.stampExpireWithdraw), |