createNonceAccount static method

List<TransactionInstruction> createNonceAccount({
  1. required Pubkey fromPubkey,
  2. required Pubkey noncePubkey,
  3. required Pubkey authorizedPubkey,
  4. required bu64 lamports,
})

Generates a transaction that creates a new Nonce account.

Keys:

  • [s, w] fromPubkey The account that will transfer lamports to the created nonce account.
  • [s, w] noncePubkey The public key of the created nonce account.
  • [] authorizedPubkey The public key to set as the authority of the created nonce account.

Data:

  • lamports The amount of lamports to transfer to the created nonce account.

Implementation

static List<TransactionInstruction> createNonceAccount({
  required final Pubkey fromPubkey,
  required final Pubkey noncePubkey,
  required final Pubkey authorizedPubkey,
  required final bu64 lamports,
}) =>
    [
      SystemProgram.createAccount(
        fromPubkey: fromPubkey,
        newAccountPubkey: noncePubkey,
        lamports: lamports,
        space: NonceAccount.length.toBigInt(),
        programId: SystemProgram.programId,
      ),
      nonceInitialize(
        noncePubkey: noncePubkey,
        authorizedPubkey: authorizedPubkey,
      ),
    ];