Rarible clone part-7 with react-moralis

I’m trying to mintNTF in my react project but I’m getting the following error
Line 61:31: ‘tokenContract’ is not defined no-undef
Line 61:89: ‘ethereum’ is not defined no-undef

How do I import ethereum ?

Try: window.web3 = await Moralis.Web3.enable();
And also make sure that MetaMask is connected.

Error: Property ‘web3’ does not exist on type ‘Window & typeof globalThis’

You have to add Moralis SDK and web3, something like:

    <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>    

Or you can ignore me if you want to do this in react, I saw normal javascript and not react in your code example.

I’m using react.
I’m using react-moralis.

I’m not able to mint because of this ethereum not found error

Try: web3.currentProvider.selectedAddress instead of that, in case that you have access to web3.

Got this error with web3.currentProvider.selectedAddress

It looks like you successfully called a smart contract function and some exception happened on execution.

Got this in metamask

:stop_sign: Transaction Error. Exception thrown in contract code.

Now you can check your smart contract code and what parameters were sent to it.

Contract code looks fine to me and it’s the same from Rarible clone video
Err: Property ‘selectedAddress’ does not exist on type ‘provider’.

You can hardcode your wallet address there until you find a way to get its value.

Still getting the same error

Is there anyother threads or github link for react version of the Rarible clone?

Hi @raxith,

We do not have a Github repo for a react-moralis Rarible clone. However, we have another tutorial with all the basic functionality shown over here -

You can check out the documentation over here -

If you are still facing issues, do paste your code over here and we will check it out.

Hope this helps. Thanks.

Yea I’ve opened a detailed thread with code and error and warning screenshots!!
Thank you