Closed cesar4design closed 1 year ago
yes I can do that for you, your using this exact Template?
@cesar4design You would need to pass in the value from the text box into the cost of the NFT. I've updated mine to do dynamic pricing so something similar to this
const baseWei = 10000000000000;
const dynamicDisplayCost = () => {
let round = roundUp(parseInt(data.totalSupply) + parseInt(mintAmount), 1000);
let multiplier = round === 0 ? 1000 : round;
return SET_COST_CONFIG(baseWei * multiplier);
};
useEffect(() => {
dynamicDisplayCost();
});
A snippet of the top part of the function
const claimNFTs = () => {
// let cost = CONFIG.WEI_COST;
let cost = WEI_COST;
let gasLimit = CONFIG.GAS_LIMIT;
let totalCostWei = String(cost * mintAmount);
let totalGasLimit = String(gasLimit * mintAmount);
console.log('Mint Amount: ', mintAmount);
console.log('Cost: ', cost);
console.log('Total Cost In WEI: ', totalCostWei);
console.log('Total Cost In ETH: ', totalCostWei / (baseWei * 100000));
console.log('Gas Limit: ', totalGasLimit);
console.log('Contract Address: ', CONFIG.CONTRACT_ADDRESS);
Code to change the selected price of the NFT. This is the improved part of the original repository.