mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
modals and mint removal
This commit is contained in:
1 parent
22d3675f2b
commit
a8faa03b49
4 files changed
+368
-165
No files matched your search
@@ -78,13 +78,33 @@ export function useCashuMints(manager: unknown | null): UseCashuMintsReturn {
|
||||
}
|
||||
}, [manager]);
|
||||
|
||||
const removeMint = useCallback(async (_mintUrl: string) => {
|
||||
// Note: coco-cashu doesn't have a direct remove mint method
|
||||
// This would need to be implemented at the repository level
|
||||
const error = new CashuWalletError('Remove mint functionality not yet implemented', 'REMOVE_MINT_NOT_IMPLEMENTED');
|
||||
setError(error);
|
||||
throw error;
|
||||
}, []);
|
||||
const removeMint = useCallback(async (mintUrl: string) => {
|
||||
if (!manager) throw new CashuWalletError('Wallet not initialized', 'WALLET_NOT_INITIALIZED');
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
|
||||
// Access the mintService directly through the manager to use deleteMint
|
||||
// The manager has a private mintService property that we can access
|
||||
const mintService = (manager as any).mintService;
|
||||
if (!mintService || typeof mintService.deleteMint !== 'function') {
|
||||
throw new CashuWalletError('Mint service not available', 'MINT_SERVICE_ERROR');
|
||||
}
|
||||
|
||||
await mintService.deleteMint(mintUrl);
|
||||
|
||||
// No need to manually refresh - events will handle it automatically
|
||||
console.log('✅ Mint removed successfully:', mintUrl);
|
||||
} catch (err) {
|
||||
const errorMessage = err instanceof Error ? err.message : 'Failed to remove mint';
|
||||
const cashuError = new CashuWalletError(errorMessage, 'REMOVE_MINT_ERROR', { mintUrl, originalError: err });
|
||||
setError(cashuError);
|
||||
throw cashuError;
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, [manager]);
|
||||
|
||||
// Set up event listeners for automatic mint updates using coco events
|
||||
useEffect(() => {
|
||||
|
||||
Reference in new issue
Block a user