I am new heare. Tried to integrate crossmint to my website. but failed. What have I done wrong? My contrac is deployed on rinkeby
I am using rinkeby testnet
my code react js-
import React, { useEffect, useState, useRef } from "react";
import { CrossmintPayButton } from '@Crossmint/client-sdk-react-ui';
export default function MintNft() {
return (
<CrossmintPayButton
collectionTitle="Test MembershipNft2"
collectionDescription="Testing"
collectionPhoto="null"
clientId="d4e2f7f2-d4dd-4b5f-bb97-77f95874d81d"
mintConfig={{"type":"erc-721","totalPrice":".001","_mintAmount":"1"}}
environment="staging"
/>
);
}
my mint function
function mint(address to,uint256 _mintAmount) public payable {
uint256 supply = totalSupply();
require(!paused);
require(_mintAmount > 0);
require(_mintAmount <= maxMintAmount);
require(supply + _mintAmount <= maxSupply);
require(supply + _mintAmount<= availableSupplyForSale);
if (to != owner()) {
require(msg.value >= cost * _mintAmount);
}
for (uint256 i = 1; i <= _mintAmount; i++) {
_safeMint(to, supply + i);
}
}
Is there any regional restriction?
The reason you're seeing the "execution reverted" error is that one of the require statements in your mint function isn't passing.
To start one thing that can be hugely helpful is to include error messages in your require statements.
So instead of:
require(!paused);
do this:require(!paused, "Minting is Paused");
I bet the contract is paused. I tried to check on etherscan, but the contract isn't verified.
If you're still working on this you can reach me on discord at dmulvi#0001. I work at Crossmint and would be happy to help!