@solana-program/compute-budget
Advanced tools
+1
-23
@@ -351,23 +351,2 @@ 'use strict'; | ||
| } | ||
| var PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT = { | ||
| blockhash: "11111111111111111111111111111111", | ||
| lastValidBlockHeight: 0n | ||
| // This is not included in compiled transactions; it can be anything. | ||
| }; | ||
| function fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash(transactionMessage) { | ||
| if ("lifetimeConstraint" in transactionMessage) { | ||
| return transactionMessage; | ||
| } | ||
| return setTransactionMessageLifetimeUsingProvisoryBlockhash( | ||
| transactionMessage | ||
| ); | ||
| } | ||
| function setTransactionMessageLifetimeUsingProvisoryBlockhash(transactionMessage) { | ||
| return kit.setTransactionMessageLifetimeUsingBlockhash( | ||
| PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT, | ||
| transactionMessage | ||
| ); | ||
| } | ||
| // src/estimateComputeLimitInternal.ts | ||
| async function estimateComputeUnitLimit({ | ||
@@ -377,6 +356,5 @@ transactionMessage, | ||
| }) { | ||
| const replaceRecentBlockhash = !kit.isDurableNonceTransaction(transactionMessage); | ||
| const replaceRecentBlockhash = !kit.isTransactionMessageWithDurableNonceLifetime(transactionMessage); | ||
| const transaction = kit.pipe( | ||
| transactionMessage, | ||
| fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash, | ||
| (m) => updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m), | ||
@@ -383,0 +361,0 @@ kit.compileTransaction |
@@ -1,1 +0,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/internalMoveToKit.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","setTransactionMessageLifetimeUsingBlockhash","isDurableNonceTransaction","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,8CAAA;AAEU,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACL,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gCAAA,CAAA;AALU,EAAAA,OAAAA,yBAAAA,CAAAA;AAAA,CAAA,EAAA,wBAAA,IAAA,EAAA,EAAA;AAQL,SAAS,iCACd,WAC0B,EAAA;AAC1B,EAAA,MAAM,IAAO,GAAA,MAAA,IAAU,WAAc,GAAA,WAAA,CAAY,IAAO,GAAA,WAAA,CAAA;AACxD,EAAI,IAAAC,iBAAA,CAAc,MAAMC,gBAAa,EAAA,CAAE,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GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,aAAe,EAAA,qBAAA,EAA0B,GAAA,kBAAA,CAAA;AACxD,EAAM,MAAA,gBAAA,GAAmB,iBAAiB,qBAAqB,CAAA,CAAA;AAC/D,EAAA,IAAI,qBAAqB,qBAAuB,EAAA;AAC9C,IAAO,OAAA,kBAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,iBAAiB,iCAAkC,CAAA;AAAA,IACvD,aAAe,EAAA,gBAAA;AAAA,GAChB,CAAA,CAAA;AACD,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACnB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA,eAAA;AAAA,GACf,CAAA,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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestHeapFrameInstructionData = {\n discriminator: number;\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport type RequestHeapFrameInstructionDataArgs = {\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport function getRequestHeapFrameInstructionDataEncoder(): Encoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR })\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): Decoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): Codec<\n RequestHeapFrameInstructionDataArgs,\n RequestHeapFrameInstructionData\n> {\n return combineCodec(\n getRequestHeapFrameInstructionDataEncoder(),\n getRequestHeapFrameInstructionDataDecoder()\n );\n}\n\nexport type RequestHeapFrameInput = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport function getRequestHeapFrameInstruction<\n 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 const instruction = {\n programAddress,\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n } as RequestHeapFrameInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestHeapFrameInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestHeapFrameInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestUnitsInstructionData = {\n discriminator: number;\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport type RequestUnitsInstructionDataArgs = {\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport function getRequestUnitsInstructionDataEncoder(): Encoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR })\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): Decoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): Codec<\n RequestUnitsInstructionDataArgs,\n RequestUnitsInstructionData\n> {\n return combineCodec(\n getRequestUnitsInstructionDataEncoder(),\n getRequestUnitsInstructionDataDecoder()\n );\n}\n\nexport type RequestUnitsInput = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport function getRequestUnitsInstruction<\n 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 const instruction = {\n programAddress,\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n } as RequestUnitsInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestUnitsInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestUnitsInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitLimitInstructionData = {\n discriminator: number;\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport type SetComputeUnitLimitInstructionDataArgs = {\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport function getSetComputeUnitLimitInstructionDataEncoder(): Encoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): Decoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): Codec<\n SetComputeUnitLimitInstructionDataArgs,\n SetComputeUnitLimitInstructionData\n> {\n return combineCodec(\n getSetComputeUnitLimitInstructionDataEncoder(),\n getSetComputeUnitLimitInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitLimitInput = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport function getSetComputeUnitLimitInstruction<\n 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 const instruction = {\n programAddress,\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n } as SetComputeUnitLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitPriceInstructionData = {\n discriminator: number;\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: bigint;\n};\n\nexport type SetComputeUnitPriceInstructionDataArgs = {\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: number | bigint;\n};\n\nexport function getSetComputeUnitPriceInstructionDataEncoder(): Encoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): Decoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): Codec<\n SetComputeUnitPriceInstructionDataArgs,\n SetComputeUnitPriceInstructionData\n> {\n return combineCodec(\n getSetComputeUnitPriceInstructionDataEncoder(),\n getSetComputeUnitPriceInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitPriceInput = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport function getSetComputeUnitPriceInstruction<\n 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 const instruction = {\n programAddress,\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n } as SetComputeUnitPriceInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitPriceInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitPriceInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = {\n discriminator: number;\n accountDataSizeLimit: number;\n};\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {\n accountDataSizeLimit: number;\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): Encoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): Decoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): Codec<\n SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n SetLoadedAccountsDataSizeLimitInstructionData\n> {\n return combineCodec(\n getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),\n getSetLoadedAccountsDataSizeLimitInstructionDataDecoder()\n );\n}\n\nexport type SetLoadedAccountsDataSizeLimitInput = {\n accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstruction<\n 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 const instruction = {\n programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetLoadedAccountsDataSizeLimitInstructionData;\n};\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string,\n>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\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 IInstruction,\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: IInstruction\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: IInstruction\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 );\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 CompilableTransactionMessage,\n ITransactionMessageWithFeePayer,\n TransactionMessage,\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\n | CompilableTransactionMessage\n | (TransactionMessage & ITransactionMessageWithFeePayer),\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","// TODO: Add these helpers to @solana/kit in v3.\n\nimport {\n BaseTransactionMessage,\n Blockhash,\n setTransactionMessageLifetimeUsingBlockhash,\n TransactionMessageWithBlockhashLifetime,\n TransactionMessageWithDurableNonceLifetime,\n} from '@solana/kit';\n\n/**\n * An invalid blockhash lifetime constraint used as a placeholder for\n * transaction messages that are not yet ready to be compiled.\n *\n * This enables various operations on the transaction message, such as\n * simulating it or calculating its transaction size, whilst defering\n * the actual blockhash to a later stage.\n */\nexport const PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT: TransactionMessageWithBlockhashLifetime['lifetimeConstraint'] =\n {\n blockhash: '11111111111111111111111111111111' as Blockhash,\n lastValidBlockHeight: 0n, // This is not included in compiled transactions; it can be anything.\n };\n\n/**\n * Sets a provisory blockhash lifetime constraint on the transaction message\n * if and only if it doesn't already have a lifetime constraint.\n */\nexport function fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n transactionMessage: TTransactionMessage\n): TTransactionMessage &\n (\n | TransactionMessageWithBlockhashLifetime\n | TransactionMessageWithDurableNonceLifetime\n ) {\n type ReturnType = TTransactionMessage &\n (\n | TransactionMessageWithBlockhashLifetime\n | TransactionMessageWithDurableNonceLifetime\n );\n\n if ('lifetimeConstraint' in transactionMessage) {\n return transactionMessage as ReturnType;\n }\n\n return setTransactionMessageLifetimeUsingProvisoryBlockhash(\n transactionMessage\n );\n}\n\n/**\n * Sets a provisory blockhash lifetime constraint on the transaction message.\n */\nexport function setTransactionMessageLifetimeUsingProvisoryBlockhash<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n transactionMessage: TTransactionMessage\n): TTransactionMessage & TransactionMessageWithBlockhashLifetime {\n return setTransactionMessageLifetimeUsingBlockhash(\n PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT,\n transactionMessage\n );\n}\n","import {\n Commitment,\n CompilableTransactionMessage,\n compileTransaction,\n getBase64EncodedWireTransaction,\n isDurableNonceTransaction,\n isSolanaError,\n ITransactionMessageWithFeePayer,\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 TransactionMessage,\n} from '@solana/kit';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\nimport { MAX_COMPUTE_UNIT_LIMIT } from './constants';\nimport { fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash } from './internalMoveToKit';\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:\n | CompilableTransactionMessage\n | (TransactionMessage & ITransactionMessageWithFeePayer),\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:\n | CompilableTransactionMessage\n | (TransactionMessage & ITransactionMessageWithFeePayer);\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 = !isDurableNonceTransaction(transactionMessage);\n const transaction = pipe(\n transactionMessage,\n fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash,\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 );\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"]} | ||
| {"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,8CAAA;AAEU,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACL,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,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AA,GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,aAAe,EAAA,qBAAA,EAA0B,GAAA,kBAAA,CAAA;AACxD,EAAM,MAAA,gBAAA,GAAmB,iBAAiB,qBAAqB,CAAA,CAAA;AAC/D,EAAA,IAAI,qBAAqB,qBAAuB,EAAA;AAC9C,IAAO,OAAA,kBAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,iBAAiB,iCAAkC,CAAA;AAAA,IACvD,aAAe,EAAA,gBAAA;AAAA,GAChB,CAAA,CAAA;AACD,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACnB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA,eAAA;AAAA,GACf,CAAA,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 const instruction = {\n programAddress,\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n } as RequestHeapFrameInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n } as RequestUnitsInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n } as SetComputeUnitLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n } as SetComputeUnitPriceInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetLoadedAccountsDataSizeLimitInstructionData;\n};\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string,\n>(\n instruction: 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"]} |
+2
-24
@@ -1,2 +0,2 @@ | ||
| import { containsBytes, getU8Encoder, transformEncoder, getStructEncoder, getU32Encoder, getStructDecoder, getU8Decoder, getU32Decoder, combineCodec, getU64Encoder, getU64Decoder, appendTransactionMessageInstruction, isDurableNonceTransaction, pipe, compileTransaction, getBase64EncodedWireTransaction, SolanaError, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, isSolanaError, setTransactionMessageLifetimeUsingBlockhash } from '@solana/kit'; | ||
| 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'; | ||
@@ -349,23 +349,2 @@ // src/generated/instructions/requestHeapFrame.ts | ||
| } | ||
| var PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT = { | ||
| blockhash: "11111111111111111111111111111111", | ||
| lastValidBlockHeight: 0n | ||
| // This is not included in compiled transactions; it can be anything. | ||
| }; | ||
| function fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash(transactionMessage) { | ||
| if ("lifetimeConstraint" in transactionMessage) { | ||
| return transactionMessage; | ||
| } | ||
| return setTransactionMessageLifetimeUsingProvisoryBlockhash( | ||
| transactionMessage | ||
| ); | ||
| } | ||
| function setTransactionMessageLifetimeUsingProvisoryBlockhash(transactionMessage) { | ||
| return setTransactionMessageLifetimeUsingBlockhash( | ||
| PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT, | ||
| transactionMessage | ||
| ); | ||
| } | ||
| // src/estimateComputeLimitInternal.ts | ||
| async function estimateComputeUnitLimit({ | ||
@@ -375,6 +354,5 @@ transactionMessage, | ||
| }) { | ||
| const replaceRecentBlockhash = !isDurableNonceTransaction(transactionMessage); | ||
| const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage); | ||
| const transaction = pipe( | ||
| transactionMessage, | ||
| fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash, | ||
| (m) => updateOrAppendSetComputeUnitLimitInstruction(MAX_COMPUTE_UNIT_LIMIT, m), | ||
@@ -381,0 +359,0 @@ compileTransaction |
@@ -1,1 +0,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/internalMoveToKit.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,8CAAA;AAEU,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACL,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gCAAA,CAAA;AALU,EAAAA,OAAAA,yBAAAA,CAAAA;AAAA,CAAA,EAAA,wBAAA,IAAA,EAAA,EAAA;AAQL,SAAS,iCACd,WAC0B,EAAA;AAC1B,EAAA,MAAM,IAAO,GAAA,MAAA,IAAU,WAAc,GAAA,WAAA,CAAY,IAAO,GAAA,WAAA,CAAA;AACxD,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa,EAAA,CAAE,OAAO,CAAC,CAAA,EAAG,CAAC,CAAG,EAAA;AACpD,IAAO,OAAA,CAAA,oBAAA;AAAA,GACT;AACA,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa,EAAA,CAAE,OAAO,CAAC,CAAA,EAAG,CAAC,CAAG,EAAA;AACpD,IAAO,OAAA,CAAA,wBAAA;AAAA,GACT;AACA,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa,EAAA,CAAE,OAAO,CAAC,CAAA,EAAG,CAAC,CAAG,EAA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;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACnB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA,eAAA;AAAA,GACf,CAAA,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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestHeapFrameInstructionData = {\n discriminator: number;\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport type RequestHeapFrameInstructionDataArgs = {\n /**\n * Requested transaction-wide program heap size in bytes.\n * Must be multiple of 1024. Applies to each program, including CPIs.\n */\n bytes: number;\n};\n\nexport function getRequestHeapFrameInstructionDataEncoder(): Encoder<RequestHeapFrameInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['bytes', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_HEAP_FRAME_DISCRIMINATOR })\n );\n}\n\nexport function getRequestHeapFrameInstructionDataDecoder(): Decoder<RequestHeapFrameInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['bytes', getU32Decoder()],\n ]);\n}\n\nexport function getRequestHeapFrameInstructionDataCodec(): Codec<\n RequestHeapFrameInstructionDataArgs,\n RequestHeapFrameInstructionData\n> {\n return combineCodec(\n getRequestHeapFrameInstructionDataEncoder(),\n getRequestHeapFrameInstructionDataDecoder()\n );\n}\n\nexport type RequestHeapFrameInput = {\n bytes: RequestHeapFrameInstructionDataArgs['bytes'];\n};\n\nexport function getRequestHeapFrameInstruction<\n 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 const instruction = {\n programAddress,\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n } as RequestHeapFrameInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestHeapFrameInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestHeapFrameInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type RequestUnitsInstructionData = {\n discriminator: number;\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport type RequestUnitsInstructionDataArgs = {\n /** Units to request for transaction-wide compute. */\n units: number;\n /** Prioritization fee lamports. */\n additionalFee: number;\n};\n\nexport function getRequestUnitsInstructionDataEncoder(): Encoder<RequestUnitsInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ['additionalFee', getU32Encoder()],\n ]),\n (value) => ({ ...value, discriminator: REQUEST_UNITS_DISCRIMINATOR })\n );\n}\n\nexport function getRequestUnitsInstructionDataDecoder(): Decoder<RequestUnitsInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ['additionalFee', getU32Decoder()],\n ]);\n}\n\nexport function getRequestUnitsInstructionDataCodec(): Codec<\n RequestUnitsInstructionDataArgs,\n RequestUnitsInstructionData\n> {\n return combineCodec(\n getRequestUnitsInstructionDataEncoder(),\n getRequestUnitsInstructionDataDecoder()\n );\n}\n\nexport type RequestUnitsInput = {\n units: RequestUnitsInstructionDataArgs['units'];\n additionalFee: RequestUnitsInstructionDataArgs['additionalFee'];\n};\n\nexport function getRequestUnitsInstruction<\n 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 const instruction = {\n programAddress,\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n } as RequestUnitsInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedRequestUnitsInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getRequestUnitsInstructionDataDecoder().decode(instruction.data),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitLimitInstructionData = {\n discriminator: number;\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport type SetComputeUnitLimitInstructionDataArgs = {\n /** Transaction-wide compute unit limit. */\n units: number;\n};\n\nexport function getSetComputeUnitLimitInstructionDataEncoder(): Encoder<SetComputeUnitLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['units', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitLimitInstructionDataDecoder(): Decoder<SetComputeUnitLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['units', getU32Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitLimitInstructionDataCodec(): Codec<\n SetComputeUnitLimitInstructionDataArgs,\n SetComputeUnitLimitInstructionData\n> {\n return combineCodec(\n getSetComputeUnitLimitInstructionDataEncoder(),\n getSetComputeUnitLimitInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitLimitInput = {\n units: SetComputeUnitLimitInstructionDataArgs['units'];\n};\n\nexport function getSetComputeUnitLimitInstruction<\n 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 const instruction = {\n programAddress,\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n } as SetComputeUnitLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetComputeUnitPriceInstructionData = {\n discriminator: number;\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: bigint;\n};\n\nexport type SetComputeUnitPriceInstructionDataArgs = {\n /** Transaction compute unit price used for prioritization fees. */\n microLamports: number | bigint;\n};\n\nexport function getSetComputeUnitPriceInstructionDataEncoder(): Encoder<SetComputeUnitPriceInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['microLamports', getU64Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetComputeUnitPriceInstructionDataDecoder(): Decoder<SetComputeUnitPriceInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['microLamports', getU64Decoder()],\n ]);\n}\n\nexport function getSetComputeUnitPriceInstructionDataCodec(): Codec<\n SetComputeUnitPriceInstructionDataArgs,\n SetComputeUnitPriceInstructionData\n> {\n return combineCodec(\n getSetComputeUnitPriceInstructionDataEncoder(),\n getSetComputeUnitPriceInstructionDataDecoder()\n );\n}\n\nexport type SetComputeUnitPriceInput = {\n microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports'];\n};\n\nexport function getSetComputeUnitPriceInstruction<\n 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 const instruction = {\n programAddress,\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n } as SetComputeUnitPriceInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetComputeUnitPriceInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetComputeUnitPriceInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\n * This code was AUTOGENERATED using the 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 Address,\n type Codec,\n type Decoder,\n type Encoder,\n type IAccountMeta,\n type IInstruction,\n type IInstructionWithAccounts,\n type IInstructionWithData,\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 IAccountMeta<string>[] = [],\n> = IInstruction<TProgram> &\n IInstructionWithData<Uint8Array> &\n IInstructionWithAccounts<TRemainingAccounts>;\n\nexport type SetLoadedAccountsDataSizeLimitInstructionData = {\n discriminator: number;\n accountDataSizeLimit: number;\n};\n\nexport type SetLoadedAccountsDataSizeLimitInstructionDataArgs = {\n accountDataSizeLimit: number;\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): Encoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs> {\n return transformEncoder(\n getStructEncoder([\n ['discriminator', getU8Encoder()],\n ['accountDataSizeLimit', getU32Encoder()],\n ]),\n (value) => ({\n ...value,\n discriminator: SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR,\n })\n );\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): Decoder<SetLoadedAccountsDataSizeLimitInstructionData> {\n return getStructDecoder([\n ['discriminator', getU8Decoder()],\n ['accountDataSizeLimit', getU32Decoder()],\n ]);\n}\n\nexport function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): Codec<\n SetLoadedAccountsDataSizeLimitInstructionDataArgs,\n SetLoadedAccountsDataSizeLimitInstructionData\n> {\n return combineCodec(\n getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(),\n getSetLoadedAccountsDataSizeLimitInstructionDataDecoder()\n );\n}\n\nexport type SetLoadedAccountsDataSizeLimitInput = {\n accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit'];\n};\n\nexport function getSetLoadedAccountsDataSizeLimitInstruction<\n 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 const instruction = {\n programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetLoadedAccountsDataSizeLimitInstructionData;\n};\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string,\n>(\n instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>\n): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram> {\n return {\n programAddress: instruction.programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataDecoder().decode(\n instruction.data\n ),\n };\n}\n","/**\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 IInstruction,\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: IInstruction\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: IInstruction\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 );\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 CompilableTransactionMessage,\n ITransactionMessageWithFeePayer,\n TransactionMessage,\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\n | CompilableTransactionMessage\n | (TransactionMessage & ITransactionMessageWithFeePayer),\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","// TODO: Add these helpers to @solana/kit in v3.\n\nimport {\n BaseTransactionMessage,\n Blockhash,\n setTransactionMessageLifetimeUsingBlockhash,\n TransactionMessageWithBlockhashLifetime,\n TransactionMessageWithDurableNonceLifetime,\n} from '@solana/kit';\n\n/**\n * An invalid blockhash lifetime constraint used as a placeholder for\n * transaction messages that are not yet ready to be compiled.\n *\n * This enables various operations on the transaction message, such as\n * simulating it or calculating its transaction size, whilst defering\n * the actual blockhash to a later stage.\n */\nexport const PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT: TransactionMessageWithBlockhashLifetime['lifetimeConstraint'] =\n {\n blockhash: '11111111111111111111111111111111' as Blockhash,\n lastValidBlockHeight: 0n, // This is not included in compiled transactions; it can be anything.\n };\n\n/**\n * Sets a provisory blockhash lifetime constraint on the transaction message\n * if and only if it doesn't already have a lifetime constraint.\n */\nexport function fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n transactionMessage: TTransactionMessage\n): TTransactionMessage &\n (\n | TransactionMessageWithBlockhashLifetime\n | TransactionMessageWithDurableNonceLifetime\n ) {\n type ReturnType = TTransactionMessage &\n (\n | TransactionMessageWithBlockhashLifetime\n | TransactionMessageWithDurableNonceLifetime\n );\n\n if ('lifetimeConstraint' in transactionMessage) {\n return transactionMessage as ReturnType;\n }\n\n return setTransactionMessageLifetimeUsingProvisoryBlockhash(\n transactionMessage\n );\n}\n\n/**\n * Sets a provisory blockhash lifetime constraint on the transaction message.\n */\nexport function setTransactionMessageLifetimeUsingProvisoryBlockhash<\n TTransactionMessage extends BaseTransactionMessage,\n>(\n transactionMessage: TTransactionMessage\n): TTransactionMessage & TransactionMessageWithBlockhashLifetime {\n return setTransactionMessageLifetimeUsingBlockhash(\n PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT,\n transactionMessage\n );\n}\n","import {\n Commitment,\n CompilableTransactionMessage,\n compileTransaction,\n getBase64EncodedWireTransaction,\n isDurableNonceTransaction,\n isSolanaError,\n ITransactionMessageWithFeePayer,\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 TransactionMessage,\n} from '@solana/kit';\nimport { updateOrAppendSetComputeUnitLimitInstruction } from './setComputeLimit';\nimport { MAX_COMPUTE_UNIT_LIMIT } from './constants';\nimport { fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash } from './internalMoveToKit';\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:\n | CompilableTransactionMessage\n | (TransactionMessage & ITransactionMessageWithFeePayer),\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:\n | CompilableTransactionMessage\n | (TransactionMessage & ITransactionMessageWithFeePayer);\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 = !isDurableNonceTransaction(transactionMessage);\n const transaction = pipe(\n transactionMessage,\n fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash,\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 );\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"]} | ||
| {"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,8CAAA;AAEU,IAAA,wBAAA,qBAAAA,yBAAL,KAAA;AACL,EAAAA,yBAAA,CAAA,yBAAA,CAAA,cAAA,CAAA,GAAA,CAAA,CAAA,GAAA,cAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,qBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,qBAAA,CAAA;AACA,EAAAA,yBAAA,CAAA,yBAAA,CAAA,gCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gCAAA,CAAA;AALU,EAAAA,OAAAA,yBAAAA,CAAAA;AAAA,CAAA,EAAA,wBAAA,IAAA,EAAA,EAAA;AAQL,SAAS,iCACd,WAC0B,EAAA;AAC1B,EAAA,MAAM,IAAO,GAAA,MAAA,IAAU,WAAc,GAAA,WAAA,CAAY,IAAO,GAAA,WAAA,CAAA;AACxD,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa,EAAA,CAAE,OAAO,CAAC,CAAA,EAAG,CAAC,CAAG,EAAA;AACpD,IAAO,OAAA,CAAA,oBAAA;AAAA,GACT;AACA,EAAI,IAAA,aAAA,CAAc,MAAM,YAAa,EAAA,CAAE,OAAO,CAAC,CAAA,EAAG,CAAC,CAAG,EA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AA,IACL,iCAAA,CAAkC,EAAE,aAAA,EAAe,CAAA;AAAA,IACnD,kBAAA;AAAA,GACF,CAAA;AACF,CAAA;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,CAAA;AACN,EAAM,MAAA,kBAAA,GACJ,uDAAuD,kBAAkB,CAAA,CAAA;AAE3E,EAAA,IAAI,CAAC,kBAAoB,EAAA;AACvB,IAAOD,OAAAA,mCAAAA;AAAA,MACL,iCAAkC,CAAA;AAAA,QAChC,aAAA,EAAe,iBAAiB,IAAI,CAAA;AAAA,OACrC,CAAA;AAAA,MACD,kBAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAO,aAAe,EAAA,qBAAA,EAA0B,GAAA,kBAAA,CAAA;AACxD,EAAM,MAAA,gBAAA,GAAmB,iBAAiB,qBAAqB,CAAA,CAAA;AAC/D,EAAA,IAAI,qBAAqB,qBAAuB,EAAA;AAC9C,IAAO,OAAA,kBAAA,CAAA;AAAA,GACT;AAEA,EAAA,MAAM,iBAAiB,iCAAkC,CAAA;AAAA,IACvD,aAAe,EAAA,gBAAA;AAAA,GAChB,CAAA,CAAA;AACD,EAAA,MAAM,eAAkB,GAAA,CAAC,GAAG,kBAAA,CAAmB,YAAY,CAAA,CAAA;AAC3D,EAAgB,eAAA,CAAA,MAAA,CAAO,KAAO,EAAA,CAAA,EAAG,cAAc,CAAA,CAAA;AAC/C,EAAA,OAAO,OAAO,MAAO,CAAA;AAAA,IACnB,GAAG,kBAAA;AAAA,IACH,YAAc,EAAA,eAAA;AAAA,GACf,CAAA,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 const instruction = {\n programAddress,\n data: getRequestHeapFrameInstructionDataEncoder().encode(\n args as RequestHeapFrameInstructionDataArgs\n ),\n } as RequestHeapFrameInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestHeapFrameInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestHeapFrameInstructionData;\n};\n\nexport function parseRequestHeapFrameInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getRequestUnitsInstructionDataEncoder().encode(\n args as RequestUnitsInstructionDataArgs\n ),\n } as RequestUnitsInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedRequestUnitsInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: RequestUnitsInstructionData;\n};\n\nexport function parseRequestUnitsInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getSetComputeUnitLimitInstructionDataEncoder().encode(\n args as SetComputeUnitLimitInstructionDataArgs\n ),\n } as SetComputeUnitLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitLimitInstructionData;\n};\n\nexport function parseSetComputeUnitLimitInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getSetComputeUnitPriceInstructionDataEncoder().encode(\n args as SetComputeUnitPriceInstructionDataArgs\n ),\n } as SetComputeUnitPriceInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetComputeUnitPriceInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetComputeUnitPriceInstructionData;\n};\n\nexport function parseSetComputeUnitPriceInstruction<TProgram extends string>(\n instruction: 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 const instruction = {\n programAddress,\n data: getSetLoadedAccountsDataSizeLimitInstructionDataEncoder().encode(\n args as SetLoadedAccountsDataSizeLimitInstructionDataArgs\n ),\n } as SetLoadedAccountsDataSizeLimitInstruction<TProgramAddress>;\n\n return instruction;\n}\n\nexport type ParsedSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS,\n> = {\n programAddress: Address<TProgram>;\n data: SetLoadedAccountsDataSizeLimitInstructionData;\n};\n\nexport function parseSetLoadedAccountsDataSizeLimitInstruction<\n TProgram extends string,\n>(\n instruction: 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,4 +0,4 @@ | ||
| import { CompilableTransactionMessage, ITransactionMessageWithFeePayer, TransactionMessage } from '@solana/kit'; | ||
| import { BaseTransactionMessage, TransactionMessageWithFeePayer } from '@solana/kit'; | ||
| import { EstimateComputeUnitLimitFactoryFunction, EstimateComputeUnitLimitFactoryFunctionConfig } from './estimateComputeLimitInternal'; | ||
| type EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <TTransactionMessage extends CompilableTransactionMessage | (TransactionMessage & ITransactionMessageWithFeePayer)>(transactionMessage: TTransactionMessage, config?: EstimateComputeUnitLimitFactoryFunctionConfig) => Promise<TTransactionMessage>; | ||
| type EstimateAndUpdateProvisoryComputeUnitLimitFactoryFunction = <TTransactionMessage extends BaseTransactionMessage & TransactionMessageWithFeePayer>(transactionMessage: TTransactionMessage, config?: EstimateComputeUnitLimitFactoryFunctionConfig) => Promise<TTransactionMessage>; | ||
| /** | ||
@@ -5,0 +5,0 @@ * Given a transaction message, if it does not have an explicit compute unit limit, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"estimateAndSetComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateAndSetComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,uCAAuC,EACvC,6CAA6C,EAC9C,MAAM,gCAAgC,CAAC;AAIxC,KAAK,yDAAyD,GAAG,CAC/D,mBAAmB,SACf,4BAA4B,GAC5B,CAAC,kBAAkB,GAAG,+BAA+B,CAAC,EAE1D,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,6CAA6C,KACnD,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,wBAAwB,EAAE,uCAAuC,GAChE,yDAAyD,CAqB3D"} | ||
| {"version":3,"file":"estimateAndSetComputeLimit.d.ts","sourceRoot":"","sources":["../../src/estimateAndSetComputeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,uCAAuC,EACvC,6CAA6C,EAC9C,MAAM,gCAAgC,CAAC;AAIxC,KAAK,yDAAyD,GAAG,CAC/D,mBAAmB,SAAS,sBAAsB,GAChD,8BAA8B,EAEhC,kBAAkB,EAAE,mBAAmB,EACvC,MAAM,CAAC,EAAE,6CAA6C,KACnD,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,wBAAwB,EAAE,uCAAuC,GAChE,yDAAyD,CAqB3D"} |
@@ -1,2 +0,2 @@ | ||
| import { Commitment, CompilableTransactionMessage, ITransactionMessageWithFeePayer, Rpc, SimulateTransactionApi, Slot, TransactionMessage } from '@solana/kit'; | ||
| import { BaseTransactionMessage, Commitment, Rpc, SimulateTransactionApi, Slot, TransactionMessageWithFeePayer } from '@solana/kit'; | ||
| export type EstimateComputeUnitLimitFactoryConfig = Readonly<{ | ||
@@ -6,3 +6,3 @@ /** An object that supports the {@link SimulateTransactionApi} of the Solana RPC API */ | ||
| }>; | ||
| export type EstimateComputeUnitLimitFactoryFunction = (transactionMessage: CompilableTransactionMessage | (TransactionMessage & ITransactionMessageWithFeePayer), config?: EstimateComputeUnitLimitFactoryFunctionConfig) => Promise<number>; | ||
| export type EstimateComputeUnitLimitFactoryFunction = (transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer, config?: EstimateComputeUnitLimitFactoryFunctionConfig) => Promise<number>; | ||
| export type EstimateComputeUnitLimitFactoryFunctionConfig = { | ||
@@ -27,3 +27,3 @@ abortSignal?: AbortSignal; | ||
| rpc: Rpc<SimulateTransactionApi>; | ||
| transactionMessage: CompilableTransactionMessage | (TransactionMessage & ITransactionMessageWithFeePayer); | ||
| transactionMessage: BaseTransactionMessage & TransactionMessageWithFeePayer; | ||
| }>; | ||
@@ -30,0 +30,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"estimateComputeLimitInternal.d.ts","sourceRoot":"","sources":["../../src/estimateComputeLimitInternal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,4BAA4B,EAK5B,+BAA+B,EAE/B,GAAG,EACH,sBAA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GAAG,CAAC,sBAAsB,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH,MAAM,MAAM,uCAAuC,GAAG,CACpD,kBAAkB,EAAE,sBAAsB,GAAG,8BAA8B,EAC3E,MAAM,CAAC,EAAE,6CAA6C,KACnD,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,MAAM,6CAA6C,GAAG;IAC1D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,cAAc,CAAC,EAAE,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,8BAA8B,GACjC,6CAA6C,GAC3C,QAAQ,CAAC;IACP,GAAG,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACjC,kBAAkB,EAAE,sBAAsB,GACxC,8BAA8B,CAAC;CAClC,CAAC,CAAC;AAEP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAsB,wBAAwB,CAAC,EAC7C,kBAAkB,EAClB,GAAG,OAAO,EACX,EAAE,8BAA8B,GAAG,OAAO,CAAC,MAAM,CAAC,CAelD"} |
@@ -8,7 +8,7 @@ /** | ||
| */ | ||
| import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit'; | ||
| import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit'; | ||
| import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs'; | ||
| export declare const REQUEST_HEAP_FRAME_DISCRIMINATOR = 1; | ||
| export declare function getRequestHeapFrameDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array; | ||
| export type RequestHeapFrameInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>; | ||
| export declare function getRequestHeapFrameDiscriminatorBytes(): ReadonlyUint8Array; | ||
| export type RequestHeapFrameInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>; | ||
| export type RequestHeapFrameInstructionData = { | ||
@@ -29,5 +29,5 @@ discriminator: number; | ||
| }; | ||
| export declare function getRequestHeapFrameInstructionDataEncoder(): Encoder<RequestHeapFrameInstructionDataArgs>; | ||
| export declare function getRequestHeapFrameInstructionDataDecoder(): Decoder<RequestHeapFrameInstructionData>; | ||
| export declare function getRequestHeapFrameInstructionDataCodec(): Codec<RequestHeapFrameInstructionDataArgs, RequestHeapFrameInstructionData>; | ||
| export declare function getRequestHeapFrameInstructionDataEncoder(): FixedSizeEncoder<RequestHeapFrameInstructionDataArgs>; | ||
| export declare function getRequestHeapFrameInstructionDataDecoder(): FixedSizeDecoder<RequestHeapFrameInstructionData>; | ||
| export declare function getRequestHeapFrameInstructionDataCodec(): FixedSizeCodec<RequestHeapFrameInstructionDataArgs, RequestHeapFrameInstructionData>; | ||
| export type RequestHeapFrameInput = { | ||
@@ -43,3 +43,3 @@ bytes: RequestHeapFrameInstructionDataArgs['bytes']; | ||
| }; | ||
| export declare function parseRequestHeapFrameInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedRequestHeapFrameInstruction<TProgram>; | ||
| export declare function parseRequestHeapFrameInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedRequestHeapFrameInstruction<TProgram>; | ||
| //# sourceMappingURL=requestHeapFrame.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"requestHe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,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAChD;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,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,CACvE,mCAAmC,EACnC,+BAA+B,CAChC,CAKA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,CAAC;CACrD,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,qBAAqB,EAC5B,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,2BAA2B,CAAC,eAAe,CAAC,CAgB9C;AAED,MAAM,MAAM,iCAAiC,CAC3C,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC7D;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,+BAA+B,CAAC;CACvC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,QAAQ,SAAS,MAAM,EACtE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,iCAAiC,CAAC,QAAQ,CAAC,CAK7C"} |
@@ -8,7 +8,7 @@ /** | ||
| */ | ||
| import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit'; | ||
| import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit'; | ||
| import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs'; | ||
| export declare const REQUEST_UNITS_DISCRIMINATOR = 0; | ||
| export declare function getRequestUnitsDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array; | ||
| export type RequestUnitsInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>; | ||
| export declare function getRequestUnitsDiscriminatorBytes(): ReadonlyUint8Array; | ||
| export type RequestUnitsInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>; | ||
| export type RequestUnitsInstructionData = { | ||
@@ -27,5 +27,5 @@ discriminator: number; | ||
| }; | ||
| export declare function getRequestUnitsInstructionDataEncoder(): Encoder<RequestUnitsInstructionDataArgs>; | ||
| export declare function getRequestUnitsInstructionDataDecoder(): Decoder<RequestUnitsInstructionData>; | ||
| export declare function getRequestUnitsInstructionDataCodec(): Codec<RequestUnitsInstructionDataArgs, RequestUnitsInstructionData>; | ||
| export declare function getRequestUnitsInstructionDataEncoder(): FixedSizeEncoder<RequestUnitsInstructionDataArgs>; | ||
| export declare function getRequestUnitsInstructionDataDecoder(): FixedSizeDecoder<RequestUnitsInstructionData>; | ||
| export declare function getRequestUnitsInstructionDataCodec(): FixedSizeCodec<RequestUnitsInstructionDataArgs, RequestUnitsInstructionData>; | ||
| export type RequestUnitsInput = { | ||
@@ -42,3 +42,3 @@ units: RequestUnitsInstructionDataArgs['units']; | ||
| }; | ||
| export declare function parseRequestUnitsInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedRequestUnitsInstruction<TProgram>; | ||
| export declare function parseRequestUnitsInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedRequestUnitsInstruction<TProgram>; | ||
| //# sourceMappingURL=requestUnits.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"requestUnits.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/requestUnits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,wBAAgB,iCAAiC,6CAEhD;AAED,MAAM,MAAM,uBAAuB,CACjC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC7D,YAAY,CAAC,QAAQ,CAAC,GACxB,oBAAoB,CAAC,UAAU,CAAC,GAChC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;AAE/C,MAAM,MAAM,2BAA2B,GAAG;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,qCAAqC,IAAI,OAAO,CAAC,+BAA+B,CAAC,CAShG;AAED,wBAAgB,qCAAqC,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAM5F;AAED,wBAAgB,mCAAmC,IAAI,KAAK,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AAC,QAAQ,SAAS,MAAM,EAClE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,6BAA6B,CAAC,QAAQ,CAAC,CAKzC"} |
@@ -8,7 +8,7 @@ /** | ||
| */ | ||
| import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit'; | ||
| import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit'; | ||
| import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs'; | ||
| export declare const SET_COMPUTE_UNIT_LIMIT_DISCRIMINATOR = 2; | ||
| export declare function getSetComputeUnitLimitDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array; | ||
| export type SetComputeUnitLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>; | ||
| export declare function getSetComputeUnitLimitDiscriminatorBytes(): ReadonlyUint8Array; | ||
| export type SetComputeUnitLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>; | ||
| export type SetComputeUnitLimitInstructionData = { | ||
@@ -23,5 +23,5 @@ discriminator: number; | ||
| }; | ||
| export declare function getSetComputeUnitLimitInstructionDataEncoder(): Encoder<SetComputeUnitLimitInstructionDataArgs>; | ||
| export declare function getSetComputeUnitLimitInstructionDataDecoder(): Decoder<SetComputeUnitLimitInstructionData>; | ||
| export declare function getSetComputeUnitLimitInstructionDataCodec(): Codec<SetComputeUnitLimitInstructionDataArgs, SetComputeUnitLimitInstructionData>; | ||
| export declare function getSetComputeUnitLimitInstructionDataEncoder(): FixedSizeEncoder<SetComputeUnitLimitInstructionDataArgs>; | ||
| export declare function getSetComputeUnitLimitInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitLimitInstructionData>; | ||
| export declare function getSetComputeUnitLimitInstructionDataCodec(): FixedSizeCodec<SetComputeUnitLimitInstructionDataArgs, SetComputeUnitLimitInstructionData>; | ||
| export type SetComputeUnitLimitInput = { | ||
@@ -37,3 +37,3 @@ units: SetComputeUnitLimitInstructionDataArgs['units']; | ||
| }; | ||
| export declare function parseSetComputeUnitLimitInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedSetComputeUnitLimitInstruction<TProgram>; | ||
| export declare function parseSetComputeUnitLimitInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedSetComputeUnitLimitInstruction<TProgram>; | ||
| //# sourceMappingURL=setComputeUnitLimit.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"setComputeUnitLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,wBAAgB,wCAAwC,6CAEvD;AAED,MAAM,MAAM,8BAA8B,CACxC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE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/B,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,8BAA8B,CAAC,eAAe,CAAC,CAgBjD;AAED,MAAM,MAAM,oCAAoC,CAC9C,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC7D;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,kCAAkC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,MAAM,EACzE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,oCAAoC,CAAC,QAAQ,CAAC,CAOhD"} |
@@ -8,7 +8,7 @@ /** | ||
| */ | ||
| import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit'; | ||
| import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit'; | ||
| import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs'; | ||
| export declare const SET_COMPUTE_UNIT_PRICE_DISCRIMINATOR = 3; | ||
| export declare function getSetComputeUnitPriceDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array; | ||
| export type SetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>; | ||
| export declare function getSetComputeUnitPriceDiscriminatorBytes(): ReadonlyUint8Array; | ||
| export type SetComputeUnitPriceInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>; | ||
| export type SetComputeUnitPriceInstructionData = { | ||
@@ -23,5 +23,5 @@ discriminator: number; | ||
| }; | ||
| export declare function getSetComputeUnitPriceInstructionDataEncoder(): Encoder<SetComputeUnitPriceInstructionDataArgs>; | ||
| export declare function getSetComputeUnitPriceInstructionDataDecoder(): Decoder<SetComputeUnitPriceInstructionData>; | ||
| export declare function getSetComputeUnitPriceInstructionDataCodec(): Codec<SetComputeUnitPriceInstructionDataArgs, SetComputeUnitPriceInstructionData>; | ||
| export declare function getSetComputeUnitPriceInstructionDataEncoder(): FixedSizeEncoder<SetComputeUnitPriceInstructionDataArgs>; | ||
| export declare function getSetComputeUnitPriceInstructionDataDecoder(): FixedSizeDecoder<SetComputeUnitPriceInstructionData>; | ||
| export declare function getSetComputeUnitPriceInstructionDataCodec(): FixedSizeCodec<SetComputeUnitPriceInstructionDataArgs, SetComputeUnitPriceInstructionData>; | ||
| export type SetComputeUnitPriceInput = { | ||
@@ -37,3 +37,3 @@ microLamports: SetComputeUnitPriceInstructionDataArgs['microLamports']; | ||
| }; | ||
| export declare function parseSetComputeUnitPriceInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedSetComputeUnitPriceInstruction<TProgram>; | ||
| export declare function parseSetComputeUnitPriceInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedSetComputeUnitPriceInstruction<TProgram>; | ||
| //# sourceMappingURL=setComputeUnitPrice.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"setComputeUnitPrice.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitPrice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,wBAAwB,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,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,kCAAkC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,MAAM,EACzE,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,GACrE,oCAAoC,CAAC,QAAQ,CAAC,CAOhD"} | ||
| {"version":3,"file":"setComputeUnitPrice.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setComputeUnitPrice.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,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,EACxB,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,CACxC,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC5D,WAAW,CAAC,QAAQ,CAAC,GACvB,mBAAmB,CAAC,kBAAkB,CAAC,GACvC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;AAE9C,MAAM,MAAM,kCAAkC,GAAG;IAC/C,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,mEAAmE;IACnE,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC,CAAC;AAEF,wBAAgB,4CAA4C,IAAI,gBAAgB,CAAC,sCAAsC,CAAC,CAWvH;AAED,wBAAgB,4CAA4C,IAAI,gBAAgB,CAAC,kCAAkC,CAAC,CAKnH;AAED,wBAAgB,0CAA0C,IAAI,cAAc,CAC1E,sCAAsC,EACtC,kCAAkC,CACnC,CAKA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,sCAAsC,CAAC,eAAe,CAAC,CAAC;CACxE,CAAC;AAEF,wBAAgB,iCAAiC,CAC/C,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,wBAAwB,EAC/B,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,8BAA8B,CAAC,eAAe,CAAC,CAgBjD;AAED,MAAM,MAAM,oCAAoC,CAC9C,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC7D;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,kCAAkC,CAAC;CAC1C,CAAC;AAEF,wBAAgB,mCAAmC,CAAC,QAAQ,SAAS,MAAM,EACzE,WAAW,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,oCAAoC,CAAC,QAAQ,CAAC,CAOhD"} |
@@ -8,7 +8,7 @@ /** | ||
| */ | ||
| import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData } from '@solana/kit'; | ||
| import { type AccountMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyUint8Array } from '@solana/kit'; | ||
| import { COMPUTE_BUDGET_PROGRAM_ADDRESS } from '../programs'; | ||
| export declare const SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_DISCRIMINATOR = 4; | ||
| export declare function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): import("@solana/kit").ReadonlyUint8Array; | ||
| export type SetLoadedAccountsDataSizeLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<TRemainingAccounts>; | ||
| export declare function getSetLoadedAccountsDataSizeLimitDiscriminatorBytes(): ReadonlyUint8Array; | ||
| export type SetLoadedAccountsDataSizeLimitInstruction<TProgram extends string = typeof COMPUTE_BUDGET_PROGRAM_ADDRESS, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<TRemainingAccounts>; | ||
| export type SetLoadedAccountsDataSizeLimitInstructionData = { | ||
@@ -21,5 +21,5 @@ discriminator: number; | ||
| }; | ||
| export declare function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): Encoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs>; | ||
| export declare function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): Decoder<SetLoadedAccountsDataSizeLimitInstructionData>; | ||
| export declare function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): Codec<SetLoadedAccountsDataSizeLimitInstructionDataArgs, SetLoadedAccountsDataSizeLimitInstructionData>; | ||
| export declare function getSetLoadedAccountsDataSizeLimitInstructionDataEncoder(): FixedSizeEncoder<SetLoadedAccountsDataSizeLimitInstructionDataArgs>; | ||
| export declare function getSetLoadedAccountsDataSizeLimitInstructionDataDecoder(): FixedSizeDecoder<SetLoadedAccountsDataSizeLimitInstructionData>; | ||
| export declare function getSetLoadedAccountsDataSizeLimitInstructionDataCodec(): FixedSizeCodec<SetLoadedAccountsDataSizeLimitInstructionDataArgs, SetLoadedAccountsDataSizeLimitInstructionData>; | ||
| export type SetLoadedAccountsDataSizeLimitInput = { | ||
@@ -35,3 +35,3 @@ accountDataSizeLimit: SetLoadedAccountsDataSizeLimitInstructionDataArgs['accountDataSizeLimit']; | ||
| }; | ||
| export declare function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(instruction: IInstruction<TProgram> & IInstructionWithData<Uint8Array>): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>; | ||
| export declare function parseSetLoadedAccountsDataSizeLimitInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedSetLoadedAccountsDataSizeLimitInstruction<TProgram>; | ||
| //# sourceMappingURL=setLoadedAccountsDataSizeLimit.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,iDAAiD,IAAI,CAAC;AAEnE,wBAAgB,mDAAmD,6CAIlE;AAED,MAAM,MAAM,yCAAyC,CACnD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,EAC/D,kBAAkB,SAAS,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC7D,YAAY,CAAC,QAAQ,CAAC,GACxB,oBAAoB,CAAC,UAAU,CAAC,GAChC,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;AAE/C,MAAM,MAAM,6CAA6C,GAAG;IAC1D,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iDAAiD,GAAG;IAC9D,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,wBAAgB,uDAAuD,IAAI,OAAO,CAAC,iDAAiD,CAAC,CAWpI;AAED,wBAAgB,uDAAuD,IAAI,OAAO,CAAC,6CAA6C,CAAC,CAKhI;AAED,wBAAgB,qDAAqD,IAAI,KAAK,CAC5E,iDAAiD,EACjD,6CAA6C,CAC9C,CAKA;AAED,MAAM,MAAM,mCAAmC,GAAG;IAChD,oBAAoB,EAAE,iDAAiD,CAAC,sBAAsB,CAAC,CAAC;CACjG,CAAC;AAEF,wBAAgB,4CAA4C,CAC1D,eAAe,SAAS,OAAO,GAAG,OAAO,8BAA8B,EAEvE,KAAK,EAAE,mCAAmC,EAC1C,MAAM,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,yCAAyC,CAAC,eAAe,CAAC,CAgB5D;AAED,MAAM,MAAM,+CAA+C,CACzD,QAAQ,SAAS,MAAM,GAAG,OAAO,8BAA8B,IAC7D;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,6CAA6C,CAAC;CACrD,CAAC;AAEF,wBAAgB,8CAA8C,CAC5D,QAAQ,SAAS,MAAM,EAEvB,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,oBAAoB,CAAC,UAAU,CAAC,GACrE,+CAA+C,CAAC,QAAQ,CAAC,CAO3D"} | ||
| {"version":3,"file":"setLoadedAccountsDataSizeLimit.d.ts","sourceRoot":"","sources":["../../../../src/generated/instructions/setLoadedAccountsDataSizeLimit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EASL,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,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,eAAO,MAAM,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W,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,GAC3E,+CAA+C,CAAC,QAAQ,CAAC,CAO3D"} |
@@ -8,3 +8,3 @@ /** | ||
| */ | ||
| import { type Address, type IAccountMeta, type IAccountSignerMeta, type ProgramDerivedAddress, type TransactionSigner } from '@solana/kit'; | ||
| import { type AccountMeta, type AccountSignerMeta, type Address, type ProgramDerivedAddress, type TransactionSigner } from '@solana/kit'; | ||
| /** | ||
@@ -42,3 +42,3 @@ * Asserts that the given value is not null or undefined. | ||
| */ | ||
| export type IInstructionWithByteDelta = { | ||
| export type InstructionWithByteDelta = { | ||
| byteDelta: number; | ||
@@ -50,4 +50,4 @@ }; | ||
| */ | ||
| export declare function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: 'omitted' | 'programId'): (account: ResolvedAccount) => IAccountMeta | IAccountSignerMeta | undefined; | ||
| export declare function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: 'omitted' | 'programId'): (account: ResolvedAccount) => AccountMeta | AccountSignerMeta | undefined; | ||
| export declare function isTransactionSigner<TAddress extends string = string>(value: Address<TAddress> | ProgramDerivedAddress<TAddress> | TransactionSigner<TAddress>): value is TransactionSigner<TAddress>; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generated/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,CAK5D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MA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iB,CAAC,CAAC,CAAC,GACpB,IAAI,GACJ,SAAS,GACZ,iBAAiB,CAAC,CAAC,CAAC,CAKtB;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,CAAC,SACG,OAAO,CAAC,CAAC,CAAC,GACV,qBAAqB,CAAC,CAAC,CAAC,GACxB,iBAAiB,CAAC,CAAC,CAAC,GACpB,IAAI,GACJ,OAAO,CAAC,CAAC,CAAC,GACV,qBAAqB,CAAC,CAAC,CAAC,GACxB,iBAAiB,CAAC,CAAC,CAAC,GACpB,IAAI,IACN;IACF,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,OAAO,EACvB,uBAAuB,EAAE,SAAS,GAAG,WAAW,aAGrC,eAAe,KACvB,WAAW,GAAG,iBAAiB,GAAG,SAAS,CAoB/C;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAClE,KAAK,EACD,OAAO,CAAC,QAAQ,CAAC,GACjB,qBAAqB,CAAC,QAAQ,CAAC,GAC/B,iBAAiB,CAAC,QAAQ,CAAC,GAC9B,KAAK,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAOtC"} |
@@ -1,2 +0,2 @@ | ||
| import { BaseTransactionMessage, IInstruction, MicroLamports } from '@solana/kit'; | ||
| import { BaseTransactionMessage, Instruction, MicroLamports } from '@solana/kit'; | ||
| import { SetComputeUnitLimitInstruction, SetComputeUnitPriceInstruction } from './generated'; | ||
@@ -18,3 +18,3 @@ /** | ||
| */ | ||
| export declare function isSetComputeUnitLimitInstruction(instruction: IInstruction): instruction is SetComputeUnitLimitInstruction; | ||
| export declare function isSetComputeUnitLimitInstruction(instruction: Instruction): instruction is SetComputeUnitLimitInstruction; | ||
| /** | ||
@@ -35,3 +35,3 @@ * Finds the index of the first `SetComputeUnitPrice` instruction in a transaction message | ||
| */ | ||
| export declare function isSetComputeUnitPriceInstruction(instruction: IInstruction): instruction is SetComputeUnitPriceInstruction; | ||
| export declare function isSetComputeUnitPriceInstruction(instruction: Instruction): instruction is SetComputeUnitPriceInstruction; | ||
| //# sourceMappingURL=internal.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAGtB,YAAY,EACZ,aAAa,EAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,8CAA8C,CAC5D,kBAAkB,EAAE,sBAAsB,GACzC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYzC;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,sBAAsB,UAK3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,YAAY,GACxB,WAAW,IAAI,8BAA8B,CAM/C;AAED;;;GAGG;AACH,wBAAgB,sDAAsD,CACpE,kBAAkB,EAAE,sBAAsB,GACzC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAYxD;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,sBAAsB,UAK3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,YAAY,GACxB,WAAW,IAAI,8BAA8B,CAM/C"} | ||
| {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EAGtB,WAAW,EACX,aAAa,EAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,8CAA8C,CAC5D,kBAAkB,EAAE,sBAAsB,GACzC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYzC;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,sBAAsB,UAK3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,WAAW,GACvB,WAAW,IAAI,8BAA8B,CAM/C;AAED;;;GAGG;AACH,wBAAgB,sDAAsD,CACpE,kBAAkB,EAAE,sBAAsB,GACzC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GAAG,IAAI,CAYxD;AAED;;GAEG;AACH,wBAAgB,sCAAsC,CACpD,kBAAkB,EAAE,sBAAsB,UAK3C;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,WAAW,GACvB,WAAW,IAAI,8BAA8B,CAM/C"} |
@@ -14,3 +14,5 @@ import { BaseTransactionMessage, MicroLamports } from '@solana/kit'; | ||
| */ | ||
| export declare function setTransactionMessageComputeUnitPrice<TTransactionMessage extends BaseTransactionMessage>(microLamports: number | bigint, transactionMessage: TTransactionMessage): TTransactionMessage; | ||
| export declare function setTransactionMessageComputeUnitPrice<TTransactionMessage extends BaseTransactionMessage>(microLamports: number | bigint, transactionMessage: TTransactionMessage): Omit<import("@solana/kit").ExcludeTransactionMessageWithinSizeLimit<TTransactionMessage>, "instructions"> & { | ||
| readonly instructions: readonly [...TTransactionMessage["instructions"], import("./generated").SetComputeUnitPriceInstruction<import("@solana/kit").Address<"ComputeBudget111111111111111111111111111111">, []>]; | ||
| }; | ||
| /** | ||
@@ -17,0 +19,0 @@ * Updates the first `SetComputeUnitPrice` instruction in a transaction message |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CACnD,mBAAmB,SAAS,sBAAsB,EAClD,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,mBAAmB,uBAKxE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAC1D,mBAAmB,SAAS,sBAAsB,EAElD,aAAa,EACT,aAAa,GACb,CAAC,CAAC,qBAAqB,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,CAAC,EACpE,kBAAkB,EAAE,mBAAmB,GACtC,mBAAmB,CAkCrB"} | ||
| {"version":3,"file":"setComputePrice.d.ts","sourceRoot":"","sources":["../../src/setComputePrice.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB;;;;;;;;;;;GAWG;AACH,wBAAgB,qCAAqC,CACnD,mBAAmB,SAAS,sBAAsB,EAClD,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,mBAAmB;;EAKxE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,4CAA4C,CAC1D,mBAAmB,SAAS,sBAAsB,EAElD,aAAa,EACT,aAAa,GACb,CAAC,CAAC,qBAAqB,EAAE,aAAa,GAAG,IAAI,KAAK,aAAa,CAAC,EACpE,kBAAkB,EAAE,mBAAmB,GACtC,mBAAmB,CAkCrB"} |
+4
-4
| { | ||
| "name": "@solana-program/compute-budget", | ||
| "version": "0.8.0", | ||
| "version": "0.9.0", | ||
| "description": "JavaScript client for the Compute Budget program", | ||
@@ -35,8 +35,8 @@ "sideEffects": false, | ||
| "peerDependencies": { | ||
| "@solana/kit": "^2.1.0" | ||
| "@solana/kit": "^3.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@solana/eslint-config-solana": "^3.0.3", | ||
| "@solana/kit": "^2.1.0", | ||
| "@types/node": "^20", | ||
| "@solana/kit": "^3.0", | ||
| "@types/node": "^24", | ||
| "@typescript-eslint/eslint-plugin": "^7.16.1", | ||
@@ -43,0 +43,0 @@ "@typescript-eslint/parser": "^7.16.1", |
| import { BaseTransactionMessage, TransactionMessageWithBlockhashLifetime, TransactionMessageWithDurableNonceLifetime } from '@solana/kit'; | ||
| /** | ||
| * An invalid blockhash lifetime constraint used as a placeholder for | ||
| * transaction messages that are not yet ready to be compiled. | ||
| * | ||
| * This enables various operations on the transaction message, such as | ||
| * simulating it or calculating its transaction size, whilst defering | ||
| * the actual blockhash to a later stage. | ||
| */ | ||
| export declare const PROVISORY_BLOCKHASH_LIFETIME_CONSTRAINT: TransactionMessageWithBlockhashLifetime['lifetimeConstraint']; | ||
| /** | ||
| * Sets a provisory blockhash lifetime constraint on the transaction message | ||
| * if and only if it doesn't already have a lifetime constraint. | ||
| */ | ||
| export declare function fillMissingTransactionMessageLifetimeUsingProvisoryBlockhash<TTransactionMessage extends BaseTransactionMessage>(transactionMessage: TTransactionMessage): TTransactionMessage & (TransactionMessageWithBlockhashLifetime | TransactionMessageWithDurableNonceLifetime); | ||
| /** | ||
| * Sets a provisory blockhash lifetime constraint on the transaction message. | ||
| */ | ||
| export declare function setTransactionMessageLifetimeUsingProvisoryBlockhash<TTransactionMessage extends BaseTransactionMessage>(transactionMessage: TTransactionMessage): TTransactionMessage & TransactionMessageWithBlockhashLifetime; | ||
| //# sourceMappingURL=internalMoveToKit.d.ts.map |
| {"version":3,"file":"internalMoveToKit.d.ts","sourceRoot":"","sources":["../../src/internalMoveToKit.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EAGtB,uCAAuC,EACvC,0CAA0C,EAC3C,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AACH,eAAO,MAAM,uCAAuC,EAAE,uCAAuC,CAAC,oBAAoB,CAI/G,CAAC;AAEJ;;;GAGG;AACH,wBAAgB,4DAA4D,CAC1E,mBAAmB,SAAS,sBAAsB,EAElD,kBAAkB,EAAE,mBAAmB,GACtC,mBAAmB,GACpB,CACI,uCAAuC,GACvC,0CAA0C,CAC7C,CAcF;AAED;;GAEG;AACH,wBAAgB,oDAAoD,CAClE,mBAAmB,SAAS,sBAAsB,EAElD,kBAAkB,EAAE,mBAAmB,GACtC,mBAAmB,GAAG,uCAAuC,CAK/D"} |
206322
-3.65%42
-4.55%1545
-3.62%