commit b1322bf4461f36407792e36d2777a63a0744b3d6
parent f9401bcbf1efacfe82d96e9e0e1fedd5616512fa
Author: Florian Dold <florian@dold.me>
Date: Sun, 3 Aug 2025 22:57:50 +0200
wallet-core: handle missing deposit state transition
Diffstat:
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
@@ -265,7 +265,9 @@ async function createLocalWallet(
persistentStoragePath: dbPath !== ":memory:" ? dbPath : undefined,
httpLib: myHttpLib,
notifyHandler: (n) => {
- logger.info(`wallet notification: ${j2s(n)}`);
+ if (logger.shouldLogTrace()) {
+ logger.trace(`wallet notification: ${j2s(n)}`);
+ }
if (notificationHandler) {
notificationHandler(n);
}
@@ -859,6 +861,33 @@ walletCli
await cliPeerPushCredit(wallet, uri);
break;
}
+ case TalerUriAction.WithdrawExchange: {
+ const exchangeBaseUrl = parsedTalerUri.exchangeBaseUrl;
+ await wallet.client.call(WalletApiOperation.UpdateExchangeEntry, {
+ exchangeBaseUrl,
+ });
+ const exch = await wallet.client.call(
+ WalletApiOperation.GetExchangeEntryByUrl,
+ {
+ exchangeBaseUrl,
+ },
+ );
+ // FIXME: Maybe prompt for this?
+ await wallet.client.call(WalletApiOperation.SetExchangeTosAccepted, {
+ exchangeBaseUrl,
+ });
+ const res = await readlinePrompt(`Amount (in ${exch.currency}): `);
+ const amount = Amounts.stringify(Amounts.parseOrThrow(res));
+ const w = await wallet.client.call(
+ WalletApiOperation.AcceptManualWithdrawal,
+ {
+ amount,
+ exchangeBaseUrl,
+ },
+ );
+ console.log(`Transaction ID: ${w.transactionId}`);
+ break;
+ }
case TalerUriAction.Withdraw: {
const withdrawInfo = await wallet.client.call(
WalletApiOperation.GetWithdrawalDetailsForUri,
diff --git a/packages/taler-wallet-core/src/deposits.ts b/packages/taler-wallet-core/src/deposits.ts
@@ -1123,6 +1123,10 @@ async function processDepositGroupPendingKyc(
};
}
+ if (myKycState == null) {
+ logger.info("no kyc state yet");
+ }
+
if (myKycState == null || isKycOperationDue(myKycState)) {
switch (depositGroup.operationStatus) {
case DepositOperationStatus.PendingDepositKyc:
@@ -1331,7 +1335,17 @@ async function transitionToKycRequired(
dg.operationStatus = DepositOperationStatus.PendingDepositKyc;
}
break;
+ case DepositOperationStatus.PendingDepositKyc:
+ if (args.badKycAuth) {
+ dg.operationStatus = DepositOperationStatus.PendingDepositKycAuth;
+ }
+ break;
default:
+ logger.warn(
+ `transitionToKycRequired: state ${dg.operationStatus} / ${
+ DepositOperationStatus[dg.operationStatus]
+ } not handled`,
+ );
return;
}
if (dg.kycInfo && dg.kycInfo.exchangeBaseUrl === args.exchangeUrl) {
@@ -1786,6 +1800,7 @@ async function processDepositGroupPendingDeposit(
await wex.db.runReadWriteTx({ storeNames: ["depositGroups"] }, async (tx) => {
const dg = await tx.depositGroups.get(depositGroup.depositGroupId);
if (!dg) {
+ logger.warn(`deposit group ${depositGroup.depositGroupId} not found`);
return;
}
dg.timestampLastDepositAttempt = timestampPreciseToDb(
diff --git a/packages/taler-wallet-core/src/shepherd.ts b/packages/taler-wallet-core/src/shepherd.ts
@@ -354,11 +354,11 @@ export class TaskSchedulerImpl implements TaskScheduler {
await info.cts.token.racePromise(this.ws.timerGroup.resolveAfter(delay));
} catch (e) {
if (e instanceof CancellationToken.CancellationError) {
- logger.info(
+ logger.trace(
`waiting for ${taskId} interrupted: ${e.message} ${j2s(e.reason)}`,
);
} else {
- logger.info(`waiting for ${taskId} interrupted: ${e}`);
+ logger.trace(`waiting for ${taskId} interrupted: ${e}`);
}
}
}