I'm trying to call a payable function on a smart contract that only accepts one argument.
How would I send an eth value to this function in ethers.js along with the function call? The docs don't seem to give much examples on the best way to do this.
My function call
const reciept = await contract.buyPunk(1001);
all other read and write function calls work as expected, but its calling a payable function that I have yet to solve.
const options = {value: ethers.utils.parseEther("1.0")}
const reciept = await contract.buyPunk(1001, options);
When calling a contract function through ethers.js you can pass along an object of options at the end of your arguments. This object can set the the value
to send along with the transaction.
Documentation here: https://docs.ethers.io/v5/api/contract/contract/#Contract-functionsCall