allocate static method

TransactionInstruction allocate({
  1. required Pubkey accountPubkey,
  2. required bu64 space,
})

Generates a transaction instruction that allocates space in an account without funding.

Keys:

  • [s, w] accountPubkey The public key of the account which will be assigned a new owner.

Data:

  • space The amount of space in bytes to allocate.

Implementation

static TransactionInstruction allocate({
  required final Pubkey accountPubkey,
  required final bu64 space,
}) {
  final List<AccountMeta> keys = [
    AccountMeta.signerAndWritable(accountPubkey),
  ];

  final List<Iterable<int>> data = [
    borsh.u64.encode(space),
  ];

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