@solana-program/compute-budget 0.1.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.
- package/README.md +38 -0
- package/dist/src/index.cjs +382 -0
- package/dist/src/index.cjs.map +1 -0
- package/dist/src/index.js +339 -0
- package/dist/src/index.js.map +1 -0
- package/dist/types/src/generated/index.d.ts +11 -0
- package/dist/types/src/generated/index.d.ts.map +1 -0
- package/dist/types/src/generated/instructions/index.d.ts +13 -0
- package/dist/types/src/generated/instructions/index.d.ts.map +1 -0
- package/dist/types/src/generated/instructions/requestHeapFrame.d.ts +45 -0
- package/dist/types/src/generated/instructions/requestHeapFrame.d.ts.map +1 -0
- package/dist/types/src/generated/instructions/requestUnits.d.ts +45 -0
- package/dist/types/src/generated/instructions/requestUnits.d.ts.map +1 -0
- package/dist/types/src/generated/instructions/setComputeUnitLimit.d.ts +39 -0
- package/dist/types/src/generated/instructions/setComputeUnitLimit.d.ts.map +1 -0
- package/dist/types/src/generated/instructions/setComputeUnitPrice.d.ts +39 -0
- package/dist/types/src/generated/instructions/setComputeUnitPrice.d.ts.map +1 -0
- package/dist/types/src/generated/instructions/setLoadedAccountsDataSizeLimit.d.ts +37 -0
- package/dist/types/src/generated/instructions/setLoadedAccountsDataSizeLimit.d.ts.map +1 -0
- package/dist/types/src/generated/programs/computeBudget.d.ts +35 -0
- package/dist/types/src/generated/programs/computeBudget.d.ts.map +1 -0
- package/dist/types/src/generated/programs/index.d.ts +9 -0
- package/dist/types/src/generated/programs/index.d.ts.map +1 -0
- package/dist/types/src/generated/shared/index.d.ts +61 -0
- package/dist/types/src/generated/shared/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/test/_setup.d.ts +14 -0
- package/dist/types/test/_setup.d.ts.map +1 -0
- package/dist/types/test/setComputeUnitLimit.test.d.ts +2 -0
- package/dist/types/test/setComputeUnitLimit.test.d.ts.map +1 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# JavaScript client
|
|
2
|
+
|
|
3
|
+
A generated JavaScript library for the Compute Budget program.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
To build and test your JavaScript client from the root of the repository, you may use the following command.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm clients:js:test
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This will start a new local validator, if one is not already running, and run the tests for your JavaScript client.
|
|
14
|
+
|
|
15
|
+
## Available client scripts.
|
|
16
|
+
|
|
17
|
+
Alternatively, you can go into the client directory and run the tests directly.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
# Build your programs and start the validator.
|
|
21
|
+
pnpm programs:build
|
|
22
|
+
pnpm validator:restart
|
|
23
|
+
|
|
24
|
+
# Go into the client directory and run the tests.
|
|
25
|
+
cd clients/js
|
|
26
|
+
pnpm install
|
|
27
|
+
pnpm build
|
|
28
|
+
pnpm test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You may also use the following scripts to lint and/or format your JavaScript client.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pnpm lint
|
|
35
|
+
pnpm lint:fix
|
|
36
|
+
pnpm format
|
|
37
|
+
pnpm format:fix
|
|
38
|
+
```
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
'use strict';
|
|
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');
|
|
7
|
+
|
|
8
|
+
// src/generated/instructions/requestHeapFrame.ts
|
|
9
|
+
function getRequestHeapFrameInstructionDataEncoder() {
|
|
10
|
+
return codecs.mapEncoder(
|
|
11
|
+
codecs.getStructEncoder([
|
|
12
|
+
["discriminator", codecs.getU8Encoder()],
|
|
13
|
+
["bytes", codecs.getU32Encoder()]
|
|
14
|
+
]),
|
|
15
|
+
(value) => ({ ...value, discriminator: 1 })
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function getRequestHeapFrameInstructionDataDecoder() {
|
|
19
|
+
return codecs.getStructDecoder([
|
|
20
|
+
["discriminator", codecs.getU8Decoder()],
|
|
21
|
+
["bytes", codecs.getU32Decoder()]
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
function getRequestHeapFrameInstructionDataCodec() {
|
|
25
|
+
return codecs.combineCodec(
|
|
26
|
+
getRequestHeapFrameInstructionDataEncoder(),
|
|
27
|
+
getRequestHeapFrameInstructionDataDecoder()
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function getRequestHeapFrameInstruction(input) {
|
|
31
|
+
const programAddress = "ComputeBudget111111111111111111111111111111";
|
|
32
|
+
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
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function parseRequestHeapFrameInstruction(instruction) {
|
|
47
|
+
return {
|
|
48
|
+
programAddress: instruction.programAddress,
|
|
49
|
+
data: getRequestHeapFrameInstructionDataDecoder().decode(instruction.data)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function getRequestUnitsInstructionDataEncoder() {
|
|
53
|
+
return codecs.mapEncoder(
|
|
54
|
+
codecs.getStructEncoder([
|
|
55
|
+
["discriminator", codecs.getU8Encoder()],
|
|
56
|
+
["units", codecs.getU32Encoder()],
|
|
57
|
+
["additionalFee", codecs.getU32Encoder()]
|
|
58
|
+
]),
|
|
59
|
+
(value) => ({ ...value, discriminator: 0 })
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
function getRequestUnitsInstructionDataDecoder() {
|
|
63
|
+
return codecs.getStructDecoder([
|
|
64
|
+
["discriminator", codecs.getU8Decoder()],
|
|
65
|
+
["units", codecs.getU32Decoder()],
|
|
66
|
+
["additionalFee", codecs.getU32Decoder()]
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
function getRequestUnitsInstructionDataCodec() {
|
|
70
|
+
return codecs.combineCodec(
|
|
71
|
+
getRequestUnitsInstructionDataEncoder(),
|
|
72
|
+
getRequestUnitsInstructionDataDecoder()
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function getRequestUnitsInstruction(input) {
|
|
76
|
+
const programAddress = "ComputeBudget111111111111111111111111111111";
|
|
77
|
+
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
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function parseRequestUnitsInstruction(instruction) {
|
|
92
|
+
return {
|
|
93
|
+
programAddress: instruction.programAddress,
|
|
94
|
+
data: getRequestUnitsInstructionDataDecoder().decode(instruction.data)
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function getSetComputeUnitLimitInstructionDataEncoder() {
|
|
98
|
+
return codecs.mapEncoder(
|
|
99
|
+
codecs.getStructEncoder([
|
|
100
|
+
["discriminator", codecs.getU8Encoder()],
|
|
101
|
+
["units", codecs.getU32Encoder()]
|
|
102
|
+
]),
|
|
103
|
+
(value) => ({ ...value, discriminator: 2 })
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
function getSetComputeUnitLimitInstructionDataDecoder() {
|
|
107
|
+
return codecs.getStructDecoder([
|
|
108
|
+
["discriminator", codecs.getU8Decoder()],
|
|
109
|
+
["units", codecs.getU32Decoder()]
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
function getSetComputeUnitLimitInstructionDataCodec() {
|
|
113
|
+
return codecs.combineCodec(
|
|
114
|
+
getSetComputeUnitLimitInstructionDataEncoder(),
|
|
115
|
+
getSetComputeUnitLimitInstructionDataDecoder()
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function getSetComputeUnitLimitInstruction(input) {
|
|
119
|
+
const programAddress = "ComputeBudget111111111111111111111111111111";
|
|
120
|
+
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
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function parseSetComputeUnitLimitInstruction(instruction) {
|
|
135
|
+
return {
|
|
136
|
+
programAddress: instruction.programAddress,
|
|
137
|
+
data: getSetComputeUnitLimitInstructionDataDecoder().decode(
|
|
138
|
+
instruction.data
|
|
139
|
+
)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
function getSetComputeUnitPriceInstructionDataEncoder() {
|
|
143
|
+
return codecs.mapEncoder(
|
|
144
|
+
codecs.getStructEncoder([
|
|
145
|
+
["discriminator", codecs.getU8Encoder()],
|
|
146
|
+
["microLamports", codecs.getU64Encoder()]
|
|
147
|
+
]),
|
|
148
|
+
(value) => ({ ...value, discriminator: 3 })
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
function getSetComputeUnitPriceInstructionDataDecoder() {
|
|
152
|
+
return codecs.getStructDecoder([
|
|
153
|
+
["discriminator", codecs.getU8Decoder()],
|
|
154
|
+
["microLamports", codecs.getU64Decoder()]
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
function getSetComputeUnitPriceInstructionDataCodec() {
|
|
158
|
+
return codecs.combineCodec(
|
|
159
|
+
getSetComputeUnitPriceInstructionDataEncoder(),
|
|
160
|
+
getSetComputeUnitPriceInstructionDataDecoder()
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
function getSetComputeUnitPriceInstruction(input) {
|
|
164
|
+
const programAddress = "ComputeBudget111111111111111111111111111111";
|
|
165
|
+
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
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function parseSetComputeUnitPriceInstruction(instruction) {
|
|
180
|
+
return {
|
|
181
|
+
programAddress: instruction.programAddress,
|
|
182
|
+
data: getSetComputeUnitPriceInstructionDataDecoder().decode(
|
|
183
|
+
instruction.data
|
|
184
|
+
)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder() {
|
|
188
|
+
return codecs.mapEncoder(
|
|
189
|
+
codecs.getStructEncoder([
|
|
190
|
+
["discriminator", codecs.getU8Encoder()],
|
|
191
|
+
["accountDataSizeLimit", codecs.getU32Encoder()]
|
|
192
|
+
]),
|
|
193
|
+
(value) => ({ ...value, discriminator: 4 })
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder() {
|
|
197
|
+
return codecs.getStructDecoder([
|
|
198
|
+
["discriminator", codecs.getU8Decoder()],
|
|
199
|
+
["accountDataSizeLimit", codecs.getU32Decoder()]
|
|
200
|
+
]);
|
|
201
|
+
}
|
|
202
|
+
function getSetLoadedAccountsDataSizeLimitInstructionDataCodec() {
|
|
203
|
+
return codecs.combineCodec(
|
|
204
|
+
getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),
|
|
205
|
+
getSetLoadedAccountsDataSizeLimitInstructionDataDecoder()
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function getSetLoadedAccountsDataSizeLimitInstruction(input) {
|
|
209
|
+
const programAddress = "ComputeBudget111111111111111111111111111111";
|
|
210
|
+
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
|
+
data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(
|
|
221
|
+
args
|
|
222
|
+
),
|
|
223
|
+
programAddress
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function parseSetLoadedAccountsDataSizeLimitInstruction(instruction) {
|
|
227
|
+
return {
|
|
228
|
+
programAddress: instruction.programAddress,
|
|
229
|
+
data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(
|
|
230
|
+
instruction.data
|
|
231
|
+
)
|
|
232
|
+
};
|
|
233
|
+
}
|
|
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
|
+
|
|
339
|
+
exports.COMPUTE_BUDGET_PROGRAM_ADDRESS = COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
340
|
+
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
|
+
exports.getRequestHeapFrameInstruction = getRequestHeapFrameInstruction;
|
|
349
|
+
exports.getRequestHeapFrameInstructionDataCodec = getRequestHeapFrameInstructionDataCodec;
|
|
350
|
+
exports.getRequestHeapFrameInstructionDataDecoder = getRequestHeapFrameInstructionDataDecoder;
|
|
351
|
+
exports.getRequestHeapFrameInstructionDataEncoder = getRequestHeapFrameInstructionDataEncoder;
|
|
352
|
+
exports.getRequestHeapFrameInstructionRaw = getRequestHeapFrameInstructionRaw;
|
|
353
|
+
exports.getRequestUnitsInstruction = getRequestUnitsInstruction;
|
|
354
|
+
exports.getRequestUnitsInstructionDataCodec = getRequestUnitsInstructionDataCodec;
|
|
355
|
+
exports.getRequestUnitsInstructionDataDecoder = getRequestUnitsInstructionDataDecoder;
|
|
356
|
+
exports.getRequestUnitsInstructionDataEncoder = getRequestUnitsInstructionDataEncoder;
|
|
357
|
+
exports.getRequestUnitsInstructionRaw = getRequestUnitsInstructionRaw;
|
|
358
|
+
exports.getSetComputeUnitLimitInstruction = getSetComputeUnitLimitInstruction;
|
|
359
|
+
exports.getSetComputeUnitLimitInstructionDataCodec = getSetComputeUnitLimitInstructionDataCodec;
|
|
360
|
+
exports.getSetComputeUnitLimitInstructionDataDecoder = getSetComputeUnitLimitInstructionDataDecoder;
|
|
361
|
+
exports.getSetComputeUnitLimitInstructionDataEncoder = getSetComputeUnitLimitInstructionDataEncoder;
|
|
362
|
+
exports.getSetComputeUnitLimitInstructionRaw = getSetComputeUnitLimitInstructionRaw;
|
|
363
|
+
exports.getSetComputeUnitPriceInstruction = getSetComputeUnitPriceInstruction;
|
|
364
|
+
exports.getSetComputeUnitPriceInstructionDataCodec = getSetComputeUnitPriceInstructionDataCodec;
|
|
365
|
+
exports.getSetComputeUnitPriceInstructionDataDecoder = getSetComputeUnitPriceInstructionDataDecoder;
|
|
366
|
+
exports.getSetComputeUnitPriceInstructionDataEncoder = getSetComputeUnitPriceInstructionDataEncoder;
|
|
367
|
+
exports.getSetComputeUnitPriceInstructionRaw = getSetComputeUnitPriceInstructionRaw;
|
|
368
|
+
exports.getSetLoadedAccountsDataSizeLimitInstruction = getSetLoadedAccountsDataSizeLimitInstruction;
|
|
369
|
+
exports.getSetLoadedAccountsDataSizeLimitInstructionDataCodec = getSetLoadedAccountsDataSizeLimitInstructionDataCodec;
|
|
370
|
+
exports.getSetLoadedAccountsDataSizeLimitInstructionDataDecoder = getSetLoadedAccountsDataSizeLimitInstructionDataDecoder;
|
|
371
|
+
exports.getSetLoadedAccountsDataSizeLimitInstructionDataEncoder = getSetLoadedAccountsDataSizeLimitInstructionDataEncoder;
|
|
372
|
+
exports.getSetLoadedAccountsDataSizeLimitInstructionRaw = getSetLoadedAccountsDataSizeLimitInstructionRaw;
|
|
373
|
+
exports.identifyComputeBudgetInstruction = identifyComputeBudgetInstruction;
|
|
374
|
+
exports.isTransactionSigner = isTransactionSigner;
|
|
375
|
+
exports.memcmp = memcmp;
|
|
376
|
+
exports.parseRequestHeapFrameInstruction = parseRequestHeapFrameInstruction;
|
|
377
|
+
exports.parseRequestUnitsInstruction = parseRequestUnitsInstruction;
|
|
378
|
+
exports.parseSetComputeUnitLimitInstruction = parseSetComputeUnitLimitInstruction;
|
|
379
|
+
exports.parseSetComputeUnitPriceInstruction = parseSetComputeUnitPriceInstruction;
|
|
380
|
+
exports.parseSetLoadedAccountsDataSizeLimitInstruction = parseSetLoadedAccountsDataSizeLimitInstruction;
|
|
381
|
+
//# sourceMappingURL=out.js.map
|
|
382
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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;AASO,SAAS,iCACd,aAC6C;AAC7C,SAAO;AAAA,IACL,gBAAgB,YAAY;AAAA,IAC5B,MAAM,0CAA0C,EAAE,OAAO,YAAY,IAAI;AAAA,EAC3E;AACF;;;AC7IA;AAAA,EAIE,gBAAAA;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC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ACN,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"]}
|