diff options
Diffstat (limited to 'packages/taler-wallet-core/src/pay-peer-common.ts')
-rw-r--r-- | packages/taler-wallet-core/src/pay-peer-common.ts | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/taler-wallet-core/src/pay-peer-common.ts b/packages/taler-wallet-core/src/pay-peer-common.ts index dbc3376b4..ff035d5e5 100644 --- a/packages/taler-wallet-core/src/pay-peer-common.ts +++ b/packages/taler-wallet-core/src/pay-peer-common.ts @@ -33,25 +33,25 @@ import type { SelectedPeerCoin } from "./coinSelection.js"; import { SpendCoinDetails } from "./crypto/cryptoImplementation.js"; import { PeerPushPaymentCoinSelection, ReserveRecord } from "./db.js"; import { getTotalRefreshCost } from "./refresh.js"; -import { InternalWalletState, getDenomInfo } from "./wallet.js"; +import { WalletExecutionContext, getDenomInfo } from "./wallet.js"; import { getCandidateWithdrawalDenomsTx } from "./withdraw.js"; /** * Get information about the coin selected for signatures. */ export async function queryCoinInfosForSelection( - ws: InternalWalletState, + wex: WalletExecutionContext, csel: PeerPushPaymentCoinSelection, ): Promise<SpendCoinDetails[]> { let infos: SpendCoinDetails[] = []; - await ws.db.runReadOnlyTx(["coins", "denominations"], async (tx) => { + await wex.db.runReadOnlyTx(["coins", "denominations"], async (tx) => { for (let i = 0; i < csel.coinPubs.length; i++) { const coin = await tx.coins.get(csel.coinPubs[i]); if (!coin) { throw Error("coin not found anymore"); } const denom = await getDenomInfo( - ws, + wex, tx, coin.exchangeBaseUrl, coin.denomPubHash, @@ -73,11 +73,11 @@ export async function queryCoinInfosForSelection( } export async function getTotalPeerPaymentCost( - ws: InternalWalletState, + wex: WalletExecutionContext, pcs: SelectedPeerCoin[], ): Promise<AmountJson> { const currency = Amounts.currencyOf(pcs[0].contribution); - return ws.db.runReadOnlyTx(["coins", "denominations"], async (tx) => { + return wex.db.runReadOnlyTx(["coins", "denominations"], async (tx) => { const costs: AmountJson[] = []; for (let i = 0; i < pcs.length; i++) { const coin = await tx.coins.get(pcs[i].coinPub); @@ -85,7 +85,7 @@ export async function getTotalPeerPaymentCost( throw Error("can't calculate payment cost, coin not found"); } const denomInfo = await getDenomInfo( - ws, + wex, tx, coin.exchangeBaseUrl, coin.denomPubHash, @@ -96,7 +96,7 @@ export async function getTotalPeerPaymentCost( ); } const allDenoms = await getCandidateWithdrawalDenomsTx( - ws, + wex, tx, coin.exchangeBaseUrl, currency, @@ -109,7 +109,7 @@ export async function getTotalPeerPaymentCost( allDenoms, denomInfo, amountLeft, - ws.config.testing.denomselAllowLate, + wex.ws.config.testing.denomselAllowLate, ); costs.push(Amounts.parseOrThrow(pcs[i].contribution)); costs.push(refreshCost); @@ -133,16 +133,16 @@ export const codecForExchangePurseStatus = (): Codec<ExchangePurseStatus> => .build("ExchangePurseStatus"); export async function getMergeReserveInfo( - ws: InternalWalletState, + wex: WalletExecutionContext, req: { exchangeBaseUrl: string; }, ): Promise<ReserveRecord> { // We have to eagerly create the key pair outside of the transaction, // due to the async crypto API. - const newReservePair = await ws.cryptoApi.createEddsaKeypair({}); + const newReservePair = await wex.cryptoApi.createEddsaKeypair({}); - const mergeReserveRecord: ReserveRecord = await ws.db.runReadWriteTx( + const mergeReserveRecord: ReserveRecord = await wex.db.runReadWriteTx( ["exchanges", "reserves"], async (tx) => { const ex = await tx.exchanges.get(req.exchangeBaseUrl); |