Skip to content

Instantly share code, notes, and snippets.

export async function sendTransaction(
connection: Connection,
wallet: any,
transaction: Transaction,
signers: Array<Account> = []
) {
transaction.recentBlockhash = (await connection.getRecentBlockhash(commitment)).blockhash
transaction.setSigners(wallet.publicKey, ...signers.map((s) => s.publicKey))
if (signers.length > 0) {
transaction.partialSign(...signers)