Rarible Clone dilemma

Take a look at adding custom Network RPC

If you have tested your code on sandbox and it woked fine, so there is a problem with your localhost live server

1 Like

Thatā€™s gotta be the answer but i dont have a chain id number to fill in

Hey @SolidCircle
Did you manage to solve the problem?

No. This is probably a dumb question, but am i supposed to actually download ganache? I was just about to do the command : npm install -g ganache.cli

Because I canā€™t configure my metamask wallet to my local server, but do i even have a local server. Rookie questions, i knowā€¦

I ran ganache but that didnā€™t help. Hmmmā€¦ it gotta be something simple that Iā€™m not doing. Its not the code or the server. Then its gotta be the wallet. Im using the Brave browser, could that be it?

@SolidCircle take a look at a short video
https://www.youtube.com/watch?v=nUEBAS5r4Og

Thatā€™s the video i watched that got me tobdownload ganache. But after i download it and run it, still says the same thing. Question: When i run command : python3 -m http.server ; what server is that running on? Its not ganache because it was running and allowing me to access the site before i downloaded ganache.

@SolidCircle
If you want to start your live server for the site you can just click on your HTML file in the VS code and select open in default browser.

To start your ganache server you can easily start the Ganache App (GANACHE QUICKSTART)

I tried a few things. Ganache, but its not needed for this project. Iā€™ll repost the code and see if it still runs right on your serverā€¦

<!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>Culture</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>
Moralis.initialize("LLe95gObRCYtxHc8EUnBfLByDfBWRFEZkjlNRXa0JXa0J");
Moralis.serverURL = 'https://ldkjffesu0ln.usemoralis.com:2053/server'

init = async () => {
    window.web3 = await Moralis.Web3.enable();
    initUser();
}

initUser = async () => {
    if (await Moralis.User.current()){
        hideElement(userConnectButton);
        showElement(userProfileButton);
    }else{
        showElement(userConnectButton);
        hideElement(userProfileButton);
    }
}

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();

I hate to be a bother, but did u get a chance to run that code again. I wanna be sure that none of the changes i made altered the codeā€¦

Hi, @SolidCircle.

Make sure to use the latest version of both the libraries instead of a specific one.

Change it to ā€“

<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
 <script src="https://unpkg.com/moralis/dist/moralis.js"></script>

I was getting this error when using the specific version -

And it gets resolved once you use the latest versions as shown above

Hope this resolves the issue. :raised_hands:

It definitely solved the problem. Good lookinā€¦ Unfortunately another problem came up. When i click connect wallet it opens my metemask wallet. when i try to sign it im metamask, this pops up: ParseError: undefined unauthorized

Hi @SolidCircle,

Iā€™m not sure why that happens. Because I used the exact code from your post above and I was able to sign through metamask properly. Iā€™m using local ganache instance and ran the code using python3 -m http.server in my front-end directory. Also, my moralis server is connected to my ganache. Make sure you follow the local setup steps properly.

Double check your sever details, app id and server url.

If all these are right then please post the screenshots of your moralis server and the error youā€™re getting.

Looking forward to hearing from you.

Iā€™ll do that, but i think its my metamask wallet configuration. When its set for the ethereum network and i press connect wallet, it sends the error ā€œParseError: undefined unauthorizedā€. is the wallet supposed to be preset to a particular test network or does it have to have funds in it to complete this part of the process?

Hi,

Please do not share your server credentials except for Server URL and Application ID. Other credentials are supposed to be private.

Did you import your ganache keys in your metamask properly? If yes, then it should not be an issue and you should have 100 ETH in your address.

Also, Since your server is a Ganche server, please make sure to configure the Devchain Proxy Server. You have to setup your Frpc files as well. You can find details over here ā€“

  1. https://docs.moralis.io/misc/faq#frpc
  2. https://docs.moralis.io/setting-up-ganache

Also, looking at your screenshot and your code,
I see that your APP id is - LLe95gObRCYtxHc8EUnBfLByDfBWRFEZkjlNRXa0JXa0J
But, in your screenshot is - Le95gObRCYtxHc8EUnBfLByDfBWRFEZkjlNRXa0JXa0J

Thereā€™s an extra ā€œLā€ in the code. Please fix that too.

Hope this helps.