diff --git a/apps/govern/components/Login/LoginV2.tsx b/apps/govern/components/Login/LoginV2.tsx index 03fe134a..f12c9066 100644 --- a/apps/govern/components/Login/LoginV2.tsx +++ b/apps/govern/components/Login/LoginV2.tsx @@ -22,10 +22,16 @@ export const LoginV2 = () => { const dispatch = useAppDispatch(); const handleConnect = useCallback( - ({ address }: Pick) => { + async ({ address, connector }: Pick) => { if (isAddressProhibited(address)) { disconnect(); } + + if (connector) { + const modalProvider = await connector.getProvider(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any).MODAL_PROVIDER = modalProvider; + } }, [disconnect], ); diff --git a/apps/launch/components/Login/LoginV2.tsx b/apps/launch/components/Login/LoginV2.tsx index 9d1a5602..31ea78e5 100644 --- a/apps/launch/components/Login/LoginV2.tsx +++ b/apps/launch/components/Login/LoginV2.tsx @@ -16,10 +16,16 @@ export const LoginV2 = () => { const config = useConfig(); const handleConnect = useCallback( - ({ address }: Pick) => { + async ({ address, connector }: Pick) => { if (isAddressProhibited(address)) { disconnect(); } + + if (connector) { + const modalProvider = await connector.getProvider(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (window as any).MODAL_PROVIDER = modalProvider; + } }, [disconnect], ); diff --git a/libs/common-middleware/src/lib/cspHeader.ts b/libs/common-middleware/src/lib/cspHeader.ts index f4bb376c..de412628 100644 --- a/libs/common-middleware/src/lib/cspHeader.ts +++ b/libs/common-middleware/src/lib/cspHeader.ts @@ -37,6 +37,7 @@ const ALLOWED_ORIGINS = [ 'https://safe-transaction-goerli.safe.global/api/', 'https://safe-transaction-gnosis-chain.safe.global/api/', 'https://safe-transaction-polygon.safe.global/api/', + 'https://cloudflare-eth.com/', // chains 'https://eth-mainnet.g.alchemy.com/v2/', diff --git a/libs/util-functions/src/lib/sendTransaction/index.ts b/libs/util-functions/src/lib/sendTransaction/index.ts index 249bd736..4f9aa63e 100644 --- a/libs/util-functions/src/lib/sendTransaction/index.ts +++ b/libs/util-functions/src/lib/sendTransaction/index.ts @@ -49,10 +49,7 @@ export const sendTransaction = async ( if (!provider) return false; try { - const getCodeFn = provider?.provider?.getCode; - if (!getCodeFn) return false; - - const code = await getCodeFn(account); + const code = await provider.getCode(account); return code !== '0x'; } catch (error) { console.error(error); @@ -69,7 +66,7 @@ export const sendTransaction = async ( */ notifyWarning('Please submit the transaction in your safe app.'); - sendFn.on('transactionHash', async (safeTx: string) => { + return sendFn.on('transactionHash', async (safeTx: string) => { window.console.log('safeTx', safeTx); /** @@ -95,6 +92,4 @@ export const sendTransaction = async ( notifyError('Error occurred while sending transaction'); throw e; } - - return null; };