mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
npubxcash lnaddress subscriptions working
This commit is contained in:
1 parent
b5bc571aa7
commit
ea57135d1e
4 files changed
+150
-48
No files matched your search
@@ -48,6 +48,7 @@ export function CashuWallet() {
|
||||
getUserInfo: getNpubCashUserInfo,
|
||||
getAllQuotes,
|
||||
refreshQuotes,
|
||||
syncQuotesWithWallet,
|
||||
isLoggedIn: isNpubCashLoggedIn,
|
||||
isLoading: isNpubCashLoading,
|
||||
error: npubCashError,
|
||||
@@ -233,6 +234,25 @@ export function CashuWallet() {
|
||||
fetchUserInfo();
|
||||
}, [isNpubCashLoggedIn, isInitialized, isNpubCashLoading, getNpubCashUserInfo, activeMintUrl, mints, coco, setActiveMintUrl]);
|
||||
|
||||
// Set up automatic quote sync subscription when logged into npub.cash
|
||||
useEffect(() => {
|
||||
if (!isNpubCashLoggedIn || !coco || !isInitialized) return;
|
||||
|
||||
let unsubscribe: (() => void) | null = null;
|
||||
|
||||
const setupSync = async () => {
|
||||
unsubscribe = await syncQuotesWithWallet(coco, toast);
|
||||
};
|
||||
|
||||
setupSync();
|
||||
|
||||
return () => {
|
||||
if (unsubscribe) {
|
||||
unsubscribe();
|
||||
}
|
||||
};
|
||||
}, [isNpubCashLoggedIn, coco, isInitialized, syncQuotesWithWallet, toast]);
|
||||
|
||||
// ============================================================================
|
||||
// EFFECTS - Cleanup
|
||||
// ============================================================================
|
||||
@@ -284,8 +304,6 @@ export function CashuWallet() {
|
||||
setShowLightningAddressQR(true);
|
||||
}}
|
||||
generateQRCode={generateQRCode}
|
||||
onRefreshQuotes={() => refreshQuotes(coco, toast)}
|
||||
isRefreshingQuotes={isNpubCashLoading}
|
||||
mintDropdownOpen={mintDropdownOpen}
|
||||
setMintDropdownOpen={setMintDropdownOpen}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user