From 948eb9ae8eae8d80087bfa4fe569e78eec8be61d Mon Sep 17 00:00:00 2001 From: Timur Sultanov Date: Tue, 7 Oct 2025 10:55:52 +0300 Subject: [PATCH 1/5] fix: correct amount calculation for self-transfer transactions in BTC, DASH, and DOGE --- src/lib/nodes/btc-indexer/utils.ts | 4 +++- src/lib/nodes/dash/utils.ts | 4 +++- src/lib/nodes/doge-indexer/utils.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/nodes/btc-indexer/utils.ts b/src/lib/nodes/btc-indexer/utils.ts index f05e79a71..686ce1467 100644 --- a/src/lib/nodes/btc-indexer/utils.ts +++ b/src/lib/nodes/btc-indexer/utils.ts @@ -12,6 +12,7 @@ export function normalizeTransaction( const recipients = tx.vout.map((vout) => vout.scriptpubkey_address) const direction = senders.includes(ownerAddress) ? 'from' : 'to' + const isSelfTransfer = senders.includes(ownerAddress) && recipients.includes(ownerAddress) if (direction === 'from') { // Disregard our address for an outgoing transaction unless it's the only address (i.e. we're sending to ourselves) @@ -31,9 +32,10 @@ export function normalizeTransaction( // Calculate amount from outputs: // * for the outgoing transactions take outputs that DO NOT target us // * for the incoming transactions take outputs that DO target us + // * for self-transfers take outputs that DO target us const amount = tx.vout.reduce( (sum, t) => - (direction === 'to') === (t.scriptpubkey_address === ownerAddress) + (isSelfTransfer || direction === 'to') === (t.scriptpubkey_address === ownerAddress) ? sum + Number(t.value) : sum, 0 diff --git a/src/lib/nodes/dash/utils.ts b/src/lib/nodes/dash/utils.ts index 3fbe6a28d..52e99f746 100644 --- a/src/lib/nodes/dash/utils.ts +++ b/src/lib/nodes/dash/utils.ts @@ -10,6 +10,7 @@ export function normalizeTransaction(tx: Transaction, ownerAddress: string): Das const recipients = tx.vout.flatMap((vout) => vout.scriptPubKey.addresses).filter(onlyUnique) const direction = senders.includes(ownerAddress) ? 'from' : 'to' + const isSelfTransfer = senders.includes(ownerAddress) && recipients.includes(ownerAddress) if (direction === 'from') { // Disregard our address for an outgoing transaction unless it's the only address (i.e. we're sending to ourselves) @@ -29,9 +30,10 @@ export function normalizeTransaction(tx: Transaction, ownerAddress: string): Das // Calculate amount from outputs: // * for the outgoing transactions take outputs that DO NOT target us // * for the incoming transactions take outputs that DO target us + // * for self-transfers take outputs that DO target us const amount = tx.vout.reduce( (sum, t) => - (direction === 'to') === t.scriptPubKey.addresses.includes(ownerAddress) + (isSelfTransfer || direction === 'to') === t.scriptPubKey.addresses.includes(ownerAddress) ? sum + Number(t.value) : sum, 0 diff --git a/src/lib/nodes/doge-indexer/utils.ts b/src/lib/nodes/doge-indexer/utils.ts index 458cf83af..337ff36f8 100644 --- a/src/lib/nodes/doge-indexer/utils.ts +++ b/src/lib/nodes/doge-indexer/utils.ts @@ -12,6 +12,7 @@ export function normalizeTransaction(tx: Transaction, ownerAddress: string): Dog const recipients = tx.vout.flatMap((vout) => vout.scriptPubKey.addresses).filter(onlyUnique) const direction = senders.includes(ownerAddress) ? 'from' : 'to' + const isSelfTransfer = senders.includes(ownerAddress) && recipients.includes(ownerAddress) if (direction === 'from') { // Disregard our address for an outgoing transaction unless it's the only address (i.e. we're sending to ourselves) @@ -31,9 +32,10 @@ export function normalizeTransaction(tx: Transaction, ownerAddress: string): Dog // Calculate amount from outputs: // * for the outgoing transactions take outputs that DO NOT target us // * for the incoming transactions take outputs that DO target us + // * for self-transfers take outputs that DO target us const amount = tx.vout.reduce( (sum, t) => - (direction === 'to') === t.scriptPubKey.addresses.includes(ownerAddress) + (isSelfTransfer || direction === 'to') === t.scriptPubKey.addresses.includes(ownerAddress) ? sum + Number(t.value) : sum, 0 From b628ae2c926703e8b8e1c133350aeb95ff1b8a52 Mon Sep 17 00:00:00 2001 From: Timur Sultanov Date: Fri, 10 Oct 2025 19:46:20 +0300 Subject: [PATCH 2/5] feat: add color coding for transaction direction icons --- src/components/TransactionListItem.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/TransactionListItem.vue b/src/components/TransactionListItem.vue index 5f1e5aac3..25816b22f 100644 --- a/src/components/TransactionListItem.vue +++ b/src/components/TransactionListItem.vue @@ -3,7 +3,7 @@