Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: blockchain.smartContract.methods.mint is not a function #38

Open
rcpilotp51 opened this issue Jan 3, 2022 · 11 comments
Open

Comments

@rcpilotp51
Copy link

I can connect the metamask, but the buy button produces this error.

129 | console.log("Gas limit: ", totalGasLimit); 130 | setFeedback(Minting your ${CONFIG.NFT_NAME}...`);
131 | setClaimingNft(true);

132 | blockchain.smartContract.methods
| ^ 133 | .mint(mintAmount)
134 | .send({
135 | gasLimit: String(totalGasLimit),`

Not sure what to do. Any suggestions

I'm trying to test on a Rinkeby test contract - could that be the issue?

@VaderUri
Copy link

VaderUri commented Jan 3, 2022 via email

@rcpilotp51
Copy link
Author

rcpilotp51 commented Jan 3, 2022

yes! thanks for your response! @VaderUri

@rcpilotp51
Copy link
Author

I'm not sure whats going on. This is the last piece of the puzzle for me

@rcpilotp51
Copy link
Author

@VaderUri I'm not sure whats going on. I think everything is setup.

@rcpilotp51
Copy link
Author

@HashLips any insight?

@xxxcrow
Copy link

xxxcrow commented Jan 5, 2022

same issue here, deployed on polygon testnet

@trinichad
Copy link

trinichad commented Jan 6, 2022

Make sure you put in your contract abi. I created a new abi file "myABI.json" and copied my contract-specific abi to that file. I then went to "src > redux >blockchain > blockchainActions.js" and updated the abi location.

export const connect = () => {
  return async (dispatch) => {
    dispatch(connectRequest());
    const abiResponse = await fetch("/config/myABI.json", {

Also, my mint call in my contract is "mintSale", by default, in this minting dapp it was set to "mint" so check that in the App.js

 const claimNFTs = () => {
    let cost = CONFIG.WEI_COST;
    let gasLimit = CONFIG.GAS_LIMIT;
    let totalCostWei = String(cost * mintAmount);
    let totalGasLimit = String(gasLimit * mintAmount);
    console.log("Cost: ", totalCostWei);
    console.log("Gas limit: ", totalGasLimit);
    setFeedback(`Minting your ${CONFIG.NFT_NAME} NFT...`);
    setClaimingNft(true);
    blockchain.smartContract.methods
      .mintSale(mintAmount)
      .send({
        gasLimit: String(totalGasLimit),
        to: CONFIG.CONTRACT_ADDRESS,
        from: blockchain.account,
        value: totalCostWei,

@vollit
Copy link

vollit commented Jan 6, 2022

Same error here, maybe it is caused by an change in the web3 lib?

@vollit
Copy link

vollit commented Jan 6, 2022

@rcpilotp51 I fixed it, it has to do with your ABI file. If i put the default ABI file in the folder it fixes the problem. The methods .mint() and for example .getTotalSupply() missed in my ABI file so thats why it keeps crashing.

@Doughp
Copy link

Doughp commented Jan 14, 2022

Have you found the fix to this issue?

I am seeing people saying the ABI but mine says safeMint so i changed the ".mint" to ".safeMint" and it still is not working. or is giving me another error saying invalid address, or saying it received two parameters but was expecting one.

Any help is appreciated,
thank you.

@idolaru
Copy link

idolaru commented Apr 3, 2022

Has anyone managed to fix this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants