import { useArk } from "@lume/ark"; import { LoaderIcon } from "@lume/icons"; import * as Dialog from "@radix-ui/react-dialog"; import { fetch } from "@tauri-apps/plugin-http"; import { useState } from "react"; import { toast } from "sonner"; import { renderSVG } from "uqr"; export function TranslateRegisterModal({ setAPIKey }) { const ark = useArk(); const [open, setOpen] = useState(false); const [loading, setLoading] = useState(false); const [invoice, setInvoice] = useState<{ api_key: string; bolt11: string }>( null, ); const createInvoice = async () => { try { setLoading(true); const res = await fetch("https://translate.nostr.wine/api/create", { method: "POST", body: JSON.stringify({ pubkey: ark.account.pubkey, amount: 2500, }), headers: { "Content-Type": "application/json; charset=utf-8", }, }); if (res) { const data = await res.json(); setInvoice(data); setLoading(false); } } catch (e) { setLoading(false); toast.error(String(e)); } }; const finish = () => { if (!invoice) return; setAPIKey(invoice.api_key); setOpen(false); }; return (
Register Translate Service

Translation Service is provided by{" "} nostr.wine. Prices start at 2,500 sats for 50,000 characters of translated text.

You can learn more about nostr.wine{" "} here

{!invoice ? (
translate
) : (

API Key

{invoice.api_key}

Scan and Pay with Lightning Wallet

)}
); }