SystemInstruction.createAccount constructor
SystemInstruction.createAccount({
- required Ed25519HDPublicKey fundingAccount,
- required Ed25519HDPublicKey newAccount,
- required int lamports,
- required int space,
- required Ed25519HDPublicKey owner,
Create a new account.
Number or lamports
will be transferred from fundingAccount
to
newAccount
, and amount of space
in bytes will be allocated.
owner
is the address of program that will own the newAccount
.
Implementation
factory SystemInstruction.createAccount({
required Ed25519HDPublicKey fundingAccount,
required Ed25519HDPublicKey newAccount,
required int lamports,
required int space,
required Ed25519HDPublicKey owner,
}) =>
SystemInstruction._(
accounts: [
AccountMeta.writeable(pubKey: fundingAccount, isSigner: true),
AccountMeta.writeable(pubKey: newAccount, isSigner: true),
],
data: ByteArray.merge([
SystemProgram.createAccountInstructionIndex,
ByteArray.u64(lamports),
ByteArray.u64(space),
owner.toByteArray(),
]),
);