apply3.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. "use strict";
  2. var __assign =
  3. (this && this.__assign) ||
  4. function () {
  5. __assign =
  6. Object.assign ||
  7. function (t) {
  8. for (var s, i = 1, n = arguments.length; i < n; i++) {
  9. s = arguments[i];
  10. for (var p in s)
  11. if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  12. }
  13. return t;
  14. };
  15. return __assign.apply(this, arguments);
  16. };
  17. var __createBinding =
  18. (this && this.__createBinding) ||
  19. (Object.create
  20. ? function (o, m, k, k2) {
  21. if (k2 === undefined) k2 = k;
  22. var desc = Object.getOwnPropertyDescriptor(m, k);
  23. if (
  24. !desc ||
  25. ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
  26. ) {
  27. desc = {
  28. enumerable: true,
  29. get: function () {
  30. return m[k];
  31. },
  32. };
  33. }
  34. Object.defineProperty(o, k2, desc);
  35. }
  36. : function (o, m, k, k2) {
  37. if (k2 === undefined) k2 = k;
  38. o[k2] = m[k];
  39. });
  40. var __setModuleDefault =
  41. (this && this.__setModuleDefault) ||
  42. (Object.create
  43. ? function (o, v) {
  44. Object.defineProperty(o, "default", { enumerable: true, value: v });
  45. }
  46. : function (o, v) {
  47. o["default"] = v;
  48. });
  49. var __importStar =
  50. (this && this.__importStar) ||
  51. function (mod) {
  52. if (mod && mod.__esModule) return mod;
  53. var result = {};
  54. if (mod != null)
  55. for (var k in mod)
  56. if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
  57. __createBinding(result, mod, k);
  58. __setModuleDefault(result, mod);
  59. return result;
  60. };
  61. Object.defineProperty(exports, "__esModule", { value: true });
  62. exports.createApply3Instruction =
  63. exports.apply3InstructionDiscriminator =
  64. exports.apply3Struct =
  65. void 0;
  66. var beet = __importStar(require("@metaplex-foundation/beet"));
  67. var web3 = __importStar(require("@solana/web3.js"));
  68. var index_1 = require("../index");
  69. exports.apply3Struct = new beet.FixableBeetArgsStruct(
  70. [
  71. ["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)],
  72. ["args", beet.bytes],
  73. ],
  74. "Apply3InstructionArgs"
  75. );
  76. exports.apply3InstructionDiscriminator = [254, 146, 49, 7, 236, 131, 105, 221];
  77. function createApply3Instruction(accounts, args, programId) {
  78. var _a, _b;
  79. if (programId === void 0) {
  80. programId = new web3.PublicKey(
  81. "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
  82. );
  83. }
  84. var data = exports.apply3Struct.serialize(
  85. __assign(
  86. { instructionDiscriminator: exports.apply3InstructionDiscriminator },
  87. args
  88. )
  89. )[0];
  90. var keys = [
  91. {
  92. pubkey: accounts.boltSystem,
  93. isWritable: false,
  94. isSigner: false,
  95. },
  96. {
  97. pubkey: accounts.componentProgram1,
  98. isWritable: false,
  99. isSigner: false,
  100. },
  101. {
  102. pubkey: accounts.boltComponent1,
  103. isWritable: true,
  104. isSigner: false,
  105. },
  106. {
  107. pubkey: accounts.componentProgram2,
  108. isWritable: false,
  109. isSigner: false,
  110. },
  111. {
  112. pubkey: accounts.boltComponent2,
  113. isWritable: true,
  114. isSigner: false,
  115. },
  116. {
  117. pubkey: accounts.componentProgram3,
  118. isWritable: false,
  119. isSigner: false,
  120. },
  121. {
  122. pubkey: accounts.boltComponent3,
  123. isWritable: true,
  124. isSigner: false,
  125. },
  126. {
  127. pubkey:
  128. (_a = accounts.authority) !== null && _a !== void 0 ? _a : programId,
  129. isWritable: false,
  130. isSigner: false,
  131. },
  132. {
  133. pubkey:
  134. (_b = accounts.instructionSysvarAccount) !== null && _b !== void 0
  135. ? _b
  136. : index_1.SYSVAR_INSTRUCTIONS_PUBKEY,
  137. isWritable: false,
  138. isSigner: false,
  139. },
  140. ];
  141. if (accounts.anchorRemainingAccounts != null) {
  142. for (
  143. var _i = 0, _c = accounts.anchorRemainingAccounts;
  144. _i < _c.length;
  145. _i++
  146. ) {
  147. var acc = _c[_i];
  148. keys.push(acc);
  149. }
  150. }
  151. var ix = new web3.TransactionInstruction({
  152. programId: programId,
  153. keys: keys,
  154. data: data,
  155. });
  156. return ix;
  157. }
  158. exports.createApply3Instruction = createApply3Instruction;
  159. //# sourceMappingURL=apply3.js.map