SystemProgram.createAccount constructor

SystemProgram.createAccount({
  1. required SolAddress from,
  2. required SolAddress newAccountPubKey,
  3. required SystemCreateLayout layout,
})

Create account system transaction

Implementation

factory SystemProgram.createAccount({
  /// The account that will transfer lamports to the created account
  required SolAddress from,

  /// address of the created account
  required SolAddress newAccountPubKey,
  required SystemCreateLayout layout,
}) {
  return SystemProgram(
      layout: layout,
      keys: [
        from.toSignerAndWritable(),
        newAccountPubKey.toSignerAndWritable()
      ],
      programId: SystemProgramConst.programId);
}