From 033edb4a46ff8d407baa25587cd5d86f6fc9c6c3 Mon Sep 17 00:00:00 2001 From: Philipp Walter Date: Tue, 30 Jul 2024 17:50:01 +0200 Subject: [PATCH] fix(activity): transfer amount & fees (#2112) --- src/utils/wallet/transfer.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/utils/wallet/transfer.ts b/src/utils/wallet/transfer.ts index 73e7ba813..73d18a188 100644 --- a/src/utils/wallet/transfer.ts +++ b/src/utils/wallet/transfer.ts @@ -14,22 +14,19 @@ export const getTransferForTx = async ( const { currentWallet, selectedNetwork } = getCurrentWallet(); const transfers = currentWallet.transfers[selectedNetwork]; - const transfer = transfers.find((t) => { - // check if the tx is a transfer to spending - const isTransferToSpending = t.txId === tx.txid; - if (isTransferToSpending) { - return true; - } + // check if the tx is a transfer to spending + const transferToSpending = transfers.find((t) => t.txId === tx.txid); + if (transferToSpending) { + return transferToSpending; + } - // if the funding tx is in the transfer list it's a mutual close + // if the funding tx is in the transfer list it's a mutual close + const transferToSavings = transfers.find((t) => { const txInput = tx.vin.find((vin) => t.txId === vin.txid); - if (txInput) { - return true; - } + return !!txInput; }); - - if (transfer) { - return transfer; + if (transferToSavings) { + return transferToSavings; } // If we haven't found a transfer yet, check if the tx is a sweep from a force close