await routerContract
          Date.now() + 60000 * props.deadline,
          { value: ethers.utils.parseEther(strEthAmount) }

The above is working code. I am writing this question for further understanding.

I am having trouble understanding the final parameter of my smart contract... { value: ethers.utils.parseEther(strEthAmount) }

I added the final parameter as the code was throwing errors and I saw a thread saying that you have to add this parameter so that ethers knows that I am making a transaction. As far as I understand, the parameter is only passing the ether amount.

Another resolution that I tried was putting a .send method for my transaction. But ethers does not recognize the .send method.

If anyone could help to clear my confusion or give some pointers, I would be very grateful. Thanks!

1 Answer 1


addLiquidityETH seems to be a payable function therefore it needed that parameter, those curly brackets indicate that this is info for the transaction and not part of the parameters expected by the function, that's how you indicate you are sending eth. It could also include gasLimit and other properties.

  • Thanks for the information! I still can't seem to find any sort of documentation for this syntax. But I guess I got the gist of it.
    – tuktuktruk
    Commented Apr 7, 2022 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.