@solana-program/compute-budget 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,71 @@
1
1
  'use strict';
2
2
 
3
- var codecs = require('@solana/codecs');
4
- var addresses = require('@solana/addresses');
5
- var instructions = require('@solana/instructions');
6
- var signers = require('@solana/signers');
3
+ var web3_js = require('@solana/web3.js');
4
+
5
+ // src/generated/instructions/requestHeapFrame.ts
6
+ var COMPUTE_BUDGET_PROGRAM_ADDRESS = "ComputeBudget111111111111111111111111111111";
7
+ var ComputeBudgetInstruction = /* @__PURE__ */ ((ComputeBudgetInstruction2) => {
8
+ ComputeBudgetInstruction2[ComputeBudgetInstruction2["RequestUnits"] = 0] = "RequestUnits";
9
+ ComputeBudgetInstruction2[ComputeBudgetInstruction2["RequestHeapFrame"] = 1] = "RequestHeapFrame";
10
+ ComputeBudgetInstruction2[ComputeBudgetInstruction2["SetComputeUnitLimit"] = 2] = "SetComputeUnitLimit";
11
+ ComputeBudgetInstruction2[ComputeBudgetInstruction2["SetComputeUnitPrice"] = 3] = "SetComputeUnitPrice";
12
+ ComputeBudgetInstruction2[ComputeBudgetInstruction2["SetLoadedAccountsDataSizeLimit"] = 4] = "SetLoadedAccountsDataSizeLimit";
13
+ return ComputeBudgetInstruction2;
14
+ })(ComputeBudgetInstruction || {});
15
+ function identifyComputeBudgetInstruction(instruction) {
16
+ const data = instruction instanceof Uint8Array ? instruction : instruction.data;
17
+ if (web3_js.containsBytes(data, web3_js.getU8Encoder().encode(0), 0)) {
18
+ return 0 /* RequestUnits */;
19
+ }
20
+ if (web3_js.containsBytes(data, web3_js.getU8Encoder().encode(1), 0)) {
21
+ return 1 /* RequestHeapFrame */;
22
+ }
23
+ if (web3_js.containsBytes(data, web3_js.getU8Encoder().encode(2), 0)) {
24
+ return 2 /* SetComputeUnitLimit */;
25
+ }
26
+ if (web3_js.containsBytes(data, web3_js.getU8Encoder().encode(3), 0)) {
27
+ return 3 /* SetComputeUnitPrice */;
28
+ }
29
+ if (web3_js.containsBytes(data, web3_js.getU8Encoder().encode(4), 0)) {
30
+ return 4 /* SetLoadedAccountsDataSizeLimit */;
31
+ }
32
+ throw new Error(
33
+ "The provided instruction could not be identified as a computeBudget instruction."
34
+ );
35
+ }
7
36
 
8
37
  // src/generated/instructions/requestHeapFrame.ts
9
38
  function getRequestHeapFrameInstructionDataEncoder() {
10
- return codecs.mapEncoder(
11
- codecs.getStructEncoder([
12
- ["discriminator", codecs.getU8Encoder()],
13
- ["bytes", codecs.getU32Encoder()]
39
+ return web3_js.transformEncoder(
40
+ web3_js.getStructEncoder([
41
+ ["discriminator", web3_js.getU8Encoder()],
42
+ ["bytes", web3_js.getU32Encoder()]
14
43
  ]),
15
44
  (value) => ({ ...value, discriminator: 1 })
16
45
  );
17
46
  }
18
47
  function getRequestHeapFrameInstructionDataDecoder() {
19
- return codecs.getStructDecoder([
20
- ["discriminator", codecs.getU8Decoder()],
21
- ["bytes", codecs.getU32Decoder()]
48
+ return web3_js.getStructDecoder([
49
+ ["discriminator", web3_js.getU8Decoder()],
50
+ ["bytes", web3_js.getU32Decoder()]
22
51
  ]);
23
52
  }
24
53
  function getRequestHeapFrameInstructionDataCodec() {
25
- return codecs.combineCodec(
54
+ return web3_js.combineCodec(
26
55
  getRequestHeapFrameInstructionDataEncoder(),
27
56
  getRequestHeapFrameInstructionDataDecoder()
28
57
  );
29
58
  }
30
59
  function getRequestHeapFrameInstruction(input) {
31
- const programAddress = "ComputeBudget111111111111111111111111111111";
60
+ const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;
32
61
  const args = { ...input };
33
- const instruction = getRequestHeapFrameInstructionRaw(
34
- args,
35
- programAddress
36
- );
37
- return instruction;
38
- }
39
- function getRequestHeapFrameInstructionRaw(args, programAddress = "ComputeBudget111111111111111111111111111111", remainingAccounts) {
40
- return {
41
- accounts: remainingAccounts ?? [],
42
- data: getRequestHeapFrameInstructionDataEncoder().encode(args),
43
- programAddress
62
+ const instruction = {
63
+ programAddress,
64
+ data: getRequestHeapFrameInstructionDataEncoder().encode(
65
+ args
66
+ )
44
67
  };
68
+ return instruction;
45
69
  }
46
70
  function parseRequestHeapFrameInstruction(instruction) {
47
71
  return {
@@ -50,43 +74,38 @@ function parseRequestHeapFrameInstruction(instruction) {
50
74
  };
51
75
  }
52
76
  function getRequestUnitsInstructionDataEncoder() {
53
- return codecs.mapEncoder(
54
- codecs.getStructEncoder([
55
- ["discriminator", codecs.getU8Encoder()],
56
- ["units", codecs.getU32Encoder()],
57
- ["additionalFee", codecs.getU32Encoder()]
77
+ return web3_js.transformEncoder(
78
+ web3_js.getStructEncoder([
79
+ ["discriminator", web3_js.getU8Encoder()],
80
+ ["units", web3_js.getU32Encoder()],
81
+ ["additionalFee", web3_js.getU32Encoder()]
58
82
  ]),
59
83
  (value) => ({ ...value, discriminator: 0 })
60
84
  );
61
85
  }
62
86
  function getRequestUnitsInstructionDataDecoder() {
63
- return codecs.getStructDecoder([
64
- ["discriminator", codecs.getU8Decoder()],
65
- ["units", codecs.getU32Decoder()],
66
- ["additionalFee", codecs.getU32Decoder()]
87
+ return web3_js.getStructDecoder([
88
+ ["discriminator", web3_js.getU8Decoder()],
89
+ ["units", web3_js.getU32Decoder()],
90
+ ["additionalFee", web3_js.getU32Decoder()]
67
91
  ]);
68
92
  }
69
93
  function getRequestUnitsInstructionDataCodec() {
70
- return codecs.combineCodec(
94
+ return web3_js.combineCodec(
71
95
  getRequestUnitsInstructionDataEncoder(),
72
96
  getRequestUnitsInstructionDataDecoder()
73
97
  );
74
98
  }
75
99
  function getRequestUnitsInstruction(input) {
76
- const programAddress = "ComputeBudget111111111111111111111111111111";
100
+ const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;
77
101
  const args = { ...input };
78
- const instruction = getRequestUnitsInstructionRaw(
79
- args,
80
- programAddress
81
- );
82
- return instruction;
83
- }
84
- function getRequestUnitsInstructionRaw(args, programAddress = "ComputeBudget111111111111111111111111111111", remainingAccounts) {
85
- return {
86
- accounts: remainingAccounts ?? [],
87
- data: getRequestUnitsInstructionDataEncoder().encode(args),
88
- programAddress
102
+ const instruction = {
103
+ programAddress,
104
+ data: getRequestUnitsInstructionDataEncoder().encode(
105
+ args
106
+ )
89
107
  };
108
+ return instruction;
90
109
  }
91
110
  function parseRequestUnitsInstruction(instruction) {
92
111
  return {
@@ -95,41 +114,36 @@ function parseRequestUnitsInstruction(instruction) {
95
114
  };
96
115
  }
97
116
  function getSetComputeUnitLimitInstructionDataEncoder() {
98
- return codecs.mapEncoder(
99
- codecs.getStructEncoder([
100
- ["discriminator", codecs.getU8Encoder()],
101
- ["units", codecs.getU32Encoder()]
117
+ return web3_js.transformEncoder(
118
+ web3_js.getStructEncoder([
119
+ ["discriminator", web3_js.getU8Encoder()],
120
+ ["units", web3_js.getU32Encoder()]
102
121
  ]),
103
122
  (value) => ({ ...value, discriminator: 2 })
104
123
  );
105
124
  }
106
125
  function getSetComputeUnitLimitInstructionDataDecoder() {
107
- return codecs.getStructDecoder([
108
- ["discriminator", codecs.getU8Decoder()],
109
- ["units", codecs.getU32Decoder()]
126
+ return web3_js.getStructDecoder([
127
+ ["discriminator", web3_js.getU8Decoder()],
128
+ ["units", web3_js.getU32Decoder()]
110
129
  ]);
111
130
  }
112
131
  function getSetComputeUnitLimitInstructionDataCodec() {
113
- return codecs.combineCodec(
132
+ return web3_js.combineCodec(
114
133
  getSetComputeUnitLimitInstructionDataEncoder(),
115
134
  getSetComputeUnitLimitInstructionDataDecoder()
116
135
  );
117
136
  }
118
137
  function getSetComputeUnitLimitInstruction(input) {
119
- const programAddress = "ComputeBudget111111111111111111111111111111";
138
+ const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;
120
139
  const args = { ...input };
121
- const instruction = getSetComputeUnitLimitInstructionRaw(
122
- args,
123
- programAddress
124
- );
125
- return instruction;
126
- }
127
- function getSetComputeUnitLimitInstructionRaw(args, programAddress = "ComputeBudget111111111111111111111111111111", remainingAccounts) {
128
- return {
129
- accounts: remainingAccounts ?? [],
130
- data: getSetComputeUnitLimitInstructionDataEncoder().encode(args),
131
- programAddress
140
+ const instruction = {
141
+ programAddress,
142
+ data: getSetComputeUnitLimitInstructionDataEncoder().encode(
143
+ args
144
+ )
132
145
  };
146
+ return instruction;
133
147
  }
134
148
  function parseSetComputeUnitLimitInstruction(instruction) {
135
149
  return {
@@ -140,41 +154,36 @@ function parseSetComputeUnitLimitInstruction(instruction) {
140
154
  };
141
155
  }
142
156
  function getSetComputeUnitPriceInstructionDataEncoder() {
143
- return codecs.mapEncoder(
144
- codecs.getStructEncoder([
145
- ["discriminator", codecs.getU8Encoder()],
146
- ["microLamports", codecs.getU64Encoder()]
157
+ return web3_js.transformEncoder(
158
+ web3_js.getStructEncoder([
159
+ ["discriminator", web3_js.getU8Encoder()],
160
+ ["microLamports", web3_js.getU64Encoder()]
147
161
  ]),
148
162
  (value) => ({ ...value, discriminator: 3 })
149
163
  );
150
164
  }
151
165
  function getSetComputeUnitPriceInstructionDataDecoder() {
152
- return codecs.getStructDecoder([
153
- ["discriminator", codecs.getU8Decoder()],
154
- ["microLamports", codecs.getU64Decoder()]
166
+ return web3_js.getStructDecoder([
167
+ ["discriminator", web3_js.getU8Decoder()],
168
+ ["microLamports", web3_js.getU64Decoder()]
155
169
  ]);
156
170
  }
157
171
  function getSetComputeUnitPriceInstructionDataCodec() {
158
- return codecs.combineCodec(
172
+ return web3_js.combineCodec(
159
173
  getSetComputeUnitPriceInstructionDataEncoder(),
160
174
  getSetComputeUnitPriceInstructionDataDecoder()
161
175
  );
162
176
  }
163
177
  function getSetComputeUnitPriceInstruction(input) {
164
- const programAddress = "ComputeBudget111111111111111111111111111111";
178
+ const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;
165
179
  const args = { ...input };
166
- const instruction = getSetComputeUnitPriceInstructionRaw(
167
- args,
168
- programAddress
169
- );
170
- return instruction;
171
- }
172
- function getSetComputeUnitPriceInstructionRaw(args, programAddress = "ComputeBudget111111111111111111111111111111", remainingAccounts) {
173
- return {
174
- accounts: remainingAccounts ?? [],
175
- data: getSetComputeUnitPriceInstructionDataEncoder().encode(args),
176
- programAddress
180
+ const instruction = {
181
+ programAddress,
182
+ data: getSetComputeUnitPriceInstructionDataEncoder().encode(
183
+ args
184
+ )
177
185
  };
186
+ return instruction;
178
187
  }
179
188
  function parseSetComputeUnitPriceInstruction(instruction) {
180
189
  return {
@@ -185,43 +194,36 @@ function parseSetComputeUnitPriceInstruction(instruction) {
185
194
  };
186
195
  }
187
196
  function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder() {
188
- return codecs.mapEncoder(
189
- codecs.getStructEncoder([
190
- ["discriminator", codecs.getU8Encoder()],
191
- ["accountDataSizeLimit", codecs.getU32Encoder()]
197
+ return web3_js.transformEncoder(
198
+ web3_js.getStructEncoder([
199
+ ["discriminator", web3_js.getU8Encoder()],
200
+ ["accountDataSizeLimit", web3_js.getU32Encoder()]
192
201
  ]),
193
202
  (value) => ({ ...value, discriminator: 4 })
194
203
  );
195
204
  }
196
205
  function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder() {
197
- return codecs.getStructDecoder([
198
- ["discriminator", codecs.getU8Decoder()],
199
- ["accountDataSizeLimit", codecs.getU32Decoder()]
206
+ return web3_js.getStructDecoder([
207
+ ["discriminator", web3_js.getU8Decoder()],
208
+ ["accountDataSizeLimit", web3_js.getU32Decoder()]
200
209
  ]);
201
210
  }
202
211
  function getSetLoadedAccountsDataSizeLimitInstructionDataCodec() {
203
- return codecs.combineCodec(
212
+ return web3_js.combineCodec(
204
213
  getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),
205
214
  getSetLoadedAccountsDataSizeLimitInstructionDataDecoder()
206
215
  );
207
216
  }
208
217
  function getSetLoadedAccountsDataSizeLimitInstruction(input) {
209
- const programAddress = "ComputeBudget111111111111111111111111111111";
218
+ const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;
210
219
  const args = { ...input };
211
- const instruction = getSetLoadedAccountsDataSizeLimitInstructionRaw(
212
- args,
213
- programAddress
214
- );
215
- return instruction;
216
- }
217
- function getSetLoadedAccountsDataSizeLimitInstructionRaw(args, programAddress = "ComputeBudget111111111111111111111111111111", remainingAccounts) {
218
- return {
219
- accounts: remainingAccounts ?? [],
220
+ const instruction = {
221
+ programAddress,
220
222
  data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(
221
223
  args
222
- ),
223
- programAddress
224
+ )
224
225
  };
226
+ return instruction;
225
227
  }
226
228
  function parseSetLoadedAccountsDataSizeLimitInstruction(instruction) {
227
229
  return {
@@ -231,148 +233,30 @@ function parseSetLoadedAccountsDataSizeLimitInstruction(instruction) {
231
233
  )
232
234
  };
233
235
  }
234
- function expectSome(value) {
235
- if (value == null) {
236
- throw new Error("Expected a value but received null or undefined.");
237
- }
238
- return value;
239
- }
240
- function expectAddress(value) {
241
- if (!value) {
242
- throw new Error("Expected a Address.");
243
- }
244
- if (typeof value === "object" && "address" in value) {
245
- return value.address;
246
- }
247
- if (Array.isArray(value)) {
248
- return value[0];
249
- }
250
- return value;
251
- }
252
- function expectProgramDerivedAddress(value) {
253
- if (!value || !Array.isArray(value) || !addresses.isProgramDerivedAddress(value)) {
254
- throw new Error("Expected a ProgramDerivedAddress.");
255
- }
256
- return value;
257
- }
258
- function expectTransactionSigner(value) {
259
- if (!value || !isTransactionSigner(value)) {
260
- throw new Error("Expected a TransactionSigner.");
261
- }
262
- return value;
263
- }
264
- function accountMetaWithDefault(account, role) {
265
- if (account === void 0)
266
- return void 0;
267
- return typeof account === "string" ? { address: account, role } : account;
268
- }
269
- function getAccountMetasWithSigners(accounts, optionalAccountStrategy, programAddress) {
270
- const accountMetas = {};
271
- Object.keys(accounts).forEach((key) => {
272
- const account = accounts[key];
273
- if (!account.value) {
274
- if (optionalAccountStrategy === "omitted")
275
- return;
276
- accountMetas[key] = {
277
- address: programAddress,
278
- role: instructions.AccountRole.READONLY
279
- };
280
- return;
281
- }
282
- const writableRole = account.isWritable ? instructions.AccountRole.WRITABLE : instructions.AccountRole.READONLY;
283
- accountMetas[key] = Object.freeze({
284
- address: expectAddress(account.value),
285
- role: isTransactionSigner(account.value) ? instructions.upgradeRoleToSigner(writableRole) : writableRole,
286
- ...isTransactionSigner(account.value) ? { signer: account.value } : {}
287
- });
288
- });
289
- return accountMetas;
290
- }
291
- function isTransactionSigner(value) {
292
- return !!value && typeof value === "object" && "address" in value && signers.isTransactionSigner(value);
293
- }
294
- function memcmp(data, bytes, offset) {
295
- const slice = data.slice(offset, offset + bytes.length);
296
- if (slice.length !== bytes.length)
297
- return false;
298
- return bytes.every((b, i) => b === slice[i]);
299
- }
300
-
301
- // src/generated/programs/computeBudget.ts
302
- var COMPUTE_BUDGET_PROGRAM_ADDRESS = "ComputeBudget111111111111111111111111111111";
303
- function getComputeBudgetProgram() {
304
- return {
305
- name: "computeBudget",
306
- address: COMPUTE_BUDGET_PROGRAM_ADDRESS
307
- };
308
- }
309
- var ComputeBudgetInstruction = /* @__PURE__ */ ((ComputeBudgetInstruction2) => {
310
- ComputeBudgetInstruction2[ComputeBudgetInstruction2["RequestUnits"] = 0] = "RequestUnits";
311
- ComputeBudgetInstruction2[ComputeBudgetInstruction2["RequestHeapFrame"] = 1] = "RequestHeapFrame";
312
- ComputeBudgetInstruction2[ComputeBudgetInstruction2["SetComputeUnitLimit"] = 2] = "SetComputeUnitLimit";
313
- ComputeBudgetInstruction2[ComputeBudgetInstruction2["SetComputeUnitPrice"] = 3] = "SetComputeUnitPrice";
314
- ComputeBudgetInstruction2[ComputeBudgetInstruction2["SetLoadedAccountsDataSizeLimit"] = 4] = "SetLoadedAccountsDataSizeLimit";
315
- return ComputeBudgetInstruction2;
316
- })(ComputeBudgetInstruction || {});
317
- function identifyComputeBudgetInstruction(instruction) {
318
- const data = instruction instanceof Uint8Array ? instruction : instruction.data;
319
- if (memcmp(data, codecs.getU8Encoder().encode(0), 0)) {
320
- return 0 /* RequestUnits */;
321
- }
322
- if (memcmp(data, codecs.getU8Encoder().encode(1), 0)) {
323
- return 1 /* RequestHeapFrame */;
324
- }
325
- if (memcmp(data, codecs.getU8Encoder().encode(2), 0)) {
326
- return 2 /* SetComputeUnitLimit */;
327
- }
328
- if (memcmp(data, codecs.getU8Encoder().encode(3), 0)) {
329
- return 3 /* SetComputeUnitPrice */;
330
- }
331
- if (memcmp(data, codecs.getU8Encoder().encode(4), 0)) {
332
- return 4 /* SetLoadedAccountsDataSizeLimit */;
333
- }
334
- throw new Error(
335
- "The provided instruction could not be identified as a computeBudget instruction."
336
- );
337
- }
338
236
 
339
237
  exports.COMPUTE_BUDGET_PROGRAM_ADDRESS = COMPUTE_BUDGET_PROGRAM_ADDRESS;
340
238
  exports.ComputeBudgetInstruction = ComputeBudgetInstruction;
341
- exports.accountMetaWithDefault = accountMetaWithDefault;
342
- exports.expectAddress = expectAddress;
343
- exports.expectProgramDerivedAddress = expectProgramDerivedAddress;
344
- exports.expectSome = expectSome;
345
- exports.expectTransactionSigner = expectTransactionSigner;
346
- exports.getAccountMetasWithSigners = getAccountMetasWithSigners;
347
- exports.getComputeBudgetProgram = getComputeBudgetProgram;
348
239
  exports.getRequestHeapFrameInstruction = getRequestHeapFrameInstruction;
349
240
  exports.getRequestHeapFrameInstructionDataCodec = getRequestHeapFrameInstructionDataCodec;
350
241
  exports.getRequestHeapFrameInstructionDataDecoder = getRequestHeapFrameInstructionDataDecoder;
351
242
  exports.getRequestHeapFrameInstructionDataEncoder = getRequestHeapFrameInstructionDataEncoder;
352
- exports.getRequestHeapFrameInstructionRaw = getRequestHeapFrameInstructionRaw;
353
243
  exports.getRequestUnitsInstruction = getRequestUnitsInstruction;
354
244
  exports.getRequestUnitsInstructionDataCodec = getRequestUnitsInstructionDataCodec;
355
245
  exports.getRequestUnitsInstructionDataDecoder = getRequestUnitsInstructionDataDecoder;
356
246
  exports.getRequestUnitsInstructionDataEncoder = getRequestUnitsInstructionDataEncoder;
357
- exports.getRequestUnitsInstructionRaw = getRequestUnitsInstructionRaw;
358
247
  exports.getSetComputeUnitLimitInstruction = getSetComputeUnitLimitInstruction;
359
248
  exports.getSetComputeUnitLimitInstructionDataCodec = getSetComputeUnitLimitInstructionDataCodec;
360
249
  exports.getSetComputeUnitLimitInstructionDataDecoder = getSetComputeUnitLimitInstructionDataDecoder;
361
250
  exports.getSetComputeUnitLimitInstructionDataEncoder = getSetComputeUnitLimitInstructionDataEncoder;
362
- exports.getSetComputeUnitLimitInstructionRaw = getSetComputeUnitLimitInstructionRaw;
363
251
  exports.getSetComputeUnitPriceInstruction = getSetComputeUnitPriceInstruction;
364
252
  exports.getSetComputeUnitPriceInstructionDataCodec = getSetComputeUnitPriceInstructionDataCodec;
365
253
  exports.getSetComputeUnitPriceInstructionDataDecoder = getSetComputeUnitPriceInstructionDataDecoder;
366
254
  exports.getSetComputeUnitPriceInstructionDataEncoder = getSetComputeUnitPriceInstructionDataEncoder;
367
- exports.getSetComputeUnitPriceInstructionRaw = getSetComputeUnitPriceInstructionRaw;
368
255
  exports.getSetLoadedAccountsDataSizeLimitInstruction = getSetLoadedAccountsDataSizeLimitInstruction;
369
256
  exports.getSetLoadedAccountsDataSizeLimitInstructionDataCodec = getSetLoadedAccountsDataSizeLimitInstructionDataCodec;
370
257
  exports.getSetLoadedAccountsDataSizeLimitInstructionDataDecoder = getSetLoadedAccountsDataSizeLimitInstructionDataDecoder;
371
258
  exports.getSetLoadedAccountsDataSizeLimitInstructionDataEncoder = getSetLoadedAccountsDataSizeLimitInstructionDataEncoder;
372
- exports.getSetLoadedAccountsDataSizeLimitInstructionRaw = getSetLoadedAccountsDataSizeLimitInstructionRaw;
373
259
  exports.identifyComputeBudgetInstruction = identifyComputeBudgetInstruction;
374
- exports.isTransactionSigner = isTransactionSigner;
375
- exports.memcmp = memcmp;
376
260
  exports.parseRequestHeapFrameInstruction = parseRequestHeapFrameInstruction;
377
261
  exports.parseRequestUnitsInstruction = parseRequestUnitsInstruction;
378
262
  exports.parseSetComputeUnitLimitInstruction = parseSetComputeUnitLimitInstruction;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generated/instructions/requestHeapFrame.ts","../../src/generated/instructions/requestUnits.ts","../../src/generated/instructions/setComputeUnitLimit.ts","../../src/generated/instructions/setComputeUnitPrice.ts","../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts","../../src/generated/programs/computeBudget.ts","../../src/generated/shared/index.ts"],"names":["combineCodec","getStructDecoder","getStructEncoder","getU32Decoder","getU32Encoder","getU8Decoder","getU8Encoder","mapEncoder","ComputeBudgetInstruction"],"mappings":";AASA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAuCA,SAAS,4CAA0F;AACxG,SAAO;AAAA,IACL,iBAAiB;AAAA,MACf,CAAC,iBAAiB,aAAa,CAAC;AAAA,MAChC,CAAC,SAAS,cAAc,CAAC;AAAA,IAC3B,CAAC;AAAA,IACD,CAAC,WAAW,EAAE,GAAG,OAAO,eAAe,EAAE;AAAA,EAC3C;AACF;AAEO,SAAS,4CAAsF;AACpG,SAAO,iBAAiB;AAAA,IACtB,CAAC,iBAAiB,aAAa,CAAC;AAAA,IAChC,CAAC,SAAS,cAAc,CAAC;AAAA,EAC3B,CAAC;AACH;AAEO,SAAS,0CAGd;AACA,SAAO;AAAA,IACL,0CAA0C;AAAA,IAC1C,0CAA0C;AAAA,EAC5C;AACF;AAkBO,SAAS,+BACd,OACc;AAEd,QAAM,iBACJ;AAGF,QAAM,OAAO,EAAE,GAAG,MAAM;AAExB,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,kCAId,MACA,iBAAoC,+CACpC,mBACA;AACA,SAAO;AAAA,IACL,UAAU,qBAAqB,CAAC;AAAA,IAChC,MAAM,0CAA0C,EAAE,OAAO,IAAI;AAAA,IAC7D;AAAA,EACF;AACF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;AAEO,SAAS,OAAO,MAAkB,OAAmB,QAAgB;AAC1E,QAAM,QAAQ,KAAK,MAAM,QAAQ,SAAS,MAAM,MAAM;AACtD,MAAI,MAAM,WAAW,MAAM;AAAQ,WAAO;AAC1C,SAAO,MAAM,MAAM,CAAC,GAAG,MAAM,MAAM,MAAM,CAAC,CAAC;AAC7C;;;AD1KO,IAAM,iCACX;AAKK,SAAS,0BAAgD;AAC9D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAEO,IAAK,2BAAL,kBAAKE,8BAAL;AACL,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AALU,SAAAA;AAAA,GAAA;AAQL,SAAS,iCACd,aAC0B;AAC1B,QAAM,OACJ,uBAAuB,aAAa,cAAc,YAAY;AAChE,MAAI,OAAO,MAAMF,cAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,MAAI,OAAO,MAAMA,cAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,MAAI,OAAO,MAAMA,cAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,MAAI,OAAO,MAAMA,cAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,MAAI,OAAO,MAAMA,cAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF","sourcesContent":["/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address } from '@solana/addresses';\nimport {\n Codec,\n Decoder,\n Encoder,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n mapEncoder,\n} from '@solana/codecs';\nimport {\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n} from '@solana/instructions';\n\nexport type RequestHeapFrameInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestHeapFrameInstructionWithSigners<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestHeapFrameInstructionData = {\n discriminator: number;\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport type RequestHeapFrameInstructionDataArgs = {\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport function getRequestHeapFrameInstructionDataEncoder(): Encoder<RequestHeapFrameInstructionDataArgs> {\n return mapEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 1 })\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): Decoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): Codec<\n RequestHeapFrameInstructionDataArgs,\n RequestHeapFrameInstructionData\n> {\n return combineCodec(\n getRequestHeapFrameInstructionDataEncoder(),\n getRequestHeapFrameInstructionDataDecoder()\n );\n}\n\nexport type RequestHeapFrameInput = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport type RequestHeapFrameInputWithSigners = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport function getRequestHeapFrameInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(\n input: RequestHeapFrameInputWithSigners\n): RequestHeapFrameInstructionWithSigners<TProgram>;\nexport function getRequestHeapFrameInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(input: RequestHeapFrameInput): RequestHeapFrameInstruction<TProgram>;\nexport function getRequestHeapFrameInstruction(\n input: RequestHeapFrameInput\n): IInstruction {\n // Program address.\n const programAddress =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\n // Original args.\n const args = { ...input };\n\n const instruction = getRequestHeapFrameInstructionRaw(\n args as RequestHeapFrameInstructionDataArgs,\n programAddress\n );\n\n return instruction;\n}\n\nexport function getRequestHeapFrameInstructionRaw<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n>(\n args: RequestHeapFrameInstructionDataArgs,\n programAddress: Address<TProgram> = 'ComputeBudget111111111111111111111111111111' as Address<TProgram>,\n remainingAccounts?: TRemainingAccounts\n) {\n return {\n accounts: remainingAccounts ?? [],\n data: getRequestHeapFrameInstructionDataEncoder().encode(args),\n programAddress,\n } as RequestHeapFrameInstruction<TProgram, TRemainingAccounts>;\n}\n\nexport type ParsedRequestHeapFrameInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestHeapFrameInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestHeapFrameInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address } from '@solana/addresses';\nimport {\n Codec,\n Decoder,\n Encoder,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n mapEncoder,\n} from '@solana/codecs';\nimport {\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n} from '@solana/instructions';\n\nexport type RequestUnitsInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestUnitsInstructionWithSigners<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestUnitsInstructionData = {\n discriminator: number;\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport type RequestUnitsInstructionDataArgs = {\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport function getRequestUnitsInstructionDataEncoder(): Encoder<RequestUnitsInstructionDataArgs> {\n return mapEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 0 })\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): Decoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): Codec<\n RequestUnitsInstructionDataArgs,\n RequestUnitsInstructionData\n> {\n return combineCodec(\n getRequestUnitsInstructionDataEncoder(),\n getRequestUnitsInstructionDataDecoder()\n );\n}\n\nexport type RequestUnitsInput = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport type RequestUnitsInputWithSigners = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport function getRequestUnitsInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(\n input: RequestUnitsInputWithSigners\n): RequestUnitsInstructionWithSigners<TProgram>;\nexport function getRequestUnitsInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(input: RequestUnitsInput): RequestUnitsInstruction<TProgram>;\nexport function getRequestUnitsInstruction(\n input: RequestUnitsInput\n): IInstruction {\n // Program address.\n const programAddress =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\n // Original args.\n const args = { ...input };\n\n const instruction = getRequestUnitsInstructionRaw(\n args as RequestUnitsInstructionDataArgs,\n programAddress\n );\n\n return instruction;\n}\n\nexport function getRequestUnitsInstructionRaw<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n>(\n args: RequestUnitsInstructionDataArgs,\n programAddress: Address<TProgram> = 'ComputeBudget111111111111111111111111111111' as Address<TProgram>,\n remainingAccounts?: TRemainingAccounts\n) {\n return {\n accounts: remainingAccounts ?? [],\n data: getRequestUnitsInstructionDataEncoder().encode(args),\n programAddress,\n } as RequestUnitsInstruction<TProgram, TRemainingAccounts>;\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestUnitsInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestUnitsInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address } from '@solana/addresses';\nimport {\n Codec,\n Decoder,\n Encoder,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n mapEncoder,\n} from '@solana/codecs';\nimport {\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n} from '@solana/instructions';\n\nexport type SetComputeUnitLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitLimitInstructionWithSigners<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitLimitInstructionData = {\n discriminator: number;\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport type SetComputeUnitLimitInstructionDataArgs = {\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport function getSetComputeUnitLimitInstructionDataEncoder(): Encoder<SetComputeUnitLimitInstructionDataArgs> {\n return mapEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 2 })\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): Decoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): Codec<\n SetComputeUnitLimitInstructionDataArgs,\n SetComputeUnitLimitInstructionData\n> {\n return combineCodec(\n getSetComputeUnitLimitInstructionDataEncoder(),\n getSetComputeUnitLimitInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitLimitInput = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport type SetComputeUnitLimitInputWithSigners = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport function getSetComputeUnitLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(\n input: SetComputeUnitLimitInputWithSigners\n): SetComputeUnitLimitInstructionWithSigners<TProgram>;\nexport function getSetComputeUnitLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(input: SetComputeUnitLimitInput): SetComputeUnitLimitInstruction<TProgram>;\nexport function getSetComputeUnitLimitInstruction(\n input: SetComputeUnitLimitInput\n): IInstruction {\n // Program address.\n const programAddress =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\n // Original args.\n const args = { ...input };\n\n const instruction = getSetComputeUnitLimitInstructionRaw(\n args as SetComputeUnitLimitInstructionDataArgs,\n programAddress\n );\n\n return instruction;\n}\n\nexport function getSetComputeUnitLimitInstructionRaw<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n>(\n args: SetComputeUnitLimitInstructionDataArgs,\n programAddress: Address<TProgram> = 'ComputeBudget111111111111111111111111111111' as Address<TProgram>,\n remainingAccounts?: TRemainingAccounts\n) {\n return {\n accounts: remainingAccounts ?? [],\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(args),\n programAddress,\n } as SetComputeUnitLimitInstruction<TProgram, TRemainingAccounts>;\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address } from '@solana/addresses';\nimport {\n Codec,\n Decoder,\n Encoder,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n mapEncoder,\n} from '@solana/codecs';\nimport {\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n} from '@solana/instructions';\n\nexport type SetComputeUnitPriceInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitPriceInstructionWithSigners<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitPriceInstructionData = {\n discriminator: number;\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: bigint;\n};\n\nexport type SetComputeUnitPriceInstructionDataArgs = {\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: number | bigint;\n};\n\nexport function getSetComputeUnitPriceInstructionDataEncoder(): Encoder<SetComputeUnitPriceInstructionDataArgs> {\n return mapEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 3 })\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): Decoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): Codec<\n SetComputeUnitPriceInstructionDataArgs,\n SetComputeUnitPriceInstructionData\n> {\n return combineCodec(\n getSetComputeUnitPriceInstructionDataEncoder(),\n getSetComputeUnitPriceInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitPriceInput = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport type SetComputeUnitPriceInputWithSigners = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport function getSetComputeUnitPriceInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(\n input: SetComputeUnitPriceInputWithSigners\n): SetComputeUnitPriceInstructionWithSigners<TProgram>;\nexport function getSetComputeUnitPriceInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(input: SetComputeUnitPriceInput): SetComputeUnitPriceInstruction<TProgram>;\nexport function getSetComputeUnitPriceInstruction(\n input: SetComputeUnitPriceInput\n): IInstruction {\n // Program address.\n const programAddress =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\n // Original args.\n const args = { ...input };\n\n const instruction = getSetComputeUnitPriceInstructionRaw(\n args as SetComputeUnitPriceInstructionDataArgs,\n programAddress\n );\n\n return instruction;\n}\n\nexport function getSetComputeUnitPriceInstructionRaw<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n>(\n args: SetComputeUnitPriceInstructionDataArgs,\n programAddress: Address<TProgram> = 'ComputeBudget111111111111111111111111111111' as Address<TProgram>,\n remainingAccounts?: TRemainingAccounts\n) {\n return {\n accounts: remainingAccounts ?? [],\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(args),\n programAddress,\n } as SetComputeUnitPriceInstruction<TProgram, TRemainingAccounts>;\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitPriceInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitPriceInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address } from '@solana/addresses';\nimport {\n Codec,\n Decoder,\n Encoder,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n mapEncoder,\n} from '@solana/codecs';\nimport {\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n} from '@solana/instructions';\n\nexport type SetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionWithSigners<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = {\n discriminator: number;\n accountDataSizeLimit: number;\n};\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {\n accountDataSizeLimit: number;\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): Encoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return mapEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 4 })\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): Decoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): Codec<\n SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n SetLoadedAccountsDataSizeLimitInstructionData\n> {\n return combineCodec(\n getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),\n getSetLoadedAccountsDataSizeLimitInstructionDataDecoder()\n );\n}\n\nexport type SetLoadedAccountsDataSizeLimitInput = {\n accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];\n};\n\nexport type SetLoadedAccountsDataSizeLimitInputWithSigners = {\n accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(\n input: SetLoadedAccountsDataSizeLimitInputWithSigners\n): SetLoadedAccountsDataSizeLimitInstructionWithSigners<TProgram>;\nexport function getSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n>(\n input: SetLoadedAccountsDataSizeLimitInput\n): SetLoadedAccountsDataSizeLimitInstruction<TProgram>;\nexport function getSetLoadedAccountsDataSizeLimitInstruction(\n input: SetLoadedAccountsDataSizeLimitInput\n): IInstruction {\n // Program address.\n const programAddress =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\n // Original args.\n const args = { ...input };\n\n const instruction = getSetLoadedAccountsDataSizeLimitInstructionRaw(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n programAddress\n );\n\n return instruction;\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionRaw<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n TRemainingAccounts extends Array<IAccountMeta<string>> = []\n>(\n args: SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n programAddress: Address<TProgram> = 'ComputeBudget111111111111111111111111111111' as Address<TProgram>,\n remainingAccounts?: TRemainingAccounts\n) {\n return {\n accounts: remainingAccounts ?? [],\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args\n ),\n programAddress,\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgram, TRemainingAccounts>;\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n> = {\n programAddress: Address<TProgram>;\n data: SetLoadedAccountsDataSizeLimitInstructionData;\n};\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string\n>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address } from '@solana/addresses';\nimport { getU8Encoder } from '@solana/codecs';\nimport { Program } from '@solana/programs';\nimport {\n ParsedRequestHeapFrameInstruction,\n ParsedRequestUnitsInstruction,\n ParsedSetComputeUnitLimitInstruction,\n ParsedSetComputeUnitPriceInstruction,\n ParsedSetLoadedAccountsDataSizeLimitInstruction,\n} from '../instructions';\nimport { memcmp } from '../shared';\n\nexport const COMPUTE_BUDGET_PROGRAM_ADDRESS =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\nexport type ComputeBudgetProgram =\n Program<'ComputeBudget111111111111111111111111111111'>;\n\nexport function getComputeBudgetProgram(): ComputeBudgetProgram {\n return {\n name: 'computeBudget',\n address: COMPUTE_BUDGET_PROGRAM_ADDRESS,\n };\n}\n\nexport enum ComputeBudgetInstruction {\n RequestUnits,\n RequestHeapFrame,\n SetComputeUnitLimit,\n SetComputeUnitPrice,\n SetLoadedAccountsDataSizeLimit,\n}\n\nexport function identifyComputeBudgetInstruction(\n instruction: { data: Uint8Array } | Uint8Array\n): ComputeBudgetInstruction {\n const data =\n instruction instanceof Uint8Array ? instruction : instruction.data;\n if (memcmp(data, getU8Encoder().encode(0), 0)) {\n return ComputeBudgetInstruction.RequestUnits;\n }\n if (memcmp(data, getU8Encoder().encode(1), 0)) {\n return ComputeBudgetInstruction.RequestHeapFrame;\n }\n if (memcmp(data, getU8Encoder().encode(2), 0)) {\n return ComputeBudgetInstruction.SetComputeUnitLimit;\n }\n if (memcmp(data, getU8Encoder().encode(3), 0)) {\n return ComputeBudgetInstruction.SetComputeUnitPrice;\n }\n if (memcmp(data, getU8Encoder().encode(4), 0)) {\n return ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit;\n }\n throw new Error(\n 'The provided instruction could not be identified as a computeBudget instruction.'\n );\n}\n\nexport type ParsedComputeBudgetInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111'\n> =\n | ({\n instructionType: ComputeBudgetInstruction.RequestUnits;\n } & ParsedRequestUnitsInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.RequestHeapFrame;\n } & ParsedRequestHeapFrameInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.SetComputeUnitLimit;\n } & ParsedSetComputeUnitLimitInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.SetComputeUnitPrice;\n } & ParsedSetComputeUnitPriceInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit;\n } & ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>);\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport {\n Address,\n isProgramDerivedAddress,\n ProgramDerivedAddress,\n} from '@solana/addresses';\nimport {\n AccountRole,\n IAccountMeta,\n upgradeRoleToSigner,\n} from '@solana/instructions';\nimport {\n IAccountSignerMeta,\n isTransactionSigner as web3JsIsTransactionSigner,\n TransactionSigner,\n} from '@solana/signers';\n\n/**\n * Asserts that the given value is not null or undefined.\n * @internal\n */\nexport function expectSome<T>(value: T | null | undefined): T {\n if (value == null) {\n throw new Error('Expected a value but received null or undefined.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a PublicKey.\n * @internal\n */\nexport function expectAddress<T extends string = string>(\n value:\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null\n | undefined\n): Address<T> {\n if (!value) {\n throw new Error('Expected a Address.');\n }\n if (typeof value === 'object' && 'address' in value) {\n return value.address;\n }\n if (Array.isArray(value)) {\n return value[0];\n }\n return value as Address<T>;\n}\n\n/**\n * Asserts that the given value is a PDA.\n * @internal\n */\nexport function expectProgramDerivedAddress<T extends string = string>(\n value:\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null\n | undefined\n): ProgramDerivedAddress<T> {\n if (!value || !Array.isArray(value) || !isProgramDerivedAddress(value)) {\n throw new Error('Expected a ProgramDerivedAddress.');\n }\n return value;\n}\n\n/**\n * Asserts that the given value is a TransactionSigner.\n * @internal\n */\nexport function expectTransactionSigner<T extends string = string>(\n value:\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null\n | undefined\n): TransactionSigner<T> {\n if (!value || !isTransactionSigner(value)) {\n throw new Error('Expected a TransactionSigner.');\n }\n return value;\n}\n\n/**\n * Defines an instruction account to resolve.\n * @internal\n */\nexport type ResolvedAccount<\n T extends string = string,\n U extends\n | Address<T>\n | ProgramDerivedAddress<T>\n | TransactionSigner<T>\n | null = Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null\n> = {\n isWritable: boolean;\n value: U;\n};\n\n/**\n * Add an account meta with a default role if only an address is provided.\n * @internal\n */\nexport function accountMetaWithDefault<\n TAccount extends string | IAccountMeta<string>,\n TRole extends AccountRole\n>(account: TAccount | undefined, role: TRole) {\n if (account === undefined) return undefined;\n return (\n typeof account === 'string' ? { address: account, role } : account\n ) as TAccount extends string\n ? { address: Address<TAccount>; role: TRole }\n : TAccount;\n}\n\n/**\n * Defines an instruction that stores additional bytes on-chain.\n * @internal\n */\nexport type IInstructionWithByteDelta = {\n byteDelta: number;\n};\n\n/**\n * Get account metas and signers from resolved accounts.\n * @internal\n */\nexport function getAccountMetasWithSigners<TKey extends string = string>(\n accounts: Record<TKey, ResolvedAccount>,\n optionalAccountStrategy: 'omitted' | 'programId',\n programAddress: Address\n): Record<TKey, IAccountMeta | IAccountSignerMeta> {\n const accountMetas: Record<string, IAccountMeta | IAccountSignerMeta> = {};\n\n Object.keys(accounts).forEach((key) => {\n const account = accounts[key as TKey] as ResolvedAccount;\n if (!account.value) {\n if (optionalAccountStrategy === 'omitted') return;\n accountMetas[key] = {\n address: programAddress,\n role: AccountRole.READONLY,\n };\n return;\n }\n\n const writableRole = account.isWritable\n ? AccountRole.WRITABLE\n : AccountRole.READONLY;\n accountMetas[key] = Object.freeze({\n address: expectAddress(account.value),\n role: isTransactionSigner(account.value)\n ? upgradeRoleToSigner(writableRole)\n : writableRole,\n ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),\n });\n });\n\n return accountMetas;\n}\n\nexport function isTransactionSigner<TAddress extends string = string>(\n value:\n | Address<TAddress>\n | ProgramDerivedAddress<TAddress>\n | TransactionSigner<TAddress>\n): value is TransactionSigner<TAddress> {\n return (\n !!value &&\n typeof value === 'object' &&\n 'address' in value &&\n web3JsIsTransactionSigner(value)\n );\n}\n\nexport function memcmp(data: Uint8Array, bytes: Uint8Array, offset: number) {\n const slice = data.slice(offset, offset + bytes.length);\n if (slice.length !== bytes.length) return false;\n return bytes.every((b, i) => b === slice[i]);\n}\n"]}
1
+ {"version":3,"sources":["../../src/generated/instructions/requestHeapFrame.ts","../../src/generated/programs/computeBudget.ts","../../src/generated/instructions/requestUnits.ts","../../src/generated/instructions/setComputeUnitLimit.ts","../../src/generated/instructions/setComputeUnitPrice.ts","../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":["getU8Encoder","ComputeBudgetInstruction","combineCodec","getStructDecoder","getStructEncoder","getU32Decoder","getU32Encoder","getU8Decoder","transformEncoder"],"mappings":";AAQA;AAAA,EASE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAAA;AAAA,EACA;AAAA,OACK;;;ACjBP,SAAkB,eAAe,oBAAoB;AAS9C,IAAM,iCACX;AAEK,IAAK,2BAAL,kBAAKC,8BAAL;AACL,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AACA,EAAAA,oDAAA;AALU,SAAAA;AAAA,GAAA;AAQL,SAAS,iCACd,aAC0B;AAC1B,QAAM,OACJ,uBAAuB,aAAa,cAAc,YAAY;AAChE,MAAI,cAAc,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AACpD,WAAO;AAAA,EACT;AACA,MAAI,cAAc,MAAM,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;AACpD,WAAO;AAAA,EACT;AACA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IAC5B,MAAM,wDAAwD,EAAE;AAAA,MAC9D,YAAY;AAAA,IACd;AAAA,EACF;AACF","sourcesContent":["/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport {\n Address,\n Codec,\n Decoder,\n Encoder,\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n} from '@solana/web3.js';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport type RequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestHeapFrameInstructionData = {\n discriminator: number;\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport type RequestHeapFrameInstructionDataArgs = {\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport function getRequestHeapFrameInstructionDataEncoder(): Encoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 1 })\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): Decoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): Codec<\n RequestHeapFrameInstructionDataArgs,\n RequestHeapFrameInstructionData\n> {\n return combineCodec(\n getRequestHeapFrameInstructionDataEncoder(),\n getRequestHeapFrameInstructionDataDecoder()\n );\n}\n\nexport type RequestHeapFrameInput = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport function getRequestHeapFrameInstruction(\n input: RequestHeapFrameInput\n): RequestHeapFrameInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> {\n // Program address.\n const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n const instruction = {\n programAddress,\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n } as RequestHeapFrameInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>;\n\n return instruction;\n}\n\nexport type ParsedRequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestHeapFrameInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestHeapFrameInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport { Address, containsBytes, getU8Encoder } from '@solana/web3.js';\nimport {\n ParsedRequestHeapFrameInstruction,\n ParsedRequestUnitsInstruction,\n ParsedSetComputeUnitLimitInstruction,\n ParsedSetComputeUnitPriceInstruction,\n ParsedSetLoadedAccountsDataSizeLimitInstruction,\n} from '../instructions';\n\nexport const COMPUTE_BUDGET_PROGRAM_ADDRESS =\n 'ComputeBudget111111111111111111111111111111' as Address<'ComputeBudget111111111111111111111111111111'>;\n\nexport enum ComputeBudgetInstruction {\n RequestUnits,\n RequestHeapFrame,\n SetComputeUnitLimit,\n SetComputeUnitPrice,\n SetLoadedAccountsDataSizeLimit,\n}\n\nexport function identifyComputeBudgetInstruction(\n instruction: { data: Uint8Array } | Uint8Array\n): ComputeBudgetInstruction {\n const data =\n instruction instanceof Uint8Array ? instruction : instruction.data;\n if (containsBytes(data, getU8Encoder().encode(0), 0)) {\n return ComputeBudgetInstruction.RequestUnits;\n }\n if (containsBytes(data, getU8Encoder().encode(1), 0)) {\n return ComputeBudgetInstruction.RequestHeapFrame;\n }\n if (containsBytes(data, getU8Encoder().encode(2), 0)) {\n return ComputeBudgetInstruction.SetComputeUnitLimit;\n }\n if (containsBytes(data, getU8Encoder().encode(3), 0)) {\n return ComputeBudgetInstruction.SetComputeUnitPrice;\n }\n if (containsBytes(data, getU8Encoder().encode(4), 0)) {\n return ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit;\n }\n throw new Error(\n 'The provided instruction could not be identified as a computeBudget instruction.'\n );\n}\n\nexport type ParsedComputeBudgetInstruction<\n TProgram extends string = 'ComputeBudget111111111111111111111111111111',\n> =\n | ({\n instructionType: ComputeBudgetInstruction.RequestUnits;\n } & ParsedRequestUnitsInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.RequestHeapFrame;\n } & ParsedRequestHeapFrameInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.SetComputeUnitLimit;\n } & ParsedSetComputeUnitLimitInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.SetComputeUnitPrice;\n } & ParsedSetComputeUnitPriceInstruction<TProgram>)\n | ({\n instructionType: ComputeBudgetInstruction.SetLoadedAccountsDataSizeLimit;\n } & ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>);\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport {\n Address,\n Codec,\n Decoder,\n Encoder,\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n} from '@solana/web3.js';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport type RequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestUnitsInstructionData = {\n discriminator: number;\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport type RequestUnitsInstructionDataArgs = {\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport function getRequestUnitsInstructionDataEncoder(): Encoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 0 })\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): Decoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): Codec<\n RequestUnitsInstructionDataArgs,\n RequestUnitsInstructionData\n> {\n return combineCodec(\n getRequestUnitsInstructionDataEncoder(),\n getRequestUnitsInstructionDataDecoder()\n );\n}\n\nexport type RequestUnitsInput = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport function getRequestUnitsInstruction(\n input: RequestUnitsInput\n): RequestUnitsInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> {\n // Program address.\n const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n const instruction = {\n programAddress,\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n } as RequestUnitsInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>;\n\n return instruction;\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestUnitsInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestUnitsInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport {\n Address,\n Codec,\n Decoder,\n Encoder,\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n} from '@solana/web3.js';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport type SetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitLimitInstructionData = {\n discriminator: number;\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport type SetComputeUnitLimitInstructionDataArgs = {\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport function getSetComputeUnitLimitInstructionDataEncoder(): Encoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 2 })\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): Decoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): Codec<\n SetComputeUnitLimitInstructionDataArgs,\n SetComputeUnitLimitInstructionData\n> {\n return combineCodec(\n getSetComputeUnitLimitInstructionDataEncoder(),\n getSetComputeUnitLimitInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitLimitInput = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport function getSetComputeUnitLimitInstruction(\n input: SetComputeUnitLimitInput\n): SetComputeUnitLimitInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> {\n // Program address.\n const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n const instruction = {\n programAddress,\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n } as SetComputeUnitLimitInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport {\n Address,\n Codec,\n Decoder,\n Encoder,\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n} from '@solana/web3.js';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport type SetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitPriceInstructionData = {\n discriminator: number;\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: bigint;\n};\n\nexport type SetComputeUnitPriceInstructionDataArgs = {\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: number | bigint;\n};\n\nexport function getSetComputeUnitPriceInstructionDataEncoder(): Encoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 3 })\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): Decoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): Codec<\n SetComputeUnitPriceInstructionDataArgs,\n SetComputeUnitPriceInstructionData\n> {\n return combineCodec(\n getSetComputeUnitPriceInstructionDataEncoder(),\n getSetComputeUnitPriceInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitPriceInput = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport function getSetComputeUnitPriceInstruction(\n input: SetComputeUnitPriceInput\n): SetComputeUnitPriceInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> {\n // Program address.\n const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n const instruction = {\n programAddress,\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n } as SetComputeUnitPriceInstruction<typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitPriceInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitPriceInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the kinobi library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun kinobi to update it.\n *\n * @see https://github.com/metaplex-foundation/kinobi\n */\n\nimport {\n Address,\n Codec,\n Decoder,\n Encoder,\n IAccountMeta,\n IInstruction,\n IInstructionWithAccounts,\n IInstructionWithData,\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n} from '@solana/web3.js';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport type SetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = {\n discriminator: number;\n accountDataSizeLimit: number;\n};\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {\n accountDataSizeLimit: number;\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): Encoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: 4 })\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): Decoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): Codec<\n SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n SetLoadedAccountsDataSizeLimitInstructionData\n> {\n return combineCodec(\n getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),\n getSetLoadedAccountsDataSizeLimitInstructionDataDecoder()\n );\n}\n\nexport type SetLoadedAccountsDataSizeLimitInput = {\n accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstruction(\n input: SetLoadedAccountsDataSizeLimitInput\n): SetLoadedAccountsDataSizeLimitInstruction<\n typeof COMPUTE_BUDGET_PROGRAM_ADDRESS\n> {\n // Program address.\n const programAddress = COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n const instruction = {\n programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n } as SetLoadedAccountsDataSizeLimitInstruction<\n typeof COMPUTE_BUDGET_PROGRAM_ADDRESS\n >;\n\n return instruction;\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetLoadedAccountsDataSizeLimitInstructionData;\n};\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string,\n>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n"]}