SystemInstruction.assignWithSeed constructor

SystemInstruction.assignWithSeed({
  1. required Ed25519HDPublicKey account,
  2. required Ed25519HDPublicKey base,
  3. required String seed,
  4. required Ed25519HDPublicKey owner,
})

Assign account to a program based on a seed.

Implementation

factory SystemInstruction.assignWithSeed({
  required Ed25519HDPublicKey account,
  required Ed25519HDPublicKey base,
  required String seed,
  required Ed25519HDPublicKey owner,
}) =>
    SystemInstruction._(
      accounts: [
        AccountMeta.writeable(pubKey: account, isSigner: false),
        AccountMeta.readonly(pubKey: base, isSigner: true),
      ],
      data: ByteArray.merge([
        SystemProgram.assignWithSeedInstructionIndex,
        base.toByteArray(),
        ByteArray.fromString(seed),
        owner.toByteArray(),
      ]),
    );