2

I am sending transactions using the Solana web3js library:

  1. sendRawTransaction
  2. confirmTransaction w/ "confirmed" commitment.

Although, how would I check that the tx was actually successful?

2 Answers 2

2

All I had to do was check for the return value of the confirmTransaction

const result = await connection.confirmTransaction(...);
if (result.value.err) { /* log err due to failed tx */}

Thanks Josip!

And others on this Twitter thread

0

you can check the transaction status like this

First, get the transactionId

let txid = await sendRawTransaction(transaction, connection);

Then go to this URL in Solana Explorer and check the status(pending and confirmed)

console.log(Transaction submitted: https://explorer.solana.com/tx/${txid}?cluster=devnet);

Specify the cluster in URL as you want devnet Mainnet etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.