apply2.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 Apply2
  12. * @category generated
  13. */
  14. export interface Apply2InstructionArgs {
  15. args: Uint8Array;
  16. }
  17. /**
  18. * @category Instructions
  19. * @category Apply2
  20. * @category generated
  21. */
  22. export const apply2Struct = new beet.FixableBeetArgsStruct<
  23. Apply2InstructionArgs & {
  24. instructionDiscriminator: number[] /* size: 8 */;
  25. }
  26. >(
  27. [
  28. ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)],
  29. ["args", beet.bytes],
  30. ],
  31. "Apply2InstructionArgs"
  32. );
  33. /**
  34. * Accounts required by the _apply2_ instruction
  35. *
  36. * @property [] boltSystem
  37. * @property [] componentProgram1
  38. * @property [_writable_] boltComponent1
  39. * @property [] componentProgram2
  40. * @property [_writable_] boltComponent2
  41. * @property [] authority
  42. * @property [] instructionSysvarAccount
  43. * @category Instructions
  44. * @category Apply2
  45. * @category generated
  46. */
  47. export interface Apply2InstructionAccounts {
  48. boltSystem: web3.PublicKey;
  49. componentProgram1: web3.PublicKey;
  50. boltComponent1: web3.PublicKey;
  51. componentProgram2: web3.PublicKey;
  52. boltComponent2: web3.PublicKey;
  53. authority: web3.PublicKey;
  54. instructionSysvarAccount: web3.PublicKey;
  55. anchorRemainingAccounts?: web3.AccountMeta[];
  56. }
  57. export const apply2InstructionDiscriminator = [
  58. 120, 32, 116, 154, 158, 159, 208, 73,
  59. ];
  60. /**
  61. * Creates a _Apply2_ instruction.
  62. *
  63. * @param accounts that will be accessed while the instruction is processed
  64. * @param args to provide as instruction data to the program
  65. *
  66. * @category Instructions
  67. * @category Apply2
  68. * @category generated
  69. */
  70. export function createApply2Instruction(
  71. accounts: Apply2InstructionAccounts,
  72. args: Apply2InstructionArgs,
  73. programId = new web3.PublicKey("WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n")
  74. ) {
  75. const [data] = apply2Struct.serialize({
  76. instructionDiscriminator: apply2InstructionDiscriminator,
  77. ...args,
  78. });
  79. const keys: web3.AccountMeta[] = [
  80. {
  81. pubkey: accounts.boltSystem,
  82. isWritable: false,
  83. isSigner: false,
  84. },
  85. {
  86. pubkey: accounts.componentProgram1,
  87. isWritable: false,
  88. isSigner: false,
  89. },
  90. {
  91. pubkey: accounts.boltComponent1,
  92. isWritable: true,
  93. isSigner: false,
  94. },
  95. {
  96. pubkey: accounts.componentProgram2,
  97. isWritable: false,
  98. isSigner: false,
  99. },
  100. {
  101. pubkey: accounts.boltComponent2,
  102. isWritable: true,
  103. isSigner: false,
  104. },
  105. {
  106. pubkey: accounts.authority,
  107. isWritable: false,
  108. isSigner: false,
  109. },
  110. {
  111. pubkey: accounts.instructionSysvarAccount,
  112. isWritable: false,
  113. isSigner: false,
  114. },
  115. ];
  116. if (accounts.anchorRemainingAccounts != null) {
  117. for (const acc of accounts.anchorRemainingAccounts) {
  118. keys.push(acc);
  119. }
  120. }
  121. const ix = new web3.TransactionInstruction({
  122. programId,
  123. keys,
  124. data,
  125. });
  126. return ix;
  127. }