/**
 * This code was GENERATED using the solita package.
 * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
 *
 * See: https://github.com/metaplex-foundation/solita
 */

import * as beet from '@metaplex-foundation/beet';
import * as web3 from '@solana/web3.js';

/**
 * @category Instructions
 * @category Increment
 * @category generated
 */
export const IncrementStruct = new beet.BeetArgsStruct<{
  instructionDiscriminator: number;
}>([['instructionDiscriminator', beet.u8]], 'IncrementInstructionArgs');
/**
 * Accounts required by the _Increment_ instruction
 *
 * @property [_writable_] counter Counter account to increment
 * @category Instructions
 * @category Increment
 * @category generated
 */
export type IncrementInstructionAccounts = {
  counter: web3.PublicKey;
};

export const incrementInstructionDiscriminator = 0;

/**
 * Creates a _Increment_ instruction.
 *
 * @param accounts that will be accessed while the instruction is processed
 * @category Instructions
 * @category Increment
 * @category generated
 */
export function createIncrementInstruction(
  accounts: IncrementInstructionAccounts,
  programId = new web3.PublicKey('Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS'),
) {
  const [data] = IncrementStruct.serialize({
    instructionDiscriminator: incrementInstructionDiscriminator,
  });
  const keys: web3.AccountMeta[] = [
    {
      pubkey: accounts.counter,
      isWritable: true,
      isSigner: false,
    },
  ];

  const ix = new web3.TransactionInstruction({
    programId,
    keys,
    data,
  });
  return ix;
}
