i am trying to develop a nft mint daap. i deploy the erc 721 contract on bsc test net(b481eFed1099C03aEBA03a160cd4feE17Ace3257)/ The mint function is working but the metadata is not showing on opensea test net. for metadata and image i am using pinata, here is the link for metadata
https://gateway.pinata.cloud/ipfs/Qmcchbbm2R6CdiwsYbcoLPcY7PSi7yska9HzDCvK977mMU
my ultimate goal is once the user mint his nft he can view is on opensea.
here is my code
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<!-- INSTALL THE SDK and WEB3 -->
<script src="https://unpkg.com/moralis-v1/dist/moralis.js"></script>
<!-- / -->
<title>Document</title>
</head>
<body>
<div><button id="logn">Connect</button></div>
<div id="address"> </div>
<div ><input type="text " placeholder="quantity" id="quan"></div>
<button id="mnt">mint</button>
<div> <button id="nft">view on opensea</button></div>
<script src="main.js"></script>
</body>
</html>
JS
const serverUrl = "xx"
const appId = "xx"
Moralis.start({serverUrl, appId})
/* Authentication code */
async function login() {
let user = Moralis.User.current();
user = await Moralis.authenticate({ signingMessage: ' done' });
if(user){
console.log(user);
let addressOfUser= document.getElementById('address')
document.getElementById('logn').innerHTML='connected'
addressOfUser.innerHTML=(user.get('ethAddress'));
}
}
async function mint(quantity_){
await Moralis.enableWeb3();
let tic= document.getElementById('quan').value
let options={
contractAddress: "0xb481eFed1099C03aEBA03a160cd4feE17Ace3257",
functionName: "mint",
abi:[{"inputs":[{"internalType":"uint256","name":"quantity_","type":"uint256"}],
"name":"mint","outputs":[],"stateMutability":"payable","type":"function"}],
params:{
quantity_:tic
},
msgValue:Moralis.Units.ETH(tic*0.01),
}
await Moralis.executeFunction(options)
}
document.getElementById('logn').onclick= login;
document.getElementById('mnt').onclick=mint;