transfer static method
Generates a transaction instruction that transfers lamports from one account to another.
Keys:
fromPubkey
The account that will transfer lamports.toPubkey
The account that will receive transferred lamports.
Data:
lamports
The amount of lamports to transfer.
Implementation
static TransactionInstruction transfer({
required final Pubkey fromPubkey,
required final Pubkey toPubkey,
required final BigInt lamports,
}) {
final List<AccountMeta> keys = [
AccountMeta.signerAndWritable(fromPubkey),
AccountMeta.writable(toPubkey),
];
final List<Iterable<int>> data = [
borsh.u64.encode(lamports),
];
return _instance.createTransactionIntruction(
SystemInstruction.transfer,
keys: keys,
data: data,
);
}