diff --git a/src/components/connectOverlay/ConnectOverlay.tsx b/src/components/connectOverlay/ConnectOverlay.tsx index f2f9c33..8791ca6 100644 --- a/src/components/connectOverlay/ConnectOverlay.tsx +++ b/src/components/connectOverlay/ConnectOverlay.tsx @@ -44,8 +44,10 @@ const ConnectOverlay: React.FC = ({ const connectMetamask = async () => { try { window.localStorage.removeItem('walletconnect'); - window.localStorage.removeItem('WALLETCONNECT_DEEPLINK_CHOICE'); + + console.log(BRIDGE_URL); + const response = await axios.post(BRIDGE_URL + '/init-provider'); const providerId = response.data.providerId; WebApp.openLink(response.data.universalLink); @@ -55,38 +57,38 @@ const ConnectOverlay: React.FC = ({ const timeout = 30000; // 30 seconds timeout // Function to check connection status - const checkConnection = async () => { - if (Date.now() - startTime > timeout) { - return; - } - - try { - const statusResponse = await axios.post( - BRIDGE_URL + '/is-connected', - { - providerId: providerId, - withCredentials: true, - headers: { - 'Content-Type': 'application/json', - 'Access-Control-Allow-Origin': '*', - 'ngrok-skip-browser-warning': 'true', - }, - } - ); - if (statusResponse.data.connected) { - onConnect(); - } else { - console.log('Not Connected, checking again...'); - setTimeout(checkConnection, 1000); - } - } catch (error) { - console.error('Error checking connection:', error); - setTimeout(checkConnection, 1000); - } - }; - - // Start checking connection status - checkConnection(); + // const checkConnection = async () => { + // if (Date.now() - startTime > timeout) { + // return; + // } + + // try { + // const statusResponse = await axios.post( + // BRIDGE_URL + '/is-connected', + // { + // providerId: providerId, + // withCredentials: true, + // headers: { + // 'Content-Type': 'application/json', + // 'Access-Control-Allow-Origin': '*', + // 'ngrok-skip-browser-warning': 'true', + // }, + // } + // ); + // if (statusResponse.data.connected) { + // onConnect(); + // } else { + // console.log('Not Connected, checking again...'); + // setTimeout(checkConnection, 1000); + // } + // } catch (error) { + // console.error('Error checking connection:', error); + // setTimeout(checkConnection, 1000); + // } + // }; + + // // Start checking connection status + // checkConnection(); } catch (error) { console.error('Error during initial connection:', error); }