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

200
Views
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
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!