From 6fc1df5538c0d6cdff94b9b7d06d0e37e0c88c8b Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Mon, 3 Nov 2025 13:20:48 -0800 Subject: [PATCH] rearranged files to colocate wallet hooks, no other changes --- src/components/WalletModal.tsx | 2 +- src/components/ZapButton.tsx | 2 +- src/components/ZapDialog.tsx | 2 +- src/components/wallet/BitcoinWallet.tsx | 4 ++-- src/components/wallet/CashuWallet.tsx | 20 +++++++++---------- src/components/wallet/QRScanner.tsx | 2 +- src/components/wallet/WalletContainer.tsx | 6 +++--- src/contexts/CashuContext.tsx | 2 +- src/hooks/useWallet.ts | 2 +- src/hooks/useZaps.ts | 2 +- .../useBitcoin.ts} | 2 +- src/hooks/{cashu => wallet}/useCashu.ts | 0 .../{cashu => wallet}/useHistoryManager.ts | 0 src/hooks/{ => wallet}/useLightningAddress.ts | 0 .../useLightningOperations.ts | 0 src/hooks/{cashu => wallet}/useMintManager.ts | 0 src/hooks/{ => wallet}/useNpubCash.ts | 4 ++-- src/hooks/{ => wallet}/useQRCode.ts | 2 +- src/hooks/{ => wallet}/useReverseSwap.ts | 0 .../useReverseSwapOperations.ts | 2 +- .../{cashu => wallet}/useSeedPhraseRestore.ts | 0 .../{cashu => wallet}/useTokenOperations.ts | 0 22 files changed, 27 insertions(+), 27 deletions(-) rename src/hooks/{useBitcoinBalance.ts => wallet/useBitcoin.ts} (99%) rename src/hooks/{cashu => wallet}/useCashu.ts (100%) rename src/hooks/{cashu => wallet}/useHistoryManager.ts (100%) rename src/hooks/{ => wallet}/useLightningAddress.ts (100%) rename src/hooks/{cashu => wallet}/useLightningOperations.ts (100%) rename src/hooks/{cashu => wallet}/useMintManager.ts (100%) rename src/hooks/{ => wallet}/useNpubCash.ts (99%) rename src/hooks/{ => wallet}/useQRCode.ts (99%) rename src/hooks/{ => wallet}/useReverseSwap.ts (100%) rename src/hooks/{cashu => wallet}/useReverseSwapOperations.ts (99%) rename src/hooks/{cashu => wallet}/useSeedPhraseRestore.ts (100%) rename src/hooks/{cashu => wallet}/useTokenOperations.ts (100%) diff --git a/src/components/WalletModal.tsx b/src/components/WalletModal.tsx index 49b4cd9..cee4d04 100644 --- a/src/components/WalletModal.tsx +++ b/src/components/WalletModal.tsx @@ -26,7 +26,7 @@ import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { useNWC } from '@/hooks/useNWCContext'; import { useWallet } from '@/hooks/useWallet'; -import { useCashu } from '@/hooks/cashu/useCashu'; +import { useCashu } from '@/hooks/wallet/useCashu'; import { useToast } from '@/hooks/useToast'; import { useIsMobile } from '@/hooks/useIsMobile'; import type { NWCConnection, NWCInfo } from '@/hooks/useNWC'; diff --git a/src/components/ZapButton.tsx b/src/components/ZapButton.tsx index a9fe0ad..f9e8132 100644 --- a/src/components/ZapButton.tsx +++ b/src/components/ZapButton.tsx @@ -30,7 +30,7 @@ import { useAuthor } from '@/hooks/useAuthor'; import { useToast } from '@/hooks/useToast'; import { useZaps } from '@/hooks/useZaps'; import { useWallet } from '@/hooks/useWallet'; -import { useCashu } from '@/hooks/cashu/useCashu'; +import { useCashu } from '@/hooks/wallet/useCashu'; import { useIsMobile } from '@/hooks/useIsMobile'; import type { Event } from 'nostr-tools'; import QRCode from 'qrcode'; diff --git a/src/components/ZapDialog.tsx b/src/components/ZapDialog.tsx index 7b3478c..2b55eff 100644 --- a/src/components/ZapDialog.tsx +++ b/src/components/ZapDialog.tsx @@ -30,7 +30,7 @@ import { useAuthor } from '@/hooks/useAuthor'; import { useToast } from '@/hooks/useToast'; import { useZaps } from '@/hooks/useZaps'; import { useWallet } from '@/hooks/useWallet'; -import { useCashu } from '@/hooks/cashu/useCashu'; +import { useCashu } from '@/hooks/wallet/useCashu'; import { useIsMobile } from '@/hooks/useIsMobile'; import type { Event } from 'nostr-tools'; import QRCode from 'qrcode'; diff --git a/src/components/wallet/BitcoinWallet.tsx b/src/components/wallet/BitcoinWallet.tsx index 5625ba3..b9c24ba 100644 --- a/src/components/wallet/BitcoinWallet.tsx +++ b/src/components/wallet/BitcoinWallet.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, useRef } from 'react'; import { nip19 } from 'nostr-tools'; -import { useBitcoinBalance, useBitcoinTransactionHistory, useBitcoinOperations } from '@/hooks/useBitcoinBalance'; +import { useBitcoinBalance, useBitcoinTransactionHistory, useBitcoinOperations } from '@/hooks/wallet/useBitcoin'; import { useNsecAccess } from '@/hooks/useNsecAccess'; import { nostrPubkeyToBitcoinAddress } from '@/lib/bitcoin'; import { QRModal } from '@/components/ui/qr-modal'; @@ -12,7 +12,7 @@ import { TransactionHistory } from './TransactionHistory'; import { ScrollArea } from '@/components/ui/scroll-area'; import { ChevronUp, Send, Download, ScanLine } from 'lucide-react'; import { Button } from '@/components/ui/button'; -import type { QRScanResult } from '@/hooks/useQRCode'; +import type { QRScanResult } from '@/hooks/wallet/useQRCode'; interface BitcoinWalletProps { toast: ReturnType['toast']; diff --git a/src/components/wallet/CashuWallet.tsx b/src/components/wallet/CashuWallet.tsx index 637c251..66a7518 100644 --- a/src/components/wallet/CashuWallet.tsx +++ b/src/components/wallet/CashuWallet.tsx @@ -1,16 +1,16 @@ import { useState, useEffect, useRef } from 'react'; import { nip19 } from 'nostr-tools'; -import { useCashu } from '@/hooks/cashu/useCashu'; -import { useLightningAddress } from '@/hooks/useLightningAddress'; -import { useNpubCash, type NpubCashUserInfo } from '@/hooks/useNpubCash'; +import { useCashu } from '@/hooks/wallet/useCashu'; +import { useLightningAddress } from '@/hooks/wallet/useLightningAddress'; +import { useNpubCash, type NpubCashUserInfo } from '@/hooks/wallet/useNpubCash'; import { useLocalStorage } from '@/hooks/useLocalStorage'; -import type { QRScanResult } from '@/hooks/useQRCode'; -import { useMintManager } from '@/hooks/cashu/useMintManager'; -import { useTokenOperations } from '@/hooks/cashu/useTokenOperations'; -import { useLightningOperations } from '@/hooks/cashu/useLightningOperations'; -import { useReverseSwapOperations } from '@/hooks/cashu/useReverseSwapOperations'; -import { useSeedPhraseRestore } from '@/hooks/cashu/useSeedPhraseRestore'; -import { useHistoryManager } from '@/hooks/cashu/useHistoryManager'; +import type { QRScanResult } from '@/hooks/wallet/useQRCode'; +import { useMintManager } from '@/hooks/wallet/useMintManager'; +import { useTokenOperations } from '@/hooks/wallet/useTokenOperations'; +import { useLightningOperations } from '@/hooks/wallet/useLightningOperations'; +import { useReverseSwapOperations } from '@/hooks/wallet/useReverseSwapOperations'; +import { useSeedPhraseRestore } from '@/hooks/wallet/useSeedPhraseRestore'; +import { useHistoryManager } from '@/hooks/wallet/useHistoryManager'; import { decodeBolt11Amount } from '@/lib/bolt11Decoder'; import { QRModal } from '@/components/ui/qr-modal'; import { TransactionCard } from './PaymentCard'; diff --git a/src/components/wallet/QRScanner.tsx b/src/components/wallet/QRScanner.tsx index 5d0a4a9..0462968 100644 --- a/src/components/wallet/QRScanner.tsx +++ b/src/components/wallet/QRScanner.tsx @@ -3,7 +3,7 @@ import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import * as VisuallyHidden from '@radix-ui/react-visually-hidden'; import { useToast } from '@/hooks/useToast'; -import type { QRScanResult } from '@/hooks/useQRCode'; +import type { QRScanResult } from '@/hooks/wallet/useQRCode'; interface QRScannerProps { isOpen: boolean; diff --git a/src/components/wallet/WalletContainer.tsx b/src/components/wallet/WalletContainer.tsx index cf69d59..13286cd 100644 --- a/src/components/wallet/WalletContainer.tsx +++ b/src/components/wallet/WalletContainer.tsx @@ -2,10 +2,10 @@ import { useState, useEffect, useRef, useCallback } from 'react'; import { nip19 } from 'nostr-tools'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { useToast } from '@/hooks/useToast'; -import { useQRCode, type QRScanResult } from '@/hooks/useQRCode'; +import { useQRCode, type QRScanResult } from '@/hooks/wallet/useQRCode'; import { useCopyToClipboard } from '@/hooks/useCopyToClipboard'; -import { useCashu } from '@/hooks/cashu/useCashu'; -import { useBitcoinBalance } from '@/hooks/useBitcoinBalance'; +import { useCashu } from '@/hooks/wallet/useCashu'; +import { useBitcoinBalance } from '@/hooks/wallet/useBitcoin'; import { nostrPubkeyToBitcoinAddress } from '@/lib/bitcoin'; import { WalletHeader } from './WalletHeader'; import { CashuWallet } from './CashuWallet'; diff --git a/src/contexts/CashuContext.tsx b/src/contexts/CashuContext.tsx index 4fc86f9..7b4d410 100644 --- a/src/contexts/CashuContext.tsx +++ b/src/contexts/CashuContext.tsx @@ -1,5 +1,5 @@ import { createContext, useContext, ReactNode } from 'react'; -import { useCashu as useCashuHook, type UseCashuReturn } from '@/hooks/cashu/useCashu'; +import { useCashu as useCashuHook, type UseCashuReturn } from '@/hooks/wallet/useCashu'; const CashuContext = createContext(null); diff --git a/src/hooks/useWallet.ts b/src/hooks/useWallet.ts index 7f77095..8d521da 100644 --- a/src/hooks/useWallet.ts +++ b/src/hooks/useWallet.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { useNWC } from '@/hooks/useNWCContext'; -import { useCashu } from '@/hooks/cashu/useCashu'; +import { useCashu } from '@/hooks/wallet/useCashu'; import type { WebLNProvider } from '@webbtc/webln-types'; export interface WalletStatus { diff --git a/src/hooks/useZaps.ts b/src/hooks/useZaps.ts index 2e5eb36..cd3ff33 100644 --- a/src/hooks/useZaps.ts +++ b/src/hooks/useZaps.ts @@ -4,7 +4,7 @@ import { useAuthor } from '@/hooks/useAuthor'; import { useAppContext } from '@/hooks/useAppContext'; import { useToast } from '@/hooks/useToast'; import { useNWC } from '@/hooks/useNWCContext'; -import { useCashu } from '@/hooks/cashu/useCashu'; +import { useCashu } from '@/hooks/wallet/useCashu'; import type { NWCConnection } from '@/hooks/useNWC'; import { nip57 } from 'nostr-tools'; import type { Event } from 'nostr-tools'; diff --git a/src/hooks/useBitcoinBalance.ts b/src/hooks/wallet/useBitcoin.ts similarity index 99% rename from src/hooks/useBitcoinBalance.ts rename to src/hooks/wallet/useBitcoin.ts index 9f200f6..dfd51e1 100644 --- a/src/hooks/useBitcoinBalance.ts +++ b/src/hooks/wallet/useBitcoin.ts @@ -3,7 +3,7 @@ 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 { useToast } from '@/hooks/useToast'; -import { useQRCode } from '@/hooks/useQRCode'; +import { useQRCode } from '@/hooks/wallet/useQRCode'; import { useNsecAccess } from '@/hooks/useNsecAccess'; // Blockstream API response types diff --git a/src/hooks/cashu/useCashu.ts b/src/hooks/wallet/useCashu.ts similarity index 100% rename from src/hooks/cashu/useCashu.ts rename to src/hooks/wallet/useCashu.ts diff --git a/src/hooks/cashu/useHistoryManager.ts b/src/hooks/wallet/useHistoryManager.ts similarity index 100% rename from src/hooks/cashu/useHistoryManager.ts rename to src/hooks/wallet/useHistoryManager.ts diff --git a/src/hooks/useLightningAddress.ts b/src/hooks/wallet/useLightningAddress.ts similarity index 100% rename from src/hooks/useLightningAddress.ts rename to src/hooks/wallet/useLightningAddress.ts diff --git a/src/hooks/cashu/useLightningOperations.ts b/src/hooks/wallet/useLightningOperations.ts similarity index 100% rename from src/hooks/cashu/useLightningOperations.ts rename to src/hooks/wallet/useLightningOperations.ts diff --git a/src/hooks/cashu/useMintManager.ts b/src/hooks/wallet/useMintManager.ts similarity index 100% rename from src/hooks/cashu/useMintManager.ts rename to src/hooks/wallet/useMintManager.ts diff --git a/src/hooks/useNpubCash.ts b/src/hooks/wallet/useNpubCash.ts similarity index 99% rename from src/hooks/useNpubCash.ts rename to src/hooks/wallet/useNpubCash.ts index b4d65a8..a75bd51 100644 --- a/src/hooks/useNpubCash.ts +++ b/src/hooks/wallet/useNpubCash.ts @@ -1,10 +1,10 @@ import { useCallback, useState, useMemo, useRef } from 'react'; -import { useNIP98 } from './useNIP98'; +import { useNIP98 } from '../useNIP98'; import { NPCClient, JWTAuthProvider } from 'npubcash-sdk'; import type { Quote } from 'npubcash-types'; import type { Manager } from 'coco-cashu-core'; import type { EventTemplate, Event } from 'nostr-tools'; -import { useToast } from './useToast'; +import { useToast } from '../useToast'; const NPUBCASH_BASE_URL = 'https://npubx.cash'; diff --git a/src/hooks/useQRCode.ts b/src/hooks/wallet/useQRCode.ts similarity index 99% rename from src/hooks/useQRCode.ts rename to src/hooks/wallet/useQRCode.ts index 93b147d..9dce57f 100644 --- a/src/hooks/useQRCode.ts +++ b/src/hooks/wallet/useQRCode.ts @@ -1,7 +1,7 @@ import { useState, useCallback, useRef } from 'react'; import QRCode from 'qrcode'; import { Html5Qrcode } from 'html5-qrcode'; -import { useToast } from './useToast'; +import { useToast } from '@/hooks/useToast'; export type QRScanResult = | { type: 'lightning_invoice'; value: string } diff --git a/src/hooks/useReverseSwap.ts b/src/hooks/wallet/useReverseSwap.ts similarity index 100% rename from src/hooks/useReverseSwap.ts rename to src/hooks/wallet/useReverseSwap.ts diff --git a/src/hooks/cashu/useReverseSwapOperations.ts b/src/hooks/wallet/useReverseSwapOperations.ts similarity index 99% rename from src/hooks/cashu/useReverseSwapOperations.ts rename to src/hooks/wallet/useReverseSwapOperations.ts index 7c9eb14..f5b0fbb 100644 --- a/src/hooks/cashu/useReverseSwapOperations.ts +++ b/src/hooks/wallet/useReverseSwapOperations.ts @@ -1,6 +1,6 @@ import { useState, useCallback, useEffect } from 'react'; import { nip19 } from 'nostr-tools'; -import { createReverseSwap, type SwapStatusUpdate } from '@/hooks/useReverseSwap'; +import { createReverseSwap, type SwapStatusUpdate } from '@/hooks/wallet/useReverseSwap'; import { isValidBitcoinAddress, npubToBitcoinAddress } from '@/lib/bitcoin'; import type { Manager } from 'coco-cashu-core'; import { useToast } from '@/hooks/useToast'; diff --git a/src/hooks/cashu/useSeedPhraseRestore.ts b/src/hooks/wallet/useSeedPhraseRestore.ts similarity index 100% rename from src/hooks/cashu/useSeedPhraseRestore.ts rename to src/hooks/wallet/useSeedPhraseRestore.ts diff --git a/src/hooks/cashu/useTokenOperations.ts b/src/hooks/wallet/useTokenOperations.ts similarity index 100% rename from src/hooks/cashu/useTokenOperations.ts rename to src/hooks/wallet/useTokenOperations.ts