Axios Network error when calling get tokenId on NFT Marketplace

hey guys. im getting this error on my front end, can anyone help?

GET https://%3Cdedicated_gateway%3E.infura-ipfs.io/ipfs/QmemEXtAasE6gyqy6PVNjo8efGKCE8EeodMJ4zgdsuVkxU net::ERR_NAME_NOT_RESOLVED

it seems like axios is passing a “dedicated_gateway”, but i can’t find that anywhere

this is the code

import Web3 from ‘web3’;
import { useEffect, useState } from ‘react’;
import axios from ‘axios’;
import Web3Modal from ‘web3modal’;

//import Marketplace from ‘…/contracts/optimism-contracts/Marketplace.json’
//import BoredPetsNFT from ‘…/contracts/optimism-contracts/BoredPetsNFT.json’
import Marketplace from ‘…/contracts/ethereum-contracts/Marketplace.json’
import BoredPetsNFT from ‘…/contracts/ethereum-contracts/BoredPetsNFT.json’

export default function CreatorDashboard() {
const [nfts, setNfts] = useState()
const [loadingState, setLoadingState] = useState(‘not-loaded’)

useEffect(() => { loadNFTs() }, )

async function loadNFTs() {
const web3Modal = new Web3Modal()
const provider = await web3Modal.connect()
const web3 = new Web3(provider)
const networkId = await web3.eth.net.getId()

// Get listed NFTs
const marketPlaceContract = new web3.eth.Contract(Marketplace.abi, Marketplace.networks[networkId].address)
const accounts = await web3.eth.getAccounts()
const listings = await marketPlaceContract.methods.getMyListedNfts().call({from: accounts[0]})
// Iterate over my listed NFTs and retrieve their metadata
const nfts = await Promise.all(listings.map(async i => {
  try {
    const boredPetsContract = new web3.eth.Contract(BoredPetsNFT.abi, BoredPetsNFT.networks[networkId].address)
    const tokenURI = await boredPetsContract.methods.tokenURI(i.tokenId).call();
    const meta = await axios.get(tokenURI);

    //const ipfsSubdomain = "https://hephtestmarket.infura-ipfs.io/ipfs/";
   // const meta = await axios.get(`${ipfsSubdomain}${tokenURI}`);


    let item = {
      price: i.price,
      tokenId: i.tokenId,
      seller: i.seller,
      owner: i.owner,
      image: meta.data.image,
    }
    return item
  } catch(err) {
    console.log(err)
    return null
  }
}))
setNfts(nfts.filter(nft => nft !== null))
setLoadingState('loaded')

}

if (loadingState === ‘loaded’ && !nfts.length) {
return (

No NFTs listed

)
} else {
return (


Items Listed



{
nfts.map((nft, i) => (



Price - {Web3.utils.fromWei(nft.price, “ether”)} Eth




))
}



)
}
}

2 Likes