import { Button } from "../components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "../components/ui/dialog" import { Input } from "../components/ui/input" import { Label } from "../components/ui/label" import { CopyClipboard } from "./ui/copy-clipboard" import { useState } from "react" import { useBitcoinKit } from "../hooks/useBitcoinKit" import { useToast } from "./ui/use-toast" export default function AuthenticateModal({ messageWillBeVerified, }: { messageWillBeVerified?: string }) { const [authenticationInfo, setAuthenticationInfo] = useState({ address: "", message: messageWillBeVerified ? messageWillBeVerified : "", signature: "", }) const { toast } = useToast() const [showModal, setShowModal] = useState(false) const { authenticateWithGivenSignature } = useBitcoinKit() return ( { setShowModal(open) }} > Verify the ownership of your address Sign the given message with your wallet and paste the signature below
{ setAuthenticationInfo({ ...authenticationInfo, address: e.target.value, }) }} />
{messageWillBeVerified ? (
{messageWillBeVerified}
) : ( { setAuthenticationInfo({ ...authenticationInfo, message: e.target.value, }) }} /> )}
{ setAuthenticationInfo({ ...authenticationInfo, signature: e.target.value, }) }} />
) }