I am working on a project that just needs to retrieve the user's public address from the Metamask wallet into my project app. Can I get some help regarding this issue? I have tried the official Metamask SDK but it gets stuck on the wallet and does not return to the app with a connect wallet prompt as it shows in the example. I have tried Implementing the same using WalletConnect but couldn't get it to work as well. It would be extremely helpful if someone could share an example. Thank you. Added below is a snippet of the code used to connect Metamask using the Metamask SDK.
const connect = async () => {
try {
console.log('Connection Started:::::::');
const result = await ethereum.request({method: 'eth_requestAccounts'});
console.log('RESULT', result?.[0]);
setAccount(result?.[0]);
getBalance();
} catch (e) { console.log('ERROR', e); }
};