From e331012c9f8efef86c6a8a9297b44a67ba8cda66 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 21 Apr 2023 22:46:04 +0200 Subject: [PATCH] -fix harness type errors --- packages/taler-harness/package.json | 3 ++- packages/taler-harness/src/bench1.ts | 12 ++++++++---- packages/taler-harness/src/bench3.ts | 12 ++++++++---- .../integrationtests/test-age-restrictions-peer.ts | 2 -- .../src/integrationtests/test-forced-selection.ts | 1 - .../src/integrationtests/test-wallettesting.ts | 3 --- packages/taler-wallet-core/src/bank-api-client.ts | 3 +++ packages/taler-wallet-core/src/dbless.ts | 7 ++++++- 8 files changed, 27 insertions(+), 16 deletions(-) diff --git a/packages/taler-harness/package.json b/packages/taler-harness/package.json index 8def7af61..3af8b73e3 100644 --- a/packages/taler-harness/package.json +++ b/packages/taler-harness/package.json @@ -18,6 +18,7 @@ "scripts": { "compile": "./build.mjs", "check": "tsc", + "test": "tsc", "clean": "rimraf lib dist tsconfig.tsbuildinfo", "pretty": "prettier --write src" }, @@ -42,4 +43,4 @@ "axios": "^0.27.2", "tslib": "^2.4.0" } -} \ No newline at end of file +} diff --git a/packages/taler-harness/src/bench1.ts b/packages/taler-harness/src/bench1.ts index 0a4118ec1..941d9244a 100644 --- a/packages/taler-harness/src/bench1.ts +++ b/packages/taler-harness/src/bench1.ts @@ -86,13 +86,17 @@ export async function runBench1(configJson: any): Promise { // No persistent DB storage. persistentStoragePath: undefined, httpLib: myHttpLib, + config: { + testing: { + insecureTrustExchange: trustExchange, + }, + features: { + batchWithdrawal, + } + } }); wallet = res.wallet; getDbStats = res.getDbStats; - if (trustExchange) { - wallet.setInsecureTrustExchange(); - } - wallet.setBatchWithdrawal(batchWithdrawal); await wallet.client.call(WalletApiOperation.InitWallet, {}); } diff --git a/packages/taler-harness/src/bench3.ts b/packages/taler-harness/src/bench3.ts index 5e8fac0e9..2573aec14 100644 --- a/packages/taler-harness/src/bench3.ts +++ b/packages/taler-harness/src/bench3.ts @@ -94,13 +94,17 @@ export async function runBench3(configJson: any): Promise { // No persistent DB storage. persistentStoragePath: undefined, httpLib: myHttpLib, + config: { + features: { + batchWithdrawal: batchWithdrawal, + }, + testing: { + insecureTrustExchange: trustExchange, + }, + }, }); wallet = res.wallet; getDbStats = res.getDbStats; - if (trustExchange) { - wallet.setInsecureTrustExchange(); - } - wallet.setBatchWithdrawal(batchWithdrawal); await wallet.client.call(WalletApiOperation.InitWallet, {}); } diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts index 524d04c94..d129a5217 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts @@ -19,7 +19,6 @@ */ import { AbsoluteTime, Duration } from "@gnu-taler/taler-util"; import { - getDefaultNodeWallet2, WalletApiOperation, } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; @@ -27,7 +26,6 @@ import { GlobalTestState, WalletCli } from "../harness/harness.js"; import { createSimpleTestkudosEnvironment, withdrawViaBank, - makeTestPayment, } from "../harness/helpers.js"; /** diff --git a/packages/taler-harness/src/integrationtests/test-forced-selection.ts b/packages/taler-harness/src/integrationtests/test-forced-selection.ts index 91be11a82..d0621f000 100644 --- a/packages/taler-harness/src/integrationtests/test-forced-selection.ts +++ b/packages/taler-harness/src/integrationtests/test-forced-selection.ts @@ -38,7 +38,6 @@ export async function runForcedSelectionTest(t: GlobalTestState) { await wallet.client.call(WalletApiOperation.WithdrawTestBalance, { exchangeBaseUrl: exchange.baseUrl, amount: "TESTKUDOS:10", - bankBaseUrl: bank.baseUrl, bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl, forcedDenomSel: { denoms: [ diff --git a/packages/taler-harness/src/integrationtests/test-wallettesting.ts b/packages/taler-harness/src/integrationtests/test-wallettesting.ts index 03c446db3..a856df79f 100644 --- a/packages/taler-harness/src/integrationtests/test-wallettesting.ts +++ b/packages/taler-harness/src/integrationtests/test-wallettesting.ts @@ -120,7 +120,6 @@ export async function runWallettestingTest(t: GlobalTestState) { await wallet.client.call(WalletApiOperation.RunIntegrationTest, { amountToSpend: "TESTKUDOS:5", amountToWithdraw: "TESTKUDOS:10", - bankBaseUrl: bank.baseUrl, bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl, exchangeBaseUrl: exchange.baseUrl, merchantAuthToken: merchantAuthToken, @@ -144,7 +143,6 @@ export async function runWallettestingTest(t: GlobalTestState) { await wallet.client.call(WalletApiOperation.WithdrawTestBalance, { amount: "TESTKUDOS:10", - bankBaseUrl: bank.baseUrl, bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl, exchangeBaseUrl: exchange.baseUrl, }); @@ -170,7 +168,6 @@ export async function runWallettestingTest(t: GlobalTestState) { await wallet.client.call(WalletApiOperation.WithdrawTestBalance, { amount: "TESTKUDOS:10", - bankBaseUrl: bank.baseUrl, bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl, exchangeBaseUrl: exchange.baseUrl, }); diff --git a/packages/taler-wallet-core/src/bank-api-client.ts b/packages/taler-wallet-core/src/bank-api-client.ts index de0d4b852..ac8eedc27 100644 --- a/packages/taler-wallet-core/src/bank-api-client.ts +++ b/packages/taler-wallet-core/src/bank-api-client.ts @@ -57,6 +57,9 @@ export interface BankAccountBalanceResponse { } export interface BankServiceHandle { + /** + * @deprecated + */ readonly baseUrl: string; readonly bankAccessApiBaseUrl: string; readonly http: HttpRequestLibrary; diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts index 04bfa1359..30c4247a8 100644 --- a/packages/taler-wallet-core/src/dbless.ts +++ b/packages/taler-wallet-core/src/dbless.ts @@ -205,11 +205,16 @@ export async function withdrawCoin(args: { }; } +export interface FindDenomOptions { + denomselAllowLate?: boolean; +} + export function findDenomOrThrow( - denomselAllowLate: boolean, exchangeInfo: ExchangeInfo, amount: AmountString, + options: FindDenomOptions = {}, ): DenominationRecord { + const denomselAllowLate = options.denomselAllowLate ?? false; for (const d of exchangeInfo.keys.currentDenominations) { const value: AmountJson = { currency: d.currency,