@whetstone-research/doppler-sdk 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +48 -12
  2. package/dist/{chunk-AT33RY6T.cjs → chunk-3BW6IVP3.cjs} +46 -37
  3. package/dist/chunk-3BW6IVP3.cjs.map +1 -0
  4. package/dist/{chunk-ZQEEGBXT.js → chunk-NMTYI3TB.js} +23 -26
  5. package/dist/chunk-NMTYI3TB.js.map +1 -0
  6. package/dist/{chunk-2NFQKIOB.js → chunk-TVBSIQIX.js} +35 -26
  7. package/dist/chunk-TVBSIQIX.js.map +1 -0
  8. package/dist/{chunk-LL7TW3GU.cjs → chunk-W5TMS4RD.cjs} +56 -59
  9. package/dist/chunk-W5TMS4RD.cjs.map +1 -0
  10. package/dist/{oracle-CU-nZnja.d.cts → oracle-DN8BrGPh.d.cts} +28 -28
  11. package/dist/{oracle-CU-nZnja.d.ts → oracle-DN8BrGPh.d.ts} +28 -28
  12. package/dist/{pda-FLNTBIC5.js → pda-5D3GD5S6.js} +3 -3
  13. package/dist/pda-5D3GD5S6.js.map +1 -0
  14. package/dist/{pda-G25AJSXG.cjs → pda-GNZYNRUH.cjs} +17 -17
  15. package/dist/{pda-G25AJSXG.cjs.map → pda-GNZYNRUH.cjs.map} +1 -1
  16. package/dist/solana/index.cjs +910 -743
  17. package/dist/solana/index.cjs.map +1 -1
  18. package/dist/solana/index.d.cts +560 -472
  19. package/dist/solana/index.d.ts +560 -472
  20. package/dist/solana/index.js +772 -607
  21. package/dist/solana/index.js.map +1 -1
  22. package/dist/solana/react/index.cjs +57 -57
  23. package/dist/solana/react/index.cjs.map +1 -1
  24. package/dist/solana/react/index.d.cts +5 -5
  25. package/dist/solana/react/index.d.ts +5 -5
  26. package/dist/solana/react/index.js +15 -15
  27. package/dist/solana/react/index.js.map +1 -1
  28. package/package.json +4 -2
  29. package/dist/chunk-2NFQKIOB.js.map +0 -1
  30. package/dist/chunk-AT33RY6T.cjs.map +0 -1
  31. package/dist/chunk-LL7TW3GU.cjs.map +0 -1
  32. package/dist/chunk-ZQEEGBXT.js.map +0 -1
  33. package/dist/pda-FLNTBIC5.js.map +0 -1
@@ -1,9 +1,10 @@
1
- import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setSentinelArgsCodec, setRouteArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, quoteToNumeraireArgsCodec, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, minBigInt, maxBigInt, isqrt, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getTvl, getSwapQuoteExactOut, getSwapQuote, getSpotPrice1, getSpotPrice0, getRemoveLiquidityQuote, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getAddLiquidityQuote, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetSentinelArgs, encodeSetRouteArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeQuoteToNumeraireArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createPositionArgsCodec, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, addLiquidityArgsCodec } from '../chunk-ZQEEGBXT.js';
2
- import { sortMints, getSwapAddresses, getProtocolPositionAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SF_REQUIRE_ORACLE, SF_FORWARD_READONLY_SIGNERS, SF_BEFORE_SWAP, SF_BEFORE_REMOVE_LIQ, SF_BEFORE_ADD_LIQ, SF_AFTER_SWAP, SF_AFTER_REMOVE_LIQ, SF_AFTER_ADD_LIQ, SENTINEL_NO_CHANGE, SEED_PROTOCOL_POSITION, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_SENTINEL_ALLOWLIST, MAX_ORACLE_OBSERVATIONS, INSTRUCTION_DISCRIMINATORS, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, TOKEN_PROGRAM_ADDRESS, SYSTEM_PROGRAM_ADDRESS } from '../chunk-2NFQKIOB.js';
1
+ import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setRouteArgsCodec, setHookArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, quoteToNumeraireArgsCodec, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, minBigInt, maxBigInt, isqrt, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getTvl, getSwapQuoteExactOut, getSwapQuote, getSpotPrice1, getSpotPrice0, getRemoveLiquidityQuote, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getAddLiquidityQuote, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetRouteArgs, encodeSetHookArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, encodeQuoteToNumeraireArgs, encodeOracleConsultArgs, encodeInstructionData, encodeInitializePoolArgs, encodeInitializeOracleArgs, encodeInitializeConfigArgs, encodeCreatePositionArgs, encodeCollectProtocolFeesArgs, encodeCollectFeesArgs, encodeAddLiquidityArgs, decodePosition, decodePool, decodeOracleState, decodeAmmConfig, createPositionArgsCodec, consultTwap, computePrice1Q64, computePrice0Q64, comparePoolAndOraclePrices, collectProtocolFeesArgsCodec, collectFeesArgsCodec, ceilDiv, calculateTwapNumber, calculateTwap, calculateAccruedFees, ammConfigDataCodec, addLiquidityArgsCodec } from '../chunk-NMTYI3TB.js';
2
+ import { sortMints, getSwapAddresses, getProtocolFeePositionAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SEED_PROTOCOL_FEE_POSITION, SEED_POSITION, SEED_POOL, SEED_ORACLE, SEED_CONFIG, SEED_AUTHORITY, Q64_ONE, MAX_ORACLE_OBSERVATIONS, MAX_HOOK_ALLOWLIST, INSTRUCTION_DISCRIMINATORS, HOOK_NO_CHANGE, HF_REQUIRE_ORACLE, HF_FORWARD_READONLY_SIGNERS, HF_BEFORE_SWAP, HF_BEFORE_REMOVE_LIQ, HF_BEFORE_ADD_LIQ, HF_AFTER_SWAP, HF_AFTER_REMOVE_LIQ, HF_AFTER_ADD_LIQ, BPS_DENOM, ACCOUNT_VERSION, ACCOUNT_DISCRIMINATORS, TOKEN_PROGRAM_ADDRESS, SYSTEM_PROGRAM_ADDRESS } from '../chunk-TVBSIQIX.js';
3
3
  import { __export } from '../chunk-PZ5AY32C.js';
4
- import { getAddressCodec, getProgramDerivedAddress, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getU64Encoder, getU128Encoder, getBooleanEncoder, getStructDecoder, fixDecoderSize, getU64Decoder, getU128Decoder, getBooleanDecoder, getBytesDecoder, combineCodec, getAddressEncoder, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, getU16Encoder, getU8Encoder, getArrayEncoder, getAddressDecoder, getU16Decoder, getU8Decoder, getArrayDecoder, getU32Encoder, getU32Decoder, getOptionEncoder, getOptionDecoder, createNoopSigner, address, addEncoderSizePrefix, getUtf8Encoder, addDecoderSizePrefix, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec, mergeBytes, isProgramError, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, containsBytes, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, assertIsInstructionWithAccounts } from '@solana/kit';
4
+ import { getAddressCodec, getProgramDerivedAddress, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getU64Encoder, getU128Encoder, getBooleanEncoder, getStructDecoder, fixDecoderSize, getU64Decoder, getU128Decoder, getBooleanDecoder, getBytesDecoder, combineCodec, getAddressEncoder, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, getU16Encoder, getU8Encoder, getArrayEncoder, getAddressDecoder, getU16Decoder, getU8Decoder, getArrayDecoder, getU32Encoder, getU32Decoder, getOptionEncoder, getOptionDecoder, createNoopSigner, address, addEncoderSizePrefix, getUtf8Encoder, addDecoderSizePrefix, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec, compressTransactionMessageUsingAddressLookupTables, mergeBytes, isProgramError, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, containsBytes, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, assertIsInstructionWithAccounts } from '@solana/kit';
5
5
  import { getAddressFromResolvedInstructionAccount, getAccountMetaFactory, getNonNullResolvedInstructionInput, addSelfPlanAndSendFunctions, addSelfFetchFunctions } from '@solana/program-client-core';
6
6
  import { keccak_256 } from '@noble/hashes/sha3.js';
7
+ import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
7
8
 
8
9
  // src/solana/cpmm/index.ts
9
10
  var cpmm_exports = {};
@@ -20,13 +21,22 @@ __export(cpmm_exports, {
20
21
  CREATE_POSITION_DISCRIMINATOR: () => CREATE_POSITION_DISCRIMINATOR,
21
22
  CpmmError: () => CpmmError,
22
23
  CpmmErrorCode: () => CpmmErrorCode,
24
+ HF_AFTER_ADD_LIQ: () => HF_AFTER_ADD_LIQ,
25
+ HF_AFTER_REMOVE_LIQ: () => HF_AFTER_REMOVE_LIQ,
26
+ HF_AFTER_SWAP: () => HF_AFTER_SWAP,
27
+ HF_BEFORE_ADD_LIQ: () => HF_BEFORE_ADD_LIQ,
28
+ HF_BEFORE_REMOVE_LIQ: () => HF_BEFORE_REMOVE_LIQ,
29
+ HF_BEFORE_SWAP: () => HF_BEFORE_SWAP,
30
+ HF_FORWARD_READONLY_SIGNERS: () => HF_FORWARD_READONLY_SIGNERS,
31
+ HF_REQUIRE_ORACLE: () => HF_REQUIRE_ORACLE,
32
+ HOOK_NO_CHANGE: () => HOOK_NO_CHANGE,
23
33
  INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR,
24
34
  INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
25
35
  INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
26
36
  INSTRUCTION_DISCRIMINATORS: () => INSTRUCTION_DISCRIMINATORS,
27
37
  MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
38
+ MAX_HOOK_ALLOWLIST: () => MAX_HOOK_ALLOWLIST,
28
39
  MAX_ORACLE_OBSERVATIONS: () => MAX_ORACLE_OBSERVATIONS,
29
- MAX_SENTINEL_ALLOWLIST: () => MAX_SENTINEL_ALLOWLIST,
30
40
  ORACLE_CONSULT_DISCRIMINATOR: () => ORACLE_CONSULT_DISCRIMINATOR,
31
41
  ORACLE_UPDATE_DISCRIMINATOR: () => ORACLE_UPDATE_DISCRIMINATOR,
32
42
  PAUSE_DISCRIMINATOR: () => PAUSE_DISCRIMINATOR,
@@ -39,25 +49,16 @@ __export(cpmm_exports, {
39
49
  SEED_ORACLE: () => SEED_ORACLE,
40
50
  SEED_POOL: () => SEED_POOL,
41
51
  SEED_POSITION: () => SEED_POSITION,
42
- SEED_PROTOCOL_POSITION: () => SEED_PROTOCOL_POSITION,
43
- SENTINEL_NO_CHANGE: () => SENTINEL_NO_CHANGE,
52
+ SEED_PROTOCOL_FEE_POSITION: () => SEED_PROTOCOL_FEE_POSITION,
44
53
  SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
54
+ SET_HOOK_DISCRIMINATOR: () => SET_HOOK_DISCRIMINATOR,
45
55
  SET_ROUTE_DISCRIMINATOR: () => SET_ROUTE_DISCRIMINATOR,
46
- SET_SENTINEL_DISCRIMINATOR: () => SET_SENTINEL_DISCRIMINATOR,
47
- SF_AFTER_ADD_LIQ: () => SF_AFTER_ADD_LIQ,
48
- SF_AFTER_REMOVE_LIQ: () => SF_AFTER_REMOVE_LIQ,
49
- SF_AFTER_SWAP: () => SF_AFTER_SWAP,
50
- SF_BEFORE_ADD_LIQ: () => SF_BEFORE_ADD_LIQ,
51
- SF_BEFORE_REMOVE_LIQ: () => SF_BEFORE_REMOVE_LIQ,
52
- SF_BEFORE_SWAP: () => SF_BEFORE_SWAP,
53
- SF_FORWARD_READONLY_SIGNERS: () => SF_FORWARD_READONLY_SIGNERS,
54
- SF_REQUIRE_ORACLE: () => SF_REQUIRE_ORACLE,
55
- SKIM_DISCRIMINATOR: () => SKIM_DISCRIMINATOR,
56
56
  SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
57
57
  TOKEN_METADATA_PROGRAM_ID: () => TOKEN_METADATA_PROGRAM_ID,
58
58
  TRANSFER_ADMIN_DISCRIMINATOR: () => TRANSFER_ADMIN_DISCRIMINATOR,
59
59
  UNPAUSE_DISCRIMINATOR: () => UNPAUSE_DISCRIMINATOR,
60
60
  UPDATE_CONFIG_DISCRIMINATOR: () => UPDATE_CONFIG_DISCRIMINATOR,
61
+ WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () => WITHDRAW_VAULT_EXCESS_DISCRIMINATOR,
61
62
  addLiquidityArgsCodec: () => addLiquidityArgsCodec,
62
63
  ammConfigDataCodec: () => ammConfigDataCodec,
63
64
  areMintsOrdered: () => areMintsOrdered,
@@ -86,13 +87,13 @@ __export(cpmm_exports, {
86
87
  createQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
87
88
  createRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
88
89
  createSetFeesInstruction: () => getSetFeesInstruction,
90
+ createSetHookInstruction: () => getSetHookInstruction,
89
91
  createSetRouteInstruction: () => getSetRouteInstruction,
90
- createSetSentinelInstruction: () => getSetSentinelInstruction,
91
- createSkimInstruction: () => getSkimInstruction,
92
92
  createSwapExactInInstruction: () => getSwapExactInInstruction,
93
93
  createSwapInstruction: () => createSwapInstruction,
94
94
  createTransferAdminInstruction: () => getTransferAdminInstruction,
95
95
  createUnpauseInstruction: () => getUnpauseInstruction,
96
+ createWithdrawVaultExcessInstruction: () => getWithdrawVaultExcessInstruction,
96
97
  curveParamsToMarketCap: () => curveParamsToMarketCap,
97
98
  decodeAmmConfig: () => decodeAmmConfig,
98
99
  decodeOracleState: () => decodeOracleState,
@@ -110,8 +111,8 @@ __export(cpmm_exports, {
110
111
  encodeQuoteToNumeraireArgs: () => encodeQuoteToNumeraireArgs,
111
112
  encodeRemoveLiquidityArgs: () => encodeRemoveLiquidityArgs,
112
113
  encodeSetFeesArgs: () => encodeSetFeesArgs,
114
+ encodeSetHookArgs: () => encodeSetHookArgs,
113
115
  encodeSetRouteArgs: () => encodeSetRouteArgs,
114
- encodeSetSentinelArgs: () => encodeSetSentinelArgs,
115
116
  encodeSwapExactInArgs: () => encodeSwapExactInArgs,
116
117
  encodeTransferAdminArgs: () => encodeTransferAdminArgs,
117
118
  fetchAllPools: () => fetchAllPools,
@@ -221,7 +222,7 @@ __export(cpmm_exports, {
221
222
  getPreviewSwapExactInInstructionDataCodec: () => getPreviewSwapExactInInstructionDataCodec,
222
223
  getPreviewSwapExactInInstructionDataDecoder: () => getPreviewSwapExactInInstructionDataDecoder,
223
224
  getPreviewSwapExactInInstructionDataEncoder: () => getPreviewSwapExactInInstructionDataEncoder,
224
- getProtocolPositionAddress: () => getProtocolPositionAddress,
225
+ getProtocolFeePositionAddress: () => getProtocolFeePositionAddress,
225
226
  getQuoteToNumeraireDiscriminatorBytes: () => getQuoteToNumeraireDiscriminatorBytes,
226
227
  getQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
227
228
  getQuoteToNumeraireInstructionDataCodec: () => getQuoteToNumeraireInstructionDataCodec,
@@ -239,22 +240,16 @@ __export(cpmm_exports, {
239
240
  getSetFeesInstructionDataCodec: () => getSetFeesInstructionDataCodec,
240
241
  getSetFeesInstructionDataDecoder: () => getSetFeesInstructionDataDecoder,
241
242
  getSetFeesInstructionDataEncoder: () => getSetFeesInstructionDataEncoder,
243
+ getSetHookDiscriminatorBytes: () => getSetHookDiscriminatorBytes,
244
+ getSetHookInstruction: () => getSetHookInstruction,
245
+ getSetHookInstructionDataCodec: () => getSetHookInstructionDataCodec,
246
+ getSetHookInstructionDataDecoder: () => getSetHookInstructionDataDecoder,
247
+ getSetHookInstructionDataEncoder: () => getSetHookInstructionDataEncoder,
242
248
  getSetRouteDiscriminatorBytes: () => getSetRouteDiscriminatorBytes,
243
249
  getSetRouteInstruction: () => getSetRouteInstruction,
244
250
  getSetRouteInstructionDataCodec: () => getSetRouteInstructionDataCodec,
245
251
  getSetRouteInstructionDataDecoder: () => getSetRouteInstructionDataDecoder,
246
252
  getSetRouteInstructionDataEncoder: () => getSetRouteInstructionDataEncoder,
247
- getSetSentinelDiscriminatorBytes: () => getSetSentinelDiscriminatorBytes,
248
- getSetSentinelInstruction: () => getSetSentinelInstruction,
249
- getSetSentinelInstructionDataCodec: () => getSetSentinelInstructionDataCodec,
250
- getSetSentinelInstructionDataDecoder: () => getSetSentinelInstructionDataDecoder,
251
- getSetSentinelInstructionDataEncoder: () => getSetSentinelInstructionDataEncoder,
252
- getSkimDiscriminatorBytes: () => getSkimDiscriminatorBytes,
253
- getSkimInstruction: () => getSkimInstruction,
254
- getSkimInstructionAsync: () => getSkimInstructionAsync,
255
- getSkimInstructionDataCodec: () => getSkimInstructionDataCodec,
256
- getSkimInstructionDataDecoder: () => getSkimInstructionDataDecoder,
257
- getSkimInstructionDataEncoder: () => getSkimInstructionDataEncoder,
258
253
  getSpotPrice0: () => getSpotPrice0,
259
254
  getSpotPrice1: () => getSpotPrice1,
260
255
  getSwapAddresses: () => getSwapAddresses,
@@ -282,6 +277,12 @@ __export(cpmm_exports, {
282
277
  getUpdateConfigInstructionDataCodec: () => getUpdateConfigInstructionDataCodec,
283
278
  getUpdateConfigInstructionDataDecoder: () => getUpdateConfigInstructionDataDecoder,
284
279
  getUpdateConfigInstructionDataEncoder: () => getUpdateConfigInstructionDataEncoder,
280
+ getWithdrawVaultExcessDiscriminatorBytes: () => getWithdrawVaultExcessDiscriminatorBytes,
281
+ getWithdrawVaultExcessInstruction: () => getWithdrawVaultExcessInstruction,
282
+ getWithdrawVaultExcessInstructionAsync: () => getWithdrawVaultExcessInstructionAsync,
283
+ getWithdrawVaultExcessInstructionDataCodec: () => getWithdrawVaultExcessInstructionDataCodec,
284
+ getWithdrawVaultExcessInstructionDataDecoder: () => getWithdrawVaultExcessInstructionDataDecoder,
285
+ getWithdrawVaultExcessInstructionDataEncoder: () => getWithdrawVaultExcessInstructionDataEncoder,
285
286
  initializeConfigArgsCodec: () => initializeConfigArgsCodec,
286
287
  initializeOracleArgsCodec: () => initializeOracleArgsCodec,
287
288
  initializePoolArgsCodec: () => initializePoolArgsCodec,
@@ -313,13 +314,13 @@ __export(cpmm_exports, {
313
314
  parseQuoteToNumeraireInstruction: () => parseQuoteToNumeraireInstruction,
314
315
  parseRemoveLiquidityInstruction: () => parseRemoveLiquidityInstruction,
315
316
  parseSetFeesInstruction: () => parseSetFeesInstruction,
317
+ parseSetHookInstruction: () => parseSetHookInstruction,
316
318
  parseSetRouteInstruction: () => parseSetRouteInstruction,
317
- parseSetSentinelInstruction: () => parseSetSentinelInstruction,
318
- parseSkimInstruction: () => parseSkimInstruction,
319
319
  parseSwapExactInInstruction: () => parseSwapExactInInstruction,
320
320
  parseTransferAdminInstruction: () => parseTransferAdminInstruction,
321
321
  parseUnpauseInstruction: () => parseUnpauseInstruction,
322
322
  parseUpdateConfigInstruction: () => parseUpdateConfigInstruction,
323
+ parseWithdrawVaultExcessInstruction: () => parseWithdrawVaultExcessInstruction,
323
324
  poolDataCodec: () => poolDataCodec,
324
325
  poolExists: () => poolExists,
325
326
  positionDataCodec: () => positionDataCodec,
@@ -330,8 +331,8 @@ __export(cpmm_exports, {
330
331
  ratioToNumber: () => ratioToNumber,
331
332
  removeLiquidityArgsCodec: () => removeLiquidityArgsCodec,
332
333
  setFeesArgsCodec: () => setFeesArgsCodec,
334
+ setHookArgsCodec: () => setHookArgsCodec,
333
335
  setRouteArgsCodec: () => setRouteArgsCodec,
334
- setSentinelArgsCodec: () => setSentinelArgsCodec,
335
336
  sortMints: () => sortMints,
336
337
  sortPoolsByReserves: () => sortPoolsByReserves,
337
338
  sortPositionsByShares: () => sortPositionsByShares,
@@ -519,7 +520,7 @@ var CpmmErrorCode = /* @__PURE__ */ ((CpmmErrorCode2) => {
519
520
  CpmmErrorCode2[CpmmErrorCode2["PoolLocked"] = 6001] = "PoolLocked";
520
521
  CpmmErrorCode2[CpmmErrorCode2["InvalidFee"] = 6002] = "InvalidFee";
521
522
  CpmmErrorCode2[CpmmErrorCode2["InvalidFeeSplit"] = 6003] = "InvalidFeeSplit";
522
- CpmmErrorCode2[CpmmErrorCode2["InvalidDirection"] = 6004] = "InvalidDirection";
523
+ CpmmErrorCode2[CpmmErrorCode2["InvalidTradeDirection"] = 6004] = "InvalidTradeDirection";
523
524
  CpmmErrorCode2[CpmmErrorCode2["InsufficientLiquidity"] = 6005] = "InsufficientLiquidity";
524
525
  CpmmErrorCode2[CpmmErrorCode2["SlippageExceeded"] = 6006] = "SlippageExceeded";
525
526
  CpmmErrorCode2[CpmmErrorCode2["MathOverflow"] = 6007] = "MathOverflow";
@@ -532,13 +533,13 @@ var CpmmErrorCode = /* @__PURE__ */ ((CpmmErrorCode2) => {
532
533
  CpmmErrorCode2[CpmmErrorCode2["NotSupportedInV0_1"] = 6014] = "NotSupportedInV0_1";
533
534
  CpmmErrorCode2[CpmmErrorCode2["OracleNotInitialized"] = 6015] = "OracleNotInitialized";
534
535
  CpmmErrorCode2[CpmmErrorCode2["ZeroSharesOut"] = 6016] = "ZeroSharesOut";
535
- CpmmErrorCode2[CpmmErrorCode2["SentinelRejected"] = 6017] = "SentinelRejected";
536
- CpmmErrorCode2[CpmmErrorCode2["SentinelCpiFailed"] = 6018] = "SentinelCpiFailed";
537
- CpmmErrorCode2[CpmmErrorCode2["SentinelProgramNotProvided"] = 6019] = "SentinelProgramNotProvided";
538
- CpmmErrorCode2[CpmmErrorCode2["SentinelProgramNotExecutable"] = 6020] = "SentinelProgramNotExecutable";
539
- CpmmErrorCode2[CpmmErrorCode2["SentinelReturnDataMissing"] = 6021] = "SentinelReturnDataMissing";
540
- CpmmErrorCode2[CpmmErrorCode2["SentinelReturnDataInvalid"] = 6022] = "SentinelReturnDataInvalid";
541
- CpmmErrorCode2[CpmmErrorCode2["SentinelNotAllowlisted"] = 6023] = "SentinelNotAllowlisted";
536
+ CpmmErrorCode2[CpmmErrorCode2["HookRejected"] = 6017] = "HookRejected";
537
+ CpmmErrorCode2[CpmmErrorCode2["HookCpiFailed"] = 6018] = "HookCpiFailed";
538
+ CpmmErrorCode2[CpmmErrorCode2["HookProgramNotProvided"] = 6019] = "HookProgramNotProvided";
539
+ CpmmErrorCode2[CpmmErrorCode2["HookProgramNotExecutable"] = 6020] = "HookProgramNotExecutable";
540
+ CpmmErrorCode2[CpmmErrorCode2["HookReturnDataMissing"] = 6021] = "HookReturnDataMissing";
541
+ CpmmErrorCode2[CpmmErrorCode2["HookReturnDataInvalid"] = 6022] = "HookReturnDataInvalid";
542
+ CpmmErrorCode2[CpmmErrorCode2["HookNotAllowlisted"] = 6023] = "HookNotAllowlisted";
542
543
  CpmmErrorCode2[CpmmErrorCode2["TotalSharesZero"] = 6024] = "TotalSharesZero";
543
544
  CpmmErrorCode2[CpmmErrorCode2["AmountZero"] = 6025] = "AmountZero";
544
545
  CpmmErrorCode2[CpmmErrorCode2["Paused"] = 6026] = "Paused";
@@ -546,6 +547,8 @@ var CpmmErrorCode = /* @__PURE__ */ ((CpmmErrorCode2) => {
546
547
  CpmmErrorCode2[CpmmErrorCode2["InvalidMint"] = 6028] = "InvalidMint";
547
548
  CpmmErrorCode2[CpmmErrorCode2["InvalidInput"] = 6029] = "InvalidInput";
548
549
  CpmmErrorCode2[CpmmErrorCode2["Reentrancy"] = 6030] = "Reentrancy";
550
+ CpmmErrorCode2[CpmmErrorCode2["CpiForbidden"] = 6031] = "CpiForbidden";
551
+ CpmmErrorCode2[CpmmErrorCode2["UseCollectProtocolFees"] = 6032] = "UseCollectProtocolFees";
549
552
  return CpmmErrorCode2;
550
553
  })(CpmmErrorCode || {});
551
554
  var CPMM_ERROR_MESSAGES = {
@@ -553,7 +556,7 @@ var CPMM_ERROR_MESSAGES = {
553
556
  [6001 /* PoolLocked */]: "Pool is currently locked (reentrancy protection)",
554
557
  [6002 /* InvalidFee */]: "Invalid fee value (exceeds max or invalid range)",
555
558
  [6003 /* InvalidFeeSplit */]: "Invalid fee split value (exceeds max or invalid range)",
556
- [6004 /* InvalidDirection */]: "Invalid swap direction (must be 0 or 1)",
559
+ [6004 /* InvalidTradeDirection */]: "Invalid trade direction (must be 0 or 1)",
557
560
  [6005 /* InsufficientLiquidity */]: "Insufficient liquidity for this operation",
558
561
  [6006 /* SlippageExceeded */]: "Slippage exceeded: Output amount less than minimum",
559
562
  [6007 /* MathOverflow */]: "Math operation overflowed",
@@ -566,20 +569,22 @@ var CPMM_ERROR_MESSAGES = {
566
569
  [6014 /* NotSupportedInV0_1 */]: "Not supported in v0.1",
567
570
  [6015 /* OracleNotInitialized */]: "Oracle not initialized for this pool",
568
571
  [6016 /* ZeroSharesOut */]: "Zero shares out",
569
- [6017 /* SentinelRejected */]: "Sentinel program rejected the operation",
570
- [6018 /* SentinelCpiFailed */]: "Sentinel CPI call failed",
571
- [6019 /* SentinelProgramNotProvided */]: "Sentinel program account not provided",
572
- [6020 /* SentinelProgramNotExecutable */]: "Sentinel program account is not executable",
573
- [6021 /* SentinelReturnDataMissing */]: "Sentinel return data missing or wrong program id",
574
- [6022 /* SentinelReturnDataInvalid */]: "Sentinel return data invalid length or could not deserialize",
575
- [6023 /* SentinelNotAllowlisted */]: "Sentinel program not in allowlist",
572
+ [6017 /* HookRejected */]: "Hook rejected",
573
+ [6018 /* HookCpiFailed */]: "Hook CPI failed",
574
+ [6019 /* HookProgramNotProvided */]: "Hook program account not provided",
575
+ [6020 /* HookProgramNotExecutable */]: "Hook program account is not executable",
576
+ [6021 /* HookReturnDataMissing */]: "Hook return data missing or wrong program id",
577
+ [6022 /* HookReturnDataInvalid */]: "Hook return data invalid length or could not deserialize",
578
+ [6023 /* HookNotAllowlisted */]: "Hook not allowlisted",
576
579
  [6024 /* TotalSharesZero */]: "Pool has zero shares (no liquidity)",
577
580
  [6025 /* AmountZero */]: "Amount cannot be zero",
578
581
  [6026 /* Paused */]: "Pool is paused by admin",
579
582
  [6027 /* InvariantViolation */]: "Internal invariant violation",
580
583
  [6028 /* InvalidMint */]: "Invalid mint address",
581
584
  [6029 /* InvalidInput */]: "Invalid input parameter",
582
- [6030 /* Reentrancy */]: "Reentrancy detected"
585
+ [6030 /* Reentrancy */]: "Reentrancy detected",
586
+ [6031 /* CpiForbidden */]: "CPI calls into this program are forbidden",
587
+ [6032 /* UseCollectProtocolFees */]: "Protocol fee position must be claimed via collect_protocol_fees"
583
588
  };
584
589
  var CpmmError = class extends Error {
585
590
  constructor(code, logs) {
@@ -602,14 +607,14 @@ function parseErrorFromLogs(logs) {
602
607
  );
603
608
  if (anchorMatch) {
604
609
  const errorNumber = parseInt(anchorMatch[2], 10);
605
- if (errorNumber >= 6e3 && errorNumber <= 6030) {
610
+ if (errorNumber >= 6e3 && errorNumber <= 6032) {
606
611
  return new CpmmError(errorNumber, logs);
607
612
  }
608
613
  }
609
614
  const hexMatch = log.match(/Error Number:\s*0x([0-9a-fA-F]+)/);
610
615
  if (hexMatch) {
611
616
  const errorNumber = parseInt(hexMatch[1], 16);
612
- if (errorNumber >= 6e3 && errorNumber <= 6030) {
617
+ if (errorNumber >= 6e3 && errorNumber <= 6032) {
613
618
  return new CpmmError(errorNumber, logs);
614
619
  }
615
620
  }
@@ -626,7 +631,7 @@ function parseErrorFromLogs(logs) {
626
631
  return null;
627
632
  }
628
633
  function isCpmmError(code) {
629
- return code >= 6e3 && code <= 6030;
634
+ return code >= 6e3 && code <= 6032;
630
635
  }
631
636
  function getErrorMessage(code) {
632
637
  if (isCpmmError(code)) {
@@ -687,8 +692,8 @@ async function getAddLiquidityInstructionAsync(input, config) {
687
692
  config: { value: input.config ?? null, isWritable: false },
688
693
  pool: { value: input.pool ?? null, isWritable: true },
689
694
  position: { value: input.position ?? null, isWritable: true },
690
- protocolPosition: {
691
- value: input.protocolPosition ?? null,
695
+ protocolFeePosition: {
696
+ value: input.protocolFeePosition ?? null,
692
697
  isWritable: true
693
698
  },
694
699
  owner: { value: input.owner ?? null, isWritable: false },
@@ -724,7 +729,7 @@ async function getAddLiquidityInstructionAsync(input, config) {
724
729
  getAccountMeta("config", accounts.config),
725
730
  getAccountMeta("pool", accounts.pool),
726
731
  getAccountMeta("position", accounts.position),
727
- getAccountMeta("protocolPosition", accounts.protocolPosition),
732
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
728
733
  getAccountMeta("owner", accounts.owner),
729
734
  getAccountMeta("authority", accounts.authority),
730
735
  getAccountMeta("vault0", accounts.vault0),
@@ -749,8 +754,8 @@ function getAddLiquidityInstruction(input, config) {
749
754
  config: { value: input.config ?? null, isWritable: false },
750
755
  pool: { value: input.pool ?? null, isWritable: true },
751
756
  position: { value: input.position ?? null, isWritable: true },
752
- protocolPosition: {
753
- value: input.protocolPosition ?? null,
757
+ protocolFeePosition: {
758
+ value: input.protocolFeePosition ?? null,
754
759
  isWritable: true
755
760
  },
756
761
  owner: { value: input.owner ?? null, isWritable: false },
@@ -773,7 +778,7 @@ function getAddLiquidityInstruction(input, config) {
773
778
  getAccountMeta("config", accounts.config),
774
779
  getAccountMeta("pool", accounts.pool),
775
780
  getAccountMeta("position", accounts.position),
776
- getAccountMeta("protocolPosition", accounts.protocolPosition),
781
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
777
782
  getAccountMeta("owner", accounts.owner),
778
783
  getAccountMeta("authority", accounts.authority),
779
784
  getAccountMeta("vault0", accounts.vault0),
@@ -818,7 +823,7 @@ function parseAddLiquidityInstruction(instruction) {
818
823
  config: getNextAccount(),
819
824
  pool: getNextAccount(),
820
825
  position: getNextAccount(),
821
- protocolPosition: getNextAccount(),
826
+ protocolFeePosition: getNextAccount(),
822
827
  owner: getNextAccount(),
823
828
  authority: getNextAccount(),
824
829
  vault0: getNextAccount(),
@@ -1126,8 +1131,8 @@ async function getCollectProtocolFeesInstructionAsync(input, config) {
1126
1131
  const originalAccounts = {
1127
1132
  config: { value: input.config ?? null, isWritable: false },
1128
1133
  pool: { value: input.pool ?? null, isWritable: true },
1129
- protocolPosition: {
1130
- value: input.protocolPosition ?? null,
1134
+ protocolFeePosition: {
1135
+ value: input.protocolFeePosition ?? null,
1131
1136
  isWritable: true
1132
1137
  },
1133
1138
  admin: { value: input.admin ?? null, isWritable: false },
@@ -1161,7 +1166,7 @@ async function getCollectProtocolFeesInstructionAsync(input, config) {
1161
1166
  accounts: [
1162
1167
  getAccountMeta("config", accounts.config),
1163
1168
  getAccountMeta("pool", accounts.pool),
1164
- getAccountMeta("protocolPosition", accounts.protocolPosition),
1169
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1165
1170
  getAccountMeta("admin", accounts.admin),
1166
1171
  getAccountMeta("authority", accounts.authority),
1167
1172
  getAccountMeta("vault0", accounts.vault0),
@@ -1184,8 +1189,8 @@ function getCollectProtocolFeesInstruction(input, config) {
1184
1189
  const originalAccounts = {
1185
1190
  config: { value: input.config ?? null, isWritable: false },
1186
1191
  pool: { value: input.pool ?? null, isWritable: true },
1187
- protocolPosition: {
1188
- value: input.protocolPosition ?? null,
1192
+ protocolFeePosition: {
1193
+ value: input.protocolFeePosition ?? null,
1189
1194
  isWritable: true
1190
1195
  },
1191
1196
  admin: { value: input.admin ?? null, isWritable: false },
@@ -1206,7 +1211,7 @@ function getCollectProtocolFeesInstruction(input, config) {
1206
1211
  accounts: [
1207
1212
  getAccountMeta("config", accounts.config),
1208
1213
  getAccountMeta("pool", accounts.pool),
1209
- getAccountMeta("protocolPosition", accounts.protocolPosition),
1214
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1210
1215
  getAccountMeta("admin", accounts.admin),
1211
1216
  getAccountMeta("authority", accounts.authority),
1212
1217
  getAccountMeta("vault0", accounts.vault0),
@@ -1245,7 +1250,7 @@ function parseCollectProtocolFeesInstruction(instruction) {
1245
1250
  accounts: {
1246
1251
  config: getNextAccount(),
1247
1252
  pool: getNextAccount(),
1248
- protocolPosition: getNextAccount(),
1253
+ protocolFeePosition: getNextAccount(),
1249
1254
  admin: getNextAccount(),
1250
1255
  authority: getNextAccount(),
1251
1256
  vault0: getNextAccount(),
@@ -1432,7 +1437,7 @@ function getInitializeConfigInstructionDataEncoder() {
1432
1437
  ["maxRouteHops", getU8Encoder()],
1433
1438
  ["protocolFeeEnabled", getBooleanEncoder()],
1434
1439
  ["protocolFeeBps", getU16Encoder()],
1435
- ["sentinelAllowlist", getArrayEncoder(getAddressEncoder())]
1440
+ ["hookAllowlist", getArrayEncoder(getAddressEncoder())]
1436
1441
  ]),
1437
1442
  (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
1438
1443
  );
@@ -1447,7 +1452,7 @@ function getInitializeConfigInstructionDataDecoder() {
1447
1452
  ["maxRouteHops", getU8Decoder()],
1448
1453
  ["protocolFeeEnabled", getBooleanDecoder()],
1449
1454
  ["protocolFeeBps", getU16Decoder()],
1450
- ["sentinelAllowlist", getArrayDecoder(getAddressDecoder())]
1455
+ ["hookAllowlist", getArrayDecoder(getAddressDecoder())]
1451
1456
  ]);
1452
1457
  }
1453
1458
  function getInitializeConfigInstructionDataCodec() {
@@ -1708,7 +1713,7 @@ function getInitializePoolInstructionDataEncoder() {
1708
1713
  ["mintB", getAddressEncoder()],
1709
1714
  ["initialSwapFeeBps", getU16Encoder()],
1710
1715
  ["initialFeeSplitBps", getU16Encoder()],
1711
- ["liquidityMeasureSide", getU8Encoder()],
1716
+ ["liquidityMeasureTokenIndex", getU8Encoder()],
1712
1717
  ["numeraireMintOverride", getOptionEncoder(getAddressEncoder())]
1713
1718
  ]),
1714
1719
  (value) => ({ ...value, discriminator: INITIALIZE_POOL_DISCRIMINATOR })
@@ -1721,7 +1726,7 @@ function getInitializePoolInstructionDataDecoder() {
1721
1726
  ["mintB", getAddressDecoder()],
1722
1727
  ["initialSwapFeeBps", getU16Decoder()],
1723
1728
  ["initialFeeSplitBps", getU16Decoder()],
1724
- ["liquidityMeasureSide", getU8Decoder()],
1729
+ ["liquidityMeasureTokenIndex", getU8Decoder()],
1725
1730
  ["numeraireMintOverride", getOptionDecoder(getAddressDecoder())]
1726
1731
  ]);
1727
1732
  }
@@ -1736,8 +1741,8 @@ async function getInitializePoolInstructionAsync(input, config) {
1736
1741
  const originalAccounts = {
1737
1742
  config: { value: input.config ?? null, isWritable: false },
1738
1743
  pool: { value: input.pool ?? null, isWritable: true },
1739
- protocolPosition: {
1740
- value: input.protocolPosition ?? null,
1744
+ protocolFeePosition: {
1745
+ value: input.protocolFeePosition ?? null,
1741
1746
  isWritable: true
1742
1747
  },
1743
1748
  authority: { value: input.authority ?? null, isWritable: false },
@@ -1777,8 +1782,8 @@ async function getInitializePoolInstructionAsync(input, config) {
1777
1782
  ]
1778
1783
  });
1779
1784
  }
1780
- if (!accounts.protocolPosition.value) {
1781
- accounts.protocolPosition.value = await getProgramDerivedAddress({
1785
+ if (!accounts.protocolFeePosition.value) {
1786
+ accounts.protocolFeePosition.value = await getProgramDerivedAddress({
1782
1787
  programAddress,
1783
1788
  seeds: [
1784
1789
  getBytesEncoder().encode(
@@ -1854,7 +1859,7 @@ async function getInitializePoolInstructionAsync(input, config) {
1854
1859
  accounts: [
1855
1860
  getAccountMeta("config", accounts.config),
1856
1861
  getAccountMeta("pool", accounts.pool),
1857
- getAccountMeta("protocolPosition", accounts.protocolPosition),
1862
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1858
1863
  getAccountMeta("authority", accounts.authority),
1859
1864
  getAccountMeta("vault0", accounts.vault0),
1860
1865
  getAccountMeta("vault1", accounts.vault1),
@@ -1878,8 +1883,8 @@ function getInitializePoolInstruction(input, config) {
1878
1883
  const originalAccounts = {
1879
1884
  config: { value: input.config ?? null, isWritable: false },
1880
1885
  pool: { value: input.pool ?? null, isWritable: true },
1881
- protocolPosition: {
1882
- value: input.protocolPosition ?? null,
1886
+ protocolFeePosition: {
1887
+ value: input.protocolFeePosition ?? null,
1883
1888
  isWritable: true
1884
1889
  },
1885
1890
  authority: { value: input.authority ?? null, isWritable: false },
@@ -1910,7 +1915,7 @@ function getInitializePoolInstruction(input, config) {
1910
1915
  accounts: [
1911
1916
  getAccountMeta("config", accounts.config),
1912
1917
  getAccountMeta("pool", accounts.pool),
1913
- getAccountMeta("protocolPosition", accounts.protocolPosition),
1918
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1914
1919
  getAccountMeta("authority", accounts.authority),
1915
1920
  getAccountMeta("vault0", accounts.vault0),
1916
1921
  getAccountMeta("vault1", accounts.vault1),
@@ -1950,7 +1955,7 @@ function parseInitializePoolInstruction(instruction) {
1950
1955
  accounts: {
1951
1956
  config: getNextAccount(),
1952
1957
  pool: getNextAccount(),
1953
- protocolPosition: getNextAccount(),
1958
+ protocolFeePosition: getNextAccount(),
1954
1959
  authority: getNextAccount(),
1955
1960
  vault0: getNextAccount(),
1956
1961
  vault1: getNextAccount(),
@@ -2263,7 +2268,7 @@ function getPreviewSwapExactInInstructionDataEncoder() {
2263
2268
  getStructEncoder([
2264
2269
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2265
2270
  ["amountIn", getU64Encoder()],
2266
- ["direction", getU8Encoder()]
2271
+ ["tradeDirection", getU8Encoder()]
2267
2272
  ]),
2268
2273
  (value) => ({
2269
2274
  ...value,
@@ -2275,7 +2280,7 @@ function getPreviewSwapExactInInstructionDataDecoder() {
2275
2280
  return getStructDecoder([
2276
2281
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2277
2282
  ["amountIn", getU64Decoder()],
2278
- ["direction", getU8Decoder()]
2283
+ ["tradeDirection", getU8Decoder()]
2279
2284
  ]);
2280
2285
  }
2281
2286
  function getPreviewSwapExactInInstructionDataCodec() {
@@ -2348,7 +2353,7 @@ function getQuoteToNumeraireInstructionDataEncoder() {
2348
2353
  getStructEncoder([
2349
2354
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2350
2355
  ["amount", getU128Encoder()],
2351
- ["side", getU8Encoder()],
2356
+ ["inputTokenIndex", getU8Encoder()],
2352
2357
  ["maxHops", getU8Encoder()],
2353
2358
  ["useTwap", getBooleanEncoder()],
2354
2359
  ["windowSeconds", getU32Encoder()]
@@ -2360,7 +2365,7 @@ function getQuoteToNumeraireInstructionDataDecoder() {
2360
2365
  return getStructDecoder([
2361
2366
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2362
2367
  ["amount", getU128Decoder()],
2363
- ["side", getU8Decoder()],
2368
+ ["inputTokenIndex", getU8Decoder()],
2364
2369
  ["maxHops", getU8Decoder()],
2365
2370
  ["useTwap", getBooleanDecoder()],
2366
2371
  ["windowSeconds", getU32Decoder()]
@@ -2462,8 +2467,8 @@ async function getRemoveLiquidityInstructionAsync(input, config) {
2462
2467
  config: { value: input.config ?? null, isWritable: false },
2463
2468
  pool: { value: input.pool ?? null, isWritable: true },
2464
2469
  position: { value: input.position ?? null, isWritable: true },
2465
- protocolPosition: {
2466
- value: input.protocolPosition ?? null,
2470
+ protocolFeePosition: {
2471
+ value: input.protocolFeePosition ?? null,
2467
2472
  isWritable: true
2468
2473
  },
2469
2474
  owner: { value: input.owner ?? null, isWritable: false },
@@ -2499,7 +2504,7 @@ async function getRemoveLiquidityInstructionAsync(input, config) {
2499
2504
  getAccountMeta("config", accounts.config),
2500
2505
  getAccountMeta("pool", accounts.pool),
2501
2506
  getAccountMeta("position", accounts.position),
2502
- getAccountMeta("protocolPosition", accounts.protocolPosition),
2507
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2503
2508
  getAccountMeta("owner", accounts.owner),
2504
2509
  getAccountMeta("authority", accounts.authority),
2505
2510
  getAccountMeta("vault0", accounts.vault0),
@@ -2524,8 +2529,8 @@ function getRemoveLiquidityInstruction(input, config) {
2524
2529
  config: { value: input.config ?? null, isWritable: false },
2525
2530
  pool: { value: input.pool ?? null, isWritable: true },
2526
2531
  position: { value: input.position ?? null, isWritable: true },
2527
- protocolPosition: {
2528
- value: input.protocolPosition ?? null,
2532
+ protocolFeePosition: {
2533
+ value: input.protocolFeePosition ?? null,
2529
2534
  isWritable: true
2530
2535
  },
2531
2536
  owner: { value: input.owner ?? null, isWritable: false },
@@ -2548,7 +2553,7 @@ function getRemoveLiquidityInstruction(input, config) {
2548
2553
  getAccountMeta("config", accounts.config),
2549
2554
  getAccountMeta("pool", accounts.pool),
2550
2555
  getAccountMeta("position", accounts.position),
2551
- getAccountMeta("protocolPosition", accounts.protocolPosition),
2556
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2552
2557
  getAccountMeta("owner", accounts.owner),
2553
2558
  getAccountMeta("authority", accounts.authority),
2554
2559
  getAccountMeta("vault0", accounts.vault0),
@@ -2593,7 +2598,7 @@ function parseRemoveLiquidityInstruction(instruction) {
2593
2598
  config: getNextAccount(),
2594
2599
  pool: getNextAccount(),
2595
2600
  position: getNextAccount(),
2596
- protocolPosition: getNextAccount(),
2601
+ protocolFeePosition: getNextAccount(),
2597
2602
  owner: getNextAccount(),
2598
2603
  authority: getNextAccount(),
2599
2604
  vault0: getNextAccount(),
@@ -2693,48 +2698,47 @@ function parseSetFeesInstruction(instruction) {
2693
2698
  data: getSetFeesInstructionDataDecoder().decode(instruction.data)
2694
2699
  };
2695
2700
  }
2696
- var SET_ROUTE_DISCRIMINATOR = new Uint8Array([
2697
- 244,
2698
- 231,
2699
- 3,
2700
- 84,
2701
- 233,
2702
- 61,
2703
- 146,
2704
- 149
2701
+ var SET_HOOK_DISCRIMINATOR = new Uint8Array([
2702
+ 175,
2703
+ 16,
2704
+ 187,
2705
+ 252,
2706
+ 19,
2707
+ 54,
2708
+ 111,
2709
+ 221
2705
2710
  ]);
2706
- function getSetRouteDiscriminatorBytes() {
2707
- return fixEncoderSize(getBytesEncoder(), 8).encode(SET_ROUTE_DISCRIMINATOR);
2711
+ function getSetHookDiscriminatorBytes() {
2712
+ return fixEncoderSize(getBytesEncoder(), 8).encode(SET_HOOK_DISCRIMINATOR);
2708
2713
  }
2709
- function getSetRouteInstructionDataEncoder() {
2714
+ function getSetHookInstructionDataEncoder() {
2710
2715
  return transformEncoder(
2711
2716
  getStructEncoder([
2712
2717
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2713
- ["routeNextPool", getAddressEncoder()],
2714
- ["routeBridgeMint", getAddressEncoder()]
2718
+ ["hookProgram", getAddressEncoder()],
2719
+ ["hookFlags", getU32Encoder()]
2715
2720
  ]),
2716
- (value) => ({ ...value, discriminator: SET_ROUTE_DISCRIMINATOR })
2721
+ (value) => ({ ...value, discriminator: SET_HOOK_DISCRIMINATOR })
2717
2722
  );
2718
2723
  }
2719
- function getSetRouteInstructionDataDecoder() {
2724
+ function getSetHookInstructionDataDecoder() {
2720
2725
  return getStructDecoder([
2721
2726
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2722
- ["routeNextPool", getAddressDecoder()],
2723
- ["routeBridgeMint", getAddressDecoder()]
2727
+ ["hookProgram", getAddressDecoder()],
2728
+ ["hookFlags", getU32Decoder()]
2724
2729
  ]);
2725
2730
  }
2726
- function getSetRouteInstructionDataCodec() {
2731
+ function getSetHookInstructionDataCodec() {
2727
2732
  return combineCodec(
2728
- getSetRouteInstructionDataEncoder(),
2729
- getSetRouteInstructionDataDecoder()
2733
+ getSetHookInstructionDataEncoder(),
2734
+ getSetHookInstructionDataDecoder()
2730
2735
  );
2731
2736
  }
2732
- function getSetRouteInstruction(input, config) {
2737
+ function getSetHookInstruction(input, config) {
2733
2738
  const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2734
2739
  const originalAccounts = {
2735
2740
  config: { value: input.config ?? null, isWritable: false },
2736
2741
  pool: { value: input.pool ?? null, isWritable: true },
2737
- nextPool: { value: input.nextPool ?? null, isWritable: false },
2738
2742
  admin: { value: input.admin ?? null, isWritable: false }
2739
2743
  };
2740
2744
  const accounts = originalAccounts;
@@ -2744,22 +2748,21 @@ function getSetRouteInstruction(input, config) {
2744
2748
  accounts: [
2745
2749
  getAccountMeta("config", accounts.config),
2746
2750
  getAccountMeta("pool", accounts.pool),
2747
- getAccountMeta("nextPool", accounts.nextPool),
2748
2751
  getAccountMeta("admin", accounts.admin)
2749
2752
  ],
2750
- data: getSetRouteInstructionDataEncoder().encode(
2753
+ data: getSetHookInstructionDataEncoder().encode(
2751
2754
  args
2752
2755
  ),
2753
2756
  programAddress
2754
2757
  });
2755
2758
  }
2756
- function parseSetRouteInstruction(instruction) {
2757
- if (instruction.accounts.length < 4) {
2759
+ function parseSetHookInstruction(instruction) {
2760
+ if (instruction.accounts.length < 3) {
2758
2761
  throw new SolanaError(
2759
2762
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2760
2763
  {
2761
2764
  actualAccountMetas: instruction.accounts.length,
2762
- expectedAccountMetas: 4
2765
+ expectedAccountMetas: 3
2763
2766
  }
2764
2767
  );
2765
2768
  }
@@ -2769,64 +2772,58 @@ function parseSetRouteInstruction(instruction) {
2769
2772
  accountIndex += 1;
2770
2773
  return accountMeta;
2771
2774
  };
2772
- const getNextOptionalAccount = () => {
2773
- const accountMeta = getNextAccount();
2774
- return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
2775
- };
2776
2775
  return {
2777
2776
  programAddress: instruction.programAddress,
2778
2777
  accounts: {
2779
2778
  config: getNextAccount(),
2780
2779
  pool: getNextAccount(),
2781
- nextPool: getNextOptionalAccount(),
2782
2780
  admin: getNextAccount()
2783
2781
  },
2784
- data: getSetRouteInstructionDataDecoder().decode(instruction.data)
2782
+ data: getSetHookInstructionDataDecoder().decode(instruction.data)
2785
2783
  };
2786
2784
  }
2787
- var SET_SENTINEL_DISCRIMINATOR = new Uint8Array([
2788
- 94,
2789
- 200,
2790
- 82,
2791
- 129,
2792
- 53,
2793
- 149,
2794
- 232,
2795
- 113
2785
+ var SET_ROUTE_DISCRIMINATOR = new Uint8Array([
2786
+ 244,
2787
+ 231,
2788
+ 3,
2789
+ 84,
2790
+ 233,
2791
+ 61,
2792
+ 146,
2793
+ 149
2796
2794
  ]);
2797
- function getSetSentinelDiscriminatorBytes() {
2798
- return fixEncoderSize(getBytesEncoder(), 8).encode(
2799
- SET_SENTINEL_DISCRIMINATOR
2800
- );
2795
+ function getSetRouteDiscriminatorBytes() {
2796
+ return fixEncoderSize(getBytesEncoder(), 8).encode(SET_ROUTE_DISCRIMINATOR);
2801
2797
  }
2802
- function getSetSentinelInstructionDataEncoder() {
2798
+ function getSetRouteInstructionDataEncoder() {
2803
2799
  return transformEncoder(
2804
2800
  getStructEncoder([
2805
2801
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2806
- ["sentinelProgram", getAddressEncoder()],
2807
- ["sentinelFlags", getU32Encoder()]
2802
+ ["routeNextPool", getAddressEncoder()],
2803
+ ["routeBridgeMint", getAddressEncoder()]
2808
2804
  ]),
2809
- (value) => ({ ...value, discriminator: SET_SENTINEL_DISCRIMINATOR })
2805
+ (value) => ({ ...value, discriminator: SET_ROUTE_DISCRIMINATOR })
2810
2806
  );
2811
2807
  }
2812
- function getSetSentinelInstructionDataDecoder() {
2808
+ function getSetRouteInstructionDataDecoder() {
2813
2809
  return getStructDecoder([
2814
2810
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2815
- ["sentinelProgram", getAddressDecoder()],
2816
- ["sentinelFlags", getU32Decoder()]
2811
+ ["routeNextPool", getAddressDecoder()],
2812
+ ["routeBridgeMint", getAddressDecoder()]
2817
2813
  ]);
2818
2814
  }
2819
- function getSetSentinelInstructionDataCodec() {
2815
+ function getSetRouteInstructionDataCodec() {
2820
2816
  return combineCodec(
2821
- getSetSentinelInstructionDataEncoder(),
2822
- getSetSentinelInstructionDataDecoder()
2817
+ getSetRouteInstructionDataEncoder(),
2818
+ getSetRouteInstructionDataDecoder()
2823
2819
  );
2824
2820
  }
2825
- function getSetSentinelInstruction(input, config) {
2821
+ function getSetRouteInstruction(input, config) {
2826
2822
  const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2827
2823
  const originalAccounts = {
2828
2824
  config: { value: input.config ?? null, isWritable: false },
2829
2825
  pool: { value: input.pool ?? null, isWritable: true },
2826
+ nextPool: { value: input.nextPool ?? null, isWritable: false },
2830
2827
  admin: { value: input.admin ?? null, isWritable: false }
2831
2828
  };
2832
2829
  const accounts = originalAccounts;
@@ -2836,21 +2833,22 @@ function getSetSentinelInstruction(input, config) {
2836
2833
  accounts: [
2837
2834
  getAccountMeta("config", accounts.config),
2838
2835
  getAccountMeta("pool", accounts.pool),
2836
+ getAccountMeta("nextPool", accounts.nextPool),
2839
2837
  getAccountMeta("admin", accounts.admin)
2840
2838
  ],
2841
- data: getSetSentinelInstructionDataEncoder().encode(
2839
+ data: getSetRouteInstructionDataEncoder().encode(
2842
2840
  args
2843
2841
  ),
2844
2842
  programAddress
2845
2843
  });
2846
2844
  }
2847
- function parseSetSentinelInstruction(instruction) {
2848
- if (instruction.accounts.length < 3) {
2845
+ function parseSetRouteInstruction(instruction) {
2846
+ if (instruction.accounts.length < 4) {
2849
2847
  throw new SolanaError(
2850
2848
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2851
2849
  {
2852
2850
  actualAccountMetas: instruction.accounts.length,
2853
- expectedAccountMetas: 3
2851
+ expectedAccountMetas: 4
2854
2852
  }
2855
2853
  );
2856
2854
  }
@@ -2860,216 +2858,19 @@ function parseSetSentinelInstruction(instruction) {
2860
2858
  accountIndex += 1;
2861
2859
  return accountMeta;
2862
2860
  };
2863
- return {
2864
- programAddress: instruction.programAddress,
2865
- accounts: {
2866
- config: getNextAccount(),
2867
- pool: getNextAccount(),
2868
- admin: getNextAccount()
2869
- },
2870
- data: getSetSentinelInstructionDataDecoder().decode(instruction.data)
2871
- };
2872
- }
2873
- var SKIM_DISCRIMINATOR = new Uint8Array([
2874
- 238,
2875
- 120,
2876
- 221,
2877
- 138,
2878
- 82,
2879
- 60,
2880
- 100,
2881
- 218
2882
- ]);
2883
- function getSkimDiscriminatorBytes() {
2884
- return fixEncoderSize(getBytesEncoder(), 8).encode(SKIM_DISCRIMINATOR);
2885
- }
2886
- function getSkimInstructionDataEncoder() {
2887
- return transformEncoder(
2888
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
2889
- (value) => ({ ...value, discriminator: SKIM_DISCRIMINATOR })
2890
- );
2891
- }
2892
- function getSkimInstructionDataDecoder() {
2893
- return getStructDecoder([
2894
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
2895
- ]);
2896
- }
2897
- function getSkimInstructionDataCodec() {
2898
- return combineCodec(
2899
- getSkimInstructionDataEncoder(),
2900
- getSkimInstructionDataDecoder()
2901
- );
2902
- }
2903
- async function getSkimInstructionAsync(input, config) {
2904
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2905
- const originalAccounts = {
2906
- config: { value: input.config ?? null, isWritable: false },
2907
- pool: { value: input.pool ?? null, isWritable: false },
2908
- admin: { value: input.admin ?? null, isWritable: false },
2909
- authority: { value: input.authority ?? null, isWritable: false },
2910
- vault0: { value: input.vault0 ?? null, isWritable: true },
2911
- vault1: { value: input.vault1 ?? null, isWritable: true },
2912
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2913
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2914
- adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
2915
- adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
2916
- token0Program: { value: input.token0Program ?? null, isWritable: false },
2917
- token1Program: { value: input.token1Program ?? null, isWritable: false }
2918
- };
2919
- const accounts = originalAccounts;
2920
- if (!accounts.authority.value) {
2921
- accounts.authority.value = await getProgramDerivedAddress({
2922
- programAddress,
2923
- seeds: [
2924
- getBytesEncoder().encode(
2925
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2926
- ),
2927
- getAddressEncoder().encode(
2928
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2929
- )
2930
- ]
2931
- });
2932
- }
2933
- if (!accounts.adminAta0.value) {
2934
- accounts.adminAta0.value = await getProgramDerivedAddress({
2935
- programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2936
- seeds: [
2937
- getAddressEncoder().encode(
2938
- getAddressFromResolvedInstructionAccount(
2939
- "admin",
2940
- accounts.admin.value
2941
- )
2942
- ),
2943
- getAddressEncoder().encode(
2944
- getAddressFromResolvedInstructionAccount(
2945
- "token0Program",
2946
- accounts.token0Program.value
2947
- )
2948
- ),
2949
- getAddressEncoder().encode(
2950
- getAddressFromResolvedInstructionAccount(
2951
- "token0Mint",
2952
- accounts.token0Mint.value
2953
- )
2954
- )
2955
- ]
2956
- });
2957
- }
2958
- if (!accounts.adminAta1.value) {
2959
- accounts.adminAta1.value = await getProgramDerivedAddress({
2960
- programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2961
- seeds: [
2962
- getAddressEncoder().encode(
2963
- getAddressFromResolvedInstructionAccount(
2964
- "admin",
2965
- accounts.admin.value
2966
- )
2967
- ),
2968
- getAddressEncoder().encode(
2969
- getAddressFromResolvedInstructionAccount(
2970
- "token1Program",
2971
- accounts.token1Program.value
2972
- )
2973
- ),
2974
- getAddressEncoder().encode(
2975
- getAddressFromResolvedInstructionAccount(
2976
- "token1Mint",
2977
- accounts.token1Mint.value
2978
- )
2979
- )
2980
- ]
2981
- });
2982
- }
2983
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2984
- return Object.freeze({
2985
- accounts: [
2986
- getAccountMeta("config", accounts.config),
2987
- getAccountMeta("pool", accounts.pool),
2988
- getAccountMeta("admin", accounts.admin),
2989
- getAccountMeta("authority", accounts.authority),
2990
- getAccountMeta("vault0", accounts.vault0),
2991
- getAccountMeta("vault1", accounts.vault1),
2992
- getAccountMeta("token0Mint", accounts.token0Mint),
2993
- getAccountMeta("token1Mint", accounts.token1Mint),
2994
- getAccountMeta("adminAta0", accounts.adminAta0),
2995
- getAccountMeta("adminAta1", accounts.adminAta1),
2996
- getAccountMeta("token0Program", accounts.token0Program),
2997
- getAccountMeta("token1Program", accounts.token1Program)
2998
- ],
2999
- data: getSkimInstructionDataEncoder().encode({}),
3000
- programAddress
3001
- });
3002
- }
3003
- function getSkimInstruction(input, config) {
3004
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3005
- const originalAccounts = {
3006
- config: { value: input.config ?? null, isWritable: false },
3007
- pool: { value: input.pool ?? null, isWritable: false },
3008
- admin: { value: input.admin ?? null, isWritable: false },
3009
- authority: { value: input.authority ?? null, isWritable: false },
3010
- vault0: { value: input.vault0 ?? null, isWritable: true },
3011
- vault1: { value: input.vault1 ?? null, isWritable: true },
3012
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3013
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3014
- adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
3015
- adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
3016
- token0Program: { value: input.token0Program ?? null, isWritable: false },
3017
- token1Program: { value: input.token1Program ?? null, isWritable: false }
3018
- };
3019
- const accounts = originalAccounts;
3020
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3021
- return Object.freeze({
3022
- accounts: [
3023
- getAccountMeta("config", accounts.config),
3024
- getAccountMeta("pool", accounts.pool),
3025
- getAccountMeta("admin", accounts.admin),
3026
- getAccountMeta("authority", accounts.authority),
3027
- getAccountMeta("vault0", accounts.vault0),
3028
- getAccountMeta("vault1", accounts.vault1),
3029
- getAccountMeta("token0Mint", accounts.token0Mint),
3030
- getAccountMeta("token1Mint", accounts.token1Mint),
3031
- getAccountMeta("adminAta0", accounts.adminAta0),
3032
- getAccountMeta("adminAta1", accounts.adminAta1),
3033
- getAccountMeta("token0Program", accounts.token0Program),
3034
- getAccountMeta("token1Program", accounts.token1Program)
3035
- ],
3036
- data: getSkimInstructionDataEncoder().encode({}),
3037
- programAddress
3038
- });
3039
- }
3040
- function parseSkimInstruction(instruction) {
3041
- if (instruction.accounts.length < 12) {
3042
- throw new SolanaError(
3043
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3044
- {
3045
- actualAccountMetas: instruction.accounts.length,
3046
- expectedAccountMetas: 12
3047
- }
3048
- );
3049
- }
3050
- let accountIndex = 0;
3051
- const getNextAccount = () => {
3052
- const accountMeta = instruction.accounts[accountIndex];
3053
- accountIndex += 1;
3054
- return accountMeta;
2861
+ const getNextOptionalAccount = () => {
2862
+ const accountMeta = getNextAccount();
2863
+ return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
3055
2864
  };
3056
2865
  return {
3057
2866
  programAddress: instruction.programAddress,
3058
2867
  accounts: {
3059
2868
  config: getNextAccount(),
3060
2869
  pool: getNextAccount(),
3061
- admin: getNextAccount(),
3062
- authority: getNextAccount(),
3063
- vault0: getNextAccount(),
3064
- vault1: getNextAccount(),
3065
- token0Mint: getNextAccount(),
3066
- token1Mint: getNextAccount(),
3067
- adminAta0: getNextAccount(),
3068
- adminAta1: getNextAccount(),
3069
- token0Program: getNextAccount(),
3070
- token1Program: getNextAccount()
2870
+ nextPool: getNextOptionalAccount(),
2871
+ admin: getNextAccount()
3071
2872
  },
3072
- data: getSkimInstructionDataDecoder().decode(instruction.data)
2873
+ data: getSetRouteInstructionDataDecoder().decode(instruction.data)
3073
2874
  };
3074
2875
  }
3075
2876
  var SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
@@ -3093,7 +2894,7 @@ function getSwapExactInInstructionDataEncoder() {
3093
2894
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
3094
2895
  ["amountIn", getU64Encoder()],
3095
2896
  ["minAmountOut", getU64Encoder()],
3096
- ["direction", getU8Encoder()],
2897
+ ["tradeDirection", getU8Encoder()],
3097
2898
  ["updateOracle", getBooleanEncoder()]
3098
2899
  ]),
3099
2900
  (value) => ({ ...value, discriminator: SWAP_EXACT_IN_DISCRIMINATOR })
@@ -3104,7 +2905,7 @@ function getSwapExactInInstructionDataDecoder() {
3104
2905
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
3105
2906
  ["amountIn", getU64Decoder()],
3106
2907
  ["minAmountOut", getU64Decoder()],
3107
- ["direction", getU8Decoder()],
2908
+ ["tradeDirection", getU8Decoder()],
3108
2909
  ["updateOracle", getBooleanDecoder()]
3109
2910
  ]);
3110
2911
  }
@@ -3423,7 +3224,7 @@ function getUpdateConfigInstructionDataEncoder() {
3423
3224
  ["maxRouteHops", getU8Encoder()],
3424
3225
  ["protocolFeeEnabled", getBooleanEncoder()],
3425
3226
  ["protocolFeeBps", getU16Encoder()],
3426
- ["sentinelAllowlist", getArrayEncoder(getAddressEncoder())]
3227
+ ["hookAllowlist", getArrayEncoder(getAddressEncoder())]
3427
3228
  ]),
3428
3229
  (value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR })
3429
3230
  );
@@ -3437,7 +3238,7 @@ function getUpdateConfigInstructionDataDecoder() {
3437
3238
  ["maxRouteHops", getU8Decoder()],
3438
3239
  ["protocolFeeEnabled", getBooleanDecoder()],
3439
3240
  ["protocolFeeBps", getU16Decoder()],
3440
- ["sentinelAllowlist", getArrayDecoder(getAddressDecoder())]
3241
+ ["hookAllowlist", getArrayDecoder(getAddressDecoder())]
3441
3242
  ]);
3442
3243
  }
3443
3244
  function getUpdateConfigInstructionDataCodec() {
@@ -3446,33 +3247,227 @@ function getUpdateConfigInstructionDataCodec() {
3446
3247
  getUpdateConfigInstructionDataDecoder()
3447
3248
  );
3448
3249
  }
3449
- function getUpdateConfigInstruction(input, config) {
3250
+ function getUpdateConfigInstruction(input, config) {
3251
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3252
+ const originalAccounts = {
3253
+ config: { value: input.config ?? null, isWritable: true },
3254
+ admin: { value: input.admin ?? null, isWritable: false }
3255
+ };
3256
+ const accounts = originalAccounts;
3257
+ const args = { ...input };
3258
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3259
+ return Object.freeze({
3260
+ accounts: [
3261
+ getAccountMeta("config", accounts.config),
3262
+ getAccountMeta("admin", accounts.admin)
3263
+ ],
3264
+ data: getUpdateConfigInstructionDataEncoder().encode(
3265
+ args
3266
+ ),
3267
+ programAddress
3268
+ });
3269
+ }
3270
+ function parseUpdateConfigInstruction(instruction) {
3271
+ if (instruction.accounts.length < 2) {
3272
+ throw new SolanaError(
3273
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3274
+ {
3275
+ actualAccountMetas: instruction.accounts.length,
3276
+ expectedAccountMetas: 2
3277
+ }
3278
+ );
3279
+ }
3280
+ let accountIndex = 0;
3281
+ const getNextAccount = () => {
3282
+ const accountMeta = instruction.accounts[accountIndex];
3283
+ accountIndex += 1;
3284
+ return accountMeta;
3285
+ };
3286
+ return {
3287
+ programAddress: instruction.programAddress,
3288
+ accounts: { config: getNextAccount(), admin: getNextAccount() },
3289
+ data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
3290
+ };
3291
+ }
3292
+ var WITHDRAW_VAULT_EXCESS_DISCRIMINATOR = new Uint8Array([
3293
+ 235,
3294
+ 197,
3295
+ 247,
3296
+ 177,
3297
+ 137,
3298
+ 72,
3299
+ 135,
3300
+ 113
3301
+ ]);
3302
+ function getWithdrawVaultExcessDiscriminatorBytes() {
3303
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
3304
+ WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
3305
+ );
3306
+ }
3307
+ function getWithdrawVaultExcessInstructionDataEncoder() {
3308
+ return transformEncoder(
3309
+ getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
3310
+ (value) => ({
3311
+ ...value,
3312
+ discriminator: WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
3313
+ })
3314
+ );
3315
+ }
3316
+ function getWithdrawVaultExcessInstructionDataDecoder() {
3317
+ return getStructDecoder([
3318
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
3319
+ ]);
3320
+ }
3321
+ function getWithdrawVaultExcessInstructionDataCodec() {
3322
+ return combineCodec(
3323
+ getWithdrawVaultExcessInstructionDataEncoder(),
3324
+ getWithdrawVaultExcessInstructionDataDecoder()
3325
+ );
3326
+ }
3327
+ async function getWithdrawVaultExcessInstructionAsync(input, config) {
3328
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3329
+ const originalAccounts = {
3330
+ config: { value: input.config ?? null, isWritable: false },
3331
+ pool: { value: input.pool ?? null, isWritable: false },
3332
+ admin: { value: input.admin ?? null, isWritable: false },
3333
+ authority: { value: input.authority ?? null, isWritable: false },
3334
+ vault0: { value: input.vault0 ?? null, isWritable: true },
3335
+ vault1: { value: input.vault1 ?? null, isWritable: true },
3336
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3337
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3338
+ adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
3339
+ adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
3340
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
3341
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
3342
+ };
3343
+ const accounts = originalAccounts;
3344
+ if (!accounts.authority.value) {
3345
+ accounts.authority.value = await getProgramDerivedAddress({
3346
+ programAddress,
3347
+ seeds: [
3348
+ getBytesEncoder().encode(
3349
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
3350
+ ),
3351
+ getAddressEncoder().encode(
3352
+ getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
3353
+ )
3354
+ ]
3355
+ });
3356
+ }
3357
+ if (!accounts.adminAta0.value) {
3358
+ accounts.adminAta0.value = await getProgramDerivedAddress({
3359
+ programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
3360
+ seeds: [
3361
+ getAddressEncoder().encode(
3362
+ getAddressFromResolvedInstructionAccount(
3363
+ "admin",
3364
+ accounts.admin.value
3365
+ )
3366
+ ),
3367
+ getAddressEncoder().encode(
3368
+ getAddressFromResolvedInstructionAccount(
3369
+ "token0Program",
3370
+ accounts.token0Program.value
3371
+ )
3372
+ ),
3373
+ getAddressEncoder().encode(
3374
+ getAddressFromResolvedInstructionAccount(
3375
+ "token0Mint",
3376
+ accounts.token0Mint.value
3377
+ )
3378
+ )
3379
+ ]
3380
+ });
3381
+ }
3382
+ if (!accounts.adminAta1.value) {
3383
+ accounts.adminAta1.value = await getProgramDerivedAddress({
3384
+ programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
3385
+ seeds: [
3386
+ getAddressEncoder().encode(
3387
+ getAddressFromResolvedInstructionAccount(
3388
+ "admin",
3389
+ accounts.admin.value
3390
+ )
3391
+ ),
3392
+ getAddressEncoder().encode(
3393
+ getAddressFromResolvedInstructionAccount(
3394
+ "token1Program",
3395
+ accounts.token1Program.value
3396
+ )
3397
+ ),
3398
+ getAddressEncoder().encode(
3399
+ getAddressFromResolvedInstructionAccount(
3400
+ "token1Mint",
3401
+ accounts.token1Mint.value
3402
+ )
3403
+ )
3404
+ ]
3405
+ });
3406
+ }
3407
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3408
+ return Object.freeze({
3409
+ accounts: [
3410
+ getAccountMeta("config", accounts.config),
3411
+ getAccountMeta("pool", accounts.pool),
3412
+ getAccountMeta("admin", accounts.admin),
3413
+ getAccountMeta("authority", accounts.authority),
3414
+ getAccountMeta("vault0", accounts.vault0),
3415
+ getAccountMeta("vault1", accounts.vault1),
3416
+ getAccountMeta("token0Mint", accounts.token0Mint),
3417
+ getAccountMeta("token1Mint", accounts.token1Mint),
3418
+ getAccountMeta("adminAta0", accounts.adminAta0),
3419
+ getAccountMeta("adminAta1", accounts.adminAta1),
3420
+ getAccountMeta("token0Program", accounts.token0Program),
3421
+ getAccountMeta("token1Program", accounts.token1Program)
3422
+ ],
3423
+ data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
3424
+ programAddress
3425
+ });
3426
+ }
3427
+ function getWithdrawVaultExcessInstruction(input, config) {
3450
3428
  const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3451
3429
  const originalAccounts = {
3452
- config: { value: input.config ?? null, isWritable: true },
3453
- admin: { value: input.admin ?? null, isWritable: false }
3430
+ config: { value: input.config ?? null, isWritable: false },
3431
+ pool: { value: input.pool ?? null, isWritable: false },
3432
+ admin: { value: input.admin ?? null, isWritable: false },
3433
+ authority: { value: input.authority ?? null, isWritable: false },
3434
+ vault0: { value: input.vault0 ?? null, isWritable: true },
3435
+ vault1: { value: input.vault1 ?? null, isWritable: true },
3436
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3437
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3438
+ adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
3439
+ adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
3440
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
3441
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
3454
3442
  };
3455
3443
  const accounts = originalAccounts;
3456
- const args = { ...input };
3457
3444
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3458
3445
  return Object.freeze({
3459
3446
  accounts: [
3460
3447
  getAccountMeta("config", accounts.config),
3461
- getAccountMeta("admin", accounts.admin)
3448
+ getAccountMeta("pool", accounts.pool),
3449
+ getAccountMeta("admin", accounts.admin),
3450
+ getAccountMeta("authority", accounts.authority),
3451
+ getAccountMeta("vault0", accounts.vault0),
3452
+ getAccountMeta("vault1", accounts.vault1),
3453
+ getAccountMeta("token0Mint", accounts.token0Mint),
3454
+ getAccountMeta("token1Mint", accounts.token1Mint),
3455
+ getAccountMeta("adminAta0", accounts.adminAta0),
3456
+ getAccountMeta("adminAta1", accounts.adminAta1),
3457
+ getAccountMeta("token0Program", accounts.token0Program),
3458
+ getAccountMeta("token1Program", accounts.token1Program)
3462
3459
  ],
3463
- data: getUpdateConfigInstructionDataEncoder().encode(
3464
- args
3465
- ),
3460
+ data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
3466
3461
  programAddress
3467
3462
  });
3468
3463
  }
3469
- function parseUpdateConfigInstruction(instruction) {
3470
- if (instruction.accounts.length < 2) {
3464
+ function parseWithdrawVaultExcessInstruction(instruction) {
3465
+ if (instruction.accounts.length < 12) {
3471
3466
  throw new SolanaError(
3472
3467
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3473
3468
  {
3474
3469
  actualAccountMetas: instruction.accounts.length,
3475
- expectedAccountMetas: 2
3470
+ expectedAccountMetas: 12
3476
3471
  }
3477
3472
  );
3478
3473
  }
@@ -3484,8 +3479,23 @@ function parseUpdateConfigInstruction(instruction) {
3484
3479
  };
3485
3480
  return {
3486
3481
  programAddress: instruction.programAddress,
3487
- accounts: { config: getNextAccount(), admin: getNextAccount() },
3488
- data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
3482
+ accounts: {
3483
+ config: getNextAccount(),
3484
+ pool: getNextAccount(),
3485
+ admin: getNextAccount(),
3486
+ authority: getNextAccount(),
3487
+ vault0: getNextAccount(),
3488
+ vault1: getNextAccount(),
3489
+ token0Mint: getNextAccount(),
3490
+ token1Mint: getNextAccount(),
3491
+ adminAta0: getNextAccount(),
3492
+ adminAta1: getNextAccount(),
3493
+ token0Program: getNextAccount(),
3494
+ token1Program: getNextAccount()
3495
+ },
3496
+ data: getWithdrawVaultExcessInstructionDataDecoder().decode(
3497
+ instruction.data
3498
+ )
3489
3499
  };
3490
3500
  }
3491
3501
  function isTransactionSigner(value) {
@@ -3518,7 +3528,7 @@ function createSwapInstruction(params) {
3518
3528
  user,
3519
3529
  amountIn,
3520
3530
  minAmountOut,
3521
- direction,
3531
+ tradeDirection,
3522
3532
  oracle,
3523
3533
  remainingAccounts = [],
3524
3534
  updateOracle = false,
@@ -3528,8 +3538,8 @@ function createSwapInstruction(params) {
3528
3538
  programId = CPMM_PROGRAM_ADDRESS
3529
3539
  } = params;
3530
3540
  const trader = typeof user === "string" ? createNoopSigner(user) : user;
3531
- const [vaultIn, vaultOut] = direction === 0 ? [vault0, vault1] : [vault1, vault0];
3532
- const [userIn, userOut] = direction === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
3541
+ const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
3542
+ const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
3533
3543
  const instruction = getSwapExactInInstruction(
3534
3544
  {
3535
3545
  config,
@@ -3547,7 +3557,7 @@ function createSwapInstruction(params) {
3547
3557
  oracle,
3548
3558
  amountIn,
3549
3559
  minAmountOut,
3550
- direction,
3560
+ tradeDirection,
3551
3561
  updateOracle
3552
3562
  },
3553
3563
  { programAddress: programId }
@@ -3595,33 +3605,35 @@ async function fetchConfigWithAddress(rpc, programId = CPMM_PROGRAM_ID, commitme
3595
3605
  var initializer_exports = {};
3596
3606
  __export(initializer_exports, {
3597
3607
  BPF_LOADER_UPGRADEABLE_PROGRAM_ID: () => BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
3598
- CPMM_SENTINEL_PROGRAM_ID: () => CPMM_SENTINEL_PROGRAM_ID,
3608
+ CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
3599
3609
  CURVE_KIND_XYK: () => CURVE_KIND_XYK,
3600
3610
  CURVE_PARAMS_FORMAT_XYK_V0: () => CURVE_PARAMS_FORMAT_XYK_V0,
3601
- DIRECTION_BUY: () => DIRECTION_BUY,
3602
- DIRECTION_SELL: () => DIRECTION_SELL,
3603
- DOPPLER_DEVNET_ALT: () => DOPPLER_DEVNET_ALT,
3611
+ DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND: () => DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND,
3604
3612
  EMPTY_REMAINING_ACCOUNTS_HASH: () => EMPTY_REMAINING_ACCOUNTS_HASH,
3613
+ HF_AFTER_CREATE: () => HF_AFTER_CREATE,
3614
+ HF_AFTER_MIGRATE: () => HF_AFTER_MIGRATE,
3615
+ HF_AFTER_SWAP: () => HF_AFTER_SWAP2,
3616
+ HF_BEFORE_CREATE: () => HF_BEFORE_CREATE,
3617
+ HF_BEFORE_MIGRATE: () => HF_BEFORE_MIGRATE,
3618
+ HF_BEFORE_SWAP: () => HF_BEFORE_SWAP2,
3619
+ HOOK_NO_CHANGE: () => HOOK_NO_CHANGE2,
3605
3620
  INITIALIZER_ACCOUNT_DISCRIMINATORS: () => INITIALIZER_ACCOUNT_DISCRIMINATORS,
3606
3621
  INITIALIZER_INSTRUCTION_DISCRIMINATORS: () => INITIALIZER_INSTRUCTION_DISCRIMINATORS,
3607
3622
  INITIALIZER_PROGRAM_ID: () => INITIALIZER_PROGRAM_ID,
3608
- MAX_CALLDATA: () => MAX_CALLDATA,
3623
+ MAX_HOOK_ALLOWLIST: () => MAX_HOOK_ALLOWLIST2,
3609
3624
  MAX_MIGRATOR_ALLOWLIST: () => MAX_MIGRATOR_ALLOWLIST,
3610
- MAX_SENTINEL_ALLOWLIST: () => MAX_SENTINEL_ALLOWLIST2,
3625
+ MAX_PAYLOAD: () => MAX_PAYLOAD,
3611
3626
  PHASE_ABORTED: () => PHASE_ABORTED,
3612
3627
  PHASE_MIGRATED: () => PHASE_MIGRATED,
3613
3628
  PHASE_TRADING: () => PHASE_TRADING,
3614
- PREDICTION_SENTINEL_PROGRAM_ID: () => PREDICTION_SENTINEL_PROGRAM_ID,
3629
+ PREDICTION_HOOK_PROGRAM_ID: () => PREDICTION_HOOK_PROGRAM_ID,
3615
3630
  SEED_CONFIG: () => SEED_CONFIG2,
3616
3631
  SEED_LAUNCH: () => SEED_LAUNCH,
3617
3632
  SEED_LAUNCH_AUTHORITY: () => SEED_LAUNCH_AUTHORITY,
3618
- SENTINEL_NO_CHANGE: () => SENTINEL_NO_CHANGE2,
3619
- SF_AFTER_CREATE: () => SF_AFTER_CREATE,
3620
- SF_AFTER_MIGRATE: () => SF_AFTER_MIGRATE,
3621
- SF_AFTER_SWAP: () => SF_AFTER_SWAP2,
3622
- SF_BEFORE_CREATE: () => SF_BEFORE_CREATE,
3623
- SF_BEFORE_MIGRATE: () => SF_BEFORE_MIGRATE,
3624
- SF_BEFORE_SWAP: () => SF_BEFORE_SWAP2,
3633
+ TRADE_DIRECTION_BUY: () => TRADE_DIRECTION_BUY,
3634
+ TRADE_DIRECTION_SELL: () => TRADE_DIRECTION_SELL,
3635
+ buildAddressLookupTableSetupInstructions: () => buildAddressLookupTableSetupInstructions,
3636
+ compressTransactionMessageWithLookupTable: () => compressTransactionMessageWithLookupTable,
3625
3637
  computeRemainingAccountsHash: () => computeRemainingAccountsHash,
3626
3638
  createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
3627
3639
  createInitializeConfigInstruction: () => createInitializeConfigInstruction,
@@ -3629,8 +3641,8 @@ __export(initializer_exports, {
3629
3641
  createMigrateLaunchInstruction: () => createMigrateLaunchInstruction,
3630
3642
  createPreviewMigrationInstruction: () => createPreviewMigrationInstruction,
3631
3643
  createPreviewSwapExactInInstruction: () => createPreviewSwapExactInInstruction,
3644
+ createSetHookAllowlistInstruction: () => createSetHookAllowlistInstruction,
3632
3645
  createSetMigratorAllowlistInstruction: () => createSetMigratorAllowlistInstruction,
3633
- createSetSentinelAllowlistInstruction: () => createSetSentinelAllowlistInstruction,
3634
3646
  decodePreviewMigrationResult: () => decodePreviewMigrationResult,
3635
3647
  decodePreviewSwapExactInResult: () => decodePreviewSwapExactInResult,
3636
3648
  encodeU64LE: () => encodeU64LE,
@@ -3647,6 +3659,7 @@ __export(initializer_exports, {
3647
3659
  getInitializeLaunchArgsCodec: () => getInitializeLaunchArgsCodec,
3648
3660
  getInitializeLaunchArgsDecoder: () => getInitializeLaunchArgsDecoder,
3649
3661
  getInitializeLaunchArgsEncoder: () => getInitializeLaunchArgsEncoder,
3662
+ getInstructionLookupTableAddresses: () => getInstructionLookupTableAddresses,
3650
3663
  getLaunchAddress: () => getLaunchAddress,
3651
3664
  getLaunchAuthorityAddress: () => getLaunchAuthorityAddress,
3652
3665
  getLaunchCodec: () => getLaunchCodec,
@@ -3664,10 +3677,10 @@ var INITIALIZER_PROGRAM_ID = address(
3664
3677
  var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = address(
3665
3678
  "BPFLoaderUpgradeab1e11111111111111111111111"
3666
3679
  );
3667
- var CPMM_SENTINEL_PROGRAM_ID = address(
3680
+ var CPMM_HOOK_PROGRAM_ID = address(
3668
3681
  "2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
3669
3682
  );
3670
- var PREDICTION_SENTINEL_PROGRAM_ID = address(
3683
+ var PREDICTION_HOOK_PROGRAM_ID = address(
3671
3684
  "7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
3672
3685
  );
3673
3686
  var SEED_CONFIG2 = "config";
@@ -3707,26 +3720,23 @@ var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
3707
3720
  36,
3708
3721
  76
3709
3722
  ]);
3710
- var DOPPLER_DEVNET_ALT = address(
3711
- "7r5rdLkGMzTq5Q2kBhkePw4ZTeZEooHgTXktYoamNmVq"
3712
- );
3713
3723
  var MAX_MIGRATOR_ALLOWLIST = 32;
3714
- var MAX_SENTINEL_ALLOWLIST2 = 32;
3715
- var MAX_CALLDATA = 256;
3724
+ var MAX_HOOK_ALLOWLIST2 = 32;
3725
+ var MAX_PAYLOAD = 256;
3716
3726
  var PHASE_TRADING = 0;
3717
3727
  var PHASE_MIGRATED = 1;
3718
3728
  var PHASE_ABORTED = 2;
3719
- var DIRECTION_BUY = 0;
3720
- var DIRECTION_SELL = 1;
3729
+ var TRADE_DIRECTION_BUY = 0;
3730
+ var TRADE_DIRECTION_SELL = 1;
3721
3731
  var CURVE_KIND_XYK = 0;
3722
3732
  var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
3723
- var SF_BEFORE_SWAP2 = 1 << 0;
3724
- var SF_AFTER_SWAP2 = 1 << 1;
3725
- var SF_BEFORE_CREATE = 1 << 2;
3726
- var SF_AFTER_CREATE = 1 << 3;
3727
- var SF_BEFORE_MIGRATE = 1 << 4;
3728
- var SF_AFTER_MIGRATE = 1 << 5;
3729
- var SENTINEL_NO_CHANGE2 = 65535;
3733
+ var HF_BEFORE_SWAP2 = 1 << 0;
3734
+ var HF_AFTER_SWAP2 = 1 << 1;
3735
+ var HF_BEFORE_CREATE = 1 << 2;
3736
+ var HF_AFTER_CREATE = 1 << 3;
3737
+ var HF_BEFORE_MIGRATE = 1 << 4;
3738
+ var HF_AFTER_MIGRATE = 1 << 5;
3739
+ var HOOK_NO_CHANGE2 = 65535;
3730
3740
  var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
3731
3741
  // SHA256("global:initialize_config")[0:8]
3732
3742
  initializeConfig: new Uint8Array([
@@ -3750,16 +3760,16 @@ var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
3750
3760
  233,
3751
3761
  168
3752
3762
  ]),
3753
- // SHA256("global:set_sentinel_allowlist")[0:8]
3754
- setSentinelAllowlist: new Uint8Array([
3755
- 233,
3756
- 72,
3757
- 180,
3758
- 246,
3759
- 171,
3760
- 117,
3761
- 21,
3762
- 50
3763
+ // SHA256("global:set_hook_allowlist")[0:8]
3764
+ setHookAllowlist: new Uint8Array([
3765
+ 232,
3766
+ 28,
3767
+ 40,
3768
+ 143,
3769
+ 121,
3770
+ 182,
3771
+ 77,
3772
+ 103
3763
3773
  ]),
3764
3774
  // SHA256("global:initialize_launch")[0:8]
3765
3775
  initializeLaunch: new Uint8Array([
@@ -3840,8 +3850,8 @@ function getInitConfigEncoder() {
3840
3850
  ["admin", getAddressEncoder()],
3841
3851
  ["migratorAllowlistLen", getU8Encoder()],
3842
3852
  ["migratorAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
3843
- ["sentinelAllowlistLen", getU8Encoder()],
3844
- ["sentinelAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
3853
+ ["hookAllowlistLen", getU8Encoder()],
3854
+ ["hookAllowlist", getArrayEncoder(getAddressEncoder(), { size: 32 })],
3845
3855
  ["bump", getU8Encoder()],
3846
3856
  ["version", getU8Encoder()],
3847
3857
  ["reserved", fixEncoderSize(getBytesEncoder(), 31)]
@@ -3855,8 +3865,8 @@ function getInitConfigDecoder() {
3855
3865
  ["admin", getAddressDecoder()],
3856
3866
  ["migratorAllowlistLen", getU8Decoder()],
3857
3867
  ["migratorAllowlist", getArrayDecoder(getAddressDecoder(), { size: 32 })],
3858
- ["sentinelAllowlistLen", getU8Decoder()],
3859
- ["sentinelAllowlist", getArrayDecoder(getAddressDecoder(), { size: 32 })],
3868
+ ["hookAllowlistLen", getU8Decoder()],
3869
+ ["hookAllowlist", getArrayDecoder(getAddressDecoder(), { size: 32 })],
3860
3870
  ["bump", getU8Decoder()],
3861
3871
  ["version", getU8Decoder()],
3862
3872
  ["reserved", fixDecoderSize(getBytesDecoder(), 31)]
@@ -3865,28 +3875,16 @@ function getInitConfigDecoder() {
3865
3875
  function getInitConfigCodec() {
3866
3876
  return combineCodec(getInitConfigEncoder(), getInitConfigDecoder());
3867
3877
  }
3868
- function getCalldataBufEncoder() {
3869
- return getStructEncoder([
3870
- ["len", getU16Encoder()],
3871
- ["bytes", fixEncoderSize(getBytesEncoder(), 256)]
3872
- ]);
3873
- }
3874
- function getCalldataBufDecoder() {
3875
- return getStructDecoder([
3876
- ["len", getU16Decoder()],
3877
- ["bytes", fixDecoderSize(getBytesDecoder(), 256)]
3878
- ]);
3879
- }
3880
3878
  function getInitializeConfigArgsEncoder() {
3881
3879
  return getStructEncoder([
3882
3880
  ["migratorAllowlist", getArrayEncoder(getAddressEncoder())],
3883
- ["sentinelAllowlist", getArrayEncoder(getAddressEncoder())]
3881
+ ["hookAllowlist", getArrayEncoder(getAddressEncoder())]
3884
3882
  ]);
3885
3883
  }
3886
3884
  function getInitializeConfigArgsDecoder() {
3887
3885
  return getStructDecoder([
3888
3886
  ["migratorAllowlist", getArrayDecoder(getAddressDecoder())],
3889
- ["sentinelAllowlist", getArrayDecoder(getAddressDecoder())]
3887
+ ["hookAllowlist", getArrayDecoder(getAddressDecoder())]
3890
3888
  ]);
3891
3889
  }
3892
3890
  function getInitializeConfigArgsCodec() {
@@ -3910,27 +3908,21 @@ function getInitializeLaunchArgsEncoder() {
3910
3908
  ["curveParams", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
3911
3909
  ["allowBuy", getU8Encoder()],
3912
3910
  ["allowSell", getU8Encoder()],
3913
- ["sentinelProgram", getAddressEncoder()],
3914
- ["sentinelFlags", getU32Encoder()],
3915
- [
3916
- "sentinelCalldata",
3917
- addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
3918
- ],
3919
- ["sentinelCreateRemainingAccountsLen", getU32Encoder()],
3911
+ ["hookProgram", getAddressEncoder()],
3912
+ ["hookFlags", getU32Encoder()],
3913
+ ["hookPayload", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
3914
+ ["hookCreateRemainingAccountsLen", getU32Encoder()],
3920
3915
  ["migratorProgram", getAddressEncoder()],
3921
3916
  [
3922
- "migratorInitCalldata",
3917
+ "migratorInitPayload",
3923
3918
  addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
3924
3919
  ],
3925
3920
  [
3926
- "migratorMigrateCalldata",
3921
+ "migratorMigratePayload",
3927
3922
  addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
3928
3923
  ],
3929
- [
3930
- "sentinelCreateRemainingAccountsHash",
3931
- fixEncoderSize(getBytesEncoder(), 32)
3932
- ],
3933
- ["sentinelRemainingAccountsHash", fixEncoderSize(getBytesEncoder(), 32)],
3924
+ ["hookCreateRemainingAccountsHash", fixEncoderSize(getBytesEncoder(), 32)],
3925
+ ["hookRemainingAccountsHash", fixEncoderSize(getBytesEncoder(), 32)],
3934
3926
  [
3935
3927
  "migratorInitRemainingAccountsHash",
3936
3928
  fixEncoderSize(getBytesEncoder(), 32)
@@ -3956,27 +3948,21 @@ function getInitializeLaunchArgsDecoder() {
3956
3948
  ["curveParams", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
3957
3949
  ["allowBuy", getU8Decoder()],
3958
3950
  ["allowSell", getU8Decoder()],
3959
- ["sentinelProgram", getAddressDecoder()],
3960
- ["sentinelFlags", getU32Decoder()],
3961
- [
3962
- "sentinelCalldata",
3963
- addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())
3964
- ],
3965
- ["sentinelCreateRemainingAccountsLen", getU32Decoder()],
3951
+ ["hookProgram", getAddressDecoder()],
3952
+ ["hookFlags", getU32Decoder()],
3953
+ ["hookPayload", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
3954
+ ["hookCreateRemainingAccountsLen", getU32Decoder()],
3966
3955
  ["migratorProgram", getAddressDecoder()],
3967
3956
  [
3968
- "migratorInitCalldata",
3957
+ "migratorInitPayload",
3969
3958
  addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())
3970
3959
  ],
3971
3960
  [
3972
- "migratorMigrateCalldata",
3961
+ "migratorMigratePayload",
3973
3962
  addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())
3974
3963
  ],
3975
- [
3976
- "sentinelCreateRemainingAccountsHash",
3977
- fixDecoderSize(getBytesDecoder(), 32)
3978
- ],
3979
- ["sentinelRemainingAccountsHash", fixDecoderSize(getBytesDecoder(), 32)],
3964
+ ["hookCreateRemainingAccountsHash", fixDecoderSize(getBytesDecoder(), 32)],
3965
+ ["hookRemainingAccountsHash", fixDecoderSize(getBytesDecoder(), 32)],
3980
3966
  [
3981
3967
  "migratorInitRemainingAccountsHash",
3982
3968
  fixDecoderSize(getBytesDecoder(), 32)
@@ -3993,6 +3979,18 @@ function getInitializeLaunchArgsCodec() {
3993
3979
  getInitializeLaunchArgsDecoder()
3994
3980
  );
3995
3981
  }
3982
+ function getPayloadBufEncoder() {
3983
+ return getStructEncoder([
3984
+ ["len", getU16Encoder()],
3985
+ ["bytes", fixEncoderSize(getBytesEncoder(), 256)]
3986
+ ]);
3987
+ }
3988
+ function getPayloadBufDecoder() {
3989
+ return getStructDecoder([
3990
+ ["len", getU16Decoder()],
3991
+ ["bytes", fixDecoderSize(getBytesDecoder(), 256)]
3992
+ ]);
3993
+ }
3996
3994
 
3997
3995
  // src/solana/generated/initializer/accounts/launch.ts
3998
3996
  var LAUNCH_DISCRIMINATOR = new Uint8Array([
@@ -4031,17 +4029,17 @@ function getLaunchEncoder() {
4031
4029
  ["allowBuy", getU8Encoder()],
4032
4030
  ["allowSell", getU8Encoder()],
4033
4031
  ["pad2", fixEncoderSize(getBytesEncoder(), 6)],
4034
- ["sentinelProgram", getAddressEncoder()],
4035
- ["sentinelFlags", getU32Encoder()],
4032
+ ["hookProgram", getAddressEncoder()],
4033
+ ["hookFlags", getU32Encoder()],
4036
4034
  ["pad3", fixEncoderSize(getBytesEncoder(), 4)],
4037
- ["sentinelCalldata", getCalldataBufEncoder()],
4035
+ ["hookPayload", getPayloadBufEncoder()],
4038
4036
  ["migratorProgram", getAddressEncoder()],
4039
- ["migratorInitCalldata", getCalldataBufEncoder()],
4040
- ["migratorMigrateCalldata", getCalldataBufEncoder()],
4037
+ ["migratorInitPayload", getPayloadBufEncoder()],
4038
+ ["migratorMigratePayload", getPayloadBufEncoder()],
4041
4039
  ["curveKind", getU8Encoder()],
4042
4040
  ["swapLock", getU8Encoder()],
4043
4041
  ["pad4", fixEncoderSize(getBytesEncoder(), 6)],
4044
- ["curveParams", getCalldataBufEncoder()],
4042
+ ["curveParams", getPayloadBufEncoder()],
4045
4043
  ["quoteDeposited", getU64Encoder()],
4046
4044
  ["reserved", fixEncoderSize(getBytesEncoder(), 64)]
4047
4045
  ]),
@@ -4073,17 +4071,17 @@ function getLaunchDecoder() {
4073
4071
  ["allowBuy", getU8Decoder()],
4074
4072
  ["allowSell", getU8Decoder()],
4075
4073
  ["pad2", fixDecoderSize(getBytesDecoder(), 6)],
4076
- ["sentinelProgram", getAddressDecoder()],
4077
- ["sentinelFlags", getU32Decoder()],
4074
+ ["hookProgram", getAddressDecoder()],
4075
+ ["hookFlags", getU32Decoder()],
4078
4076
  ["pad3", fixDecoderSize(getBytesDecoder(), 4)],
4079
- ["sentinelCalldata", getCalldataBufDecoder()],
4077
+ ["hookPayload", getPayloadBufDecoder()],
4080
4078
  ["migratorProgram", getAddressDecoder()],
4081
- ["migratorInitCalldata", getCalldataBufDecoder()],
4082
- ["migratorMigrateCalldata", getCalldataBufDecoder()],
4079
+ ["migratorInitPayload", getPayloadBufDecoder()],
4080
+ ["migratorMigratePayload", getPayloadBufDecoder()],
4083
4081
  ["curveKind", getU8Decoder()],
4084
4082
  ["swapLock", getU8Decoder()],
4085
4083
  ["pad4", fixDecoderSize(getBytesDecoder(), 6)],
4086
- ["curveParams", getCalldataBufDecoder()],
4084
+ ["curveParams", getPayloadBufDecoder()],
4087
4085
  ["quoteDeposited", getU64Decoder()],
4088
4086
  ["reserved", fixDecoderSize(getBytesDecoder(), 64)]
4089
4087
  ]);
@@ -4107,7 +4105,7 @@ function getCurveSwapExactInInstructionDataEncoder() {
4107
4105
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
4108
4106
  ["amountIn", getU64Encoder()],
4109
4107
  ["minAmountOut", getU64Encoder()],
4110
- ["direction", getU8Encoder()]
4108
+ ["tradeDirection", getU8Encoder()]
4111
4109
  ]),
4112
4110
  (value) => ({ ...value, discriminator: CURVE_SWAP_EXACT_IN_DISCRIMINATOR })
4113
4111
  );
@@ -4127,7 +4125,7 @@ function getInitializeConfigInstructionDataEncoder2() {
4127
4125
  getStructEncoder([
4128
4126
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
4129
4127
  ["migratorAllowlist", getArrayEncoder(getAddressEncoder())],
4130
- ["sentinelAllowlist", getArrayEncoder(getAddressEncoder())]
4128
+ ["hookAllowlist", getArrayEncoder(getAddressEncoder())]
4131
4129
  ]),
4132
4130
  (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR2 })
4133
4131
  );
@@ -4159,27 +4157,24 @@ function getInitializeLaunchInstructionDataEncoder() {
4159
4157
  ["curveParams", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
4160
4158
  ["allowBuy", getU8Encoder()],
4161
4159
  ["allowSell", getU8Encoder()],
4162
- ["sentinelProgram", getAddressEncoder()],
4163
- ["sentinelFlags", getU32Encoder()],
4164
- [
4165
- "sentinelCalldata",
4166
- addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
4167
- ],
4168
- ["sentinelCreateRemainingAccountsLen", getU32Encoder()],
4160
+ ["hookProgram", getAddressEncoder()],
4161
+ ["hookFlags", getU32Encoder()],
4162
+ ["hookPayload", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
4163
+ ["hookCreateRemainingAccountsLen", getU32Encoder()],
4169
4164
  ["migratorProgram", getAddressEncoder()],
4170
4165
  [
4171
- "migratorInitCalldata",
4166
+ "migratorInitPayload",
4172
4167
  addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
4173
4168
  ],
4174
4169
  [
4175
- "migratorMigrateCalldata",
4170
+ "migratorMigratePayload",
4176
4171
  addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
4177
4172
  ],
4178
4173
  [
4179
- "sentinelCreateRemainingAccountsHash",
4174
+ "hookCreateRemainingAccountsHash",
4180
4175
  fixEncoderSize(getBytesEncoder(), 32)
4181
4176
  ],
4182
- ["sentinelRemainingAccountsHash", fixEncoderSize(getBytesEncoder(), 32)],
4177
+ ["hookRemainingAccountsHash", fixEncoderSize(getBytesEncoder(), 32)],
4183
4178
  [
4184
4179
  "migratorInitRemainingAccountsHash",
4185
4180
  fixEncoderSize(getBytesEncoder(), 32)
@@ -4210,7 +4205,7 @@ function getPreviewSwapExactInInstructionDataEncoder2() {
4210
4205
  getStructEncoder([
4211
4206
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
4212
4207
  ["amountIn", getU64Encoder()],
4213
- ["direction", getU8Encoder()]
4208
+ ["tradeDirection", getU8Encoder()]
4214
4209
  ]),
4215
4210
  (value) => ({
4216
4211
  ...value,
@@ -4218,6 +4213,25 @@ function getPreviewSwapExactInInstructionDataEncoder2() {
4218
4213
  })
4219
4214
  );
4220
4215
  }
4216
+ var SET_HOOK_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
4217
+ 232,
4218
+ 28,
4219
+ 40,
4220
+ 143,
4221
+ 121,
4222
+ 182,
4223
+ 77,
4224
+ 103
4225
+ ]);
4226
+ function getSetHookAllowlistInstructionDataEncoder() {
4227
+ return transformEncoder(
4228
+ getStructEncoder([
4229
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
4230
+ ["allowlist", getArrayEncoder(getAddressEncoder())]
4231
+ ]),
4232
+ (value) => ({ ...value, discriminator: SET_HOOK_ALLOWLIST_DISCRIMINATOR })
4233
+ );
4234
+ }
4221
4235
  var SET_MIGRATOR_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
4222
4236
  209,
4223
4237
  90,
@@ -4240,28 +4254,6 @@ function getSetMigratorAllowlistInstructionDataEncoder() {
4240
4254
  })
4241
4255
  );
4242
4256
  }
4243
- var SET_SENTINEL_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
4244
- 233,
4245
- 72,
4246
- 180,
4247
- 246,
4248
- 171,
4249
- 117,
4250
- 21,
4251
- 50
4252
- ]);
4253
- function getSetSentinelAllowlistInstructionDataEncoder() {
4254
- return transformEncoder(
4255
- getStructEncoder([
4256
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
4257
- ["allowlist", getArrayEncoder(getAddressEncoder())]
4258
- ]),
4259
- (value) => ({
4260
- ...value,
4261
- discriminator: SET_SENTINEL_ALLOWLIST_DISCRIMINATOR
4262
- })
4263
- );
4264
- }
4265
4257
  if (process.env.NODE_ENV !== "production") ;
4266
4258
  var addressCodec2 = getAddressCodec();
4267
4259
  var textEncoder2 = new TextEncoder();
@@ -4366,14 +4358,14 @@ function createSignerAccountMeta3(value, role) {
4366
4358
  }
4367
4359
  return { address: value, role };
4368
4360
  }
4369
- function createSetSentinelAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
4361
+ function createSetHookAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
4370
4362
  const { admin, config } = accounts;
4371
4363
  const keys = [
4372
4364
  createSignerAccountMeta3(admin, AccountRole.WRITABLE_SIGNER),
4373
4365
  { address: config, role: AccountRole.WRITABLE }
4374
4366
  ];
4375
4367
  const data = new Uint8Array(
4376
- getSetSentinelAllowlistInstructionDataEncoder().encode({ allowlist })
4368
+ getSetHookAllowlistInstructionDataEncoder().encode({ allowlist })
4377
4369
  );
4378
4370
  return { programAddress: programId, accounts: keys, data };
4379
4371
  }
@@ -4674,21 +4666,6 @@ function getAccumulatorUpdatedCodec() {
4674
4666
  getAccumulatorUpdatedDecoder()
4675
4667
  );
4676
4668
  }
4677
- function getCalldataBufEncoder2() {
4678
- return getStructEncoder([
4679
- ["len", getU16Encoder()],
4680
- ["bytes", fixEncoderSize(getBytesEncoder(), 256)]
4681
- ]);
4682
- }
4683
- function getCalldataBufDecoder2() {
4684
- return getStructDecoder([
4685
- ["len", getU16Decoder()],
4686
- ["bytes", fixDecoderSize(getBytesDecoder(), 256)]
4687
- ]);
4688
- }
4689
- function getCalldataBufCodec() {
4690
- return combineCodec(getCalldataBufEncoder2(), getCalldataBufDecoder2());
4691
- }
4692
4669
  function getEntryMigratedEncoder() {
4693
4670
  return getStructEncoder([
4694
4671
  ["market", getAddressEncoder()],
@@ -4781,6 +4758,21 @@ function getMigrateEntryArgsCodec() {
4781
4758
  getMigrateEntryArgsDecoder()
4782
4759
  );
4783
4760
  }
4761
+ function getPayloadBufEncoder2() {
4762
+ return getStructEncoder([
4763
+ ["len", getU16Encoder()],
4764
+ ["bytes", fixEncoderSize(getBytesEncoder(), 256)]
4765
+ ]);
4766
+ }
4767
+ function getPayloadBufDecoder2() {
4768
+ return getStructDecoder([
4769
+ ["len", getU16Decoder()],
4770
+ ["bytes", fixDecoderSize(getBytesDecoder(), 256)]
4771
+ ]);
4772
+ }
4773
+ function getPayloadBufCodec() {
4774
+ return combineCodec(getPayloadBufEncoder2(), getPayloadBufDecoder2());
4775
+ }
4784
4776
  function getPreviewPayoutIfWinnerArgsEncoder() {
4785
4777
  return getStructEncoder([
4786
4778
  ["candidateWinnerMint", getAddressEncoder()],
@@ -4873,17 +4865,17 @@ function getLaunchEncoder2() {
4873
4865
  ["allowBuy", getU8Encoder()],
4874
4866
  ["allowSell", getU8Encoder()],
4875
4867
  ["pad2", fixEncoderSize(getBytesEncoder(), 6)],
4876
- ["sentinelProgram", getAddressEncoder()],
4877
- ["sentinelFlags", getU32Encoder()],
4868
+ ["hookProgram", getAddressEncoder()],
4869
+ ["hookFlags", getU32Encoder()],
4878
4870
  ["pad3", fixEncoderSize(getBytesEncoder(), 4)],
4879
- ["sentinelCalldata", getCalldataBufEncoder2()],
4871
+ ["hookPayload", getPayloadBufEncoder2()],
4880
4872
  ["migratorProgram", getAddressEncoder()],
4881
- ["migratorInitCalldata", getCalldataBufEncoder2()],
4882
- ["migratorMigrateCalldata", getCalldataBufEncoder2()],
4873
+ ["migratorInitPayload", getPayloadBufEncoder2()],
4874
+ ["migratorMigratePayload", getPayloadBufEncoder2()],
4883
4875
  ["curveKind", getU8Encoder()],
4884
4876
  ["swapLock", getU8Encoder()],
4885
4877
  ["pad4", fixEncoderSize(getBytesEncoder(), 6)],
4886
- ["curveParams", getCalldataBufEncoder2()],
4878
+ ["curveParams", getPayloadBufEncoder2()],
4887
4879
  ["quoteDeposited", getU64Encoder()],
4888
4880
  ["reserved", fixEncoderSize(getBytesEncoder(), 64)]
4889
4881
  ]),
@@ -4915,17 +4907,17 @@ function getLaunchDecoder2() {
4915
4907
  ["allowBuy", getU8Decoder()],
4916
4908
  ["allowSell", getU8Decoder()],
4917
4909
  ["pad2", fixDecoderSize(getBytesDecoder(), 6)],
4918
- ["sentinelProgram", getAddressDecoder()],
4919
- ["sentinelFlags", getU32Decoder()],
4910
+ ["hookProgram", getAddressDecoder()],
4911
+ ["hookFlags", getU32Decoder()],
4920
4912
  ["pad3", fixDecoderSize(getBytesDecoder(), 4)],
4921
- ["sentinelCalldata", getCalldataBufDecoder2()],
4913
+ ["hookPayload", getPayloadBufDecoder2()],
4922
4914
  ["migratorProgram", getAddressDecoder()],
4923
- ["migratorInitCalldata", getCalldataBufDecoder2()],
4924
- ["migratorMigrateCalldata", getCalldataBufDecoder2()],
4915
+ ["migratorInitPayload", getPayloadBufDecoder2()],
4916
+ ["migratorMigratePayload", getPayloadBufDecoder2()],
4925
4917
  ["curveKind", getU8Decoder()],
4926
4918
  ["swapLock", getU8Decoder()],
4927
4919
  ["pad4", fixDecoderSize(getBytesDecoder(), 6)],
4928
- ["curveParams", getCalldataBufDecoder2()],
4920
+ ["curveParams", getPayloadBufDecoder2()],
4929
4921
  ["quoteDeposited", getU64Decoder()],
4930
4922
  ["reserved", fixDecoderSize(getBytesDecoder(), 64)]
4931
4923
  ]);
@@ -6391,17 +6383,6 @@ async function getTokenMetadataAddress(mint) {
6391
6383
  });
6392
6384
  return metadataAddress;
6393
6385
  }
6394
- var ALT_INDEX = {
6395
- [TOKEN_PROGRAM_ADDRESS]: 0,
6396
- [SYSTEM_PROGRAM_ADDRESS]: 1,
6397
- SysvarRent111111111111111111111111111111111: 2,
6398
- [INITIALIZER_PROGRAM_ID]: 3,
6399
- [TOKEN_METADATA_PROGRAM_ID]: 4,
6400
- [CPMM_MIGRATOR_PROGRAM_ID]: 5,
6401
- So11111111111111111111111111111111111111112: 6,
6402
- [PREDICTION_MIGRATOR_PROGRAM_ADDRESS]: 8,
6403
- A9DojSvj32PMTTGctEcWZu9GSKuQVEhPkBXxDxmYu34o: 10
6404
- };
6405
6386
  function validateInitializeLaunchCurveParams(args) {
6406
6387
  if (args.curveKind !== CURVE_KIND_XYK) {
6407
6388
  throw new Error(
@@ -6424,7 +6405,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
6424
6405
  quoteVault,
6425
6406
  payer,
6426
6407
  authority,
6427
- sentinelProgram,
6408
+ hookProgram,
6428
6409
  migratorProgram,
6429
6410
  baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
6430
6411
  quoteTokenProgram = TOKEN_PROGRAM_ADDRESS,
@@ -6432,8 +6413,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
6432
6413
  rent,
6433
6414
  metadataAccount,
6434
6415
  metadataProgram = TOKEN_METADATA_PROGRAM_ID,
6435
- sentinelCreateRemainingAccounts = [],
6436
- addressLookupTable: alt
6416
+ hookCreateRemainingAccounts = []
6437
6417
  } = accounts;
6438
6418
  const withMetadata = Boolean(
6439
6419
  args.metadataName && args.metadataName.length > 0
@@ -6443,80 +6423,75 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
6443
6423
  "metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
6444
6424
  );
6445
6425
  }
6446
- const createHooksEnabled = (args.sentinelFlags & (SF_BEFORE_CREATE | SF_AFTER_CREATE)) !== 0;
6447
- const sentinelCreateRemainingAccountAddresses = sentinelCreateRemainingAccounts.map(
6426
+ const createHooksEnabled = (args.hookFlags & (HF_BEFORE_CREATE | HF_AFTER_CREATE)) !== 0;
6427
+ const hookCreateRemainingAccountAddresses = hookCreateRemainingAccounts.map(
6448
6428
  (account) => isTransactionSigner5(account) ? account.address : account
6449
6429
  );
6450
- const altIndexMap = alt ? ALT_INDEX : {};
6451
- function staticOrLookup(addr, role) {
6452
- if (alt && altIndexMap[addr] !== void 0) {
6453
- return {
6454
- address: addr,
6455
- role,
6456
- lookupTableAddress: alt,
6457
- addressIndex: altIndexMap[addr]
6458
- };
6459
- }
6460
- return { address: addr, role };
6461
- }
6462
6430
  const keys = [
6463
- staticOrLookup(config, AccountRole.READONLY),
6431
+ { address: config, role: AccountRole.READONLY },
6464
6432
  { address: launch, role: AccountRole.WRITABLE },
6465
6433
  { address: launchAuthority, role: AccountRole.READONLY },
6466
6434
  createAccountMeta(baseMint, AccountRole.WRITABLE_SIGNER),
6467
- staticOrLookup(quoteMint, AccountRole.READONLY),
6435
+ { address: quoteMint, role: AccountRole.READONLY },
6468
6436
  createAccountMeta(baseVault, AccountRole.WRITABLE_SIGNER),
6469
6437
  createAccountMeta(quoteVault, AccountRole.WRITABLE_SIGNER),
6470
6438
  createAccountMeta(payer, AccountRole.WRITABLE_SIGNER)
6471
6439
  ];
6472
6440
  keys.push(
6473
- authority ? createAccountMeta(authority, AccountRole.READONLY_SIGNER) : staticOrLookup(programId, AccountRole.READONLY)
6441
+ authority ? createAccountMeta(authority, AccountRole.READONLY_SIGNER) : { address: programId, role: AccountRole.READONLY }
6474
6442
  );
6475
6443
  keys.push(
6476
- sentinelProgram ? staticOrLookup(sentinelProgram, AccountRole.READONLY) : staticOrLookup(programId, AccountRole.READONLY)
6444
+ hookProgram ? { address: hookProgram, role: AccountRole.READONLY } : { address: programId, role: AccountRole.READONLY }
6477
6445
  );
6478
6446
  keys.push(
6479
- migratorProgram ? staticOrLookup(migratorProgram, AccountRole.READONLY) : staticOrLookup(programId, AccountRole.READONLY)
6447
+ migratorProgram ? { address: migratorProgram, role: AccountRole.READONLY } : { address: programId, role: AccountRole.READONLY }
6480
6448
  );
6481
- keys.push(staticOrLookup(baseTokenProgram, AccountRole.READONLY));
6482
- keys.push(staticOrLookup(quoteTokenProgram, AccountRole.READONLY));
6483
- keys.push(staticOrLookup(systemProgram, AccountRole.READONLY));
6484
- keys.push(staticOrLookup(rent, AccountRole.READONLY));
6449
+ keys.push({ address: baseTokenProgram, role: AccountRole.READONLY });
6450
+ keys.push({ address: quoteTokenProgram, role: AccountRole.READONLY });
6451
+ keys.push({ address: systemProgram, role: AccountRole.READONLY });
6452
+ keys.push({ address: rent, role: AccountRole.READONLY });
6485
6453
  if (withMetadata) {
6486
6454
  keys.push({ address: metadataAccount, role: AccountRole.WRITABLE });
6487
- keys.push(staticOrLookup(metadataProgram, AccountRole.READONLY));
6455
+ keys.push({ address: metadataProgram, role: AccountRole.READONLY });
6488
6456
  } else {
6489
- keys.push(staticOrLookup(programId, AccountRole.READONLY));
6490
- keys.push(staticOrLookup(programId, AccountRole.READONLY));
6457
+ keys.push({ address: programId, role: AccountRole.READONLY });
6458
+ keys.push({ address: programId, role: AccountRole.READONLY });
6491
6459
  }
6492
6460
  const encoderArgs = {
6493
6461
  ...args,
6494
6462
  allowBuy: args.allowBuy ? 1 : 0,
6495
6463
  allowSell: args.allowSell ? 1 : 0,
6496
- sentinelProgram: args.sentinelProgram ?? sentinelProgram ?? SYSTEM_PROGRAM_ADDRESS,
6497
- sentinelCreateRemainingAccountsLen: args.sentinelCreateRemainingAccountsLen ?? sentinelCreateRemainingAccounts.length,
6464
+ hookProgram: args.hookProgram ?? hookProgram ?? SYSTEM_PROGRAM_ADDRESS,
6465
+ hookCreateRemainingAccountsLen: args.hookCreateRemainingAccountsLen ?? hookCreateRemainingAccounts.length,
6498
6466
  migratorProgram: migratorProgram ?? SYSTEM_PROGRAM_ADDRESS,
6499
- sentinelCreateRemainingAccountsHash: args.sentinelCreateRemainingAccountsHash ?? (createHooksEnabled ? computeRemainingAccountsHash(sentinelCreateRemainingAccountAddresses) : new Uint8Array(32))
6467
+ hookCreateRemainingAccountsHash: args.hookCreateRemainingAccountsHash ?? (createHooksEnabled ? computeRemainingAccountsHash(hookCreateRemainingAccountAddresses) : new Uint8Array(32))
6500
6468
  };
6501
6469
  const data = new Uint8Array(
6502
6470
  getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
6503
6471
  );
6504
6472
  keys.push(
6505
- ...sentinelCreateRemainingAccounts.map(
6473
+ ...hookCreateRemainingAccounts.map(
6506
6474
  (account) => createAccountMeta(
6507
6475
  account,
6508
6476
  isTransactionSigner5(account) ? AccountRole.READONLY_SIGNER : AccountRole.READONLY
6509
6477
  )
6510
6478
  )
6511
6479
  );
6512
- if (migratorProgram === CPMM_MIGRATOR_PROGRAM_ID) {
6513
- if (!accounts.cpmmConfig) {
6480
+ const shouldAppendCpmmMigratorAccounts = accounts.cpmmConfig !== void 0 || migratorProgram === CPMM_MIGRATOR_PROGRAM_ID;
6481
+ if (shouldAppendCpmmMigratorAccounts) {
6482
+ if (!migratorProgram) {
6514
6483
  throw new Error(
6515
- "cpmmConfig is required when migratorProgram is CPMM_MIGRATOR_PROGRAM_ID"
6484
+ "migratorProgram is required when cpmmConfig is provided"
6516
6485
  );
6517
6486
  }
6518
- const [cpmmMigratorState] = await getCpmmMigratorStateAddress(launch);
6519
- keys.push({ address: cpmmMigratorState, role: AccountRole.WRITABLE });
6487
+ if (!accounts.cpmmConfig) {
6488
+ throw new Error("cpmmConfig is required when using the CPMM migrator");
6489
+ }
6490
+ const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
6491
+ launch,
6492
+ migratorProgram
6493
+ );
6494
+ keys.push({ address: cpmmMigrationState, role: AccountRole.WRITABLE });
6520
6495
  keys.push({ address: accounts.cpmmConfig, role: AccountRole.READONLY });
6521
6496
  }
6522
6497
  if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
@@ -6561,7 +6536,7 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
6561
6536
  baseMint,
6562
6537
  quoteMint,
6563
6538
  user,
6564
- sentinelProgram = SYSTEM_PROGRAM_ADDRESS,
6539
+ hookProgram = SYSTEM_PROGRAM_ADDRESS,
6565
6540
  baseTokenProgram = TOKEN_PROGRAM_ADDRESS,
6566
6541
  quoteTokenProgram = TOKEN_PROGRAM_ADDRESS
6567
6542
  } = accounts;
@@ -6576,10 +6551,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
6576
6551
  { address: baseMint, role: AccountRole.READONLY },
6577
6552
  { address: quoteMint, role: AccountRole.READONLY },
6578
6553
  createAccountMeta2(user, AccountRole.READONLY_SIGNER),
6579
- // sentinel_program is Optional in the on-chain struct but still occupies a fixed
6554
+ // hook_program is Optional in the on-chain struct but still occupies a fixed
6580
6555
  // slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
6581
- // no-op placeholder when no real sentinel is configured.
6582
- { address: sentinelProgram, role: AccountRole.READONLY },
6556
+ // no-op placeholder when no real hook is configured.
6557
+ { address: hookProgram, role: AccountRole.READONLY },
6583
6558
  { address: baseTokenProgram, role: AccountRole.READONLY },
6584
6559
  { address: quoteTokenProgram, role: AccountRole.READONLY }
6585
6560
  ];
@@ -6638,13 +6613,13 @@ var previewSwapExactInResultCodec = getStructCodec([
6638
6613
  ["feePaid", getU64Codec()]
6639
6614
  ]);
6640
6615
  function createPreviewSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
6641
- const { launch, baseVault, quoteVault, sentinelProgram } = accounts;
6616
+ const { launch, baseVault, quoteVault, hookProgram } = accounts;
6642
6617
  const keys = [
6643
6618
  { address: launch, role: AccountRole.READONLY },
6644
6619
  { address: baseVault, role: AccountRole.READONLY },
6645
6620
  { address: quoteVault, role: AccountRole.READONLY }
6646
6621
  ];
6647
- const accountsList = sentinelProgram ? [...keys, { address: sentinelProgram, role: AccountRole.READONLY }] : keys;
6622
+ const accountsList = hookProgram ? [...keys, { address: hookProgram, role: AccountRole.READONLY }] : keys;
6648
6623
  const data = new Uint8Array(
6649
6624
  getPreviewSwapExactInInstructionDataEncoder2().encode(args)
6650
6625
  );
@@ -6674,6 +6649,77 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
6674
6649
  function decodePreviewMigrationResult(data) {
6675
6650
  return previewMigrationResultCodec.decode(data);
6676
6651
  }
6652
+ var DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND = 20;
6653
+ function getInstructionLookupTableAddresses(instructions) {
6654
+ const seen = /* @__PURE__ */ new Set();
6655
+ const addresses = [];
6656
+ for (const instruction of Array.isArray(instructions) ? instructions : [instructions]) {
6657
+ for (const account of instruction.accounts ?? []) {
6658
+ if ("signer" in account || account.role === AccountRole.READONLY_SIGNER || account.role === AccountRole.WRITABLE_SIGNER) {
6659
+ continue;
6660
+ }
6661
+ if (!seen.has(account.address)) {
6662
+ seen.add(account.address);
6663
+ addresses.push(account.address);
6664
+ }
6665
+ }
6666
+ }
6667
+ return addresses;
6668
+ }
6669
+ async function buildAddressLookupTableSetupInstructions({
6670
+ authority,
6671
+ payer,
6672
+ recentSlot,
6673
+ addresses,
6674
+ addressesPerExtendInstruction = DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND
6675
+ }) {
6676
+ if (addressesPerExtendInstruction <= 0) {
6677
+ throw new Error("addressesPerExtendInstruction must be greater than zero");
6678
+ }
6679
+ const dedupedAddresses = [...new Set(addresses)];
6680
+ const lookupTablePda = await findAddressLookupTablePda({
6681
+ authority: authority.address,
6682
+ recentSlot
6683
+ });
6684
+ const [lookupTableAddress] = lookupTablePda;
6685
+ const createInstruction = getCreateLookupTableInstruction({
6686
+ address: lookupTablePda,
6687
+ authority: authority.address,
6688
+ payer,
6689
+ recentSlot
6690
+ });
6691
+ const extendInstructions = [];
6692
+ for (let start = 0; start < dedupedAddresses.length; start += addressesPerExtendInstruction) {
6693
+ extendInstructions.push(
6694
+ getExtendLookupTableInstruction({
6695
+ address: lookupTableAddress,
6696
+ authority,
6697
+ payer,
6698
+ addresses: dedupedAddresses.slice(
6699
+ start,
6700
+ start + addressesPerExtendInstruction
6701
+ )
6702
+ })
6703
+ );
6704
+ }
6705
+ return {
6706
+ lookupTableAddress,
6707
+ createInstruction,
6708
+ extendInstructions,
6709
+ addresses: dedupedAddresses
6710
+ };
6711
+ }
6712
+ function compressTransactionMessageWithLookupTable(transactionMessage, {
6713
+ lookupTableAddress,
6714
+ addresses
6715
+ }) {
6716
+ return compressTransactionMessageUsingAddressLookupTables(
6717
+ transactionMessage,
6718
+ {
6719
+ [lookupTableAddress]: [...addresses]
6720
+ }
6721
+ );
6722
+ }
6677
6723
  var addressCodec5 = getAddressCodec();
6678
6724
  function bytesToBase64(bytes) {
6679
6725
  let binary = "";
@@ -6787,8 +6833,10 @@ __export(cpmmMigrator_exports, {
6787
6833
  MAX_RECIPIENTS: () => MAX_RECIPIENTS,
6788
6834
  SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
6789
6835
  SEED_STATE: () => SEED_STATE,
6790
- encodeMigrateCalldata: () => encodeMigrateCalldata,
6791
- encodeRegisterLaunchCalldata: () => encodeRegisterLaunchCalldata,
6836
+ buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
6837
+ buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
6838
+ encodeMigratePayload: () => encodeMigratePayload,
6839
+ encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
6792
6840
  fetchCpmmMigratorState: () => fetchCpmmMigratorState,
6793
6841
  getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
6794
6842
  getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
@@ -6820,6 +6868,18 @@ function getMigrateArgsDecoder() {
6820
6868
  function getMigrateArgsCodec() {
6821
6869
  return combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
6822
6870
  }
6871
+ function getMigratedPoolHookConfigEncoder() {
6872
+ return getStructEncoder([
6873
+ ["hookProgram", getAddressEncoder()],
6874
+ ["hookFlags", getU32Encoder()]
6875
+ ]);
6876
+ }
6877
+ function getMigratedPoolHookConfigDecoder() {
6878
+ return getStructDecoder([
6879
+ ["hookProgram", getAddressDecoder()],
6880
+ ["hookFlags", getU32Decoder()]
6881
+ ]);
6882
+ }
6823
6883
  function getRecipientEncoder() {
6824
6884
  return getStructEncoder([
6825
6885
  ["wallet", getAddressEncoder()],
@@ -6842,7 +6902,11 @@ function getRegisterLaunchArgsEncoder() {
6842
6902
  ["initialFeeSplitBps", getU16Encoder()],
6843
6903
  ["recipients", getArrayEncoder(getRecipientEncoder())],
6844
6904
  ["minRaiseQuote", getU64Encoder()],
6845
- ["minMigrationPriceQ64Opt", getOptionEncoder(getU128Encoder())]
6905
+ ["minMigrationPriceQ64Opt", getOptionEncoder(getU128Encoder())],
6906
+ [
6907
+ "migratedPoolHookConfig",
6908
+ getOptionEncoder(getMigratedPoolHookConfigEncoder())
6909
+ ]
6846
6910
  ]);
6847
6911
  }
6848
6912
  function getRegisterLaunchArgsDecoder() {
@@ -6852,7 +6916,11 @@ function getRegisterLaunchArgsDecoder() {
6852
6916
  ["initialFeeSplitBps", getU16Decoder()],
6853
6917
  ["recipients", getArrayDecoder(getRecipientDecoder())],
6854
6918
  ["minRaiseQuote", getU64Decoder()],
6855
- ["minMigrationPriceQ64Opt", getOptionDecoder(getU128Decoder())]
6919
+ ["minMigrationPriceQ64Opt", getOptionDecoder(getU128Decoder())],
6920
+ [
6921
+ "migratedPoolHookConfig",
6922
+ getOptionDecoder(getMigratedPoolHookConfigDecoder())
6923
+ ]
6856
6924
  ]);
6857
6925
  }
6858
6926
  function getRegisterLaunchArgsCodec() {
@@ -6883,6 +6951,8 @@ function getCpmmMigratorStateEncoder() {
6883
6951
  ["initialSwapFeeBps", getU16Encoder()],
6884
6952
  ["initialFeeSplitBps", getU16Encoder()],
6885
6953
  ["pad0", fixEncoderSize(getBytesEncoder(), 4)],
6954
+ ["migratedPoolHookProgram", getAddressEncoder()],
6955
+ ["migratedPoolHookFlags", getU32Encoder()],
6886
6956
  ["recipients", getArrayEncoder(getRecipientEncoder(), { size: 2 })],
6887
6957
  ["minRaiseQuote", getU64Encoder()],
6888
6958
  ["minMigrationPriceQ64Opt", getOptionEncoder(getU128Encoder())],
@@ -6902,6 +6972,8 @@ function getCpmmMigratorStateDecoder() {
6902
6972
  ["initialSwapFeeBps", getU16Decoder()],
6903
6973
  ["initialFeeSplitBps", getU16Decoder()],
6904
6974
  ["pad0", fixDecoderSize(getBytesDecoder(), 4)],
6975
+ ["migratedPoolHookProgram", getAddressDecoder()],
6976
+ ["migratedPoolHookFlags", getU32Decoder()],
6905
6977
  ["recipients", getArrayDecoder(getRecipientDecoder(), { size: 2 })],
6906
6978
  ["minRaiseQuote", getU64Decoder()],
6907
6979
  ["minMigrationPriceQ64Opt", getOptionDecoder(getU128Decoder())],
@@ -6934,16 +7006,90 @@ async function fetchCpmmMigratorState(rpc, address3) {
6934
7006
  base64ToBytes3(response.value.data[0])
6935
7007
  );
6936
7008
  }
7009
+ async function buildCpmmMigrationRemainingAccounts({
7010
+ launch,
7011
+ baseMint,
7012
+ quoteMint,
7013
+ launchAuthority,
7014
+ adminBaseAta,
7015
+ adminQuoteAta,
7016
+ recipientAtas,
7017
+ cpmmProgram = CPMM_PROGRAM_ID,
7018
+ cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
7019
+ }) {
7020
+ const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
7021
+ launch,
7022
+ cpmmMigratorProgram
7023
+ );
7024
+ const [migrationAuthority] = await getCpmmMigrationAuthorityAddress(cpmmMigratorProgram);
7025
+ const poolInit = await getPoolInitAddresses(baseMint, quoteMint, cpmmProgram);
7026
+ const pool = poolInit.pool[0];
7027
+ const [launchLpPosition] = await getPositionAddress(
7028
+ pool,
7029
+ launchAuthority,
7030
+ 0n,
7031
+ cpmmProgram
7032
+ );
7033
+ const addresses = [
7034
+ cpmmMigrationState,
7035
+ poolInit.config[0],
7036
+ pool,
7037
+ poolInit.authority[0],
7038
+ poolInit.vault0[0],
7039
+ poolInit.vault1[0],
7040
+ poolInit.protocolFeePosition[0],
7041
+ launchLpPosition,
7042
+ cpmmProgram,
7043
+ migrationAuthority,
7044
+ adminBaseAta,
7045
+ adminQuoteAta,
7046
+ ...recipientAtas
7047
+ ];
7048
+ return {
7049
+ addresses,
7050
+ hash: computeRemainingAccountsHash(addresses),
7051
+ metas: [
7052
+ { address: cpmmMigrationState, role: AccountRole.WRITABLE },
7053
+ { address: poolInit.config[0], role: AccountRole.READONLY },
7054
+ { address: pool, role: AccountRole.WRITABLE },
7055
+ { address: poolInit.authority[0], role: AccountRole.READONLY },
7056
+ { address: poolInit.vault0[0], role: AccountRole.WRITABLE },
7057
+ { address: poolInit.vault1[0], role: AccountRole.WRITABLE },
7058
+ { address: poolInit.protocolFeePosition[0], role: AccountRole.WRITABLE },
7059
+ { address: launchLpPosition, role: AccountRole.WRITABLE },
7060
+ { address: cpmmProgram, role: AccountRole.READONLY },
7061
+ { address: migrationAuthority, role: AccountRole.READONLY },
7062
+ { address: adminBaseAta, role: AccountRole.WRITABLE },
7063
+ { address: adminQuoteAta, role: AccountRole.WRITABLE },
7064
+ ...recipientAtas.map((address3) => ({
7065
+ address: address3,
7066
+ role: AccountRole.WRITABLE
7067
+ }))
7068
+ ],
7069
+ cpmmMigrationState,
7070
+ cpmmConfig: poolInit.config[0],
7071
+ pool,
7072
+ poolAuthority: poolInit.authority[0],
7073
+ poolVault0: poolInit.vault0[0],
7074
+ poolVault1: poolInit.vault1[0],
7075
+ protocolFeePosition: poolInit.protocolFeePosition[0],
7076
+ launchLpPosition,
7077
+ migrationAuthority
7078
+ };
7079
+ }
7080
+ async function buildCpmmMigrationRemainingAccountsHash(input) {
7081
+ return (await buildCpmmMigrationRemainingAccounts(input)).hash;
7082
+ }
6937
7083
 
6938
7084
  // src/solana/migrators/cpmmMigrator/index.ts
6939
- function encodeRegisterLaunchCalldata(args) {
7085
+ function encodeRegisterLaunchPayload(args) {
6940
7086
  const encoded = new Uint8Array(getRegisterLaunchArgsEncoder().encode(args));
6941
7087
  return mergeBytes([
6942
7088
  CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.registerLaunch,
6943
7089
  encoded
6944
7090
  ]);
6945
7091
  }
6946
- function encodeMigrateCalldata(args) {
7092
+ function encodeMigratePayload(args) {
6947
7093
  const encoded = new Uint8Array(getMigrateArgsEncoder().encode(args));
6948
7094
  return mergeBytes([
6949
7095
  CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.migrate,
@@ -7020,9 +7166,6 @@ __export(predictionMigrator_exports, {
7020
7166
  getAccumulatorUpdatedCodec: () => getAccumulatorUpdatedCodec,
7021
7167
  getAccumulatorUpdatedDecoder: () => getAccumulatorUpdatedDecoder,
7022
7168
  getAccumulatorUpdatedEncoder: () => getAccumulatorUpdatedEncoder,
7023
- getCalldataBufCodec: () => getCalldataBufCodec,
7024
- getCalldataBufDecoder: () => getCalldataBufDecoder2,
7025
- getCalldataBufEncoder: () => getCalldataBufEncoder2,
7026
7169
  getClaimDiscriminatorBytes: () => getClaimDiscriminatorBytes,
7027
7170
  getClaimInstruction: () => getClaimInstruction,
7028
7171
  getClaimInstructionAsync: () => getClaimInstructionAsync,
@@ -7080,6 +7223,9 @@ __export(predictionMigrator_exports, {
7080
7223
  getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes,
7081
7224
  getOracleStateEncoder: () => getOracleStateEncoder,
7082
7225
  getOracleStateSize: () => getOracleStateSize,
7226
+ getPayloadBufCodec: () => getPayloadBufCodec,
7227
+ getPayloadBufDecoder: () => getPayloadBufDecoder2,
7228
+ getPayloadBufEncoder: () => getPayloadBufEncoder2,
7083
7229
  getPredictionEntryAddress: () => getPredictionEntryAddress,
7084
7230
  getPredictionEntryByMintAddress: () => getPredictionEntryByMintAddress,
7085
7231
  getPredictionMarketAddress: () => getPredictionMarketAddress,
@@ -7624,6 +7770,25 @@ async function getOracleStateAddress(oracleAuthority, nonce) {
7624
7770
  });
7625
7771
  }
7626
7772
 
7627
- export { cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, initializer_exports as initializer, predictionMigrator_exports as predictionMigrator, trustedOracle_exports as trustedOracle };
7773
+ // src/solana/deployment.ts
7774
+ var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
7775
+ cpmmProgram: CPMM_PROGRAM_ID,
7776
+ initializerProgram: INITIALIZER_PROGRAM_ID,
7777
+ cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
7778
+ cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
7779
+ };
7780
+ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
7781
+ const [cpmmConfig] = await getConfigAddress(programs.cpmmProgram);
7782
+ const [initializerConfig] = await getConfigAddress2(
7783
+ programs.initializerProgram
7784
+ );
7785
+ return {
7786
+ ...programs,
7787
+ cpmmConfig,
7788
+ initializerConfig
7789
+ };
7790
+ }
7791
+
7792
+ export { DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES, cpmm_exports as cpmm, cpmmMigrator_exports as cpmmMigrator, deriveSolanaCpmmDeployment, initializer_exports as initializer, predictionMigrator_exports as predictionMigrator, trustedOracle_exports as trustedOracle };
7628
7793
  //# sourceMappingURL=index.js.map
7629
7794
  //# sourceMappingURL=index.js.map