commit 5ab5000d67b1e3abf7082c20af3b6026031b1976
parent 1fa663f93fca3b066dd3f0dbdeea0ca0eea77ad1
Author: Florian Dold <dold@taler.net>
Date: Wed, 25 Nov 2026 19:34:36 +0100
wallet-core: remove deprecated requests in API v12
Remaining usages in the harness/CLI etc. were migrated. The iOS/Android
wallets don't use the deprecated requests anymore.
Diffstat:
9 files changed, 46 insertions(+), 682 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet.test.ts b/packages/taler-util/src/types-taler-wallet.test.ts
@@ -18,46 +18,41 @@
import assert from "node:assert";
import { test } from "node:test";
import {
- codecForGetDefaultExchangesRequest,
codecForListWithdrawalExchangeCandidatesRequest,
codecForTestingWaitTransactionRequest,
codecForWaitTransactionStateRequest,
matchTransactionState,
} from "./types-taler-wallet.js";
-test("default and candidate exchange requests share selection flags", () => {
- for (const codec of [
- codecForGetDefaultExchangesRequest(),
- codecForListWithdrawalExchangeCandidatesRequest(),
+test("withdrawal exchange candidates support selection flags", () => {
+ const codec = codecForListWithdrawalExchangeCandidatesRequest();
+ assert.deepStrictEqual(
+ codec.decode({
+ presetOnly: true,
+ withBuiltin: false,
+ withDemo: true,
+ withTest: true,
+ }),
+ {
+ presetOnly: true,
+ withBuiltin: false,
+ withDemo: true,
+ withTest: true,
+ },
+ );
+ assert.deepStrictEqual(codec.decode({}), {
+ presetOnly: undefined,
+ withBuiltin: undefined,
+ withDemo: undefined,
+ withTest: undefined,
+ });
+ for (const property of [
+ "presetOnly",
+ "withBuiltin",
+ "withDemo",
+ "withTest",
]) {
- assert.deepStrictEqual(
- codec.decode({
- presetOnly: true,
- withBuiltin: false,
- withDemo: true,
- withTest: true,
- }),
- {
- presetOnly: true,
- withBuiltin: false,
- withDemo: true,
- withTest: true,
- },
- );
- assert.deepStrictEqual(codec.decode({}), {
- presetOnly: undefined,
- withBuiltin: undefined,
- withDemo: undefined,
- withTest: undefined,
- });
- for (const property of [
- "presetOnly",
- "withBuiltin",
- "withDemo",
- "withTest",
- ]) {
- assert.throws(() => codec.decode({ [property]: "yes" }));
- }
+ assert.throws(() => codec.decode({ [property]: "yes" }));
}
});
import {
diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts
@@ -50,7 +50,6 @@ import {
} from "./codec.js";
import { canonicalizeBaseUrl } from "./helpers.js";
import { TaldirAlreadyPaidResponse } from "./types-taler-directory.js";
-import { PaytoString, codecForPaytoString } from "./payto.js";
import { PerformanceTable } from "./performance.js";
import { QrCodeSpec } from "./qr.js";
import { AgeCommitmentProof } from "./taler-crypto.js";
@@ -245,29 +244,6 @@ export enum TransactionAmountMode {
Raw = "raw",
}
-/**
- * @deprecated Use {@link CheckDepositRequest} for a concrete instructed
- * amount, or {@link GetMaxDepositAmountRequest} to query deposit limits.
- */
-export interface ConvertAmountRequest {
- amount: AmountString;
- type: TransactionAmountMode;
- depositPaytoUri: PaytoString;
-}
-
-export const codecForConvertAmountRequest =
- buildCodecForObject<ConvertAmountRequest>()
- .property("amount", codecForAmountString())
- .property("depositPaytoUri", codecForPaytoString())
- .property(
- "type",
- codecForEither(
- codecForConstString(TransactionAmountMode.Raw),
- codecForConstString(TransactionAmountMode.Effective),
- ),
- )
- .build("ConvertAmountRequest");
-
export interface GetMaxDepositAmountRequest {
/**
* Currency to deposit.
@@ -391,11 +367,6 @@ export interface GetMaxPeerPushDebitAmountResponse {
exchangeBaseUrl?: string;
}
-export interface AmountResponse {
- effectiveAmount: AmountString;
- rawAmount: AmountString;
-}
-
export enum BalanceFlag {
IncomingKyc = "incoming-kyc",
IncomingAml = "incoming-aml",
@@ -4854,41 +4825,6 @@ export interface GetDepositWireTypesResponse {
wireTypeDetails: WireTypeDetails[];
}
-export interface GetDepositWireTypesForCurrencyRequest {
- currency: string;
- /**
- * Optional scope info to further restrict the result.
- * Currency must match the currency field.
- */
- scopeInfo?: ScopeInfo;
-}
-
-export const codecForGetDepositWireTypesForCurrencyRequest =
- (): Codec<GetDepositWireTypesForCurrencyRequest> =>
- buildCodecForObject<GetDepositWireTypesForCurrencyRequest>()
- .property("currency", codecForString())
- .property("scopeInfo", codecOptional(codecForScopeInfo()))
- .build("GetDepositWireTypesForCurrencyRequest");
-
-/**
- * Response with wire types that are supported for a deposit.
- *
- * In the future, we might surface more information here, such as debit restrictions
- * by the exchange, which then can be shown by UIs to the user before they
- * enter their payment information.
- */
-export interface GetDepositWireTypesForCurrencyResponse {
- /**
- * @deprecated, use wireTypeDetails instead.
- */
- wireTypes: string[];
-
- /**
- * Details for each wire type.
- */
- wireTypeDetails: WireTypeDetails[];
-}
-
export interface WireTypeDetails {
paymentTargetType: string;
@@ -4910,20 +4846,6 @@ export interface WireTypeDetails {
talerBankHostnames?: string[];
}
-export interface GetQrCodesForPaytoRequest {
- paytoUri: string;
-}
-
-export const codecForGetQrCodesForPaytoRequest =
- (): Codec<GetQrCodesForPaytoRequest> =>
- buildCodecForObject<GetQrCodesForPaytoRequest>()
- .property("paytoUri", codecForString())
- .build("GetQrCodesForPaytoRequest");
-
-export interface GetQrCodesForPaytoResponse {
- codes: QrCodeSpec[];
-}
-
export interface GetBankingChoicesForPaytoRequest {
paytoUri: string;
}
@@ -5192,10 +5114,7 @@ export enum FlightRecordEvent {
WithdrawalRedenominate = "withdrawal-redenominate",
}
-/**
- * @deprecated Use {@link ListWithdrawalExchangeCandidatesRequest} instead.
- */
-export interface GetDefaultExchangesRequest {
+export interface ListWithdrawalExchangeCandidatesRequest {
/**
* Only return production exchanges from the builtin exchange list.
* Cannot be combined with `withBuiltin: false`.
@@ -5212,40 +5131,6 @@ export interface GetDefaultExchangesRequest {
withTest?: boolean;
}
-export const codecForGetDefaultExchangesRequest =
- (): Codec<GetDefaultExchangesRequest> =>
- buildCodecForObject<GetDefaultExchangesRequest>()
- .property("presetOnly", codecOptional(codecForBoolean()))
- .property("withBuiltin", codecOptional(codecForBoolean()))
- .property("withDemo", codecOptional(codecForBoolean()))
- .property("withTest", codecOptional(codecForBoolean()))
- .build("GetDefaultExchangesRequest");
-
-/**
- * @deprecated Use {@link ListWithdrawalExchangeCandidatesResponse} instead.
- */
-export interface GetDefaultExchangesResponse {
- defaultExchanges: {
- /**
- * A taler://withdraw-exchange URI for the
- * exchange.
- */
- talerUri: string;
- /**
- * Currency offered by the exchange.
- */
- currency: string;
- /**
- * Currency spec for the currency offered
- * by the exchange.
- */
- currencySpec: CurrencySpecification;
- }[];
-}
-
-export type ListWithdrawalExchangeCandidatesRequest =
- GetDefaultExchangesRequest;
-
export const codecForListWithdrawalExchangeCandidatesRequest =
(): Codec<ListWithdrawalExchangeCandidatesRequest> =>
buildCodecForObject<ListWithdrawalExchangeCandidatesRequest>()
diff --git a/packages/taler-wallet-core/src/instructedAmountConversion.ts b/packages/taler-wallet-core/src/instructedAmountConversion.ts
@@ -16,26 +16,12 @@
import {
AbsoluteTime,
- AgeRestriction,
AmountJson,
- AmountResponse,
Amounts,
- ConvertAmountRequest,
Duration,
- TalerError,
- TalerErrorCode,
TransactionAmountMode,
- TransactionType,
- checkDbInvariant,
strcmp,
} from "@gnu-taler/taler-util";
-import { timestampProtocolFromDb } from "./db/records.js";
-import { WalletDenomination } from "./db/records.js";
-import {
- getAllDenominationsForExchange,
- getExchangeDetailsInTx,
-} from "./exchanges.js";
-import { denomRefKey, WalletExecutionContext } from "./wallet.js";
export interface CoinInfo {
id: string;
@@ -51,15 +37,6 @@ export interface CoinInfo {
maxAge: number;
}
-/**
- * If the operation going to be plan subtracts
- * or adds amount in the wallet db
- */
-export enum OperationType {
- Credit = "credit",
- Debit = "debit",
-}
-
// FIXME: Name conflict ...
interface ExchangeInfo {
wireFee: AmountJson | undefined;
@@ -68,23 +45,6 @@ interface ExchangeInfo {
debitDeadline: AbsoluteTime;
}
-function getOperationType(txType: TransactionType): OperationType {
- const operationType =
- txType === TransactionType.Withdrawal
- ? OperationType.Credit
- : txType === TransactionType.Deposit
- ? OperationType.Debit
- : undefined;
- if (!operationType) {
- throw TalerError.fromDetail(
- TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
- { parameter: "type" },
- `conversion for operation type ${txType} is not supported`,
- );
- }
- return operationType;
-}
-
interface SelectedCoins {
totalValue: AmountJson;
coins: { info: CoinInfo; size: number }[];
@@ -109,240 +69,11 @@ interface RefreshChoice {
// totalChangeWithdrawalFee: AmountJson;
}
-interface CoinsFilter {
- shouldCalculatePurseFee?: boolean;
- exchanges?: string[];
- wireMethod?: string;
- ageRestricted?: number;
-}
-
interface AvailableCoins {
list: CoinInfo[];
exchanges: Record<string, ExchangeInfo>;
}
-/**
- * Get all the denoms that can be used for a operation that is limited
- * by the following restrictions.
- * This function is costly (by the database access) but with high chances
- * of being cached
- */
-async function getAvailableCoins(
- wex: WalletExecutionContext,
- op: TransactionType,
- currency: string,
- filters: CoinsFilter = {},
-): Promise<AvailableCoins> {
- const operationType = getOperationType(op);
-
- return await wex.runWalletDbTx(async (tx) => {
- const list: CoinInfo[] = [];
- const exchanges: Record<string, ExchangeInfo> = {};
-
- const databaseExchanges = await tx.getExchanges();
- const filteredExchanges =
- filters.exchanges ?? databaseExchanges.map((e) => e.baseUrl);
-
- for (const exchangeBaseUrl of filteredExchanges) {
- const exchangeDetails = await getExchangeDetailsInTx(tx, exchangeBaseUrl);
- // 1.- exchange has same currency
- if (exchangeDetails?.currency !== currency) {
- continue;
- }
-
- let deadline = AbsoluteTime.never();
- // 2.- exchange supports wire method
- let wireFee: AmountJson | undefined;
- if (filters.wireMethod) {
- const wireMethodWithDates =
- exchangeDetails.wireInfo.feesForType[filters.wireMethod];
-
- if (!wireMethodWithDates) {
- throw TalerError.fromDetail(
- TalerErrorCode.WALLET_NO_SUITABLE_EXCHANGE,
- { wireMethod: filters.wireMethod },
- `exchange ${exchangeBaseUrl} does not support wire method ${filters.wireMethod}`,
- );
- }
- const wireMethodFee = wireMethodWithDates.find((x) => {
- return AbsoluteTime.isBetween(
- AbsoluteTime.now(),
- AbsoluteTime.fromProtocolTimestamp(x.startStamp),
- AbsoluteTime.fromProtocolTimestamp(x.endStamp),
- );
- });
-
- if (!wireMethodFee) {
- throw Error(
- `exchange ${exchangeBaseUrl} doesn't have wire fee defined for this period`,
- );
- }
- wireFee = Amounts.parseOrThrow(wireMethodFee.wireFee);
- deadline = AbsoluteTime.min(
- deadline,
- AbsoluteTime.fromProtocolTimestamp(wireMethodFee.endStamp),
- );
- }
- // exchanges[exchangeBaseUrl].wireFee = wireMethodFee;
-
- // 3.- exchange supports wire method
- let purseFee: AmountJson | undefined;
- if (filters.shouldCalculatePurseFee) {
- const purseFeeFound = exchangeDetails.globalFees.find((x) => {
- return AbsoluteTime.isBetween(
- AbsoluteTime.now(),
- AbsoluteTime.fromProtocolTimestamp(x.startDate),
- AbsoluteTime.fromProtocolTimestamp(x.endDate),
- );
- });
- if (!purseFeeFound) {
- throw Error(
- `exchange ${exchangeBaseUrl} doesn't have purse fee defined for this period`,
- );
- }
- purseFee = Amounts.parseOrThrow(purseFeeFound.purseFee);
- deadline = AbsoluteTime.min(
- deadline,
- AbsoluteTime.fromProtocolTimestamp(purseFeeFound.endDate),
- );
- }
-
- let creditDeadline = AbsoluteTime.never();
- let debitDeadline = AbsoluteTime.never();
- //4.- filter coins restricted by age
- if (operationType === OperationType.Credit) {
- // FIXME: Use denom groups instead of querying all denominations!
- const ds = await getAllDenominationsForExchange(tx, exchangeBaseUrl);
- for (const denom of ds) {
- const expiresWithdraw = AbsoluteTime.fromProtocolTimestamp(
- timestampProtocolFromDb(denom.stampExpireWithdraw),
- );
- const expiresDeposit = AbsoluteTime.fromProtocolTimestamp(
- timestampProtocolFromDb(denom.stampExpireDeposit),
- );
- creditDeadline = AbsoluteTime.min(deadline, expiresWithdraw);
- debitDeadline = AbsoluteTime.min(deadline, expiresDeposit);
- list.push(
- buildCoinInfoFromDenom(
- denom,
- purseFee,
- wireFee,
- AgeRestriction.AGE_UNRESTRICTED,
- Number.MAX_SAFE_INTEGER, // Max withdrawable from single denom
- ),
- );
- }
- } else {
- const ageLower = filters.ageRestricted ?? 0;
- const ageUpper = AgeRestriction.AGE_UNRESTRICTED;
-
- const myExchangeCoins =
- await tx.getCoinAvailabilityByExchangeAndAgeRange(
- exchangeDetails.exchangeBaseUrl,
- ageLower,
- ageUpper,
- );
- //5.- save denoms with how many coins are available
- // FIXME: Check that the individual denomination is audited!
- // FIXME: Should we exclude denominations that are
- // not spendable anymore?
- const denominations = await tx.getDenominationsByRefs(myExchangeCoins);
- const denominationsByRef = new Map(
- denominations.map((denom) => [denomRefKey(denom), denom]),
- );
- for (const coinAvail of myExchangeCoins) {
- const denom = denominationsByRef.get(denomRefKey(coinAvail));
- checkDbInvariant(
- !!denom,
- `denomination of a coin is missing hash: ${coinAvail.denomPubHash}`,
- );
- if (denom.isRevoked || !denom.isOffered) {
- continue;
- }
- const expiresWithdraw = AbsoluteTime.fromProtocolTimestamp(
- timestampProtocolFromDb(denom.stampExpireWithdraw),
- );
- const expiresDeposit = AbsoluteTime.fromProtocolTimestamp(
- timestampProtocolFromDb(denom.stampExpireDeposit),
- );
- creditDeadline = AbsoluteTime.min(deadline, expiresWithdraw);
- debitDeadline = AbsoluteTime.min(deadline, expiresDeposit);
- list.push(
- buildCoinInfoFromDenom(
- denom,
- purseFee,
- wireFee,
- coinAvail.maxAge,
- coinAvail.freshCoinCount,
- ),
- );
- }
- }
-
- exchanges[exchangeBaseUrl] = {
- purseFee,
- wireFee,
- debitDeadline,
- creditDeadline,
- };
- }
-
- return { list, exchanges };
- });
-}
-
-function buildCoinInfoFromDenom(
- denom: WalletDenomination,
- purseFee: AmountJson | undefined,
- wireFee: AmountJson | undefined,
- maxAge: number,
- total: number,
-): CoinInfo {
- return {
- id: denom.denomPubHash,
- denomWithdraw: Amounts.parseOrThrow(denom.fees.feeWithdraw),
- denomDeposit: Amounts.parseOrThrow(denom.fees.feeDeposit),
- denomRefresh: Amounts.parseOrThrow(denom.fees.feeRefresh),
- exchangePurse: purseFee,
- exchangeWire: wireFee,
- exchangeBaseUrl: denom.exchangeBaseUrl,
- duration: AbsoluteTime.difference(
- AbsoluteTime.now(),
- AbsoluteTime.fromProtocolTimestamp(
- timestampProtocolFromDb(denom.stampExpireDeposit),
- ),
- ),
- totalAvailable: total,
- value: Amounts.parseOrThrow(denom.value),
- maxAge,
- };
-}
-
-export async function convertDepositAmount(
- wex: WalletExecutionContext,
- req: ConvertAmountRequest,
-): Promise<AmountResponse> {
- const amount = Amounts.parseOrThrow(req.amount);
- // const filter = getCoinsFilter(req);
-
- const denoms = await getAvailableCoins(
- wex,
- TransactionType.Deposit,
- amount.currency,
- {},
- );
- const result = convertDepositAmountForAvailableCoins(
- denoms,
- amount,
- req.type,
- );
-
- return {
- effectiveAmount: Amounts.stringify(result.effective),
- rawAmount: Amounts.stringify(result.raw),
- };
-}
-
const LOG_REFRESH = false;
const LOG_DEPOSIT = false;
diff --git a/packages/taler-wallet-core/src/pay-peer-push-debit.ts b/packages/taler-wallet-core/src/pay-peer-push-debit.ts
@@ -18,7 +18,6 @@ import {
AbsoluteTime,
AmountJson,
Amounts,
- CheckPeerPushDebitOkResponse,
CheckPeerPushDebitRequest,
CheckPeerPushDebitResponse,
ContractTermsUtil,
@@ -492,29 +491,6 @@ export class PeerPushDebitTransactionContext implements TransactionContext {
}
}
-/**
- * @deprecated use V2 instead
- */
-export async function checkPeerPushDebit(
- wex: WalletExecutionContext,
- req: CheckPeerPushDebitRequest,
-): Promise<CheckPeerPushDebitOkResponse> {
- const res = await checkPeerPushDebitV2(wex, req);
- switch (res.type) {
- case "ok":
- return res;
- case "insufficient-balance":
- throw TalerError.fromDetail(
- TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE,
- {
- insufficientBalanceDetails: res.insufficientBalanceDetails,
- },
- );
- default:
- assertUnreachable(res);
- }
-}
-
export async function checkPeerPushDebitV2(
wex: WalletExecutionContext,
req: CheckPeerPushDebitRequest,
diff --git a/packages/taler-wallet-core/src/requests.test.ts b/packages/taler-wallet-core/src/requests.test.ts
@@ -59,7 +59,6 @@ import { importWalletDbDump } from "./db/migration/import.js";
import { markExchangeAddedByUser } from "./exchanges.js";
import { SynchronousCryptoWorkerFactoryPlain } from "./crypto/workers/synchronousWorkerFactoryPlain.js";
import {
- handleGetDefaultExchanges,
handleHintApplicationResumed,
handleListWithdrawalExchangeCandidates,
handleRemoveGlobalCurrencyExchange,
@@ -1087,44 +1086,24 @@ test("presetOnly returns only production exchanges from the builtin list", async
candidates.candidates[0].exchangeEntryStatus,
ExchangeEntryStatus.Used,
);
-
- let warning = "";
- const originalWrite = process.stderr.write;
- process.stderr.write = ((chunk: unknown) => {
- warning += String(chunk);
- return true;
- }) as typeof process.stderr.write;
- try {
- const legacy = await handleGetDefaultExchanges(wex, { presetOnly: true });
- assert.deepStrictEqual(
- legacy.defaultExchanges.map((x) => x.talerUri),
- ["taler://withdraw-exchange/exchange.taler-ops.ch/"],
- );
- } finally {
- process.stderr.write = originalWrite;
- }
- assert.match(warning, /getDefaultExchanges is deprecated/);
- assert.match(warning, /listWithdrawalExchangeCandidates/);
});
-test("presetOnly rejects withBuiltin=false for both exchange APIs", async () => {
+test("presetOnly rejects withBuiltin=false for withdrawal candidates", async () => {
const wex = makeExchangeTestContext([]);
- for (const operation of [
- handleListWithdrawalExchangeCandidates,
- handleGetDefaultExchanges,
- ]) {
- await assert.rejects(
- operation(wex, { presetOnly: true, withBuiltin: false }),
- (error: unknown) => {
- assert.ok(error instanceof TalerError);
- assert.strictEqual(
- error.errorDetail.code,
- TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
- );
- return true;
- },
- );
- }
+ await assert.rejects(
+ handleListWithdrawalExchangeCandidates(wex, {
+ presetOnly: true,
+ withBuiltin: false,
+ }),
+ (error: unknown) => {
+ assert.ok(error instanceof TalerError);
+ assert.strictEqual(
+ error.errorDetail.code,
+ TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
+ );
+ return true;
+ },
+ );
});
for (const [backend, makeDb] of backendCases) {
diff --git a/packages/taler-wallet-core/src/requests.ts b/packages/taler-wallet-core/src/requests.ts
@@ -95,10 +95,6 @@ import {
GetChoicesForPaymentResult,
GetCurrencySpecificationRequest,
GetCurrencySpecificationResponse,
- GetDefaultExchangesRequest,
- GetDefaultExchangesResponse,
- GetDepositWireTypesForCurrencyRequest,
- GetDepositWireTypesForCurrencyResponse,
GetDepositWireTypesRequest,
GetDepositWireTypesResponse,
GetDiagnosticsRequest,
@@ -107,8 +103,6 @@ import {
GetExchangeTosResult,
GetPerformanceStatsRequest,
GetPerformanceStatsResponse,
- GetQrCodesForPaytoRequest,
- GetQrCodesForPaytoResponse,
HintNetworkAvailabilityRequest,
HintPowerStateRequest,
DismissWalletWarningRequest,
@@ -204,7 +198,6 @@ import {
codecForConfirmPayRequest,
codecForConfirmPeerPushPaymentRequest,
codecForConfirmWithdrawalRequestRequest,
- codecForConvertAmountRequest,
codecForConvertIbanAccountFieldToPaytoRequest,
codecForConvertIbanPaytoToAccountFieldRequest,
codecForCreateDepositGroupRequest,
@@ -225,8 +218,6 @@ import {
codecForGetBankingChoicesForPaytoRequest,
codecForGetChoicesForPaymentRequest,
codecForGetCurrencyInfoRequest,
- codecForGetDefaultExchangesRequest,
- codecForGetDepositWireTypesForCurrencyRequest,
codecForGetDepositWireTypesRequest,
codecForGetDiagnosticsRequest,
codecForGetDonauStatementsRequest,
@@ -237,7 +228,6 @@ import {
codecForGetMaxPeerPushDebitAmountRequest,
codecForGetPaivanaCookieRequest,
codecForGetPerformanceStatsRequest,
- codecForGetQrCodesForPaytoRequest,
codecForGetTransactionsV2Request,
codecForResolveTransactionReferenceRequest,
codecForGetWithdrawalDetailsForAmountRequest,
@@ -314,7 +304,6 @@ import {
convertHUF_BBANtoIBAN,
encodeCrock,
getErrorDetailFromException,
- getQrCodesForPayto,
getRandomBytes,
j2s,
parseIban,
@@ -379,7 +368,6 @@ import {
startUpdateExchangeEntry,
waitReadyExchange,
} from "./exchanges.js";
-import { convertDepositAmount } from "./instructedAmountConversion.js";
import {
upsertMailboxMessage,
deleteMailboxMessage,
@@ -415,7 +403,6 @@ import {
preparePeerPushCredit,
} from "./pay-peer-push-credit.js";
import {
- checkPeerPushDebit,
checkPeerPushDebitV2,
initiatePeerPushDebit,
} from "./pay-peer-push-debit.js";
@@ -1413,15 +1400,6 @@ async function handleGetExchangeTos(
);
}
-async function handleGetQrCodesForPayto(
- wex: WalletExecutionContext,
- req: GetQrCodesForPaytoRequest,
-): Promise<GetQrCodesForPaytoResponse> {
- return {
- codes: getQrCodesForPayto(req.paytoUri),
- };
-}
-
async function handleGetBankingChoicesForPayto(
wex: WalletExecutionContext,
req: GetBankingChoicesForPaytoRequest,
@@ -1730,68 +1708,6 @@ async function handleGetDepositWireTypes(
};
}
-async function handleGetDepositWireTypesForCurrency(
- wex: WalletExecutionContext,
- req: GetDepositWireTypesForCurrencyRequest,
-): Promise<GetDepositWireTypesForCurrencyResponse> {
- const wtSet: Set<string> = new Set();
- const wireTypeDetails: WireTypeDetails[] = [];
- const talerBankHostnames: string[] = [];
- await wex.runWalletDbTx(async (tx) => {
- const exchanges = await tx.getExchanges();
- for (const exchange of exchanges) {
- const det = await getExchangeDetailsInTx(tx, exchange.baseUrl);
- if (!det) {
- continue;
- }
- if (det.currency !== req.currency) {
- continue;
- }
- for (const acc of det.wireInfo.accounts) {
- let usable = true;
- for (const dr of acc.debit_restrictions) {
- if (dr.type === "deny") {
- usable = false;
- break;
- }
- }
- if (!usable) {
- continue;
- }
- const parsedPayto = parseExchangeWireAccountPayto(
- acc,
- exchange.baseUrl,
- );
- if (!parsedPayto) {
- continue;
- }
- if (parsedPayto.targetType === PaytoType.TalerBank) {
- if (!talerBankHostnames.includes(parsedPayto.host)) {
- talerBankHostnames.push(parsedPayto.host);
- }
- }
- if (!wtSet.has(parsedPayto.targetType!)) {
- wtSet.add(parsedPayto.targetType!);
- wireTypeDetails.push({
- paymentTargetType: parsedPayto.targetType!,
- // Hostnames only apply to x-taler-bank. The array is shared so
- // that it is possibly extended later by other exchanges with the
- // same wire type.
- talerBankHostnames:
- parsedPayto.targetType === PaytoType.TalerBank
- ? talerBankHostnames
- : undefined,
- });
- }
- }
- }
- });
- return {
- wireTypes: [...wtSet],
- wireTypeDetails,
- };
-}
-
async function handleListGlobalCurrencyExchanges(
wex: WalletExecutionContext,
_req: EmptyObject,
@@ -2427,23 +2343,6 @@ export async function handleGetFlightRecords(
return { flightRecords: wex.ws.flightRecords };
}
-export async function handleGetDefaultExchanges(
- wex: WalletExecutionContext,
- req: GetDefaultExchangesRequest,
-): Promise<GetDefaultExchangesResponse> {
- logger.warn(
- "getDefaultExchanges is deprecated; use listWithdrawalExchangeCandidates instead",
- );
- const { candidates } = await listWithdrawalExchangeCandidates(wex, req);
- return {
- defaultExchanges: candidates.map((candidate) => ({
- currency: candidate.currency,
- currencySpec: candidate.currencySpec,
- talerUri: candidate.talerUri,
- })),
- };
-}
-
export async function handleListWithdrawalExchangeCandidates(
wex: WalletExecutionContext,
req: ListWithdrawalExchangeCandidatesRequest,
@@ -2543,10 +2442,6 @@ const handlers: { [T in WalletApiOperation]: HandlerWithValidator<T> } = {
codec: codecForTestingCorruptWithdrawalCoinSelRequest(),
handler: handleTestingCorruptWithdrawalCoinSel,
},
- [WalletApiOperation.GetDefaultExchanges]: {
- codec: codecForGetDefaultExchangesRequest(),
- handler: handleGetDefaultExchanges,
- },
[WalletApiOperation.ListWithdrawalExchangeCandidates]: {
codec: codecForListWithdrawalExchangeCandidatesRequest(),
handler: handleListWithdrawalExchangeCandidates,
@@ -2897,10 +2792,6 @@ const handlers: { [T in WalletApiOperation]: HandlerWithValidator<T> } = {
codec: codecForGetPaivanaCookieRequest(),
handler: getPaivanaCookie,
},
- [WalletApiOperation.GetQrCodesForPayto]: {
- codec: codecForGetQrCodesForPaytoRequest(),
- handler: handleGetQrCodesForPayto,
- },
[WalletApiOperation.GetChoicesForPayment]: {
codec: codecForGetChoicesForPaymentRequest(),
handler: handleGetChoicesForPayment,
@@ -3001,10 +2892,6 @@ const handlers: { [T in WalletApiOperation]: HandlerWithValidator<T> } = {
codec: codecForHintNetworkAvailabilityRequest(),
handler: handleHintNetworkAvailability,
},
- [WalletApiOperation.ConvertDepositAmount]: {
- codec: codecForConvertAmountRequest,
- handler: convertDepositAmount,
- },
[WalletApiOperation.GetMaxDepositAmount]: {
codec: codecForGetMaxDepositAmountRequest(),
handler: getMaxDepositAmount,
@@ -3073,10 +2960,6 @@ const handlers: { [T in WalletApiOperation]: HandlerWithValidator<T> } = {
codec: codecForGetDepositWireTypesRequest(),
handler: handleGetDepositWireTypes,
},
- [WalletApiOperation.GetDepositWireTypesForCurrency]: {
- codec: codecForGetDepositWireTypesForCurrencyRequest(),
- handler: handleGetDepositWireTypesForCurrency,
- },
[WalletApiOperation.ListGlobalCurrencyExchanges]: {
codec: codecForEmptyObject(),
handler: handleListGlobalCurrencyExchanges,
@@ -3123,10 +3006,6 @@ const handlers: { [T in WalletApiOperation]: HandlerWithValidator<T> } = {
codec: codecForImportDbFromFileRequest(),
handler: handleImportDbFromFile,
},
- [WalletApiOperation.CheckPeerPushDebit]: {
- codec: codecForCheckPeerPushDebitRequest(),
- handler: checkPeerPushDebit,
- },
[WalletApiOperation.CheckPeerPushDebitV2]: {
codec: codecForCheckPeerPushDebitRequest(),
handler: checkPeerPushDebitV2,
diff --git a/packages/taler-wallet-core/src/versions.ts b/packages/taler-wallet-core/src/versions.ts
@@ -52,7 +52,7 @@ export const WALLET_BANK_CONVERSION_API_PROTOCOL_VERSION = "2:0:0";
/**
* Libtool version of the wallet-core API.
*/
-export const WALLET_CORE_API_PROTOCOL_VERSION = "11:0:0";
+export const WALLET_CORE_API_PROTOCOL_VERSION = "12:0:0";
/**
* Libtool rules:
diff --git a/packages/taler-wallet-core/src/wallet-api-types.ts b/packages/taler-wallet-core/src/wallet-api-types.ts
@@ -42,7 +42,6 @@ import {
AddGlobalCurrencyAuditorRequest,
AddGlobalCurrencyExchangeRequest,
UpsertMailboxMessageRequest,
- AmountResponse,
ApplyDevExperimentRequest,
BalancesResponse,
CancelProgressTokenRequest,
@@ -54,7 +53,6 @@ import {
CheckPayTemplateRequest,
CheckPeerPullCreditRequest,
CheckPeerPullCreditResponse,
- CheckPeerPushDebitOkResponse,
CheckPeerPushDebitRequest,
CheckPeerPushDebitResponse,
CoinDumpJson,
@@ -66,7 +64,6 @@ import {
ConfirmPeerPushCreditRequest,
ConfirmWithdrawalRequest,
ContactListResponse,
- ConvertAmountRequest,
ConvertIbanAccountFieldToPaytoRequest,
ConvertIbanAccountFieldToPaytoResponse,
ConvertIbanPaytoToAccountFieldRequest,
@@ -97,10 +94,6 @@ import {
GetChoicesForPaymentResult,
GetCurrencySpecificationRequest,
GetCurrencySpecificationResponse,
- GetDefaultExchangesRequest,
- GetDefaultExchangesResponse,
- GetDepositWireTypesForCurrencyRequest,
- GetDepositWireTypesForCurrencyResponse,
GetDepositWireTypesRequest,
GetDepositWireTypesResponse,
GetDiagnosticsRequest,
@@ -124,8 +117,6 @@ import {
GetPerformanceStatsResponse,
GetPaivanaCookieRequest,
GetPaivanaCookieResult,
- GetQrCodesForPaytoRequest,
- GetQrCodesForPaytoResponse,
GetTransactionsV2Request,
ResolveTransactionReferenceRequest,
ResolveTransactionReferenceResponse,
@@ -308,8 +299,6 @@ export enum WalletApiOperation {
AddExchange = "addExchange",
ListExchanges = "listExchanges",
ListWithdrawalExchangeCandidates = "listWithdrawalExchangeCandidates",
- /** @deprecated Use listWithdrawalExchangeCandidates instead. */
- GetDefaultExchanges = "getDefaultExchanges",
GetExchangeEntryByUrl = "getExchangeEntryByUrl",
UpdateExchangeEntry = "updateExchangeEntry",
GetExchangeResources = "getExchangeResources",
@@ -349,14 +338,8 @@ export enum WalletApiOperation {
CheckDeposit = "checkDeposit",
CreateDepositGroup = "createDepositGroup",
- /**
- * @deprecated Use CheckDeposit for a concrete instructed amount, or
- * GetMaxDepositAmount to query deposit limits.
- */
- ConvertDepositAmount = "convertDepositAmount",
GetMaxDepositAmount = "getMaxDepositAmount",
GetDepositWireTypes = "getDepositWireTypes",
- GetDepositWireTypesForCurrency = "getDepositWireTypesForCurrency",
// P2P Payments
@@ -373,7 +356,6 @@ export enum WalletApiOperation {
RenewObservations = "renewObservations",
StopObservation = "stopObservation",
PreparePeerPushCredit = "preparePeerPushCredit",
- CheckPeerPushDebit = "checkPeerPushDebit",
CheckPeerPushDebitV2 = "checkPeerPushDebitV2",
InitiatePeerPushDebit = "initiatePeerPushDebit",
ConfirmPeerPushCredit = "confirmPeerPushCredit",
@@ -473,11 +455,6 @@ export enum WalletApiOperation {
* Use {@link WalletApiOperation.PrepareBankIntegratedWithdrawal} instead.
*/
GetWithdrawalDetailsForUri = "getWithdrawalDetailsForUri",
-
- /**
- * @deprecated(2026-05-26) Consult withdrawal transaction details instead.
- */
- GetQrCodesForPayto = "getQrCodesForPayto",
}
// group: Initialization
@@ -760,16 +737,6 @@ export type GetBalancesDetailOp = {
response: PaymentBalanceDetails;
};
-/**
- * @deprecated Use {@link CheckDepositOp} for a concrete instructed amount,
- * or {@link GetMaxDepositAmountOp} to query deposit limits.
- */
-export type ConvertDepositAmountOp = {
- op: WalletApiOperation.ConvertDepositAmount;
- request: ConvertAmountRequest;
- response: AmountResponse;
-};
-
export type GetMaxDepositAmountOp = {
op: WalletApiOperation.GetMaxDepositAmount;
request: GetMaxDepositAmountRequest;
@@ -1268,18 +1235,6 @@ export type GetDepositWireTypesOp = {
};
/**
- * Get wire types that can be used for a deposit operation
- * with the provided currency.
- *
- * @deprecated Use getDepositWireTypes instead
- */
-export type GetDepositWireTypesForCurrencyOp = {
- op: WalletApiOperation.GetDepositWireTypesForCurrency;
- request: GetDepositWireTypesForCurrencyRequest;
- response: GetDepositWireTypesForCurrencyResponse;
-};
-
-/**
* Get the current terms of a service of an exchange.
*/
export type GetExchangeDetailedInfoOp = {
@@ -1288,13 +1243,6 @@ export type GetExchangeDetailedInfoOp = {
response: ExchangeDetailedResponse;
};
-/** @deprecated Use {@link ListWithdrawalExchangeCandidatesOp} instead. */
-export type GetDefaultExchangesOp = {
- op: WalletApiOperation.GetDefaultExchanges;
- request: GetDefaultExchangesRequest;
- response: GetDefaultExchangesResponse;
-};
-
export type ListWithdrawalExchangeCandidatesOp = {
op: WalletApiOperation.ListWithdrawalExchangeCandidates;
request: ListWithdrawalExchangeCandidatesRequest;
@@ -1391,16 +1339,6 @@ export type ImportDbFromFileOp = {
* Check if initiating a peer push payment is possible
* based on the funds in the wallet.
*/
-export type CheckPeerPushDebitOp = {
- op: WalletApiOperation.CheckPeerPushDebit;
- request: CheckPeerPushDebitRequest;
- response: CheckPeerPushDebitOkResponse;
-};
-
-/**
- * Check if initiating a peer push payment is possible
- * based on the funds in the wallet.
- */
export type CheckPeerPushDebitV2Op = {
op: WalletApiOperation.CheckPeerPushDebitV2;
request: CheckPeerPushDebitRequest;
@@ -1568,12 +1506,6 @@ export type CanonicalizeBaseUrlOp = {
response: CanonicalizeBaseUrlResponse;
};
-export type GetQrCodesForPaytoOp = {
- op: WalletApiOperation.GetQrCodesForPayto;
- request: GetQrCodesForPaytoRequest;
- response: GetQrCodesForPaytoResponse;
-};
-
export type ConvertIbanAccountFieldToPaytoOp = {
op: WalletApiOperation.ConvertIbanAccountFieldToPayto;
request: ConvertIbanAccountFieldToPaytoRequest;
@@ -2144,11 +2076,6 @@ export const walletApiExpectedErrors = {
TalerErrorCode.WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE,
TalerErrorCode.WALLET_TRANSACTION_NOT_FOUND,
],
- [WalletApiOperation.CheckPeerPushDebit]: [
- TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE,
- TalerErrorCode.WALLET_NO_SUITABLE_EXCHANGE,
- TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
- ],
[WalletApiOperation.CheckPeerPushDebitV2]: [
TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE,
TalerErrorCode.WALLET_NO_SUITABLE_EXCHANGE,
@@ -2173,9 +2100,6 @@ export const walletApiExpectedErrors = {
// --- Exchanges ----------------------------------------------------------
- [WalletApiOperation.GetDefaultExchanges]: [
- TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
- ],
[WalletApiOperation.ListWithdrawalExchangeCandidates]: [
TalerErrorCode.WALLET_CORE_API_BAD_REQUEST,
],
@@ -2306,7 +2230,6 @@ export type WalletOperations = {
[WalletApiOperation.GetBalances]: GetBalancesOp;
[WalletApiOperation.GetBalanceRefreshInfo]: GetBalanceRefreshInfoOp;
[WalletApiOperation.ObserveBalanceRefreshInfo]: ObserveBalanceRefreshInfoOp;
- [WalletApiOperation.ConvertDepositAmount]: ConvertDepositAmountOp;
[WalletApiOperation.GetMaxDepositAmount]: GetMaxDepositAmountOp;
[WalletApiOperation.GetMaxPeerPushDebitAmount]: GetMaxPeerPushDebitAmountOp;
[WalletApiOperation.GetBalanceDetail]: GetBalancesDetailOp;
@@ -2352,7 +2275,6 @@ export type WalletOperations = {
[WalletApiOperation.TestPay]: TestPayOp;
[WalletApiOperation.ExportDb]: ExportDbOp;
[WalletApiOperation.ImportDb]: ImportDbOp;
- [WalletApiOperation.CheckPeerPushDebit]: CheckPeerPushDebitOp;
[WalletApiOperation.CheckPeerPushDebitV2]: CheckPeerPushDebitV2Op;
[WalletApiOperation.InitiatePeerPushDebit]: InitiatePeerPushDebitOp;
[WalletApiOperation.ObserveTransaction]: ObserveTransactionOp;
@@ -2415,8 +2337,6 @@ export type WalletOperations = {
[WalletApiOperation.HintPowerState]: HintPowerStateOp;
[WalletApiOperation.DismissWalletWarning]: DismissWalletWarningOp;
[WalletApiOperation.GetDepositWireTypes]: GetDepositWireTypesOp;
- [WalletApiOperation.GetDepositWireTypesForCurrency]: GetDepositWireTypesForCurrencyOp;
- [WalletApiOperation.GetQrCodesForPayto]: GetQrCodesForPaytoOp;
[WalletApiOperation.GetBankingChoicesForPayto]: GetBankingChoicesForPaytoOp;
[WalletApiOperation.ListDiscounts]: ListDiscountsOp;
[WalletApiOperation.DeleteDiscount]: DeleteDiscountOp;
@@ -2449,7 +2369,6 @@ export type WalletOperations = {
[WalletApiOperation.GetDiagnostics]: GetDiagnosticsOp;
[WalletApiOperation.TestingGetPerformanceStats]: GetPerformanceStatsOp;
[WalletApiOperation.TestingGetFlightRecords]: TestingGetFlightRecordsOp;
- [WalletApiOperation.GetDefaultExchanges]: GetDefaultExchangesOp;
[WalletApiOperation.TestingCorruptWithdrawalCoinSel]: TestingCorruptWithdrawalCoinSelOp;
[WalletApiOperation.CancelProgressToken]: CancelProgressTokenOp;
[WalletApiOperation.RetryProgressTokenNow]: RetryProgressTokenNowOp;
diff --git a/packages/wallet-webui/src/testing/demo-wallet.ts b/packages/wallet-webui/src/testing/demo-wallet.ts
@@ -1537,7 +1537,7 @@ export class DemoWalletConnection implements WalletConnection {
walletCoreVersion: {
implementationSemver: "demo",
implementationGitHash: "demo",
- version: "11:0:0",
+ version: "12:0:0",
},
frontendInfo: request.frontendInfo,
database: { backend: "indexeddb", recordCounts: {} },