nonceWithdraw static method
Generates a transaction instruction that withdraws lamports from a Nonce account.
Keys:
[w]noncePubkeyThe nonce account.[s]authorizedPubkeyThe public key of the nonce authority.[w]toPubkeyThe public key of the account which will receive the withdrawn nonce account balance.
Data:
lamportsThe mount of lamports to withdraw from the nonce account.
Implementation
static TransactionInstruction nonceWithdraw({
  required final Pubkey noncePubkey,
  required final Pubkey authorizedPubkey,
  required final Pubkey toPubkey,
  required final bu64 lamports,
}) {
  final List<AccountMeta> keys = [
    AccountMeta.writable(noncePubkey),
    AccountMeta.writable(toPubkey),
    AccountMeta(sysvarRecentBlockhashesPubkey),
    AccountMeta(sysvarRentPubkey),
    AccountMeta.signer(authorizedPubkey),
  ];
  final List<Iterable<int>> data = [borsh.u64.encode(lamports)];
  return _instance.createTransactionIntruction(
    SystemInstruction.withdrawNonceAccount,
    keys: keys,
    data: data,
  );
}