Been trying to get this sorted for a couple days now. I’m not sure what has happened but the Moralis.authenticate({ provider: “walletconnect”, chainId: 56 }); code is absolutely haulting my code. For example, I click the “Sign in with WalletConnect” button, the QR code appears on the screen, I proceed with the WalletConnect option from mobile device. The QR code disappears, and the phone looks like it is connected. However, the code does not continue in the DApp. I am unable to send any kind of transaction or signature request from the DApp. The exact same functions, work properly using MetaMask from desktop. I have also tried stripping away all m extra code, as well as trying to do the same thing from the Demo WalletConnect apps from the Moralis Github and I’m getting the same result. The only thing I get in console is the bridge connect info and then the code just stops. No errors that I can see. It’s like Moralis is not acknowledging the WalletConnect login. I have tried all recent versions of the WalletConnect script with the same results. I will put my login functions for both MetaMask and WalletConnect below:
MM Login:
async function login() {
try {
currentUser = Moralis.User.current();
if (!currentUser) {
document.getElementById("login_button").innerText = "Authenticating...";
currentUser = await Moralis.authenticate();
document.getElementById("vote_token_1_button").disabled = false;
document.getElementById("vote_token_2_button").disabled = false;
document.getElementById("vote_token_3_button").disabled = false;
document.getElementById("vote_token_4_button").disabled = false;
document.getElementById("vote_token_5_button").disabled = false;
setHelperData();
} else {
logOut();
}
document.getElementById("login_button").innerText = "Logout";
logged_in = true;
} catch (error) {
if (error.message == "MetaMask Message Signature: User denied message signature.") {
alert("Login cancelled")
document.getElementById("login_button").innerText = "Sign in with Metamask";
}
}
}
WC Login:
async function loginWC() {
try {
currentUser = Moralis.User.current();
if (!currentUser) {
document.getElementById("login_button_wc").innerText = "Authenticating...";
currentUser = await Moralis.authenticate({ provider: "walletconnect", chainId: 56 });
document.getElementById("vote_token_1_button").disabled = false;
document.getElementById("vote_token_2_button").disabled = false;
document.getElementById("vote_token_3_button").disabled = false;
document.getElementById("vote_token_4_button").disabled = false;
document.getElementById("vote_token_5_button").disabled = false;
setHelperData();
} else {
logOut();
}
document.getElementById("login_button_wc").innerText = "Logout";
logged_in = true;
} catch (error) {
if (error.message == "User closed modal") {
alert("Login cancelled")
document.getElementById("login_button_wc").innerText = "Sign in with WalletConnect";
}
}
}