@solana-program/compute-budget 0.11.0 → 0.12.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/dist/src/index.js +26 -84
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +27 -85
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/estimateAndSetComputeLimit.d.ts.map +1 -1
- package/dist/types/estimateComputeLimit.d.ts.map +1 -1
- package/dist/types/estimateComputeLimitInternal.d.ts.map +1 -1
- package/dist/types/generated/instructions/requestHeapFrame.d.ts.map +1 -1
- package/dist/types/generated/instructions/requestUnits.d.ts.map +1 -1
- package/dist/types/generated/instructions/setComputeUnitLimit.d.ts.map +1 -1
- package/dist/types/generated/instructions/setComputeUnitPrice.d.ts.map +1 -1
- package/dist/types/generated/instructions/setLoadedAccountsDataSizeLimit.d.ts.map +1 -1
- package/dist/types/generated/programs/computeBudget.d.ts.map +1 -1
- package/dist/types/generated/shared/index.d.ts.map +1 -1
- package/dist/types/internal.d.ts.map +1 -1
- package/dist/types/setComputeLimit.d.ts.map +1 -1
- package/dist/types/setComputePrice.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -29,9 +29,7 @@ function identifyComputeBudgetInstruction(instruction) {
|
|
|
29
29
|
if (kit.containsBytes(data, kit.getU8Encoder().encode(4), 0)) {
|
|
30
30
|
return 4 /* SetLoadedAccountsDataSizeLimit */;
|
|
31
31
|
}
|
|
32
|
-
throw new Error(
|
|
33
|
-
"The provided instruction could not be identified as a computeBudget instruction."
|
|
34
|
-
);
|
|
32
|
+
throw new Error("The provided instruction could not be identified as a computeBudget instruction.");
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
// src/generated/instructions/requestHeapFrame.ts
|
|
@@ -55,18 +53,13 @@ function getRequestHeapFrameInstructionDataDecoder() {
|
|
|
55
53
|
]);
|
|
56
54
|
}
|
|
57
55
|
function getRequestHeapFrameInstructionDataCodec() {
|
|
58
|
-
return kit.combineCodec(
|
|
59
|
-
getRequestHeapFrameInstructionDataEncoder(),
|
|
60
|
-
getRequestHeapFrameInstructionDataDecoder()
|
|
61
|
-
);
|
|
56
|
+
return kit.combineCodec(getRequestHeapFrameInstructionDataEncoder(), getRequestHeapFrameInstructionDataDecoder());
|
|
62
57
|
}
|
|
63
58
|
function getRequestHeapFrameInstruction(input, config) {
|
|
64
59
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
65
60
|
const args = { ...input };
|
|
66
61
|
return Object.freeze({
|
|
67
|
-
data: getRequestHeapFrameInstructionDataEncoder().encode(
|
|
68
|
-
args
|
|
69
|
-
),
|
|
62
|
+
data: getRequestHeapFrameInstructionDataEncoder().encode(args),
|
|
70
63
|
programAddress
|
|
71
64
|
});
|
|
72
65
|
}
|
|
@@ -98,18 +91,13 @@ function getRequestUnitsInstructionDataDecoder() {
|
|
|
98
91
|
]);
|
|
99
92
|
}
|
|
100
93
|
function getRequestUnitsInstructionDataCodec() {
|
|
101
|
-
return kit.combineCodec(
|
|
102
|
-
getRequestUnitsInstructionDataEncoder(),
|
|
103
|
-
getRequestUnitsInstructionDataDecoder()
|
|
104
|
-
);
|
|
94
|
+
return kit.combineCodec(getRequestUnitsInstructionDataEncoder(), getRequestUnitsInstructionDataDecoder());
|
|
105
95
|
}
|
|
106
96
|
function getRequestUnitsInstruction(input, config) {
|
|
107
97
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
108
98
|
const args = { ...input };
|
|
109
99
|
return Object.freeze({
|
|
110
|
-
data: getRequestUnitsInstructionDataEncoder().encode(
|
|
111
|
-
args
|
|
112
|
-
),
|
|
100
|
+
data: getRequestUnitsInstructionDataEncoder().encode(args),
|
|
113
101
|
programAddress
|
|
114
102
|
});
|
|
115
103
|
}
|
|
@@ -129,10 +117,7 @@ function getSetComputeUnitLimitInstructionDataEncoder() {
|
|
|
129
117
|
["discriminator", kit.getU8Encoder()],
|
|
130
118
|
["units", kit.getU32Encoder()]
|
|
131
119
|
]),
|
|
132
|
-
(value) => ({
|
|
133
|
-
...value,
|
|
134
|
-
discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR
|
|
135
|
-
})
|
|
120
|
+
(value) => ({ ...value, discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR })
|
|
136
121
|
);
|
|
137
122
|
}
|
|
138
123
|
function getSetComputeUnitLimitInstructionDataDecoder() {
|
|
@@ -142,27 +127,20 @@ function getSetComputeUnitLimitInstructionDataDecoder() {
|
|
|
142
127
|
]);
|
|
143
128
|
}
|
|
144
129
|
function getSetComputeUnitLimitInstructionDataCodec() {
|
|
145
|
-
return kit.combineCodec(
|
|
146
|
-
getSetComputeUnitLimitInstructionDataEncoder(),
|
|
147
|
-
getSetComputeUnitLimitInstructionDataDecoder()
|
|
148
|
-
);
|
|
130
|
+
return kit.combineCodec(getSetComputeUnitLimitInstructionDataEncoder(), getSetComputeUnitLimitInstructionDataDecoder());
|
|
149
131
|
}
|
|
150
132
|
function getSetComputeUnitLimitInstruction(input, config) {
|
|
151
133
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
152
134
|
const args = { ...input };
|
|
153
135
|
return Object.freeze({
|
|
154
|
-
data: getSetComputeUnitLimitInstructionDataEncoder().encode(
|
|
155
|
-
args
|
|
156
|
-
),
|
|
136
|
+
data: getSetComputeUnitLimitInstructionDataEncoder().encode(args),
|
|
157
137
|
programAddress
|
|
158
138
|
});
|
|
159
139
|
}
|
|
160
140
|
function parseSetComputeUnitLimitInstruction(instruction) {
|
|
161
141
|
return {
|
|
162
142
|
programAddress: instruction.programAddress,
|
|
163
|
-
data: getSetComputeUnitLimitInstructionDataDecoder().decode(
|
|
164
|
-
instruction.data
|
|
165
|
-
)
|
|
143
|
+
data: getSetComputeUnitLimitInstructionDataDecoder().decode(instruction.data)
|
|
166
144
|
};
|
|
167
145
|
}
|
|
168
146
|
var SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;
|
|
@@ -175,10 +153,7 @@ function getSetComputeUnitPriceInstructionDataEncoder() {
|
|
|
175
153
|
["discriminator", kit.getU8Encoder()],
|
|
176
154
|
["microLamports", kit.getU64Encoder()]
|
|
177
155
|
]),
|
|
178
|
-
(value) => ({
|
|
179
|
-
...value,
|
|
180
|
-
discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR
|
|
181
|
-
})
|
|
156
|
+
(value) => ({ ...value, discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR })
|
|
182
157
|
);
|
|
183
158
|
}
|
|
184
159
|
function getSetComputeUnitPriceInstructionDataDecoder() {
|
|
@@ -188,34 +163,25 @@ function getSetComputeUnitPriceInstructionDataDecoder() {
|
|
|
188
163
|
]);
|
|
189
164
|
}
|
|
190
165
|
function getSetComputeUnitPriceInstructionDataCodec() {
|
|
191
|
-
return kit.combineCodec(
|
|
192
|
-
getSetComputeUnitPriceInstructionDataEncoder(),
|
|
193
|
-
getSetComputeUnitPriceInstructionDataDecoder()
|
|
194
|
-
);
|
|
166
|
+
return kit.combineCodec(getSetComputeUnitPriceInstructionDataEncoder(), getSetComputeUnitPriceInstructionDataDecoder());
|
|
195
167
|
}
|
|
196
168
|
function getSetComputeUnitPriceInstruction(input, config) {
|
|
197
169
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
198
170
|
const args = { ...input };
|
|
199
171
|
return Object.freeze({
|
|
200
|
-
data: getSetComputeUnitPriceInstructionDataEncoder().encode(
|
|
201
|
-
args
|
|
202
|
-
),
|
|
172
|
+
data: getSetComputeUnitPriceInstructionDataEncoder().encode(args),
|
|
203
173
|
programAddress
|
|
204
174
|
});
|
|
205
175
|
}
|
|
206
176
|
function parseSetComputeUnitPriceInstruction(instruction) {
|
|
207
177
|
return {
|
|
208
178
|
programAddress: instruction.programAddress,
|
|
209
|
-
data: getSetComputeUnitPriceInstructionDataDecoder().decode(
|
|
210
|
-
instruction.data
|
|
211
|
-
)
|
|
179
|
+
data: getSetComputeUnitPriceInstructionDataDecoder().decode(instruction.data)
|
|
212
180
|
};
|
|
213
181
|
}
|
|
214
182
|
var SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;
|
|
215
183
|
function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes() {
|
|
216
|
-
return kit.getU8Encoder().encode(
|
|
217
|
-
SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR
|
|
218
|
-
);
|
|
184
|
+
return kit.getU8Encoder().encode(SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR);
|
|
219
185
|
}
|
|
220
186
|
function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder() {
|
|
221
187
|
return kit.transformEncoder(
|
|
@@ -223,10 +189,7 @@ function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder() {
|
|
|
223
189
|
["discriminator", kit.getU8Encoder()],
|
|
224
190
|
["accountDataSizeLimit", kit.getU32Encoder()]
|
|
225
191
|
]),
|
|
226
|
-
(value) => ({
|
|
227
|
-
...value,
|
|
228
|
-
discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR
|
|
229
|
-
})
|
|
192
|
+
(value) => ({ ...value, discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR })
|
|
230
193
|
);
|
|
231
194
|
}
|
|
232
195
|
function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder() {
|
|
@@ -254,9 +217,7 @@ function getSetLoadedAccountsDataSizeLimitInstruction(input, config) {
|
|
|
254
217
|
function parseSetLoadedAccountsDataSizeLimitInstruction(instruction) {
|
|
255
218
|
return {
|
|
256
219
|
programAddress: instruction.programAddress,
|
|
257
|
-
data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(
|
|
258
|
-
instruction.data
|
|
259
|
-
)
|
|
220
|
+
data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(instruction.data)
|
|
260
221
|
};
|
|
261
222
|
}
|
|
262
223
|
|
|
@@ -268,16 +229,11 @@ function getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage) {
|
|
|
268
229
|
if (index < 0) {
|
|
269
230
|
return null;
|
|
270
231
|
}
|
|
271
|
-
const units = kit.getU32Decoder().decode(
|
|
272
|
-
transactionMessage.instructions[index].data,
|
|
273
|
-
1
|
|
274
|
-
);
|
|
232
|
+
const units = kit.getU32Decoder().decode(transactionMessage.instructions[index].data, 1);
|
|
275
233
|
return { index, units };
|
|
276
234
|
}
|
|
277
235
|
function getSetComputeUnitLimitInstructionIndex(transactionMessage) {
|
|
278
|
-
return transactionMessage.instructions.findIndex(
|
|
279
|
-
isSetComputeUnitLimitInstruction
|
|
280
|
-
);
|
|
236
|
+
return transactionMessage.instructions.findIndex(isSetComputeUnitLimitInstruction);
|
|
281
237
|
}
|
|
282
238
|
function isSetComputeUnitLimitInstruction(instruction) {
|
|
283
239
|
return instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && identifyComputeBudgetInstruction(instruction.data) === 2 /* SetComputeUnitLimit */;
|
|
@@ -294,9 +250,7 @@ function getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessa
|
|
|
294
250
|
return { index, microLamports };
|
|
295
251
|
}
|
|
296
252
|
function getSetComputeUnitPriceInstructionIndex(transactionMessage) {
|
|
297
|
-
return transactionMessage.instructions.findIndex(
|
|
298
|
-
isSetComputeUnitPriceInstruction
|
|
299
|
-
);
|
|
253
|
+
return transactionMessage.instructions.findIndex(isSetComputeUnitPriceInstruction);
|
|
300
254
|
}
|
|
301
255
|
function isSetComputeUnitPriceInstruction(instruction) {
|
|
302
256
|
return instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && identifyComputeBudgetInstruction(instruction.data) === 3 /* SetComputeUnitPrice */;
|
|
@@ -375,31 +329,19 @@ async function simulateTransactionAndGetConsumedUnits({
|
|
|
375
329
|
sigVerify: false
|
|
376
330
|
}).send({ abortSignal });
|
|
377
331
|
if (unitsConsumed == null) {
|
|
378
|
-
throw new kit.SolanaError(
|
|
379
|
-
kit.SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT
|
|
380
|
-
);
|
|
332
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT);
|
|
381
333
|
}
|
|
382
334
|
const downcastUnitsConsumed = unitsConsumed > 4294967295n ? 4294967295 : Number(unitsConsumed);
|
|
383
335
|
if (transactionError) {
|
|
384
|
-
throw new kit.SolanaError(
|
|
385
|
-
kit.
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
unitsConsumed: downcastUnitsConsumed
|
|
389
|
-
}
|
|
390
|
-
);
|
|
336
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, {
|
|
337
|
+
cause: kit.getSolanaErrorFromTransactionError(transactionError),
|
|
338
|
+
unitsConsumed: downcastUnitsConsumed
|
|
339
|
+
});
|
|
391
340
|
}
|
|
392
341
|
return downcastUnitsConsumed;
|
|
393
342
|
} catch (e) {
|
|
394
|
-
if (kit.isSolanaError(
|
|
395
|
-
|
|
396
|
-
kit.SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT
|
|
397
|
-
))
|
|
398
|
-
throw e;
|
|
399
|
-
throw new kit.SolanaError(
|
|
400
|
-
kit.SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,
|
|
401
|
-
{ cause: e }
|
|
402
|
-
);
|
|
343
|
+
if (kit.isSolanaError(e, kit.SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT)) throw e;
|
|
344
|
+
throw new kit.SolanaError(kit.SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, { cause: e });
|
|
403
345
|
}
|
|
404
346
|
}
|
|
405
347
|
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generated/programs/computeBudget.ts","../../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/constants.ts","../../src/internal.ts","../../src/setComputeLimit.ts","../../src/estimateAndSetComputeLimit.ts","../../src/estimateComputeLimitInternal.ts","../../src/estimateComputeLimit.ts","../../src/setComputePrice.ts"],"names":["ComputeBudgetInstruction","containsBytes","getU8Encoder","transformEncoder","getStructEncoder","getU32Encoder","getStructDecoder","getU8Decoder","getU32Decoder","combineCodec","getU64Encoder","getU64Decoder","previousUnits","appendTransactionMessageInstruction","estimateComputeUnitLimit","isTransactionMessageWithDurableNonceLifetime","pipe","compileTransaction","getBase64EncodedWireTransaction","SolanaError","SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT","SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT","isSolanaError","previousMicroLamports"],"mappings":";;;;;AAsBO,IAAM,8BACX,GAAA;AAEU,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACL,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA;AACA,EAAAA,yBAA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kC,CAAA;AAAA,IACvD,aAAe,EAAA;AAAA,GAChB,CAAA;AACD,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACnB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA;AAAA,GACf,CAAA;AACH","file":"index.js","sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n containsBytes,\n getU8Encoder,\n type Address,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n type ParsedRequestHeapFrameInstruction,\n type ParsedRequestUnitsInstruction,\n type ParsedSetComputeUnitLimitInstruction,\n type ParsedSetComputeUnitPriceInstruction,\n type 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: ReadonlyUint8Array } | ReadonlyUint8Array\n): ComputeBudgetInstruction {\n const data = 'data' in instruction ? instruction.data : instruction;\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;\n\nexport function getRequestHeapFrameDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_HEAP_FRAME_DISCRIMINATOR);\n}\n\nexport type RequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR })\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): FixedSizeDecoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: RequestHeapFrameInput,\n config?: { programAddress?: TProgramAddress }\n): RequestHeapFrameInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n programAddress,\n } as RequestHeapFrameInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_UNITS_DISCRIMINATOR = 0;\n\nexport function getRequestUnitsDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_UNITS_DISCRIMINATOR);\n}\n\nexport type RequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR })\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): FixedSizeDecoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: RequestUnitsInput,\n config?: { programAddress?: TProgramAddress }\n): RequestUnitsInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n programAddress,\n } as RequestUnitsInstruction<TProgramAddress>);\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = { programAddress: Address<TProgram>; data: RequestUnitsInstructionData };\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;\n\nexport function getSetComputeUnitLimitDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitLimitInput,\n config?: { programAddress?: TProgramAddress }\n): SetComputeUnitLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n programAddress,\n } as SetComputeUnitLimitInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;\n\nexport function getSetComputeUnitPriceDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitPriceInput,\n config?: { programAddress?: TProgramAddress }\n): SetComputeUnitPriceInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n programAddress,\n } as SetComputeUnitPriceInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;\n\nexport function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes() {\n return getU8Encoder().encode(\n SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR\n );\n}\n\nexport type SetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = {\n discriminator: number;\n accountDataSizeLimit: number;\n};\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {\n accountDataSizeLimit: number;\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetLoadedAccountsDataSizeLimitInput,\n config?: { programAddress?: TProgramAddress }\n): SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n programAddress,\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * A provisory compute unit limit is used to indicate that the transaction\n * should be estimated for compute units before being sent to the network.\n *\n * Setting it to zero ensures the transaction fails unless it is properly estimated.\n */\nexport const PROVISORY_COMPUTE_UNIT_LIMIT = 0;\n\n/**\n * The maximum compute unit limit that can be set for a transaction.\n */\nexport const MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n","import {\n BaseTransactionMessage,\n getU32Decoder,\n getU64Decoder,\n Instruction,\n MicroLamports,\n ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n COMPUTE_BUDGET_PROGRAM_ADDRESS,\n ComputeBudgetInstruction,\n identifyComputeBudgetInstruction,\n SetComputeUnitLimitInstruction,\n SetComputeUnitPriceInstruction,\n} from './generated';\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message\n * and its set limit, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndexAndUnits(\n transactionMessage: BaseTransactionMessage\n): { index: number; units: number } | null {\n const index = getSetComputeUnitLimitInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const units = getU32Decoder().decode(\n transactionMessage.instructions[index].data as ReadonlyUint8Array,\n 1\n );\n\n return { index, units };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndex(\n transactionMessage: BaseTransactionMessage\n) {\n return transactionMessage.instructions.findIndex(\n isSetComputeUnitLimitInstruction\n );\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitLimit` instruction.\n */\nexport function isSetComputeUnitLimitInstruction(\n instruction: Instruction\n): instruction is SetComputeUnitLimitInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitLimit\n );\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message\n * and its set micro-lamports, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndexAndMicroLamports(\n transactionMessage: BaseTransactionMessage\n): { index: number; microLamports: MicroLamports } | null {\n const index = getSetComputeUnitPriceInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const microLamports = getU64Decoder().decode(\n transactionMessage.instructions[index].data as ReadonlyUint8Array,\n 1\n ) as MicroLamports;\n\n return { index, microLamports };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndex(\n transactionMessage: BaseTransactionMessage\n) {\n return transactionMessage.instructions.findIndex(\n isSetComputeUnitPriceInstruction\n );\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitPrice` instruction.\n */\nexport function isSetComputeUnitPriceInstruction(\n instruction: Instruction\n): instruction is SetComputeUnitPriceInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitPrice\n );\n}\n","import {\n appendTransactionMessageInstruction,\n BaseTransactionMessage,\n} from '@solana/kit';\nimport { PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';\nimport { getSetComputeUnitLimitInstruction } from './generated';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\n\n/**\n * Appends a `SetComputeUnitLimit` instruction with a provisory\n * compute unit limit to a given transaction message\n * if and only if it does not already have one.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * fillProvisorySetComputeUnitLimitInstruction,\n * // ...\n * );\n * ```\n */\nexport function fillProvisorySetComputeUnitLimitInstruction<\n TTransactionMessage extends BaseTransactionMessage,\n>(transactionMessage: TTransactionMessage) {\n return updateOrAppendSetComputeUnitLimitInstruction(\n (previousUnits) =>\n previousUnits === null ? PROVISORY_COMPUTE_UNIT_LIMIT : previousUnits,\n transactionMessage\n );\n}\n\n/**\n * Updates the first `SetComputeUnitLimit` instruction in a transaction message\n * with the given units, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param units - The new compute unit limit, or a function that takes the previous\n * compute unit limit and returns the new limit.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitLimitInstruction(\n * // E.g. Keep the current limit if it is set, otherwise set it to the maximum.\n * (currentUnits) => currentUnits === null ? MAX_COMPUTE_UNIT_LIMIT : currentUnits,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitLimitInstruction<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n units: number | ((previousUnits: number | null) => number),\n transactionMessage: TTransactionMessage\n): TTransactionMessage {\n const getUnits = (previousUnits: number | null): number =>\n typeof units === 'function' ? units(previousUnits) : units;\n const instructionDetails =\n getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitLimitInstruction({ units: getUnits(null) }),\n transactionMessage\n ) as unknown as TTransactionMessage;\n }\n\n const { index, units: previousUnits } = instructionDetails;\n const newUnits = getUnits(previousUnits);\n if (newUnits === previousUnits) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitLimitInstruction({ units: newUnits });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n","import {\n BaseTransactionMessage,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport {\n MAX_COMPUTE_UNIT_LIMIT,\n PROVISORY_COMPUTE_UNIT_LIMIT,\n} from './constants';\nimport {\n EstimateComputeUnitLimitFactoryFunction,\n EstimateComputeUnitLimitFactoryFunctionConfig,\n} from './estimateComputeLimitInternal';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\n\ntype EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <\n TTransactionMessage extends BaseTransactionMessage &\n TransactionMessageWithFeePayer,\n>(\n transactionMessage: TTransactionMessage,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig\n) => Promise<TTransactionMessage>;\n\n/**\n * Given a transaction message, if it does not have an explicit compute unit limit,\n * estimates the compute unit limit and updates the transaction message with\n * the estimated limit. Otherwise, returns the transaction message unchanged.\n *\n * It requires a function that estimates the compute unit limit.\n *\n * @example\n * ```ts\n * const estimateAndUpdateCUs = estimateAndUpdateProvisoryComputeUnitLimitFactory(\n * estimateComputeUnitLimitFactory({ rpc })\n * );\n *\n * const transactionMessageWithCUs = await estimateAndUpdateCUs(transactionMessage);\n * ```\n *\n * @see {@link estimateAndUpdateProvisoryComputeUnitLimitFactory}\n */\nexport function estimateAndUpdateProvisoryComputeUnitLimitFactory(\n estimateComputeUnitLimit: EstimateComputeUnitLimitFactoryFunction\n): EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction {\n return async function fn(transactionMessage, config) {\n const instructionDetails =\n getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n // If the transaction message already has a compute unit limit instruction\n // which is set to a specific value — i.e. not 0 or the maximum limit —\n // we don't need to estimate the compute unit limit.\n if (\n instructionDetails &&\n instructionDetails.units !== PROVISORY_COMPUTE_UNIT_LIMIT &&\n instructionDetails.units !== MAX_COMPUTE_UNIT_LIMIT\n ) {\n return transactionMessage;\n }\n\n return updateOrAppendSetComputeUnitLimitInstruction(\n await estimateComputeUnitLimit(transactionMessage, config),\n transactionMessage\n );\n };\n}\n","import {\n BaseTransactionMessage,\n Commitment,\n compileTransaction,\n getBase64EncodedWireTransaction,\n isSolanaError,\n isTransactionMessageWithDurableNonceLifetime,\n pipe,\n Rpc,\n SimulateTransactionApi,\n Slot,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SolanaError,\n Transaction,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\nimport { MAX_COMPUTE_UNIT_LIMIT } from './constants';\n\nexport type EstimateComputeUnitLimitFactoryConfig = Readonly<{\n /** An object that supports the {@link SimulateTransactionApi} of the Solana RPC API */\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\nexport type EstimateComputeUnitLimitFactoryFunction = (\n transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig\n) => Promise<number>;\n\nexport type EstimateComputeUnitLimitFactoryFunctionConfig = {\n abortSignal?: AbortSignal;\n /**\n * Compute the estimate as of the highest slot that has reached this level of commitment.\n *\n * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For\n * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment\n * is `\"confirmed\"` unless configured otherwise. Unmitigated by an API layer on the client, the\n * default commitment applied by the server is `\"finalized\"`.\n */\n commitment?: Commitment;\n /**\n * Prevents accessing stale data by enforcing that the RPC node has processed transactions up to\n * this slot\n */\n minContextSlot?: Slot;\n};\n\ntype EstimateComputeUnitLimitConfig =\n EstimateComputeUnitLimitFactoryFunctionConfig &\n Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n transactionMessage: BaseTransactionMessage &\n TransactionMessageWithFeePayer;\n }>;\n\n/**\n * Simulates a transaction message on the network and returns the number of compute units it\n * consumed during simulation.\n *\n * The estimate this function returns can be used to set a compute unit limit on the transaction.\n * Correctly budgeting a compute unit limit for your transaction message can increase the probability\n * that your transaction will be accepted for processing.\n *\n * If you don't declare a compute unit limit on your transaction, validators will assume an upper\n * limit of 200K compute units (CU) per instruction. Since validators have an incentive to pack as\n * many transactions into each block as possible, they may choose to include transactions that they\n * know will fit into the remaining compute budget for the current block over transactions that\n * might not. For this reason, you should set a compute unit limit on each of your transaction\n * messages, whenever possible.\n *\n * ## Example\n *\n * ```ts\n * import { getSetComputeLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, getComputeUnitEstimateForTransactionMessageFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const getComputeUnitEstimateForTransactionMessage =\n * getComputeUnitEstimateForTransactionMessageFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume.\n * const computeUnitsEstimate =\n * await getComputeUnitEstimateForTransactionMessage(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeLimitInstruction({ units: computeUnitsEstimate }),\n * transactionMessage,\n * );\n * ```\n *\n * > [!WARNING]\n * > The compute unit estimate is just that – an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n */\nexport async function estimateComputeUnitLimit({\n transactionMessage,\n ...configs\n}: EstimateComputeUnitLimitConfig): Promise<number> {\n const replaceRecentBlockhash =\n !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n const transaction = pipe(\n transactionMessage,\n (m) =>\n updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m),\n compileTransaction\n );\n\n return await simulateTransactionAndGetConsumedUnits({\n transaction,\n replaceRecentBlockhash,\n ...configs,\n });\n}\n\ntype SimulateTransactionAndGetConsumedUnitsConfig = Omit<\n EstimateComputeUnitLimitConfig,\n 'transactionMessage'\n> &\n Readonly<{ replaceRecentBlockhash?: boolean; transaction: Transaction }>;\n\nasync function simulateTransactionAndGetConsumedUnits({\n abortSignal,\n rpc,\n transaction,\n ...simulateConfig\n}: SimulateTransactionAndGetConsumedUnitsConfig): Promise<number> {\n const wireTransactionBytes = getBase64EncodedWireTransaction(transaction);\n\n try {\n const {\n value: { err: transactionError, unitsConsumed },\n } = await rpc\n .simulateTransaction(wireTransactionBytes, {\n ...simulateConfig,\n encoding: 'base64',\n sigVerify: false,\n })\n .send({ abortSignal });\n if (unitsConsumed == null) {\n // This should never be hit, because all RPCs should support `unitsConsumed` by now.\n throw new SolanaError(\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT\n );\n }\n // FIXME(https://github.com/anza-xyz/agave/issues/1295): The simulation response returns\n // compute units as a u64, but the `SetComputeLimit` instruction only accepts a u32. Until\n // this changes, downcast it.\n const downcastUnitsConsumed =\n unitsConsumed > 4_294_967_295n ? 4_294_967_295 : Number(unitsConsumed);\n if (transactionError) {\n throw new SolanaError(\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n {\n cause: transactionError,\n unitsConsumed: downcastUnitsConsumed,\n }\n );\n }\n return downcastUnitsConsumed;\n } catch (e) {\n if (\n isSolanaError(\n e,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT\n )\n )\n throw e;\n throw new SolanaError(\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n { cause: e }\n );\n }\n}\n","import {\n estimateComputeUnitLimit,\n EstimateComputeUnitLimitFactoryConfig,\n EstimateComputeUnitLimitFactoryFunction,\n} from './estimateComputeLimitInternal';\n\n/**\n * Use this utility to estimate the actual compute unit cost of a given transaction message.\n *\n * Correctly budgeting a compute unit limit for your transaction message can increase the\n * probability that your transaction will be accepted for processing. If you don't declare a compute\n * unit limit on your transaction, validators will assume an upper limit of 200K compute units (CU)\n * per instruction.\n *\n * Since validators have an incentive to pack as many transactions into each block as possible, they\n * may choose to include transactions that they know will fit into the remaining compute budget for\n * the current block over transactions that might not. For this reason, you should set a compute\n * unit limit on each of your transaction messages, whenever possible.\n *\n * > [!WARNING]\n * > The compute unit estimate is just that -- an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n *\n * > [!INFO]\n * > In the event that a transaction message does not already have a `SetComputeUnitLimit`\n * > instruction, this function will add one before simulation. This ensures that the compute unit\n * > consumption of the `SetComputeUnitLimit` instruction itself is included in the estimate.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { getSetComputeUnitLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, estimateComputeUnitLimitFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const estimateComputeUnitLimit = estimateComputeUnitLimitFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume. This is done by\n * // simulating the transaction and grabbing the estimated compute units from the result.\n * const estimatedUnits = await estimateComputeUnitLimit(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeUnitLimitInstruction({ units: estimatedUnits }),\n * transactionMessage,\n * );\n * ```\n */\nexport function estimateComputeUnitLimitFactory({\n rpc,\n}: EstimateComputeUnitLimitFactoryConfig): EstimateComputeUnitLimitFactoryFunction {\n return async function estimateComputeUnitLimitFactoryFunction(\n transactionMessage,\n config\n ) {\n return await estimateComputeUnitLimit({\n ...config,\n rpc,\n transactionMessage,\n });\n };\n}\n","import {\n appendTransactionMessageInstruction,\n BaseTransactionMessage,\n MicroLamports,\n} from '@solana/kit';\nimport { getSetComputeUnitPriceInstruction } from './generated';\nimport { getSetComputeUnitPriceInstructionIndexAndMicroLamports } from './internal';\n\n/**\n * Sets the compute unit price of a transaction message in micro-Lamports.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * (m) => setTransactionMessageComputeUnitPrice(10_000, m),\n * // ...\n * );\n * ```\n */\nexport function setTransactionMessageComputeUnitPrice<\n TTransactionMessage extends BaseTransactionMessage,\n>(microLamports: number | bigint, transactionMessage: TTransactionMessage) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({ microLamports }),\n transactionMessage\n );\n}\n\n/**\n * Updates the first `SetComputeUnitPrice` instruction in a transaction message\n * with the given micro-Lamports, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param microLamports - The new compute unit price, or a function that\n * takes the previous price and returns the new one.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitPriceInstruction(\n * // E.g. double the current price or set it to 10_000 if it isn't set.\n * (currentPrice) => currentPrice === null ? 10_000 : currentPrice * 2,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitPriceInstruction<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n microLamports:\n | MicroLamports\n | ((previousMicroLamports: MicroLamports | null) => MicroLamports),\n transactionMessage: TTransactionMessage\n): TTransactionMessage {\n const getMicroLamports = (\n previousMicroLamports: MicroLamports | null\n ): MicroLamports =>\n typeof microLamports === 'function'\n ? microLamports(previousMicroLamports)\n : microLamports;\n const instructionDetails =\n getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({\n microLamports: getMicroLamports(null),\n }),\n transactionMessage\n ) as unknown as TTransactionMessage;\n }\n\n const { index, microLamports: previousMicroLamports } = instructionDetails;\n const newMicroLamports = getMicroLamports(previousMicroLamports);\n if (newMicroLamports === previousMicroLamports) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitPriceInstruction({\n microLamports: newMicroLamports,\n });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/generated/programs/computeBudget.ts","../../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/constants.ts","../../src/internal.ts","../../src/setComputeLimit.ts","../../src/estimateAndSetComputeLimit.ts","../../src/estimateComputeLimitInternal.ts","../../src/estimateComputeLimit.ts","../../src/setComputePrice.ts"],"names":["ComputeBudgetInstruction","containsBytes","getU8Encoder","transformEncoder","getStructEncoder","getU32Encoder","getStructDecoder","getU8Decoder","getU32Decoder","combineCodec","getU64Encoder","getU64Decoder","previousUnits","appendTransactionMessageInstruction","estimateComputeUnitLimit","isTransactionMessageWithDurableNonceLifetime","pipe","compileTransaction","getBase64EncodedWireTransaction","SolanaError","SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT","SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT","getSolanaErrorFromTransactionError","isSolanaError","previousMicroLamports"],"mappings":";;;;;AAiBO,IAAM,8BACT,GAAA;AAEQ,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACH,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAA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,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACjB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA;AAAA,GACjB,CAAA;AACL","file":"index.js","sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { containsBytes, getU8Encoder, type Address, type ReadonlyUint8Array } from '@solana/kit';\nimport {\n type ParsedRequestHeapFrameInstruction,\n type ParsedRequestUnitsInstruction,\n type ParsedSetComputeUnitLimitInstruction,\n type ParsedSetComputeUnitPriceInstruction,\n type 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: ReadonlyUint8Array } | ReadonlyUint8Array,\n): ComputeBudgetInstruction {\n const data = 'data' in instruction ? instruction.data : instruction;\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('The provided instruction could not be identified as a computeBudget instruction.');\n}\n\nexport type ParsedComputeBudgetInstruction<TProgram extends string = 'ComputeBudget111111111111111111111111111111'> =\n | ({ instructionType: ComputeBudgetInstruction.RequestUnits } & ParsedRequestUnitsInstruction<TProgram>)\n | ({ instructionType: ComputeBudgetInstruction.RequestHeapFrame } & 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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;\n\nexport function getRequestHeapFrameDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_HEAP_FRAME_DISCRIMINATOR);\n}\n\nexport type RequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR }),\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): FixedSizeDecoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): FixedSizeCodec<\n RequestHeapFrameInstructionDataArgs,\n RequestHeapFrameInstructionData\n> {\n return combineCodec(getRequestHeapFrameInstructionDataEncoder(), getRequestHeapFrameInstructionDataDecoder());\n}\n\nexport type RequestHeapFrameInput = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport function getRequestHeapFrameInstruction<TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>(\n input: RequestHeapFrameInput,\n config?: { programAddress?: TProgramAddress },\n): RequestHeapFrameInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestHeapFrameInstructionDataEncoder().encode(args as RequestHeapFrameInstructionDataArgs),\n programAddress,\n } as RequestHeapFrameInstruction<TProgramAddress>);\n}\n\nexport type ParsedRequestHeapFrameInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_UNITS_DISCRIMINATOR = 0;\n\nexport function getRequestUnitsDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_UNITS_DISCRIMINATOR);\n}\n\nexport type RequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR }),\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): FixedSizeDecoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): FixedSizeCodec<\n RequestUnitsInstructionDataArgs,\n RequestUnitsInstructionData\n> {\n return combineCodec(getRequestUnitsInstructionDataEncoder(), getRequestUnitsInstructionDataDecoder());\n}\n\nexport type RequestUnitsInput = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport function getRequestUnitsInstruction<TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>(\n input: RequestUnitsInput,\n config?: { programAddress?: TProgramAddress },\n): RequestUnitsInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestUnitsInstructionDataEncoder().encode(args as RequestUnitsInstructionDataArgs),\n programAddress,\n } as RequestUnitsInstruction<TProgramAddress>);\n}\n\nexport type ParsedRequestUnitsInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;\n\nexport function getSetComputeUnitLimitDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR }),\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): FixedSizeCodec<\n SetComputeUnitLimitInstructionDataArgs,\n SetComputeUnitLimitInstructionData\n> {\n return combineCodec(getSetComputeUnitLimitInstructionDataEncoder(), getSetComputeUnitLimitInstructionDataDecoder());\n}\n\nexport type SetComputeUnitLimitInput = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport function getSetComputeUnitLimitInstruction<\n TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitLimitInput,\n config?: { programAddress?: TProgramAddress },\n): SetComputeUnitLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(args as SetComputeUnitLimitInstructionDataArgs),\n programAddress,\n } as SetComputeUnitLimitInstruction<TProgramAddress>);\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedSetComputeUnitLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitLimitInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;\n\nexport function getSetComputeUnitPriceDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n value => ({ ...value, discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR }),\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<\n SetComputeUnitPriceInstructionDataArgs,\n SetComputeUnitPriceInstructionData\n> {\n return combineCodec(getSetComputeUnitPriceInstructionDataEncoder(), getSetComputeUnitPriceInstructionDataDecoder());\n}\n\nexport type SetComputeUnitPriceInput = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport function getSetComputeUnitPriceInstruction<\n TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitPriceInput,\n config?: { programAddress?: TProgramAddress },\n): SetComputeUnitPriceInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(args as SetComputeUnitPriceInstructionDataArgs),\n programAddress,\n } as SetComputeUnitPriceInstruction<TProgramAddress>);\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedSetComputeUnitPriceInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitPriceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;\n\nexport function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes() {\n return getU8Encoder().encode(SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR);\n}\n\nexport type SetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = { discriminator: number; accountDataSizeLimit: number };\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = { accountDataSizeLimit: number };\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR }),\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetLoadedAccountsDataSizeLimitInput,\n config?: { programAddress?: TProgramAddress },\n): SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n ),\n programAddress,\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>);\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = { programAddress: Address<TProgram>; data: SetLoadedAccountsDataSizeLimitInstructionData };\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * A provisory compute unit limit is used to indicate that the transaction\n * should be estimated for compute units before being sent to the network.\n *\n * Setting it to zero ensures the transaction fails unless it is properly estimated.\n */\nexport const PROVISORY_COMPUTE_UNIT_LIMIT = 0;\n\n/**\n * The maximum compute unit limit that can be set for a transaction.\n */\nexport const MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n","import {\n BaseTransactionMessage,\n getU32Decoder,\n getU64Decoder,\n Instruction,\n MicroLamports,\n ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n COMPUTE_BUDGET_PROGRAM_ADDRESS,\n ComputeBudgetInstruction,\n identifyComputeBudgetInstruction,\n SetComputeUnitLimitInstruction,\n SetComputeUnitPriceInstruction,\n} from './generated';\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message\n * and its set limit, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndexAndUnits(\n transactionMessage: BaseTransactionMessage,\n): { index: number; units: number } | null {\n const index = getSetComputeUnitLimitInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const units = getU32Decoder().decode(transactionMessage.instructions[index].data as ReadonlyUint8Array, 1);\n\n return { index, units };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndex(transactionMessage: BaseTransactionMessage) {\n return transactionMessage.instructions.findIndex(isSetComputeUnitLimitInstruction);\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitLimit` instruction.\n */\nexport function isSetComputeUnitLimitInstruction(\n instruction: Instruction,\n): instruction is SetComputeUnitLimitInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitLimit\n );\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message\n * and its set micro-lamports, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndexAndMicroLamports(\n transactionMessage: BaseTransactionMessage,\n): { index: number; microLamports: MicroLamports } | null {\n const index = getSetComputeUnitPriceInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const microLamports = getU64Decoder().decode(\n transactionMessage.instructions[index].data as ReadonlyUint8Array,\n 1,\n ) as MicroLamports;\n\n return { index, microLamports };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndex(transactionMessage: BaseTransactionMessage) {\n return transactionMessage.instructions.findIndex(isSetComputeUnitPriceInstruction);\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitPrice` instruction.\n */\nexport function isSetComputeUnitPriceInstruction(\n instruction: Instruction,\n): instruction is SetComputeUnitPriceInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitPrice\n );\n}\n","import { appendTransactionMessageInstruction, BaseTransactionMessage } from '@solana/kit';\nimport { PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';\nimport { getSetComputeUnitLimitInstruction } from './generated';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\n\n/**\n * Appends a `SetComputeUnitLimit` instruction with a provisory\n * compute unit limit to a given transaction message\n * if and only if it does not already have one.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * fillProvisorySetComputeUnitLimitInstruction,\n * // ...\n * );\n * ```\n */\nexport function fillProvisorySetComputeUnitLimitInstruction<TTransactionMessage extends BaseTransactionMessage>(\n transactionMessage: TTransactionMessage,\n) {\n return updateOrAppendSetComputeUnitLimitInstruction(\n previousUnits => (previousUnits === null ? PROVISORY_COMPUTE_UNIT_LIMIT : previousUnits),\n transactionMessage,\n );\n}\n\n/**\n * Updates the first `SetComputeUnitLimit` instruction in a transaction message\n * with the given units, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param units - The new compute unit limit, or a function that takes the previous\n * compute unit limit and returns the new limit.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitLimitInstruction(\n * // E.g. Keep the current limit if it is set, otherwise set it to the maximum.\n * (currentUnits) => currentUnits === null ? MAX_COMPUTE_UNIT_LIMIT : currentUnits,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitLimitInstruction<TTransactionMessage extends BaseTransactionMessage>(\n units: number | ((previousUnits: number | null) => number),\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n const getUnits = (previousUnits: number | null): number =>\n typeof units === 'function' ? units(previousUnits) : units;\n const instructionDetails = getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitLimitInstruction({ units: getUnits(null) }),\n transactionMessage,\n ) as unknown as TTransactionMessage;\n }\n\n const { index, units: previousUnits } = instructionDetails;\n const newUnits = getUnits(previousUnits);\n if (newUnits === previousUnits) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitLimitInstruction({ units: newUnits });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n","import { BaseTransactionMessage, TransactionMessageWithFeePayer } from '@solana/kit';\nimport { MAX_COMPUTE_UNIT_LIMIT, PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';\nimport {\n EstimateComputeUnitLimitFactoryFunction,\n EstimateComputeUnitLimitFactoryFunctionConfig,\n} from './estimateComputeLimitInternal';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\n\ntype EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <\n TTransactionMessage extends BaseTransactionMessage & TransactionMessageWithFeePayer,\n>(\n transactionMessage: TTransactionMessage,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig,\n) => Promise<TTransactionMessage>;\n\n/**\n * Given a transaction message, if it does not have an explicit compute unit limit,\n * estimates the compute unit limit and updates the transaction message with\n * the estimated limit. Otherwise, returns the transaction message unchanged.\n *\n * It requires a function that estimates the compute unit limit.\n *\n * @example\n * ```ts\n * const estimateAndUpdateCUs = estimateAndUpdateProvisoryComputeUnitLimitFactory(\n * estimateComputeUnitLimitFactory({ rpc })\n * );\n *\n * const transactionMessageWithCUs = await estimateAndUpdateCUs(transactionMessage);\n * ```\n *\n * @see {@link estimateAndUpdateProvisoryComputeUnitLimitFactory}\n */\nexport function estimateAndUpdateProvisoryComputeUnitLimitFactory(\n estimateComputeUnitLimit: EstimateComputeUnitLimitFactoryFunction,\n): EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction {\n return async function fn(transactionMessage, config) {\n const instructionDetails = getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n // If the transaction message already has a compute unit limit instruction\n // which is set to a specific value — i.e. not 0 or the maximum limit —\n // we don't need to estimate the compute unit limit.\n if (\n instructionDetails &&\n instructionDetails.units !== PROVISORY_COMPUTE_UNIT_LIMIT &&\n instructionDetails.units !== MAX_COMPUTE_UNIT_LIMIT\n ) {\n return transactionMessage;\n }\n\n return updateOrAppendSetComputeUnitLimitInstruction(\n await estimateComputeUnitLimit(transactionMessage, config),\n transactionMessage,\n );\n };\n}\n","import {\n BaseTransactionMessage,\n Commitment,\n compileTransaction,\n getBase64EncodedWireTransaction,\n getSolanaErrorFromTransactionError,\n isSolanaError,\n isTransactionMessageWithDurableNonceLifetime,\n pipe,\n Rpc,\n SimulateTransactionApi,\n Slot,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SolanaError,\n Transaction,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\nimport { MAX_COMPUTE_UNIT_LIMIT } from './constants';\n\nexport type EstimateComputeUnitLimitFactoryConfig = Readonly<{\n /** An object that supports the {@link SimulateTransactionApi} of the Solana RPC API */\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\nexport type EstimateComputeUnitLimitFactoryFunction = (\n transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig,\n) => Promise<number>;\n\nexport type EstimateComputeUnitLimitFactoryFunctionConfig = {\n abortSignal?: AbortSignal;\n /**\n * Compute the estimate as of the highest slot that has reached this level of commitment.\n *\n * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For\n * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment\n * is `\"confirmed\"` unless configured otherwise. Unmitigated by an API layer on the client, the\n * default commitment applied by the server is `\"finalized\"`.\n */\n commitment?: Commitment;\n /**\n * Prevents accessing stale data by enforcing that the RPC node has processed transactions up to\n * this slot\n */\n minContextSlot?: Slot;\n};\n\ntype EstimateComputeUnitLimitConfig = EstimateComputeUnitLimitFactoryFunctionConfig &\n Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer;\n }>;\n\n/**\n * Simulates a transaction message on the network and returns the number of compute units it\n * consumed during simulation.\n *\n * The estimate this function returns can be used to set a compute unit limit on the transaction.\n * Correctly budgeting a compute unit limit for your transaction message can increase the probability\n * that your transaction will be accepted for processing.\n *\n * If you don't declare a compute unit limit on your transaction, validators will assume an upper\n * limit of 200K compute units (CU) per instruction. Since validators have an incentive to pack as\n * many transactions into each block as possible, they may choose to include transactions that they\n * know will fit into the remaining compute budget for the current block over transactions that\n * might not. For this reason, you should set a compute unit limit on each of your transaction\n * messages, whenever possible.\n *\n * ## Example\n *\n * ```ts\n * import { getSetComputeLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, getComputeUnitEstimateForTransactionMessageFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const getComputeUnitEstimateForTransactionMessage =\n * getComputeUnitEstimateForTransactionMessageFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume.\n * const computeUnitsEstimate =\n * await getComputeUnitEstimateForTransactionMessage(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeLimitInstruction({ units: computeUnitsEstimate }),\n * transactionMessage,\n * );\n * ```\n *\n * > [!WARNING]\n * > The compute unit estimate is just that – an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n */\nexport async function estimateComputeUnitLimit({\n transactionMessage,\n ...configs\n}: EstimateComputeUnitLimitConfig): Promise<number> {\n const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n const transaction = pipe(\n transactionMessage,\n m => updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m),\n compileTransaction,\n );\n\n return await simulateTransactionAndGetConsumedUnits({\n transaction,\n replaceRecentBlockhash,\n ...configs,\n });\n}\n\ntype SimulateTransactionAndGetConsumedUnitsConfig = Omit<EstimateComputeUnitLimitConfig, 'transactionMessage'> &\n Readonly<{ replaceRecentBlockhash?: boolean; transaction: Transaction }>;\n\nasync function simulateTransactionAndGetConsumedUnits({\n abortSignal,\n rpc,\n transaction,\n ...simulateConfig\n}: SimulateTransactionAndGetConsumedUnitsConfig): Promise<number> {\n const wireTransactionBytes = getBase64EncodedWireTransaction(transaction);\n\n try {\n const {\n value: { err: transactionError, unitsConsumed },\n } = await rpc\n .simulateTransaction(wireTransactionBytes, {\n ...simulateConfig,\n encoding: 'base64',\n sigVerify: false,\n })\n .send({ abortSignal });\n if (unitsConsumed == null) {\n // This should never be hit, because all RPCs should support `unitsConsumed` by now.\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT);\n }\n // FIXME(https://github.com/anza-xyz/agave/issues/1295): The simulation response returns\n // compute units as a u64, but the `SetComputeLimit` instruction only accepts a u32. Until\n // this changes, downcast it.\n const downcastUnitsConsumed = unitsConsumed > 4_294_967_295n ? 4_294_967_295 : Number(unitsConsumed);\n if (transactionError) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, {\n cause: getSolanaErrorFromTransactionError(transactionError),\n unitsConsumed: downcastUnitsConsumed,\n });\n }\n return downcastUnitsConsumed;\n } catch (e) {\n if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT)) throw e;\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, { cause: e });\n }\n}\n","import {\n estimateComputeUnitLimit,\n EstimateComputeUnitLimitFactoryConfig,\n EstimateComputeUnitLimitFactoryFunction,\n} from './estimateComputeLimitInternal';\n\n/**\n * Use this utility to estimate the actual compute unit cost of a given transaction message.\n *\n * Correctly budgeting a compute unit limit for your transaction message can increase the\n * probability that your transaction will be accepted for processing. If you don't declare a compute\n * unit limit on your transaction, validators will assume an upper limit of 200K compute units (CU)\n * per instruction.\n *\n * Since validators have an incentive to pack as many transactions into each block as possible, they\n * may choose to include transactions that they know will fit into the remaining compute budget for\n * the current block over transactions that might not. For this reason, you should set a compute\n * unit limit on each of your transaction messages, whenever possible.\n *\n * > [!WARNING]\n * > The compute unit estimate is just that -- an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n *\n * > [!INFO]\n * > In the event that a transaction message does not already have a `SetComputeUnitLimit`\n * > instruction, this function will add one before simulation. This ensures that the compute unit\n * > consumption of the `SetComputeUnitLimit` instruction itself is included in the estimate.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { getSetComputeUnitLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, estimateComputeUnitLimitFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const estimateComputeUnitLimit = estimateComputeUnitLimitFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume. This is done by\n * // simulating the transaction and grabbing the estimated compute units from the result.\n * const estimatedUnits = await estimateComputeUnitLimit(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeUnitLimitInstruction({ units: estimatedUnits }),\n * transactionMessage,\n * );\n * ```\n */\nexport function estimateComputeUnitLimitFactory({\n rpc,\n}: EstimateComputeUnitLimitFactoryConfig): EstimateComputeUnitLimitFactoryFunction {\n return async function estimateComputeUnitLimitFactoryFunction(transactionMessage, config) {\n return await estimateComputeUnitLimit({\n ...config,\n rpc,\n transactionMessage,\n });\n };\n}\n","import { appendTransactionMessageInstruction, BaseTransactionMessage, MicroLamports } from '@solana/kit';\nimport { getSetComputeUnitPriceInstruction } from './generated';\nimport { getSetComputeUnitPriceInstructionIndexAndMicroLamports } from './internal';\n\n/**\n * Sets the compute unit price of a transaction message in micro-Lamports.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * (m) => setTransactionMessageComputeUnitPrice(10_000, m),\n * // ...\n * );\n * ```\n */\nexport function setTransactionMessageComputeUnitPrice<TTransactionMessage extends BaseTransactionMessage>(\n microLamports: number | bigint,\n transactionMessage: TTransactionMessage,\n) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({ microLamports }),\n transactionMessage,\n );\n}\n\n/**\n * Updates the first `SetComputeUnitPrice` instruction in a transaction message\n * with the given micro-Lamports, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param microLamports - The new compute unit price, or a function that\n * takes the previous price and returns the new one.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitPriceInstruction(\n * // E.g. double the current price or set it to 10_000 if it isn't set.\n * (currentPrice) => currentPrice === null ? 10_000 : currentPrice * 2,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitPriceInstruction<TTransactionMessage extends BaseTransactionMessage>(\n microLamports: MicroLamports | ((previousMicroLamports: MicroLamports | null) => MicroLamports),\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n const getMicroLamports = (previousMicroLamports: MicroLamports | null): MicroLamports =>\n typeof microLamports === 'function' ? microLamports(previousMicroLamports) : microLamports;\n const instructionDetails = getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({\n microLamports: getMicroLamports(null),\n }),\n transactionMessage,\n ) as unknown as TTransactionMessage;\n }\n\n const { index, microLamports: previousMicroLamports } = instructionDetails;\n const newMicroLamports = getMicroLamports(previousMicroLamports);\n if (newMicroLamports === previousMicroLamports) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitPriceInstruction({\n microLamports: newMicroLamports,\n });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n"]}
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { containsBytes, getU8Encoder, transformEncoder, getStructEncoder, getU32Encoder, getStructDecoder, getU8Decoder, getU32Decoder, combineCodec, getU64Encoder, getU64Decoder, appendTransactionMessageInstruction, isTransactionMessageWithDurableNonceLifetime, pipe, compileTransaction, getBase64EncodedWireTransaction, SolanaError, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, isSolanaError } from '@solana/kit';
|
|
1
|
+
import { containsBytes, getU8Encoder, transformEncoder, getStructEncoder, getU32Encoder, getStructDecoder, getU8Decoder, getU32Decoder, combineCodec, getU64Encoder, getU64Decoder, appendTransactionMessageInstruction, isTransactionMessageWithDurableNonceLifetime, pipe, compileTransaction, getBase64EncodedWireTransaction, SolanaError, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, getSolanaErrorFromTransactionError, isSolanaError } from '@solana/kit';
|
|
2
2
|
|
|
3
3
|
// src/generated/instructions/requestHeapFrame.ts
|
|
4
4
|
var COMPUTE_BUDGET_PROGRAM_ADDRESS = "ComputeBudget111111111111111111111111111111";
|
|
@@ -27,9 +27,7 @@ function identifyComputeBudgetInstruction(instruction) {
|
|
|
27
27
|
if (containsBytes(data, getU8Encoder().encode(4), 0)) {
|
|
28
28
|
return 4 /* SetLoadedAccountsDataSizeLimit */;
|
|
29
29
|
}
|
|
30
|
-
throw new Error(
|
|
31
|
-
"The provided instruction could not be identified as a computeBudget instruction."
|
|
32
|
-
);
|
|
30
|
+
throw new Error("The provided instruction could not be identified as a computeBudget instruction.");
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
// src/generated/instructions/requestHeapFrame.ts
|
|
@@ -53,18 +51,13 @@ function getRequestHeapFrameInstructionDataDecoder() {
|
|
|
53
51
|
]);
|
|
54
52
|
}
|
|
55
53
|
function getRequestHeapFrameInstructionDataCodec() {
|
|
56
|
-
return combineCodec(
|
|
57
|
-
getRequestHeapFrameInstructionDataEncoder(),
|
|
58
|
-
getRequestHeapFrameInstructionDataDecoder()
|
|
59
|
-
);
|
|
54
|
+
return combineCodec(getRequestHeapFrameInstructionDataEncoder(), getRequestHeapFrameInstructionDataDecoder());
|
|
60
55
|
}
|
|
61
56
|
function getRequestHeapFrameInstruction(input, config) {
|
|
62
57
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
63
58
|
const args = { ...input };
|
|
64
59
|
return Object.freeze({
|
|
65
|
-
data: getRequestHeapFrameInstructionDataEncoder().encode(
|
|
66
|
-
args
|
|
67
|
-
),
|
|
60
|
+
data: getRequestHeapFrameInstructionDataEncoder().encode(args),
|
|
68
61
|
programAddress
|
|
69
62
|
});
|
|
70
63
|
}
|
|
@@ -96,18 +89,13 @@ function getRequestUnitsInstructionDataDecoder() {
|
|
|
96
89
|
]);
|
|
97
90
|
}
|
|
98
91
|
function getRequestUnitsInstructionDataCodec() {
|
|
99
|
-
return combineCodec(
|
|
100
|
-
getRequestUnitsInstructionDataEncoder(),
|
|
101
|
-
getRequestUnitsInstructionDataDecoder()
|
|
102
|
-
);
|
|
92
|
+
return combineCodec(getRequestUnitsInstructionDataEncoder(), getRequestUnitsInstructionDataDecoder());
|
|
103
93
|
}
|
|
104
94
|
function getRequestUnitsInstruction(input, config) {
|
|
105
95
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
106
96
|
const args = { ...input };
|
|
107
97
|
return Object.freeze({
|
|
108
|
-
data: getRequestUnitsInstructionDataEncoder().encode(
|
|
109
|
-
args
|
|
110
|
-
),
|
|
98
|
+
data: getRequestUnitsInstructionDataEncoder().encode(args),
|
|
111
99
|
programAddress
|
|
112
100
|
});
|
|
113
101
|
}
|
|
@@ -127,10 +115,7 @@ function getSetComputeUnitLimitInstructionDataEncoder() {
|
|
|
127
115
|
["discriminator", getU8Encoder()],
|
|
128
116
|
["units", getU32Encoder()]
|
|
129
117
|
]),
|
|
130
|
-
(value) => ({
|
|
131
|
-
...value,
|
|
132
|
-
discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR
|
|
133
|
-
})
|
|
118
|
+
(value) => ({ ...value, discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR })
|
|
134
119
|
);
|
|
135
120
|
}
|
|
136
121
|
function getSetComputeUnitLimitInstructionDataDecoder() {
|
|
@@ -140,27 +125,20 @@ function getSetComputeUnitLimitInstructionDataDecoder() {
|
|
|
140
125
|
]);
|
|
141
126
|
}
|
|
142
127
|
function getSetComputeUnitLimitInstructionDataCodec() {
|
|
143
|
-
return combineCodec(
|
|
144
|
-
getSetComputeUnitLimitInstructionDataEncoder(),
|
|
145
|
-
getSetComputeUnitLimitInstructionDataDecoder()
|
|
146
|
-
);
|
|
128
|
+
return combineCodec(getSetComputeUnitLimitInstructionDataEncoder(), getSetComputeUnitLimitInstructionDataDecoder());
|
|
147
129
|
}
|
|
148
130
|
function getSetComputeUnitLimitInstruction(input, config) {
|
|
149
131
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
150
132
|
const args = { ...input };
|
|
151
133
|
return Object.freeze({
|
|
152
|
-
data: getSetComputeUnitLimitInstructionDataEncoder().encode(
|
|
153
|
-
args
|
|
154
|
-
),
|
|
134
|
+
data: getSetComputeUnitLimitInstructionDataEncoder().encode(args),
|
|
155
135
|
programAddress
|
|
156
136
|
});
|
|
157
137
|
}
|
|
158
138
|
function parseSetComputeUnitLimitInstruction(instruction) {
|
|
159
139
|
return {
|
|
160
140
|
programAddress: instruction.programAddress,
|
|
161
|
-
data: getSetComputeUnitLimitInstructionDataDecoder().decode(
|
|
162
|
-
instruction.data
|
|
163
|
-
)
|
|
141
|
+
data: getSetComputeUnitLimitInstructionDataDecoder().decode(instruction.data)
|
|
164
142
|
};
|
|
165
143
|
}
|
|
166
144
|
var SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;
|
|
@@ -173,10 +151,7 @@ function getSetComputeUnitPriceInstructionDataEncoder() {
|
|
|
173
151
|
["discriminator", getU8Encoder()],
|
|
174
152
|
["microLamports", getU64Encoder()]
|
|
175
153
|
]),
|
|
176
|
-
(value) => ({
|
|
177
|
-
...value,
|
|
178
|
-
discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR
|
|
179
|
-
})
|
|
154
|
+
(value) => ({ ...value, discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR })
|
|
180
155
|
);
|
|
181
156
|
}
|
|
182
157
|
function getSetComputeUnitPriceInstructionDataDecoder() {
|
|
@@ -186,34 +161,25 @@ function getSetComputeUnitPriceInstructionDataDecoder() {
|
|
|
186
161
|
]);
|
|
187
162
|
}
|
|
188
163
|
function getSetComputeUnitPriceInstructionDataCodec() {
|
|
189
|
-
return combineCodec(
|
|
190
|
-
getSetComputeUnitPriceInstructionDataEncoder(),
|
|
191
|
-
getSetComputeUnitPriceInstructionDataDecoder()
|
|
192
|
-
);
|
|
164
|
+
return combineCodec(getSetComputeUnitPriceInstructionDataEncoder(), getSetComputeUnitPriceInstructionDataDecoder());
|
|
193
165
|
}
|
|
194
166
|
function getSetComputeUnitPriceInstruction(input, config) {
|
|
195
167
|
const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;
|
|
196
168
|
const args = { ...input };
|
|
197
169
|
return Object.freeze({
|
|
198
|
-
data: getSetComputeUnitPriceInstructionDataEncoder().encode(
|
|
199
|
-
args
|
|
200
|
-
),
|
|
170
|
+
data: getSetComputeUnitPriceInstructionDataEncoder().encode(args),
|
|
201
171
|
programAddress
|
|
202
172
|
});
|
|
203
173
|
}
|
|
204
174
|
function parseSetComputeUnitPriceInstruction(instruction) {
|
|
205
175
|
return {
|
|
206
176
|
programAddress: instruction.programAddress,
|
|
207
|
-
data: getSetComputeUnitPriceInstructionDataDecoder().decode(
|
|
208
|
-
instruction.data
|
|
209
|
-
)
|
|
177
|
+
data: getSetComputeUnitPriceInstructionDataDecoder().decode(instruction.data)
|
|
210
178
|
};
|
|
211
179
|
}
|
|
212
180
|
var SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;
|
|
213
181
|
function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes() {
|
|
214
|
-
return getU8Encoder().encode(
|
|
215
|
-
SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR
|
|
216
|
-
);
|
|
182
|
+
return getU8Encoder().encode(SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR);
|
|
217
183
|
}
|
|
218
184
|
function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder() {
|
|
219
185
|
return transformEncoder(
|
|
@@ -221,10 +187,7 @@ function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder() {
|
|
|
221
187
|
["discriminator", getU8Encoder()],
|
|
222
188
|
["accountDataSizeLimit", getU32Encoder()]
|
|
223
189
|
]),
|
|
224
|
-
(value) => ({
|
|
225
|
-
...value,
|
|
226
|
-
discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR
|
|
227
|
-
})
|
|
190
|
+
(value) => ({ ...value, discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR })
|
|
228
191
|
);
|
|
229
192
|
}
|
|
230
193
|
function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder() {
|
|
@@ -252,9 +215,7 @@ function getSetLoadedAccountsDataSizeLimitInstruction(input, config) {
|
|
|
252
215
|
function parseSetLoadedAccountsDataSizeLimitInstruction(instruction) {
|
|
253
216
|
return {
|
|
254
217
|
programAddress: instruction.programAddress,
|
|
255
|
-
data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(
|
|
256
|
-
instruction.data
|
|
257
|
-
)
|
|
218
|
+
data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(instruction.data)
|
|
258
219
|
};
|
|
259
220
|
}
|
|
260
221
|
|
|
@@ -266,16 +227,11 @@ function getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage) {
|
|
|
266
227
|
if (index < 0) {
|
|
267
228
|
return null;
|
|
268
229
|
}
|
|
269
|
-
const units = getU32Decoder().decode(
|
|
270
|
-
transactionMessage.instructions[index].data,
|
|
271
|
-
1
|
|
272
|
-
);
|
|
230
|
+
const units = getU32Decoder().decode(transactionMessage.instructions[index].data, 1);
|
|
273
231
|
return { index, units };
|
|
274
232
|
}
|
|
275
233
|
function getSetComputeUnitLimitInstructionIndex(transactionMessage) {
|
|
276
|
-
return transactionMessage.instructions.findIndex(
|
|
277
|
-
isSetComputeUnitLimitInstruction
|
|
278
|
-
);
|
|
234
|
+
return transactionMessage.instructions.findIndex(isSetComputeUnitLimitInstruction);
|
|
279
235
|
}
|
|
280
236
|
function isSetComputeUnitLimitInstruction(instruction) {
|
|
281
237
|
return instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && identifyComputeBudgetInstruction(instruction.data) === 2 /* SetComputeUnitLimit */;
|
|
@@ -292,9 +248,7 @@ function getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessa
|
|
|
292
248
|
return { index, microLamports };
|
|
293
249
|
}
|
|
294
250
|
function getSetComputeUnitPriceInstructionIndex(transactionMessage) {
|
|
295
|
-
return transactionMessage.instructions.findIndex(
|
|
296
|
-
isSetComputeUnitPriceInstruction
|
|
297
|
-
);
|
|
251
|
+
return transactionMessage.instructions.findIndex(isSetComputeUnitPriceInstruction);
|
|
298
252
|
}
|
|
299
253
|
function isSetComputeUnitPriceInstruction(instruction) {
|
|
300
254
|
return instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS && identifyComputeBudgetInstruction(instruction.data) === 3 /* SetComputeUnitPrice */;
|
|
@@ -373,31 +327,19 @@ async function simulateTransactionAndGetConsumedUnits({
|
|
|
373
327
|
sigVerify: false
|
|
374
328
|
}).send({ abortSignal });
|
|
375
329
|
if (unitsConsumed == null) {
|
|
376
|
-
throw new SolanaError(
|
|
377
|
-
SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT
|
|
378
|
-
);
|
|
330
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT);
|
|
379
331
|
}
|
|
380
332
|
const downcastUnitsConsumed = unitsConsumed > 4294967295n ? 4294967295 : Number(unitsConsumed);
|
|
381
333
|
if (transactionError) {
|
|
382
|
-
throw new SolanaError(
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
unitsConsumed: downcastUnitsConsumed
|
|
387
|
-
}
|
|
388
|
-
);
|
|
334
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, {
|
|
335
|
+
cause: getSolanaErrorFromTransactionError(transactionError),
|
|
336
|
+
unitsConsumed: downcastUnitsConsumed
|
|
337
|
+
});
|
|
389
338
|
}
|
|
390
339
|
return downcastUnitsConsumed;
|
|
391
340
|
} catch (e) {
|
|
392
|
-
if (isSolanaError(
|
|
393
|
-
|
|
394
|
-
SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT
|
|
395
|
-
))
|
|
396
|
-
throw e;
|
|
397
|
-
throw new SolanaError(
|
|
398
|
-
SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,
|
|
399
|
-
{ cause: e }
|
|
400
|
-
);
|
|
341
|
+
if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT)) throw e;
|
|
342
|
+
throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, { cause: e });
|
|
401
343
|
}
|
|
402
344
|
}
|
|
403
345
|
|
package/dist/src/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/generated/programs/computeBudget.ts","../../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/constants.ts","../../src/internal.ts","../../src/setComputeLimit.ts","../../src/estimateAndSetComputeLimit.ts","../../src/estimateComputeLimitInternal.ts","../../src/estimateComputeLimit.ts","../../src/setComputePrice.ts"],"names":["ComputeBudgetInstruction","getU8Encoder","transformEncoder","getStructEncoder","getU32Encoder","getStructDecoder","getU8Decoder","getU32Decoder","combineCodec","getU64Decoder","previousUnits","estimateComputeUnitLimit","appendTransactionMessageInstruction","previousMicroLamports"],"mappings":";;;AAsBO,IAAM,8BACX,GAAA;AAEU,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACL,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gCAAA;AALU,EAAAA,OAAAA,yBAAAA;AAAA,CAAA,EAAA,wBAAA,IAAA,EAAA;AAQL,SAAS,iCACd,WAC0B,EAAA;AAC1B,EAAA,MAAM,IAAO,GAAA,MAAA,IAAU,WAAc,GAAA,WAAA,CAAY,IAAO,GAAA,WAAA;AACxD,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa,EAAA,CAAE,OAAO,CAAC,CAAA,EAAG,CAAC,CAAG,EAAA;AACpD,IAAO,OAAA,CAAA;AAAA;AAET,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa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GACF;AACF;AAoBO,SAAS,4CAAA,CAGd,eAGA,kBACqB,EAAA;AACrB,EAAM,MAAA,gBAAA,GAAmB,CACvBC,sBAEA,KAAA,OAAO,kBAAkB,UACrB,GAAA,aAAA,CAAcA,sBAAqB,CACnC,GAAA,aAAA;AACN,EAAM,MAAA,kBAAA,GACJ,uDAAuD,kBAAkB,CAAA;AAE3E,EAAA,IAAI,CAAC,kBAAoB,EAAA;AACvB,IAAOD,OAAAA,mCAAAA;AAAA,MACL,iCAAkC,CAAA;AAAA,QAChC,aAAA,EAAe,iBAAiB,IAAI;AAAA,OACrC,CAAA;AAAA,MACD;AAAA,KACF;AAAA;AAGF,EAAA,MAAM,EAAE,KAAA,EAAO,aAAe,EAAA,qBAAA,EAA0B,GAAA,kBAAA;AACxD,EAAM,MAAA,gBAAA,GAAmB,iBAAiB,qBAAqB,CAAA;AAC/D,EAAA,IAAI,qBAAqB,qBAAuB,EAAA;AAC9C,IAAO,OAAA,kBAAA;AAAA;AAGT,EAAA,MAAM,iBAAiB,iCAAkC,CAAA;AAAA,IACvD,aAAe,EAAA;AAAA,GAChB,CAAA;AACD,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACnB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA;AAAA,GACf,CAAA;AACH","file":"index.mjs","sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n containsBytes,\n getU8Encoder,\n type Address,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n type ParsedRequestHeapFrameInstruction,\n type ParsedRequestUnitsInstruction,\n type ParsedSetComputeUnitLimitInstruction,\n type ParsedSetComputeUnitPriceInstruction,\n type 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: ReadonlyUint8Array } | ReadonlyUint8Array\n): ComputeBudgetInstruction {\n const data = 'data' in instruction ? instruction.data : instruction;\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;\n\nexport function getRequestHeapFrameDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_HEAP_FRAME_DISCRIMINATOR);\n}\n\nexport type RequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR })\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): FixedSizeDecoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: RequestHeapFrameInput,\n config?: { programAddress?: TProgramAddress }\n): RequestHeapFrameInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n programAddress,\n } as RequestHeapFrameInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_UNITS_DISCRIMINATOR = 0;\n\nexport function getRequestUnitsDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_UNITS_DISCRIMINATOR);\n}\n\nexport type RequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR })\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): FixedSizeDecoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: RequestUnitsInput,\n config?: { programAddress?: TProgramAddress }\n): RequestUnitsInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n programAddress,\n } as RequestUnitsInstruction<TProgramAddress>);\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = { programAddress: Address<TProgram>; data: RequestUnitsInstructionData };\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;\n\nexport function getSetComputeUnitLimitDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitLimitInput,\n config?: { programAddress?: TProgramAddress }\n): SetComputeUnitLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n programAddress,\n } as SetComputeUnitLimitInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;\n\nexport function getSetComputeUnitPriceDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitPriceInput,\n config?: { programAddress?: TProgramAddress }\n): SetComputeUnitPriceInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n programAddress,\n } as SetComputeUnitPriceInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;\n\nexport function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes() {\n return getU8Encoder().encode(\n SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR\n );\n}\n\nexport type SetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> &\n InstructionWithData<ReadonlyUint8Array> &\n InstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = {\n discriminator: number;\n accountDataSizeLimit: number;\n};\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {\n accountDataSizeLimit: number;\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetLoadedAccountsDataSizeLimitInput,\n config?: { programAddress?: TProgramAddress }\n): SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress =\n config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n programAddress,\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>);\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: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * A provisory compute unit limit is used to indicate that the transaction\n * should be estimated for compute units before being sent to the network.\n *\n * Setting it to zero ensures the transaction fails unless it is properly estimated.\n */\nexport const PROVISORY_COMPUTE_UNIT_LIMIT = 0;\n\n/**\n * The maximum compute unit limit that can be set for a transaction.\n */\nexport const MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n","import {\n BaseTransactionMessage,\n getU32Decoder,\n getU64Decoder,\n Instruction,\n MicroLamports,\n ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n COMPUTE_BUDGET_PROGRAM_ADDRESS,\n ComputeBudgetInstruction,\n identifyComputeBudgetInstruction,\n SetComputeUnitLimitInstruction,\n SetComputeUnitPriceInstruction,\n} from './generated';\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message\n * and its set limit, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndexAndUnits(\n transactionMessage: BaseTransactionMessage\n): { index: number; units: number } | null {\n const index = getSetComputeUnitLimitInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const units = getU32Decoder().decode(\n transactionMessage.instructions[index].data as ReadonlyUint8Array,\n 1\n );\n\n return { index, units };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndex(\n transactionMessage: BaseTransactionMessage\n) {\n return transactionMessage.instructions.findIndex(\n isSetComputeUnitLimitInstruction\n );\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitLimit` instruction.\n */\nexport function isSetComputeUnitLimitInstruction(\n instruction: Instruction\n): instruction is SetComputeUnitLimitInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitLimit\n );\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message\n * and its set micro-lamports, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndexAndMicroLamports(\n transactionMessage: BaseTransactionMessage\n): { index: number; microLamports: MicroLamports } | null {\n const index = getSetComputeUnitPriceInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const microLamports = getU64Decoder().decode(\n transactionMessage.instructions[index].data as ReadonlyUint8Array,\n 1\n ) as MicroLamports;\n\n return { index, microLamports };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndex(\n transactionMessage: BaseTransactionMessage\n) {\n return transactionMessage.instructions.findIndex(\n isSetComputeUnitPriceInstruction\n );\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitPrice` instruction.\n */\nexport function isSetComputeUnitPriceInstruction(\n instruction: Instruction\n): instruction is SetComputeUnitPriceInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitPrice\n );\n}\n","import {\n appendTransactionMessageInstruction,\n BaseTransactionMessage,\n} from '@solana/kit';\nimport { PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';\nimport { getSetComputeUnitLimitInstruction } from './generated';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\n\n/**\n * Appends a `SetComputeUnitLimit` instruction with a provisory\n * compute unit limit to a given transaction message\n * if and only if it does not already have one.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * fillProvisorySetComputeUnitLimitInstruction,\n * // ...\n * );\n * ```\n */\nexport function fillProvisorySetComputeUnitLimitInstruction<\n TTransactionMessage extends BaseTransactionMessage,\n>(transactionMessage: TTransactionMessage) {\n return updateOrAppendSetComputeUnitLimitInstruction(\n (previousUnits) =>\n previousUnits === null ? PROVISORY_COMPUTE_UNIT_LIMIT : previousUnits,\n transactionMessage\n );\n}\n\n/**\n * Updates the first `SetComputeUnitLimit` instruction in a transaction message\n * with the given units, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param units - The new compute unit limit, or a function that takes the previous\n * compute unit limit and returns the new limit.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitLimitInstruction(\n * // E.g. Keep the current limit if it is set, otherwise set it to the maximum.\n * (currentUnits) => currentUnits === null ? MAX_COMPUTE_UNIT_LIMIT : currentUnits,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitLimitInstruction<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n units: number | ((previousUnits: number | null) => number),\n transactionMessage: TTransactionMessage\n): TTransactionMessage {\n const getUnits = (previousUnits: number | null): number =>\n typeof units === 'function' ? units(previousUnits) : units;\n const instructionDetails =\n getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitLimitInstruction({ units: getUnits(null) }),\n transactionMessage\n ) as unknown as TTransactionMessage;\n }\n\n const { index, units: previousUnits } = instructionDetails;\n const newUnits = getUnits(previousUnits);\n if (newUnits === previousUnits) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitLimitInstruction({ units: newUnits });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n","import {\n BaseTransactionMessage,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport {\n MAX_COMPUTE_UNIT_LIMIT,\n PROVISORY_COMPUTE_UNIT_LIMIT,\n} from './constants';\nimport {\n EstimateComputeUnitLimitFactoryFunction,\n EstimateComputeUnitLimitFactoryFunctionConfig,\n} from './estimateComputeLimitInternal';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\n\ntype EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <\n TTransactionMessage extends BaseTransactionMessage &\n TransactionMessageWithFeePayer,\n>(\n transactionMessage: TTransactionMessage,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig\n) => Promise<TTransactionMessage>;\n\n/**\n * Given a transaction message, if it does not have an explicit compute unit limit,\n * estimates the compute unit limit and updates the transaction message with\n * the estimated limit. Otherwise, returns the transaction message unchanged.\n *\n * It requires a function that estimates the compute unit limit.\n *\n * @example\n * ```ts\n * const estimateAndUpdateCUs = estimateAndUpdateProvisoryComputeUnitLimitFactory(\n * estimateComputeUnitLimitFactory({ rpc })\n * );\n *\n * const transactionMessageWithCUs = await estimateAndUpdateCUs(transactionMessage);\n * ```\n *\n * @see {@link estimateAndUpdateProvisoryComputeUnitLimitFactory}\n */\nexport function estimateAndUpdateProvisoryComputeUnitLimitFactory(\n estimateComputeUnitLimit: EstimateComputeUnitLimitFactoryFunction\n): EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction {\n return async function fn(transactionMessage, config) {\n const instructionDetails =\n getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n // If the transaction message already has a compute unit limit instruction\n // which is set to a specific value — i.e. not 0 or the maximum limit —\n // we don't need to estimate the compute unit limit.\n if (\n instructionDetails &&\n instructionDetails.units !== PROVISORY_COMPUTE_UNIT_LIMIT &&\n instructionDetails.units !== MAX_COMPUTE_UNIT_LIMIT\n ) {\n return transactionMessage;\n }\n\n return updateOrAppendSetComputeUnitLimitInstruction(\n await estimateComputeUnitLimit(transactionMessage, config),\n transactionMessage\n );\n };\n}\n","import {\n BaseTransactionMessage,\n Commitment,\n compileTransaction,\n getBase64EncodedWireTransaction,\n isSolanaError,\n isTransactionMessageWithDurableNonceLifetime,\n pipe,\n Rpc,\n SimulateTransactionApi,\n Slot,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SolanaError,\n Transaction,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\nimport { MAX_COMPUTE_UNIT_LIMIT } from './constants';\n\nexport type EstimateComputeUnitLimitFactoryConfig = Readonly<{\n /** An object that supports the {@link SimulateTransactionApi} of the Solana RPC API */\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\nexport type EstimateComputeUnitLimitFactoryFunction = (\n transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig\n) => Promise<number>;\n\nexport type EstimateComputeUnitLimitFactoryFunctionConfig = {\n abortSignal?: AbortSignal;\n /**\n * Compute the estimate as of the highest slot that has reached this level of commitment.\n *\n * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For\n * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment\n * is `\"confirmed\"` unless configured otherwise. Unmitigated by an API layer on the client, the\n * default commitment applied by the server is `\"finalized\"`.\n */\n commitment?: Commitment;\n /**\n * Prevents accessing stale data by enforcing that the RPC node has processed transactions up to\n * this slot\n */\n minContextSlot?: Slot;\n};\n\ntype EstimateComputeUnitLimitConfig =\n EstimateComputeUnitLimitFactoryFunctionConfig &\n Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n transactionMessage: BaseTransactionMessage &\n TransactionMessageWithFeePayer;\n }>;\n\n/**\n * Simulates a transaction message on the network and returns the number of compute units it\n * consumed during simulation.\n *\n * The estimate this function returns can be used to set a compute unit limit on the transaction.\n * Correctly budgeting a compute unit limit for your transaction message can increase the probability\n * that your transaction will be accepted for processing.\n *\n * If you don't declare a compute unit limit on your transaction, validators will assume an upper\n * limit of 200K compute units (CU) per instruction. Since validators have an incentive to pack as\n * many transactions into each block as possible, they may choose to include transactions that they\n * know will fit into the remaining compute budget for the current block over transactions that\n * might not. For this reason, you should set a compute unit limit on each of your transaction\n * messages, whenever possible.\n *\n * ## Example\n *\n * ```ts\n * import { getSetComputeLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, getComputeUnitEstimateForTransactionMessageFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const getComputeUnitEstimateForTransactionMessage =\n * getComputeUnitEstimateForTransactionMessageFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume.\n * const computeUnitsEstimate =\n * await getComputeUnitEstimateForTransactionMessage(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeLimitInstruction({ units: computeUnitsEstimate }),\n * transactionMessage,\n * );\n * ```\n *\n * > [!WARNING]\n * > The compute unit estimate is just that – an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n */\nexport async function estimateComputeUnitLimit({\n transactionMessage,\n ...configs\n}: EstimateComputeUnitLimitConfig): Promise<number> {\n const replaceRecentBlockhash =\n !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n const transaction = pipe(\n transactionMessage,\n (m) =>\n updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m),\n compileTransaction\n );\n\n return await simulateTransactionAndGetConsumedUnits({\n transaction,\n replaceRecentBlockhash,\n ...configs,\n });\n}\n\ntype SimulateTransactionAndGetConsumedUnitsConfig = Omit<\n EstimateComputeUnitLimitConfig,\n 'transactionMessage'\n> &\n Readonly<{ replaceRecentBlockhash?: boolean; transaction: Transaction }>;\n\nasync function simulateTransactionAndGetConsumedUnits({\n abortSignal,\n rpc,\n transaction,\n ...simulateConfig\n}: SimulateTransactionAndGetConsumedUnitsConfig): Promise<number> {\n const wireTransactionBytes = getBase64EncodedWireTransaction(transaction);\n\n try {\n const {\n value: { err: transactionError, unitsConsumed },\n } = await rpc\n .simulateTransaction(wireTransactionBytes, {\n ...simulateConfig,\n encoding: 'base64',\n sigVerify: false,\n })\n .send({ abortSignal });\n if (unitsConsumed == null) {\n // This should never be hit, because all RPCs should support `unitsConsumed` by now.\n throw new SolanaError(\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT\n );\n }\n // FIXME(https://github.com/anza-xyz/agave/issues/1295): The simulation response returns\n // compute units as a u64, but the `SetComputeLimit` instruction only accepts a u32. Until\n // this changes, downcast it.\n const downcastUnitsConsumed =\n unitsConsumed > 4_294_967_295n ? 4_294_967_295 : Number(unitsConsumed);\n if (transactionError) {\n throw new SolanaError(\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n {\n cause: transactionError,\n unitsConsumed: downcastUnitsConsumed,\n }\n );\n }\n return downcastUnitsConsumed;\n } catch (e) {\n if (\n isSolanaError(\n e,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT\n )\n )\n throw e;\n throw new SolanaError(\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n { cause: e }\n );\n }\n}\n","import {\n estimateComputeUnitLimit,\n EstimateComputeUnitLimitFactoryConfig,\n EstimateComputeUnitLimitFactoryFunction,\n} from './estimateComputeLimitInternal';\n\n/**\n * Use this utility to estimate the actual compute unit cost of a given transaction message.\n *\n * Correctly budgeting a compute unit limit for your transaction message can increase the\n * probability that your transaction will be accepted for processing. If you don't declare a compute\n * unit limit on your transaction, validators will assume an upper limit of 200K compute units (CU)\n * per instruction.\n *\n * Since validators have an incentive to pack as many transactions into each block as possible, they\n * may choose to include transactions that they know will fit into the remaining compute budget for\n * the current block over transactions that might not. For this reason, you should set a compute\n * unit limit on each of your transaction messages, whenever possible.\n *\n * > [!WARNING]\n * > The compute unit estimate is just that -- an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n *\n * > [!INFO]\n * > In the event that a transaction message does not already have a `SetComputeUnitLimit`\n * > instruction, this function will add one before simulation. This ensures that the compute unit\n * > consumption of the `SetComputeUnitLimit` instruction itself is included in the estimate.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { getSetComputeUnitLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, estimateComputeUnitLimitFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const estimateComputeUnitLimit = estimateComputeUnitLimitFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume. This is done by\n * // simulating the transaction and grabbing the estimated compute units from the result.\n * const estimatedUnits = await estimateComputeUnitLimit(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeUnitLimitInstruction({ units: estimatedUnits }),\n * transactionMessage,\n * );\n * ```\n */\nexport function estimateComputeUnitLimitFactory({\n rpc,\n}: EstimateComputeUnitLimitFactoryConfig): EstimateComputeUnitLimitFactoryFunction {\n return async function estimateComputeUnitLimitFactoryFunction(\n transactionMessage,\n config\n ) {\n return await estimateComputeUnitLimit({\n ...config,\n rpc,\n transactionMessage,\n });\n };\n}\n","import {\n appendTransactionMessageInstruction,\n BaseTransactionMessage,\n MicroLamports,\n} from '@solana/kit';\nimport { getSetComputeUnitPriceInstruction } from './generated';\nimport { getSetComputeUnitPriceInstructionIndexAndMicroLamports } from './internal';\n\n/**\n * Sets the compute unit price of a transaction message in micro-Lamports.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * (m) => setTransactionMessageComputeUnitPrice(10_000, m),\n * // ...\n * );\n * ```\n */\nexport function setTransactionMessageComputeUnitPrice<\n TTransactionMessage extends BaseTransactionMessage,\n>(microLamports: number | bigint, transactionMessage: TTransactionMessage) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({ microLamports }),\n transactionMessage\n );\n}\n\n/**\n * Updates the first `SetComputeUnitPrice` instruction in a transaction message\n * with the given micro-Lamports, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param microLamports - The new compute unit price, or a function that\n * takes the previous price and returns the new one.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitPriceInstruction(\n * // E.g. double the current price or set it to 10_000 if it isn't set.\n * (currentPrice) => currentPrice === null ? 10_000 : currentPrice * 2,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitPriceInstruction<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n microLamports:\n | MicroLamports\n | ((previousMicroLamports: MicroLamports | null) => MicroLamports),\n transactionMessage: TTransactionMessage\n): TTransactionMessage {\n const getMicroLamports = (\n previousMicroLamports: MicroLamports | null\n ): MicroLamports =>\n typeof microLamports === 'function'\n ? microLamports(previousMicroLamports)\n : microLamports;\n const instructionDetails =\n getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({\n microLamports: getMicroLamports(null),\n }),\n transactionMessage\n ) as unknown as TTransactionMessage;\n }\n\n const { index, microLamports: previousMicroLamports } = instructionDetails;\n const newMicroLamports = getMicroLamports(previousMicroLamports);\n if (newMicroLamports === previousMicroLamports) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitPriceInstruction({\n microLamports: newMicroLamports,\n });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/generated/programs/computeBudget.ts","../../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/constants.ts","../../src/internal.ts","../../src/setComputeLimit.ts","../../src/estimateAndSetComputeLimit.ts","../../src/estimateComputeLimitInternal.ts","../../src/estimateComputeLimit.ts","../../src/setComputePrice.ts"],"names":["ComputeBudgetInstruction","getU8Encoder","transformEncoder","getStructEncoder","getU32Encoder","getStructDecoder","getU8Decoder","getU32Decoder","combineCodec","getU64Decoder","previousUnits","estimateComputeUnitLimit","appendTransactionMess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A,KACJ;AAAA;AAGJ,EAAA,MAAM,EAAE,KAAA,EAAO,aAAe,EAAA,qBAAA,EAA0B,GAAA,kBAAA;AACxD,EAAM,MAAA,gBAAA,GAAmB,iBAAiB,qBAAqB,CAAA;AAC/D,EAAA,IAAI,qBAAqB,qBAAuB,EAAA;AAC5C,IAAO,OAAA,kBAAA;AAAA;AAGX,EAAA,MAAM,iBAAiB,iCAAkC,CAAA;AAAA,IACrD,aAAe,EAAA;AAAA,GAClB,CAAA;AACD,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACjB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA;AAAA,GACjB,CAAA;AACL","file":"index.mjs","sourcesContent":["/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport { containsBytes, getU8Encoder, type Address, type ReadonlyUint8Array } from '@solana/kit';\nimport {\n type ParsedRequestHeapFrameInstruction,\n type ParsedRequestUnitsInstruction,\n type ParsedSetComputeUnitLimitInstruction,\n type ParsedSetComputeUnitPriceInstruction,\n type 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: ReadonlyUint8Array } | ReadonlyUint8Array,\n): ComputeBudgetInstruction {\n const data = 'data' in instruction ? instruction.data : instruction;\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('The provided instruction could not be identified as a computeBudget instruction.');\n}\n\nexport type ParsedComputeBudgetInstruction<TProgram extends string = 'ComputeBudget111111111111111111111111111111'> =\n | ({ instructionType: ComputeBudgetInstruction.RequestUnits } & ParsedRequestUnitsInstruction<TProgram>)\n | ({ instructionType: ComputeBudgetInstruction.RequestHeapFrame } & 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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1;\n\nexport function getRequestHeapFrameDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_HEAP_FRAME_DISCRIMINATOR);\n}\n\nexport type RequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR }),\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): FixedSizeDecoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): FixedSizeCodec<\n RequestHeapFrameInstructionDataArgs,\n RequestHeapFrameInstructionData\n> {\n return combineCodec(getRequestHeapFrameInstructionDataEncoder(), getRequestHeapFrameInstructionDataDecoder());\n}\n\nexport type RequestHeapFrameInput = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport function getRequestHeapFrameInstruction<TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>(\n input: RequestHeapFrameInput,\n config?: { programAddress?: TProgramAddress },\n): RequestHeapFrameInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestHeapFrameInstructionDataEncoder().encode(args as RequestHeapFrameInstructionDataArgs),\n programAddress,\n } as RequestHeapFrameInstruction<TProgramAddress>);\n}\n\nexport type ParsedRequestHeapFrameInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const REQUEST_UNITS_DISCRIMINATOR = 0;\n\nexport function getRequestUnitsDiscriminatorBytes() {\n return getU8Encoder().encode(REQUEST_UNITS_DISCRIMINATOR);\n}\n\nexport type RequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR }),\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): FixedSizeDecoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): FixedSizeCodec<\n RequestUnitsInstructionDataArgs,\n RequestUnitsInstructionData\n> {\n return combineCodec(getRequestUnitsInstructionDataEncoder(), getRequestUnitsInstructionDataDecoder());\n}\n\nexport type RequestUnitsInput = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport function getRequestUnitsInstruction<TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS>(\n input: RequestUnitsInput,\n config?: { programAddress?: TProgramAddress },\n): RequestUnitsInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getRequestUnitsInstructionDataEncoder().encode(args as RequestUnitsInstructionDataArgs),\n programAddress,\n } as RequestUnitsInstruction<TProgramAddress>);\n}\n\nexport type ParsedRequestUnitsInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\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 Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2;\n\nexport function getSetComputeUnitLimitDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR }),\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): FixedSizeCodec<\n SetComputeUnitLimitInstructionDataArgs,\n SetComputeUnitLimitInstructionData\n> {\n return combineCodec(getSetComputeUnitLimitInstructionDataEncoder(), getSetComputeUnitLimitInstructionDataDecoder());\n}\n\nexport type SetComputeUnitLimitInput = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport function getSetComputeUnitLimitInstruction<\n TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitLimitInput,\n config?: { programAddress?: TProgramAddress },\n): SetComputeUnitLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(args as SetComputeUnitLimitInstructionDataArgs),\n programAddress,\n } as SetComputeUnitLimitInstruction<TProgramAddress>);\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedSetComputeUnitLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitLimitInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU64Decoder,\n getU64Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3;\n\nexport function getSetComputeUnitPriceDiscriminatorBytes() {\n return getU8Encoder().encode(SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR);\n}\n\nexport type SetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<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(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n value => ({ ...value, discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR }),\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<\n SetComputeUnitPriceInstructionDataArgs,\n SetComputeUnitPriceInstructionData\n> {\n return combineCodec(getSetComputeUnitPriceInstructionDataEncoder(), getSetComputeUnitPriceInstructionDataDecoder());\n}\n\nexport type SetComputeUnitPriceInput = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport function getSetComputeUnitPriceInstruction<\n TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetComputeUnitPriceInput,\n config?: { programAddress?: TProgramAddress },\n): SetComputeUnitPriceInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(args as SetComputeUnitPriceInstructionDataArgs),\n programAddress,\n } as SetComputeUnitPriceInstruction<TProgramAddress>);\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedSetComputeUnitPriceInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitPriceInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the Codama library.\n * Please DO NOT EDIT THIS FILE, instead use visitors\n * to add features, then rerun Codama to update it.\n *\n * @see https://github.com/codama-idl/codama\n */\n\nimport {\n combineCodec,\n getStructDecoder,\n getStructEncoder,\n getU32Decoder,\n getU32Encoder,\n getU8Decoder,\n getU8Encoder,\n transformEncoder,\n type AccountMeta,\n type Address,\n type FixedSizeCodec,\n type FixedSizeDecoder,\n type FixedSizeEncoder,\n type Instruction,\n type InstructionWithAccounts,\n type InstructionWithData,\n type ReadonlyUint8Array,\n} from '@solana/kit';\nimport { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs';\n\nexport const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4;\n\nexport function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes() {\n return getU8Encoder().encode(SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR);\n}\n\nexport type SetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n TRemainingAccounts extends readonly AccountMeta<string>[] = [],\n> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = { discriminator: number; accountDataSizeLimit: number };\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = { accountDataSizeLimit: number };\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n value => ({ ...value, discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR }),\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<\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 TProgramAddress extends Address = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n>(\n input: SetLoadedAccountsDataSizeLimitInput,\n config?: { programAddress?: TProgramAddress },\n): SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress> {\n // Program address.\n const programAddress = config?.programAddress ?? COMPUTE_BUDGET_PROGRAM_ADDRESS;\n\n // Original args.\n const args = { ...input };\n\n return Object.freeze({\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n ),\n programAddress,\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>);\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = { programAddress: Address<TProgram>; data: SetLoadedAccountsDataSizeLimitInstructionData };\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(\n instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>,\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * A provisory compute unit limit is used to indicate that the transaction\n * should be estimated for compute units before being sent to the network.\n *\n * Setting it to zero ensures the transaction fails unless it is properly estimated.\n */\nexport const PROVISORY_COMPUTE_UNIT_LIMIT = 0;\n\n/**\n * The maximum compute unit limit that can be set for a transaction.\n */\nexport const MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n","import {\n BaseTransactionMessage,\n getU32Decoder,\n getU64Decoder,\n Instruction,\n MicroLamports,\n ReadonlyUint8Array,\n} from '@solana/kit';\nimport {\n COMPUTE_BUDGET_PROGRAM_ADDRESS,\n ComputeBudgetInstruction,\n identifyComputeBudgetInstruction,\n SetComputeUnitLimitInstruction,\n SetComputeUnitPriceInstruction,\n} from './generated';\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message\n * and its set limit, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndexAndUnits(\n transactionMessage: BaseTransactionMessage,\n): { index: number; units: number } | null {\n const index = getSetComputeUnitLimitInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const units = getU32Decoder().decode(transactionMessage.instructions[index].data as ReadonlyUint8Array, 1);\n\n return { index, units };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitLimit` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitLimitInstructionIndex(transactionMessage: BaseTransactionMessage) {\n return transactionMessage.instructions.findIndex(isSetComputeUnitLimitInstruction);\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitLimit` instruction.\n */\nexport function isSetComputeUnitLimitInstruction(\n instruction: Instruction,\n): instruction is SetComputeUnitLimitInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitLimit\n );\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message\n * and its set micro-lamports, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndexAndMicroLamports(\n transactionMessage: BaseTransactionMessage,\n): { index: number; microLamports: MicroLamports } | null {\n const index = getSetComputeUnitPriceInstructionIndex(transactionMessage);\n if (index < 0) {\n return null;\n }\n\n const microLamports = getU64Decoder().decode(\n transactionMessage.instructions[index].data as ReadonlyUint8Array,\n 1,\n ) as MicroLamports;\n\n return { index, microLamports };\n}\n\n/**\n * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message, if any.\n */\nexport function getSetComputeUnitPriceInstructionIndex(transactionMessage: BaseTransactionMessage) {\n return transactionMessage.instructions.findIndex(isSetComputeUnitPriceInstruction);\n}\n\n/**\n * Checks if the given instruction is a `SetComputeUnitPrice` instruction.\n */\nexport function isSetComputeUnitPriceInstruction(\n instruction: Instruction,\n): instruction is SetComputeUnitPriceInstruction {\n return (\n instruction.programAddress === COMPUTE_BUDGET_PROGRAM_ADDRESS &&\n identifyComputeBudgetInstruction(instruction.data as Uint8Array) ===\n ComputeBudgetInstruction.SetComputeUnitPrice\n );\n}\n","import { appendTransactionMessageInstruction, BaseTransactionMessage } from '@solana/kit';\nimport { PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';\nimport { getSetComputeUnitLimitInstruction } from './generated';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\n\n/**\n * Appends a `SetComputeUnitLimit` instruction with a provisory\n * compute unit limit to a given transaction message\n * if and only if it does not already have one.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * fillProvisorySetComputeUnitLimitInstruction,\n * // ...\n * );\n * ```\n */\nexport function fillProvisorySetComputeUnitLimitInstruction<TTransactionMessage extends BaseTransactionMessage>(\n transactionMessage: TTransactionMessage,\n) {\n return updateOrAppendSetComputeUnitLimitInstruction(\n previousUnits => (previousUnits === null ? PROVISORY_COMPUTE_UNIT_LIMIT : previousUnits),\n transactionMessage,\n );\n}\n\n/**\n * Updates the first `SetComputeUnitLimit` instruction in a transaction message\n * with the given units, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param units - The new compute unit limit, or a function that takes the previous\n * compute unit limit and returns the new limit.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitLimitInstruction(\n * // E.g. Keep the current limit if it is set, otherwise set it to the maximum.\n * (currentUnits) => currentUnits === null ? MAX_COMPUTE_UNIT_LIMIT : currentUnits,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitLimitInstruction<TTransactionMessage extends BaseTransactionMessage>(\n units: number | ((previousUnits: number | null) => number),\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n const getUnits = (previousUnits: number | null): number =>\n typeof units === 'function' ? units(previousUnits) : units;\n const instructionDetails = getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitLimitInstruction({ units: getUnits(null) }),\n transactionMessage,\n ) as unknown as TTransactionMessage;\n }\n\n const { index, units: previousUnits } = instructionDetails;\n const newUnits = getUnits(previousUnits);\n if (newUnits === previousUnits) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitLimitInstruction({ units: newUnits });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n","import { BaseTransactionMessage, TransactionMessageWithFeePayer } from '@solana/kit';\nimport { MAX_COMPUTE_UNIT_LIMIT, PROVISORY_COMPUTE_UNIT_LIMIT } from './constants';\nimport {\n EstimateComputeUnitLimitFactoryFunction,\n EstimateComputeUnitLimitFactoryFunctionConfig,\n} from './estimateComputeLimitInternal';\nimport { getSetComputeUnitLimitInstructionIndexAndUnits } from './internal';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\n\ntype EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <\n TTransactionMessage extends BaseTransactionMessage & TransactionMessageWithFeePayer,\n>(\n transactionMessage: TTransactionMessage,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig,\n) => Promise<TTransactionMessage>;\n\n/**\n * Given a transaction message, if it does not have an explicit compute unit limit,\n * estimates the compute unit limit and updates the transaction message with\n * the estimated limit. Otherwise, returns the transaction message unchanged.\n *\n * It requires a function that estimates the compute unit limit.\n *\n * @example\n * ```ts\n * const estimateAndUpdateCUs = estimateAndUpdateProvisoryComputeUnitLimitFactory(\n * estimateComputeUnitLimitFactory({ rpc })\n * );\n *\n * const transactionMessageWithCUs = await estimateAndUpdateCUs(transactionMessage);\n * ```\n *\n * @see {@link estimateAndUpdateProvisoryComputeUnitLimitFactory}\n */\nexport function estimateAndUpdateProvisoryComputeUnitLimitFactory(\n estimateComputeUnitLimit: EstimateComputeUnitLimitFactoryFunction,\n): EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction {\n return async function fn(transactionMessage, config) {\n const instructionDetails = getSetComputeUnitLimitInstructionIndexAndUnits(transactionMessage);\n\n // If the transaction message already has a compute unit limit instruction\n // which is set to a specific value — i.e. not 0 or the maximum limit —\n // we don't need to estimate the compute unit limit.\n if (\n instructionDetails &&\n instructionDetails.units !== PROVISORY_COMPUTE_UNIT_LIMIT &&\n instructionDetails.units !== MAX_COMPUTE_UNIT_LIMIT\n ) {\n return transactionMessage;\n }\n\n return updateOrAppendSetComputeUnitLimitInstruction(\n await estimateComputeUnitLimit(transactionMessage, config),\n transactionMessage,\n );\n };\n}\n","import {\n BaseTransactionMessage,\n Commitment,\n compileTransaction,\n getBase64EncodedWireTransaction,\n getSolanaErrorFromTransactionError,\n isSolanaError,\n isTransactionMessageWithDurableNonceLifetime,\n pipe,\n Rpc,\n SimulateTransactionApi,\n Slot,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SolanaError,\n Transaction,\n TransactionMessageWithFeePayer,\n} from '@solana/kit';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\nimport { MAX_COMPUTE_UNIT_LIMIT } from './constants';\n\nexport type EstimateComputeUnitLimitFactoryConfig = Readonly<{\n /** An object that supports the {@link SimulateTransactionApi} of the Solana RPC API */\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\nexport type EstimateComputeUnitLimitFactoryFunction = (\n transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer,\n config?: EstimateComputeUnitLimitFactoryFunctionConfig,\n) => Promise<number>;\n\nexport type EstimateComputeUnitLimitFactoryFunctionConfig = {\n abortSignal?: AbortSignal;\n /**\n * Compute the estimate as of the highest slot that has reached this level of commitment.\n *\n * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For\n * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment\n * is `\"confirmed\"` unless configured otherwise. Unmitigated by an API layer on the client, the\n * default commitment applied by the server is `\"finalized\"`.\n */\n commitment?: Commitment;\n /**\n * Prevents accessing stale data by enforcing that the RPC node has processed transactions up to\n * this slot\n */\n minContextSlot?: Slot;\n};\n\ntype EstimateComputeUnitLimitConfig = EstimateComputeUnitLimitFactoryFunctionConfig &\n Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer;\n }>;\n\n/**\n * Simulates a transaction message on the network and returns the number of compute units it\n * consumed during simulation.\n *\n * The estimate this function returns can be used to set a compute unit limit on the transaction.\n * Correctly budgeting a compute unit limit for your transaction message can increase the probability\n * that your transaction will be accepted for processing.\n *\n * If you don't declare a compute unit limit on your transaction, validators will assume an upper\n * limit of 200K compute units (CU) per instruction. Since validators have an incentive to pack as\n * many transactions into each block as possible, they may choose to include transactions that they\n * know will fit into the remaining compute budget for the current block over transactions that\n * might not. For this reason, you should set a compute unit limit on each of your transaction\n * messages, whenever possible.\n *\n * ## Example\n *\n * ```ts\n * import { getSetComputeLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, getComputeUnitEstimateForTransactionMessageFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const getComputeUnitEstimateForTransactionMessage =\n * getComputeUnitEstimateForTransactionMessageFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume.\n * const computeUnitsEstimate =\n * await getComputeUnitEstimateForTransactionMessage(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeLimitInstruction({ units: computeUnitsEstimate }),\n * transactionMessage,\n * );\n * ```\n *\n * > [!WARNING]\n * > The compute unit estimate is just that – an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n */\nexport async function estimateComputeUnitLimit({\n transactionMessage,\n ...configs\n}: EstimateComputeUnitLimitConfig): Promise<number> {\n const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n const transaction = pipe(\n transactionMessage,\n m => updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m),\n compileTransaction,\n );\n\n return await simulateTransactionAndGetConsumedUnits({\n transaction,\n replaceRecentBlockhash,\n ...configs,\n });\n}\n\ntype SimulateTransactionAndGetConsumedUnitsConfig = Omit<EstimateComputeUnitLimitConfig, 'transactionMessage'> &\n Readonly<{ replaceRecentBlockhash?: boolean; transaction: Transaction }>;\n\nasync function simulateTransactionAndGetConsumedUnits({\n abortSignal,\n rpc,\n transaction,\n ...simulateConfig\n}: SimulateTransactionAndGetConsumedUnitsConfig): Promise<number> {\n const wireTransactionBytes = getBase64EncodedWireTransaction(transaction);\n\n try {\n const {\n value: { err: transactionError, unitsConsumed },\n } = await rpc\n .simulateTransaction(wireTransactionBytes, {\n ...simulateConfig,\n encoding: 'base64',\n sigVerify: false,\n })\n .send({ abortSignal });\n if (unitsConsumed == null) {\n // This should never be hit, because all RPCs should support `unitsConsumed` by now.\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT);\n }\n // FIXME(https://github.com/anza-xyz/agave/issues/1295): The simulation response returns\n // compute units as a u64, but the `SetComputeLimit` instruction only accepts a u32. Until\n // this changes, downcast it.\n const downcastUnitsConsumed = unitsConsumed > 4_294_967_295n ? 4_294_967_295 : Number(unitsConsumed);\n if (transactionError) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, {\n cause: getSolanaErrorFromTransactionError(transactionError),\n unitsConsumed: downcastUnitsConsumed,\n });\n }\n return downcastUnitsConsumed;\n } catch (e) {\n if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT)) throw e;\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, { cause: e });\n }\n}\n","import {\n estimateComputeUnitLimit,\n EstimateComputeUnitLimitFactoryConfig,\n EstimateComputeUnitLimitFactoryFunction,\n} from './estimateComputeLimitInternal';\n\n/**\n * Use this utility to estimate the actual compute unit cost of a given transaction message.\n *\n * Correctly budgeting a compute unit limit for your transaction message can increase the\n * probability that your transaction will be accepted for processing. If you don't declare a compute\n * unit limit on your transaction, validators will assume an upper limit of 200K compute units (CU)\n * per instruction.\n *\n * Since validators have an incentive to pack as many transactions into each block as possible, they\n * may choose to include transactions that they know will fit into the remaining compute budget for\n * the current block over transactions that might not. For this reason, you should set a compute\n * unit limit on each of your transaction messages, whenever possible.\n *\n * > [!WARNING]\n * > The compute unit estimate is just that -- an estimate. The compute unit consumption of the\n * > actual transaction might be higher or lower than what was observed in simulation. Unless you\n * > are confident that your particular transaction message will consume the same or fewer compute\n * > units as was estimated, you might like to augment the estimate by either a fixed number of CUs\n * > or a multiplier.\n *\n * > [!NOTE]\n * > If you are preparing an _unsigned_ transaction, destined to be signed and submitted to the\n * > network by a wallet, you might like to leave it up to the wallet to determine the compute unit\n * > limit. Consider that the wallet might have a more global view of how many compute units certain\n * > types of transactions consume, and might be able to make better estimates of an appropriate\n * > compute unit budget.\n *\n * > [!INFO]\n * > In the event that a transaction message does not already have a `SetComputeUnitLimit`\n * > instruction, this function will add one before simulation. This ensures that the compute unit\n * > consumption of the `SetComputeUnitLimit` instruction itself is included in the estimate.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { getSetComputeUnitLimitInstruction } from '@solana-program/compute-budget';\n * import { createSolanaRpc, estimateComputeUnitLimitFactory, pipe } from '@solana/kit';\n *\n * // Create an estimator function.\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const estimateComputeUnitLimit = estimateComputeUnitLimitFactory({ rpc });\n *\n * // Create your transaction message.\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 'legacy' }),\n * /* ... *\\/\n * );\n *\n * // Request an estimate of the actual compute units this message will consume. This is done by\n * // simulating the transaction and grabbing the estimated compute units from the result.\n * const estimatedUnits = await estimateComputeUnitLimit(transactionMessage);\n *\n * // Set the transaction message's compute unit budget.\n * const transactionMessageWithComputeUnitLimit = prependTransactionMessageInstruction(\n * getSetComputeUnitLimitInstruction({ units: estimatedUnits }),\n * transactionMessage,\n * );\n * ```\n */\nexport function estimateComputeUnitLimitFactory({\n rpc,\n}: EstimateComputeUnitLimitFactoryConfig): EstimateComputeUnitLimitFactoryFunction {\n return async function estimateComputeUnitLimitFactoryFunction(transactionMessage, config) {\n return await estimateComputeUnitLimit({\n ...config,\n rpc,\n transactionMessage,\n });\n };\n}\n","import { appendTransactionMessageInstruction, BaseTransactionMessage, MicroLamports } from '@solana/kit';\nimport { getSetComputeUnitPriceInstruction } from './generated';\nimport { getSetComputeUnitPriceInstructionIndexAndMicroLamports } from './internal';\n\n/**\n * Sets the compute unit price of a transaction message in micro-Lamports.\n *\n * @example\n * ```ts\n * const transactionMessage = pipe(\n * createTransactionMessage({ version: 0 }),\n * (m) => setTransactionMessageComputeUnitPrice(10_000, m),\n * // ...\n * );\n * ```\n */\nexport function setTransactionMessageComputeUnitPrice<TTransactionMessage extends BaseTransactionMessage>(\n microLamports: number | bigint,\n transactionMessage: TTransactionMessage,\n) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({ microLamports }),\n transactionMessage,\n );\n}\n\n/**\n * Updates the first `SetComputeUnitPrice` instruction in a transaction message\n * with the given micro-Lamports, or appends a new instruction if none exists.\n * A function of the current value can be provided instead of a static value.\n *\n * @param microLamports - The new compute unit price, or a function that\n * takes the previous price and returns the new one.\n * @param transactionMessage - The transaction message to update.\n *\n * @example\n * ```ts\n * const updatedTransactionMessage = updateOrAppendSetComputeUnitPriceInstruction(\n * // E.g. double the current price or set it to 10_000 if it isn't set.\n * (currentPrice) => currentPrice === null ? 10_000 : currentPrice * 2,\n * transactionMessage,\n * );\n * ```\n */\nexport function updateOrAppendSetComputeUnitPriceInstruction<TTransactionMessage extends BaseTransactionMessage>(\n microLamports: MicroLamports | ((previousMicroLamports: MicroLamports | null) => MicroLamports),\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n const getMicroLamports = (previousMicroLamports: MicroLamports | null): MicroLamports =>\n typeof microLamports === 'function' ? microLamports(previousMicroLamports) : microLamports;\n const instructionDetails = getSetComputeUnitPriceInstructionIndexAndMicroLamports(transactionMessage);\n\n if (!instructionDetails) {\n return appendTransactionMessageInstruction(\n getSetComputeUnitPriceInstruction({\n microLamports: getMicroLamports(null),\n }),\n transactionMessage,\n ) as unknown as TTransactionMessage;\n }\n\n const { index, microLamports: previousMicroLamports } = instructionDetails;\n const newMicroLamports = getMicroLamports(previousMicroLamports);\n if (newMicroLamports === previousMicroLamports) {\n return transactionMessage;\n }\n\n const newInstruction = getSetComputeUnitPriceInstruction({\n microLamports: newMicroLamports,\n });\n const newInstructions = [...transactionMessage.instructions];\n newInstructions.splice(index, 1, newInstruction);\n return Object.freeze({\n ...transactionMessage,\n instructions: newInstructions,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateAndSetComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateAndSetComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"estimateAndSetComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateAndSetComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EACH,uCAAuC,EACvC,6CAA6C,EAChD,MAAM,gCAAgC,CAAC;AAIxC,KAAK,yDAAyD,GAAG,CAC7D,mBAAmB,SAAS,sBAAsB,GAAG,8BAA8B,EAEnF,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,6CAA6C,KACrD,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC7D,wBAAwB,EAAE,uCAAuC,GAClE,yDAAyD,CAoB3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"estimateComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,qCAAqC,EACrC,uCAAuC,EAC1C,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,+BAA+B,CAAC,EAC5C,GAAG,GACN,EAAE,qCAAqC,GAAG,uCAAuC,CAQjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateComputeLimitInternal.d.ts","sourceRoot":"","sources":["../../src/estimateComputeLimitInternal.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"estimateComputeLimitInternal.d.ts","sourceRoot":"","sources":["../../src/estimateComputeLimitInternal.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,UAAU,EAOV,GAAG,EACH,sBAAsB,EACtB,IAAI,EAKJ,8BAA8B,EACjC,MAAM,aAAa,CAAC;AAIrB,MAAM,MAAM,qCAAqC,GAAG,QAAQ,CAAC;IACzD,uFAAuF;IACvF,GAAG,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,uCAAuC,GAAG,CAClD,kBAAkB,EAAE,sBAAsB,GAAG,8BAA8B,EAC3E,MAAM,CAAC,EAAE,6CAA6C,KACrD,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,MAAM,6CAA6C,GAAG;IACxD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC;CACzB,CAAC;AAEF,KAAK,8BAA8B,GAAG,6CAA6C,GAC/E,QAAQ,CAAC;IACL,GAAG,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACjC,kBAAkB,EAAE,sBAAsB,GAAG,8BAA8B,CAAC;CAC/E,CAAC,CAAC;AAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAsB,wBAAwB,CAAC,EAC3C,kBAAkB,EAClB,GAAG,OAAO,EACb,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAalD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHeapFrame.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestHeapFrame.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"requestHeapFrame.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestHeapFrame.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,wBAAgB,qCAAqC,uBAEpD;AAED,MAAM,MAAM,2BAA2B,CACnC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9D,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;AAElH,MAAM,MAAM,+BAA+B,GAAG;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAC9C;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,yCAAyC,IAAI,gBAAgB,CAAC,mCAAmC,CAAC,CAQjH;AAED,wBAAgB,yCAAyC,IAAI,gBAAgB,CAAC,+BAA+B,CAAC,CAK7G;AAED,wBAAgB,uCAAuC,IAAI,cAAc,CACrE,mCAAmC,EACnC,+BAA+B,CAClC,CAEA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAChC,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,CAAC;CACvD,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAClH,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9C,2BAA2B,CAAC,eAAe,CAAC,CAW9C;AAED,MAAM,MAAM,iCAAiC,CAAC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAAI;IAC7G,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,+BAA+B,CAAC;CACzC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EACpE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,iCAAiC,CAAC,QAAQ,CAAC,CAK7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestUnits.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestUnits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"requestUnits.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestUnits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,wBAAgB,iCAAiC,uBAEhD;AAED,MAAM,MAAM,uBAAuB,CAC/B,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAA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EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,6BAA6B,CAAC,QAAQ,CAAC,CAKzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setComputeUnitLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"setComputeUnitLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,wBAAgB,wCAAwC,uBAEvD;AAED,MAAM,MAAM,8BAA8B,CACtC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9D,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;AAElH,MAAM,MAAM,kCAAkC,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACjD,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,4CAA4C,IAAI,gBAAgB,CAAC,sCAAsC,CAAC,CAQvH;AAED,wBAAgB,4CAA4C,IAAI,gBAAgB,CAAC,kCAAkC,CAAC,CAKnH;AAED,wBAAgB,0CAA0C,IAAI,cAAc,CACxE,sCAAsC,EACtC,kCAAkC,CACrC,CAEA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,EAAE,sCAAsC,CAAC,OAAO,CAAC,CAAC;CAC1D,CAAC;AAEF,wBAAgB,iCAAiC,CAC7C,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,wBAAwB,EAC/B,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9C,8BAA8B,CAAC,eAAe,CAAC,CAWjD;AAED,MAAM,MAAM,oCAAoC,CAAC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAAI;IAChH,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,kCAAkC,CAAC;CAC5C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,MAAM,EACvE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,oCAAoC,CAAC,QAAQ,CAAC,CAKhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setComputeUnitPrice.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitPrice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"setComputeUnitPrice.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitPrice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EA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IAAI;IAChH,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,kCAAkC,CAAC;CAC5C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,MAAM,EACvE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,oCAAoC,CAAC,QAAQ,CAAC,CAKhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASH,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,iDAAiD,IAAI,CAAC;AAEnE,wBAAgB,mDAAmD,uBAElE;AAED,MAAM,MAAM,yCAAyC,CACjD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC9D,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;AAElH,MAAM,MAAM,6CAA6C,GAAG;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpH,MAAM,MAAM,iDAAiD,GAAG;IAAE,oBAAoB,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,wBAAgB,uDAAuD,IAAI,gBAAgB,CAAC,iDAAiD,CAAC,CAQ7I;AAED,wBAAgB,uDAAuD,IAAI,gBAAgB,CAAC,6CAA6C,CAAC,CAKzI;AAED,wBAAgB,qDAAqD,IAAI,cAAc,CACnF,iDAAiD,EACjD,6CAA6C,CAChD,CAKA;AAED,MAAM,MAAM,mCAAmC,GAAG;IAC9C,oBAAoB,EAAE,iDAAiD,CAAC,sBAAsB,CAAC,CAAC;CACnG,CAAC;AAEF,wBAAgB,4CAA4C,CACxD,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,mCAAmC,EAC1C,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9C,yCAAyC,CAAC,eAAe,CAAC,CAa5D;AAED,MAAM,MAAM,+CAA+C,CACvD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC/D;IAAE,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAAC,IAAI,EAAE,6CAA6C,CAAA;CAAE,CAAC;AAE/F,wBAAgB,8CAA8C,CAAC,QAAQ,SAAS,MAAM,EAClF,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC7E,+CAA+C,CAAC,QAAQ,CAAC,CAK3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeBudget.d.ts","sourceRoot":"","sources":["../../../../src/generated/programs/computeBudget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"computeBudget.d.ts","sourceRoot":"","sources":["../../../../src/generated/programs/computeBudget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG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,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,GACvE,OAAO,CAAC,CAAC,CAAC,GACV,qBAAqB,CAAC,CAAC,CAAC,GACxB,iBAAiB,CAAC,CAAC,CAAC,GACpB,IAAI,IACV;IACA,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC;CACZ,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,OAAO,EAAE,uBAAuB,EAAE,SAAS,GAAG,WAAW,aAC1F,eAAe,KAAG,WAAW,GAAG,iBAAiB,GAAG,SAAS,CAajF;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChE,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,qBAAqB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GACzF,KAAK,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAEtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EAGtB,WAAW,EACX,aAAa,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAIH,8BAA8B,EAC9B,8BAA8B,EACjC,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,8CAA8C,CAC1D,kBAAkB,EAAE,sBAAsB,GAC3C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CASzC;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,kBAAkB,EAAE,sBAAsB,UAEhG;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC5C,WAAW,EAAE,WAAW,GACzB,WAAW,IAAI,8BAA8B,CAM/C;AAED;;;GAGG;AACH,wBAAgB,sDAAsD,CAClE,kBAAkB,EAAE,sBAAsB,GAC3C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAYxD;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CAAC,kBAAkB,EAAE,sBAAsB,UAEhG;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC5C,WAAW,EAAE,WAAW,GACzB,WAAW,IAAI,8BAA8B,CAM/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setComputeLimit.d.ts","sourceRoot":"","sources":["../../src/setComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"setComputeLimit.d.ts","sourceRoot":"","sources":["../../src/setComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAK1F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2CAA2C,CAAC,mBAAmB,SAAS,sBAAsB,EAC1G,kBAAkB,EAAE,mBAAmB,uBAM1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAAC,mBAAmB,SAAS,sBAAsB,EAC3G,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC,EAC1D,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CAyBrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,sBAAsB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIzG;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CAAC,mBAAmB,SAAS,sBAAsB,EACpG,aAAa,EAAE,MAAM,GAAG,MAAM,EAC9B,kBAAkB,EAAE,mBAAmB;;EAM1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAAC,mBAAmB,SAAS,sBAAsB,EAC3G,aAAa,EAAE,aAAa,GAAG,CAAC,CAAC,qBAAqB,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,CAAC,EAC/F,kBAAkB,EAAE,mBAAmB,GACxC,mBAAmB,CA6BrB"}
|