Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-vahn committed Apr 22, 2024
1 parent b3bfb8d commit 5bbcf8f
Showing 1 changed file with 35 additions and 33 deletions.
68 changes: 35 additions & 33 deletions src/components/connectOverlay/ConnectOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ const ConnectOverlay: React.FC<Props> = ({
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;

Check failure on line 52 in src/components/connectOverlay/ConnectOverlay.tsx

View workflow job for this annotation

GitHub Actions / deploy

'providerId' is declared but its value is never read.
WebApp.openLink(response.data.universalLink);
Expand All @@ -55,38 +57,38 @@ const ConnectOverlay: React.FC<Props> = ({
const timeout = 30000; // 30 seconds timeout

Check failure on line 57 in src/components/connectOverlay/ConnectOverlay.tsx

View workflow job for this annotation

GitHub Actions / deploy

'timeout' is declared but its value is never read.

// 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);
}
Expand Down

0 comments on commit 5bbcf8f

Please sign in to comment.