Ethereum Boilerplate Questions

What is your contract address?

Contract address:
0x7A7aB8E21336802A153d6106DDDCF71a472b5636

The data seems to be ok for that BSC testnet contract and each NFT seems to be synced. I can load the token_uri and image.

{
      "token_address": "0x7a7ab8e21336802a153d6106dddcf71a472b5636",
      "token_id": "198",
      "amount": "1",
      "token_hash": "ffe8ae8ee30540aff3e01d3d5c4a1c4b",
      "block_number_minted": "19669878",
      "contract_type": "ERC721",
      "name": "MYNFT",
      "symbol": "TNFT",
      "token_uri": "https://ipfs.moralis.io:2053/ipfs/QmYgtLJ49yY8jSBuPLPoWNQEYx5KZgvcxErHkPFZY2cV2g",
      "metadata": "{\"name\":\"Test NFT 11\",\"walletUsername\":\"Thilipan\",\"description\":\"test\",\"image\":\"https://ipfs.moralis.io:2053/ipfs/QmWperfrEpHZGTEuiR6CwA5kuKMRnA8yDM5x4L3aULDBAV\",\"slots\":\"Test Slot 11\",\"type\":\"Farm\"}",
      "synced_at": "2022-05-30T10:31:44.305Z",
      "last_token_uri_sync": "2022-05-27T11:05:45.948Z",
      "last_metadata_sync": "2022-05-30T10:31:44.305Z"
    }

Are you still having issues fetching/using the data?

Thanks for the support. We can able to create NFT now, it is fixed by the support team from Moralis.

I can able to fetch some NFTs, recently created NFTs took 1.30hrs to 2hrs to reflect, now we are not able to list the created NFT it is gone from transactions after 2 hrs and it’s not listed in the marketplace as well.

it is gone from transactions after 2 hrs

What do you mean by this exactly?

Are your NFTs not showing on the NFTs page? What marketplace are you referring to?

While listing the NFT it is marked as SELL in the NFT transactions view, after two hours the item was gone from the NFT transactions, the expected result is if the transaction succeeds the listed NFT should be available in the explore view where I can buy any NFT. Attached snapshot for your quick reference.

@alex and @johnversus must shudder every morning when they come across these forums :slight_smile:
I am slashing and hacking my way through the Ethereum Boilerplate trying to ‘make it my own’ and use it for my NFT-based game.

I say that so you know that my code isn’t the prettiest - the aim was to splice and dice enough of it together to be doing what I want to do and then be able to go back through and clean up the code etc before moving to a live site.

In saying that if there is anyone out there who can help with this question that I now find myself stuck on I’d be greatly appreciative.

Columns

import React, { useState } from "react";
import { useMoralis, useNFTBalances } from "react-moralis";
import { Card, Divider, Skeleton, Column } from "antd";
import logo from "Logo.png";


const { Meta } = Card;

const styles = {
  NFTs: {
    display: "flex",
    flexWrap: "wrap",
    WebkitBoxPack: "start",
    justifyContent: "flex-start",
    margin: "0 auto",
    maxWidth: "1000px",
    width: "100%",
    gap: "10px",
  },
  };


function NFTBalance() {
  const { data: NFTBalances } = useNFTBalances();
  const { Moralis, chainId } = useMoralis();
  const options = {
    address: '0x945b4E834b06d743c18284c73bA6E0bDD2515E1B',
    token_address: '0x2953399124f0cbb46d2cbacd8a89cf0599974963',
     };
    

  console.log("Lockerroom", NFTBalances);
  return (
    <div style={{ padding: "15px", maxWidth: "1030px", width: "100%" }} align="center">
      <h1><font color="#ffffff">Your Locker Room</font></h1>
      <Divider></Divider>
     <div style={{ padding: "10px", maxWidth: "1030px", width: "80%" }} align="center">
       <font color="#ffffff">Welcome to your Locker Room. Here you will be able to upgrade your Yowie NFT including adding 
       accessories and traits that you acquire, as well as any in-game perks before heading to the Battle Arena.</font>
         </div>
         <space></space>
         <div style={{ padding: "15px", maxWidth: "1030px", width: "100%" }} align="center">
           <img src={logo} alt="" style={{ height: "350px" }}></img>
           <button>Minting Soon...</button>
    </div>
    <Divider></Divider>
   <div>  <h2><font color="#ffffff">Stored Bonuses</font></h2></div> 
  <font color="#ffffff">**2 x 50/50 Columns here.**</font>  </div>
  );
  
}

Would love to get two columns where stated in BOLD!

So after two hours, this item disappears from this page? When someone has purchased it, that should say “SELL CONFIRMED” I believe.

If the NFT is for sale, then on the “Explore” page, it will have the buy options available. Are you saying it doesn’t?

Sorry, I’m not too sure what you’re asking for.

Are you talking about <font color="#ffffff">**2 x 50/50 Columns here.**</font></div>? What data do you want in here and how should it be displayed?

That is the part I am talking about. And I appreciate your response but I am not going to learn if I can’t bug fix or pull together the most basic of information. So please ignore the question while I head back to the tutorials/documents, it is quite clear that I have missed something as I’ve noticed all of my issues revolve around styling.

Thank you so much for getting back to me - I greatly appreciate it.

1 Like

I can appreciate that, good luck to you with your learning.

How come when on the /1inch page on the boilerplate, if I hit refresh or hit enter on the path in the address bar I get “chain null chain.jsx:91” in the console? and the tokenlist or modal window are not populated? seems to only happen to the first tab in the DEX component. or if I move the dex to the quickstart page, on first load the first tab “ethereum” is unpopulated aswell as it’s modal window.

if I add another tab infront of “ethereum” with some random content in it and make it the default showing tab, then click on the ethereum tab it populates fine.

I get “chain null chain.jsx:91” in the console

This is fine, this Chains component just logs chain from useChain() even before it has a valid value.

and the tokenlist or modal window are not populated? seems to only happen to the first tab in the DEX component

This is an issue with the useInchDex hook (hooks/useInchDex.js), what you can do is change the current useEffect at the top to:

const { Moralis, account, isInitialized } = useMoralis();

...

useEffect(() => {
  async function run() {
    await Moralis.initPlugins();
    Moralis.Plugins.oneInch
      .getSupportedTokens({ chain })
      .then((tokens) => setTokenlist(tokens.tokens));
  }

  if (isInitialized) run();
}, [isInitialized]);

Awesome thanks Glad! I just had to modify the dependency array a bit to get it working properly.

[Moralis, chain, isInitialized]

1 Like

why NFT Assets not appearing in react native application… after connected my metamask test network wallet in my application… its always loading only…

Hello can you post in this thread with answers to these questions - do you get any console errors and have you verified with the Moralis API that your wallet address has NFT results for the testnet that you’re using?

I have bbeen testing the eth-boilerplate for a cpl weeks now and so far I really like it. However, I recently upgraded the react-moralis packages to latest version and can no longer display chains or logged user account address on frontend.

Has anyone else had this problem? If i downgrade the network selector works. What changes do I need to make? Any help is greatly appreciated. Thank you. =)

Hi!

I have a problem calling contract functions from the browser using useWeb3Contract, essentailly the code doesnt break anything but does not run either when invoking through a button with an onClick:

export default function CreateMatch() {
    const { Moralis, isWeb3Enabled, chainId: chainIdHex } = useMoralis()
    const chainId = parseInt(chainIdHex)
    const universalContractAddress = chainId in contractAddresses ? contractAddresses[chainId][0] : null

    const eventOptions = {
        abi: abiEvent,
        contractAddress: universalContractAddress,
        functionName: "createMatch",
        params: {
            teamName1, teamName2, teamName3, eventDate, matchPlace, matchFinished, matchBets},
    };

    const { runContractFunction, isFetching, isLoading } =
        useWeb3Contract();
    const { runContractFunction: createMatch } = useWeb3Contract();
    return (
            <div>
                <button
                    onClick={() => runContractFunction({ params: eventOptions })}
                    disabled={isFetching}
                >
                    CreateMatch
                </button>
            </div>
    )
}

and the contract it is calling:


contract Event {
    uint256 public matchCount = 0;
    mapping(uint => Match) public matches;
    struct Match {
        uint256 matchId;
        string homeTeam;
        string awayTeam;
        string drawTeam;
        string matchDate;
        string place;
        bool finished;
        address[] userList;
    }
    function createMatch(
        string memory homeTeam,
        string memory awayTeam,
        string memory drawTeam,
        string memory matchDate,
        string memory place,
        bool finished,
        address[] memory userList
    ) public {
        matches[matchCount] = Match(
            matchCount,
            homeTeam,
            awayTeam,
            drawTeam,
            matchDate,
            place,
            finished,
            userList
        );
        matchCount++;
    }
}

Why is my code not opening up metamask to deduct the gas cost and run the contract function?

You may just have to keep using the older version or try different versions that don’t break things. That is strange though as a user (and myself) had a similar issue to yours with the dropdown chain selector but upgrading the react-moralis version fixed it.

The eventOptions should just be passed in as an object without params e.g. useWeb3Contract(eventOptions). You can check out the docs.