nonceInitialize static method

TransactionInstruction nonceInitialize({
  1. required Pubkey noncePubkey,
  2. required Pubkey authorizedPubkey,
})

Generates an instruction to initialize a Nonce account.

Keys:

  • [w] noncePubkey The nonce account.

Data:

  • authorizedPubkey The public key of the nonce authority.

Implementation

static TransactionInstruction nonceInitialize({
  required final Pubkey noncePubkey,
  required final Pubkey authorizedPubkey,
}) {
  final List<AccountMeta> keys = [
    AccountMeta.writable(noncePubkey),
    AccountMeta(sysvarRecentBlockhashesPubkey),
    AccountMeta(sysvarRentPubkey),
  ];

  final List<Iterable<int>> data = [
    borsh.pubkey.encode(authorizedPubkey.toBase58()),
  ];

  return _instance.createTransactionIntruction(
    SystemInstruction.initializeNonceAccount,
    keys: keys,
    data: data,
  );
}