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/wallet.ts | |
parent | c019f4c040e82baebdbbda8208f10be2fbc19566 (diff) | |
download | wallet-core-6f2b03021d7946a61d6b8e53dbba7fc10e5f9a4d.tar.gz wallet-core-6f2b03021d7946a61d6b8e53dbba7fc10e5f9a4d.tar.bz2 wallet-core-6f2b03021d7946a61d6b8e53dbba7fc10e5f9a4d.zip |
wallet-core: exchange management cleanup
Diffstat (limited to 'packages/taler-wallet-core/src/wallet.ts')
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 154665c47..ff1f991dd 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -41,7 +41,6 @@ import { KnownBankAccounts, KnownBankAccountsInfo, Logger, - WithdrawalDetailsForAmount, MerchantUsingTemplateDetails, NotificationType, PrepareWithdrawExchangeRequest, @@ -61,6 +60,7 @@ import { ValidateIbanResponse, WalletCoreVersion, WalletNotification, + WithdrawalDetailsForAmount, codecForAbortTransaction, codecForAcceptBankIntegratedWithdrawalRequest, codecForAcceptExchangeTosRequest, @@ -157,7 +157,6 @@ import { DevExperimentHttpLib, applyDevExperiment } from "./dev-experiments.js"; import { ActiveLongpollInfo, CancelFn, - ExchangeOperations, InternalWalletState, MerchantInfo, MerchantOperations, @@ -185,10 +184,8 @@ import { } from "./operations/backup/index.js"; import { getBalanceDetail, getBalances } from "./operations/balance.js"; import { - TaskIdentifiers, TaskRunResult, TaskRunResultType, - makeExchangeListItem, runTaskWithErrorReporting, } from "./operations/common.js"; import { @@ -203,9 +200,9 @@ import { addPresetExchangeEntry, fetchFreshExchange, getExchangeDetailedInfo, - getExchangeDetails, getExchangeTos, listExchanges, + lookupExchangeByUri, updateExchangeFromUrlHandler, } from "./operations/exchanges.js"; import { getMerchantInfo } from "./operations/merchants.js"; @@ -967,32 +964,7 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( } case WalletApiOperation.GetExchangeEntryByUrl: { const req = codecForGetExchangeEntryByUrlRequest().decode(payload); - const exchangeEntry = await ws.db - .mktx((x) => [ - x.exchanges, - x.exchangeDetails, - x.denominations, - x.operationRetries, - ]) - .runReadOnly(async (tx) => { - const exchangeRec = await tx.exchanges.get(req.exchangeBaseUrl); - if (!exchangeRec) { - throw Error("exchange not found"); - } - const exchangeDetails = await getExchangeDetails( - tx, - exchangeRec.baseUrl, - ); - const opRetryRecord = await tx.operationRetries.get( - TaskIdentifiers.forExchangeUpdate(exchangeRec), - ); - return makeExchangeListItem( - exchangeRec, - exchangeDetails, - opRetryRecord?.lastError, - ); - }); - return exchangeEntry; + return lookupExchangeByUri(ws, req); } case WalletApiOperation.ListExchangesForScopedCurrency: { const req = @@ -1687,11 +1659,6 @@ class InternalWalletStateImpl implements InternalWalletState { initCalled = false; - exchangeOps: ExchangeOperations = { - getExchangeDetails, - fetchFreshExchange, - }; - recoupOps: RecoupOperations = { createRecoupGroup, }; |