TypeScript SDK

// Define constants
const NOZOMI_TIP = new PublicKey("TEMPaMeCRFAS9EKF53Jd6KpHxgL47uWLcpFArU1Fanq");
const MIN_TIP_AMOUNT = 1_000_000;

async function sendNozomiTx(
  ixs: TransactionInstruction[],
  signer: Keypair,
  rpcClient: Connection
): Promise<void> {
  // Create transfer instruction
  const tipIx = SystemProgram.transfer({
    fromPubkey: signer.publicKey,
    toPubkey: NOZOMI_TIP,
    lamports: MIN_TIP_AMOUNT,
  });
  ixs.push(tipIx);

  // Get the latest blockhash
  const { blockhash } = await rpcClient.getLatestBlockhash();

  // Create transaction and sign it
  const tx = new Transaction().add(...ixs);
  tx.recentBlockhash = blockhash;
  tx.feePayer = signer.publicKey;
  tx.sign(signer);

  // Send the transaction
  const signature = await rpcClient.sendTransaction(tx, [signer]);
  console.log("Transaction sent with signature:", signature);
}

Last updated