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

264
Views
Getting the transaction hash after sending a method to track the status

I am trying to add some extra functionality to my NFT minting dApp and check if a mint/transaction is actually succesful before executing a certain line of code. But i cant really connect the dots on this.

I found alot of examples to get the status by using the txn hash, but one first has to obtain this transaction hash right? Is there a way of obtaining the txn hash after starting up/confirming the transaction? This is the actual code where i send the transaction to the mint method in my contract:

const mint = async function (amount) { 
   const id = await ethereum.request({ method: 'eth_chainId' });
  if (mintAcc != "")
  {
    var totalCost = WEI_COST * amount;
    // if an account is present
    if (mintAcc.length > 0 && id == CHAIN_ID) { 
      
     contract.methods.mint(amount).send({
        from: mintAcc[0],
        to: CONTRACT_ADDRESS,
        value: String(totalCost),
       });
    }
  } else { 
    alert("Connect wallet first")
  }
}

What should i add to obtain the transaction hash/id after actually sending the mint method to track its status if its mined or not?

The reason im asking this is because im using an allowlist stored in a map which holds the value how many mints a specific adress can claim. After the claim took place i want to remove the persons adress so they cannot claim again.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The send() method returns a PromiEvent type that you can handle events on. One of these events is transactionHash

Code example:

contract.methods.mint(amount).send({
    from: mintAcc[0],
    to: CONTRACT_ADDRESS,
    value: String(totalCost),
}).on("transactionHash", function(hash) {
    console.log(hash);
});

Docs: https://web3js.readthedocs.io/en/v1.7.3/web3-eth-contract.html#methods-mymethod-send

about 4 years ago · Juan Pablo Isaza Report
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!