Skip to content

Commit

Permalink
fix(activity): transfer amount & fees (#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr authored Jul 30, 2024
1 parent 3d37b47 commit 033edb4
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/utils/wallet/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 033edb4

Please sign in to comment.