• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

240
Views
¿Cómo imprimir solidez revertirme mensaje en web3.js?

Estoy tratando de codificar una plataforma de subastas. Cuando el contrato envía una función de reversión, quiero mostrarla en la pantalla. Estoy usando web3.js versión 1.5.

Este es el código de solidez relacionado;

 function bid() public payable { require( now <= auctionEndTime, "Auction already ended." ); require( //I want to print this error on screen. msg.value > highestBid, "There already is a higher bid." ); if (highestBid != 0) { pendingReturns[highestBidder] += highestBid; } highestBidder = msg.sender; highestBid = msg.value; emit HighestBidIncreased(msg.sender, msg.value); }

Este es el código javascript para pujar y obtener error;

 async bid(amount) { if(this.state.auction!=='undefined'){ try{ await this.state.auction.methods.bid().send({value: this.state.web3.utils.toWei(amount).toString(), from: this.state.account}) } catch (e) { console.log(e) } } }

Esto es lo que obtengo en la consola si hago una oferta más baja que la oferta más alta;

{código: -32603, mensaje: Error: [ethjs-query] while formatting outputs from…/task_queues.js:93:5)","name":"RuntimeError"}}}}' , stack: Error: Error: [ethjs-query] while formatting outpu…/task_queues.js:93:5)","name":"RuntimeError"}}}}' }

Lo que quiero es imprimir "Ya hay una oferta más alta". en la consola, pero no pude hacerlo funcionar. Leí documentos de web3 y documentos de metamask, pero no tuve suerte. Gracias por sus respuestas.

over 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error