Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: update confirmTransaction strategy
  • Loading branch information
GHesericsu committed Dec 19, 2022
commit 44445f6f56d2e734f35dec1efbc921ebb7ecbdd6
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"Blockhash",
"txid"
]
}
9 changes: 7 additions & 2 deletions src/components/SendTransaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ export const SendTransaction: FC = () => {

signature = await sendTransaction(transaction, connection);

await connection.confirmTransaction(signature, 'confirmed');
console.log(signature);
const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
await connection.confirmTransaction({
blockhash,
lastValidBlockHeight,
signature
});
console.log('Transaction Signature:', signature);
notify({ type: 'success', message: 'Transaction successful!', txid: signature });
} catch (error: any) {
notify({ type: 'error', message: `Transaction failed!`, description: error?.message, txid: signature });
Expand Down