Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

403
Views
How would I send an eth value to specific smart contract function that is payable in ethers.js?

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!