Hi everyone,
ive been following the course on Youtube/moralis about cloning rarible and i happen to get this error message when trying to connect the metamask wallet to the moralis server.
What am i missing? heres the Main.js file
Moralis.initialize("MrNIwMrv8ugb5MnEhIJIot3XYRIGjO1nkE16ggGc");
Moralis.serverURL = 'http://https://d44hjhepbdo1.moralis.io:2053/server:1337/server'
init = async () => {
window.web3 = await Moralis.Web3.enable();
initUser();
}
initUser = async () => {
if (await Moralis.User.current()){
hideElement(userConnectButton);
showElement(userProfileButton);
}else{
hideElement(userProfileButton);
showElement(userConnectButton);
}
}
login = async () => {
try {
await Moralis.Web3.authenticate();
initUser();
} catch (error) {
alert(error)
}
}
hideElement = (element) => element.style.display = "none";
showElement = (element) => element.style.display = "block";
const userConnectButton = document.getElementById("btnConnect");
userConnectButton.onclick = login;
const userProfileButton = document.getElementById("btnUserInfo");
init();
heres the html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Moralis Course Rarible</title>
</head>
<body>
<div>
<button id = "btnConnect">Connect Wallet</button>
<button id = "btnUserInfo"> Profile </button>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/moralis.js"></script>
<script src="main.js"></script>
</body>
</html>
i used the line python3 -m http.server in the therminal of visual code to get my local host running.
please let me know if you know whats good.
thank you