initializeComponent.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. "use strict";
  2. var __createBinding =
  3. (this && this.__createBinding) ||
  4. (Object.create
  5. ? function (o, m, k, k2) {
  6. if (k2 === undefined) k2 = k;
  7. var desc = Object.getOwnPropertyDescriptor(m, k);
  8. if (
  9. !desc ||
  10. ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
  11. ) {
  12. desc = {
  13. enumerable: true,
  14. get: function () {
  15. return m[k];
  16. },
  17. };
  18. }
  19. Object.defineProperty(o, k2, desc);
  20. }
  21. : function (o, m, k, k2) {
  22. if (k2 === undefined) k2 = k;
  23. o[k2] = m[k];
  24. });
  25. var __setModuleDefault =
  26. (this && this.__setModuleDefault) ||
  27. (Object.create
  28. ? function (o, v) {
  29. Object.defineProperty(o, "default", { enumerable: true, value: v });
  30. }
  31. : function (o, v) {
  32. o["default"] = v;
  33. });
  34. var __importStar =
  35. (this && this.__importStar) ||
  36. function (mod) {
  37. if (mod && mod.__esModule) return mod;
  38. var result = {};
  39. if (mod != null)
  40. for (var k in mod)
  41. if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
  42. __createBinding(result, mod, k);
  43. __setModuleDefault(result, mod);
  44. return result;
  45. };
  46. Object.defineProperty(exports, "__esModule", { value: true });
  47. exports.createInitializeComponentInstruction =
  48. exports.initializeComponentInstructionDiscriminator =
  49. exports.initializeComponentStruct =
  50. void 0;
  51. var beet = __importStar(require("@metaplex-foundation/beet"));
  52. var web3 = __importStar(require("@solana/web3.js"));
  53. var index_1 = require("../index");
  54. exports.initializeComponentStruct = new beet.BeetArgsStruct(
  55. [["instructionDiscriminator", beet.uniformFixedSizeArray(beet.u8, 8)]],
  56. "InitializeComponentInstructionArgs"
  57. );
  58. exports.initializeComponentInstructionDiscriminator = [
  59. 36, 143, 233, 113, 12, 234, 61, 30,
  60. ];
  61. function createInitializeComponentInstruction(accounts, programId) {
  62. var _a, _b, _c;
  63. if (programId === void 0) {
  64. programId = new web3.PublicKey(
  65. "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
  66. );
  67. }
  68. var data = exports.initializeComponentStruct.serialize({
  69. instructionDiscriminator:
  70. exports.initializeComponentInstructionDiscriminator,
  71. })[0];
  72. var keys = [
  73. {
  74. pubkey: accounts.payer,
  75. isWritable: true,
  76. isSigner: true,
  77. },
  78. {
  79. pubkey: accounts.data,
  80. isWritable: true,
  81. isSigner: false,
  82. },
  83. {
  84. pubkey: accounts.entity,
  85. isWritable: false,
  86. isSigner: false,
  87. },
  88. {
  89. pubkey: accounts.componentProgram,
  90. isWritable: false,
  91. isSigner: false,
  92. },
  93. {
  94. pubkey:
  95. (_a = accounts.authority) !== null && _a !== void 0 ? _a : programId,
  96. isWritable: false,
  97. isSigner: false,
  98. },
  99. {
  100. pubkey:
  101. (_b = accounts.instructionSysvarAccount) !== null && _b !== void 0
  102. ? _b
  103. : index_1.SYSVAR_INSTRUCTIONS_PUBKEY,
  104. isWritable: false,
  105. isSigner: false,
  106. },
  107. {
  108. pubkey:
  109. (_c = accounts.systemProgram) !== null && _c !== void 0
  110. ? _c
  111. : web3.SystemProgram.programId,
  112. isWritable: false,
  113. isSigner: false,
  114. },
  115. ];
  116. if (accounts.anchorRemainingAccounts != null) {
  117. for (
  118. var _i = 0, _d = accounts.anchorRemainingAccounts;
  119. _i < _d.length;
  120. _i++
  121. ) {
  122. var acc = _d[_i];
  123. keys.push(acc);
  124. }
  125. }
  126. var ix = new web3.TransactionInstruction({
  127. programId: programId,
  128. keys: keys,
  129. data: data,
  130. });
  131. return ix;
  132. }
  133. exports.createInitializeComponentInstruction =
  134. createInitializeComponentInstruction;
  135. //# sourceMappingURL=initializeComponent.js.map