-1

Hi i am trying to make speed up button like MetaMask. so i want to check if it's pending or success. i've been trying all api in web3.

don't tell me to use "getPendingTransactions" or filter plz. they are not working in web3@1.7.5 also getBlock('pending') either. also receipt thing doesn't work as it only shows true or false

i've made PendingTransactions with MetaMask but getBlock array doesn't show my PendingTransactions in explorer. those are not reliable.

just want to add gas to pending PendingTransactions but i have no idea how to check it. any idea or great api?

plz help me!

1 Answers1

1

When a transaction is mined, it's assigned a receipt. So until it's mined, there's no receipt.

async function isPending(txHash) {
    return (await web3.eth.getTransactionReceipt(txHash)) == null;
}

Docs: https://web3js.readthedocs.io/en/v1.7.5/web3-eth.html#gettransactionreceipt

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100