I just want to make a simple button that allows someone to mint an nft from my contracts mint nft function. I already have everything on the site working just trying to sort how to send the payable to the function via moralis.
Right now my page just has the simple transfer button that sends erc20 I just want to add the pointer to the mint function.
Yes I actually watched this today and got some progress made. I have just been pulling bits and pieces from tutorials. My function requires a payable input of ether and quantity to fire off the mint. I got most of the way through it today and started to figure it out it’s just that this tutorial doesn’t show how to pass a payable to the function.
function mintNFT(uint256 _count) public payable {
if (msg.sender != owner()) {
require(saleOpen, "Sale is not open yet");
}
require(
_count > 0 && _count <= 10,
"Min 1 & Max 10 can be minted per transaction"
);
require(
totalSupply() + _count <= MAX_HS,
"Transaction will exceed maximum supply"
);
require(
msg.value >= price * _count,
"Ether sent with this transaction is not correct"
);
address _to = msg.sender;
for (uint256 i = 0; i < _count; i++) {
_mint(_to);
}
}
Hey guys im having an issue with the using the moralis server for hosting my files. In the video filip deploys the contract along with the .json files and he is able to pull up the images rhat he used in the folder by entering the directory path he listed in the .jsoon file however when i try to do the same i get a 404 file not found error. Do i need to set up a specific server? I used test net ropsten for ethereum and selected the 2 other chains. The images are in the same directory as the json files so why are they not being located?
Ok sorry about that but i think it may be that my server was maxed out, im new to moralis. I didnt know exactly what i would name the topic i andbin my confusion i just chose this thread. I was coding along and i try not to look at the repositories before i at least try on my own
I have it set up to mint like this can you tell me if it does not look right? For some reason i keep getting fund not defined in the console log. Im new to JS so bare with me and thank you for alll you help to this point.
<script>
async function fund(){
amount = document.getElementById("100000000000000000").value;
window.web3 = await Moralis.Web3.enable();
let FootieStars = new web3.eth.Contract(('mintStars(uint256)', '1');, 0x9c90Ae0d3D6A29D58Bd57DF06494Ce985496a2fe);
await FootieStars.methods.mintStars(_count).send({ value: amount, from: ethereum.selectedAddress });
}
document.getElementById("btn-mint").onclick = fund;
</script>