allocateWithSeed static method
Generates a transaction instruction that allocates space in an account without funding.
Keys:
[w]accountPubkeyThe public key of the account which will be assigned a new owner.[s]basePubkeyThe base public key used to derive the address of the assigned account.
Data:
basePubkeyThe base public key used to derive the address of the assigned account.seedThe seed used to derive the address of the assigned account.spaceThe amount of space in bytes to allocate.programIdThe public key of the program to assign as the owner.
Implementation
static TransactionInstruction allocateWithSeed({
required final Pubkey accountPubkey,
required final Pubkey basePubkey,
required final String seed,
required final bu64 space,
required final Pubkey programId,
}) {
final List<AccountMeta> keys = [
AccountMeta.writable(accountPubkey),
AccountMeta.signer(basePubkey),
];
final BorshStringSizedCodec pubkey = borsh.pubkey;
final List<Iterable<int>> data = [
pubkey.encode(basePubkey.toBase58()),
borsh.rustString().encode(seed),
borsh.u64.encode(space),
pubkey.encode(programId.toBase58()),
];
return _instance.createTransactionIntruction(
SystemInstruction.allocateWithSeed,
keys: keys,
data: data,
);
}