import { webln } from '@getalby/sdk'; import * as Dialog from '@radix-ui/react-dialog'; import { message } from '@tauri-apps/api/dialog'; import { WebviewWindow } from '@tauri-apps/api/window'; import { useState } from 'react'; import { useStorage } from '@libs/storage/provider'; import { AlbyIcon, ArrowRightCircleIcon, CancelIcon, LoaderIcon, StarsIcon, } from '@shared/icons'; export function AlbyConnectButton() { const { db } = useStorage(); const [isOpen, setIsOpen] = useState(false); const [isLoading, setIsloading] = useState(false); const initAlby = async () => { try { setIsloading(true); const provider = webln.NostrWebLNProvider.withNewSecret(); const walletConnectURL = provider.getNostrWalletConnectUrl(true); // get auth url const authURL = provider.getAuthorizationUrl({ name: 'Lume' }); // open auth window const webview = new WebviewWindow('alby', { title: 'Connect Alby', url: authURL.href, center: true, theme: 'light', width: 400, height: 650, }); webview.listen('tauri://close-requested', async (e) => { console.log(e); await db.secureSave('wallet-connect-url', walletConnectURL); setIsloading(false); webview.close(); }); } catch (e) { setIsloading(false); await message(e.toString(), { title: 'Connect Alby', type: 'error' }); } }; return (
New feature

Send bitcoin tip with Alby

Alby integration (Beta)

When you click "Connect", a new window will open in your default browser. You will need to click the "Connect Wallet" button to grant Lume permission to integrate with your Alby account.

All information will be encrypted and stored on the local machine.

); }