compileLegacy static method

Message compileLegacy({
  1. required List<TransactionInstruction> transactionInstructions,
  2. required SolAddress payer,
  3. required SolAddress recentBlockhash,
})

compile instructions to legacy message

Implementation

static Message compileLegacy({
  required List<TransactionInstruction> transactionInstructions,
  required SolAddress payer,
  required SolAddress recentBlockhash,
}) {
  final compiledKeys = CompiledKeys.compile(transactionInstructions, payer);
  final componets = compiledKeys.getMessageComponents();
  final header = componets.item1;
  final staticAccountKeys = componets.item2;
  final accountKeys = MessageAccountKeys(staticAccountKeys, null);
  final instructions =
      accountKeys.compileInstructions(transactionInstructions).map((ix) {
    return CompiledInstruction(
        programIdIndex: ix.programIdIndex,
        accounts: ix.accounts,
        data: ix.data);
  }).toList();
  return Message(
    header: header,
    accountKeys: staticAccountKeys,
    recentBlockhash: recentBlockhash,
    compiledInstructions: instructions,
  );
}