assignWithSeed static method
Generates a transaction instruction that assigns an account to a program.
Keys:
accountPubkeyThe public key of the account which will be assigned a new owner.
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.programIdThe public key of the program to assign as the owner.
Implementation
static TransactionInstruction assignWithSeed({
required final Pubkey accountPubkey,
required final Pubkey basePubkey,
required final String seed,
required final Pubkey programId,
}) {
final List<AccountMeta> keys = [
AccountMeta.writable(accountPubkey),
AccountMeta.signer(basePubkey),
];
final List<Iterable<int>> data = [
borsh.pubkey.encode(basePubkey.toBase58()),
borsh.rustString().encode(seed),
borsh.pubkey.encode(programId.toBase58()),
];
return _instance.createTransactionIntruction(
SystemInstruction.assignWithSeed,
keys: keys,
data: data,
);
}