I am cloning opensea and trying to put my smart contract info that I have on Goerli, where can I specify that ?
thank you for your reply, I am wondering where I can specify which testnet my contract is in? I have a contract already deployed on goerli and want to use that
Not sure what you mean, what sort of contract are you talking about? If youâve deployed your contract on Goerli, then you donât need to specify itâs on Goerli.
If you have an NFT contract on Goerli that you want to display, then you set it in your helpers\collections.js
file with the correct chainId (â0x5â) and then when the user is connected to Goerli with their wallet, it will be active in the app.
I thought I had to specify contract info in MoralisDappProvider.js ?
I also see Chains.jsx is where the input is given?
I thought I had to specify contract info in MoralisDappProvider.js ?
Yes you do for the marketplace contract. That is different from an NFT contract. When the userâs wallet is on Goerli, then they can interact with your marketplace contract.
when I insert my contract info, the marketplace shows empty page in the browser, this is my code in MoralisDappProvider.js:
const [contractABI, setContractABI] = useState(my_contract_abi); //Smart Contract ABI here
const [marketAddress, setMarketAddress] = useState(my_contract_address); //Smart Contract Address Here
Is your wallet on the right chain where some of the NFT collections defined in helpers\collections.js
(sorry incorrectly specified networks.js previously)? You donât see the marketplace contract, itâs what you interact with behind the scenes when you go to list an NFT for example from one of these collections.
Check your browser console for any errors.
my abi is not in JSON format apparently, but I just copied and pasted it
[
{
inputs: [ [Object] ],
stateMutability: ânonpayableâ,
type: âconstructorâ
},
{
anonymous: false,
inputs: [ [Object], [Object] ],
name: âBalanceWithdrawnâ,
type: âeventâ
},
{
anonymous: false,
inputs: [ [Object], [Object] ],
name: âOfferingClosedâ,
type: âeventâ
},
{
anonymous: false,
inputs: [ [Object], [Object], [Object], [Object], [Object], [Object] ],
name: âOfferingPlacedâ,
type: âeventâ
},
{
anonymous: false,
inputs: [ [Object], [Object] ],
name: âOperatorChangedâ,
type: âeventâ
},
{
inputs: [ [Object], [Object], [Object], [Object] ],
name: âplaceOfferingâ,
outputs: [],
stateMutability: ânonpayableâ,
type: âfunctionâ
},
{
inputs: [ [Object] ],
name: âcloseOfferingâ,
outputs: [],
stateMutability: âpayableâ,
type: âfunctionâ,
payable: true
},
{
inputs: [],
name: âwithdrawBalanceâ,
outputs: [],
stateMutability: ânonpayableâ,
type: âfunctionâ
},
{
inputs: [ [Object] ],
name: âchangeOperatorâ,
outputs: [],
stateMutability: ânonpayableâ,
type: âfunctionâ
},
{
inputs: [ [Object] ],
name: âviewOfferingNFTâ,
outputs: [ [Object], [Object], [Object], [Object] ],
stateMutability: âviewâ,
type: âfunctionâ,
constant: true
},
{
inputs: [ [Object] ],
name: âviewBalancesâ,
outputs: [ [Object] ],
stateMutability: âviewâ,
type: âfunctionâ,
constant: true
}
]
Where did you copy this ABI from? There shouldnât be any [Object]
s like that. Also it doesnât look like the ABI for the default marketplace contract.
This is an example of the marketplace ABI, and it needs to be in a string:
const [contractABI, setContractABI] = useState(
'[{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"createMarketItem","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"itemId","type":"uint256"}],"name":"createMarketSale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"itemId","type":"uint256"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sold","type":"bool"}],"name":"MarketItemCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"itemId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"}],"name":"MarketItemSold","type":"event"},{"inputs":[],"name":"fetchMarketItems","outputs":[{"components":[{"internalType":"uint256","name":"itemId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable","name":"seller","type":"address"},{"internalType":"address payable","name":"owner","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"bool","name":"sold","type":"bool"}],"internalType":"struct BETTASea.MarketItem[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]'
);
I was just reading documentation. let me check that tutorial and will get back to you! thanks
I checked the video really helpful. Do you know where is the nft contract (marketplace) used in this video? I canât find it on github
thank you glad for your help. I have successfully loaded the contract and NFE collection but am getting the error âUnable to fetch all NFT metadata⌠We are searching for a solution, please try again later!â
I understand it is coming from NFTBalance.jsx but canât seem to figure out why.
I also changed to heroku server to stop CORS error.
the picture for the collection loads fine
this is what the browser gives me
You can click into that 400 error link (or check your browserâs network tab) to see what the error response is.
That âUnable to fetch all NFT metadataâ message means the useNFTBalance
hook (getNFTs) failed where it couldnât get the metadata from one or more of your owned NFTs. What is that NFE contract address youâre using?
this is what the console link says : {âcodeâ:141,âerrorâ:âaddress is not a valid hex addressâ}
and this is my NFT address on goerli 0xA43C59BDb984DBF72A2ca6D938B5cfc745817AcA