3

The confirmTransaction method is being deprecated. Instead there's a sendandconfirmtransaction method but that is not available on the connection object, so I can't use for transactions that are to be signed using phantom.

I have a transaction hash(signature) after the transaction so I'm trying to confirm if a transaction was done on the backend using the transaction hash, how is this possible?

raghav saraf
  • 151
  • 1
  • 5

1 Answers1

7
/** @deprecated Instead, call `confirmTransaction` using a `TransactionConfirmationConfig` */

Method is not deprecated try this:

const tx = await connection.requestAirdrop(publicKey, 1e9);
const latestBlockHash = await connection.getLatestBlockhash();

await connection.confirmTransaction({
  blockhash: latestBlockHash.blockhash,
  lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
  signature: tx,
});
Milkncookiez
  • 6,817
  • 10
  • 57
  • 96
Urvesh109
  • 71
  • 3