Ethereum Boilerplate Questions

[quote=“bogdabart, post:208, topic:3951”]
We don’t have useNFTTokenIds in the react-moralis. Please use the standard web3API hook

1 Like

These are just warnings and can be ignored

1 Like

Have you changed something in the code?

no, nothing at all, just followed the instruction on the git hub for the boilerplate as below .

  1. Copied and paster boiler plate in visual studio code within a folder
  2. input > cd ethereum-boilerplate
    3.input > yarn install
  3. Rename .env.example to .env in the main folder and provide your appId and serverUrl from Moralis
  4. input > yarn start

This is when i get the error message in the browser

Attaching the error message to be a bit more clear about the issue

i am testing the ethereum-boilerplate on my localhost
may i know why the token is not showing?
and where i can modify this
MoralisWeb3.js:271 Moralis.enable() is deprecated and will be removed, use Moralis.enableWeb3() instead.

Hi @dcoderk
make sure you have installed the 1inch DEX plugin.

You can ignore this message, it’s just a warning in our SDK, we need to fix it ourselves

i see it works now thank you
btw about the binance chain why the bnb token is not showing?

I don’t get an error but still nothing shows up. This is my code:

import { useMoralis } from "react-moralis";
import { useEffect, useState } from "react";
import { useMoralisWeb3Api, useMoralisWeb3ApiCall } from "react-moralis";
import { useIPFS } from "./useIPFS";

export const useNFTTokenIds = () => {
  const { token } = useMoralisWeb3Api();
  const { chainId } = useMoralis();
  const { resolveLink } = useIPFS();
  const [NFTTokenIds, setNFTTokenIds] = useState([]);
  const [totalNFTs, setTotalNFTs] = useState()
  const {
    fetch: getNFTTokenIds,
  } = useMoralisWeb3ApiCall(token.getAllTokenIds, { chain: chainId, address: "0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb" });

  useEffect(() => {
    if (data?.result) {
      const NFTs = data.result;
      for (let NFT of NFTs) {
        if (NFT?.metadata) {
          NFT.metadata = JSON.parse(NFT.metadata);
          // metadata is a string type
          NFT.image = resolveLink(NFT.metadata?.image);
  // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [data]);

  return { getNFTTokenIds, NFTTokenIds, totalNFTs, error, isLoading };

What’s the best way of updating this? If we download and overwrite files (I don’t use “git clone”) is that OK? Or is there an update command? Sorry for the noob question on that.

Is anyone able to see NFTs within the tab? it just keeps loading for me.

Where? Because for me it works ok

In your case only overwriting is possible

Add console.log(error) to the useEffect and share the message then here. Also please check the Network tab in the devtools if the response in not null

What part of the readme or docs does this apply to - connecting to existing contracts, either on Testnet or Mainnet. Sorry I am coming back to this much later than I anticipated. Last time I tried, it would not connect to my deployed test contract on Rinkeby.

Is it fully functional? ie, will this integrate into a site now with a deployed Mainnet contract, and connect to a wallet and then mint the NFTs?

Hey @JimBob ! We decided to change the code structure a bit, so these inctructions are not actual now. In coming days there will be an update for easy adding existing contract to the boilerplate. I’ll tag you here when it added

1 Like

Thanks! That explains why we couldn’t get it working today. :slight_smile: Good to know it’s not because we’re hopeless, haha!
We’ll pause for now and await the updates.
Many thanks Yomoo :+1:

As a quick follow up also, is there a way to incorporate Moralis into static websites, or does it always have to be via react?

For example, Squarespace, Wordpress, Webflow, or any other non-react method of building single-page sites we’d like to turn into Dapps.

Probably not via any of those builders GUIs of course, but once the code is exported and the site is live, or staged, and for those that are comfortable with inserting code into a site that originated from one of those sources… but also those people who are maybe not react experts. And lets face it even beginning react is a big task to get from zero to Dapp).

The Moralis SDK is built on JavaScript, so the main question is only can you use Js code inside the libraries you mentioned.

react-moralis is a wrapper around the Moralis Js SDK and it designed only for react/react-netive

Thanks good to know!
I guess the harder part of that question is how do you know what needs to go where, what dependences and file structure, to just use one or two components in a static site. Can you just drop <Chains /> in, and for that run what files from the larger package do you need, etc. Do you need ALL the imports, how do you know which ones, etc. If its a boilerplate it should be able to be broken down into parts easily, components, but the impression I have is it’s built like it’s one big interconnected thing.

1 Like