@whetstone-research/doppler-sdk 1.0.19 → 1.0.21

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 (35) hide show
  1. package/dist/chunk-BESE77DM.js +3840 -0
  2. package/dist/chunk-BESE77DM.js.map +1 -0
  3. package/dist/chunk-KJ6W44WF.cjs +4089 -0
  4. package/dist/chunk-KJ6W44WF.cjs.map +1 -0
  5. package/dist/{chunk-AKLS6T3R.cjs → chunk-Y6TJIH33.cjs} +36 -24
  6. package/dist/chunk-Y6TJIH33.cjs.map +1 -0
  7. package/dist/{chunk-6TOPYGOG.js → chunk-ZUJKBFXW.js} +35 -24
  8. package/dist/chunk-ZUJKBFXW.js.map +1 -0
  9. package/dist/{oracle-7PmpwwPx.d.ts → oracle-D1wPWydZ.d.cts} +1 -33
  10. package/dist/{oracle-7PmpwwPx.d.cts → oracle-D1wPWydZ.d.ts} +1 -33
  11. package/dist/{pda-PZRHQJMK.cjs → pda-A4PIAS5Y.cjs} +20 -16
  12. package/dist/pda-A4PIAS5Y.cjs.map +1 -0
  13. package/dist/{pda-N6ULJYLG.js → pda-JVAD45XJ.js} +3 -3
  14. package/dist/pda-JVAD45XJ.js.map +1 -0
  15. package/dist/solana/index.cjs +427 -3253
  16. package/dist/solana/index.cjs.map +1 -1
  17. package/dist/solana/index.d.cts +211 -213
  18. package/dist/solana/index.d.ts +211 -213
  19. package/dist/solana/index.js +105 -2931
  20. package/dist/solana/index.js.map +1 -1
  21. package/dist/solana/react/index.cjs +53 -85
  22. package/dist/solana/react/index.cjs.map +1 -1
  23. package/dist/solana/react/index.d.cts +7 -1
  24. package/dist/solana/react/index.d.ts +7 -1
  25. package/dist/solana/react/index.js +15 -47
  26. package/dist/solana/react/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/chunk-6TOPYGOG.js.map +0 -1
  29. package/dist/chunk-AKLS6T3R.cjs.map +0 -1
  30. package/dist/chunk-C2D7CIXP.js +0 -977
  31. package/dist/chunk-C2D7CIXP.js.map +0 -1
  32. package/dist/chunk-GUGN3EYX.cjs +0 -1069
  33. package/dist/chunk-GUGN3EYX.cjs.map +0 -1
  34. package/dist/pda-N6ULJYLG.js.map +0 -1
  35. package/dist/pda-PZRHQJMK.cjs.map +0 -1
@@ -1,8 +1,8 @@
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-C2D7CIXP.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-6TOPYGOG.js';
1
+ import { transferAdminArgsCodec, swapExactInArgsCodec, sortPositionsByShares, sortPoolsByReserves, setHookArgsCodec, setFeesArgsCodec, removeLiquidityArgsCodec, ratioToNumber, q64ToNumber, q64Mul, q64Div, positionDataCodec, poolExists, poolDataCodec, parseWithdrawVaultExcessInstruction, parseUpdateConfigInstruction, parseUnpauseInstruction, parseTransferAdminInstruction, parseSwapExactInInstruction, parseSetHookInstruction, parseSetFeesInstruction, parseRemoveLiquidityInstruction, parseRedeemProtocolSharesInstruction, parsePreviewSwapExactInInstruction, parsePauseInstruction, parseOracleUpdateInstruction, parseOracleConsultInstruction, parseInitializePoolInstruction, parseInitializeOracleInstruction, parseInitializeConfigInstruction, parseCreatePositionInstruction, parseCollectProtocolFeesInstruction, parseCollectFeesInstruction, parseClosePositionInstruction, parseAddLiquidityInstruction, oracleStateDataCodec, oracleConsultArgsCodec, observationCodec, numberToQ64, minBigInt, maxBigInt, isqrt, isOracleStale, initializePoolArgsCodec, initializeOracleArgsCodec, initializeConfigArgsCodec, getWithdrawVaultExcessInstructionDataEncoder, getWithdrawVaultExcessInstructionDataDecoder, getWithdrawVaultExcessInstructionDataCodec, getWithdrawVaultExcessInstructionAsync, getWithdrawVaultExcessInstruction, getWithdrawVaultExcessDiscriminatorBytes, getUpdateConfigInstructionDataEncoder, getUpdateConfigInstructionDataDecoder, getUpdateConfigInstructionDataCodec, getUpdateConfigInstruction, getUpdateConfigDiscriminatorBytes, getUnpauseInstructionDataEncoder, getUnpauseInstructionDataDecoder, getUnpauseInstructionDataCodec, getUnpauseInstruction, getUnpauseDiscriminatorBytes, getTvl, getTransferAdminInstructionDataEncoder, getTransferAdminInstructionDataDecoder, getTransferAdminInstructionDataCodec, getTransferAdminInstruction, getTransferAdminDiscriminatorBytes, getSwapQuoteExactOut, getSwapQuote, getSwapExactInInstructionDataEncoder, getSwapExactInInstructionDataDecoder, getSwapExactInInstructionDataCodec, getSwapExactInInstructionAsync, getSwapExactInInstruction, getSwapExactInDiscriminatorBytes, getSpotPrice1, getSpotPrice0, getSetHookInstructionDataEncoder, getSetHookInstructionDataDecoder, getSetHookInstructionDataCodec, getSetHookInstruction, getSetHookDiscriminatorBytes, getSetFeesInstructionDataEncoder, getSetFeesInstructionDataDecoder, getSetFeesInstructionDataCodec, getSetFeesInstruction, getSetFeesDiscriminatorBytes, getRemoveLiquidityQuote, getRemoveLiquidityInstructionDataEncoder, getRemoveLiquidityInstructionDataDecoder, getRemoveLiquidityInstructionDataCodec, getRemoveLiquidityInstructionAsync, getRemoveLiquidityInstruction, getRemoveLiquidityDiscriminatorBytes, getRedeemProtocolSharesInstructionDataEncoder, getRedeemProtocolSharesInstructionDataDecoder, getRedeemProtocolSharesInstructionDataCodec, getRedeemProtocolSharesInstructionAsync, getRedeemProtocolSharesInstruction, getRedeemProtocolSharesDiscriminatorBytes, getPreviewSwapExactInInstructionDataEncoder, getPreviewSwapExactInInstructionDataDecoder, getPreviewSwapExactInInstructionDataCodec, getPreviewSwapExactInInstruction, getPreviewSwapExactInDiscriminatorBytes, getPositionValue, getPositionAddressFromParams, getPoolByMints, getPoolAddressFromMints, getPendingFees, getPauseInstructionDataEncoder, getPauseInstructionDataDecoder, getPauseInstructionDataCodec, getPauseInstruction, getPauseDiscriminatorBytes, getOracleUpdateInstructionDataEncoder, getOracleUpdateInstructionDataDecoder, getOracleUpdateInstructionDataCodec, getOracleUpdateInstructionAsync, getOracleUpdateInstruction, getOracleUpdateDiscriminatorBytes, getOracleSpotPrices, getOracleForPool, getOracleDeviation, getOracleConsultInstructionDataEncoder, getOracleConsultInstructionDataDecoder, getOracleConsultInstructionDataCodec, getOracleConsultInstructionAsync, getOracleConsultInstruction, getOracleConsultDiscriminatorBytes, getOracleBufferStats, getOracleAge, getOracleAddressFromPool, getK, getInitializePoolInstructionDataEncoder, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataCodec, getInitializePoolInstructionAsync, getInitializePoolInstruction, getInitializePoolDiscriminatorBytes, getInitializeOracleInstructionDataEncoder, getInitializeOracleInstructionDataDecoder, getInitializeOracleInstructionDataCodec, getInitializeOracleInstructionAsync, getInitializeOracleInstruction, getInitializeOracleDiscriminatorBytes, getInitializeConfigInstructionDataEncoder, getInitializeConfigInstructionDataDecoder, getInitializeConfigInstructionDataCodec, getInitializeConfigInstructionAsync, getInitializeConfigInstruction, getInitializeConfigDiscriminatorBytes, getCreatePositionInstructionDataEncoder, getCreatePositionInstructionDataDecoder, getCreatePositionInstructionDataCodec, getCreatePositionInstructionAsync, getCreatePositionInstruction, getCreatePositionDiscriminatorBytes, getCollectProtocolFeesInstructionDataEncoder, getCollectProtocolFeesInstructionDataDecoder, getCollectProtocolFeesInstructionDataCodec, getCollectProtocolFeesInstructionAsync, getCollectProtocolFeesInstruction, getCollectProtocolFeesDiscriminatorBytes, getCollectFeesInstructionDataEncoder, getCollectFeesInstructionDataDecoder, getCollectFeesInstructionDataCodec, getCollectFeesInstructionAsync, getCollectFeesInstruction, getCollectFeesDiscriminatorBytes, getClosePositionInstructionDataEncoder, getClosePositionInstructionDataDecoder, getClosePositionInstructionDataCodec, getClosePositionInstruction, getClosePositionDiscriminatorBytes, getAddLiquidityQuote, getAddLiquidityInstructionDataEncoder, getAddLiquidityInstructionDataDecoder, getAddLiquidityInstructionDataCodec, getAddLiquidityInstructionAsync, getAddLiquidityInstruction, getAddLiquidityDiscriminatorBytes, filterPoolsByMint, filterActivePositions, fetchUserPositions, fetchPositionsBatch, fetchPositionByParams, fetchPosition, fetchPoolsBatch, fetchPoolPositions, fetchPool, fetchOraclesBatch, fetchOracle, fetchAllPools, encodeTransferAdminArgs, encodeSwapExactInArgs, encodeSetHookArgs, encodeSetFeesArgs, encodeRemoveLiquidityArgs, 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, WITHDRAW_VAULT_EXCESS_DISCRIMINATOR, UPDATE_CONFIG_DISCRIMINATOR, UNPAUSE_DISCRIMINATOR, TRANSFER_ADMIN_DISCRIMINATOR, SWAP_EXACT_IN_DISCRIMINATOR, SET_HOOK_DISCRIMINATOR, SET_FEES_DISCRIMINATOR, REMOVE_LIQUIDITY_DISCRIMINATOR, REDEEM_PROTOCOL_SHARES_DISCRIMINATOR, PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR, PAUSE_DISCRIMINATOR, ORACLE_UPDATE_DISCRIMINATOR, ORACLE_CONSULT_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, INITIALIZE_ORACLE_DISCRIMINATOR, INITIALIZE_CONFIG_DISCRIMINATOR, CREATE_POSITION_DISCRIMINATOR, COLLECT_PROTOCOL_FEES_DISCRIMINATOR, COLLECT_FEES_DISCRIMINATOR, CLOSE_POSITION_DISCRIMINATOR, ADD_LIQUIDITY_DISCRIMINATOR, CPMM_PROGRAM_ADDRESS } from '../chunk-BESE77DM.js';
2
+ import { sortMints, getSwapAddresses, getProtocolFeePositionAddress, getProtocolFeeOwnerAddress, getPositionAddress, getPoolVault1Address, getPoolVault0Address, getPoolInitAddresses, getPoolAuthorityAddress, getPoolAddress, getOracleAddress, getLiquidityAddresses, getConfigAddress, CPMM_PROGRAM_ID, areMintsOrdered, TOKEN_METADATA_PROGRAM_ID, SEED_PROTOCOL_FEE_OWNER, 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-ZUJKBFXW.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, 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, isProgramError, address, addEncoderSizePrefix, getUtf8Encoder, addDecoderSizePrefix, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec, compressTransactionMessageUsingAddressLookupTables, mergeBytes } from '@solana/kit';
5
- import { getAddressFromResolvedInstructionAccount, getAccountMetaFactory, getNonNullResolvedInstructionInput, addSelfPlanAndSendFunctions, addSelfFetchFunctions } from '@solana/program-client-core';
4
+ import { getAddressCodec, getProgramDerivedAddress, createNoopSigner, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getAddressEncoder, getU8Encoder, getArrayEncoder, getStructDecoder, fixDecoderSize, getAddressDecoder, getU8Decoder, getArrayDecoder, getBytesDecoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, 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, isProgramError, address, getU16Encoder, getU16Decoder, getU64Encoder, addEncoderSizePrefix, getU32Encoder, getUtf8Encoder, getU64Decoder, addDecoderSizePrefix, getU32Decoder, getUtf8Decoder, AccountRole, getStructCodec, getU64Codec, compressTransactionMessageUsingAddressLookupTables, getTransactionMessageSize, getOptionEncoder, getU128Encoder, getOptionDecoder, getU128Decoder, getBooleanEncoder, getBooleanDecoder, mergeBytes, getEnumEncoder } from '@solana/kit';
5
+ import { getAccountMetaFactory, addSelfPlanAndSendFunctions, addSelfFetchFunctions, getAddressFromResolvedInstructionAccount } from '@solana/program-client-core';
6
6
  import { keccak_256 } from '@noble/hashes/sha3.js';
7
7
  import { findAddressLookupTablePda, getCreateLookupTableInstruction, getExtendLookupTableInstruction } from '@solana-program/address-lookup-table';
8
8
 
@@ -42,17 +42,16 @@ __export(cpmm_exports, {
42
42
  PAUSE_DISCRIMINATOR: () => PAUSE_DISCRIMINATOR,
43
43
  PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
44
44
  Q64_ONE: () => Q64_ONE,
45
- QUOTE_TO_NUMERAIRE_DISCRIMINATOR: () => QUOTE_TO_NUMERAIRE_DISCRIMINATOR,
45
+ REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () => REDEEM_PROTOCOL_SHARES_DISCRIMINATOR,
46
46
  REMOVE_LIQUIDITY_DISCRIMINATOR: () => REMOVE_LIQUIDITY_DISCRIMINATOR,
47
47
  SEED_AUTHORITY: () => SEED_AUTHORITY,
48
48
  SEED_CONFIG: () => SEED_CONFIG,
49
49
  SEED_ORACLE: () => SEED_ORACLE,
50
50
  SEED_POOL: () => SEED_POOL,
51
51
  SEED_POSITION: () => SEED_POSITION,
52
- SEED_PROTOCOL_FEE_POSITION: () => SEED_PROTOCOL_FEE_POSITION,
52
+ SEED_PROTOCOL_FEE_OWNER: () => SEED_PROTOCOL_FEE_OWNER,
53
53
  SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
54
54
  SET_HOOK_DISCRIMINATOR: () => SET_HOOK_DISCRIMINATOR,
55
- SET_ROUTE_DISCRIMINATOR: () => SET_ROUTE_DISCRIMINATOR,
56
55
  SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
57
56
  TOKEN_METADATA_PROGRAM_ID: () => TOKEN_METADATA_PROGRAM_ID,
58
57
  TRANSFER_ADMIN_DISCRIMINATOR: () => TRANSFER_ADMIN_DISCRIMINATOR,
@@ -84,11 +83,9 @@ __export(cpmm_exports, {
84
83
  createOracleUpdateInstruction: () => getOracleUpdateInstruction,
85
84
  createPauseInstruction: () => getPauseInstruction,
86
85
  createPositionArgsCodec: () => createPositionArgsCodec,
87
- createQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
88
86
  createRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
89
87
  createSetFeesInstruction: () => getSetFeesInstruction,
90
88
  createSetHookInstruction: () => getSetHookInstruction,
91
- createSetRouteInstruction: () => getSetRouteInstruction,
92
89
  createSwapExactInInstruction: () => getSwapExactInInstruction,
93
90
  createSwapInstruction: () => createSwapInstruction,
94
91
  createTransferAdminInstruction: () => getTransferAdminInstruction,
@@ -108,11 +105,9 @@ __export(cpmm_exports, {
108
105
  encodeInitializePoolArgs: () => encodeInitializePoolArgs,
109
106
  encodeInstructionData: () => encodeInstructionData,
110
107
  encodeOracleConsultArgs: () => encodeOracleConsultArgs,
111
- encodeQuoteToNumeraireArgs: () => encodeQuoteToNumeraireArgs,
112
108
  encodeRemoveLiquidityArgs: () => encodeRemoveLiquidityArgs,
113
109
  encodeSetFeesArgs: () => encodeSetFeesArgs,
114
110
  encodeSetHookArgs: () => encodeSetHookArgs,
115
- encodeSetRouteArgs: () => encodeSetRouteArgs,
116
111
  encodeSwapExactInArgs: () => encodeSwapExactInArgs,
117
112
  encodeTransferAdminArgs: () => encodeTransferAdminArgs,
118
113
  fetchAllPools: () => fetchAllPools,
@@ -222,12 +217,14 @@ __export(cpmm_exports, {
222
217
  getPreviewSwapExactInInstructionDataCodec: () => getPreviewSwapExactInInstructionDataCodec,
223
218
  getPreviewSwapExactInInstructionDataDecoder: () => getPreviewSwapExactInInstructionDataDecoder,
224
219
  getPreviewSwapExactInInstructionDataEncoder: () => getPreviewSwapExactInInstructionDataEncoder,
220
+ getProtocolFeeOwnerAddress: () => getProtocolFeeOwnerAddress,
225
221
  getProtocolFeePositionAddress: () => getProtocolFeePositionAddress,
226
- getQuoteToNumeraireDiscriminatorBytes: () => getQuoteToNumeraireDiscriminatorBytes,
227
- getQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
228
- getQuoteToNumeraireInstructionDataCodec: () => getQuoteToNumeraireInstructionDataCodec,
229
- getQuoteToNumeraireInstructionDataDecoder: () => getQuoteToNumeraireInstructionDataDecoder,
230
- getQuoteToNumeraireInstructionDataEncoder: () => getQuoteToNumeraireInstructionDataEncoder,
222
+ getRedeemProtocolSharesDiscriminatorBytes: () => getRedeemProtocolSharesDiscriminatorBytes,
223
+ getRedeemProtocolSharesInstruction: () => getRedeemProtocolSharesInstruction,
224
+ getRedeemProtocolSharesInstructionAsync: () => getRedeemProtocolSharesInstructionAsync,
225
+ getRedeemProtocolSharesInstructionDataCodec: () => getRedeemProtocolSharesInstructionDataCodec,
226
+ getRedeemProtocolSharesInstructionDataDecoder: () => getRedeemProtocolSharesInstructionDataDecoder,
227
+ getRedeemProtocolSharesInstructionDataEncoder: () => getRedeemProtocolSharesInstructionDataEncoder,
231
228
  getRemoveLiquidityDiscriminatorBytes: () => getRemoveLiquidityDiscriminatorBytes,
232
229
  getRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
233
230
  getRemoveLiquidityInstructionAsync: () => getRemoveLiquidityInstructionAsync,
@@ -245,11 +242,6 @@ __export(cpmm_exports, {
245
242
  getSetHookInstructionDataCodec: () => getSetHookInstructionDataCodec,
246
243
  getSetHookInstructionDataDecoder: () => getSetHookInstructionDataDecoder,
247
244
  getSetHookInstructionDataEncoder: () => getSetHookInstructionDataEncoder,
248
- getSetRouteDiscriminatorBytes: () => getSetRouteDiscriminatorBytes,
249
- getSetRouteInstruction: () => getSetRouteInstruction,
250
- getSetRouteInstructionDataCodec: () => getSetRouteInstructionDataCodec,
251
- getSetRouteInstructionDataDecoder: () => getSetRouteInstructionDataDecoder,
252
- getSetRouteInstructionDataEncoder: () => getSetRouteInstructionDataEncoder,
253
245
  getSpotPrice0: () => getSpotPrice0,
254
246
  getSpotPrice1: () => getSpotPrice1,
255
247
  getSwapAddresses: () => getSwapAddresses,
@@ -311,11 +303,10 @@ __export(cpmm_exports, {
311
303
  parseOracleUpdateInstruction: () => parseOracleUpdateInstruction,
312
304
  parsePauseInstruction: () => parsePauseInstruction,
313
305
  parsePreviewSwapExactInInstruction: () => parsePreviewSwapExactInInstruction,
314
- parseQuoteToNumeraireInstruction: () => parseQuoteToNumeraireInstruction,
306
+ parseRedeemProtocolSharesInstruction: () => parseRedeemProtocolSharesInstruction,
315
307
  parseRemoveLiquidityInstruction: () => parseRemoveLiquidityInstruction,
316
308
  parseSetFeesInstruction: () => parseSetFeesInstruction,
317
309
  parseSetHookInstruction: () => parseSetHookInstruction,
318
- parseSetRouteInstruction: () => parseSetRouteInstruction,
319
310
  parseSwapExactInInstruction: () => parseSwapExactInInstruction,
320
311
  parseTransferAdminInstruction: () => parseTransferAdminInstruction,
321
312
  parseUnpauseInstruction: () => parseUnpauseInstruction,
@@ -327,12 +318,10 @@ __export(cpmm_exports, {
327
318
  q64Div: () => q64Div,
328
319
  q64Mul: () => q64Mul,
329
320
  q64ToNumber: () => q64ToNumber,
330
- quoteToNumeraireArgsCodec: () => quoteToNumeraireArgsCodec,
331
321
  ratioToNumber: () => ratioToNumber,
332
322
  removeLiquidityArgsCodec: () => removeLiquidityArgsCodec,
333
323
  setFeesArgsCodec: () => setFeesArgsCodec,
334
324
  setHookArgsCodec: () => setHookArgsCodec,
335
- setRouteArgsCodec: () => setRouteArgsCodec,
336
325
  sortMints: () => sortMints,
337
326
  sortPoolsByReserves: () => sortPoolsByReserves,
338
327
  sortPositionsByShares: () => sortPositionsByShares,
@@ -639,2869 +628,6 @@ function getErrorMessage(code) {
639
628
  }
640
629
  return `Unknown error code: ${code}`;
641
630
  }
642
-
643
- // src/solana/generated/cpmm/programs/cpmm.ts
644
- var CPMM_PROGRAM_ADDRESS = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
645
-
646
- // src/solana/generated/cpmm/instructions/addLiquidity.ts
647
- var ADD_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
648
- 181,
649
- 157,
650
- 89,
651
- 67,
652
- 143,
653
- 182,
654
- 52,
655
- 72
656
- ]);
657
- function getAddLiquidityDiscriminatorBytes() {
658
- return fixEncoderSize(getBytesEncoder(), 8).encode(
659
- ADD_LIQUIDITY_DISCRIMINATOR
660
- );
661
- }
662
- function getAddLiquidityInstructionDataEncoder() {
663
- return transformEncoder(
664
- getStructEncoder([
665
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
666
- ["amount0Max", getU64Encoder()],
667
- ["amount1Max", getU64Encoder()],
668
- ["minSharesOut", getU128Encoder()],
669
- ["updateOracle", getBooleanEncoder()]
670
- ]),
671
- (value) => ({ ...value, discriminator: ADD_LIQUIDITY_DISCRIMINATOR })
672
- );
673
- }
674
- function getAddLiquidityInstructionDataDecoder() {
675
- return getStructDecoder([
676
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
677
- ["amount0Max", getU64Decoder()],
678
- ["amount1Max", getU64Decoder()],
679
- ["minSharesOut", getU128Decoder()],
680
- ["updateOracle", getBooleanDecoder()]
681
- ]);
682
- }
683
- function getAddLiquidityInstructionDataCodec() {
684
- return combineCodec(
685
- getAddLiquidityInstructionDataEncoder(),
686
- getAddLiquidityInstructionDataDecoder()
687
- );
688
- }
689
- async function getAddLiquidityInstructionAsync(input, config) {
690
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
691
- const originalAccounts = {
692
- config: { value: input.config ?? null, isWritable: false },
693
- pool: { value: input.pool ?? null, isWritable: true },
694
- position: { value: input.position ?? null, isWritable: true },
695
- protocolFeePosition: {
696
- value: input.protocolFeePosition ?? null,
697
- isWritable: true
698
- },
699
- owner: { value: input.owner ?? null, isWritable: false },
700
- authority: { value: input.authority ?? null, isWritable: false },
701
- vault0: { value: input.vault0 ?? null, isWritable: true },
702
- vault1: { value: input.vault1 ?? null, isWritable: true },
703
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
704
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
705
- user0: { value: input.user0 ?? null, isWritable: true },
706
- user1: { value: input.user1 ?? null, isWritable: true },
707
- token0Program: { value: input.token0Program ?? null, isWritable: false },
708
- token1Program: { value: input.token1Program ?? null, isWritable: false },
709
- oracle: { value: input.oracle ?? null, isWritable: true }
710
- };
711
- const accounts = originalAccounts;
712
- const args = { ...input };
713
- if (!accounts.authority.value) {
714
- accounts.authority.value = await getProgramDerivedAddress({
715
- programAddress,
716
- seeds: [
717
- getBytesEncoder().encode(
718
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
719
- ),
720
- getAddressEncoder().encode(
721
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
722
- )
723
- ]
724
- });
725
- }
726
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
727
- return Object.freeze({
728
- accounts: [
729
- getAccountMeta("config", accounts.config),
730
- getAccountMeta("pool", accounts.pool),
731
- getAccountMeta("position", accounts.position),
732
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
733
- getAccountMeta("owner", accounts.owner),
734
- getAccountMeta("authority", accounts.authority),
735
- getAccountMeta("vault0", accounts.vault0),
736
- getAccountMeta("vault1", accounts.vault1),
737
- getAccountMeta("token0Mint", accounts.token0Mint),
738
- getAccountMeta("token1Mint", accounts.token1Mint),
739
- getAccountMeta("user0", accounts.user0),
740
- getAccountMeta("user1", accounts.user1),
741
- getAccountMeta("token0Program", accounts.token0Program),
742
- getAccountMeta("token1Program", accounts.token1Program),
743
- getAccountMeta("oracle", accounts.oracle)
744
- ],
745
- data: getAddLiquidityInstructionDataEncoder().encode(
746
- args
747
- ),
748
- programAddress
749
- });
750
- }
751
- function getAddLiquidityInstruction(input, config) {
752
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
753
- const originalAccounts = {
754
- config: { value: input.config ?? null, isWritable: false },
755
- pool: { value: input.pool ?? null, isWritable: true },
756
- position: { value: input.position ?? null, isWritable: true },
757
- protocolFeePosition: {
758
- value: input.protocolFeePosition ?? null,
759
- isWritable: true
760
- },
761
- owner: { value: input.owner ?? null, isWritable: false },
762
- authority: { value: input.authority ?? null, isWritable: false },
763
- vault0: { value: input.vault0 ?? null, isWritable: true },
764
- vault1: { value: input.vault1 ?? null, isWritable: true },
765
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
766
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
767
- user0: { value: input.user0 ?? null, isWritable: true },
768
- user1: { value: input.user1 ?? null, isWritable: true },
769
- token0Program: { value: input.token0Program ?? null, isWritable: false },
770
- token1Program: { value: input.token1Program ?? null, isWritable: false },
771
- oracle: { value: input.oracle ?? null, isWritable: true }
772
- };
773
- const accounts = originalAccounts;
774
- const args = { ...input };
775
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
776
- return Object.freeze({
777
- accounts: [
778
- getAccountMeta("config", accounts.config),
779
- getAccountMeta("pool", accounts.pool),
780
- getAccountMeta("position", accounts.position),
781
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
782
- getAccountMeta("owner", accounts.owner),
783
- getAccountMeta("authority", accounts.authority),
784
- getAccountMeta("vault0", accounts.vault0),
785
- getAccountMeta("vault1", accounts.vault1),
786
- getAccountMeta("token0Mint", accounts.token0Mint),
787
- getAccountMeta("token1Mint", accounts.token1Mint),
788
- getAccountMeta("user0", accounts.user0),
789
- getAccountMeta("user1", accounts.user1),
790
- getAccountMeta("token0Program", accounts.token0Program),
791
- getAccountMeta("token1Program", accounts.token1Program),
792
- getAccountMeta("oracle", accounts.oracle)
793
- ],
794
- data: getAddLiquidityInstructionDataEncoder().encode(
795
- args
796
- ),
797
- programAddress
798
- });
799
- }
800
- function parseAddLiquidityInstruction(instruction) {
801
- if (instruction.accounts.length < 15) {
802
- throw new SolanaError(
803
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
804
- {
805
- actualAccountMetas: instruction.accounts.length,
806
- expectedAccountMetas: 15
807
- }
808
- );
809
- }
810
- let accountIndex = 0;
811
- const getNextAccount = () => {
812
- const accountMeta = instruction.accounts[accountIndex];
813
- accountIndex += 1;
814
- return accountMeta;
815
- };
816
- const getNextOptionalAccount = () => {
817
- const accountMeta = getNextAccount();
818
- return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
819
- };
820
- return {
821
- programAddress: instruction.programAddress,
822
- accounts: {
823
- config: getNextAccount(),
824
- pool: getNextAccount(),
825
- position: getNextAccount(),
826
- protocolFeePosition: getNextAccount(),
827
- owner: getNextAccount(),
828
- authority: getNextAccount(),
829
- vault0: getNextAccount(),
830
- vault1: getNextAccount(),
831
- token0Mint: getNextAccount(),
832
- token1Mint: getNextAccount(),
833
- user0: getNextAccount(),
834
- user1: getNextAccount(),
835
- token0Program: getNextAccount(),
836
- token1Program: getNextAccount(),
837
- oracle: getNextOptionalAccount()
838
- },
839
- data: getAddLiquidityInstructionDataDecoder().decode(instruction.data)
840
- };
841
- }
842
- var CLOSE_POSITION_DISCRIMINATOR = new Uint8Array([
843
- 123,
844
- 134,
845
- 81,
846
- 0,
847
- 49,
848
- 68,
849
- 98,
850
- 98
851
- ]);
852
- function getClosePositionDiscriminatorBytes() {
853
- return fixEncoderSize(getBytesEncoder(), 8).encode(
854
- CLOSE_POSITION_DISCRIMINATOR
855
- );
856
- }
857
- function getClosePositionInstructionDataEncoder() {
858
- return transformEncoder(
859
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
860
- (value) => ({ ...value, discriminator: CLOSE_POSITION_DISCRIMINATOR })
861
- );
862
- }
863
- function getClosePositionInstructionDataDecoder() {
864
- return getStructDecoder([
865
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
866
- ]);
867
- }
868
- function getClosePositionInstructionDataCodec() {
869
- return combineCodec(
870
- getClosePositionInstructionDataEncoder(),
871
- getClosePositionInstructionDataDecoder()
872
- );
873
- }
874
- function getClosePositionInstruction(input, config) {
875
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
876
- const originalAccounts = {
877
- pool: { value: input.pool ?? null, isWritable: false },
878
- position: { value: input.position ?? null, isWritable: true },
879
- owner: { value: input.owner ?? null, isWritable: false },
880
- rentRecipient: { value: input.rentRecipient ?? null, isWritable: true }
881
- };
882
- const accounts = originalAccounts;
883
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
884
- return Object.freeze({
885
- accounts: [
886
- getAccountMeta("pool", accounts.pool),
887
- getAccountMeta("position", accounts.position),
888
- getAccountMeta("owner", accounts.owner),
889
- getAccountMeta("rentRecipient", accounts.rentRecipient)
890
- ],
891
- data: getClosePositionInstructionDataEncoder().encode({}),
892
- programAddress
893
- });
894
- }
895
- function parseClosePositionInstruction(instruction) {
896
- if (instruction.accounts.length < 4) {
897
- throw new SolanaError(
898
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
899
- {
900
- actualAccountMetas: instruction.accounts.length,
901
- expectedAccountMetas: 4
902
- }
903
- );
904
- }
905
- let accountIndex = 0;
906
- const getNextAccount = () => {
907
- const accountMeta = instruction.accounts[accountIndex];
908
- accountIndex += 1;
909
- return accountMeta;
910
- };
911
- return {
912
- programAddress: instruction.programAddress,
913
- accounts: {
914
- pool: getNextAccount(),
915
- position: getNextAccount(),
916
- owner: getNextAccount(),
917
- rentRecipient: getNextAccount()
918
- },
919
- data: getClosePositionInstructionDataDecoder().decode(instruction.data)
920
- };
921
- }
922
- var COLLECT_FEES_DISCRIMINATOR = new Uint8Array([
923
- 164,
924
- 152,
925
- 207,
926
- 99,
927
- 30,
928
- 186,
929
- 19,
930
- 182
931
- ]);
932
- function getCollectFeesDiscriminatorBytes() {
933
- return fixEncoderSize(getBytesEncoder(), 8).encode(
934
- COLLECT_FEES_DISCRIMINATOR
935
- );
936
- }
937
- function getCollectFeesInstructionDataEncoder() {
938
- return transformEncoder(
939
- getStructEncoder([
940
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
941
- ["max0", getU64Encoder()],
942
- ["max1", getU64Encoder()]
943
- ]),
944
- (value) => ({ ...value, discriminator: COLLECT_FEES_DISCRIMINATOR })
945
- );
946
- }
947
- function getCollectFeesInstructionDataDecoder() {
948
- return getStructDecoder([
949
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
950
- ["max0", getU64Decoder()],
951
- ["max1", getU64Decoder()]
952
- ]);
953
- }
954
- function getCollectFeesInstructionDataCodec() {
955
- return combineCodec(
956
- getCollectFeesInstructionDataEncoder(),
957
- getCollectFeesInstructionDataDecoder()
958
- );
959
- }
960
- async function getCollectFeesInstructionAsync(input, config) {
961
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
962
- const originalAccounts = {
963
- pool: { value: input.pool ?? null, isWritable: true },
964
- position: { value: input.position ?? null, isWritable: true },
965
- owner: { value: input.owner ?? null, isWritable: false },
966
- authority: { value: input.authority ?? null, isWritable: false },
967
- vault0: { value: input.vault0 ?? null, isWritable: true },
968
- vault1: { value: input.vault1 ?? null, isWritable: true },
969
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
970
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
971
- user0: { value: input.user0 ?? null, isWritable: true },
972
- user1: { value: input.user1 ?? null, isWritable: true },
973
- token0Program: { value: input.token0Program ?? null, isWritable: false },
974
- token1Program: { value: input.token1Program ?? null, isWritable: false }
975
- };
976
- const accounts = originalAccounts;
977
- const args = { ...input };
978
- if (!accounts.authority.value) {
979
- accounts.authority.value = await getProgramDerivedAddress({
980
- programAddress,
981
- seeds: [
982
- getBytesEncoder().encode(
983
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
984
- ),
985
- getAddressEncoder().encode(
986
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
987
- )
988
- ]
989
- });
990
- }
991
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
992
- return Object.freeze({
993
- accounts: [
994
- getAccountMeta("pool", accounts.pool),
995
- getAccountMeta("position", accounts.position),
996
- getAccountMeta("owner", accounts.owner),
997
- getAccountMeta("authority", accounts.authority),
998
- getAccountMeta("vault0", accounts.vault0),
999
- getAccountMeta("vault1", accounts.vault1),
1000
- getAccountMeta("token0Mint", accounts.token0Mint),
1001
- getAccountMeta("token1Mint", accounts.token1Mint),
1002
- getAccountMeta("user0", accounts.user0),
1003
- getAccountMeta("user1", accounts.user1),
1004
- getAccountMeta("token0Program", accounts.token0Program),
1005
- getAccountMeta("token1Program", accounts.token1Program)
1006
- ],
1007
- data: getCollectFeesInstructionDataEncoder().encode(
1008
- args
1009
- ),
1010
- programAddress
1011
- });
1012
- }
1013
- function getCollectFeesInstruction(input, config) {
1014
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1015
- const originalAccounts = {
1016
- pool: { value: input.pool ?? null, isWritable: true },
1017
- position: { value: input.position ?? null, isWritable: true },
1018
- owner: { value: input.owner ?? null, isWritable: false },
1019
- authority: { value: input.authority ?? null, isWritable: false },
1020
- vault0: { value: input.vault0 ?? null, isWritable: true },
1021
- vault1: { value: input.vault1 ?? null, isWritable: true },
1022
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1023
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1024
- user0: { value: input.user0 ?? null, isWritable: true },
1025
- user1: { value: input.user1 ?? null, isWritable: true },
1026
- token0Program: { value: input.token0Program ?? null, isWritable: false },
1027
- token1Program: { value: input.token1Program ?? null, isWritable: false }
1028
- };
1029
- const accounts = originalAccounts;
1030
- const args = { ...input };
1031
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1032
- return Object.freeze({
1033
- accounts: [
1034
- getAccountMeta("pool", accounts.pool),
1035
- getAccountMeta("position", accounts.position),
1036
- getAccountMeta("owner", accounts.owner),
1037
- getAccountMeta("authority", accounts.authority),
1038
- getAccountMeta("vault0", accounts.vault0),
1039
- getAccountMeta("vault1", accounts.vault1),
1040
- getAccountMeta("token0Mint", accounts.token0Mint),
1041
- getAccountMeta("token1Mint", accounts.token1Mint),
1042
- getAccountMeta("user0", accounts.user0),
1043
- getAccountMeta("user1", accounts.user1),
1044
- getAccountMeta("token0Program", accounts.token0Program),
1045
- getAccountMeta("token1Program", accounts.token1Program)
1046
- ],
1047
- data: getCollectFeesInstructionDataEncoder().encode(
1048
- args
1049
- ),
1050
- programAddress
1051
- });
1052
- }
1053
- function parseCollectFeesInstruction(instruction) {
1054
- if (instruction.accounts.length < 12) {
1055
- throw new SolanaError(
1056
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1057
- {
1058
- actualAccountMetas: instruction.accounts.length,
1059
- expectedAccountMetas: 12
1060
- }
1061
- );
1062
- }
1063
- let accountIndex = 0;
1064
- const getNextAccount = () => {
1065
- const accountMeta = instruction.accounts[accountIndex];
1066
- accountIndex += 1;
1067
- return accountMeta;
1068
- };
1069
- return {
1070
- programAddress: instruction.programAddress,
1071
- accounts: {
1072
- pool: getNextAccount(),
1073
- position: getNextAccount(),
1074
- owner: getNextAccount(),
1075
- authority: getNextAccount(),
1076
- vault0: getNextAccount(),
1077
- vault1: getNextAccount(),
1078
- token0Mint: getNextAccount(),
1079
- token1Mint: getNextAccount(),
1080
- user0: getNextAccount(),
1081
- user1: getNextAccount(),
1082
- token0Program: getNextAccount(),
1083
- token1Program: getNextAccount()
1084
- },
1085
- data: getCollectFeesInstructionDataDecoder().decode(instruction.data)
1086
- };
1087
- }
1088
- var COLLECT_PROTOCOL_FEES_DISCRIMINATOR = new Uint8Array([
1089
- 22,
1090
- 67,
1091
- 23,
1092
- 98,
1093
- 150,
1094
- 178,
1095
- 70,
1096
- 220
1097
- ]);
1098
- function getCollectProtocolFeesDiscriminatorBytes() {
1099
- return fixEncoderSize(getBytesEncoder(), 8).encode(
1100
- COLLECT_PROTOCOL_FEES_DISCRIMINATOR
1101
- );
1102
- }
1103
- function getCollectProtocolFeesInstructionDataEncoder() {
1104
- return transformEncoder(
1105
- getStructEncoder([
1106
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
1107
- ["max0", getU64Encoder()],
1108
- ["max1", getU64Encoder()]
1109
- ]),
1110
- (value) => ({
1111
- ...value,
1112
- discriminator: COLLECT_PROTOCOL_FEES_DISCRIMINATOR
1113
- })
1114
- );
1115
- }
1116
- function getCollectProtocolFeesInstructionDataDecoder() {
1117
- return getStructDecoder([
1118
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
1119
- ["max0", getU64Decoder()],
1120
- ["max1", getU64Decoder()]
1121
- ]);
1122
- }
1123
- function getCollectProtocolFeesInstructionDataCodec() {
1124
- return combineCodec(
1125
- getCollectProtocolFeesInstructionDataEncoder(),
1126
- getCollectProtocolFeesInstructionDataDecoder()
1127
- );
1128
- }
1129
- async function getCollectProtocolFeesInstructionAsync(input, config) {
1130
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1131
- const originalAccounts = {
1132
- config: { value: input.config ?? null, isWritable: false },
1133
- pool: { value: input.pool ?? null, isWritable: true },
1134
- protocolFeePosition: {
1135
- value: input.protocolFeePosition ?? null,
1136
- isWritable: true
1137
- },
1138
- admin: { value: input.admin ?? null, isWritable: false },
1139
- authority: { value: input.authority ?? null, isWritable: false },
1140
- vault0: { value: input.vault0 ?? null, isWritable: true },
1141
- vault1: { value: input.vault1 ?? null, isWritable: true },
1142
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1143
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1144
- recipient0: { value: input.recipient0 ?? null, isWritable: true },
1145
- recipient1: { value: input.recipient1 ?? null, isWritable: true },
1146
- token0Program: { value: input.token0Program ?? null, isWritable: false },
1147
- token1Program: { value: input.token1Program ?? null, isWritable: false }
1148
- };
1149
- const accounts = originalAccounts;
1150
- const args = { ...input };
1151
- if (!accounts.authority.value) {
1152
- accounts.authority.value = await getProgramDerivedAddress({
1153
- programAddress,
1154
- seeds: [
1155
- getBytesEncoder().encode(
1156
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
1157
- ),
1158
- getAddressEncoder().encode(
1159
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1160
- )
1161
- ]
1162
- });
1163
- }
1164
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1165
- return Object.freeze({
1166
- accounts: [
1167
- getAccountMeta("config", accounts.config),
1168
- getAccountMeta("pool", accounts.pool),
1169
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1170
- getAccountMeta("admin", accounts.admin),
1171
- getAccountMeta("authority", accounts.authority),
1172
- getAccountMeta("vault0", accounts.vault0),
1173
- getAccountMeta("vault1", accounts.vault1),
1174
- getAccountMeta("token0Mint", accounts.token0Mint),
1175
- getAccountMeta("token1Mint", accounts.token1Mint),
1176
- getAccountMeta("recipient0", accounts.recipient0),
1177
- getAccountMeta("recipient1", accounts.recipient1),
1178
- getAccountMeta("token0Program", accounts.token0Program),
1179
- getAccountMeta("token1Program", accounts.token1Program)
1180
- ],
1181
- data: getCollectProtocolFeesInstructionDataEncoder().encode(
1182
- args
1183
- ),
1184
- programAddress
1185
- });
1186
- }
1187
- function getCollectProtocolFeesInstruction(input, config) {
1188
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1189
- const originalAccounts = {
1190
- config: { value: input.config ?? null, isWritable: false },
1191
- pool: { value: input.pool ?? null, isWritable: true },
1192
- protocolFeePosition: {
1193
- value: input.protocolFeePosition ?? null,
1194
- isWritable: true
1195
- },
1196
- admin: { value: input.admin ?? null, isWritable: false },
1197
- authority: { value: input.authority ?? null, isWritable: false },
1198
- vault0: { value: input.vault0 ?? null, isWritable: true },
1199
- vault1: { value: input.vault1 ?? null, isWritable: true },
1200
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1201
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1202
- recipient0: { value: input.recipient0 ?? null, isWritable: true },
1203
- recipient1: { value: input.recipient1 ?? null, isWritable: true },
1204
- token0Program: { value: input.token0Program ?? null, isWritable: false },
1205
- token1Program: { value: input.token1Program ?? null, isWritable: false }
1206
- };
1207
- const accounts = originalAccounts;
1208
- const args = { ...input };
1209
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1210
- return Object.freeze({
1211
- accounts: [
1212
- getAccountMeta("config", accounts.config),
1213
- getAccountMeta("pool", accounts.pool),
1214
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1215
- getAccountMeta("admin", accounts.admin),
1216
- getAccountMeta("authority", accounts.authority),
1217
- getAccountMeta("vault0", accounts.vault0),
1218
- getAccountMeta("vault1", accounts.vault1),
1219
- getAccountMeta("token0Mint", accounts.token0Mint),
1220
- getAccountMeta("token1Mint", accounts.token1Mint),
1221
- getAccountMeta("recipient0", accounts.recipient0),
1222
- getAccountMeta("recipient1", accounts.recipient1),
1223
- getAccountMeta("token0Program", accounts.token0Program),
1224
- getAccountMeta("token1Program", accounts.token1Program)
1225
- ],
1226
- data: getCollectProtocolFeesInstructionDataEncoder().encode(
1227
- args
1228
- ),
1229
- programAddress
1230
- });
1231
- }
1232
- function parseCollectProtocolFeesInstruction(instruction) {
1233
- if (instruction.accounts.length < 13) {
1234
- throw new SolanaError(
1235
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1236
- {
1237
- actualAccountMetas: instruction.accounts.length,
1238
- expectedAccountMetas: 13
1239
- }
1240
- );
1241
- }
1242
- let accountIndex = 0;
1243
- const getNextAccount = () => {
1244
- const accountMeta = instruction.accounts[accountIndex];
1245
- accountIndex += 1;
1246
- return accountMeta;
1247
- };
1248
- return {
1249
- programAddress: instruction.programAddress,
1250
- accounts: {
1251
- config: getNextAccount(),
1252
- pool: getNextAccount(),
1253
- protocolFeePosition: getNextAccount(),
1254
- admin: getNextAccount(),
1255
- authority: getNextAccount(),
1256
- vault0: getNextAccount(),
1257
- vault1: getNextAccount(),
1258
- token0Mint: getNextAccount(),
1259
- token1Mint: getNextAccount(),
1260
- recipient0: getNextAccount(),
1261
- recipient1: getNextAccount(),
1262
- token0Program: getNextAccount(),
1263
- token1Program: getNextAccount()
1264
- },
1265
- data: getCollectProtocolFeesInstructionDataDecoder().decode(
1266
- instruction.data
1267
- )
1268
- };
1269
- }
1270
- var CREATE_POSITION_DISCRIMINATOR = new Uint8Array([
1271
- 48,
1272
- 215,
1273
- 197,
1274
- 153,
1275
- 96,
1276
- 203,
1277
- 180,
1278
- 133
1279
- ]);
1280
- function getCreatePositionDiscriminatorBytes() {
1281
- return fixEncoderSize(getBytesEncoder(), 8).encode(
1282
- CREATE_POSITION_DISCRIMINATOR
1283
- );
1284
- }
1285
- function getCreatePositionInstructionDataEncoder() {
1286
- return transformEncoder(
1287
- getStructEncoder([
1288
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
1289
- ["positionId", getU64Encoder()]
1290
- ]),
1291
- (value) => ({ ...value, discriminator: CREATE_POSITION_DISCRIMINATOR })
1292
- );
1293
- }
1294
- function getCreatePositionInstructionDataDecoder() {
1295
- return getStructDecoder([
1296
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
1297
- ["positionId", getU64Decoder()]
1298
- ]);
1299
- }
1300
- function getCreatePositionInstructionDataCodec() {
1301
- return combineCodec(
1302
- getCreatePositionInstructionDataEncoder(),
1303
- getCreatePositionInstructionDataDecoder()
1304
- );
1305
- }
1306
- async function getCreatePositionInstructionAsync(input, config) {
1307
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1308
- const originalAccounts = {
1309
- pool: { value: input.pool ?? null, isWritable: false },
1310
- position: { value: input.position ?? null, isWritable: true },
1311
- owner: { value: input.owner ?? null, isWritable: false },
1312
- payer: { value: input.payer ?? null, isWritable: true },
1313
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1314
- };
1315
- const accounts = originalAccounts;
1316
- const args = { ...input };
1317
- if (!accounts.position.value) {
1318
- accounts.position.value = await getProgramDerivedAddress({
1319
- programAddress,
1320
- seeds: [
1321
- getBytesEncoder().encode(
1322
- new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
1323
- ),
1324
- getAddressEncoder().encode(
1325
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1326
- ),
1327
- getAddressEncoder().encode(
1328
- getAddressFromResolvedInstructionAccount(
1329
- "owner",
1330
- accounts.owner.value
1331
- )
1332
- ),
1333
- getU64Encoder().encode(
1334
- getNonNullResolvedInstructionInput("positionId", args.positionId)
1335
- )
1336
- ]
1337
- });
1338
- }
1339
- if (!accounts.systemProgram.value) {
1340
- accounts.systemProgram.value = "11111111111111111111111111111111";
1341
- }
1342
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1343
- return Object.freeze({
1344
- accounts: [
1345
- getAccountMeta("pool", accounts.pool),
1346
- getAccountMeta("position", accounts.position),
1347
- getAccountMeta("owner", accounts.owner),
1348
- getAccountMeta("payer", accounts.payer),
1349
- getAccountMeta("systemProgram", accounts.systemProgram)
1350
- ],
1351
- data: getCreatePositionInstructionDataEncoder().encode(
1352
- args
1353
- ),
1354
- programAddress
1355
- });
1356
- }
1357
- function getCreatePositionInstruction(input, config) {
1358
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1359
- const originalAccounts = {
1360
- pool: { value: input.pool ?? null, isWritable: false },
1361
- position: { value: input.position ?? null, isWritable: true },
1362
- owner: { value: input.owner ?? null, isWritable: false },
1363
- payer: { value: input.payer ?? null, isWritable: true },
1364
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1365
- };
1366
- const accounts = originalAccounts;
1367
- const args = { ...input };
1368
- if (!accounts.systemProgram.value) {
1369
- accounts.systemProgram.value = "11111111111111111111111111111111";
1370
- }
1371
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1372
- return Object.freeze({
1373
- accounts: [
1374
- getAccountMeta("pool", accounts.pool),
1375
- getAccountMeta("position", accounts.position),
1376
- getAccountMeta("owner", accounts.owner),
1377
- getAccountMeta("payer", accounts.payer),
1378
- getAccountMeta("systemProgram", accounts.systemProgram)
1379
- ],
1380
- data: getCreatePositionInstructionDataEncoder().encode(
1381
- args
1382
- ),
1383
- programAddress
1384
- });
1385
- }
1386
- function parseCreatePositionInstruction(instruction) {
1387
- if (instruction.accounts.length < 5) {
1388
- throw new SolanaError(
1389
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1390
- {
1391
- actualAccountMetas: instruction.accounts.length,
1392
- expectedAccountMetas: 5
1393
- }
1394
- );
1395
- }
1396
- let accountIndex = 0;
1397
- const getNextAccount = () => {
1398
- const accountMeta = instruction.accounts[accountIndex];
1399
- accountIndex += 1;
1400
- return accountMeta;
1401
- };
1402
- return {
1403
- programAddress: instruction.programAddress,
1404
- accounts: {
1405
- pool: getNextAccount(),
1406
- position: getNextAccount(),
1407
- owner: getNextAccount(),
1408
- payer: getNextAccount(),
1409
- systemProgram: getNextAccount()
1410
- },
1411
- data: getCreatePositionInstructionDataDecoder().decode(instruction.data)
1412
- };
1413
- }
1414
- var INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([
1415
- 208,
1416
- 127,
1417
- 21,
1418
- 1,
1419
- 194,
1420
- 190,
1421
- 196,
1422
- 70
1423
- ]);
1424
- function getInitializeConfigDiscriminatorBytes() {
1425
- return fixEncoderSize(getBytesEncoder(), 8).encode(
1426
- INITIALIZE_CONFIG_DISCRIMINATOR
1427
- );
1428
- }
1429
- function getInitializeConfigInstructionDataEncoder() {
1430
- return transformEncoder(
1431
- getStructEncoder([
1432
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
1433
- ["admin", getAddressEncoder()],
1434
- ["numeraireMint", getAddressEncoder()],
1435
- ["maxSwapFeeBps", getU16Encoder()],
1436
- ["maxFeeSplitBps", getU16Encoder()],
1437
- ["maxRouteHops", getU8Encoder()],
1438
- ["protocolFeeEnabled", getBooleanEncoder()],
1439
- ["protocolFeeBps", getU16Encoder()],
1440
- ["hookAllowlist", getArrayEncoder(getAddressEncoder())]
1441
- ]),
1442
- (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
1443
- );
1444
- }
1445
- function getInitializeConfigInstructionDataDecoder() {
1446
- return getStructDecoder([
1447
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
1448
- ["admin", getAddressDecoder()],
1449
- ["numeraireMint", getAddressDecoder()],
1450
- ["maxSwapFeeBps", getU16Decoder()],
1451
- ["maxFeeSplitBps", getU16Decoder()],
1452
- ["maxRouteHops", getU8Decoder()],
1453
- ["protocolFeeEnabled", getBooleanDecoder()],
1454
- ["protocolFeeBps", getU16Decoder()],
1455
- ["hookAllowlist", getArrayDecoder(getAddressDecoder())]
1456
- ]);
1457
- }
1458
- function getInitializeConfigInstructionDataCodec() {
1459
- return combineCodec(
1460
- getInitializeConfigInstructionDataEncoder(),
1461
- getInitializeConfigInstructionDataDecoder()
1462
- );
1463
- }
1464
- async function getInitializeConfigInstructionAsync(input, config) {
1465
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1466
- const originalAccounts = {
1467
- config: { value: input.config ?? null, isWritable: true },
1468
- programData: { value: input.programData ?? null, isWritable: false },
1469
- payer: { value: input.payer ?? null, isWritable: true },
1470
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1471
- };
1472
- const accounts = originalAccounts;
1473
- const args = { ...input };
1474
- if (!accounts.config.value) {
1475
- accounts.config.value = await getProgramDerivedAddress({
1476
- programAddress,
1477
- seeds: [
1478
- getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
1479
- ]
1480
- });
1481
- }
1482
- if (!accounts.systemProgram.value) {
1483
- accounts.systemProgram.value = "11111111111111111111111111111111";
1484
- }
1485
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1486
- return Object.freeze({
1487
- accounts: [
1488
- getAccountMeta("config", accounts.config),
1489
- getAccountMeta("programData", accounts.programData),
1490
- getAccountMeta("payer", accounts.payer),
1491
- getAccountMeta("systemProgram", accounts.systemProgram)
1492
- ],
1493
- data: getInitializeConfigInstructionDataEncoder().encode(
1494
- args
1495
- ),
1496
- programAddress
1497
- });
1498
- }
1499
- function getInitializeConfigInstruction(input, config) {
1500
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1501
- const originalAccounts = {
1502
- config: { value: input.config ?? null, isWritable: true },
1503
- programData: { value: input.programData ?? null, isWritable: false },
1504
- payer: { value: input.payer ?? null, isWritable: true },
1505
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1506
- };
1507
- const accounts = originalAccounts;
1508
- const args = { ...input };
1509
- if (!accounts.systemProgram.value) {
1510
- accounts.systemProgram.value = "11111111111111111111111111111111";
1511
- }
1512
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1513
- return Object.freeze({
1514
- accounts: [
1515
- getAccountMeta("config", accounts.config),
1516
- getAccountMeta("programData", accounts.programData),
1517
- getAccountMeta("payer", accounts.payer),
1518
- getAccountMeta("systemProgram", accounts.systemProgram)
1519
- ],
1520
- data: getInitializeConfigInstructionDataEncoder().encode(
1521
- args
1522
- ),
1523
- programAddress
1524
- });
1525
- }
1526
- function parseInitializeConfigInstruction(instruction) {
1527
- if (instruction.accounts.length < 4) {
1528
- throw new SolanaError(
1529
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1530
- {
1531
- actualAccountMetas: instruction.accounts.length,
1532
- expectedAccountMetas: 4
1533
- }
1534
- );
1535
- }
1536
- let accountIndex = 0;
1537
- const getNextAccount = () => {
1538
- const accountMeta = instruction.accounts[accountIndex];
1539
- accountIndex += 1;
1540
- return accountMeta;
1541
- };
1542
- return {
1543
- programAddress: instruction.programAddress,
1544
- accounts: {
1545
- config: getNextAccount(),
1546
- programData: getNextAccount(),
1547
- payer: getNextAccount(),
1548
- systemProgram: getNextAccount()
1549
- },
1550
- data: getInitializeConfigInstructionDataDecoder().decode(instruction.data)
1551
- };
1552
- }
1553
- var INITIALIZE_ORACLE_DISCRIMINATOR = new Uint8Array([
1554
- 144,
1555
- 223,
1556
- 131,
1557
- 120,
1558
- 196,
1559
- 253,
1560
- 181,
1561
- 99
1562
- ]);
1563
- function getInitializeOracleDiscriminatorBytes() {
1564
- return fixEncoderSize(getBytesEncoder(), 8).encode(
1565
- INITIALIZE_ORACLE_DISCRIMINATOR
1566
- );
1567
- }
1568
- function getInitializeOracleInstructionDataEncoder() {
1569
- return transformEncoder(
1570
- getStructEncoder([
1571
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
1572
- ["maxPriceChangeRatioQ64", getU128Encoder()],
1573
- ["observationIntervalSec", getU32Encoder()]
1574
- ]),
1575
- (value) => ({ ...value, discriminator: INITIALIZE_ORACLE_DISCRIMINATOR })
1576
- );
1577
- }
1578
- function getInitializeOracleInstructionDataDecoder() {
1579
- return getStructDecoder([
1580
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
1581
- ["maxPriceChangeRatioQ64", getU128Decoder()],
1582
- ["observationIntervalSec", getU32Decoder()]
1583
- ]);
1584
- }
1585
- function getInitializeOracleInstructionDataCodec() {
1586
- return combineCodec(
1587
- getInitializeOracleInstructionDataEncoder(),
1588
- getInitializeOracleInstructionDataDecoder()
1589
- );
1590
- }
1591
- async function getInitializeOracleInstructionAsync(input, config) {
1592
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1593
- const originalAccounts = {
1594
- config: { value: input.config ?? null, isWritable: false },
1595
- pool: { value: input.pool ?? null, isWritable: false },
1596
- oracle: { value: input.oracle ?? null, isWritable: true },
1597
- admin: { value: input.admin ?? null, isWritable: false },
1598
- payer: { value: input.payer ?? null, isWritable: true },
1599
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1600
- };
1601
- const accounts = originalAccounts;
1602
- const args = { ...input };
1603
- if (!accounts.oracle.value) {
1604
- accounts.oracle.value = await getProgramDerivedAddress({
1605
- programAddress,
1606
- seeds: [
1607
- getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
1608
- getAddressEncoder().encode(
1609
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1610
- )
1611
- ]
1612
- });
1613
- }
1614
- if (!accounts.systemProgram.value) {
1615
- accounts.systemProgram.value = "11111111111111111111111111111111";
1616
- }
1617
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1618
- return Object.freeze({
1619
- accounts: [
1620
- getAccountMeta("config", accounts.config),
1621
- getAccountMeta("pool", accounts.pool),
1622
- getAccountMeta("oracle", accounts.oracle),
1623
- getAccountMeta("admin", accounts.admin),
1624
- getAccountMeta("payer", accounts.payer),
1625
- getAccountMeta("systemProgram", accounts.systemProgram)
1626
- ],
1627
- data: getInitializeOracleInstructionDataEncoder().encode(
1628
- args
1629
- ),
1630
- programAddress
1631
- });
1632
- }
1633
- function getInitializeOracleInstruction(input, config) {
1634
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1635
- const originalAccounts = {
1636
- config: { value: input.config ?? null, isWritable: false },
1637
- pool: { value: input.pool ?? null, isWritable: false },
1638
- oracle: { value: input.oracle ?? null, isWritable: true },
1639
- admin: { value: input.admin ?? null, isWritable: false },
1640
- payer: { value: input.payer ?? null, isWritable: true },
1641
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1642
- };
1643
- const accounts = originalAccounts;
1644
- const args = { ...input };
1645
- if (!accounts.systemProgram.value) {
1646
- accounts.systemProgram.value = "11111111111111111111111111111111";
1647
- }
1648
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1649
- return Object.freeze({
1650
- accounts: [
1651
- getAccountMeta("config", accounts.config),
1652
- getAccountMeta("pool", accounts.pool),
1653
- getAccountMeta("oracle", accounts.oracle),
1654
- getAccountMeta("admin", accounts.admin),
1655
- getAccountMeta("payer", accounts.payer),
1656
- getAccountMeta("systemProgram", accounts.systemProgram)
1657
- ],
1658
- data: getInitializeOracleInstructionDataEncoder().encode(
1659
- args
1660
- ),
1661
- programAddress
1662
- });
1663
- }
1664
- function parseInitializeOracleInstruction(instruction) {
1665
- if (instruction.accounts.length < 6) {
1666
- throw new SolanaError(
1667
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1668
- {
1669
- actualAccountMetas: instruction.accounts.length,
1670
- expectedAccountMetas: 6
1671
- }
1672
- );
1673
- }
1674
- let accountIndex = 0;
1675
- const getNextAccount = () => {
1676
- const accountMeta = instruction.accounts[accountIndex];
1677
- accountIndex += 1;
1678
- return accountMeta;
1679
- };
1680
- return {
1681
- programAddress: instruction.programAddress,
1682
- accounts: {
1683
- config: getNextAccount(),
1684
- pool: getNextAccount(),
1685
- oracle: getNextAccount(),
1686
- admin: getNextAccount(),
1687
- payer: getNextAccount(),
1688
- systemProgram: getNextAccount()
1689
- },
1690
- data: getInitializeOracleInstructionDataDecoder().decode(instruction.data)
1691
- };
1692
- }
1693
- var INITIALIZE_POOL_DISCRIMINATOR = new Uint8Array([
1694
- 95,
1695
- 180,
1696
- 10,
1697
- 172,
1698
- 84,
1699
- 174,
1700
- 232,
1701
- 40
1702
- ]);
1703
- function getInitializePoolDiscriminatorBytes() {
1704
- return fixEncoderSize(getBytesEncoder(), 8).encode(
1705
- INITIALIZE_POOL_DISCRIMINATOR
1706
- );
1707
- }
1708
- function getInitializePoolInstructionDataEncoder() {
1709
- return transformEncoder(
1710
- getStructEncoder([
1711
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
1712
- ["mintA", getAddressEncoder()],
1713
- ["mintB", getAddressEncoder()],
1714
- ["initialSwapFeeBps", getU16Encoder()],
1715
- ["initialFeeSplitBps", getU16Encoder()],
1716
- ["liquidityMeasureTokenIndex", getU8Encoder()],
1717
- ["numeraireMintOverride", getOptionEncoder(getAddressEncoder())],
1718
- ["hookProgram", getAddressEncoder()],
1719
- ["hookFlags", getU32Encoder()]
1720
- ]),
1721
- (value) => ({ ...value, discriminator: INITIALIZE_POOL_DISCRIMINATOR })
1722
- );
1723
- }
1724
- function getInitializePoolInstructionDataDecoder() {
1725
- return getStructDecoder([
1726
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
1727
- ["mintA", getAddressDecoder()],
1728
- ["mintB", getAddressDecoder()],
1729
- ["initialSwapFeeBps", getU16Decoder()],
1730
- ["initialFeeSplitBps", getU16Decoder()],
1731
- ["liquidityMeasureTokenIndex", getU8Decoder()],
1732
- ["numeraireMintOverride", getOptionDecoder(getAddressDecoder())],
1733
- ["hookProgram", getAddressDecoder()],
1734
- ["hookFlags", getU32Decoder()]
1735
- ]);
1736
- }
1737
- function getInitializePoolInstructionDataCodec() {
1738
- return combineCodec(
1739
- getInitializePoolInstructionDataEncoder(),
1740
- getInitializePoolInstructionDataDecoder()
1741
- );
1742
- }
1743
- async function getInitializePoolInstructionAsync(input, config) {
1744
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1745
- const originalAccounts = {
1746
- config: { value: input.config ?? null, isWritable: false },
1747
- pool: { value: input.pool ?? null, isWritable: true },
1748
- protocolFeePosition: {
1749
- value: input.protocolFeePosition ?? null,
1750
- isWritable: true
1751
- },
1752
- authority: { value: input.authority ?? null, isWritable: false },
1753
- vault0: { value: input.vault0 ?? null, isWritable: true },
1754
- vault1: { value: input.vault1 ?? null, isWritable: true },
1755
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1756
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1757
- payer: { value: input.payer ?? null, isWritable: true },
1758
- token0Program: { value: input.token0Program ?? null, isWritable: false },
1759
- token1Program: { value: input.token1Program ?? null, isWritable: false },
1760
- systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1761
- rent: { value: input.rent ?? null, isWritable: false },
1762
- migrationAuthority: {
1763
- value: input.migrationAuthority ?? null,
1764
- isWritable: false
1765
- }
1766
- };
1767
- const accounts = originalAccounts;
1768
- const args = { ...input };
1769
- if (!accounts.pool.value) {
1770
- accounts.pool.value = await getProgramDerivedAddress({
1771
- programAddress,
1772
- seeds: [
1773
- getBytesEncoder().encode(new Uint8Array([112, 111, 111, 108])),
1774
- getAddressEncoder().encode(
1775
- getAddressFromResolvedInstructionAccount(
1776
- "token0Mint",
1777
- accounts.token0Mint.value
1778
- )
1779
- ),
1780
- getAddressEncoder().encode(
1781
- getAddressFromResolvedInstructionAccount(
1782
- "token1Mint",
1783
- accounts.token1Mint.value
1784
- )
1785
- )
1786
- ]
1787
- });
1788
- }
1789
- if (!accounts.protocolFeePosition.value) {
1790
- accounts.protocolFeePosition.value = await getProgramDerivedAddress({
1791
- programAddress,
1792
- seeds: [
1793
- getBytesEncoder().encode(
1794
- new Uint8Array([
1795
- 112,
1796
- 114,
1797
- 111,
1798
- 116,
1799
- 111,
1800
- 99,
1801
- 111,
1802
- 108,
1803
- 95,
1804
- 112,
1805
- 111,
1806
- 115,
1807
- 105,
1808
- 116,
1809
- 105,
1810
- 111,
1811
- 110
1812
- ])
1813
- ),
1814
- getAddressEncoder().encode(
1815
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1816
- )
1817
- ]
1818
- });
1819
- }
1820
- if (!accounts.authority.value) {
1821
- accounts.authority.value = await getProgramDerivedAddress({
1822
- programAddress,
1823
- seeds: [
1824
- getBytesEncoder().encode(
1825
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
1826
- ),
1827
- getAddressEncoder().encode(
1828
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1829
- )
1830
- ]
1831
- });
1832
- }
1833
- if (!accounts.vault0.value) {
1834
- accounts.vault0.value = await getProgramDerivedAddress({
1835
- programAddress,
1836
- seeds: [
1837
- getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 48])),
1838
- getAddressEncoder().encode(
1839
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1840
- )
1841
- ]
1842
- });
1843
- }
1844
- if (!accounts.vault1.value) {
1845
- accounts.vault1.value = await getProgramDerivedAddress({
1846
- programAddress,
1847
- seeds: [
1848
- getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 49])),
1849
- getAddressEncoder().encode(
1850
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1851
- )
1852
- ]
1853
- });
1854
- }
1855
- if (!accounts.systemProgram.value) {
1856
- accounts.systemProgram.value = "11111111111111111111111111111111";
1857
- }
1858
- if (!accounts.rent.value) {
1859
- accounts.rent.value = "SysvarRent111111111111111111111111111111111";
1860
- }
1861
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1862
- return Object.freeze({
1863
- accounts: [
1864
- getAccountMeta("config", accounts.config),
1865
- getAccountMeta("pool", accounts.pool),
1866
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1867
- getAccountMeta("authority", accounts.authority),
1868
- getAccountMeta("vault0", accounts.vault0),
1869
- getAccountMeta("vault1", accounts.vault1),
1870
- getAccountMeta("token0Mint", accounts.token0Mint),
1871
- getAccountMeta("token1Mint", accounts.token1Mint),
1872
- getAccountMeta("payer", accounts.payer),
1873
- getAccountMeta("token0Program", accounts.token0Program),
1874
- getAccountMeta("token1Program", accounts.token1Program),
1875
- getAccountMeta("systemProgram", accounts.systemProgram),
1876
- getAccountMeta("rent", accounts.rent),
1877
- getAccountMeta("migrationAuthority", accounts.migrationAuthority)
1878
- ],
1879
- data: getInitializePoolInstructionDataEncoder().encode(
1880
- args
1881
- ),
1882
- programAddress
1883
- });
1884
- }
1885
- function getInitializePoolInstruction(input, config) {
1886
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1887
- const originalAccounts = {
1888
- config: { value: input.config ?? null, isWritable: false },
1889
- pool: { value: input.pool ?? null, isWritable: true },
1890
- protocolFeePosition: {
1891
- value: input.protocolFeePosition ?? null,
1892
- isWritable: true
1893
- },
1894
- authority: { value: input.authority ?? null, isWritable: false },
1895
- vault0: { value: input.vault0 ?? null, isWritable: true },
1896
- vault1: { value: input.vault1 ?? null, isWritable: true },
1897
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1898
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1899
- payer: { value: input.payer ?? null, isWritable: true },
1900
- token0Program: { value: input.token0Program ?? null, isWritable: false },
1901
- token1Program: { value: input.token1Program ?? null, isWritable: false },
1902
- systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1903
- rent: { value: input.rent ?? null, isWritable: false },
1904
- migrationAuthority: {
1905
- value: input.migrationAuthority ?? null,
1906
- isWritable: false
1907
- }
1908
- };
1909
- const accounts = originalAccounts;
1910
- const args = { ...input };
1911
- if (!accounts.systemProgram.value) {
1912
- accounts.systemProgram.value = "11111111111111111111111111111111";
1913
- }
1914
- if (!accounts.rent.value) {
1915
- accounts.rent.value = "SysvarRent111111111111111111111111111111111";
1916
- }
1917
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1918
- return Object.freeze({
1919
- accounts: [
1920
- getAccountMeta("config", accounts.config),
1921
- getAccountMeta("pool", accounts.pool),
1922
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
1923
- getAccountMeta("authority", accounts.authority),
1924
- getAccountMeta("vault0", accounts.vault0),
1925
- getAccountMeta("vault1", accounts.vault1),
1926
- getAccountMeta("token0Mint", accounts.token0Mint),
1927
- getAccountMeta("token1Mint", accounts.token1Mint),
1928
- getAccountMeta("payer", accounts.payer),
1929
- getAccountMeta("token0Program", accounts.token0Program),
1930
- getAccountMeta("token1Program", accounts.token1Program),
1931
- getAccountMeta("systemProgram", accounts.systemProgram),
1932
- getAccountMeta("rent", accounts.rent),
1933
- getAccountMeta("migrationAuthority", accounts.migrationAuthority)
1934
- ],
1935
- data: getInitializePoolInstructionDataEncoder().encode(
1936
- args
1937
- ),
1938
- programAddress
1939
- });
1940
- }
1941
- function parseInitializePoolInstruction(instruction) {
1942
- if (instruction.accounts.length < 14) {
1943
- throw new SolanaError(
1944
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1945
- {
1946
- actualAccountMetas: instruction.accounts.length,
1947
- expectedAccountMetas: 14
1948
- }
1949
- );
1950
- }
1951
- let accountIndex = 0;
1952
- const getNextAccount = () => {
1953
- const accountMeta = instruction.accounts[accountIndex];
1954
- accountIndex += 1;
1955
- return accountMeta;
1956
- };
1957
- return {
1958
- programAddress: instruction.programAddress,
1959
- accounts: {
1960
- config: getNextAccount(),
1961
- pool: getNextAccount(),
1962
- protocolFeePosition: getNextAccount(),
1963
- authority: getNextAccount(),
1964
- vault0: getNextAccount(),
1965
- vault1: getNextAccount(),
1966
- token0Mint: getNextAccount(),
1967
- token1Mint: getNextAccount(),
1968
- payer: getNextAccount(),
1969
- token0Program: getNextAccount(),
1970
- token1Program: getNextAccount(),
1971
- systemProgram: getNextAccount(),
1972
- rent: getNextAccount(),
1973
- migrationAuthority: getNextAccount()
1974
- },
1975
- data: getInitializePoolInstructionDataDecoder().decode(instruction.data)
1976
- };
1977
- }
1978
- var ORACLE_CONSULT_DISCRIMINATOR = new Uint8Array([
1979
- 239,
1980
- 237,
1981
- 255,
1982
- 177,
1983
- 142,
1984
- 72,
1985
- 96,
1986
- 175
1987
- ]);
1988
- function getOracleConsultDiscriminatorBytes() {
1989
- return fixEncoderSize(getBytesEncoder(), 8).encode(
1990
- ORACLE_CONSULT_DISCRIMINATOR
1991
- );
1992
- }
1993
- function getOracleConsultInstructionDataEncoder() {
1994
- return transformEncoder(
1995
- getStructEncoder([
1996
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
1997
- ["windowSeconds", getU32Encoder()]
1998
- ]),
1999
- (value) => ({ ...value, discriminator: ORACLE_CONSULT_DISCRIMINATOR })
2000
- );
2001
- }
2002
- function getOracleConsultInstructionDataDecoder() {
2003
- return getStructDecoder([
2004
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2005
- ["windowSeconds", getU32Decoder()]
2006
- ]);
2007
- }
2008
- function getOracleConsultInstructionDataCodec() {
2009
- return combineCodec(
2010
- getOracleConsultInstructionDataEncoder(),
2011
- getOracleConsultInstructionDataDecoder()
2012
- );
2013
- }
2014
- async function getOracleConsultInstructionAsync(input, config) {
2015
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2016
- const originalAccounts = {
2017
- pool: { value: input.pool ?? null, isWritable: false },
2018
- oracle: { value: input.oracle ?? null, isWritable: false }
2019
- };
2020
- const accounts = originalAccounts;
2021
- const args = { ...input };
2022
- if (!accounts.oracle.value) {
2023
- accounts.oracle.value = await getProgramDerivedAddress({
2024
- programAddress,
2025
- seeds: [
2026
- getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
2027
- getAddressEncoder().encode(
2028
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2029
- )
2030
- ]
2031
- });
2032
- }
2033
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2034
- return Object.freeze({
2035
- accounts: [
2036
- getAccountMeta("pool", accounts.pool),
2037
- getAccountMeta("oracle", accounts.oracle)
2038
- ],
2039
- data: getOracleConsultInstructionDataEncoder().encode(
2040
- args
2041
- ),
2042
- programAddress
2043
- });
2044
- }
2045
- function getOracleConsultInstruction(input, config) {
2046
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2047
- const originalAccounts = {
2048
- pool: { value: input.pool ?? null, isWritable: false },
2049
- oracle: { value: input.oracle ?? null, isWritable: false }
2050
- };
2051
- const accounts = originalAccounts;
2052
- const args = { ...input };
2053
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2054
- return Object.freeze({
2055
- accounts: [
2056
- getAccountMeta("pool", accounts.pool),
2057
- getAccountMeta("oracle", accounts.oracle)
2058
- ],
2059
- data: getOracleConsultInstructionDataEncoder().encode(
2060
- args
2061
- ),
2062
- programAddress
2063
- });
2064
- }
2065
- function parseOracleConsultInstruction(instruction) {
2066
- if (instruction.accounts.length < 2) {
2067
- throw new SolanaError(
2068
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2069
- {
2070
- actualAccountMetas: instruction.accounts.length,
2071
- expectedAccountMetas: 2
2072
- }
2073
- );
2074
- }
2075
- let accountIndex = 0;
2076
- const getNextAccount = () => {
2077
- const accountMeta = instruction.accounts[accountIndex];
2078
- accountIndex += 1;
2079
- return accountMeta;
2080
- };
2081
- return {
2082
- programAddress: instruction.programAddress,
2083
- accounts: { pool: getNextAccount(), oracle: getNextAccount() },
2084
- data: getOracleConsultInstructionDataDecoder().decode(instruction.data)
2085
- };
2086
- }
2087
- var ORACLE_UPDATE_DISCRIMINATOR = new Uint8Array([
2088
- 85,
2089
- 209,
2090
- 248,
2091
- 142,
2092
- 186,
2093
- 249,
2094
- 120,
2095
- 239
2096
- ]);
2097
- function getOracleUpdateDiscriminatorBytes() {
2098
- return fixEncoderSize(getBytesEncoder(), 8).encode(
2099
- ORACLE_UPDATE_DISCRIMINATOR
2100
- );
2101
- }
2102
- function getOracleUpdateInstructionDataEncoder() {
2103
- return transformEncoder(
2104
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
2105
- (value) => ({ ...value, discriminator: ORACLE_UPDATE_DISCRIMINATOR })
2106
- );
2107
- }
2108
- function getOracleUpdateInstructionDataDecoder() {
2109
- return getStructDecoder([
2110
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
2111
- ]);
2112
- }
2113
- function getOracleUpdateInstructionDataCodec() {
2114
- return combineCodec(
2115
- getOracleUpdateInstructionDataEncoder(),
2116
- getOracleUpdateInstructionDataDecoder()
2117
- );
2118
- }
2119
- async function getOracleUpdateInstructionAsync(input, config) {
2120
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2121
- const originalAccounts = {
2122
- pool: { value: input.pool ?? null, isWritable: false },
2123
- oracle: { value: input.oracle ?? null, isWritable: true }
2124
- };
2125
- const accounts = originalAccounts;
2126
- if (!accounts.oracle.value) {
2127
- accounts.oracle.value = await getProgramDerivedAddress({
2128
- programAddress,
2129
- seeds: [
2130
- getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
2131
- getAddressEncoder().encode(
2132
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2133
- )
2134
- ]
2135
- });
2136
- }
2137
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2138
- return Object.freeze({
2139
- accounts: [
2140
- getAccountMeta("pool", accounts.pool),
2141
- getAccountMeta("oracle", accounts.oracle)
2142
- ],
2143
- data: getOracleUpdateInstructionDataEncoder().encode({}),
2144
- programAddress
2145
- });
2146
- }
2147
- function getOracleUpdateInstruction(input, config) {
2148
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2149
- const originalAccounts = {
2150
- pool: { value: input.pool ?? null, isWritable: false },
2151
- oracle: { value: input.oracle ?? null, isWritable: true }
2152
- };
2153
- const accounts = originalAccounts;
2154
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2155
- return Object.freeze({
2156
- accounts: [
2157
- getAccountMeta("pool", accounts.pool),
2158
- getAccountMeta("oracle", accounts.oracle)
2159
- ],
2160
- data: getOracleUpdateInstructionDataEncoder().encode({}),
2161
- programAddress
2162
- });
2163
- }
2164
- function parseOracleUpdateInstruction(instruction) {
2165
- if (instruction.accounts.length < 2) {
2166
- throw new SolanaError(
2167
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2168
- {
2169
- actualAccountMetas: instruction.accounts.length,
2170
- expectedAccountMetas: 2
2171
- }
2172
- );
2173
- }
2174
- let accountIndex = 0;
2175
- const getNextAccount = () => {
2176
- const accountMeta = instruction.accounts[accountIndex];
2177
- accountIndex += 1;
2178
- return accountMeta;
2179
- };
2180
- return {
2181
- programAddress: instruction.programAddress,
2182
- accounts: { pool: getNextAccount(), oracle: getNextAccount() },
2183
- data: getOracleUpdateInstructionDataDecoder().decode(instruction.data)
2184
- };
2185
- }
2186
- var PAUSE_DISCRIMINATOR = new Uint8Array([
2187
- 211,
2188
- 22,
2189
- 221,
2190
- 251,
2191
- 74,
2192
- 121,
2193
- 193,
2194
- 47
2195
- ]);
2196
- function getPauseDiscriminatorBytes() {
2197
- return fixEncoderSize(getBytesEncoder(), 8).encode(PAUSE_DISCRIMINATOR);
2198
- }
2199
- function getPauseInstructionDataEncoder() {
2200
- return transformEncoder(
2201
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
2202
- (value) => ({ ...value, discriminator: PAUSE_DISCRIMINATOR })
2203
- );
2204
- }
2205
- function getPauseInstructionDataDecoder() {
2206
- return getStructDecoder([
2207
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
2208
- ]);
2209
- }
2210
- function getPauseInstructionDataCodec() {
2211
- return combineCodec(
2212
- getPauseInstructionDataEncoder(),
2213
- getPauseInstructionDataDecoder()
2214
- );
2215
- }
2216
- function getPauseInstruction(input, config) {
2217
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2218
- const originalAccounts = {
2219
- config: { value: input.config ?? null, isWritable: true },
2220
- admin: { value: input.admin ?? null, isWritable: false }
2221
- };
2222
- const accounts = originalAccounts;
2223
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2224
- return Object.freeze({
2225
- accounts: [
2226
- getAccountMeta("config", accounts.config),
2227
- getAccountMeta("admin", accounts.admin)
2228
- ],
2229
- data: getPauseInstructionDataEncoder().encode({}),
2230
- programAddress
2231
- });
2232
- }
2233
- function parsePauseInstruction(instruction) {
2234
- if (instruction.accounts.length < 2) {
2235
- throw new SolanaError(
2236
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2237
- {
2238
- actualAccountMetas: instruction.accounts.length,
2239
- expectedAccountMetas: 2
2240
- }
2241
- );
2242
- }
2243
- let accountIndex = 0;
2244
- const getNextAccount = () => {
2245
- const accountMeta = instruction.accounts[accountIndex];
2246
- accountIndex += 1;
2247
- return accountMeta;
2248
- };
2249
- return {
2250
- programAddress: instruction.programAddress,
2251
- accounts: { config: getNextAccount(), admin: getNextAccount() },
2252
- data: getPauseInstructionDataDecoder().decode(instruction.data)
2253
- };
2254
- }
2255
- var PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
2256
- 50,
2257
- 130,
2258
- 31,
2259
- 69,
2260
- 147,
2261
- 58,
2262
- 222,
2263
- 178
2264
- ]);
2265
- function getPreviewSwapExactInDiscriminatorBytes() {
2266
- return fixEncoderSize(getBytesEncoder(), 8).encode(
2267
- PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
2268
- );
2269
- }
2270
- function getPreviewSwapExactInInstructionDataEncoder() {
2271
- return transformEncoder(
2272
- getStructEncoder([
2273
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2274
- ["amountIn", getU64Encoder()],
2275
- ["tradeDirection", getU8Encoder()]
2276
- ]),
2277
- (value) => ({
2278
- ...value,
2279
- discriminator: PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
2280
- })
2281
- );
2282
- }
2283
- function getPreviewSwapExactInInstructionDataDecoder() {
2284
- return getStructDecoder([
2285
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2286
- ["amountIn", getU64Decoder()],
2287
- ["tradeDirection", getU8Decoder()]
2288
- ]);
2289
- }
2290
- function getPreviewSwapExactInInstructionDataCodec() {
2291
- return combineCodec(
2292
- getPreviewSwapExactInInstructionDataEncoder(),
2293
- getPreviewSwapExactInInstructionDataDecoder()
2294
- );
2295
- }
2296
- function getPreviewSwapExactInInstruction(input, config) {
2297
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2298
- const originalAccounts = {
2299
- config: { value: input.config ?? null, isWritable: false },
2300
- pool: { value: input.pool ?? null, isWritable: false }
2301
- };
2302
- const accounts = originalAccounts;
2303
- const args = { ...input };
2304
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2305
- return Object.freeze({
2306
- accounts: [
2307
- getAccountMeta("config", accounts.config),
2308
- getAccountMeta("pool", accounts.pool)
2309
- ],
2310
- data: getPreviewSwapExactInInstructionDataEncoder().encode(
2311
- args
2312
- ),
2313
- programAddress
2314
- });
2315
- }
2316
- function parsePreviewSwapExactInInstruction(instruction) {
2317
- if (instruction.accounts.length < 2) {
2318
- throw new SolanaError(
2319
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2320
- {
2321
- actualAccountMetas: instruction.accounts.length,
2322
- expectedAccountMetas: 2
2323
- }
2324
- );
2325
- }
2326
- let accountIndex = 0;
2327
- const getNextAccount = () => {
2328
- const accountMeta = instruction.accounts[accountIndex];
2329
- accountIndex += 1;
2330
- return accountMeta;
2331
- };
2332
- return {
2333
- programAddress: instruction.programAddress,
2334
- accounts: { config: getNextAccount(), pool: getNextAccount() },
2335
- data: getPreviewSwapExactInInstructionDataDecoder().decode(
2336
- instruction.data
2337
- )
2338
- };
2339
- }
2340
- var QUOTE_TO_NUMERAIRE_DISCRIMINATOR = new Uint8Array([
2341
- 4,
2342
- 142,
2343
- 249,
2344
- 240,
2345
- 129,
2346
- 15,
2347
- 143,
2348
- 57
2349
- ]);
2350
- function getQuoteToNumeraireDiscriminatorBytes() {
2351
- return fixEncoderSize(getBytesEncoder(), 8).encode(
2352
- QUOTE_TO_NUMERAIRE_DISCRIMINATOR
2353
- );
2354
- }
2355
- function getQuoteToNumeraireInstructionDataEncoder() {
2356
- return transformEncoder(
2357
- getStructEncoder([
2358
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2359
- ["amount", getU128Encoder()],
2360
- ["inputTokenIndex", getU8Encoder()],
2361
- ["maxHops", getU8Encoder()],
2362
- ["useTwap", getBooleanEncoder()],
2363
- ["windowSeconds", getU32Encoder()]
2364
- ]),
2365
- (value) => ({ ...value, discriminator: QUOTE_TO_NUMERAIRE_DISCRIMINATOR })
2366
- );
2367
- }
2368
- function getQuoteToNumeraireInstructionDataDecoder() {
2369
- return getStructDecoder([
2370
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2371
- ["amount", getU128Decoder()],
2372
- ["inputTokenIndex", getU8Decoder()],
2373
- ["maxHops", getU8Decoder()],
2374
- ["useTwap", getBooleanDecoder()],
2375
- ["windowSeconds", getU32Decoder()]
2376
- ]);
2377
- }
2378
- function getQuoteToNumeraireInstructionDataCodec() {
2379
- return combineCodec(
2380
- getQuoteToNumeraireInstructionDataEncoder(),
2381
- getQuoteToNumeraireInstructionDataDecoder()
2382
- );
2383
- }
2384
- function getQuoteToNumeraireInstruction(input, config) {
2385
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2386
- const originalAccounts = {
2387
- config: { value: input.config ?? null, isWritable: false },
2388
- startPool: { value: input.startPool ?? null, isWritable: false }
2389
- };
2390
- const accounts = originalAccounts;
2391
- const args = { ...input };
2392
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2393
- return Object.freeze({
2394
- accounts: [
2395
- getAccountMeta("config", accounts.config),
2396
- getAccountMeta("startPool", accounts.startPool)
2397
- ],
2398
- data: getQuoteToNumeraireInstructionDataEncoder().encode(
2399
- args
2400
- ),
2401
- programAddress
2402
- });
2403
- }
2404
- function parseQuoteToNumeraireInstruction(instruction) {
2405
- if (instruction.accounts.length < 2) {
2406
- throw new SolanaError(
2407
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2408
- {
2409
- actualAccountMetas: instruction.accounts.length,
2410
- expectedAccountMetas: 2
2411
- }
2412
- );
2413
- }
2414
- let accountIndex = 0;
2415
- const getNextAccount = () => {
2416
- const accountMeta = instruction.accounts[accountIndex];
2417
- accountIndex += 1;
2418
- return accountMeta;
2419
- };
2420
- return {
2421
- programAddress: instruction.programAddress,
2422
- accounts: { config: getNextAccount(), startPool: getNextAccount() },
2423
- data: getQuoteToNumeraireInstructionDataDecoder().decode(instruction.data)
2424
- };
2425
- }
2426
- var REMOVE_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
2427
- 80,
2428
- 85,
2429
- 209,
2430
- 72,
2431
- 24,
2432
- 206,
2433
- 177,
2434
- 108
2435
- ]);
2436
- function getRemoveLiquidityDiscriminatorBytes() {
2437
- return fixEncoderSize(getBytesEncoder(), 8).encode(
2438
- REMOVE_LIQUIDITY_DISCRIMINATOR
2439
- );
2440
- }
2441
- function getRemoveLiquidityInstructionDataEncoder() {
2442
- return transformEncoder(
2443
- getStructEncoder([
2444
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2445
- ["sharesIn", getU128Encoder()],
2446
- ["minAmount0Out", getU64Encoder()],
2447
- ["minAmount1Out", getU64Encoder()],
2448
- ["updateOracle", getBooleanEncoder()]
2449
- ]),
2450
- (value) => ({ ...value, discriminator: REMOVE_LIQUIDITY_DISCRIMINATOR })
2451
- );
2452
- }
2453
- function getRemoveLiquidityInstructionDataDecoder() {
2454
- return getStructDecoder([
2455
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2456
- ["sharesIn", getU128Decoder()],
2457
- ["minAmount0Out", getU64Decoder()],
2458
- ["minAmount1Out", getU64Decoder()],
2459
- ["updateOracle", getBooleanDecoder()]
2460
- ]);
2461
- }
2462
- function getRemoveLiquidityInstructionDataCodec() {
2463
- return combineCodec(
2464
- getRemoveLiquidityInstructionDataEncoder(),
2465
- getRemoveLiquidityInstructionDataDecoder()
2466
- );
2467
- }
2468
- async function getRemoveLiquidityInstructionAsync(input, config) {
2469
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2470
- const originalAccounts = {
2471
- config: { value: input.config ?? null, isWritable: false },
2472
- pool: { value: input.pool ?? null, isWritable: true },
2473
- position: { value: input.position ?? null, isWritable: true },
2474
- protocolFeePosition: {
2475
- value: input.protocolFeePosition ?? null,
2476
- isWritable: true
2477
- },
2478
- owner: { value: input.owner ?? null, isWritable: false },
2479
- authority: { value: input.authority ?? null, isWritable: false },
2480
- vault0: { value: input.vault0 ?? null, isWritable: true },
2481
- vault1: { value: input.vault1 ?? null, isWritable: true },
2482
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2483
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2484
- user0: { value: input.user0 ?? null, isWritable: true },
2485
- user1: { value: input.user1 ?? null, isWritable: true },
2486
- token0Program: { value: input.token0Program ?? null, isWritable: false },
2487
- token1Program: { value: input.token1Program ?? null, isWritable: false },
2488
- oracle: { value: input.oracle ?? null, isWritable: true }
2489
- };
2490
- const accounts = originalAccounts;
2491
- const args = { ...input };
2492
- if (!accounts.authority.value) {
2493
- accounts.authority.value = await getProgramDerivedAddress({
2494
- programAddress,
2495
- seeds: [
2496
- getBytesEncoder().encode(
2497
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2498
- ),
2499
- getAddressEncoder().encode(
2500
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2501
- )
2502
- ]
2503
- });
2504
- }
2505
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2506
- return Object.freeze({
2507
- accounts: [
2508
- getAccountMeta("config", accounts.config),
2509
- getAccountMeta("pool", accounts.pool),
2510
- getAccountMeta("position", accounts.position),
2511
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2512
- getAccountMeta("owner", accounts.owner),
2513
- getAccountMeta("authority", accounts.authority),
2514
- getAccountMeta("vault0", accounts.vault0),
2515
- getAccountMeta("vault1", accounts.vault1),
2516
- getAccountMeta("token0Mint", accounts.token0Mint),
2517
- getAccountMeta("token1Mint", accounts.token1Mint),
2518
- getAccountMeta("user0", accounts.user0),
2519
- getAccountMeta("user1", accounts.user1),
2520
- getAccountMeta("token0Program", accounts.token0Program),
2521
- getAccountMeta("token1Program", accounts.token1Program),
2522
- getAccountMeta("oracle", accounts.oracle)
2523
- ],
2524
- data: getRemoveLiquidityInstructionDataEncoder().encode(
2525
- args
2526
- ),
2527
- programAddress
2528
- });
2529
- }
2530
- function getRemoveLiquidityInstruction(input, config) {
2531
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2532
- const originalAccounts = {
2533
- config: { value: input.config ?? null, isWritable: false },
2534
- pool: { value: input.pool ?? null, isWritable: true },
2535
- position: { value: input.position ?? null, isWritable: true },
2536
- protocolFeePosition: {
2537
- value: input.protocolFeePosition ?? null,
2538
- isWritable: true
2539
- },
2540
- owner: { value: input.owner ?? null, isWritable: false },
2541
- authority: { value: input.authority ?? null, isWritable: false },
2542
- vault0: { value: input.vault0 ?? null, isWritable: true },
2543
- vault1: { value: input.vault1 ?? null, isWritable: true },
2544
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2545
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2546
- user0: { value: input.user0 ?? null, isWritable: true },
2547
- user1: { value: input.user1 ?? null, isWritable: true },
2548
- token0Program: { value: input.token0Program ?? null, isWritable: false },
2549
- token1Program: { value: input.token1Program ?? null, isWritable: false },
2550
- oracle: { value: input.oracle ?? null, isWritable: true }
2551
- };
2552
- const accounts = originalAccounts;
2553
- const args = { ...input };
2554
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2555
- return Object.freeze({
2556
- accounts: [
2557
- getAccountMeta("config", accounts.config),
2558
- getAccountMeta("pool", accounts.pool),
2559
- getAccountMeta("position", accounts.position),
2560
- getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2561
- getAccountMeta("owner", accounts.owner),
2562
- getAccountMeta("authority", accounts.authority),
2563
- getAccountMeta("vault0", accounts.vault0),
2564
- getAccountMeta("vault1", accounts.vault1),
2565
- getAccountMeta("token0Mint", accounts.token0Mint),
2566
- getAccountMeta("token1Mint", accounts.token1Mint),
2567
- getAccountMeta("user0", accounts.user0),
2568
- getAccountMeta("user1", accounts.user1),
2569
- getAccountMeta("token0Program", accounts.token0Program),
2570
- getAccountMeta("token1Program", accounts.token1Program),
2571
- getAccountMeta("oracle", accounts.oracle)
2572
- ],
2573
- data: getRemoveLiquidityInstructionDataEncoder().encode(
2574
- args
2575
- ),
2576
- programAddress
2577
- });
2578
- }
2579
- function parseRemoveLiquidityInstruction(instruction) {
2580
- if (instruction.accounts.length < 15) {
2581
- throw new SolanaError(
2582
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2583
- {
2584
- actualAccountMetas: instruction.accounts.length,
2585
- expectedAccountMetas: 15
2586
- }
2587
- );
2588
- }
2589
- let accountIndex = 0;
2590
- const getNextAccount = () => {
2591
- const accountMeta = instruction.accounts[accountIndex];
2592
- accountIndex += 1;
2593
- return accountMeta;
2594
- };
2595
- const getNextOptionalAccount = () => {
2596
- const accountMeta = getNextAccount();
2597
- return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
2598
- };
2599
- return {
2600
- programAddress: instruction.programAddress,
2601
- accounts: {
2602
- config: getNextAccount(),
2603
- pool: getNextAccount(),
2604
- position: getNextAccount(),
2605
- protocolFeePosition: getNextAccount(),
2606
- owner: getNextAccount(),
2607
- authority: getNextAccount(),
2608
- vault0: getNextAccount(),
2609
- vault1: getNextAccount(),
2610
- token0Mint: getNextAccount(),
2611
- token1Mint: getNextAccount(),
2612
- user0: getNextAccount(),
2613
- user1: getNextAccount(),
2614
- token0Program: getNextAccount(),
2615
- token1Program: getNextAccount(),
2616
- oracle: getNextOptionalAccount()
2617
- },
2618
- data: getRemoveLiquidityInstructionDataDecoder().decode(instruction.data)
2619
- };
2620
- }
2621
- var SET_FEES_DISCRIMINATOR = new Uint8Array([
2622
- 137,
2623
- 178,
2624
- 49,
2625
- 58,
2626
- 0,
2627
- 245,
2628
- 242,
2629
- 190
2630
- ]);
2631
- function getSetFeesDiscriminatorBytes() {
2632
- return fixEncoderSize(getBytesEncoder(), 8).encode(SET_FEES_DISCRIMINATOR);
2633
- }
2634
- function getSetFeesInstructionDataEncoder() {
2635
- return transformEncoder(
2636
- getStructEncoder([
2637
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2638
- ["swapFeeBps", getU16Encoder()],
2639
- ["feeSplitBps", getU16Encoder()]
2640
- ]),
2641
- (value) => ({ ...value, discriminator: SET_FEES_DISCRIMINATOR })
2642
- );
2643
- }
2644
- function getSetFeesInstructionDataDecoder() {
2645
- return getStructDecoder([
2646
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2647
- ["swapFeeBps", getU16Decoder()],
2648
- ["feeSplitBps", getU16Decoder()]
2649
- ]);
2650
- }
2651
- function getSetFeesInstructionDataCodec() {
2652
- return combineCodec(
2653
- getSetFeesInstructionDataEncoder(),
2654
- getSetFeesInstructionDataDecoder()
2655
- );
2656
- }
2657
- function getSetFeesInstruction(input, config) {
2658
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2659
- const originalAccounts = {
2660
- config: { value: input.config ?? null, isWritable: false },
2661
- pool: { value: input.pool ?? null, isWritable: true },
2662
- admin: { value: input.admin ?? null, isWritable: false }
2663
- };
2664
- const accounts = originalAccounts;
2665
- const args = { ...input };
2666
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2667
- return Object.freeze({
2668
- accounts: [
2669
- getAccountMeta("config", accounts.config),
2670
- getAccountMeta("pool", accounts.pool),
2671
- getAccountMeta("admin", accounts.admin)
2672
- ],
2673
- data: getSetFeesInstructionDataEncoder().encode(
2674
- args
2675
- ),
2676
- programAddress
2677
- });
2678
- }
2679
- function parseSetFeesInstruction(instruction) {
2680
- if (instruction.accounts.length < 3) {
2681
- throw new SolanaError(
2682
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2683
- {
2684
- actualAccountMetas: instruction.accounts.length,
2685
- expectedAccountMetas: 3
2686
- }
2687
- );
2688
- }
2689
- let accountIndex = 0;
2690
- const getNextAccount = () => {
2691
- const accountMeta = instruction.accounts[accountIndex];
2692
- accountIndex += 1;
2693
- return accountMeta;
2694
- };
2695
- return {
2696
- programAddress: instruction.programAddress,
2697
- accounts: {
2698
- config: getNextAccount(),
2699
- pool: getNextAccount(),
2700
- admin: getNextAccount()
2701
- },
2702
- data: getSetFeesInstructionDataDecoder().decode(instruction.data)
2703
- };
2704
- }
2705
- var SET_HOOK_DISCRIMINATOR = new Uint8Array([
2706
- 175,
2707
- 16,
2708
- 187,
2709
- 252,
2710
- 19,
2711
- 54,
2712
- 111,
2713
- 221
2714
- ]);
2715
- function getSetHookDiscriminatorBytes() {
2716
- return fixEncoderSize(getBytesEncoder(), 8).encode(SET_HOOK_DISCRIMINATOR);
2717
- }
2718
- function getSetHookInstructionDataEncoder() {
2719
- return transformEncoder(
2720
- getStructEncoder([
2721
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2722
- ["hookProgram", getAddressEncoder()],
2723
- ["hookFlags", getU32Encoder()]
2724
- ]),
2725
- (value) => ({ ...value, discriminator: SET_HOOK_DISCRIMINATOR })
2726
- );
2727
- }
2728
- function getSetHookInstructionDataDecoder() {
2729
- return getStructDecoder([
2730
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2731
- ["hookProgram", getAddressDecoder()],
2732
- ["hookFlags", getU32Decoder()]
2733
- ]);
2734
- }
2735
- function getSetHookInstructionDataCodec() {
2736
- return combineCodec(
2737
- getSetHookInstructionDataEncoder(),
2738
- getSetHookInstructionDataDecoder()
2739
- );
2740
- }
2741
- function getSetHookInstruction(input, config) {
2742
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2743
- const originalAccounts = {
2744
- config: { value: input.config ?? null, isWritable: false },
2745
- pool: { value: input.pool ?? null, isWritable: true },
2746
- admin: { value: input.admin ?? null, isWritable: false }
2747
- };
2748
- const accounts = originalAccounts;
2749
- const args = { ...input };
2750
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2751
- return Object.freeze({
2752
- accounts: [
2753
- getAccountMeta("config", accounts.config),
2754
- getAccountMeta("pool", accounts.pool),
2755
- getAccountMeta("admin", accounts.admin)
2756
- ],
2757
- data: getSetHookInstructionDataEncoder().encode(
2758
- args
2759
- ),
2760
- programAddress
2761
- });
2762
- }
2763
- function parseSetHookInstruction(instruction) {
2764
- if (instruction.accounts.length < 3) {
2765
- throw new SolanaError(
2766
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2767
- {
2768
- actualAccountMetas: instruction.accounts.length,
2769
- expectedAccountMetas: 3
2770
- }
2771
- );
2772
- }
2773
- let accountIndex = 0;
2774
- const getNextAccount = () => {
2775
- const accountMeta = instruction.accounts[accountIndex];
2776
- accountIndex += 1;
2777
- return accountMeta;
2778
- };
2779
- return {
2780
- programAddress: instruction.programAddress,
2781
- accounts: {
2782
- config: getNextAccount(),
2783
- pool: getNextAccount(),
2784
- admin: getNextAccount()
2785
- },
2786
- data: getSetHookInstructionDataDecoder().decode(instruction.data)
2787
- };
2788
- }
2789
- var SET_ROUTE_DISCRIMINATOR = new Uint8Array([
2790
- 244,
2791
- 231,
2792
- 3,
2793
- 84,
2794
- 233,
2795
- 61,
2796
- 146,
2797
- 149
2798
- ]);
2799
- function getSetRouteDiscriminatorBytes() {
2800
- return fixEncoderSize(getBytesEncoder(), 8).encode(SET_ROUTE_DISCRIMINATOR);
2801
- }
2802
- function getSetRouteInstructionDataEncoder() {
2803
- return transformEncoder(
2804
- getStructEncoder([
2805
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2806
- ["routeNextPool", getAddressEncoder()],
2807
- ["routeBridgeMint", getAddressEncoder()]
2808
- ]),
2809
- (value) => ({ ...value, discriminator: SET_ROUTE_DISCRIMINATOR })
2810
- );
2811
- }
2812
- function getSetRouteInstructionDataDecoder() {
2813
- return getStructDecoder([
2814
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2815
- ["routeNextPool", getAddressDecoder()],
2816
- ["routeBridgeMint", getAddressDecoder()]
2817
- ]);
2818
- }
2819
- function getSetRouteInstructionDataCodec() {
2820
- return combineCodec(
2821
- getSetRouteInstructionDataEncoder(),
2822
- getSetRouteInstructionDataDecoder()
2823
- );
2824
- }
2825
- function getSetRouteInstruction(input, config) {
2826
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2827
- const originalAccounts = {
2828
- config: { value: input.config ?? null, isWritable: false },
2829
- pool: { value: input.pool ?? null, isWritable: true },
2830
- nextPool: { value: input.nextPool ?? null, isWritable: false },
2831
- admin: { value: input.admin ?? null, isWritable: false }
2832
- };
2833
- const accounts = originalAccounts;
2834
- const args = { ...input };
2835
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2836
- return Object.freeze({
2837
- accounts: [
2838
- getAccountMeta("config", accounts.config),
2839
- getAccountMeta("pool", accounts.pool),
2840
- getAccountMeta("nextPool", accounts.nextPool),
2841
- getAccountMeta("admin", accounts.admin)
2842
- ],
2843
- data: getSetRouteInstructionDataEncoder().encode(
2844
- args
2845
- ),
2846
- programAddress
2847
- });
2848
- }
2849
- function parseSetRouteInstruction(instruction) {
2850
- if (instruction.accounts.length < 4) {
2851
- throw new SolanaError(
2852
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2853
- {
2854
- actualAccountMetas: instruction.accounts.length,
2855
- expectedAccountMetas: 4
2856
- }
2857
- );
2858
- }
2859
- let accountIndex = 0;
2860
- const getNextAccount = () => {
2861
- const accountMeta = instruction.accounts[accountIndex];
2862
- accountIndex += 1;
2863
- return accountMeta;
2864
- };
2865
- const getNextOptionalAccount = () => {
2866
- const accountMeta = getNextAccount();
2867
- return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
2868
- };
2869
- return {
2870
- programAddress: instruction.programAddress,
2871
- accounts: {
2872
- config: getNextAccount(),
2873
- pool: getNextAccount(),
2874
- nextPool: getNextOptionalAccount(),
2875
- admin: getNextAccount()
2876
- },
2877
- data: getSetRouteInstructionDataDecoder().decode(instruction.data)
2878
- };
2879
- }
2880
- var SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
2881
- 104,
2882
- 104,
2883
- 131,
2884
- 86,
2885
- 161,
2886
- 189,
2887
- 180,
2888
- 216
2889
- ]);
2890
- function getSwapExactInDiscriminatorBytes() {
2891
- return fixEncoderSize(getBytesEncoder(), 8).encode(
2892
- SWAP_EXACT_IN_DISCRIMINATOR
2893
- );
2894
- }
2895
- function getSwapExactInInstructionDataEncoder() {
2896
- return transformEncoder(
2897
- getStructEncoder([
2898
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2899
- ["amountIn", getU64Encoder()],
2900
- ["minAmountOut", getU64Encoder()],
2901
- ["tradeDirection", getU8Encoder()],
2902
- ["updateOracle", getBooleanEncoder()]
2903
- ]),
2904
- (value) => ({ ...value, discriminator: SWAP_EXACT_IN_DISCRIMINATOR })
2905
- );
2906
- }
2907
- function getSwapExactInInstructionDataDecoder() {
2908
- return getStructDecoder([
2909
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2910
- ["amountIn", getU64Decoder()],
2911
- ["minAmountOut", getU64Decoder()],
2912
- ["tradeDirection", getU8Decoder()],
2913
- ["updateOracle", getBooleanDecoder()]
2914
- ]);
2915
- }
2916
- function getSwapExactInInstructionDataCodec() {
2917
- return combineCodec(
2918
- getSwapExactInInstructionDataEncoder(),
2919
- getSwapExactInInstructionDataDecoder()
2920
- );
2921
- }
2922
- async function getSwapExactInInstructionAsync(input, config) {
2923
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2924
- const originalAccounts = {
2925
- config: { value: input.config ?? null, isWritable: false },
2926
- pool: { value: input.pool ?? null, isWritable: true },
2927
- authority: { value: input.authority ?? null, isWritable: false },
2928
- vaultIn: { value: input.vaultIn ?? null, isWritable: true },
2929
- vaultOut: { value: input.vaultOut ?? null, isWritable: true },
2930
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2931
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2932
- userIn: { value: input.userIn ?? null, isWritable: true },
2933
- userOut: { value: input.userOut ?? null, isWritable: true },
2934
- trader: { value: input.trader ?? null, isWritable: false },
2935
- token0Program: { value: input.token0Program ?? null, isWritable: false },
2936
- token1Program: { value: input.token1Program ?? null, isWritable: false },
2937
- oracle: { value: input.oracle ?? null, isWritable: true }
2938
- };
2939
- const accounts = originalAccounts;
2940
- const args = { ...input };
2941
- if (!accounts.authority.value) {
2942
- accounts.authority.value = await getProgramDerivedAddress({
2943
- programAddress,
2944
- seeds: [
2945
- getBytesEncoder().encode(
2946
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2947
- ),
2948
- getAddressEncoder().encode(
2949
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2950
- )
2951
- ]
2952
- });
2953
- }
2954
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2955
- return Object.freeze({
2956
- accounts: [
2957
- getAccountMeta("config", accounts.config),
2958
- getAccountMeta("pool", accounts.pool),
2959
- getAccountMeta("authority", accounts.authority),
2960
- getAccountMeta("vaultIn", accounts.vaultIn),
2961
- getAccountMeta("vaultOut", accounts.vaultOut),
2962
- getAccountMeta("token0Mint", accounts.token0Mint),
2963
- getAccountMeta("token1Mint", accounts.token1Mint),
2964
- getAccountMeta("userIn", accounts.userIn),
2965
- getAccountMeta("userOut", accounts.userOut),
2966
- getAccountMeta("trader", accounts.trader),
2967
- getAccountMeta("token0Program", accounts.token0Program),
2968
- getAccountMeta("token1Program", accounts.token1Program),
2969
- getAccountMeta("oracle", accounts.oracle)
2970
- ],
2971
- data: getSwapExactInInstructionDataEncoder().encode(
2972
- args
2973
- ),
2974
- programAddress
2975
- });
2976
- }
2977
- function getSwapExactInInstruction(input, config) {
2978
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2979
- const originalAccounts = {
2980
- config: { value: input.config ?? null, isWritable: false },
2981
- pool: { value: input.pool ?? null, isWritable: true },
2982
- authority: { value: input.authority ?? null, isWritable: false },
2983
- vaultIn: { value: input.vaultIn ?? null, isWritable: true },
2984
- vaultOut: { value: input.vaultOut ?? null, isWritable: true },
2985
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2986
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2987
- userIn: { value: input.userIn ?? null, isWritable: true },
2988
- userOut: { value: input.userOut ?? null, isWritable: true },
2989
- trader: { value: input.trader ?? null, isWritable: false },
2990
- token0Program: { value: input.token0Program ?? null, isWritable: false },
2991
- token1Program: { value: input.token1Program ?? null, isWritable: false },
2992
- oracle: { value: input.oracle ?? null, isWritable: true }
2993
- };
2994
- const accounts = originalAccounts;
2995
- const args = { ...input };
2996
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2997
- return Object.freeze({
2998
- accounts: [
2999
- getAccountMeta("config", accounts.config),
3000
- getAccountMeta("pool", accounts.pool),
3001
- getAccountMeta("authority", accounts.authority),
3002
- getAccountMeta("vaultIn", accounts.vaultIn),
3003
- getAccountMeta("vaultOut", accounts.vaultOut),
3004
- getAccountMeta("token0Mint", accounts.token0Mint),
3005
- getAccountMeta("token1Mint", accounts.token1Mint),
3006
- getAccountMeta("userIn", accounts.userIn),
3007
- getAccountMeta("userOut", accounts.userOut),
3008
- getAccountMeta("trader", accounts.trader),
3009
- getAccountMeta("token0Program", accounts.token0Program),
3010
- getAccountMeta("token1Program", accounts.token1Program),
3011
- getAccountMeta("oracle", accounts.oracle)
3012
- ],
3013
- data: getSwapExactInInstructionDataEncoder().encode(
3014
- args
3015
- ),
3016
- programAddress
3017
- });
3018
- }
3019
- function parseSwapExactInInstruction(instruction) {
3020
- if (instruction.accounts.length < 13) {
3021
- throw new SolanaError(
3022
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3023
- {
3024
- actualAccountMetas: instruction.accounts.length,
3025
- expectedAccountMetas: 13
3026
- }
3027
- );
3028
- }
3029
- let accountIndex = 0;
3030
- const getNextAccount = () => {
3031
- const accountMeta = instruction.accounts[accountIndex];
3032
- accountIndex += 1;
3033
- return accountMeta;
3034
- };
3035
- const getNextOptionalAccount = () => {
3036
- const accountMeta = getNextAccount();
3037
- return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
3038
- };
3039
- return {
3040
- programAddress: instruction.programAddress,
3041
- accounts: {
3042
- config: getNextAccount(),
3043
- pool: getNextAccount(),
3044
- authority: getNextAccount(),
3045
- vaultIn: getNextAccount(),
3046
- vaultOut: getNextAccount(),
3047
- token0Mint: getNextAccount(),
3048
- token1Mint: getNextAccount(),
3049
- userIn: getNextAccount(),
3050
- userOut: getNextAccount(),
3051
- trader: getNextAccount(),
3052
- token0Program: getNextAccount(),
3053
- token1Program: getNextAccount(),
3054
- oracle: getNextOptionalAccount()
3055
- },
3056
- data: getSwapExactInInstructionDataDecoder().decode(instruction.data)
3057
- };
3058
- }
3059
- var TRANSFER_ADMIN_DISCRIMINATOR = new Uint8Array([
3060
- 42,
3061
- 242,
3062
- 66,
3063
- 106,
3064
- 228,
3065
- 10,
3066
- 111,
3067
- 156
3068
- ]);
3069
- function getTransferAdminDiscriminatorBytes() {
3070
- return fixEncoderSize(getBytesEncoder(), 8).encode(
3071
- TRANSFER_ADMIN_DISCRIMINATOR
3072
- );
3073
- }
3074
- function getTransferAdminInstructionDataEncoder() {
3075
- return transformEncoder(
3076
- getStructEncoder([
3077
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
3078
- ["newAdmin", getAddressEncoder()]
3079
- ]),
3080
- (value) => ({ ...value, discriminator: TRANSFER_ADMIN_DISCRIMINATOR })
3081
- );
3082
- }
3083
- function getTransferAdminInstructionDataDecoder() {
3084
- return getStructDecoder([
3085
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
3086
- ["newAdmin", getAddressDecoder()]
3087
- ]);
3088
- }
3089
- function getTransferAdminInstructionDataCodec() {
3090
- return combineCodec(
3091
- getTransferAdminInstructionDataEncoder(),
3092
- getTransferAdminInstructionDataDecoder()
3093
- );
3094
- }
3095
- function getTransferAdminInstruction(input, config) {
3096
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3097
- const originalAccounts = {
3098
- config: { value: input.config ?? null, isWritable: true },
3099
- admin: { value: input.admin ?? null, isWritable: false }
3100
- };
3101
- const accounts = originalAccounts;
3102
- const args = { ...input };
3103
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3104
- return Object.freeze({
3105
- accounts: [
3106
- getAccountMeta("config", accounts.config),
3107
- getAccountMeta("admin", accounts.admin)
3108
- ],
3109
- data: getTransferAdminInstructionDataEncoder().encode(
3110
- args
3111
- ),
3112
- programAddress
3113
- });
3114
- }
3115
- function parseTransferAdminInstruction(instruction) {
3116
- if (instruction.accounts.length < 2) {
3117
- throw new SolanaError(
3118
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3119
- {
3120
- actualAccountMetas: instruction.accounts.length,
3121
- expectedAccountMetas: 2
3122
- }
3123
- );
3124
- }
3125
- let accountIndex = 0;
3126
- const getNextAccount = () => {
3127
- const accountMeta = instruction.accounts[accountIndex];
3128
- accountIndex += 1;
3129
- return accountMeta;
3130
- };
3131
- return {
3132
- programAddress: instruction.programAddress,
3133
- accounts: { config: getNextAccount(), admin: getNextAccount() },
3134
- data: getTransferAdminInstructionDataDecoder().decode(instruction.data)
3135
- };
3136
- }
3137
- var UNPAUSE_DISCRIMINATOR = new Uint8Array([
3138
- 169,
3139
- 144,
3140
- 4,
3141
- 38,
3142
- 10,
3143
- 141,
3144
- 188,
3145
- 255
3146
- ]);
3147
- function getUnpauseDiscriminatorBytes() {
3148
- return fixEncoderSize(getBytesEncoder(), 8).encode(UNPAUSE_DISCRIMINATOR);
3149
- }
3150
- function getUnpauseInstructionDataEncoder() {
3151
- return transformEncoder(
3152
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
3153
- (value) => ({ ...value, discriminator: UNPAUSE_DISCRIMINATOR })
3154
- );
3155
- }
3156
- function getUnpauseInstructionDataDecoder() {
3157
- return getStructDecoder([
3158
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
3159
- ]);
3160
- }
3161
- function getUnpauseInstructionDataCodec() {
3162
- return combineCodec(
3163
- getUnpauseInstructionDataEncoder(),
3164
- getUnpauseInstructionDataDecoder()
3165
- );
3166
- }
3167
- function getUnpauseInstruction(input, config) {
3168
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3169
- const originalAccounts = {
3170
- config: { value: input.config ?? null, isWritable: true },
3171
- admin: { value: input.admin ?? null, isWritable: false }
3172
- };
3173
- const accounts = originalAccounts;
3174
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3175
- return Object.freeze({
3176
- accounts: [
3177
- getAccountMeta("config", accounts.config),
3178
- getAccountMeta("admin", accounts.admin)
3179
- ],
3180
- data: getUnpauseInstructionDataEncoder().encode({}),
3181
- programAddress
3182
- });
3183
- }
3184
- function parseUnpauseInstruction(instruction) {
3185
- if (instruction.accounts.length < 2) {
3186
- throw new SolanaError(
3187
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3188
- {
3189
- actualAccountMetas: instruction.accounts.length,
3190
- expectedAccountMetas: 2
3191
- }
3192
- );
3193
- }
3194
- let accountIndex = 0;
3195
- const getNextAccount = () => {
3196
- const accountMeta = instruction.accounts[accountIndex];
3197
- accountIndex += 1;
3198
- return accountMeta;
3199
- };
3200
- return {
3201
- programAddress: instruction.programAddress,
3202
- accounts: { config: getNextAccount(), admin: getNextAccount() },
3203
- data: getUnpauseInstructionDataDecoder().decode(instruction.data)
3204
- };
3205
- }
3206
- var UPDATE_CONFIG_DISCRIMINATOR = new Uint8Array([
3207
- 29,
3208
- 158,
3209
- 252,
3210
- 191,
3211
- 10,
3212
- 83,
3213
- 219,
3214
- 99
3215
- ]);
3216
- function getUpdateConfigDiscriminatorBytes() {
3217
- return fixEncoderSize(getBytesEncoder(), 8).encode(
3218
- UPDATE_CONFIG_DISCRIMINATOR
3219
- );
3220
- }
3221
- function getUpdateConfigInstructionDataEncoder() {
3222
- return transformEncoder(
3223
- getStructEncoder([
3224
- ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
3225
- ["numeraireMint", getAddressEncoder()],
3226
- ["maxSwapFeeBps", getU16Encoder()],
3227
- ["maxFeeSplitBps", getU16Encoder()],
3228
- ["maxRouteHops", getU8Encoder()],
3229
- ["protocolFeeEnabled", getBooleanEncoder()],
3230
- ["protocolFeeBps", getU16Encoder()],
3231
- ["hookAllowlist", getArrayEncoder(getAddressEncoder())]
3232
- ]),
3233
- (value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR })
3234
- );
3235
- }
3236
- function getUpdateConfigInstructionDataDecoder() {
3237
- return getStructDecoder([
3238
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
3239
- ["numeraireMint", getAddressDecoder()],
3240
- ["maxSwapFeeBps", getU16Decoder()],
3241
- ["maxFeeSplitBps", getU16Decoder()],
3242
- ["maxRouteHops", getU8Decoder()],
3243
- ["protocolFeeEnabled", getBooleanDecoder()],
3244
- ["protocolFeeBps", getU16Decoder()],
3245
- ["hookAllowlist", getArrayDecoder(getAddressDecoder())]
3246
- ]);
3247
- }
3248
- function getUpdateConfigInstructionDataCodec() {
3249
- return combineCodec(
3250
- getUpdateConfigInstructionDataEncoder(),
3251
- getUpdateConfigInstructionDataDecoder()
3252
- );
3253
- }
3254
- function getUpdateConfigInstruction(input, config) {
3255
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3256
- const originalAccounts = {
3257
- config: { value: input.config ?? null, isWritable: true },
3258
- admin: { value: input.admin ?? null, isWritable: false }
3259
- };
3260
- const accounts = originalAccounts;
3261
- const args = { ...input };
3262
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3263
- return Object.freeze({
3264
- accounts: [
3265
- getAccountMeta("config", accounts.config),
3266
- getAccountMeta("admin", accounts.admin)
3267
- ],
3268
- data: getUpdateConfigInstructionDataEncoder().encode(
3269
- args
3270
- ),
3271
- programAddress
3272
- });
3273
- }
3274
- function parseUpdateConfigInstruction(instruction) {
3275
- if (instruction.accounts.length < 2) {
3276
- throw new SolanaError(
3277
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3278
- {
3279
- actualAccountMetas: instruction.accounts.length,
3280
- expectedAccountMetas: 2
3281
- }
3282
- );
3283
- }
3284
- let accountIndex = 0;
3285
- const getNextAccount = () => {
3286
- const accountMeta = instruction.accounts[accountIndex];
3287
- accountIndex += 1;
3288
- return accountMeta;
3289
- };
3290
- return {
3291
- programAddress: instruction.programAddress,
3292
- accounts: { config: getNextAccount(), admin: getNextAccount() },
3293
- data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
3294
- };
3295
- }
3296
- var WITHDRAW_VAULT_EXCESS_DISCRIMINATOR = new Uint8Array([
3297
- 235,
3298
- 197,
3299
- 247,
3300
- 177,
3301
- 137,
3302
- 72,
3303
- 135,
3304
- 113
3305
- ]);
3306
- function getWithdrawVaultExcessDiscriminatorBytes() {
3307
- return fixEncoderSize(getBytesEncoder(), 8).encode(
3308
- WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
3309
- );
3310
- }
3311
- function getWithdrawVaultExcessInstructionDataEncoder() {
3312
- return transformEncoder(
3313
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
3314
- (value) => ({
3315
- ...value,
3316
- discriminator: WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
3317
- })
3318
- );
3319
- }
3320
- function getWithdrawVaultExcessInstructionDataDecoder() {
3321
- return getStructDecoder([
3322
- ["discriminator", fixDecoderSize(getBytesDecoder(), 8)]
3323
- ]);
3324
- }
3325
- function getWithdrawVaultExcessInstructionDataCodec() {
3326
- return combineCodec(
3327
- getWithdrawVaultExcessInstructionDataEncoder(),
3328
- getWithdrawVaultExcessInstructionDataDecoder()
3329
- );
3330
- }
3331
- async function getWithdrawVaultExcessInstructionAsync(input, config) {
3332
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3333
- const originalAccounts = {
3334
- config: { value: input.config ?? null, isWritable: false },
3335
- pool: { value: input.pool ?? null, isWritable: false },
3336
- admin: { value: input.admin ?? null, isWritable: false },
3337
- authority: { value: input.authority ?? null, isWritable: false },
3338
- vault0: { value: input.vault0 ?? null, isWritable: true },
3339
- vault1: { value: input.vault1 ?? null, isWritable: true },
3340
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3341
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3342
- adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
3343
- adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
3344
- token0Program: { value: input.token0Program ?? null, isWritable: false },
3345
- token1Program: { value: input.token1Program ?? null, isWritable: false }
3346
- };
3347
- const accounts = originalAccounts;
3348
- if (!accounts.authority.value) {
3349
- accounts.authority.value = await getProgramDerivedAddress({
3350
- programAddress,
3351
- seeds: [
3352
- getBytesEncoder().encode(
3353
- new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
3354
- ),
3355
- getAddressEncoder().encode(
3356
- getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
3357
- )
3358
- ]
3359
- });
3360
- }
3361
- if (!accounts.adminAta0.value) {
3362
- accounts.adminAta0.value = await getProgramDerivedAddress({
3363
- programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
3364
- seeds: [
3365
- getAddressEncoder().encode(
3366
- getAddressFromResolvedInstructionAccount(
3367
- "admin",
3368
- accounts.admin.value
3369
- )
3370
- ),
3371
- getAddressEncoder().encode(
3372
- getAddressFromResolvedInstructionAccount(
3373
- "token0Program",
3374
- accounts.token0Program.value
3375
- )
3376
- ),
3377
- getAddressEncoder().encode(
3378
- getAddressFromResolvedInstructionAccount(
3379
- "token0Mint",
3380
- accounts.token0Mint.value
3381
- )
3382
- )
3383
- ]
3384
- });
3385
- }
3386
- if (!accounts.adminAta1.value) {
3387
- accounts.adminAta1.value = await getProgramDerivedAddress({
3388
- programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
3389
- seeds: [
3390
- getAddressEncoder().encode(
3391
- getAddressFromResolvedInstructionAccount(
3392
- "admin",
3393
- accounts.admin.value
3394
- )
3395
- ),
3396
- getAddressEncoder().encode(
3397
- getAddressFromResolvedInstructionAccount(
3398
- "token1Program",
3399
- accounts.token1Program.value
3400
- )
3401
- ),
3402
- getAddressEncoder().encode(
3403
- getAddressFromResolvedInstructionAccount(
3404
- "token1Mint",
3405
- accounts.token1Mint.value
3406
- )
3407
- )
3408
- ]
3409
- });
3410
- }
3411
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3412
- return Object.freeze({
3413
- accounts: [
3414
- getAccountMeta("config", accounts.config),
3415
- getAccountMeta("pool", accounts.pool),
3416
- getAccountMeta("admin", accounts.admin),
3417
- getAccountMeta("authority", accounts.authority),
3418
- getAccountMeta("vault0", accounts.vault0),
3419
- getAccountMeta("vault1", accounts.vault1),
3420
- getAccountMeta("token0Mint", accounts.token0Mint),
3421
- getAccountMeta("token1Mint", accounts.token1Mint),
3422
- getAccountMeta("adminAta0", accounts.adminAta0),
3423
- getAccountMeta("adminAta1", accounts.adminAta1),
3424
- getAccountMeta("token0Program", accounts.token0Program),
3425
- getAccountMeta("token1Program", accounts.token1Program)
3426
- ],
3427
- data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
3428
- programAddress
3429
- });
3430
- }
3431
- function getWithdrawVaultExcessInstruction(input, config) {
3432
- const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3433
- const originalAccounts = {
3434
- config: { value: input.config ?? null, isWritable: false },
3435
- pool: { value: input.pool ?? null, isWritable: false },
3436
- admin: { value: input.admin ?? null, isWritable: false },
3437
- authority: { value: input.authority ?? null, isWritable: false },
3438
- vault0: { value: input.vault0 ?? null, isWritable: true },
3439
- vault1: { value: input.vault1 ?? null, isWritable: true },
3440
- token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3441
- token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3442
- adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
3443
- adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
3444
- token0Program: { value: input.token0Program ?? null, isWritable: false },
3445
- token1Program: { value: input.token1Program ?? null, isWritable: false }
3446
- };
3447
- const accounts = originalAccounts;
3448
- const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
3449
- return Object.freeze({
3450
- accounts: [
3451
- getAccountMeta("config", accounts.config),
3452
- getAccountMeta("pool", accounts.pool),
3453
- getAccountMeta("admin", accounts.admin),
3454
- getAccountMeta("authority", accounts.authority),
3455
- getAccountMeta("vault0", accounts.vault0),
3456
- getAccountMeta("vault1", accounts.vault1),
3457
- getAccountMeta("token0Mint", accounts.token0Mint),
3458
- getAccountMeta("token1Mint", accounts.token1Mint),
3459
- getAccountMeta("adminAta0", accounts.adminAta0),
3460
- getAccountMeta("adminAta1", accounts.adminAta1),
3461
- getAccountMeta("token0Program", accounts.token0Program),
3462
- getAccountMeta("token1Program", accounts.token1Program)
3463
- ],
3464
- data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
3465
- programAddress
3466
- });
3467
- }
3468
- function parseWithdrawVaultExcessInstruction(instruction) {
3469
- if (instruction.accounts.length < 12) {
3470
- throw new SolanaError(
3471
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3472
- {
3473
- actualAccountMetas: instruction.accounts.length,
3474
- expectedAccountMetas: 12
3475
- }
3476
- );
3477
- }
3478
- let accountIndex = 0;
3479
- const getNextAccount = () => {
3480
- const accountMeta = instruction.accounts[accountIndex];
3481
- accountIndex += 1;
3482
- return accountMeta;
3483
- };
3484
- return {
3485
- programAddress: instruction.programAddress,
3486
- accounts: {
3487
- config: getNextAccount(),
3488
- pool: getNextAccount(),
3489
- admin: getNextAccount(),
3490
- authority: getNextAccount(),
3491
- vault0: getNextAccount(),
3492
- vault1: getNextAccount(),
3493
- token0Mint: getNextAccount(),
3494
- token1Mint: getNextAccount(),
3495
- adminAta0: getNextAccount(),
3496
- adminAta1: getNextAccount(),
3497
- token0Program: getNextAccount(),
3498
- token1Program: getNextAccount()
3499
- },
3500
- data: getWithdrawVaultExcessInstructionDataDecoder().decode(
3501
- instruction.data
3502
- )
3503
- };
3504
- }
3505
631
  function isTransactionSigner(value) {
3506
632
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
3507
633
  }
@@ -4560,8 +1686,11 @@ __export(initializer_exports, {
4560
1686
  SEED_LAUNCH: () => SEED_LAUNCH,
4561
1687
  SEED_LAUNCH_AUTHORITY: () => SEED_LAUNCH_AUTHORITY,
4562
1688
  SEED_LAUNCH_FEE_STATE: () => SEED_LAUNCH_FEE_STATE,
1689
+ SOLANA_TRANSACTION_SIZE_LIMIT: () => SOLANA_TRANSACTION_SIZE_LIMIT,
4563
1690
  TRADE_DIRECTION_BUY: () => TRADE_DIRECTION_BUY,
4564
1691
  TRADE_DIRECTION_SELL: () => TRADE_DIRECTION_SELL,
1692
+ assertTransactionMessageFits: () => assertTransactionMessageFits,
1693
+ assertTransactionMessageFitsWithLookupTable: () => assertTransactionMessageFitsWithLookupTable,
4565
1694
  buildAddressLookupTableSetupInstructions: () => buildAddressLookupTableSetupInstructions,
4566
1695
  compressTransactionMessageWithLookupTable: () => compressTransactionMessageWithLookupTable,
4567
1696
  computeRemainingAccountsHash: () => computeRemainingAccountsHash,
@@ -4607,6 +1736,8 @@ __export(initializer_exports, {
4607
1736
  getTokenMetadataAddress: () => getTokenMetadataAddress,
4608
1737
  launchExists: () => launchExists,
4609
1738
  launchIdFromU64: () => launchIdFromU64,
1739
+ measureTransactionMessageSize: () => measureTransactionMessageSize,
1740
+ measureTransactionMessageSizeWithLookupTable: () => measureTransactionMessageSizeWithLookupTable,
4610
1741
  phaseLabel: () => phaseLabel
4611
1742
  });
4612
1743
  var INITIALIZER_PROGRAM_ID = address(
@@ -4858,6 +1989,14 @@ function getFeeBeneficiaryInputDecoder() {
4858
1989
  ["shareBps", getU16Decoder()]
4859
1990
  ]);
4860
1991
  }
1992
+ var FeeClaimRole = /* @__PURE__ */ ((FeeClaimRole2) => {
1993
+ FeeClaimRole2[FeeClaimRole2["Protocol"] = 0] = "Protocol";
1994
+ FeeClaimRole2[FeeClaimRole2["Beneficiary"] = 1] = "Beneficiary";
1995
+ return FeeClaimRole2;
1996
+ })(FeeClaimRole || {});
1997
+ function getFeeClaimRoleEncoder() {
1998
+ return getEnumEncoder(FeeClaimRole);
1999
+ }
4861
2000
  function getInitializeConfigArgsEncoder2() {
4862
2001
  return getStructEncoder([
4863
2002
  ["migratorAllowlist", getArrayEncoder(getAddressEncoder())],
@@ -4897,11 +2036,9 @@ function getInitializeLaunchArgsEncoder() {
4897
2036
  ["curveParams", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
4898
2037
  ["allowBuy", getU8Encoder()],
4899
2038
  ["allowSell", getU8Encoder()],
4900
- ["hookProgram", getAddressEncoder()],
4901
2039
  ["hookFlags", getU32Encoder()],
4902
2040
  ["hookPayload", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
4903
2041
  ["hookCreateRemainingAccountsLen", getU32Encoder()],
4904
- ["migratorProgram", getAddressEncoder()],
4905
2042
  [
4906
2043
  "migratorInitPayload",
4907
2044
  addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
@@ -4938,11 +2075,9 @@ function getInitializeLaunchArgsDecoder() {
4938
2075
  ["curveParams", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
4939
2076
  ["allowBuy", getU8Decoder()],
4940
2077
  ["allowSell", getU8Decoder()],
4941
- ["hookProgram", getAddressDecoder()],
4942
2078
  ["hookFlags", getU32Decoder()],
4943
2079
  ["hookPayload", addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())],
4944
2080
  ["hookCreateRemainingAccountsLen", getU32Decoder()],
4945
- ["migratorProgram", getAddressDecoder()],
4946
2081
  [
4947
2082
  "migratorInitPayload",
4948
2083
  addDecoderSizePrefix(getBytesDecoder(), getU32Decoder())
@@ -5095,7 +2230,6 @@ function getLaunchFeeStateEncoder() {
5095
2230
  getStructEncoder([
5096
2231
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
5097
2232
  ["launch", getAddressEncoder()],
5098
- ["protocolBeneficiary", getAddressEncoder()],
5099
2233
  ["beneficiaryLen", getU8Encoder()],
5100
2234
  ["bump", getU8Encoder()],
5101
2235
  ["protocolFeeBps", getU16Encoder()],
@@ -5127,7 +2261,6 @@ function getLaunchFeeStateDecoder() {
5127
2261
  return getStructDecoder([
5128
2262
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
5129
2263
  ["launch", getAddressDecoder()],
5130
- ["protocolBeneficiary", getAddressDecoder()],
5131
2264
  ["beneficiaryLen", getU8Decoder()],
5132
2265
  ["bump", getU8Decoder()],
5133
2266
  ["protocolFeeBps", getU16Decoder()],
@@ -5165,20 +2298,23 @@ var CLAIM_FEES_DISCRIMINATOR = new Uint8Array([
5165
2298
  ]);
5166
2299
  function getClaimFeesInstructionDataEncoder() {
5167
2300
  return transformEncoder(
5168
- getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]),
2301
+ getStructEncoder([
2302
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2303
+ ["role", getFeeClaimRoleEncoder()]
2304
+ ]),
5169
2305
  (value) => ({ ...value, discriminator: CLAIM_FEES_DISCRIMINATOR })
5170
2306
  );
5171
2307
  }
5172
2308
  async function getClaimFeesInstructionAsync(input, config) {
5173
2309
  const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
5174
2310
  const originalAccounts = {
2311
+ config: { value: input.config ?? null, isWritable: false },
5175
2312
  launch: { value: input.launch ?? null, isWritable: false },
5176
2313
  launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
5177
2314
  launchAuthority: {
5178
2315
  value: input.launchAuthority ?? null,
5179
2316
  isWritable: false
5180
2317
  },
5181
- recipient: { value: input.recipient ?? null, isWritable: false },
5182
2318
  baseMint: { value: input.baseMint ?? null, isWritable: false },
5183
2319
  quoteMint: { value: input.quoteMint ?? null, isWritable: false },
5184
2320
  baseVault: { value: input.baseVault ?? null, isWritable: true },
@@ -5201,6 +2337,15 @@ async function getClaimFeesInstructionAsync(input, config) {
5201
2337
  }
5202
2338
  };
5203
2339
  const accounts = originalAccounts;
2340
+ const args = { ...input };
2341
+ if (!accounts.config.value) {
2342
+ accounts.config.value = await getProgramDerivedAddress({
2343
+ programAddress,
2344
+ seeds: [
2345
+ getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
2346
+ ]
2347
+ });
2348
+ }
5204
2349
  if (!accounts.launchFeeState.value) {
5205
2350
  accounts.launchFeeState.value = await getProgramDerivedAddress({
5206
2351
  programAddress,
@@ -5270,10 +2415,10 @@ async function getClaimFeesInstructionAsync(input, config) {
5270
2415
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
5271
2416
  return Object.freeze({
5272
2417
  accounts: [
2418
+ getAccountMeta("config", accounts.config),
5273
2419
  getAccountMeta("launch", accounts.launch),
5274
2420
  getAccountMeta("launchFeeState", accounts.launchFeeState),
5275
2421
  getAccountMeta("launchAuthority", accounts.launchAuthority),
5276
- getAccountMeta("recipient", accounts.recipient),
5277
2422
  getAccountMeta("baseMint", accounts.baseMint),
5278
2423
  getAccountMeta("quoteMint", accounts.quoteMint),
5279
2424
  getAccountMeta("baseVault", accounts.baseVault),
@@ -5283,7 +2428,9 @@ async function getClaimFeesInstructionAsync(input, config) {
5283
2428
  getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
5284
2429
  getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
5285
2430
  ],
5286
- data: getClaimFeesInstructionDataEncoder().encode({}),
2431
+ data: getClaimFeesInstructionDataEncoder().encode(
2432
+ args
2433
+ ),
5287
2434
  programAddress
5288
2435
  });
5289
2436
  }
@@ -5505,11 +2652,9 @@ function getInitializeLaunchInstructionDataEncoder() {
5505
2652
  ["curveParams", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
5506
2653
  ["allowBuy", getU8Encoder()],
5507
2654
  ["allowSell", getU8Encoder()],
5508
- ["hookProgram", getAddressEncoder()],
5509
2655
  ["hookFlags", getU32Encoder()],
5510
2656
  ["hookPayload", addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())],
5511
2657
  ["hookCreateRemainingAccountsLen", getU32Encoder()],
5512
- ["migratorProgram", getAddressEncoder()],
5513
2658
  [
5514
2659
  "migratorInitPayload",
5515
2660
  addEncoderSizePrefix(getBytesEncoder(), getU32Encoder())
@@ -5587,6 +2732,7 @@ function getReplaceFeeBeneficiaryInstructionDataEncoder() {
5587
2732
  async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
5588
2733
  const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
5589
2734
  const originalAccounts = {
2735
+ config: { value: input.config ?? null, isWritable: false },
5590
2736
  launch: { value: input.launch ?? null, isWritable: false },
5591
2737
  launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
5592
2738
  currentBeneficiary: {
@@ -5596,6 +2742,14 @@ async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
5596
2742
  };
5597
2743
  const accounts = originalAccounts;
5598
2744
  const args = { ...input };
2745
+ if (!accounts.config.value) {
2746
+ accounts.config.value = await getProgramDerivedAddress({
2747
+ programAddress,
2748
+ seeds: [
2749
+ getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
2750
+ ]
2751
+ });
2752
+ }
5599
2753
  if (!accounts.launchFeeState.value) {
5600
2754
  accounts.launchFeeState.value = await getProgramDerivedAddress({
5601
2755
  programAddress,
@@ -5632,6 +2786,7 @@ async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
5632
2786
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
5633
2787
  return Object.freeze({
5634
2788
  accounts: [
2789
+ getAccountMeta("config", accounts.config),
5635
2790
  getAccountMeta("launch", accounts.launch),
5636
2791
  getAccountMeta("launchFeeState", accounts.launchFeeState),
5637
2792
  getAccountMeta("currentBeneficiary", accounts.currentBeneficiary)
@@ -6600,7 +3755,7 @@ async function fetchAllMaybeMarket(rpc, addresses, config) {
6600
3755
  function getMarketSize() {
6601
3756
  return 208;
6602
3757
  }
6603
- var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
3758
+ var ORACLE_STATE_DISCRIMINATOR = new Uint8Array([
6604
3759
  97,
6605
3760
  156,
6606
3761
  157,
@@ -6612,7 +3767,7 @@ var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
6612
3767
  ]);
6613
3768
  function getOracleStateDiscriminatorBytes() {
6614
3769
  return fixEncoderSize(getBytesEncoder(), 8).encode(
6615
- ORACLE_STATE_DISCRIMINATOR2
3770
+ ORACLE_STATE_DISCRIMINATOR
6616
3771
  );
6617
3772
  }
6618
3773
  function getOracleStateEncoder() {
@@ -6627,7 +3782,7 @@ function getOracleStateEncoder() {
6627
3782
  ["bump", getU8Encoder()],
6628
3783
  ["reserved", fixEncoderSize(getBytesEncoder(), 31)]
6629
3784
  ]),
6630
- (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR2 })
3785
+ (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR })
6631
3786
  );
6632
3787
  }
6633
3788
  function getOracleStateDecoder() {
@@ -6642,7 +3797,7 @@ function getOracleStateDecoder() {
6642
3797
  ["reserved", fixDecoderSize(getBytesDecoder(), 31)]
6643
3798
  ]);
6644
3799
  }
6645
- function getOracleStateCodec2() {
3800
+ function getOracleStateCodec() {
6646
3801
  return combineCodec(getOracleStateEncoder(), getOracleStateDecoder());
6647
3802
  }
6648
3803
  function decodeOracleState2(encodedAccount) {
@@ -7863,7 +5018,7 @@ function predictionMigratorProgram() {
7863
5018
  initConfig: addSelfFetchFunctions(client, getInitConfigCodec2()),
7864
5019
  launch: addSelfFetchFunctions(client, getLaunchCodec2()),
7865
5020
  market: addSelfFetchFunctions(client, getMarketCodec()),
7866
- oracleState: addSelfFetchFunctions(client, getOracleStateCodec2())
5021
+ oracleState: addSelfFetchFunctions(client, getOracleStateCodec())
7867
5022
  },
7868
5023
  instructions: {
7869
5024
  claim: (input) => addSelfPlanAndSendFunctions(
@@ -8051,9 +5206,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
8051
5206
  feeBeneficiaries: args.feeBeneficiaries ?? [],
8052
5207
  allowBuy: args.allowBuy ? 1 : 0,
8053
5208
  allowSell: args.allowSell ? 1 : 0,
8054
- hookProgram: args.hookProgram ?? hookProgram ?? SYSTEM_PROGRAM_ADDRESS,
8055
5209
  hookCreateRemainingAccountsLen: args.hookCreateRemainingAccountsLen ?? hookCreateRemainingAccounts.length,
8056
- migratorProgram: migratorProgram ?? SYSTEM_PROGRAM_ADDRESS,
8057
5210
  hookCreateRemainingAccountsHash: args.hookCreateRemainingAccountsHash ?? (createHooksEnabled ? computeRemainingAccountsHash(hookCreateRemainingAccountAddresses) : new Uint8Array(32))
8058
5211
  };
8059
5212
  const data = new Uint8Array(
@@ -8357,6 +5510,39 @@ function compressTransactionMessageWithLookupTable(transactionMessage, {
8357
5510
  }
8358
5511
  );
8359
5512
  }
5513
+ var SOLANA_TRANSACTION_SIZE_LIMIT = 1232;
5514
+ function measureTransactionMessageSize(transactionMessage) {
5515
+ const size = getTransactionMessageSize(transactionMessage);
5516
+ const overBy = Math.max(0, size - SOLANA_TRANSACTION_SIZE_LIMIT);
5517
+ return {
5518
+ size,
5519
+ limit: SOLANA_TRANSACTION_SIZE_LIMIT,
5520
+ overBy,
5521
+ fits: overBy === 0
5522
+ };
5523
+ }
5524
+ function measureTransactionMessageSizeWithLookupTable(transactionMessage, lookupTable) {
5525
+ return measureTransactionMessageSize(
5526
+ compressTransactionMessageWithLookupTable(transactionMessage, lookupTable)
5527
+ );
5528
+ }
5529
+ function assertTransactionMessageFits(transactionMessage, { label = "Transaction", metadataBytes } = {}) {
5530
+ const report = measureTransactionMessageSize(transactionMessage);
5531
+ if (report.fits) {
5532
+ return report;
5533
+ }
5534
+ const metadataHint = metadataBytes && metadataBytes > 0 ? ` Metadata contributes ${metadataBytes} instruction-data bytes; address lookup tables do not compress metadata strings.` : "";
5535
+ throw new Error(
5536
+ `${label} is ${report.size} bytes, exceeding Solana's ${report.limit}-byte transaction limit by ${report.overBy} bytes.${metadataHint}`
5537
+ );
5538
+ }
5539
+ function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupTable, options = {}) {
5540
+ const compressedMessage = compressTransactionMessageWithLookupTable(
5541
+ transactionMessage,
5542
+ lookupTable
5543
+ );
5544
+ return assertTransactionMessageFits(compressedMessage, options);
5545
+ }
8360
5546
  var addressCodec5 = getAddressCodec();
8361
5547
  function bytesToBase64(bytes) {
8362
5548
  let binary = "";
@@ -8674,6 +5860,7 @@ async function buildCpmmMigrationRemainingAccounts({
8674
5860
  poolInit.authority[0],
8675
5861
  poolInit.vault0[0],
8676
5862
  poolInit.vault1[0],
5863
+ poolInit.protocolFeeOwner[0],
8677
5864
  poolInit.protocolFeePosition[0],
8678
5865
  launchLpPosition,
8679
5866
  cpmmProgram,
@@ -8692,6 +5879,7 @@ async function buildCpmmMigrationRemainingAccounts({
8692
5879
  { address: poolInit.authority[0], role: AccountRole.READONLY },
8693
5880
  { address: poolInit.vault0[0], role: AccountRole.WRITABLE },
8694
5881
  { address: poolInit.vault1[0], role: AccountRole.WRITABLE },
5882
+ { address: poolInit.protocolFeeOwner[0], role: AccountRole.READONLY },
8695
5883
  { address: poolInit.protocolFeePosition[0], role: AccountRole.WRITABLE },
8696
5884
  { address: launchLpPosition, role: AccountRole.WRITABLE },
8697
5885
  { address: cpmmProgram, role: AccountRole.READONLY },
@@ -8709,6 +5897,7 @@ async function buildCpmmMigrationRemainingAccounts({
8709
5897
  poolAuthority: poolInit.authority[0],
8710
5898
  poolVault0: poolInit.vault0[0],
8711
5899
  poolVault1: poolInit.vault1[0],
5900
+ protocolFeeOwner: poolInit.protocolFeeOwner[0],
8712
5901
  protocolFeePosition: poolInit.protocolFeePosition[0],
8713
5902
  launchLpPosition,
8714
5903
  migrationAuthority
@@ -8745,11 +5934,8 @@ __export(predictionMigrator_exports, {
8745
5934
  LAUNCH_DISCRIMINATOR: () => LAUNCH_DISCRIMINATOR2,
8746
5935
  MARKET_DISCRIMINATOR: () => MARKET_DISCRIMINATOR,
8747
5936
  MIGRATE_ENTRY_DISCRIMINATOR: () => MIGRATE_ENTRY_DISCRIMINATOR,
8748
- ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR2,
5937
+ ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR,
8749
5938
  PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED,
8750
- PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED,
8751
- PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED,
8752
- PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED,
8753
5939
  PREDICTION_MIGRATOR_ERROR__INSUFFICIENT_BALANCE: () => PREDICTION_MIGRATOR_ERROR__INSUFFICIENT_BALANCE,
8754
5940
  PREDICTION_MIGRATOR_ERROR__INVALID_ENTRY_ID: () => PREDICTION_MIGRATOR_ERROR__INVALID_ENTRY_ID,
8755
5941
  PREDICTION_MIGRATOR_ERROR__INVALID_INPUT: () => PREDICTION_MIGRATOR_ERROR__INVALID_INPUT,
@@ -8760,7 +5946,6 @@ __export(predictionMigrator_exports, {
8760
5946
  PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT: () => PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT,
8761
5947
  PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED: () => PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED,
8762
5948
  PREDICTION_MIGRATOR_ERROR__MATH_OVERFLOW: () => PREDICTION_MIGRATOR_ERROR__MATH_OVERFLOW,
8763
- PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS: () => PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS,
8764
5949
  PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED: () => PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED,
8765
5950
  PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH: () => PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH,
8766
5951
  PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED: () => PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED,
@@ -8866,7 +6051,7 @@ __export(predictionMigrator_exports, {
8866
6051
  getMigrateEntryInstructionDataCodec: () => getMigrateEntryInstructionDataCodec,
8867
6052
  getMigrateEntryInstructionDataDecoder: () => getMigrateEntryInstructionDataDecoder,
8868
6053
  getMigrateEntryInstructionDataEncoder: () => getMigrateEntryInstructionDataEncoder,
8869
- getOracleStateCodec: () => getOracleStateCodec2,
6054
+ getOracleStateCodec: () => getOracleStateCodec,
8870
6055
  getOracleStateDecoder: () => getOracleStateDecoder,
8871
6056
  getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes,
8872
6057
  getOracleStateEncoder: () => getOracleStateEncoder,
@@ -8912,10 +6097,7 @@ __export(predictionMigrator_exports, {
8912
6097
  });
8913
6098
  var PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED = 6e3;
8914
6099
  var PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH = 6001;
8915
- var PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED = 6002;
8916
- var PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED = 6003;
8917
6100
  var PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED = 6004;
8918
- var PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED = 6005;
8919
6101
  var PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED = 6006;
8920
6102
  var PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED = 6007;
8921
6103
  var PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT = 6008;
@@ -8926,7 +6108,6 @@ var PREDICTION_MIGRATOR_ERROR__INVALID_MARKET = 6012;
8926
6108
  var PREDICTION_MIGRATOR_ERROR__INVALID_VAULT = 6013;
8927
6109
  var PREDICTION_MIGRATOR_ERROR__INVALID_MINT = 6014;
8928
6110
  var PREDICTION_MIGRATOR_ERROR__WINNING_ENTRY_NOT_MIGRATED = 6015;
8929
- var PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS = 6016;
8930
6111
  var PREDICTION_MIGRATOR_ERROR__INVALID_ORACLE = 6017;
8931
6112
  var PREDICTION_MIGRATOR_ERROR__ZERO_CLAIMABLE_SUPPLY = 6018;
8932
6113
  var PREDICTION_MIGRATOR_ERROR__INVALID_INPUT = 6019;
@@ -8934,9 +6115,6 @@ var predictionMigratorErrorMessages;
8934
6115
  if (process.env.NODE_ENV !== "production") {
8935
6116
  predictionMigratorErrorMessages = {
8936
6117
  [PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED]: `Entry already migrated`,
8937
- [PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED]: `Entry already registered`,
8938
- [PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED]: `Entry not migrated`,
8939
- [PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED]: `Entry not registered`,
8940
6118
  [PREDICTION_MIGRATOR_ERROR__INSUFFICIENT_BALANCE]: `Insufficient balance`,
8941
6119
  [PREDICTION_MIGRATOR_ERROR__INVALID_ENTRY_ID]: `Invalid entry ID`,
8942
6120
  [PREDICTION_MIGRATOR_ERROR__INVALID_INPUT]: `Invalid input`,
@@ -8947,7 +6125,6 @@ if (process.env.NODE_ENV !== "production") {
8947
6125
  [PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT]: `Invalid winner mint`,
8948
6126
  [PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED]: `Market not resolved`,
8949
6127
  [PREDICTION_MIGRATOR_ERROR__MATH_OVERFLOW]: `Math overflow`,
8950
- [PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS]: `No pending rewards`,
8951
6128
  [PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED]: `Oracle not finalized`,
8952
6129
  [PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH]: `Quote mint mismatch`,
8953
6130
  [PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED]: `Unauthorized`,
@@ -8975,10 +6152,9 @@ var trustedOracle_exports = {};
8975
6152
  __export(trustedOracle_exports, {
8976
6153
  FINALIZE_DISCRIMINATOR: () => FINALIZE_DISCRIMINATOR,
8977
6154
  INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR2,
8978
- ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR3,
6155
+ ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR2,
8979
6156
  TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED: () => TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED,
8980
6157
  TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT: () => TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT,
8981
- TRUSTED_ORACLE_ERROR__NOT_FINALIZED: () => TRUSTED_ORACLE_ERROR__NOT_FINALIZED,
8982
6158
  TRUSTED_ORACLE_ERROR__UNAUTHORIZED: () => TRUSTED_ORACLE_ERROR__UNAUTHORIZED,
8983
6159
  TRUSTED_ORACLE_PROGRAM_ADDRESS: () => TRUSTED_ORACLE_PROGRAM_ADDRESS,
8984
6160
  TrustedOracleAccount: () => TrustedOracleAccount,
@@ -9002,7 +6178,7 @@ __export(trustedOracle_exports, {
9002
6178
  getInitializeOracleInstructionDataDecoder: () => getInitializeOracleInstructionDataDecoder2,
9003
6179
  getInitializeOracleInstructionDataEncoder: () => getInitializeOracleInstructionDataEncoder2,
9004
6180
  getOracleStateAddress: () => getOracleStateAddress,
9005
- getOracleStateCodec: () => getOracleStateCodec3,
6181
+ getOracleStateCodec: () => getOracleStateCodec2,
9006
6182
  getOracleStateDecoder: () => getOracleStateDecoder2,
9007
6183
  getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes2,
9008
6184
  getOracleStateEncoder: () => getOracleStateEncoder2,
@@ -9016,7 +6192,7 @@ __export(trustedOracle_exports, {
9016
6192
  parseTrustedOracleInstruction: () => parseTrustedOracleInstruction,
9017
6193
  trustedOracleProgram: () => trustedOracleProgram
9018
6194
  });
9019
- var ORACLE_STATE_DISCRIMINATOR3 = new Uint8Array([
6195
+ var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
9020
6196
  97,
9021
6197
  156,
9022
6198
  157,
@@ -9028,7 +6204,7 @@ var ORACLE_STATE_DISCRIMINATOR3 = new Uint8Array([
9028
6204
  ]);
9029
6205
  function getOracleStateDiscriminatorBytes2() {
9030
6206
  return fixEncoderSize(getBytesEncoder(), 8).encode(
9031
- ORACLE_STATE_DISCRIMINATOR3
6207
+ ORACLE_STATE_DISCRIMINATOR2
9032
6208
  );
9033
6209
  }
9034
6210
  function getOracleStateEncoder2() {
@@ -9043,7 +6219,7 @@ function getOracleStateEncoder2() {
9043
6219
  ["bump", getU8Encoder()],
9044
6220
  ["reserved", fixEncoderSize(getBytesEncoder(), 31)]
9045
6221
  ]),
9046
- (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR3 })
6222
+ (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR2 })
9047
6223
  );
9048
6224
  }
9049
6225
  function getOracleStateDecoder2() {
@@ -9058,7 +6234,7 @@ function getOracleStateDecoder2() {
9058
6234
  ["reserved", fixDecoderSize(getBytesDecoder(), 31)]
9059
6235
  ]);
9060
6236
  }
9061
- function getOracleStateCodec3() {
6237
+ function getOracleStateCodec2() {
9062
6238
  return combineCodec(getOracleStateEncoder2(), getOracleStateDecoder2());
9063
6239
  }
9064
6240
  function decodeOracleState3(encodedAccount) {
@@ -9345,7 +6521,7 @@ function trustedOracleProgram() {
9345
6521
  ...client,
9346
6522
  trustedOracle: {
9347
6523
  accounts: {
9348
- oracleState: addSelfFetchFunctions(client, getOracleStateCodec3())
6524
+ oracleState: addSelfFetchFunctions(client, getOracleStateCodec2())
9349
6525
  },
9350
6526
  instructions: {
9351
6527
  finalize: (input) => addSelfPlanAndSendFunctions(client, getFinalizeInstruction(input)),
@@ -9362,14 +6538,12 @@ function trustedOracleProgram() {
9362
6538
  // src/solana/generated/trustedOracle/errors/trustedOracle.ts
9363
6539
  var TRUSTED_ORACLE_ERROR__UNAUTHORIZED = 6e3;
9364
6540
  var TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED = 6001;
9365
- var TRUSTED_ORACLE_ERROR__NOT_FINALIZED = 6002;
9366
6541
  var TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT = 6003;
9367
6542
  var trustedOracleErrorMessages;
9368
6543
  if (process.env.NODE_ENV !== "production") {
9369
6544
  trustedOracleErrorMessages = {
9370
6545
  [TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED]: `Oracle already finalized`,
9371
6546
  [TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT]: `Invalid winning mint`,
9372
- [TRUSTED_ORACLE_ERROR__NOT_FINALIZED]: `Oracle not finalized`,
9373
6547
  [TRUSTED_ORACLE_ERROR__UNAUTHORIZED]: `Unauthorized: only oracle authority can perform this action`
9374
6548
  };
9375
6549
  }