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

208
Vistas
How to wait for the response in typescript after it sends back an error?

In my Angular project, I am trying to mint a token with a contract address and an abi. Problem is, mint token method takes a lot of time to finish (5 minutes for example) and it returns this error:

Error: Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!

but then it gets mined successfully! even though it threw this error.

Problem is, I want the approve method to happen after the mintToken method is finished successfully, but since it throws this error, the approve method never gets called.

How can I listen to the mintToken method and call approve whenever it finally receives a response?

This is my contract:

this._contract = new this.web3.eth.Contract(MINT_ABI, MINT_CONTRACT);

This is my code:

      this._contract.methods
        .mintToken(
          formValue.wallet,
          ipfsLink,
          formValue.royaltyRecipient,
          royaltyValue
        )
        .send({ from: formValue.wallet })
        .then(
          (response: any) => {
            console.log(response);
            this.createNftService.changeTokenId(response);
            this.createNftService.changeWallet(formValue.wallet);

            this._contract.methods
              .approve(MARKETPLACE_CONTRACT, response)
              .send({ from: formValue.wallet })
              .then(
                () => this.router.navigateByUrl('/create/list'),
                (error: any) => {
                  console.log(error);
                }
              );
          },
          (error: any) => {
            console.log(error);
          }
        );
about 4 years ago · Juan Pablo Isaza
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