On-Chain Sent and Consolidation History, UTXO balance update

This commit is contained in:
lemonknowsall committed 2025-11-03 17:06:22 -08:00
1 parent e0031c6b14
commit 516461ae6e
2 files changed
+140 -52

No files matched your search

+7 -5
View File
@@ -1,10 +1,10 @@
import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, Coins, Link } from 'lucide-react';
import { Loader2, History, ArrowUpRight, ArrowDownLeft, ArrowLeftRight, Zap, Coins, Link } from 'lucide-react';
import type { HistoryEntry } from 'coco-cashu-core';
export interface BitcoinTransaction {
id: string;
txid: string;
type: 'sent' | 'received';
type: 'sent' | 'received' | 'consolidate';
amount: number; // in satoshis
fee?: number; // in satoshis, only for sent transactions
address: string;
@@ -170,7 +170,7 @@ export function TransactionHistory({
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2 flex-wrap">
<span className="font-medium">
{tx.type === 'received' ? 'Received' : 'Sent'}
{tx.type === 'received' ? 'Received' : tx.type === 'consolidate' ? 'Consolidate' : 'Sent'}
</span>
<span className={`text-xs px-2 py-1 rounded-full bg-muted ${getBitcoinStatusColor(tx.status)}`}>
{tx.status}
@@ -197,10 +197,10 @@ export function TransactionHistory({
<div className="text-right ml-4 flex items-start gap-2">
<div>
<div className="font-semibold">
{tx.type === 'sent' ? '-' : '+'}
{tx.type === 'sent' ? '-' : tx.type === 'consolidate' ? '' : '+'}
{formatBitcoinAmount(tx.amount)}
</div>
{tx.fee !== undefined && tx.fee > 0 && tx.type === 'sent' && (
{tx.fee !== undefined && tx.fee > 0 && (tx.type === 'sent' || tx.type === 'consolidate') && (
<div className="text-xs text-muted-foreground mt-1">
Fee: {formatBitcoinAmount(tx.fee)}
</div>
@@ -209,6 +209,8 @@ export function TransactionHistory({
<div className="mt-1">
{tx.type === 'received' ? (
<ArrowDownLeft className="h-4 w-4 text-green-500" />
) : tx.type === 'consolidate' ? (
<ArrowLeftRight className="h-4 w-4 text-blue-500" />
) : (
<ArrowUpRight className="h-4 w-4 text-red-500" />
)}