I have been using the following chunk of code for awhile and it seems to work about 98% of the time, however there are cases where the transaction does go through seemingly immediately, but this does not pick it up in time, even when I have my confirmTransactionInitialTimeout set to 60 seconds. Is there a better alternative or something that I'm doing wrong? Thanks! (I am using the $50 plan on quicknode as an RPC)
const connection = new Connection(
process.env.NEXT_PUBLIC_CONNECTION_NETWORK == "devnet"
? process.env.NEXT_PUBLIC_SOLANA_RPC_HOST_DEVNET
: process.env.NEXT_PUBLIC_SOLANA_RPC_HOST_MAINNET_BETA,
{ commitment: "processed", confirmTransactionInitialTimeout: 60000 },
);
await connection.confirmTransaction({
signature: signature,
blockhash: blockhash.blockhash,
lastValidBlockHeight: blockhash.lastValidBlockHeight,
})