diff --git a/src/hooks/wallet/useBitcoin.ts b/src/hooks/wallet/useBitcoin.ts index dfd51e1..bd83268 100644 --- a/src/hooks/wallet/useBitcoin.ts +++ b/src/hooks/wallet/useBitcoin.ts @@ -1,8 +1,8 @@ import { useQuery } from '@tanstack/react-query'; -import { useState } from 'react'; +import { useState, useCallback } from 'react'; import { fetchUTXOs, getFeeRates, createBitcoinTransaction, broadcastTransaction, calculateMaxSendAmount, npubToBitcoinAddress, nostrPubkeyToBitcoinAddress, type UTXO } from '@/lib/bitcoin'; import type { BitcoinTransaction } from '@/components/wallet/TransactionHistory'; -import { useToast } from '@/hooks/useToast'; +import { useToast, toast } from '@/hooks/useToast'; import { useQRCode } from '@/hooks/wallet/useQRCode'; import { useNsecAccess } from '@/hooks/useNsecAccess'; @@ -156,7 +156,7 @@ export function useBitcoinOperations(bitcoinAddress: string | null) { const bitcoinMaxAmount = utxos.length > 0 ? calculateMaxSendAmount(utxos, feeRate) : 0; // Fetch UTXOs for Bitcoin mode - const fetchBitcoinUtxos = async () => { + const fetchBitcoinUtxos = useCallback(async () => { if (!bitcoinAddress) return; setIsLoadingUtxos(true); @@ -177,7 +177,7 @@ export function useBitcoinOperations(bitcoinAddress: string | null) { } finally { setIsLoadingUtxos(false); } - }; + }, [bitcoinAddress]); // Handle Send Max const handleSendMax = (setBitcoinAmount: (amount: string) => void) => {