From bda2474d19eea56468c56f204ec26e70807945f5 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sun, 4 Feb 2024 17:02:16 -0300 Subject: pretty --- packages/taler-wallet-core/src/operations/reward.ts | 21 ++++++++++++++------- .../src/operations/transactions.ts | 10 +++++----- packages/taler-wallet-core/src/wallet.ts | 12 ++++++++---- 3 files changed, 27 insertions(+), 16 deletions(-) (limited to 'packages') diff --git a/packages/taler-wallet-core/src/operations/reward.ts b/packages/taler-wallet-core/src/operations/reward.ts index 369c1f40d..6dcd48019 100644 --- a/packages/taler-wallet-core/src/operations/reward.ts +++ b/packages/taler-wallet-core/src/operations/reward.ts @@ -651,7 +651,7 @@ export async function acceptTipBackwardCompat( transactionIdParam: TransactionIdStr | undefined, ): Promise { if (transactionIdParam) { - return acceptTip(ws, transactionIdParam) + return acceptTip(ws, transactionIdParam); } if (walletTipId) { /** @@ -661,19 +661,26 @@ export async function acceptTipBackwardCompat( tag: TransactionType.Reward, walletRewardId: walletTipId, }); - return acceptTip(ws, transactionId) + return acceptTip(ws, transactionId); } - throw Error("Unable to accept tip: neither tipId (deprecated) nor transactionId was specified") + throw Error( + "Unable to accept tip: neither tipId (deprecated) nor transactionId was specified", + ); } export async function acceptTip( ws: InternalWalletState, transactionId: TransactionIdStr, ): Promise { - const pTxId = parseTransactionIdentifier(transactionId) - if (!pTxId) throw Error(`Unable to accept tip: invalid tx tag "${transactionId}"`) - const rewardId = pTxId.tag === TransactionType.Reward ? pTxId.walletRewardId : undefined; - if (!rewardId) throw Error(`Unable to accept tip: txId is not a reward tag "${pTxId.tag}"`) + const pTxId = parseTransactionIdentifier(transactionId); + if (!pTxId) + throw Error(`Unable to accept tip: invalid tx tag "${transactionId}"`); + const rewardId = + pTxId.tag === TransactionType.Reward ? pTxId.walletRewardId : undefined; + if (!rewardId) + throw Error( + `Unable to accept tip: txId is not a reward tag "${pTxId.tag}"`, + ); const dbRes = await ws.db .mktx((x) => [x.rewards]) .runReadWrite(async (tx) => { diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index f64d3d21d..8fd7afae6 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -539,7 +539,7 @@ function buildTransactionForPeerPullCredit( const silentWithdrawalErrorForInvoice = wsrOrt?.lastError && wsrOrt.lastError.code === - TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE && + TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE && Object.values(wsrOrt.lastError.errorsPerCoin ?? {}).every((e) => { return ( e.code === TalerErrorCode.WALLET_UNEXPECTED_REQUEST_ERROR && @@ -569,10 +569,10 @@ function buildTransactionForPeerPullCredit( kycUrl: pullCredit.kycUrl, ...(wsrOrt?.lastError ? { - error: silentWithdrawalErrorForInvoice - ? undefined - : wsrOrt.lastError, - } + error: silentWithdrawalErrorForInvoice + ? undefined + : wsrOrt.lastError, + } : {}), }; } diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 6440a9912..b8d11760c 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -735,9 +735,9 @@ async function dumpCoins(ws: InternalWalletState): Promise { ageCommitmentProof: c.ageCommitmentProof, spend_allocation: c.spendAllocation ? { - amount: c.spendAllocation.amount, - id: c.spendAllocation.id, - } + amount: c.spendAllocation.amount, + id: c.spendAllocation.id, + } : undefined, }); } @@ -1195,7 +1195,11 @@ async function dispatchRequestInternal( } case WalletApiOperation.AcceptReward: { const req = codecForAcceptTipRequest().decode(payload); - return await acceptTipBackwardCompat(ws, req.walletRewardId, req.transactionId); + return await acceptTipBackwardCompat( + ws, + req.walletRewardId, + req.transactionId, + ); } case WalletApiOperation.AddBackupProvider: { const req = codecForAddBackupProviderRequest().decode(payload); -- cgit v1.2.3