commit 8db12300f2970ff63906f4ea9cbde712359ff6b5 parent 3b4abef14cc196415b106ddc12794a9b4e78aacc Author: Florian Dold <dold@taler.net> Date: Mon, 10 Aug 2026 00:15:05 +0200 wallet-cli: shorten local transaction references Diffstat:
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet-transactions.ts b/packages/taler-util/src/types-taler-wallet-transactions.ts @@ -301,7 +301,7 @@ export interface TransactionCommon { /** * Short identifier assigned by this wallet for local, human-facing use. * - * It has the form `txn#${type}#${localIdent}`. It is intentionally not + * It has the form `#${type}:${localIdent}`. It is intentionally not * portable: importing or merging a wallet can assign different local * identifiers. Clients must use transactionId when they need a stable ID. * Undefined when the active wallet backend does not support local IDs. diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts @@ -843,7 +843,7 @@ async function resolveTxRef( ): Promise<TransactionIdStr> { const ref = parseTxRef(arg); if (ref.kind === "id") { - if (ref.transactionId.startsWith("txn#")) { + if (ref.transactionId.startsWith("#")) { const resolved = await ctx.client.call( WalletApiOperation.ResolveTransactionReference, { transactionReference: ref.transactionId }, diff --git a/packages/taler-wallet-cli/src/transactions-pretty.test.ts b/packages/taler-wallet-cli/src/transactions-pretty.test.ts @@ -49,7 +49,7 @@ function makeTx(extra: Record<string, unknown> = {}): Transaction { test("pretty output leads a waiting user to continue the transaction", () => { const lines = formatPrettyTransaction( - makeTx({ localTransactionId: "txn#payment#7" }), + makeTx({ localTransactionId: "#payment:7" }), { kind: ContinuationKind.ConfirmPayment, actionable: true, @@ -59,10 +59,10 @@ test("pretty output leads a waiting user to continue the transaction", () => { ); assert.deepStrictEqual(lines, [ - "txn#payment#7 payment KUDOS:5.01 [dialog:proposed]", + "#payment:7 payment KUDOS:5.01 [dialog:proposed]", " Lunch — The Café", " Next: the merchant's offer is waiting to be accepted", - " Run: taler-wallet transactions continue txn#payment#7", + " Run: taler-wallet transactions continue #payment:7", ]); }); diff --git a/packages/taler-wallet-cli/src/txref.ts b/packages/taler-wallet-cli/src/txref.ts @@ -33,7 +33,7 @@ import { CliUsageError } from "./waitspec.js"; * Syntax of a transaction reference, as shown in the command line help. */ export const TX_REF_SYNTAX = - "Either a transaction identifier (including a local 'txn#TYPE#ID'), or '^N' for the N-th most recent" + + "Either a transaction identifier (including a local '#TYPE:ID'), or '^N' for the N-th most recent" + " transaction ('^' means '^1')."; export type TxRef = diff --git a/packages/taler-wallet-core/src/transactions.ts b/packages/taler-wallet-core/src/transactions.ts @@ -259,7 +259,7 @@ function withLocalTransactionIdentifier( } return { ...tx, - localTransactionId: `txn#${tx.type}#${localIdent}`, + localTransactionId: `#${tx.type}:${localIdent}`, } as Transaction; } @@ -276,7 +276,7 @@ export async function resolveTransactionReference( if (parseTransactionIdentifier(ref) != null) { return { transactionId: ref as TransactionIdStr }; } - const match = /^txn#([^#]+)#([^#]+)$/.exec(ref); + const match = /^#([^:]+):([^:]+)$/.exec(ref); if ( match == null || !Object.values(TransactionType).includes(match[1] as TransactionType)