diff options
Diffstat (limited to 'packages/taler-wallet-core/src/instructedAmountConversion.ts')
-rw-r--r-- | packages/taler-wallet-core/src/instructedAmountConversion.ts | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/packages/taler-wallet-core/src/instructedAmountConversion.ts b/packages/taler-wallet-core/src/instructedAmountConversion.ts index 2250188b7..ccad050bf 100644 --- a/packages/taler-wallet-core/src/instructedAmountConversion.ts +++ b/packages/taler-wallet-core/src/instructedAmountConversion.ts @@ -34,7 +34,7 @@ import { import { CoinInfo } from "./coinSelection.js"; import { DenominationRecord, timestampProtocolFromDb } from "./db.js"; import { getExchangeWireDetailsInTx } from "./exchanges.js"; -import { InternalWalletState } from "./wallet.js"; +import { InternalWalletState, WalletExecutionContext } from "./wallet.js"; /** * If the operation going to be plan subtracts @@ -129,14 +129,14 @@ interface AvailableCoins { * of being cached */ async function getAvailableDenoms( - ws: InternalWalletState, + wex: WalletExecutionContext, op: TransactionType, currency: string, filters: CoinsFilter = {}, ): Promise<AvailableCoins> { const operationType = getOperationType(TransactionType.Deposit); - return await ws.db.runReadOnlyTx( + return await wex.db.runReadOnlyTx( ["exchanges", "exchangeDetails", "denominations", "coinAvailability"], async (tx) => { const list: CoinInfo[] = []; @@ -328,14 +328,14 @@ function buildCoinInfoFromDenom( } export async function convertDepositAmount( - ws: InternalWalletState, + wex: WalletExecutionContext, req: ConvertAmountRequest, ): Promise<AmountResponse> { const amount = Amounts.parseOrThrow(req.amount); // const filter = getCoinsFilter(req); const denoms = await getAvailableDenoms( - ws, + wex, TransactionType.Deposit, amount.currency, {}, @@ -430,13 +430,13 @@ export function convertDepositAmountForAvailableCoins( } export async function getMaxDepositAmount( - ws: InternalWalletState, + wex: WalletExecutionContext, req: GetAmountRequest, ): Promise<AmountResponse> { // const filter = getCoinsFilter(req); const denoms = await getAvailableDenoms( - ws, + wex, TransactionType.Deposit, req.currency, {}, @@ -473,25 +473,27 @@ export function getMaxDepositAmountForAvailableCoins( } export async function convertPeerPushAmount( - ws: InternalWalletState, + wex: WalletExecutionContext, req: ConvertAmountRequest, ): Promise<AmountResponse> { throw Error("to be implemented after 1.0"); } + export async function getMaxPeerPushAmount( - ws: InternalWalletState, + wex: WalletExecutionContext, req: GetAmountRequest, ): Promise<AmountResponse> { throw Error("to be implemented after 1.0"); } + export async function convertWithdrawalAmount( - ws: InternalWalletState, + wex: WalletExecutionContext, req: ConvertAmountRequest, ): Promise<AmountResponse> { const amount = Amounts.parseOrThrow(req.amount); const denoms = await getAvailableDenoms( - ws, + wex, TransactionType.Withdrawal, amount.currency, {}, |