Integrate wallet IFrame for payments #42

Merged
nabarun merged 27 commits from iv-integrate-frame into main 2024-11-13 13:32:28 +00:00
2 changed files with 2 additions and 9 deletions
Showing only changes of commit 1e7b65a0c3 - Show all commits

View File

@ -224,6 +224,7 @@ const Configure = () => {
onDismiss: dismiss, onDismiss: dismiss,
}); });
setIsFrameVisible(false); setIsFrameVisible(false);
setIsPaymentLoading(false);
throw new Error('Transaction rejected'); throw new Error('Transaction rejected');
} }
@ -301,10 +302,6 @@ const Configure = () => {
[client, createProject, dismiss, toast], [client, createProject, dismiss, toast],
); );
const toggleModal = () => {
setIsFrameVisible((prev) => !prev);
};
const fetchDeployers = useCallback(async () => { const fetchDeployers = useCallback(async () => {
const res = await client.getDeployers(); const res = await client.getDeployers();
setDeployers(res.deployers); setDeployers(res.deployers);
@ -586,7 +583,6 @@ const Configure = () => {
setAccounts={setAccounts} setAccounts={setAccounts}
setIsDataReceived={setIsAccountsDataReceived} setIsDataReceived={setIsAccountsDataReceived}
isVisible={isFrameVisible} isVisible={isFrameVisible}
toggleModal={toggleModal}
/> />
{accounts.length > 0 && ( {accounts.length > 0 && (
<div> <div>

View File

@ -11,16 +11,13 @@ const IFrameModal = ({
setAccounts, setAccounts,
setIsDataReceived, setIsDataReceived,
isVisible, isVisible,
toggleModal,
}: { }: {
setAccounts: (accounts: string[]) => void; setAccounts: (accounts: string[]) => void;
setIsDataReceived: (isReceived: boolean) => void; setIsDataReceived: (isReceived: boolean) => void;
isVisible: boolean; isVisible: boolean;
toggleModal: () => void;
}) => { }) => {
useEffect(() => { useEffect(() => {
const handleMessage = (event: MessageEvent) => { const handleMessage = (event: MessageEvent) => {
// TODO: Use env for origin URL
if (event.origin !== VITE_WALLET_IFRAME_URL) return; if (event.origin !== VITE_WALLET_IFRAME_URL) return;
setIsDataReceived(true); setIsDataReceived(true);
@ -56,7 +53,7 @@ const IFrameModal = ({
}, []); }, []);
return ( return (
<Modal open={isVisible} onClose={toggleModal} keepMounted> <Modal open={isVisible} disableEscapeKeyDown keepMounted>
<Box <Box
sx={{ sx={{
position: 'absolute', position: 'absolute',