mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
UTXO consolidator, removed UTXO selection, centralized bitcoin hooks
This commit is contained in:
1 parent
fabbb0b50e
commit
cfd1e7269f
5 files changed
+403
-233
No files matched your search
@@ -11,8 +11,8 @@ import { useMintManager } from '@/hooks/cashu/useMintManager';
|
|||||||
import { useWalletTransactions } from '@/hooks/cashu/useWalletTransactions';
|
import { useWalletTransactions } from '@/hooks/cashu/useWalletTransactions';
|
||||||
import { useHistoryManager } from '@/hooks/cashu/useHistoryManager';
|
import { useHistoryManager } from '@/hooks/cashu/useHistoryManager';
|
||||||
import { useNsecAccess } from '@/hooks/useNsecAccess';
|
import { useNsecAccess } from '@/hooks/useNsecAccess';
|
||||||
import { useBitcoinBalance, useBitcoinTransactionHistory } from '@/hooks/useBitcoinBalance';
|
import { useBitcoinBalance, useBitcoinTransactionHistory, useBitcoinOperations } from '@/hooks/useBitcoinBalance';
|
||||||
import { nostrPubkeyToBitcoinAddress, npubToBitcoinAddress, fetchUTXOs, getFeeRates, createBitcoinTransaction, broadcastTransaction, calculateMaxSendAmount, UTXO } from '@/lib/bitcoin';
|
import { nostrPubkeyToBitcoinAddress, UTXO } from '@/lib/bitcoin';
|
||||||
import { QRModal } from '@/components/ui/qr-modal';
|
import { QRModal } from '@/components/ui/qr-modal';
|
||||||
import { WalletHeader } from './WalletHeader';
|
import { WalletHeader } from './WalletHeader';
|
||||||
import { TransactionCard } from './PaymentCard';
|
import { TransactionCard } from './PaymentCard';
|
||||||
@@ -48,9 +48,22 @@ export function CashuWallet() {
|
|||||||
const { copy: copyToClipboard } = useCopyToClipboard();
|
const { copy: copyToClipboard } = useCopyToClipboard();
|
||||||
|
|
||||||
// Bitcoin hooks - including balance and transaction history
|
// Bitcoin hooks - including balance and transaction history
|
||||||
const { hasNsecAccess, getPrivateKey } = useNsecAccess();
|
|
||||||
const bitcoinAddress = user?.pubkey ? nostrPubkeyToBitcoinAddress(user.pubkey) : null;
|
const bitcoinAddress = user?.pubkey ? nostrPubkeyToBitcoinAddress(user.pubkey) : null;
|
||||||
const { data: bitcoinBalanceData, isLoading: isBitcoinBalanceLoading, refetch: refetchBitcoinBalance } = useBitcoinBalance(bitcoinAddress);
|
const { data: bitcoinBalanceData, isLoading: isBitcoinBalanceLoading } = useBitcoinBalance(bitcoinAddress);
|
||||||
|
|
||||||
|
// Bitcoin operations hook
|
||||||
|
const {
|
||||||
|
utxos,
|
||||||
|
isLoadingUtxos,
|
||||||
|
feeRate,
|
||||||
|
isConsolidating,
|
||||||
|
bitcoinMaxAmount,
|
||||||
|
fetchBitcoinUtxos,
|
||||||
|
handleSendMax,
|
||||||
|
handleBitcoinSend,
|
||||||
|
handleBitcoinReceive,
|
||||||
|
handleConsolidateUtxos,
|
||||||
|
} = useBitcoinOperations(bitcoinAddress);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
setMint: setNpubCashMint,
|
setMint: setNpubCashMint,
|
||||||
@@ -177,23 +190,11 @@ export function CashuWallet() {
|
|||||||
const [showBitcoinAddressQR, setShowBitcoinAddressQR] = useState(false);
|
const [showBitcoinAddressQR, setShowBitcoinAddressQR] = useState(false);
|
||||||
const [bitcoinAddressQRCode, setBitcoinAddressQRCode] = useState('');
|
const [bitcoinAddressQRCode, setBitcoinAddressQRCode] = useState('');
|
||||||
const [showSeedPhraseInfo, setShowSeedPhraseInfo] = useState(false);
|
const [showSeedPhraseInfo, setShowSeedPhraseInfo] = useState(false);
|
||||||
|
const [showConsolidationModal, setShowConsolidationModal] = useState(false);
|
||||||
|
|
||||||
// UTXO state
|
// UTXO state
|
||||||
const [utxos, setUtxos] = useState<UTXO[]>([]);
|
|
||||||
const [utxoDropdownOpen, setUtxoDropdownOpen] = useState(false);
|
const [utxoDropdownOpen, setUtxoDropdownOpen] = useState(false);
|
||||||
const [selectedUtxo, setSelectedUtxo] = useState<UTXO | null>(null);
|
|
||||||
const [isLoadingUtxos, setIsLoadingUtxos] = useState(false);
|
|
||||||
const [feeRate, setFeeRate] = useState<number>(1);
|
|
||||||
|
|
||||||
// Calculate max send amount
|
|
||||||
const bitcoinMaxAmount = utxos.length > 0 ? calculateMaxSendAmount(utxos, feeRate) : 0;
|
|
||||||
|
|
||||||
// Handle Send Max
|
|
||||||
const handleSendMax = () => {
|
|
||||||
if (bitcoinMaxAmount > 0) {
|
|
||||||
setBitcoinAmount(bitcoinMaxAmount.toString());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Handle drawer close with state reset
|
// Handle drawer close with state reset
|
||||||
const handleSendDrawerClose = (open: boolean) => {
|
const handleSendDrawerClose = (open: boolean) => {
|
||||||
@@ -226,129 +227,6 @@ export function CashuWallet() {
|
|||||||
// Ref to track if we've fetched npub.cash user info
|
// Ref to track if we've fetched npub.cash user info
|
||||||
const hasCheckedNpubCashRef = useRef(false);
|
const hasCheckedNpubCashRef = useRef(false);
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// BITCOIN HANDLERS
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
const handleBitcoinSend = async () => {
|
|
||||||
if (!hasNsecAccess || !bitcoinAmount || !pendingBitcoinRecipient || !bitcoinAddress) {
|
|
||||||
toast({
|
|
||||||
variant: "destructive",
|
|
||||||
title: "Bitcoin Send Error",
|
|
||||||
description: "Missing required information for Bitcoin transaction",
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const privateKey = getPrivateKey();
|
|
||||||
if (!privateKey) {
|
|
||||||
throw new Error('Unable to access private key');
|
|
||||||
}
|
|
||||||
|
|
||||||
const amountSats = parseInt(bitcoinAmount);
|
|
||||||
if (isNaN(amountSats) || amountSats <= 0) {
|
|
||||||
throw new Error('Invalid amount');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine if the recipient is a Bitcoin address or npub
|
|
||||||
let recipientAddress: string;
|
|
||||||
if (pendingBitcoinRecipient.startsWith('bc1') || pendingBitcoinRecipient.startsWith('1') || pendingBitcoinRecipient.startsWith('3')) {
|
|
||||||
// It's already a Bitcoin address
|
|
||||||
recipientAddress = pendingBitcoinRecipient;
|
|
||||||
} else if (pendingBitcoinRecipient.startsWith('npub')) {
|
|
||||||
// It's an npub, convert to Bitcoin address
|
|
||||||
recipientAddress = npubToBitcoinAddress(pendingBitcoinRecipient);
|
|
||||||
} else {
|
|
||||||
// Assume it's a hex pubkey
|
|
||||||
recipientAddress = nostrPubkeyToBitcoinAddress(pendingBitcoinRecipient);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch UTXOs and fee rates
|
|
||||||
const [utxos, feeRates] = await Promise.all([
|
|
||||||
fetchUTXOs(bitcoinAddress),
|
|
||||||
getFeeRates()
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Check if this is a Send Max transaction
|
|
||||||
const isSendMax = amountSats === bitcoinMaxAmount && bitcoinMaxAmount > 0;
|
|
||||||
|
|
||||||
// Create and sign transaction
|
|
||||||
const { txHex, fee } = await createBitcoinTransaction(
|
|
||||||
privateKey,
|
|
||||||
recipientAddress,
|
|
||||||
amountSats,
|
|
||||||
utxos,
|
|
||||||
feeRates.fastestFee,
|
|
||||||
isSendMax
|
|
||||||
);
|
|
||||||
|
|
||||||
// Broadcast transaction
|
|
||||||
const txId = await broadcastTransaction(txHex);
|
|
||||||
|
|
||||||
toast({
|
|
||||||
title: "Bitcoin Sent!",
|
|
||||||
description: `Transaction ${txId.slice(0, 8)}... confirmed (Fee: ${fee} sats)`,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Reset form and refresh balance
|
|
||||||
setBitcoinAmount('');
|
|
||||||
setBitcoinRecipient('');
|
|
||||||
setPendingBitcoinRecipient(null);
|
|
||||||
refetchBitcoinBalance();
|
|
||||||
setShowSendModal(false);
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Bitcoin send error:', error);
|
|
||||||
toast({
|
|
||||||
variant: "destructive",
|
|
||||||
title: "Bitcoin Send Failed",
|
|
||||||
description: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleBitcoinReceive = async () => {
|
|
||||||
if (!bitcoinAddress) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const qr = await generateQRCode(bitcoinAddress);
|
|
||||||
setBitcoinAddressQRCode(qr);
|
|
||||||
setShowBitcoinAddressQR(true);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('QR generation error:', error);
|
|
||||||
toast({
|
|
||||||
variant: "destructive",
|
|
||||||
title: "QR Code Error",
|
|
||||||
description: "Failed to generate QR code",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Fetch UTXOs for Bitcoin mode
|
|
||||||
const fetchBitcoinUtxos = async () => {
|
|
||||||
if (!bitcoinAddress || mode !== 'bitcoin') return;
|
|
||||||
|
|
||||||
setIsLoadingUtxos(true);
|
|
||||||
try {
|
|
||||||
const [fetchedUtxos, feeRates] = await Promise.all([
|
|
||||||
fetchUTXOs(bitcoinAddress),
|
|
||||||
getFeeRates()
|
|
||||||
]);
|
|
||||||
setUtxos(fetchedUtxos);
|
|
||||||
setFeeRate(feeRates.fastestFee);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching UTXOs:', error);
|
|
||||||
toast({
|
|
||||||
variant: "destructive",
|
|
||||||
title: "UTXO Error",
|
|
||||||
description: "Failed to fetch Bitcoin UTXOs",
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setIsLoadingUtxos(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// COMPUTED VALUES
|
// COMPUTED VALUES
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -449,11 +327,8 @@ export function CashuWallet() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (mode === 'bitcoin' && bitcoinAddress) {
|
if (mode === 'bitcoin' && bitcoinAddress) {
|
||||||
fetchBitcoinUtxos();
|
fetchBitcoinUtxos();
|
||||||
} else {
|
|
||||||
// Clear UTXOs when not in Bitcoin mode
|
|
||||||
setUtxos([]);
|
|
||||||
}
|
}
|
||||||
}, [mode, bitcoinAddress]);
|
}, [mode, bitcoinAddress, fetchBitcoinUtxos]);
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// EFFECTS - Cleanup
|
// EFFECTS - Cleanup
|
||||||
@@ -514,8 +389,8 @@ export function CashuWallet() {
|
|||||||
utxos={utxos}
|
utxos={utxos}
|
||||||
utxoDropdownOpen={utxoDropdownOpen}
|
utxoDropdownOpen={utxoDropdownOpen}
|
||||||
setUtxoDropdownOpen={setUtxoDropdownOpen}
|
setUtxoDropdownOpen={setUtxoDropdownOpen}
|
||||||
selectedUtxo={selectedUtxo}
|
onShowConsolidationModal={() => setShowConsolidationModal(true)}
|
||||||
setSelectedUtxo={setSelectedUtxo}
|
isConsolidating={isConsolidating}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
@@ -567,6 +442,11 @@ export function CashuWallet() {
|
|||||||
mintToRemove={mintToRemove}
|
mintToRemove={mintToRemove}
|
||||||
onConfirmRemoveMint={handleConfirmRemoveMint}
|
onConfirmRemoveMint={handleConfirmRemoveMint}
|
||||||
isLoading={isLoading || isNpubCashLoading}
|
isLoading={isLoading || isNpubCashLoading}
|
||||||
|
showConsolidationModal={showConsolidationModal}
|
||||||
|
setShowConsolidationModal={setShowConsolidationModal}
|
||||||
|
utxos={utxos}
|
||||||
|
onConfirmConsolidation={handleConsolidateUtxos}
|
||||||
|
isConsolidating={isConsolidating}
|
||||||
showLightningAddressQR={showLightningAddressQR}
|
showLightningAddressQR={showLightningAddressQR}
|
||||||
setShowLightningAddressQR={setShowLightningAddressQR}
|
setShowLightningAddressQR={setShowLightningAddressQR}
|
||||||
lightningAddressQRCode={lightningAddressQRCode}
|
lightningAddressQRCode={lightningAddressQRCode}
|
||||||
@@ -614,7 +494,14 @@ export function CashuWallet() {
|
|||||||
activeMintUrl={activeMintUrl}
|
activeMintUrl={activeMintUrl}
|
||||||
onSend={() => {
|
onSend={() => {
|
||||||
if (mode === 'bitcoin') {
|
if (mode === 'bitcoin') {
|
||||||
handleBitcoinSend();
|
handleBitcoinSend(
|
||||||
|
bitcoinAmount,
|
||||||
|
pendingBitcoinRecipient,
|
||||||
|
setBitcoinAmount,
|
||||||
|
setBitcoinRecipient,
|
||||||
|
setPendingBitcoinRecipient,
|
||||||
|
setShowSendModal
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
const wasPendingBefore = pendingLightningAddress !== null && pendingLightningAddress !== '';
|
const wasPendingBefore = pendingLightningAddress !== null && pendingLightningAddress !== '';
|
||||||
handleSend();
|
handleSend();
|
||||||
@@ -638,9 +525,8 @@ export function CashuWallet() {
|
|||||||
setBitcoinRecipient={setBitcoinRecipient}
|
setBitcoinRecipient={setBitcoinRecipient}
|
||||||
pendingBitcoinRecipient={pendingBitcoinRecipient}
|
pendingBitcoinRecipient={pendingBitcoinRecipient}
|
||||||
setPendingBitcoinRecipient={setPendingBitcoinRecipient}
|
setPendingBitcoinRecipient={setPendingBitcoinRecipient}
|
||||||
hasNsecAccess={hasNsecAccess}
|
|
||||||
bitcoinMaxAmount={bitcoinMaxAmount}
|
bitcoinMaxAmount={bitcoinMaxAmount}
|
||||||
onSendMax={handleSendMax}
|
onSendMax={() => handleSendMax(setBitcoinAmount)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</DrawerContent>
|
</DrawerContent>
|
||||||
@@ -677,7 +563,7 @@ export function CashuWallet() {
|
|||||||
onSend={() => {}}
|
onSend={() => {}}
|
||||||
onReceive={() => {
|
onReceive={() => {
|
||||||
if (mode === 'bitcoin') {
|
if (mode === 'bitcoin') {
|
||||||
handleBitcoinReceive();
|
handleBitcoinReceive(setBitcoinAddressQRCode, setShowBitcoinAddressQR);
|
||||||
setShowReceiveModal(false);
|
setShowReceiveModal(false);
|
||||||
} else {
|
} else {
|
||||||
handleReceive();
|
handleReceive();
|
||||||
@@ -694,7 +580,6 @@ export function CashuWallet() {
|
|||||||
setBitcoinRecipient={() => {}}
|
setBitcoinRecipient={() => {}}
|
||||||
pendingBitcoinRecipient={null}
|
pendingBitcoinRecipient={null}
|
||||||
setPendingBitcoinRecipient={() => {}}
|
setPendingBitcoinRecipient={() => {}}
|
||||||
hasNsecAccess={hasNsecAccess}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</DrawerContent>
|
</DrawerContent>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { ChevronDown, Wallet, Check } from 'lucide-react';
|
import { ChevronDown, ArrowRightLeft } from 'lucide-react';
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { exchangeRateService } from '@/lib/exchangeRateService';
|
import { exchangeRateService } from '@/lib/exchangeRateService';
|
||||||
import {
|
import {
|
||||||
@@ -16,8 +16,8 @@ interface UTXOSelectorProps {
|
|||||||
bitcoinAddress: string;
|
bitcoinAddress: string;
|
||||||
dropdownOpen: boolean;
|
dropdownOpen: boolean;
|
||||||
setDropdownOpen: (open: boolean) => void;
|
setDropdownOpen: (open: boolean) => void;
|
||||||
selectedUtxo: UTXO | null;
|
onShowConsolidationModal?: () => void;
|
||||||
setSelectedUtxo: (utxo: UTXO | null) => void;
|
isConsolidating?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UTXOSelector({
|
export function UTXOSelector({
|
||||||
@@ -26,8 +26,8 @@ export function UTXOSelector({
|
|||||||
bitcoinAddress,
|
bitcoinAddress,
|
||||||
dropdownOpen,
|
dropdownOpen,
|
||||||
setDropdownOpen,
|
setDropdownOpen,
|
||||||
selectedUtxo,
|
onShowConsolidationModal,
|
||||||
setSelectedUtxo,
|
isConsolidating,
|
||||||
}: UTXOSelectorProps) {
|
}: UTXOSelectorProps) {
|
||||||
const [btcUsdRate, setBtcUsdRate] = useState<number | null>(null);
|
const [btcUsdRate, setBtcUsdRate] = useState<number | null>(null);
|
||||||
|
|
||||||
@@ -37,28 +37,6 @@ export function UTXOSelector({
|
|||||||
.catch(() => setBtcUsdRate(null));
|
.catch(() => setBtcUsdRate(null));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Auto-select first UTXO when UTXOs are loaded and none is selected
|
|
||||||
// Also handle case where selected UTXO is no longer available
|
|
||||||
useEffect(() => {
|
|
||||||
if (utxos.length > 0) {
|
|
||||||
if (!selectedUtxo) {
|
|
||||||
// No UTXO selected, select the first one
|
|
||||||
setSelectedUtxo(utxos[0]);
|
|
||||||
} else {
|
|
||||||
// Check if currently selected UTXO still exists in the list
|
|
||||||
const stillExists = utxos.some(utxo =>
|
|
||||||
utxo.txid === selectedUtxo.txid && utxo.vout === selectedUtxo.vout
|
|
||||||
);
|
|
||||||
if (!stillExists) {
|
|
||||||
// Selected UTXO no longer exists, select the first available one
|
|
||||||
setSelectedUtxo(utxos[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// No UTXOs available, clear selection
|
|
||||||
setSelectedUtxo(null);
|
|
||||||
}
|
|
||||||
}, [utxos, selectedUtxo, setSelectedUtxo]);
|
|
||||||
|
|
||||||
const formatBalance = (sats: number): string => {
|
const formatBalance = (sats: number): string => {
|
||||||
if (showSats) {
|
if (showSats) {
|
||||||
@@ -93,21 +71,12 @@ export function UTXOSelector({
|
|||||||
>
|
>
|
||||||
<div className="flex items-center justify-between w-full min-w-0">
|
<div className="flex items-center justify-between w-full min-w-0">
|
||||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||||
{selectedUtxo ? (
|
<span className="truncate font-medium min-w-0 flex-1">
|
||||||
<>
|
{utxos.length === 0 ? 'No UTXOs' : `${utxos.length} UTXO${utxos.length !== 1 ? 's' : ''}`}
|
||||||
<Check className="h-5 w-5 text-primary flex-shrink-0" />
|
</span>
|
||||||
<span className="truncate font-medium min-w-0 flex-1">
|
|
||||||
{formatUTXOBlock(selectedUtxo)}
|
|
||||||
</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span className="truncate font-medium min-w-0 flex-1">
|
|
||||||
{utxos.length === 0 ? 'No UTXOs' : `${utxos.length} UTXO${utxos.length !== 1 ? 's' : ''}`}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<span className="text-muted-foreground font-medium flex-shrink-0 ml-2">
|
<span className="text-muted-foreground font-medium flex-shrink-0 ml-2">
|
||||||
{selectedUtxo ? formatBalance(selectedUtxo.value) : formatBalance(totalBalance)}
|
{formatBalance(totalBalance)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<ChevronDown className="h-5 w-5 ml-2 flex-shrink-0" />
|
<ChevronDown className="h-5 w-5 ml-2 flex-shrink-0" />
|
||||||
@@ -120,50 +89,40 @@ export function UTXOSelector({
|
|||||||
No UTXOs available
|
No UTXOs available
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
) : (
|
) : (
|
||||||
utxos.map((utxo, index) => {
|
utxos.map((utxo, index) => (
|
||||||
const isSelected = selectedUtxo &&
|
<DropdownMenuItem
|
||||||
selectedUtxo.txid === utxo.txid &&
|
key={`utxo-${utxo.txid}-${utxo.vout}`}
|
||||||
selectedUtxo.vout === utxo.vout;
|
className="flex items-center justify-between p-3 text-base"
|
||||||
|
>
|
||||||
return (
|
<div className="flex items-center gap-3 flex-1 min-w-0">
|
||||||
<DropdownMenuItem
|
<div className="flex-1 min-w-0">
|
||||||
key={`utxo-${utxo.txid}-${utxo.vout}`}
|
<div className="font-medium truncate text-sm">
|
||||||
className="flex items-center justify-between p-3 text-base"
|
{formatUTXOBlock(utxo)}
|
||||||
onClick={() => setSelectedUtxo(isSelected ? null : utxo)}
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-3 flex-1 min-w-0">
|
|
||||||
{isSelected && (
|
|
||||||
<div className="flex-shrink-0">
|
|
||||||
<Check className="h-5 w-5 text-primary" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<div className="font-medium truncate text-sm">
|
|
||||||
{formatUTXOBlock(utxo)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2 flex-shrink-0">
|
</div>
|
||||||
<span className="px-3 py-1 text-sm font-medium text-muted-foreground">
|
<div className="flex items-center gap-2 flex-shrink-0">
|
||||||
{formatBalance(utxo.value)}
|
<span className="px-3 py-1 text-sm font-medium text-muted-foreground">
|
||||||
</span>
|
{formatBalance(utxo.value)}
|
||||||
</div>
|
</span>
|
||||||
</DropdownMenuItem>
|
</div>
|
||||||
);
|
</DropdownMenuItem>
|
||||||
})
|
))
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
|
||||||
<div className="flex flex-col gap-1">
|
{onShowConsolidationModal && (
|
||||||
<button
|
<button
|
||||||
className="flex items-center justify-center px-2 py-1.5 hover:bg-muted rounded-md transition-colors h-[40px] w-[42px] flex-shrink-0"
|
onClick={onShowConsolidationModal}
|
||||||
title="Bitcoin wallet"
|
disabled={isConsolidating}
|
||||||
|
className="flex items-center justify-center px-2 py-1.5 hover:bg-muted rounded-md transition-colors h-[40px] w-[42px] flex-shrink-0 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
|
title="Consolidate UTXOs"
|
||||||
>
|
>
|
||||||
<Wallet className="h-4 w-4" />
|
<ArrowRightLeft className="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -44,8 +44,8 @@ interface WalletHeaderProps {
|
|||||||
utxos: UTXO[];
|
utxos: UTXO[];
|
||||||
utxoDropdownOpen: boolean;
|
utxoDropdownOpen: boolean;
|
||||||
setUtxoDropdownOpen: (open: boolean) => void;
|
setUtxoDropdownOpen: (open: boolean) => void;
|
||||||
selectedUtxo: UTXO | null;
|
onShowConsolidationModal?: () => void;
|
||||||
setSelectedUtxo: (utxo: UTXO | null) => void;
|
isConsolidating?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions to prevent syntax errors in complex expressions
|
// Helper functions to prevent syntax errors in complex expressions
|
||||||
@@ -134,8 +134,8 @@ export function WalletHeader({
|
|||||||
utxos,
|
utxos,
|
||||||
utxoDropdownOpen,
|
utxoDropdownOpen,
|
||||||
setUtxoDropdownOpen,
|
setUtxoDropdownOpen,
|
||||||
selectedUtxo,
|
onShowConsolidationModal,
|
||||||
setSelectedUtxo,
|
isConsolidating,
|
||||||
}: WalletHeaderProps) {
|
}: WalletHeaderProps) {
|
||||||
const [lightningAddressCopied, setLightningAddressCopied] = useState(false);
|
const [lightningAddressCopied, setLightningAddressCopied] = useState(false);
|
||||||
const [bitcoinAddressCopied, setBitcoinAddressCopied] = useState(false);
|
const [bitcoinAddressCopied, setBitcoinAddressCopied] = useState(false);
|
||||||
@@ -342,8 +342,8 @@ export function WalletHeader({
|
|||||||
bitcoinAddress={userPubkey ? nostrPubkeyToBitcoinAddress(userPubkey) : ''}
|
bitcoinAddress={userPubkey ? nostrPubkeyToBitcoinAddress(userPubkey) : ''}
|
||||||
dropdownOpen={utxoDropdownOpen}
|
dropdownOpen={utxoDropdownOpen}
|
||||||
setDropdownOpen={setUtxoDropdownOpen}
|
setDropdownOpen={setUtxoDropdownOpen}
|
||||||
selectedUtxo={selectedUtxo}
|
onShowConsolidationModal={onShowConsolidationModal}
|
||||||
setSelectedUtxo={setSelectedUtxo}
|
isConsolidating={isConsolidating}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { X, Coins, AlertTriangle, RefreshCw, Key } from 'lucide-react';
|
import { X, Coins, AlertTriangle, RefreshCw, Key, ArrowRightLeft } from 'lucide-react';
|
||||||
import { QRModal } from '@/components/ui/qr-modal';
|
import { QRModal } from '@/components/ui/qr-modal';
|
||||||
import { nip19 } from 'nostr-tools';
|
import { nip19 } from 'nostr-tools';
|
||||||
import { useToast } from '@/hooks/useToast';
|
import { useToast } from '@/hooks/useToast';
|
||||||
|
import { UTXO } from '@/lib/bitcoin';
|
||||||
|
|
||||||
// Helper function to prevent complex template literals
|
// Helper function to prevent complex template literals
|
||||||
const getLightningAddress = (userPubkey?: string, npubCashUserInfo?: { name?: string } | null): string => {
|
const getLightningAddress = (userPubkey?: string, npubCashUserInfo?: { name?: string } | null): string => {
|
||||||
@@ -37,6 +38,13 @@ interface WalletModalProps {
|
|||||||
onConfirmRemoveMint: () => void;
|
onConfirmRemoveMint: () => void;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
|
|
||||||
|
// Consolidation Modal
|
||||||
|
showConsolidationModal: boolean;
|
||||||
|
setShowConsolidationModal: (show: boolean) => void;
|
||||||
|
utxos: UTXO[];
|
||||||
|
onConfirmConsolidation: () => void;
|
||||||
|
isConsolidating: boolean;
|
||||||
|
|
||||||
// QR Modals
|
// QR Modals
|
||||||
showLightningAddressQR: boolean;
|
showLightningAddressQR: boolean;
|
||||||
setShowLightningAddressQR: (show: boolean) => void;
|
setShowLightningAddressQR: (show: boolean) => void;
|
||||||
@@ -74,6 +82,11 @@ export function WalletModals({
|
|||||||
mintToRemove,
|
mintToRemove,
|
||||||
onConfirmRemoveMint,
|
onConfirmRemoveMint,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
showConsolidationModal,
|
||||||
|
setShowConsolidationModal,
|
||||||
|
utxos,
|
||||||
|
onConfirmConsolidation,
|
||||||
|
isConsolidating,
|
||||||
showLightningAddressQR,
|
showLightningAddressQR,
|
||||||
setShowLightningAddressQR,
|
setShowLightningAddressQR,
|
||||||
lightningAddressQRCode,
|
lightningAddressQRCode,
|
||||||
@@ -213,6 +226,77 @@ export function WalletModals({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Consolidation Modal */}
|
||||||
|
{showConsolidationModal && (
|
||||||
|
<div
|
||||||
|
className="fixed inset-0 bg-black/50 flex items-center justify-center z-[100] p-4"
|
||||||
|
onClick={() => setShowConsolidationModal(false)}
|
||||||
|
>
|
||||||
|
<Card
|
||||||
|
className="w-full max-w-md border-0 shadow-lg bg-background"
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<CardHeader className="relative">
|
||||||
|
<Button
|
||||||
|
onClick={() => setShowConsolidationModal(false)}
|
||||||
|
className="absolute top-2 right-2"
|
||||||
|
size="sm"
|
||||||
|
variant="ghost"
|
||||||
|
>
|
||||||
|
<X className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
<CardTitle className="flex items-center pr-8">
|
||||||
|
<ArrowRightLeft className="h-5 w-5 mr-2 text-primary" />
|
||||||
|
Consolidate UTXOs
|
||||||
|
</CardTitle>
|
||||||
|
<CardDescription>
|
||||||
|
Combine multiple UTXOs into a single transaction
|
||||||
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-4">
|
||||||
|
<div className="bg-muted p-4 rounded-lg border">
|
||||||
|
<div className="text-center">
|
||||||
|
<div className="text-2xl font-bold text-primary mb-2">
|
||||||
|
{utxos.length} UTXO{utxos.length !== 1 ? 's' : ''}
|
||||||
|
</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
Total Value: {utxos.reduce((sum, utxo) => sum + utxo.value, 0).toLocaleString()} sats
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-sm text-muted-foreground bg-muted/30 p-3 rounded space-y-2">
|
||||||
|
<div>🔄 <strong>What this does:</strong> Combines all your UTXOs into a single transaction, sending the total amount (minus fees) back to your own address.</div>
|
||||||
|
<div>💰 <strong>Benefits:</strong> Reduces transaction fees for future payments and simplifies your UTXO management.</div>
|
||||||
|
<div>⚠️ <strong>Note:</strong> This will create a new transaction on the Bitcoin network and may take some time to confirm.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex justify-center">
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
onConfirmConsolidation();
|
||||||
|
setShowConsolidationModal(false);
|
||||||
|
}}
|
||||||
|
disabled={isConsolidating || utxos.length <= 1}
|
||||||
|
>
|
||||||
|
{isConsolidating ? (
|
||||||
|
<>
|
||||||
|
<RefreshCw className="h-4 w-4 mr-2 animate-spin" />
|
||||||
|
Consolidating...
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<ArrowRightLeft className="h-4 w-4 mr-2" />
|
||||||
|
Consolidate UTXOs
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* QR Modals */}
|
{/* QR Modals */}
|
||||||
<QRModal
|
<QRModal
|
||||||
isOpen={showLightningAddressQR}
|
isOpen={showLightningAddressQR}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { fetchUTXOs, type UTXO } from '@/lib/bitcoin';
|
import { useState } from 'react';
|
||||||
|
import { fetchUTXOs, getFeeRates, createBitcoinTransaction, broadcastTransaction, calculateMaxSendAmount, npubToBitcoinAddress, nostrPubkeyToBitcoinAddress, type UTXO } from '@/lib/bitcoin';
|
||||||
import type { BitcoinTransaction } from '@/components/wallet/TransactionHistory';
|
import type { BitcoinTransaction } from '@/components/wallet/TransactionHistory';
|
||||||
|
import { useToast } from '@/hooks/useToast';
|
||||||
|
import { useQRCode } from '@/hooks/useQRCode';
|
||||||
|
import { useNsecAccess } from '@/hooks/useNsecAccess';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch Bitcoin transaction history for an address from Blockstream API
|
* Fetch Bitcoin transaction history for an address from Blockstream API
|
||||||
@@ -104,3 +108,241 @@ export function useBitcoinTransactionHistory(address: string | null) {
|
|||||||
staleTime: 10000, // Consider data stale after 10 seconds
|
staleTime: 10000, // Consider data stale after 10 seconds
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook for Bitcoin operations (send, receive, consolidate, etc.)
|
||||||
|
*/
|
||||||
|
export function useBitcoinOperations(bitcoinAddress: string | null) {
|
||||||
|
const { toast } = useToast();
|
||||||
|
const { generateQRCode } = useQRCode();
|
||||||
|
const { hasNsecAccess, getPrivateKey } = useNsecAccess();
|
||||||
|
const { refetch: refetchBitcoinBalance } = useBitcoinBalance(bitcoinAddress);
|
||||||
|
|
||||||
|
// State for Bitcoin operations
|
||||||
|
const [utxos, setUtxos] = useState<UTXO[]>([]);
|
||||||
|
const [isLoadingUtxos, setIsLoadingUtxos] = useState(false);
|
||||||
|
const [feeRate, setFeeRate] = useState<number>(1);
|
||||||
|
const [isConsolidating, setIsConsolidating] = useState(false);
|
||||||
|
|
||||||
|
// Calculate max send amount
|
||||||
|
const bitcoinMaxAmount = utxos.length > 0 ? calculateMaxSendAmount(utxos, feeRate) : 0;
|
||||||
|
|
||||||
|
// Fetch UTXOs for Bitcoin mode
|
||||||
|
const fetchBitcoinUtxos = async () => {
|
||||||
|
if (!bitcoinAddress) return;
|
||||||
|
|
||||||
|
setIsLoadingUtxos(true);
|
||||||
|
try {
|
||||||
|
const [fetchedUtxos, feeRates] = await Promise.all([
|
||||||
|
fetchUTXOs(bitcoinAddress),
|
||||||
|
getFeeRates()
|
||||||
|
]);
|
||||||
|
setUtxos(fetchedUtxos);
|
||||||
|
setFeeRate(feeRates.fastestFee);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching UTXOs:', error);
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "UTXO Error",
|
||||||
|
description: "Failed to fetch Bitcoin UTXOs",
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsLoadingUtxos(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle Send Max
|
||||||
|
const handleSendMax = (setBitcoinAmount: (amount: string) => void) => {
|
||||||
|
if (bitcoinMaxAmount > 0) {
|
||||||
|
setBitcoinAmount(bitcoinMaxAmount.toString());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle Bitcoin Send
|
||||||
|
const handleBitcoinSend = async (
|
||||||
|
bitcoinAmount: string,
|
||||||
|
pendingBitcoinRecipient: string | null,
|
||||||
|
setBitcoinAmount: (amount: string) => void,
|
||||||
|
setBitcoinRecipient: (recipient: string) => void,
|
||||||
|
setPendingBitcoinRecipient: (recipient: string | null) => void,
|
||||||
|
setShowSendModal: (show: boolean) => void
|
||||||
|
) => {
|
||||||
|
if (!hasNsecAccess || !bitcoinAmount || !pendingBitcoinRecipient || !bitcoinAddress) {
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "Bitcoin Send Error",
|
||||||
|
description: "Missing required information for Bitcoin transaction",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const privateKey = getPrivateKey();
|
||||||
|
if (!privateKey) {
|
||||||
|
throw new Error('Unable to access private key');
|
||||||
|
}
|
||||||
|
|
||||||
|
const amountSats = parseInt(bitcoinAmount);
|
||||||
|
if (isNaN(amountSats) || amountSats <= 0) {
|
||||||
|
throw new Error('Invalid amount');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine if the recipient is a Bitcoin address or npub
|
||||||
|
let recipientAddress: string;
|
||||||
|
if (pendingBitcoinRecipient.startsWith('bc1') || pendingBitcoinRecipient.startsWith('1') || pendingBitcoinRecipient.startsWith('3')) {
|
||||||
|
// It's already a Bitcoin address
|
||||||
|
recipientAddress = pendingBitcoinRecipient;
|
||||||
|
} else if (pendingBitcoinRecipient.startsWith('npub')) {
|
||||||
|
// It's an npub, convert to Bitcoin address
|
||||||
|
recipientAddress = npubToBitcoinAddress(pendingBitcoinRecipient);
|
||||||
|
} else {
|
||||||
|
// Assume it's a hex pubkey
|
||||||
|
recipientAddress = nostrPubkeyToBitcoinAddress(pendingBitcoinRecipient);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch UTXOs and fee rates
|
||||||
|
const [utxos, feeRates] = await Promise.all([
|
||||||
|
fetchUTXOs(bitcoinAddress),
|
||||||
|
getFeeRates()
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Check if this is a Send Max transaction
|
||||||
|
const isSendMax = amountSats === bitcoinMaxAmount && bitcoinMaxAmount > 0;
|
||||||
|
|
||||||
|
// Create and sign transaction
|
||||||
|
const { txHex, fee } = await createBitcoinTransaction(
|
||||||
|
privateKey,
|
||||||
|
recipientAddress,
|
||||||
|
amountSats,
|
||||||
|
utxos,
|
||||||
|
feeRates.fastestFee,
|
||||||
|
isSendMax
|
||||||
|
);
|
||||||
|
|
||||||
|
// Broadcast transaction
|
||||||
|
const txId = await broadcastTransaction(txHex);
|
||||||
|
|
||||||
|
toast({
|
||||||
|
title: "Bitcoin Sent!",
|
||||||
|
description: `Transaction ${txId.slice(0, 8)}... confirmed (Fee: ${fee} sats)`,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reset form and refresh balance
|
||||||
|
setBitcoinAmount('');
|
||||||
|
setBitcoinRecipient('');
|
||||||
|
setPendingBitcoinRecipient(null);
|
||||||
|
refetchBitcoinBalance();
|
||||||
|
setShowSendModal(false);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Bitcoin send error:', error);
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "Bitcoin Send Failed",
|
||||||
|
description: error instanceof Error ? error.message : 'Unknown error occurred',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle Bitcoin Receive
|
||||||
|
const handleBitcoinReceive = async (
|
||||||
|
setBitcoinAddressQRCode: (qr: string) => void,
|
||||||
|
setShowBitcoinAddressQR: (show: boolean) => void
|
||||||
|
) => {
|
||||||
|
if (!bitcoinAddress) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const qr = await generateQRCode(bitcoinAddress);
|
||||||
|
setBitcoinAddressQRCode(qr);
|
||||||
|
setShowBitcoinAddressQR(true);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('QR generation error:', error);
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "QR Code Error",
|
||||||
|
description: "Failed to generate QR code",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Handle UTXO Consolidation
|
||||||
|
const handleConsolidateUtxos = async () => {
|
||||||
|
if (!hasNsecAccess || !bitcoinAddress || utxos.length <= 1) {
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "Consolidation Error",
|
||||||
|
description: "Cannot consolidate UTXOs",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsConsolidating(true);
|
||||||
|
try {
|
||||||
|
const privateKey = getPrivateKey();
|
||||||
|
if (!privateKey) {
|
||||||
|
throw new Error('Unable to access private key');
|
||||||
|
}
|
||||||
|
|
||||||
|
// For consolidation, we send all UTXOs to our own address (self-send)
|
||||||
|
const consolidationAmount = calculateMaxSendAmount(utxos, feeRate);
|
||||||
|
|
||||||
|
if (consolidationAmount <= 0) {
|
||||||
|
throw new Error('Insufficient funds for consolidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch current UTXOs and fee rates
|
||||||
|
const [fetchedUtxos, feeRates] = await Promise.all([
|
||||||
|
fetchUTXOs(bitcoinAddress),
|
||||||
|
getFeeRates()
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Create consolidation transaction (self-send with all UTXOs)
|
||||||
|
const { txHex, fee } = await createBitcoinTransaction(
|
||||||
|
privateKey,
|
||||||
|
bitcoinAddress, // Send to our own address
|
||||||
|
consolidationAmount,
|
||||||
|
fetchedUtxos,
|
||||||
|
feeRates.fastestFee,
|
||||||
|
true // sendMax = true
|
||||||
|
);
|
||||||
|
|
||||||
|
// Broadcast transaction
|
||||||
|
const txId = await broadcastTransaction(txHex);
|
||||||
|
|
||||||
|
toast({
|
||||||
|
title: "UTXOs Consolidated!",
|
||||||
|
description: `Transaction ${txId.slice(0, 8)}... confirmed (Fee: ${fee} sats)`,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Refresh UTXOs and balance
|
||||||
|
refetchBitcoinBalance();
|
||||||
|
fetchBitcoinUtxos();
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('UTXO consolidation error:', error);
|
||||||
|
toast({
|
||||||
|
variant: "destructive",
|
||||||
|
title: "Consolidation Failed",
|
||||||
|
description: error instanceof Error ? error.message : 'Unknown error occurred',
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsConsolidating(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
// State
|
||||||
|
utxos,
|
||||||
|
isLoadingUtxos,
|
||||||
|
feeRate,
|
||||||
|
isConsolidating,
|
||||||
|
bitcoinMaxAmount,
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
fetchBitcoinUtxos,
|
||||||
|
handleSendMax,
|
||||||
|
handleBitcoinSend,
|
||||||
|
handleBitcoinReceive,
|
||||||
|
handleConsolidateUtxos,
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in new issue
Block a user