Working with usePrepareContractWrite Dealing with the logical flow
const { config: contractWriteConfig } = usePrepareContractWrite({
...contractConfig,
functionName: 'mint',
args: [numToMint],
overrides: {
value: ethers.utils.parseEther(payment), //how do I dynamically change this number on the fly to string
},
});
const {
data: mintData,
write: mintBee,
isLoading: isMintLoading,
isSuccess: isMintStarted,
error: mintError,
} = useContractWrite(contractWriteConfig);
In short I'm using a handle event for the number to mint. Before I could multiply the numToMint by the cost amount and convert it to string in another function. Now with usePrepareContractWrite() I'm unsure how to approach this as I can't pass arguments to the "mintBee" write function. Any examples are greatly appreciated!