i already have a working code for my āmint buttonā but i only can accept a constant amount of crypto .
i want to know how i can make the user choose the amount of nfts to mint with the crypto charge going up as he chooses more nfts to mint. (example: 1NFT=>0.1 ETH / 2NFT=>0.2 ETH / 3NFT=>0.3 ETH ā¦)
this is the code iām working with right now .
`
window.addEventListener(āloadā, async () => {
if (window.ethereum) {
window.web3 = new Web3(ethereum);
try {
await ethereum.enable();
initPayButton()
} catch (err) {
$(ā#statusā).html(āUser denied account accessā, err)
}
} else if (window.web3) {
window.web3 = new Web3(web3.currentProvider)
initPayButton()
} else {
$(ā#statusā).html(āNo Metamask (or other Web3 Provider) installedā)
}
})
const initPayButton = () => {
$('.bn632-hover.bn24').click(() => {
// paymentAddress is where funds will be send to
const paymentAddress = 'my wallet adress'
const amountEth = 0.23
web3.eth.sendTransaction({
to: paymentAddress,
value: web3.toWei(amountEth, 'ether')
}, (err, transactionId) => {
if (err) {
console.log('Payment failed', err)
$('#status').html('Payment failed')
} else {
console.log('Payment successful', transactionId)
$('#status').html('Payment successful')
}
})
})
}`