0

How to test payable function with sending ethers to it? I mean how to write it?

await contact.payablefunction()   ###what should I write?
1
  • are u using etherjs ?
    – Majd TL
    Commented Feb 11, 2022 at 19:46

1 Answer 1

1

If yuo are using etherjs then yuo need to add the amount of ether to send in the value. Example sending 0.01 ether:

const options = {value: ethers.utils.parseUnits("0.01")}
await contract.functioname( <args if it take arguments> , options)

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.