Web3 First Person Shooter - Helping Each Other

What do you mean it won’t work? Do you get any errors?

MUG_CONTRACT_ADDRESS needs to be a contract address, in this case on the Mumbai network based on MUG_CHAIN. Which network is your NFT contract on (the one in the top photo)?

The Mug contract adress = tutor2 I made it on open sea on the matic mumbai network. So i put this adress both in the editor field and as the The Mug contract adress?

Yes, if you’re simply just swapping out the sample contract (which comes with the tutorial I assume) with your own.

[quote=“burakko, post:25, topic:13091, full:true”]
Well I Made new nft on Opensea on mumbai. I changed the. MUG_CONTRACT_ADDRESS = to the owner of the collecttion. Then i added the token info to the claimNft. Transaction succes but i dont get the nft… I think the contract that is deployed from opensea is not see same as the 1 used in the tutorial. Think thats the problem. Think it has to do with the ABI and the Claim function. Can we have some insigth where and how the contract was made?

MUG_CONTRACT_ADDRESS = to the owner of the collecttion

No the address should be the contract address, not the owner or creator of that contract.

I think the contract that is deployed from opensea is not see same as the 1 used in the tutorial.

Isn’t this your own contract? I thought this was what you were trying to do, use your own instead of the tutorial’s contract. Where has it come from?

Oke, I changed the MUG_CONTRACT_ADDRESS = to my own contract address that is on opensea.
I also changed the adress and token id in the editor ClaimNFtcontroller. Now i get Transaction error Internal Json-rpc error.

Make sure your MetaMask is on the right network. Is your contract more or less equivalent to the tutorial contract? E.g. same function you’re calling, same network, check all these details. Also if you made your NFT directly on OpenSea, I don’t think this will work.

Thank you glad! My whole point was will it work if I made the nft directly on opensea… My English is bad so kind of hard to explain. You got any tutorials or a sample contract that i can use as refferance?

Yes I should have clarified that earlier, I was under the assumption that you had created your own contract that was then listed on OpenSea since you were swapping it out.

Possibly the source code of the contract is available, I’m not finding it in the repo however. Can you post the sample contract address? I don’t know enough about this tutorial/project to see if there’s a similar base contract you could use.

Here is link to the nft thats is used in the tutorial
nft url
contractadress: 0x698d7D745B7F5d8EF4fdB59CeB660050b3599AC3
Tokenid : 0x698d7D745B7F5d8EF4fdB59CeB660050b3599AC3

thanks you saved me so many headaches. i tried this without the json edit on my desktop and my goodness so many errors. i did this on my laptop and works perfectly.

1 Like

Glad I helped :slight_smile:

Hello, I am trying to implement the ClaimNFTcontroller.cs in my own project. I imported all the files from the Web3SpaceShooters directly, however I still get this compile error:

Assets\MoralisWeb3ApiSdk\Moralis\ClaimNftController.cs(138,54): error CS0117: ‘MoralisInterface’ does not contain a definition for ‘SendEvmTransactionAsync’

I did not change any code in the C# file, and the file has no errors in the demo project. What is going on here?

4 Likes

Hi @ardawarcraft and first of all, welcome to the Moralis Unity community :slight_smile:

What version of the Moralis SDK do you have installed in your own project?

Thanks!

Hi, thank you :slight_smile:

I do not know what version because I directly copied the MoralisWeb3ApiSdk folder fully from the Demo project to My project. I think the specific github directory is this, https://github.com/MoralisWeb3/youtube-tutorials/releases/tag/v1.0.0-unity-web3-spaceFPS , whatever version is used here I use the same because I copy pasted it from there anyway

Hi @ardawarcraft!

Is there any other MoralisInterface function getting the same definition error or just SendEvmTransactionAsync?

Thanks!

Hi @dpradell actually yes there is 1 more. ''Assets_Project\Scripts\Moralis\MoralisWeb3Manager.cs(153,30): error CS0117: ‘MoralisInterface’ does not contain a definition for 'InsertContractInstance"
and the other, as you mentioned correctly, is
“Assets_Project\Scripts\Moralis\ClaimNftController.cs(138,54): error CS0117: ‘MoralisInterface’ does not contain a definition for ‘SendEvmTransactionAsync’”

@dpradell

@dpradell important note::

this compile error only shows up after the GameManager.cs file is deleted. The reason why it was deleted was this error:

Assets_Project\Scripts\GameManager.cs(43,53): error CS0311: The type ‘Main.Enemy Data’ cannot be used as type parameter ‘T’ in the generic type or method ‘Moralis LiveQuery Callbacks’. There is no implicit reference conversion from ‘Main.EnemyData’ to ‘Moralis.WebGL.Platform.Objects.MoralisObject’.

maybe if we can fix this compile error and not have to erase gamemanager script, we can fix both

Hi @ardawarcraft!

Ok so now I know what’s happening. The thing is that copying an SDK folder from a Unity project to another it’s not usually a good practice. When you do that you expose yourself to lose some dependencies on the way.

So the way I would solve this is by doing the following:

  1. If you can, start a fresh new project.

  2. If not, in your current project, delete all the files that you imported from the Web3 Space FPS project, including the SDK folder, the ClaimNftController and all the files that are generating errors.

  3. Import the NEW version of the Moralis Web3 Unity SDK from our GitHub:

  4. To import it, copy the HTTPS link and use Add package from Git URL on the Unity Package Manager:

  5. Once the new version of the SDK is imported, you can then copy the ClaimNftController.cs from the Web3 Space FPS project. It will generate some errors because we don’t use MoralisInterface anymore but just Moralis and also some namespaces have changed so you will need to change every MoralisInterface to Moralis and also change some namespaces. Probably these are the ones that you will need to add:

using MoralisUnity;
using MoralisUnity.Platform.Objects;
using MoralisUnity.Web3Api.Models;
  1. After you do so, in order to use ClaimNftController.cs you will first need to authenticate to Moralis so you can take a look at how this is done using the new version of the SDK watching this video: https://www.youtube.com/watch?v=3Mw1tDu9gak&t=9s

I hope this is helpful. Let me know on your progress.

David

1 Like