diff --git a/src/screens/Activity/ActivityDetail.tsx b/src/screens/Activity/ActivityDetail.tsx index 27ae195a1..df50eb531 100644 --- a/src/screens/Activity/ActivityDetail.tsx +++ b/src/screens/Activity/ActivityDetail.tsx @@ -313,24 +313,6 @@ const OnchainActivityDetail = ({ ); - if (isBoosted) { - status = ( - - - {t('activity_boosting')} - - ); - } - - if (confirmed) { - status = ( - - - {t('activity_confirmed')} - - ); - } - if (transfer) { fees = value - transfer.amount + fee; paymentAmount = transfer.amount; @@ -353,6 +335,24 @@ const OnchainActivityDetail = ({ ); } + if (isBoosted) { + status = ( + + + {t('activity_boosting')} + + ); + } + + if (confirmed) { + status = ( + + + {t('activity_confirmed')} + + ); + } + if (activityType === EActivityType.onchain && !exists) { status = ( diff --git a/src/screens/Activity/ListItem.tsx b/src/screens/Activity/ListItem.tsx index d982cd3fb..f40408f94 100644 --- a/src/screens/Activity/ListItem.tsx +++ b/src/screens/Activity/ListItem.tsx @@ -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 = ( - - - - ); - } else if (feeRateDescription) { + if (feeRateDescription) { description = t('activity_confirms_in', { feeRateDescription }); } else { description = t('activity_low_fee'); @@ -141,6 +131,22 @@ const OnchainListItem = ({ } } + if (isBoosted && !confirmed) { + description = t('activity_confirms_in_boosted', { feeRateDescription }); + icon = ( + + + + ); + } + + if (confirmed) { + if (!transfer) { + // NOTE: for users with earlier versions use the timestamp + description = getActivityItemDate(confirmTimestamp ?? timestamp); + } + } + return ( 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; }