import React, { useState } from "react"; import { OmniWallet } from "../../OmniWallet"; import Popup, { present } from "../Popup"; import { PopupButton } from "../styles"; interface AuthIntentPopupProps { wallet: OmniWallet; onApprove: () => Promise; onReject: () => void; } const Loader: React.FC = () => { return ( ); }; const AuthIntentPopupComponent: React.FC = ({ wallet, onApprove, onReject }) => { const [loading, setLoading] = useState(false); const handleApprove = async () => { try { setLoading(true); await onApprove(); setLoading(false); } catch (e) { setLoading(false); throw e; } }; return ( Authorize {wallet.connector?.name}

} onClose={onReject}>

To verify your account, you need to sign a message, this action is safe, the platform does not have access to your assets.

{loading ? : "Sign message"}
); }; export const openAuthPopup = (wallet: OmniWallet, then: () => Promise) => { return new Promise((resolve, reject) => { present((close) => { return ( (close(), reject())} onApprove={async () => { try { const result = await then(); resolve(result); } catch (e) { reject(e); } finally { close(); } }} /> ); }); }); };