implement npubcash-sdk to simplify code

This commit is contained in:
lemonknowsall committed 2025-10-15 01:22:12 -07:00
1 parent 2ac097d8de
commit bd956cef3f
5 files changed
+265 -265

No files matched your search

+4 -29
View File
@@ -1,6 +1,5 @@
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Loader2, History, ArrowUpRight, ArrowDownLeft, Zap, ChevronDown, ChevronUp, Coins } from 'lucide-react';
import type { HistoryEntry } from 'coco-cashu-core';
@@ -43,32 +42,16 @@ export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpand
const getHistoryLabel = (type: string) => {
switch (type) {
case 'mint':
return 'Mint Tokens';
case 'melt':
return 'Melt Tokens';
case 'send':
return 'Send Tokens';
case 'receive':
return 'Receive Tokens';
return 'Received';
case 'melt':
case 'send':
return 'Sent';
default:
return type;
}
};
const getHistoryStateColor = (state?: string) => {
if (!state) return 'bg-gray-500';
switch (state) {
case 'PAID':
return 'bg-green-500';
case 'UNPAID':
return 'bg-yellow-500';
case 'PENDING':
return 'bg-blue-500';
default:
return 'bg-gray-500';
}
};
return (
<Card className="mt-6 border-0 shadow-none">
<CardHeader>
@@ -129,14 +112,6 @@ export function TransactionHistory({ entries, isLoading, isExpanded, setIsExpand
<span className="font-medium">
{getHistoryLabel(entry.type)}
</span>
{'state' in entry && entry.state && (
<Badge
variant="secondary"
className={`${getHistoryStateColor(entry.state)} text-white text-xs`}
>
{entry.state}
</Badge>
)}
</div>
<div className="text-sm text-muted-foreground mt-1">
{new URL(entry.mintUrl).hostname}