Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

405
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda