Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/screens/Activity/ActivityDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,24 +313,6 @@ const OnchainActivityDetail = ({
</ThemedView>
);

if (isBoosted) {
status = (
<View testID="StatusBoosting" style={styles.row}>
<TimerIconAlt style={styles.rowIcon} color="yellow" height={14} />
<BodySSB color="yellow">{t('activity_boosting')}</BodySSB>
</View>
);
}

if (confirmed) {
status = (
<View testID="StatusConfirmed" style={styles.row}>
<CheckCircleIcon style={styles.rowIcon} color="green" />
<BodySSB color="green">{t('activity_confirmed')}</BodySSB>
</View>
);
}

if (transfer) {
fees = value - transfer.amount + fee;
paymentAmount = transfer.amount;
Expand All @@ -353,6 +335,24 @@ const OnchainActivityDetail = ({
);
}

if (isBoosted) {
status = (
<View testID="StatusBoosting" style={styles.row}>
<TimerIconAlt style={styles.rowIcon} color="yellow" height={14} />
<BodySSB color="yellow">{t('activity_boosting')}</BodySSB>
</View>
);
}

if (confirmed) {
status = (
<View testID="StatusConfirmed" style={styles.row}>
<CheckCircleIcon style={styles.rowIcon} color="green" />
<BodySSB color="green">{t('activity_confirmed')}</BodySSB>
</View>
);
}

if (activityType === EActivityType.onchain && !exists) {
status = (
<View style={styles.row}>
Expand Down
28 changes: 17 additions & 11 deletions src/screens/Activity/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,7 @@ const OnchainListItem = ({
const amount = isSend ? value + fee : value;

let description;
if (confirmed) {
// NOTE: for users with earlier versions use the timestamp
description = getActivityItemDate(confirmTimestamp ?? timestamp);
} else if (isBoosted) {
description = t('activity_confirms_in_boosted', { feeRateDescription });
icon = (
<ThemedView testID="BoostingIcon" style={styles.icon} color="yellow16">
<TimerIconAlt height={13} color="yellow" />
</ThemedView>
);
} else if (feeRateDescription) {
if (feeRateDescription) {
description = t('activity_confirms_in', { feeRateDescription });
} else {
description = t('activity_low_fee');
Expand All @@ -141,6 +131,22 @@ const OnchainListItem = ({
}
}

if (isBoosted && !confirmed) {
description = t('activity_confirms_in_boosted', { feeRateDescription });
icon = (
<ThemedView style={styles.icon} color="yellow16" testID="BoostingIcon">
<TimerIconAlt height={13} color="yellow" />
</ThemedView>
);
}

if (confirmed) {
if (!transfer) {
// NOTE: for users with earlier versions use the timestamp
description = getActivityItemDate(confirmTimestamp ?? timestamp);
}
}

return (
<ListItem
title={title}
Expand Down
29 changes: 23 additions & 6 deletions src/utils/wallet/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import lm, { ldk } from '@synonymdev/react-native-ldk';

import { getCurrentWallet, getSelectedNetwork, refreshWallet } from '.';
import { btcToSats } from '../conversion';
import { getBoostedTransactionParents } from '../boost';
import { getTransactions } from './electrum';
import {
ETransferStatus,
Expand All @@ -34,13 +35,29 @@ export const getTransferForTx = async (
const transfers = currentWallet.transfers[selectedNetwork];

if (tx.type === EPaymentType.sent) {
const transfersToSpending = transfers.filter(
(t) => t.type === ETransferType.open,
);
const transfersToSpending = transfers.filter((t) => {
return t.type === ETransferType.open;
});

// check if the tx is a transfer to spending
const transferToSpending = transfersToSpending.find(
(t) => t.txId === tx.txid,
);
let transferToSpending = transfersToSpending.find((t) => {
return t.txId === tx.txid;
});

// check if the tx is a transfer that was boosted
if (!transferToSpending) {
const boostedParents = getBoostedTransactionParents({ txId: tx.txid });
const isBoosted = boostedParents.length > 0;
if (isBoosted) {
transferToSpending = transfersToSpending.find((t) => {
const boostedParent = boostedParents.find((txId) => {
return t.txId === txId;
});
return t.txId === boostedParent;
});
}
}

if (transferToSpending) {
return transferToSpending;
}
Expand Down
Loading