Skip to content

Instantly share code, notes, and snippets.

import {Connection, Transaction} from '@solana/web3.js';
export async function addBlockhash(
connection: Connection,
transaction: Transaction
): Promise<void> {
for (let i = 0; i < 5; i++) {
try {
transaction.recentBlockhash = await getBlockhash(connection);
break;