I'm building a Dapp and when i im click the mint button i get this error
Error: Provided address undefined is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted.
and this is how my code looks like
export const publicSale = async (mintAmount) => {
if(window.ethereum.selectedWallet) {
return {
success : false,
status : 'To be able to mint, you need to connect your wallet'
}
}
const nonce = await web3.eth.getTransactionCount(window.ethereum.selectedWallet, 'latest');
const tx = {
to : config.contractAddress,
from : window.ethereum.selectedWallet,
value : parseInt(web3.util.toWei(String(config.price * mintAmount), 'ether')).toString(16),
gas : String(30000 * mintAmount),
data : NFTContract.methods.publicSaleMint(mintAmount).encodeABI(),
nonce : nonce.toString(16)
}
try {
const txHash = await window.ethereum.request({
method : 'eth_sendTransaction',
params : [tx]
});
return {
success : true,
status : 'You have successfully minted your NFT'
}
} catch (error) {
return {
success : false,
status : 'Somthing went wrong ' + error.message
}
}
}
this is where the error goes
102 | const nonce = await web3.eth.getTransactionCount(window.ethereum.selectedWallet, 'latest');