mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
Coin selector and custody badge
This commit is contained in:
1 parent
015e7b8b90
commit
e3cebf3a34
5 files changed
+308
-37
No files matched your search
@@ -11,7 +11,7 @@ import { useMintManager } from '@/hooks/cashu/useMintManager';
|
||||
import { useWalletTransactions } from '@/hooks/cashu/useWalletTransactions';
|
||||
import { useHistoryManager } from '@/hooks/cashu/useHistoryManager';
|
||||
import { useNsecAccess } from '@/hooks/useNsecAccess';
|
||||
import { useBitcoinBalance } from '@/hooks/useBitcoinBalance';
|
||||
import { useBitcoinBalance, useBitcoinTransactionHistory } from '@/hooks/useBitcoinBalance';
|
||||
import { nostrPubkeyToBitcoinAddress, npubToBitcoinAddress, fetchUTXOs, getFeeRates, createBitcoinTransaction, broadcastTransaction, UTXO } from '@/lib/bitcoin';
|
||||
import { QRModal } from '@/components/ui/qr-modal';
|
||||
import { WalletHeader } from './WalletHeader';
|
||||
@@ -47,7 +47,7 @@ export function CashuWallet() {
|
||||
const { generateQRCode } = useQRCode();
|
||||
const { copy: copyToClipboard } = useCopyToClipboard();
|
||||
|
||||
// Bitcoin hooks
|
||||
// Bitcoin hooks - including balance and transaction history
|
||||
const { hasNsecAccess, getPrivateKey } = useNsecAccess();
|
||||
const bitcoinAddress = user?.pubkey ? nostrPubkeyToBitcoinAddress(user.pubkey) : null;
|
||||
const { data: bitcoinBalanceData, isLoading: isBitcoinBalanceLoading, refetch: refetchBitcoinBalance } = useBitcoinBalance(bitcoinAddress);
|
||||
@@ -137,13 +137,19 @@ export function CashuWallet() {
|
||||
getLightningInvoice,
|
||||
});
|
||||
|
||||
const {
|
||||
const {
|
||||
historyEntries,
|
||||
isLoadingHistory,
|
||||
} = useHistoryManager({
|
||||
coco,
|
||||
isInitialized,
|
||||
});
|
||||
|
||||
// Bitcoin transaction history
|
||||
const {
|
||||
data: bitcoinTransactions = [],
|
||||
isLoading: isBitcoinTransactionsLoading
|
||||
} = useBitcoinTransactionHistory(bitcoinAddress);
|
||||
|
||||
// ============================================================================
|
||||
// UI STATE
|
||||
@@ -175,6 +181,7 @@ export function CashuWallet() {
|
||||
// UTXO state
|
||||
const [utxos, setUtxos] = useState<UTXO[]>([]);
|
||||
const [utxoDropdownOpen, setUtxoDropdownOpen] = useState(false);
|
||||
const [selectedUtxo, setSelectedUtxo] = useState<UTXO | null>(null);
|
||||
const [isLoadingUtxos, setIsLoadingUtxos] = useState(false);
|
||||
|
||||
// Handle drawer close with state reset
|
||||
@@ -488,6 +495,8 @@ export function CashuWallet() {
|
||||
utxos={utxos}
|
||||
utxoDropdownOpen={utxoDropdownOpen}
|
||||
setUtxoDropdownOpen={setUtxoDropdownOpen}
|
||||
selectedUtxo={selectedUtxo}
|
||||
setSelectedUtxo={setSelectedUtxo}
|
||||
/>
|
||||
|
||||
|
||||
@@ -676,8 +685,11 @@ export function CashuWallet() {
|
||||
</DrawerHeader>
|
||||
<ScrollArea className="h-[80vh] px-4 pb-4">
|
||||
<TransactionHistory
|
||||
entries={historyEntries}
|
||||
isLoading={isLoadingHistory}
|
||||
entries={mode === 'bitcoin' ? [] : historyEntries}
|
||||
isLoading={mode === 'bitcoin' ? isBitcoinTransactionsLoading : isLoadingHistory}
|
||||
bitcoinTransactions={mode === 'bitcoin' ? bitcoinTransactions : []}
|
||||
isBitcoinLoading={isBitcoinTransactionsLoading}
|
||||
showSats={showSats}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</DrawerContent>
|
||||
|
||||
Reference in new issue
Block a user