transferWithSeed static method
Generates a transaction instruction that transfers lamports from one account to another.
Keys:
fromPubkey
The account that will transfer lamports.basePubkey
The base public key used to derive the funding account address.toPubkey
The account that will receive the transferred lamports.
Data:
lamports
The amount of lamports to transfer.seed
The seed used to derive the funding account address.programId
The program id used to derive the funding account address.
Implementation
static TransactionInstruction transferWithSeed({
required final Pubkey fromPubkey,
required final Pubkey basePubkey,
required final Pubkey toPubkey,
required final BigInt lamports,
required final String seed,
required final Pubkey programId,
}) {
final List<AccountMeta> keys = [
AccountMeta.writable(fromPubkey),
AccountMeta.signer(basePubkey),
AccountMeta.writable(toPubkey),
];
final List<Iterable<int>> data = [
borsh.u64.encode(lamports),
borsh.rustString().encode(seed),
borsh.pubkey.encode(programId.toBase58()),
];
return _instance.createTransactionIntruction(
SystemInstruction.transferWithSeed,
keys: keys,
data: data,
);
}