import { PublicKey, clusterApiUrl, Connection, Keypair, TransactionInstruction, Transaction, } from "@solana/web3.js"; const key = [ 190, 193, 120, 250, 149, 178, 94, 52, 206, 110, 89, 151, 89, 109, 26, 49, 186, 112, 209, 9, 158, 240, 185, 6, 106, 26, 47, 222, 57, 110, 24, 236, 71, 78, 122, 183, 125, 16, 86, 144, 130, 239, 169, 17, 208, 51, 63, 228, 133, 110, 28, 58, 26, 7, 214, 63, 70, 95, 8, 131, 251, 143, 119, 143, ]; export const WALLET = Keypair.fromSecretKey(Uint8Array.from(key)); export const CONNECTION = new Connection("http://127.0.0.1:8899"); export const PROGRAM = new PublicKey( "5irNH31oGrTJjbj33r9Df3uLUzwsp1EWxRbcZBJ31Bif" ); export async function transaction(tx, connection, wallet) { const ix = new Transaction().add(tx); ix.recentBlockhash = (await connection.getLatestBlockhash()).blockhash; ix.feePayer = wallet.publicKey; ix.sign(wallet); const sign = await connection.sendRawTransaction(ix.serialize()); await connection.confirmTransaction(sign, "confirmed"); return sign; }