From 1d2af751e82d1ac89403a60b40aea0c6697a7090 Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Thu, 5 Oct 2023 17:04:07 -0700 Subject: [PATCH] Allow any origin to receive event. --- packages/react-lite/src/hooks/useIframe.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/react-lite/src/hooks/useIframe.ts b/packages/react-lite/src/hooks/useIframe.ts index 5906da037..2eb7ca01b 100644 --- a/packages/react-lite/src/hooks/useIframe.ts +++ b/packages/react-lite/src/hooks/useIframe.ts @@ -104,9 +104,12 @@ export const useIframe = ({ // Broadcast keystore change event to iframe wallet. useEffect(() => { const notifyIframe = () => { - iframe?.contentWindow.postMessage({ - event: IFRAME_KEYSTORECHANGE_EVENT, - }); + iframe?.contentWindow.postMessage( + { + event: IFRAME_KEYSTORECHANGE_EVENT, + }, + '*' + ); }; // Notify inner window of keystore change on any wallet client change @@ -139,9 +142,12 @@ export const useIframe = ({ // Whenever wallet changes, broadcast keystore change event to iframe wallet. useEffect(() => { - iframe?.contentWindow.postMessage({ - event: IFRAME_KEYSTORECHANGE_EVENT, - }); + iframe?.contentWindow.postMessage( + { + event: IFRAME_KEYSTORECHANGE_EVENT, + }, + '*' + ); }, [wallet, iframe]); useEffect(() => {