Hi,
when I try to logging in with MetaMask and WalletConnect it is not working. It worked a few weeks ago, and I didn’t change the code since then.
Error for MetaMask:
Error for WalletConnect:
Code:
async function init() {
try{
window.web3 = await Moralis.Web3.enable();
const user = await Moralis.User.current();
if(user){
const _userAddress = user.get('ethAddress');
userEthAddress = _userAddress;
console.log("User:");
console.log(user);
console.log(_userAddress);
}else{
console.log(user);
}
}catch (err) {
console.log("Error Occured: " + err);
}
}
async function logInMetaMask() {
try{
await Moralis.Web3.authenticate();
console.log("logged");
init();
}catch (err){
console.log("Error occured: " + err);
}
}
async function logInWalletConnect() {
try{
await Moralis.Web3.authenticate({ provider: "walletconnect" });
init();
}catch (err){
console.log(err);
}
}
async function logOut() {
try{
await Moralis.User.logOut();
console.log("user logged out");
init();
}catch(err){
console.log("Error occured: " + err);
}
}
Regards,
Tijan