Increment.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * This code was GENERATED using the solita package.
  3. * Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
  4. *
  5. * See: https://github.com/metaplex-foundation/solita
  6. */
  7. import * as beet from '@metaplex-foundation/beet';
  8. import * as web3 from '@solana/web3.js';
  9. /**
  10. * @category Instructions
  11. * @category Increment
  12. * @category generated
  13. */
  14. export const IncrementStruct = new beet.BeetArgsStruct<{
  15. instructionDiscriminator: number;
  16. }>([['instructionDiscriminator', beet.u8]], 'IncrementInstructionArgs');
  17. /**
  18. * Accounts required by the _Increment_ instruction
  19. *
  20. * @property [_writable_] counter Counter account to increment
  21. * @category Instructions
  22. * @category Increment
  23. * @category generated
  24. */
  25. export type IncrementInstructionAccounts = {
  26. counter: web3.PublicKey;
  27. };
  28. export const incrementInstructionDiscriminator = 0;
  29. /**
  30. * Creates a _Increment_ instruction.
  31. *
  32. * @param accounts that will be accessed while the instruction is processed
  33. * @category Instructions
  34. * @category Increment
  35. * @category generated
  36. */
  37. export function createIncrementInstruction(
  38. accounts: IncrementInstructionAccounts,
  39. programId = new web3.PublicKey('Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS'),
  40. ) {
  41. const [data] = IncrementStruct.serialize({
  42. instructionDiscriminator: incrementInstructionDiscriminator,
  43. });
  44. const keys: web3.AccountMeta[] = [
  45. {
  46. pubkey: accounts.counter,
  47. isWritable: true,
  48. isSigner: false,
  49. },
  50. ];
  51. const ix = new web3.TransactionInstruction({
  52. programId,
  53. keys,
  54. data,
  55. });
  56. return ix;
  57. }