Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda