@whetstone-research/doppler-sdk 1.0.10 → 1.0.11

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.
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkI5JME35L_cjs = require('../chunk-I5JME35L.cjs');
4
- var chunkO6FR7TXY_cjs = require('../chunk-O6FR7TXY.cjs');
3
+ var chunk5USQGM5X_cjs = require('../chunk-5USQGM5X.cjs');
4
+ var chunk6FRZFA5R_cjs = require('../chunk-6FRZFA5R.cjs');
5
5
  var chunkQ7SFCCGT_cjs = require('../chunk-Q7SFCCGT.cjs');
6
6
  var kit = require('@solana/kit');
7
7
  var programClientCore = require('@solana/program-client-core');
@@ -10,179 +10,343 @@ var sha3_js = require('@noble/hashes/sha3.js');
10
10
  // src/solana/cpmm/index.ts
11
11
  var cpmm_exports = {};
12
12
  chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
13
- ACCOUNT_DISCRIMINATORS: () => chunkO6FR7TXY_cjs.ACCOUNT_DISCRIMINATORS,
14
- ACCOUNT_VERSION: () => chunkO6FR7TXY_cjs.ACCOUNT_VERSION,
15
- BPS_DENOM: () => chunkO6FR7TXY_cjs.BPS_DENOM,
13
+ ACCOUNT_DISCRIMINATORS: () => chunk6FRZFA5R_cjs.ACCOUNT_DISCRIMINATORS,
14
+ ACCOUNT_VERSION: () => chunk6FRZFA5R_cjs.ACCOUNT_VERSION,
15
+ ADD_LIQUIDITY_DISCRIMINATOR: () => ADD_LIQUIDITY_DISCRIMINATOR,
16
+ BPS_DENOM: () => chunk6FRZFA5R_cjs.BPS_DENOM,
17
+ CLOSE_POSITION_DISCRIMINATOR: () => CLOSE_POSITION_DISCRIMINATOR,
18
+ COLLECT_FEES_DISCRIMINATOR: () => COLLECT_FEES_DISCRIMINATOR,
19
+ COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
16
20
  CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
17
- CPMM_PROGRAM_ID: () => chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID,
21
+ CPMM_PROGRAM_ID: () => chunk6FRZFA5R_cjs.CPMM_PROGRAM_ID,
22
+ CREATE_POSITION_DISCRIMINATOR: () => CREATE_POSITION_DISCRIMINATOR,
18
23
  CpmmError: () => CpmmError,
19
24
  CpmmErrorCode: () => CpmmErrorCode,
20
- INSTRUCTION_DISCRIMINATORS: () => chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS,
21
- MAX_FEE_AMOUNT: () => chunkI5JME35L_cjs.MAX_FEE_AMOUNT,
22
- MAX_ORACLE_OBSERVATIONS: () => chunkO6FR7TXY_cjs.MAX_ORACLE_OBSERVATIONS,
23
- MAX_SENTINEL_ALLOWLIST: () => chunkO6FR7TXY_cjs.MAX_SENTINEL_ALLOWLIST,
24
- Q64_ONE: () => chunkO6FR7TXY_cjs.Q64_ONE,
25
- SEED_AUTHORITY: () => chunkO6FR7TXY_cjs.SEED_AUTHORITY,
26
- SEED_CONFIG: () => chunkO6FR7TXY_cjs.SEED_CONFIG,
27
- SEED_ORACLE: () => chunkO6FR7TXY_cjs.SEED_ORACLE,
28
- SEED_POOL: () => chunkO6FR7TXY_cjs.SEED_POOL,
29
- SEED_POSITION: () => chunkO6FR7TXY_cjs.SEED_POSITION,
30
- SEED_PROTOCOL_POSITION: () => chunkO6FR7TXY_cjs.SEED_PROTOCOL_POSITION,
31
- SENTINEL_NO_CHANGE: () => chunkO6FR7TXY_cjs.SENTINEL_NO_CHANGE,
32
- SF_AFTER_ADD_LIQ: () => chunkO6FR7TXY_cjs.SF_AFTER_ADD_LIQ,
33
- SF_AFTER_REMOVE_LIQ: () => chunkO6FR7TXY_cjs.SF_AFTER_REMOVE_LIQ,
34
- SF_AFTER_SWAP: () => chunkO6FR7TXY_cjs.SF_AFTER_SWAP,
35
- SF_BEFORE_ADD_LIQ: () => chunkO6FR7TXY_cjs.SF_BEFORE_ADD_LIQ,
36
- SF_BEFORE_REMOVE_LIQ: () => chunkO6FR7TXY_cjs.SF_BEFORE_REMOVE_LIQ,
37
- SF_BEFORE_SWAP: () => chunkO6FR7TXY_cjs.SF_BEFORE_SWAP,
38
- TOKEN_METADATA_PROGRAM_ID: () => chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID,
39
- addLiquidityArgsCodec: () => chunkI5JME35L_cjs.addLiquidityArgsCodec,
40
- ammConfigDataCodec: () => chunkI5JME35L_cjs.ammConfigDataCodec,
41
- areMintsOrdered: () => chunkO6FR7TXY_cjs.areMintsOrdered,
42
- calculateAccruedFees: () => chunkI5JME35L_cjs.calculateAccruedFees,
43
- calculateTwap: () => chunkI5JME35L_cjs.calculateTwap,
44
- calculateTwapNumber: () => chunkI5JME35L_cjs.calculateTwapNumber,
45
- ceilDiv: () => chunkI5JME35L_cjs.ceilDiv,
46
- collectFeesArgsCodec: () => chunkI5JME35L_cjs.collectFeesArgsCodec,
47
- collectProtocolFeesArgsCodec: () => chunkI5JME35L_cjs.collectProtocolFeesArgsCodec,
48
- comparePoolAndOraclePrices: () => chunkI5JME35L_cjs.comparePoolAndOraclePrices,
49
- computePrice0Q64: () => chunkI5JME35L_cjs.computePrice0Q64,
50
- computePrice1Q64: () => chunkI5JME35L_cjs.computePrice1Q64,
51
- consultTwap: () => chunkI5JME35L_cjs.consultTwap,
52
- createAddLiquidityInstruction: () => createAddLiquidityInstruction,
53
- createClosePositionInstruction: () => createClosePositionInstruction,
54
- createCollectFeesInstruction: () => chunkI5JME35L_cjs.createCollectFeesInstruction,
55
- createCollectProtocolFeesInstruction: () => createCollectProtocolFeesInstruction,
56
- createCreatePositionInstruction: () => createCreatePositionInstruction,
57
- createInitializeConfigInstruction: () => createInitializeConfigInstruction,
58
- createInitializeOracleInstruction: () => createInitializeOracleInstruction,
59
- createInitializePoolInstruction: () => createInitializePoolInstruction,
60
- createOracleConsultInstruction: () => createOracleConsultInstruction,
61
- createOracleUpdateInstruction: () => createOracleUpdateInstruction,
62
- createPauseInstruction: () => createPauseInstruction,
63
- createPositionArgsCodec: () => chunkI5JME35L_cjs.createPositionArgsCodec,
64
- createQuoteToNumeraireInstruction: () => createQuoteToNumeraireInstruction,
65
- createRemoveLiquidityInstruction: () => createRemoveLiquidityInstruction,
66
- createSetFeesInstruction: () => createSetFeesInstruction,
67
- createSetRouteInstruction: () => createSetRouteInstruction,
68
- createSetSentinelInstruction: () => createSetSentinelInstruction,
69
- createSkimInstruction: () => createSkimInstruction,
70
- createSwapExactInInstruction: () => createSwapExactInInstruction,
25
+ INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR,
26
+ INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
27
+ INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
28
+ INSTRUCTION_DISCRIMINATORS: () => chunk6FRZFA5R_cjs.INSTRUCTION_DISCRIMINATORS,
29
+ MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
30
+ MAX_ORACLE_OBSERVATIONS: () => chunk6FRZFA5R_cjs.MAX_ORACLE_OBSERVATIONS,
31
+ MAX_SENTINEL_ALLOWLIST: () => chunk6FRZFA5R_cjs.MAX_SENTINEL_ALLOWLIST,
32
+ ORACLE_CONSULT_DISCRIMINATOR: () => ORACLE_CONSULT_DISCRIMINATOR,
33
+ ORACLE_UPDATE_DISCRIMINATOR: () => ORACLE_UPDATE_DISCRIMINATOR,
34
+ PAUSE_DISCRIMINATOR: () => PAUSE_DISCRIMINATOR,
35
+ PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
36
+ Q64_ONE: () => chunk6FRZFA5R_cjs.Q64_ONE,
37
+ QUOTE_TO_NUMERAIRE_DISCRIMINATOR: () => QUOTE_TO_NUMERAIRE_DISCRIMINATOR,
38
+ REMOVE_LIQUIDITY_DISCRIMINATOR: () => REMOVE_LIQUIDITY_DISCRIMINATOR,
39
+ SEED_AUTHORITY: () => chunk6FRZFA5R_cjs.SEED_AUTHORITY,
40
+ SEED_CONFIG: () => chunk6FRZFA5R_cjs.SEED_CONFIG,
41
+ SEED_ORACLE: () => chunk6FRZFA5R_cjs.SEED_ORACLE,
42
+ SEED_POOL: () => chunk6FRZFA5R_cjs.SEED_POOL,
43
+ SEED_POSITION: () => chunk6FRZFA5R_cjs.SEED_POSITION,
44
+ SEED_PROTOCOL_POSITION: () => chunk6FRZFA5R_cjs.SEED_PROTOCOL_POSITION,
45
+ SENTINEL_NO_CHANGE: () => chunk6FRZFA5R_cjs.SENTINEL_NO_CHANGE,
46
+ SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
47
+ SET_ROUTE_DISCRIMINATOR: () => SET_ROUTE_DISCRIMINATOR,
48
+ SET_SENTINEL_DISCRIMINATOR: () => SET_SENTINEL_DISCRIMINATOR,
49
+ SF_AFTER_ADD_LIQ: () => chunk6FRZFA5R_cjs.SF_AFTER_ADD_LIQ,
50
+ SF_AFTER_REMOVE_LIQ: () => chunk6FRZFA5R_cjs.SF_AFTER_REMOVE_LIQ,
51
+ SF_AFTER_SWAP: () => chunk6FRZFA5R_cjs.SF_AFTER_SWAP,
52
+ SF_BEFORE_ADD_LIQ: () => chunk6FRZFA5R_cjs.SF_BEFORE_ADD_LIQ,
53
+ SF_BEFORE_REMOVE_LIQ: () => chunk6FRZFA5R_cjs.SF_BEFORE_REMOVE_LIQ,
54
+ SF_BEFORE_SWAP: () => chunk6FRZFA5R_cjs.SF_BEFORE_SWAP,
55
+ SKIM_DISCRIMINATOR: () => SKIM_DISCRIMINATOR,
56
+ SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
57
+ TOKEN_METADATA_PROGRAM_ID: () => chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID,
58
+ TRANSFER_ADMIN_DISCRIMINATOR: () => TRANSFER_ADMIN_DISCRIMINATOR,
59
+ UNPAUSE_DISCRIMINATOR: () => UNPAUSE_DISCRIMINATOR,
60
+ UPDATE_CONFIG_DISCRIMINATOR: () => UPDATE_CONFIG_DISCRIMINATOR,
61
+ addLiquidityArgsCodec: () => chunk5USQGM5X_cjs.addLiquidityArgsCodec,
62
+ ammConfigDataCodec: () => chunk5USQGM5X_cjs.ammConfigDataCodec,
63
+ areMintsOrdered: () => chunk6FRZFA5R_cjs.areMintsOrdered,
64
+ calculateAccruedFees: () => chunk5USQGM5X_cjs.calculateAccruedFees,
65
+ calculateTwap: () => chunk5USQGM5X_cjs.calculateTwap,
66
+ calculateTwapNumber: () => chunk5USQGM5X_cjs.calculateTwapNumber,
67
+ ceilDiv: () => chunk5USQGM5X_cjs.ceilDiv,
68
+ collectFeesArgsCodec: () => chunk5USQGM5X_cjs.collectFeesArgsCodec,
69
+ collectProtocolFeesArgsCodec: () => chunk5USQGM5X_cjs.collectProtocolFeesArgsCodec,
70
+ comparePoolAndOraclePrices: () => chunk5USQGM5X_cjs.comparePoolAndOraclePrices,
71
+ computePrice0Q64: () => chunk5USQGM5X_cjs.computePrice0Q64,
72
+ computePrice1Q64: () => chunk5USQGM5X_cjs.computePrice1Q64,
73
+ consultTwap: () => chunk5USQGM5X_cjs.consultTwap,
74
+ createAddLiquidityInstruction: () => getAddLiquidityInstruction,
75
+ createClosePositionInstruction: () => getClosePositionInstruction,
76
+ createCollectFeesInstruction: () => getCollectFeesInstruction,
77
+ createCollectProtocolFeesInstruction: () => getCollectProtocolFeesInstruction,
78
+ createCreatePositionInstruction: () => getCreatePositionInstruction,
79
+ createInitializeConfigInstruction: () => getInitializeConfigInstruction,
80
+ createInitializeOracleInstruction: () => getInitializeOracleInstruction,
81
+ createInitializePoolInstruction: () => getInitializePoolInstruction,
82
+ createOracleConsultInstruction: () => getOracleConsultInstruction,
83
+ createOracleUpdateInstruction: () => getOracleUpdateInstruction,
84
+ createPauseInstruction: () => getPauseInstruction,
85
+ createPositionArgsCodec: () => chunk5USQGM5X_cjs.createPositionArgsCodec,
86
+ createQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
87
+ createRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
88
+ createSetFeesInstruction: () => getSetFeesInstruction,
89
+ createSetRouteInstruction: () => getSetRouteInstruction,
90
+ createSetSentinelInstruction: () => getSetSentinelInstruction,
91
+ createSkimInstruction: () => getSkimInstruction,
92
+ createSwapExactInInstruction: () => getSwapExactInInstruction,
71
93
  createSwapInstruction: () => createSwapInstruction,
72
- createTransferAdminInstruction: () => createTransferAdminInstruction,
73
- createUnpauseInstruction: () => createUnpauseInstruction,
94
+ createTransferAdminInstruction: () => getTransferAdminInstruction,
95
+ createUnpauseInstruction: () => getUnpauseInstruction,
74
96
  curveParamsToMarketCap: () => curveParamsToMarketCap,
75
- decodeAmmConfig: () => chunkI5JME35L_cjs.decodeAmmConfig,
76
- decodeOracleConsultResult: () => decodeOracleConsultResult,
77
- decodeOracleState: () => chunkI5JME35L_cjs.decodeOracleState,
78
- decodePool: () => chunkI5JME35L_cjs.decodePool,
79
- decodePosition: () => chunkI5JME35L_cjs.decodePosition,
80
- decodeQuoteToNumeraireResult: () => decodeQuoteToNumeraireResult,
81
- encodeAddLiquidityArgs: () => chunkI5JME35L_cjs.encodeAddLiquidityArgs,
82
- encodeCollectFeesArgs: () => chunkI5JME35L_cjs.encodeCollectFeesArgs,
83
- encodeCollectProtocolFeesArgs: () => chunkI5JME35L_cjs.encodeCollectProtocolFeesArgs,
84
- encodeCreatePositionArgs: () => chunkI5JME35L_cjs.encodeCreatePositionArgs,
85
- encodeInitializeConfigArgs: () => chunkI5JME35L_cjs.encodeInitializeConfigArgs,
86
- encodeInitializeOracleArgs: () => chunkI5JME35L_cjs.encodeInitializeOracleArgs,
87
- encodeInitializePoolArgs: () => chunkI5JME35L_cjs.encodeInitializePoolArgs,
88
- encodeInstructionData: () => chunkI5JME35L_cjs.encodeInstructionData,
89
- encodeOracleConsultArgs: () => chunkI5JME35L_cjs.encodeOracleConsultArgs,
90
- encodeQuoteToNumeraireArgs: () => chunkI5JME35L_cjs.encodeQuoteToNumeraireArgs,
91
- encodeRemoveLiquidityArgs: () => chunkI5JME35L_cjs.encodeRemoveLiquidityArgs,
92
- encodeSetFeesArgs: () => chunkI5JME35L_cjs.encodeSetFeesArgs,
93
- encodeSetRouteArgs: () => chunkI5JME35L_cjs.encodeSetRouteArgs,
94
- encodeSetSentinelArgs: () => chunkI5JME35L_cjs.encodeSetSentinelArgs,
95
- encodeSwapExactInArgs: () => chunkI5JME35L_cjs.encodeSwapExactInArgs,
96
- encodeTransferAdminArgs: () => chunkI5JME35L_cjs.encodeTransferAdminArgs,
97
- fetchAllPools: () => chunkI5JME35L_cjs.fetchAllPools,
97
+ decodeAmmConfig: () => chunk5USQGM5X_cjs.decodeAmmConfig,
98
+ decodeOracleState: () => chunk5USQGM5X_cjs.decodeOracleState,
99
+ decodePool: () => chunk5USQGM5X_cjs.decodePool,
100
+ decodePosition: () => chunk5USQGM5X_cjs.decodePosition,
101
+ encodeAddLiquidityArgs: () => chunk5USQGM5X_cjs.encodeAddLiquidityArgs,
102
+ encodeCollectFeesArgs: () => chunk5USQGM5X_cjs.encodeCollectFeesArgs,
103
+ encodeCollectProtocolFeesArgs: () => chunk5USQGM5X_cjs.encodeCollectProtocolFeesArgs,
104
+ encodeCreatePositionArgs: () => chunk5USQGM5X_cjs.encodeCreatePositionArgs,
105
+ encodeInitializeConfigArgs: () => chunk5USQGM5X_cjs.encodeInitializeConfigArgs,
106
+ encodeInitializeOracleArgs: () => chunk5USQGM5X_cjs.encodeInitializeOracleArgs,
107
+ encodeInitializePoolArgs: () => chunk5USQGM5X_cjs.encodeInitializePoolArgs,
108
+ encodeInstructionData: () => chunk5USQGM5X_cjs.encodeInstructionData,
109
+ encodeOracleConsultArgs: () => chunk5USQGM5X_cjs.encodeOracleConsultArgs,
110
+ encodeQuoteToNumeraireArgs: () => chunk5USQGM5X_cjs.encodeQuoteToNumeraireArgs,
111
+ encodeRemoveLiquidityArgs: () => chunk5USQGM5X_cjs.encodeRemoveLiquidityArgs,
112
+ encodeSetFeesArgs: () => chunk5USQGM5X_cjs.encodeSetFeesArgs,
113
+ encodeSetRouteArgs: () => chunk5USQGM5X_cjs.encodeSetRouteArgs,
114
+ encodeSetSentinelArgs: () => chunk5USQGM5X_cjs.encodeSetSentinelArgs,
115
+ encodeSwapExactInArgs: () => chunk5USQGM5X_cjs.encodeSwapExactInArgs,
116
+ encodeTransferAdminArgs: () => chunk5USQGM5X_cjs.encodeTransferAdminArgs,
117
+ fetchAllPools: () => chunk5USQGM5X_cjs.fetchAllPools,
98
118
  fetchConfig: () => fetchConfig,
99
119
  fetchConfigWithAddress: () => fetchConfigWithAddress,
100
- fetchOracle: () => chunkI5JME35L_cjs.fetchOracle,
101
- fetchOraclesBatch: () => chunkI5JME35L_cjs.fetchOraclesBatch,
102
- fetchPool: () => chunkI5JME35L_cjs.fetchPool,
103
- fetchPoolPositions: () => chunkI5JME35L_cjs.fetchPoolPositions,
104
- fetchPoolsBatch: () => chunkI5JME35L_cjs.fetchPoolsBatch,
105
- fetchPosition: () => chunkI5JME35L_cjs.fetchPosition,
106
- fetchPositionByParams: () => chunkI5JME35L_cjs.fetchPositionByParams,
107
- fetchPositionsBatch: () => chunkI5JME35L_cjs.fetchPositionsBatch,
108
- fetchUserPositions: () => chunkI5JME35L_cjs.fetchUserPositions,
109
- filterActivePositions: () => chunkI5JME35L_cjs.filterActivePositions,
110
- filterPoolsByMint: () => chunkI5JME35L_cjs.filterPoolsByMint,
111
- getAddLiquidityQuote: () => chunkI5JME35L_cjs.getAddLiquidityQuote,
112
- getConfigAddress: () => chunkO6FR7TXY_cjs.getConfigAddress,
120
+ fetchOracle: () => chunk5USQGM5X_cjs.fetchOracle,
121
+ fetchOraclesBatch: () => chunk5USQGM5X_cjs.fetchOraclesBatch,
122
+ fetchPool: () => chunk5USQGM5X_cjs.fetchPool,
123
+ fetchPoolPositions: () => chunk5USQGM5X_cjs.fetchPoolPositions,
124
+ fetchPoolsBatch: () => chunk5USQGM5X_cjs.fetchPoolsBatch,
125
+ fetchPosition: () => chunk5USQGM5X_cjs.fetchPosition,
126
+ fetchPositionByParams: () => chunk5USQGM5X_cjs.fetchPositionByParams,
127
+ fetchPositionsBatch: () => chunk5USQGM5X_cjs.fetchPositionsBatch,
128
+ fetchUserPositions: () => chunk5USQGM5X_cjs.fetchUserPositions,
129
+ filterActivePositions: () => chunk5USQGM5X_cjs.filterActivePositions,
130
+ filterPoolsByMint: () => chunk5USQGM5X_cjs.filterPoolsByMint,
131
+ getAddLiquidityDiscriminatorBytes: () => getAddLiquidityDiscriminatorBytes,
132
+ getAddLiquidityInstruction: () => getAddLiquidityInstruction,
133
+ getAddLiquidityInstructionAsync: () => getAddLiquidityInstructionAsync,
134
+ getAddLiquidityInstructionDataCodec: () => getAddLiquidityInstructionDataCodec,
135
+ getAddLiquidityInstructionDataDecoder: () => getAddLiquidityInstructionDataDecoder,
136
+ getAddLiquidityInstructionDataEncoder: () => getAddLiquidityInstructionDataEncoder,
137
+ getAddLiquidityQuote: () => chunk5USQGM5X_cjs.getAddLiquidityQuote,
138
+ getClosePositionDiscriminatorBytes: () => getClosePositionDiscriminatorBytes,
139
+ getClosePositionInstruction: () => getClosePositionInstruction,
140
+ getClosePositionInstructionDataCodec: () => getClosePositionInstructionDataCodec,
141
+ getClosePositionInstructionDataDecoder: () => getClosePositionInstructionDataDecoder,
142
+ getClosePositionInstructionDataEncoder: () => getClosePositionInstructionDataEncoder,
143
+ getCollectFeesDiscriminatorBytes: () => getCollectFeesDiscriminatorBytes,
144
+ getCollectFeesInstruction: () => getCollectFeesInstruction,
145
+ getCollectFeesInstructionAsync: () => getCollectFeesInstructionAsync,
146
+ getCollectFeesInstructionDataCodec: () => getCollectFeesInstructionDataCodec,
147
+ getCollectFeesInstructionDataDecoder: () => getCollectFeesInstructionDataDecoder,
148
+ getCollectFeesInstructionDataEncoder: () => getCollectFeesInstructionDataEncoder,
149
+ getCollectProtocolFeesDiscriminatorBytes: () => getCollectProtocolFeesDiscriminatorBytes,
150
+ getCollectProtocolFeesInstruction: () => getCollectProtocolFeesInstruction,
151
+ getCollectProtocolFeesInstructionAsync: () => getCollectProtocolFeesInstructionAsync,
152
+ getCollectProtocolFeesInstructionDataCodec: () => getCollectProtocolFeesInstructionDataCodec,
153
+ getCollectProtocolFeesInstructionDataDecoder: () => getCollectProtocolFeesInstructionDataDecoder,
154
+ getCollectProtocolFeesInstructionDataEncoder: () => getCollectProtocolFeesInstructionDataEncoder,
155
+ getConfigAddress: () => chunk6FRZFA5R_cjs.getConfigAddress,
156
+ getCreatePositionDiscriminatorBytes: () => getCreatePositionDiscriminatorBytes,
157
+ getCreatePositionInstruction: () => getCreatePositionInstruction,
158
+ getCreatePositionInstructionAsync: () => getCreatePositionInstructionAsync,
159
+ getCreatePositionInstructionDataCodec: () => getCreatePositionInstructionDataCodec,
160
+ getCreatePositionInstructionDataDecoder: () => getCreatePositionInstructionDataDecoder,
161
+ getCreatePositionInstructionDataEncoder: () => getCreatePositionInstructionDataEncoder,
113
162
  getErrorMessage: () => getErrorMessage,
114
- getK: () => chunkI5JME35L_cjs.getK,
115
- getLiquidityAddresses: () => chunkO6FR7TXY_cjs.getLiquidityAddresses,
163
+ getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes,
164
+ getInitializeConfigInstruction: () => getInitializeConfigInstruction,
165
+ getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync,
166
+ getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec,
167
+ getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder,
168
+ getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder,
169
+ getInitializeOracleDiscriminatorBytes: () => getInitializeOracleDiscriminatorBytes,
170
+ getInitializeOracleInstruction: () => getInitializeOracleInstruction,
171
+ getInitializeOracleInstructionAsync: () => getInitializeOracleInstructionAsync,
172
+ getInitializeOracleInstructionDataCodec: () => getInitializeOracleInstructionDataCodec,
173
+ getInitializeOracleInstructionDataDecoder: () => getInitializeOracleInstructionDataDecoder,
174
+ getInitializeOracleInstructionDataEncoder: () => getInitializeOracleInstructionDataEncoder,
175
+ getInitializePoolDiscriminatorBytes: () => getInitializePoolDiscriminatorBytes,
176
+ getInitializePoolInstruction: () => getInitializePoolInstruction,
177
+ getInitializePoolInstructionAsync: () => getInitializePoolInstructionAsync,
178
+ getInitializePoolInstructionDataCodec: () => getInitializePoolInstructionDataCodec,
179
+ getInitializePoolInstructionDataDecoder: () => getInitializePoolInstructionDataDecoder,
180
+ getInitializePoolInstructionDataEncoder: () => getInitializePoolInstructionDataEncoder,
181
+ getK: () => chunk5USQGM5X_cjs.getK,
182
+ getLiquidityAddresses: () => chunk6FRZFA5R_cjs.getLiquidityAddresses,
116
183
  getMetadataAddress: () => getMetadataAddress,
117
- getOracleAddress: () => chunkO6FR7TXY_cjs.getOracleAddress,
118
- getOracleAddressFromPool: () => chunkI5JME35L_cjs.getOracleAddressFromPool,
119
- getOracleAge: () => chunkI5JME35L_cjs.getOracleAge,
120
- getOracleBufferStats: () => chunkI5JME35L_cjs.getOracleBufferStats,
121
- getOracleDeviation: () => chunkI5JME35L_cjs.getOracleDeviation,
122
- getOracleForPool: () => chunkI5JME35L_cjs.getOracleForPool,
123
- getOracleSpotPrices: () => chunkI5JME35L_cjs.getOracleSpotPrices,
124
- getPendingFees: () => chunkI5JME35L_cjs.getPendingFees,
125
- getPoolAddress: () => chunkO6FR7TXY_cjs.getPoolAddress,
126
- getPoolAddressFromMints: () => chunkI5JME35L_cjs.getPoolAddressFromMints,
127
- getPoolAuthorityAddress: () => chunkO6FR7TXY_cjs.getPoolAuthorityAddress,
128
- getPoolByMints: () => chunkI5JME35L_cjs.getPoolByMints,
129
- getPoolInitAddresses: () => chunkO6FR7TXY_cjs.getPoolInitAddresses,
130
- getPoolVault0Address: () => chunkO6FR7TXY_cjs.getPoolVault0Address,
131
- getPoolVault1Address: () => chunkO6FR7TXY_cjs.getPoolVault1Address,
132
- getPositionAddress: () => chunkO6FR7TXY_cjs.getPositionAddress,
133
- getPositionAddressFromParams: () => chunkI5JME35L_cjs.getPositionAddressFromParams,
134
- getPositionValue: () => chunkI5JME35L_cjs.getPositionValue,
135
- getProtocolPositionAddress: () => chunkO6FR7TXY_cjs.getProtocolPositionAddress,
136
- getRemoveLiquidityQuote: () => chunkI5JME35L_cjs.getRemoveLiquidityQuote,
137
- getSpotPrice0: () => chunkI5JME35L_cjs.getSpotPrice0,
138
- getSpotPrice1: () => chunkI5JME35L_cjs.getSpotPrice1,
139
- getSwapAddresses: () => chunkO6FR7TXY_cjs.getSwapAddresses,
140
- getSwapQuote: () => chunkI5JME35L_cjs.getSwapQuote,
141
- getSwapQuoteExactOut: () => chunkI5JME35L_cjs.getSwapQuoteExactOut,
142
- getTvl: () => chunkI5JME35L_cjs.getTvl,
143
- initializeConfigArgsCodec: () => chunkI5JME35L_cjs.initializeConfigArgsCodec,
144
- initializeOracleArgsCodec: () => chunkI5JME35L_cjs.initializeOracleArgsCodec,
145
- initializePoolArgsCodec: () => chunkI5JME35L_cjs.initializePoolArgsCodec,
184
+ getOracleAddress: () => chunk6FRZFA5R_cjs.getOracleAddress,
185
+ getOracleAddressFromPool: () => chunk5USQGM5X_cjs.getOracleAddressFromPool,
186
+ getOracleAge: () => chunk5USQGM5X_cjs.getOracleAge,
187
+ getOracleBufferStats: () => chunk5USQGM5X_cjs.getOracleBufferStats,
188
+ getOracleConsultDiscriminatorBytes: () => getOracleConsultDiscriminatorBytes,
189
+ getOracleConsultInstruction: () => getOracleConsultInstruction,
190
+ getOracleConsultInstructionAsync: () => getOracleConsultInstructionAsync,
191
+ getOracleConsultInstructionDataCodec: () => getOracleConsultInstructionDataCodec,
192
+ getOracleConsultInstructionDataDecoder: () => getOracleConsultInstructionDataDecoder,
193
+ getOracleConsultInstructionDataEncoder: () => getOracleConsultInstructionDataEncoder,
194
+ getOracleDeviation: () => chunk5USQGM5X_cjs.getOracleDeviation,
195
+ getOracleForPool: () => chunk5USQGM5X_cjs.getOracleForPool,
196
+ getOracleSpotPrices: () => chunk5USQGM5X_cjs.getOracleSpotPrices,
197
+ getOracleUpdateDiscriminatorBytes: () => getOracleUpdateDiscriminatorBytes,
198
+ getOracleUpdateInstruction: () => getOracleUpdateInstruction,
199
+ getOracleUpdateInstructionAsync: () => getOracleUpdateInstructionAsync,
200
+ getOracleUpdateInstructionDataCodec: () => getOracleUpdateInstructionDataCodec,
201
+ getOracleUpdateInstructionDataDecoder: () => getOracleUpdateInstructionDataDecoder,
202
+ getOracleUpdateInstructionDataEncoder: () => getOracleUpdateInstructionDataEncoder,
203
+ getPauseDiscriminatorBytes: () => getPauseDiscriminatorBytes,
204
+ getPauseInstruction: () => getPauseInstruction,
205
+ getPauseInstructionDataCodec: () => getPauseInstructionDataCodec,
206
+ getPauseInstructionDataDecoder: () => getPauseInstructionDataDecoder,
207
+ getPauseInstructionDataEncoder: () => getPauseInstructionDataEncoder,
208
+ getPendingFees: () => chunk5USQGM5X_cjs.getPendingFees,
209
+ getPoolAddress: () => chunk6FRZFA5R_cjs.getPoolAddress,
210
+ getPoolAddressFromMints: () => chunk5USQGM5X_cjs.getPoolAddressFromMints,
211
+ getPoolAuthorityAddress: () => chunk6FRZFA5R_cjs.getPoolAuthorityAddress,
212
+ getPoolByMints: () => chunk5USQGM5X_cjs.getPoolByMints,
213
+ getPoolInitAddresses: () => chunk6FRZFA5R_cjs.getPoolInitAddresses,
214
+ getPoolVault0Address: () => chunk6FRZFA5R_cjs.getPoolVault0Address,
215
+ getPoolVault1Address: () => chunk6FRZFA5R_cjs.getPoolVault1Address,
216
+ getPositionAddress: () => chunk6FRZFA5R_cjs.getPositionAddress,
217
+ getPositionAddressFromParams: () => chunk5USQGM5X_cjs.getPositionAddressFromParams,
218
+ getPositionValue: () => chunk5USQGM5X_cjs.getPositionValue,
219
+ getPreviewSwapExactInDiscriminatorBytes: () => getPreviewSwapExactInDiscriminatorBytes,
220
+ getPreviewSwapExactInInstruction: () => getPreviewSwapExactInInstruction,
221
+ getPreviewSwapExactInInstructionDataCodec: () => getPreviewSwapExactInInstructionDataCodec,
222
+ getPreviewSwapExactInInstructionDataDecoder: () => getPreviewSwapExactInInstructionDataDecoder,
223
+ getPreviewSwapExactInInstructionDataEncoder: () => getPreviewSwapExactInInstructionDataEncoder,
224
+ getProtocolPositionAddress: () => chunk6FRZFA5R_cjs.getProtocolPositionAddress,
225
+ getQuoteToNumeraireDiscriminatorBytes: () => getQuoteToNumeraireDiscriminatorBytes,
226
+ getQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
227
+ getQuoteToNumeraireInstructionDataCodec: () => getQuoteToNumeraireInstructionDataCodec,
228
+ getQuoteToNumeraireInstructionDataDecoder: () => getQuoteToNumeraireInstructionDataDecoder,
229
+ getQuoteToNumeraireInstructionDataEncoder: () => getQuoteToNumeraireInstructionDataEncoder,
230
+ getRemoveLiquidityDiscriminatorBytes: () => getRemoveLiquidityDiscriminatorBytes,
231
+ getRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
232
+ getRemoveLiquidityInstructionAsync: () => getRemoveLiquidityInstructionAsync,
233
+ getRemoveLiquidityInstructionDataCodec: () => getRemoveLiquidityInstructionDataCodec,
234
+ getRemoveLiquidityInstructionDataDecoder: () => getRemoveLiquidityInstructionDataDecoder,
235
+ getRemoveLiquidityInstructionDataEncoder: () => getRemoveLiquidityInstructionDataEncoder,
236
+ getRemoveLiquidityQuote: () => chunk5USQGM5X_cjs.getRemoveLiquidityQuote,
237
+ getSetFeesDiscriminatorBytes: () => getSetFeesDiscriminatorBytes,
238
+ getSetFeesInstruction: () => getSetFeesInstruction,
239
+ getSetFeesInstructionDataCodec: () => getSetFeesInstructionDataCodec,
240
+ getSetFeesInstructionDataDecoder: () => getSetFeesInstructionDataDecoder,
241
+ getSetFeesInstructionDataEncoder: () => getSetFeesInstructionDataEncoder,
242
+ getSetRouteDiscriminatorBytes: () => getSetRouteDiscriminatorBytes,
243
+ getSetRouteInstruction: () => getSetRouteInstruction,
244
+ getSetRouteInstructionDataCodec: () => getSetRouteInstructionDataCodec,
245
+ getSetRouteInstructionDataDecoder: () => getSetRouteInstructionDataDecoder,
246
+ getSetRouteInstructionDataEncoder: () => getSetRouteInstructionDataEncoder,
247
+ getSetSentinelDiscriminatorBytes: () => getSetSentinelDiscriminatorBytes,
248
+ getSetSentinelInstruction: () => getSetSentinelInstruction,
249
+ getSetSentinelInstructionDataCodec: () => getSetSentinelInstructionDataCodec,
250
+ getSetSentinelInstructionDataDecoder: () => getSetSentinelInstructionDataDecoder,
251
+ getSetSentinelInstructionDataEncoder: () => getSetSentinelInstructionDataEncoder,
252
+ getSkimDiscriminatorBytes: () => getSkimDiscriminatorBytes,
253
+ getSkimInstruction: () => getSkimInstruction,
254
+ getSkimInstructionAsync: () => getSkimInstructionAsync,
255
+ getSkimInstructionDataCodec: () => getSkimInstructionDataCodec,
256
+ getSkimInstructionDataDecoder: () => getSkimInstructionDataDecoder,
257
+ getSkimInstructionDataEncoder: () => getSkimInstructionDataEncoder,
258
+ getSpotPrice0: () => chunk5USQGM5X_cjs.getSpotPrice0,
259
+ getSpotPrice1: () => chunk5USQGM5X_cjs.getSpotPrice1,
260
+ getSwapAddresses: () => chunk6FRZFA5R_cjs.getSwapAddresses,
261
+ getSwapExactInDiscriminatorBytes: () => getSwapExactInDiscriminatorBytes,
262
+ getSwapExactInInstruction: () => getSwapExactInInstruction,
263
+ getSwapExactInInstructionAsync: () => getSwapExactInInstructionAsync,
264
+ getSwapExactInInstructionDataCodec: () => getSwapExactInInstructionDataCodec,
265
+ getSwapExactInInstructionDataDecoder: () => getSwapExactInInstructionDataDecoder,
266
+ getSwapExactInInstructionDataEncoder: () => getSwapExactInInstructionDataEncoder,
267
+ getSwapQuote: () => chunk5USQGM5X_cjs.getSwapQuote,
268
+ getSwapQuoteExactOut: () => chunk5USQGM5X_cjs.getSwapQuoteExactOut,
269
+ getTransferAdminDiscriminatorBytes: () => getTransferAdminDiscriminatorBytes,
270
+ getTransferAdminInstruction: () => getTransferAdminInstruction,
271
+ getTransferAdminInstructionDataCodec: () => getTransferAdminInstructionDataCodec,
272
+ getTransferAdminInstructionDataDecoder: () => getTransferAdminInstructionDataDecoder,
273
+ getTransferAdminInstructionDataEncoder: () => getTransferAdminInstructionDataEncoder,
274
+ getTvl: () => chunk5USQGM5X_cjs.getTvl,
275
+ getUnpauseDiscriminatorBytes: () => getUnpauseDiscriminatorBytes,
276
+ getUnpauseInstruction: () => getUnpauseInstruction,
277
+ getUnpauseInstructionDataCodec: () => getUnpauseInstructionDataCodec,
278
+ getUnpauseInstructionDataDecoder: () => getUnpauseInstructionDataDecoder,
279
+ getUnpauseInstructionDataEncoder: () => getUnpauseInstructionDataEncoder,
280
+ getUpdateConfigDiscriminatorBytes: () => getUpdateConfigDiscriminatorBytes,
281
+ getUpdateConfigInstruction: () => getUpdateConfigInstruction,
282
+ getUpdateConfigInstructionDataCodec: () => getUpdateConfigInstructionDataCodec,
283
+ getUpdateConfigInstructionDataDecoder: () => getUpdateConfigInstructionDataDecoder,
284
+ getUpdateConfigInstructionDataEncoder: () => getUpdateConfigInstructionDataEncoder,
285
+ initializeConfigArgsCodec: () => chunk5USQGM5X_cjs.initializeConfigArgsCodec,
286
+ initializeOracleArgsCodec: () => chunk5USQGM5X_cjs.initializeOracleArgsCodec,
287
+ initializePoolArgsCodec: () => chunk5USQGM5X_cjs.initializePoolArgsCodec,
146
288
  isCpmmError: () => isCpmmError,
147
- isOracleStale: () => chunkI5JME35L_cjs.isOracleStale,
148
- isqrt: () => chunkI5JME35L_cjs.isqrt,
289
+ isOracleStale: () => chunk5USQGM5X_cjs.isOracleStale,
290
+ isqrt: () => chunk5USQGM5X_cjs.isqrt,
149
291
  marketCapToCurveParams: () => marketCapToCurveParams,
150
292
  marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
151
293
  marketCapToTokenPrice: () => marketCapToTokenPrice,
152
- maxBigInt: () => chunkI5JME35L_cjs.maxBigInt,
153
- minBigInt: () => chunkI5JME35L_cjs.minBigInt,
154
- numberToQ64: () => chunkI5JME35L_cjs.numberToQ64,
155
- observationCodec: () => chunkI5JME35L_cjs.observationCodec,
156
- oracleConsultArgsCodec: () => chunkI5JME35L_cjs.oracleConsultArgsCodec,
157
- oracleStateDataCodec: () => chunkI5JME35L_cjs.oracleStateDataCodec,
294
+ maxBigInt: () => chunk5USQGM5X_cjs.maxBigInt,
295
+ minBigInt: () => chunk5USQGM5X_cjs.minBigInt,
296
+ numberToQ64: () => chunk5USQGM5X_cjs.numberToQ64,
297
+ observationCodec: () => chunk5USQGM5X_cjs.observationCodec,
298
+ oracleConsultArgsCodec: () => chunk5USQGM5X_cjs.oracleConsultArgsCodec,
299
+ oracleStateDataCodec: () => chunk5USQGM5X_cjs.oracleStateDataCodec,
300
+ parseAddLiquidityInstruction: () => parseAddLiquidityInstruction,
301
+ parseClosePositionInstruction: () => parseClosePositionInstruction,
302
+ parseCollectFeesInstruction: () => parseCollectFeesInstruction,
303
+ parseCollectProtocolFeesInstruction: () => parseCollectProtocolFeesInstruction,
304
+ parseCreatePositionInstruction: () => parseCreatePositionInstruction,
158
305
  parseErrorFromLogs: () => parseErrorFromLogs,
159
- poolDataCodec: () => chunkI5JME35L_cjs.poolDataCodec,
160
- poolExists: () => chunkI5JME35L_cjs.poolExists,
161
- positionDataCodec: () => chunkI5JME35L_cjs.positionDataCodec,
162
- q64Div: () => chunkI5JME35L_cjs.q64Div,
163
- q64Mul: () => chunkI5JME35L_cjs.q64Mul,
164
- q64ToNumber: () => chunkI5JME35L_cjs.q64ToNumber,
165
- quoteToNumeraireArgsCodec: () => chunkI5JME35L_cjs.quoteToNumeraireArgsCodec,
166
- ratioToNumber: () => chunkI5JME35L_cjs.ratioToNumber,
167
- removeLiquidityArgsCodec: () => chunkI5JME35L_cjs.removeLiquidityArgsCodec,
168
- setFeesArgsCodec: () => chunkI5JME35L_cjs.setFeesArgsCodec,
169
- setRouteArgsCodec: () => chunkI5JME35L_cjs.setRouteArgsCodec,
170
- setSentinelArgsCodec: () => chunkI5JME35L_cjs.setSentinelArgsCodec,
171
- sortMints: () => chunkO6FR7TXY_cjs.sortMints,
172
- sortPoolsByReserves: () => chunkI5JME35L_cjs.sortPoolsByReserves,
173
- sortPositionsByShares: () => chunkI5JME35L_cjs.sortPositionsByShares,
174
- swapExactInArgsCodec: () => chunkI5JME35L_cjs.swapExactInArgsCodec,
175
- transferAdminArgsCodec: () => chunkI5JME35L_cjs.transferAdminArgsCodec,
306
+ parseInitializeConfigInstruction: () => parseInitializeConfigInstruction,
307
+ parseInitializeOracleInstruction: () => parseInitializeOracleInstruction,
308
+ parseInitializePoolInstruction: () => parseInitializePoolInstruction,
309
+ parseOracleConsultInstruction: () => parseOracleConsultInstruction,
310
+ parseOracleUpdateInstruction: () => parseOracleUpdateInstruction,
311
+ parsePauseInstruction: () => parsePauseInstruction,
312
+ parsePreviewSwapExactInInstruction: () => parsePreviewSwapExactInInstruction,
313
+ parseQuoteToNumeraireInstruction: () => parseQuoteToNumeraireInstruction,
314
+ parseRemoveLiquidityInstruction: () => parseRemoveLiquidityInstruction,
315
+ parseSetFeesInstruction: () => parseSetFeesInstruction,
316
+ parseSetRouteInstruction: () => parseSetRouteInstruction,
317
+ parseSetSentinelInstruction: () => parseSetSentinelInstruction,
318
+ parseSkimInstruction: () => parseSkimInstruction,
319
+ parseSwapExactInInstruction: () => parseSwapExactInInstruction,
320
+ parseTransferAdminInstruction: () => parseTransferAdminInstruction,
321
+ parseUnpauseInstruction: () => parseUnpauseInstruction,
322
+ parseUpdateConfigInstruction: () => parseUpdateConfigInstruction,
323
+ poolDataCodec: () => chunk5USQGM5X_cjs.poolDataCodec,
324
+ poolExists: () => chunk5USQGM5X_cjs.poolExists,
325
+ positionDataCodec: () => chunk5USQGM5X_cjs.positionDataCodec,
326
+ q64Div: () => chunk5USQGM5X_cjs.q64Div,
327
+ q64Mul: () => chunk5USQGM5X_cjs.q64Mul,
328
+ q64ToNumber: () => chunk5USQGM5X_cjs.q64ToNumber,
329
+ quoteToNumeraireArgsCodec: () => chunk5USQGM5X_cjs.quoteToNumeraireArgsCodec,
330
+ ratioToNumber: () => chunk5USQGM5X_cjs.ratioToNumber,
331
+ removeLiquidityArgsCodec: () => chunk5USQGM5X_cjs.removeLiquidityArgsCodec,
332
+ setFeesArgsCodec: () => chunk5USQGM5X_cjs.setFeesArgsCodec,
333
+ setRouteArgsCodec: () => chunk5USQGM5X_cjs.setRouteArgsCodec,
334
+ setSentinelArgsCodec: () => chunk5USQGM5X_cjs.setSentinelArgsCodec,
335
+ sortMints: () => chunk6FRZFA5R_cjs.sortMints,
336
+ sortPoolsByReserves: () => chunk5USQGM5X_cjs.sortPoolsByReserves,
337
+ sortPositionsByShares: () => chunk5USQGM5X_cjs.sortPositionsByShares,
338
+ swapExactInArgsCodec: () => chunk5USQGM5X_cjs.swapExactInArgsCodec,
339
+ transferAdminArgsCodec: () => chunk5USQGM5X_cjs.transferAdminArgsCodec,
176
340
  validateMarketCapParameters: () => validateMarketCapParameters
177
341
  });
178
342
  var addressCodec = kit.getAddressCodec();
179
343
  var textEncoder = new TextEncoder();
180
344
  async function getMetadataAddress(mint) {
181
345
  return kit.getProgramDerivedAddress({
182
- programAddress: chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID,
346
+ programAddress: chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID,
183
347
  seeds: [
184
348
  textEncoder.encode("metadata"),
185
- addressCodec.encode(chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID),
349
+ addressCodec.encode(chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID),
186
350
  addressCodec.encode(mint)
187
351
  ]
188
352
  });
@@ -470,297 +634,2858 @@ function getErrorMessage(code) {
470
634
  }
471
635
  return `Unknown error code: ${code}`;
472
636
  }
473
- function createInitializeConfigInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
474
- const { config, payer, systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS } = accounts;
475
- const keys = [
476
- { address: config, role: kit.AccountRole.WRITABLE },
477
- { address: payer, role: kit.AccountRole.WRITABLE_SIGNER },
478
- { address: systemProgram, role: kit.AccountRole.READONLY }
479
- ];
480
- const data = chunkI5JME35L_cjs.encodeInstructionData(
481
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.initializeConfig,
482
- chunkI5JME35L_cjs.initializeConfigArgsCodec,
483
- args
637
+
638
+ // src/solana/generated/cpmm/programs/cpmm.ts
639
+ var CPMM_PROGRAM_ADDRESS = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
640
+
641
+ // src/solana/generated/cpmm/instructions/addLiquidity.ts
642
+ var ADD_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
643
+ 181,
644
+ 157,
645
+ 89,
646
+ 67,
647
+ 143,
648
+ 182,
649
+ 52,
650
+ 72
651
+ ]);
652
+ function getAddLiquidityDiscriminatorBytes() {
653
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
654
+ ADD_LIQUIDITY_DISCRIMINATOR
484
655
  );
485
- return {
486
- programAddress: programId,
487
- accounts: keys,
488
- data
489
- };
490
656
  }
491
- function isTransactionSigner(value) {
492
- return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
657
+ function getAddLiquidityInstructionDataEncoder() {
658
+ return kit.transformEncoder(
659
+ kit.getStructEncoder([
660
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
661
+ ["amount0Max", kit.getU64Encoder()],
662
+ ["amount1Max", kit.getU64Encoder()],
663
+ ["minSharesOut", kit.getU128Encoder()],
664
+ ["updateOracle", kit.getBooleanEncoder()]
665
+ ]),
666
+ (value) => ({ ...value, discriminator: ADD_LIQUIDITY_DISCRIMINATOR })
667
+ );
493
668
  }
494
- function createSignerAccountMeta(value, role) {
495
- if (isTransactionSigner(value)) {
496
- return {
497
- address: value.address,
498
- role,
499
- signer: value
500
- };
501
- }
502
- return { address: value, role };
669
+ function getAddLiquidityInstructionDataDecoder() {
670
+ return kit.getStructDecoder([
671
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
672
+ ["amount0Max", kit.getU64Decoder()],
673
+ ["amount1Max", kit.getU64Decoder()],
674
+ ["minSharesOut", kit.getU128Decoder()],
675
+ ["updateOracle", kit.getBooleanDecoder()]
676
+ ]);
503
677
  }
504
- function createInitializePoolInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
505
- const {
506
- config,
507
- pool,
508
- protocolPosition,
509
- authority,
510
- vault0,
511
- vault1,
512
- token0Mint,
513
- token1Mint,
514
- payer,
515
- token0Program,
516
- token1Program,
517
- tokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
518
- systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS,
519
- rent,
520
- migrationAuthority
521
- } = accounts;
522
- const resolvedToken0Program = token0Program ?? tokenProgram;
523
- const resolvedToken1Program = token1Program ?? tokenProgram;
524
- const keys = [
525
- { address: config, role: kit.AccountRole.READONLY },
526
- { address: pool, role: kit.AccountRole.WRITABLE },
527
- { address: protocolPosition, role: kit.AccountRole.WRITABLE },
528
- { address: authority, role: kit.AccountRole.READONLY },
529
- { address: vault0, role: kit.AccountRole.WRITABLE },
530
- { address: vault1, role: kit.AccountRole.WRITABLE },
531
- { address: token0Mint, role: kit.AccountRole.READONLY },
532
- { address: token1Mint, role: kit.AccountRole.READONLY },
533
- createSignerAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER),
534
- { address: resolvedToken0Program, role: kit.AccountRole.READONLY },
535
- { address: resolvedToken1Program, role: kit.AccountRole.READONLY },
536
- { address: systemProgram, role: kit.AccountRole.READONLY },
537
- { address: rent, role: kit.AccountRole.READONLY },
538
- createSignerAccountMeta(migrationAuthority, kit.AccountRole.READONLY_SIGNER)
539
- ];
540
- const data = chunkI5JME35L_cjs.encodeInstructionData(
541
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.initializePool,
542
- chunkI5JME35L_cjs.initializePoolArgsCodec,
543
- args
678
+ function getAddLiquidityInstructionDataCodec() {
679
+ return kit.combineCodec(
680
+ getAddLiquidityInstructionDataEncoder(),
681
+ getAddLiquidityInstructionDataDecoder()
544
682
  );
545
- return {
546
- programAddress: programId,
547
- accounts: keys,
548
- data
683
+ }
684
+ async function getAddLiquidityInstructionAsync(input, config) {
685
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
686
+ const originalAccounts = {
687
+ config: { value: input.config ?? null, isWritable: false },
688
+ pool: { value: input.pool ?? null, isWritable: true },
689
+ position: { value: input.position ?? null, isWritable: true },
690
+ protocolPosition: {
691
+ value: input.protocolPosition ?? null,
692
+ isWritable: true
693
+ },
694
+ owner: { value: input.owner ?? null, isWritable: false },
695
+ authority: { value: input.authority ?? null, isWritable: false },
696
+ vault0: { value: input.vault0 ?? null, isWritable: true },
697
+ vault1: { value: input.vault1 ?? null, isWritable: true },
698
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
699
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
700
+ user0: { value: input.user0 ?? null, isWritable: true },
701
+ user1: { value: input.user1 ?? null, isWritable: true },
702
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
703
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
704
+ oracle: { value: input.oracle ?? null, isWritable: true }
549
705
  };
706
+ const accounts = originalAccounts;
707
+ const args = { ...input };
708
+ if (!accounts.authority.value) {
709
+ accounts.authority.value = await kit.getProgramDerivedAddress({
710
+ programAddress,
711
+ seeds: [
712
+ kit.getBytesEncoder().encode(
713
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
714
+ ),
715
+ kit.getAddressEncoder().encode(
716
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
717
+ )
718
+ ]
719
+ });
720
+ }
721
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
722
+ return Object.freeze({
723
+ accounts: [
724
+ getAccountMeta("config", accounts.config),
725
+ getAccountMeta("pool", accounts.pool),
726
+ getAccountMeta("position", accounts.position),
727
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
728
+ getAccountMeta("owner", accounts.owner),
729
+ getAccountMeta("authority", accounts.authority),
730
+ getAccountMeta("vault0", accounts.vault0),
731
+ getAccountMeta("vault1", accounts.vault1),
732
+ getAccountMeta("token0Mint", accounts.token0Mint),
733
+ getAccountMeta("token1Mint", accounts.token1Mint),
734
+ getAccountMeta("user0", accounts.user0),
735
+ getAccountMeta("user1", accounts.user1),
736
+ getAccountMeta("token0Program", accounts.token0Program),
737
+ getAccountMeta("token1Program", accounts.token1Program),
738
+ getAccountMeta("oracle", accounts.oracle)
739
+ ],
740
+ data: getAddLiquidityInstructionDataEncoder().encode(
741
+ args
742
+ ),
743
+ programAddress
744
+ });
550
745
  }
551
- function createInitializeOracleInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
552
- const {
553
- config,
554
- pool,
555
- oracle,
556
- admin,
557
- payer,
558
- systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS
559
- } = accounts;
560
- const keys = [
561
- { address: config, role: kit.AccountRole.READONLY },
562
- { address: pool, role: kit.AccountRole.READONLY },
563
- { address: oracle, role: kit.AccountRole.WRITABLE },
564
- { address: admin, role: kit.AccountRole.READONLY_SIGNER },
565
- { address: payer, role: kit.AccountRole.WRITABLE_SIGNER },
566
- { address: systemProgram, role: kit.AccountRole.READONLY }
567
- ];
568
- const data = chunkI5JME35L_cjs.encodeInstructionData(
569
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.initializeOracle,
570
- chunkI5JME35L_cjs.initializeOracleArgsCodec,
571
- args
572
- );
573
- return {
574
- programAddress: programId,
575
- accounts: keys,
576
- data
746
+ function getAddLiquidityInstruction(input, config) {
747
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
748
+ const originalAccounts = {
749
+ config: { value: input.config ?? null, isWritable: false },
750
+ pool: { value: input.pool ?? null, isWritable: true },
751
+ position: { value: input.position ?? null, isWritable: true },
752
+ protocolPosition: {
753
+ value: input.protocolPosition ?? null,
754
+ isWritable: true
755
+ },
756
+ owner: { value: input.owner ?? null, isWritable: false },
757
+ authority: { value: input.authority ?? null, isWritable: false },
758
+ vault0: { value: input.vault0 ?? null, isWritable: true },
759
+ vault1: { value: input.vault1 ?? null, isWritable: true },
760
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
761
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
762
+ user0: { value: input.user0 ?? null, isWritable: true },
763
+ user1: { value: input.user1 ?? null, isWritable: true },
764
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
765
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
766
+ oracle: { value: input.oracle ?? null, isWritable: true }
577
767
  };
768
+ const accounts = originalAccounts;
769
+ const args = { ...input };
770
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
771
+ return Object.freeze({
772
+ accounts: [
773
+ getAccountMeta("config", accounts.config),
774
+ getAccountMeta("pool", accounts.pool),
775
+ getAccountMeta("position", accounts.position),
776
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
777
+ getAccountMeta("owner", accounts.owner),
778
+ getAccountMeta("authority", accounts.authority),
779
+ getAccountMeta("vault0", accounts.vault0),
780
+ getAccountMeta("vault1", accounts.vault1),
781
+ getAccountMeta("token0Mint", accounts.token0Mint),
782
+ getAccountMeta("token1Mint", accounts.token1Mint),
783
+ getAccountMeta("user0", accounts.user0),
784
+ getAccountMeta("user1", accounts.user1),
785
+ getAccountMeta("token0Program", accounts.token0Program),
786
+ getAccountMeta("token1Program", accounts.token1Program),
787
+ getAccountMeta("oracle", accounts.oracle)
788
+ ],
789
+ data: getAddLiquidityInstructionDataEncoder().encode(
790
+ args
791
+ ),
792
+ programAddress
793
+ });
578
794
  }
579
- function createSetFeesInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
580
- const { config, pool, admin } = accounts;
581
- const keys = [
582
- { address: config, role: kit.AccountRole.READONLY },
583
- { address: pool, role: kit.AccountRole.WRITABLE },
584
- { address: admin, role: kit.AccountRole.READONLY_SIGNER }
585
- ];
586
- const data = chunkI5JME35L_cjs.encodeInstructionData(
587
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.setFees,
588
- chunkI5JME35L_cjs.setFeesArgsCodec,
589
- args
590
- );
795
+ function parseAddLiquidityInstruction(instruction) {
796
+ if (instruction.accounts.length < 15) {
797
+ throw new kit.SolanaError(
798
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
799
+ {
800
+ actualAccountMetas: instruction.accounts.length,
801
+ expectedAccountMetas: 15
802
+ }
803
+ );
804
+ }
805
+ let accountIndex = 0;
806
+ const getNextAccount = () => {
807
+ const accountMeta = instruction.accounts[accountIndex];
808
+ accountIndex += 1;
809
+ return accountMeta;
810
+ };
811
+ const getNextOptionalAccount = () => {
812
+ const accountMeta = getNextAccount();
813
+ return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
814
+ };
591
815
  return {
592
- programAddress: programId,
593
- accounts: keys,
594
- data
816
+ programAddress: instruction.programAddress,
817
+ accounts: {
818
+ config: getNextAccount(),
819
+ pool: getNextAccount(),
820
+ position: getNextAccount(),
821
+ protocolPosition: getNextAccount(),
822
+ owner: getNextAccount(),
823
+ authority: getNextAccount(),
824
+ vault0: getNextAccount(),
825
+ vault1: getNextAccount(),
826
+ token0Mint: getNextAccount(),
827
+ token1Mint: getNextAccount(),
828
+ user0: getNextAccount(),
829
+ user1: getNextAccount(),
830
+ token0Program: getNextAccount(),
831
+ token1Program: getNextAccount(),
832
+ oracle: getNextOptionalAccount()
833
+ },
834
+ data: getAddLiquidityInstructionDataDecoder().decode(instruction.data)
595
835
  };
596
836
  }
597
- function createSetSentinelInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
598
- const { config, pool, admin } = accounts;
599
- const keys = [
600
- { address: config, role: kit.AccountRole.READONLY },
601
- { address: pool, role: kit.AccountRole.WRITABLE },
602
- { address: admin, role: kit.AccountRole.READONLY_SIGNER }
603
- ];
604
- const data = chunkI5JME35L_cjs.encodeInstructionData(
605
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.setSentinel,
606
- chunkI5JME35L_cjs.setSentinelArgsCodec,
607
- args
837
+ var CLOSE_POSITION_DISCRIMINATOR = new Uint8Array([
838
+ 123,
839
+ 134,
840
+ 81,
841
+ 0,
842
+ 49,
843
+ 68,
844
+ 98,
845
+ 98
846
+ ]);
847
+ function getClosePositionDiscriminatorBytes() {
848
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
849
+ CLOSE_POSITION_DISCRIMINATOR
608
850
  );
609
- return {
610
- programAddress: programId,
611
- accounts: keys,
612
- data
613
- };
614
851
  }
615
- function createSetRouteInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
616
- const { config, pool, nextPool, admin } = accounts;
617
- const keys = [
618
- { address: config, role: kit.AccountRole.READONLY },
619
- { address: pool, role: kit.AccountRole.WRITABLE }
620
- ];
621
- if (nextPool) {
622
- keys.push({ address: nextPool, role: kit.AccountRole.READONLY });
623
- }
624
- keys.push({ address: admin, role: kit.AccountRole.READONLY_SIGNER });
625
- const data = chunkI5JME35L_cjs.encodeInstructionData(
626
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.setRoute,
627
- chunkI5JME35L_cjs.setRouteArgsCodec,
628
- args
852
+ function getClosePositionInstructionDataEncoder() {
853
+ return kit.transformEncoder(
854
+ kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
855
+ (value) => ({ ...value, discriminator: CLOSE_POSITION_DISCRIMINATOR })
629
856
  );
630
- return {
631
- programAddress: programId,
632
- accounts: keys,
633
- data
634
- };
635
857
  }
636
- function createPauseInstruction(accounts, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
637
- const { config, admin } = accounts;
638
- const keys = [
639
- { address: config, role: kit.AccountRole.WRITABLE },
640
- { address: admin, role: kit.AccountRole.READONLY_SIGNER }
641
- ];
642
- const data = chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.pause;
643
- return {
644
- programAddress: programId,
645
- accounts: keys,
646
- data
858
+ function getClosePositionInstructionDataDecoder() {
859
+ return kit.getStructDecoder([
860
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
861
+ ]);
862
+ }
863
+ function getClosePositionInstructionDataCodec() {
864
+ return kit.combineCodec(
865
+ getClosePositionInstructionDataEncoder(),
866
+ getClosePositionInstructionDataDecoder()
867
+ );
868
+ }
869
+ function getClosePositionInstruction(input, config) {
870
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
871
+ const originalAccounts = {
872
+ pool: { value: input.pool ?? null, isWritable: false },
873
+ position: { value: input.position ?? null, isWritable: true },
874
+ owner: { value: input.owner ?? null, isWritable: false },
875
+ rentRecipient: { value: input.rentRecipient ?? null, isWritable: true }
647
876
  };
877
+ const accounts = originalAccounts;
878
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
879
+ return Object.freeze({
880
+ accounts: [
881
+ getAccountMeta("pool", accounts.pool),
882
+ getAccountMeta("position", accounts.position),
883
+ getAccountMeta("owner", accounts.owner),
884
+ getAccountMeta("rentRecipient", accounts.rentRecipient)
885
+ ],
886
+ data: getClosePositionInstructionDataEncoder().encode({}),
887
+ programAddress
888
+ });
648
889
  }
649
- function createUnpauseInstruction(accounts, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
650
- const { config, admin } = accounts;
651
- const keys = [
652
- { address: config, role: kit.AccountRole.WRITABLE },
653
- { address: admin, role: kit.AccountRole.READONLY_SIGNER }
654
- ];
655
- const data = chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.unpause;
890
+ function parseClosePositionInstruction(instruction) {
891
+ if (instruction.accounts.length < 4) {
892
+ throw new kit.SolanaError(
893
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
894
+ {
895
+ actualAccountMetas: instruction.accounts.length,
896
+ expectedAccountMetas: 4
897
+ }
898
+ );
899
+ }
900
+ let accountIndex = 0;
901
+ const getNextAccount = () => {
902
+ const accountMeta = instruction.accounts[accountIndex];
903
+ accountIndex += 1;
904
+ return accountMeta;
905
+ };
656
906
  return {
657
- programAddress: programId,
658
- accounts: keys,
659
- data
907
+ programAddress: instruction.programAddress,
908
+ accounts: {
909
+ pool: getNextAccount(),
910
+ position: getNextAccount(),
911
+ owner: getNextAccount(),
912
+ rentRecipient: getNextAccount()
913
+ },
914
+ data: getClosePositionInstructionDataDecoder().decode(instruction.data)
660
915
  };
661
916
  }
662
- function createTransferAdminInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
663
- const { config, admin } = accounts;
664
- const keys = [
665
- { address: config, role: kit.AccountRole.WRITABLE },
666
- { address: admin, role: kit.AccountRole.READONLY_SIGNER }
667
- ];
668
- const data = chunkI5JME35L_cjs.encodeInstructionData(
669
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.transferAdmin,
670
- chunkI5JME35L_cjs.transferAdminArgsCodec,
671
- args
917
+ var COLLECT_FEES_DISCRIMINATOR = new Uint8Array([
918
+ 164,
919
+ 152,
920
+ 207,
921
+ 99,
922
+ 30,
923
+ 186,
924
+ 19,
925
+ 182
926
+ ]);
927
+ function getCollectFeesDiscriminatorBytes() {
928
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
929
+ COLLECT_FEES_DISCRIMINATOR
672
930
  );
673
- return {
674
- programAddress: programId,
675
- accounts: keys,
676
- data
931
+ }
932
+ function getCollectFeesInstructionDataEncoder() {
933
+ return kit.transformEncoder(
934
+ kit.getStructEncoder([
935
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
936
+ ["max0", kit.getU64Encoder()],
937
+ ["max1", kit.getU64Encoder()]
938
+ ]),
939
+ (value) => ({ ...value, discriminator: COLLECT_FEES_DISCRIMINATOR })
940
+ );
941
+ }
942
+ function getCollectFeesInstructionDataDecoder() {
943
+ return kit.getStructDecoder([
944
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
945
+ ["max0", kit.getU64Decoder()],
946
+ ["max1", kit.getU64Decoder()]
947
+ ]);
948
+ }
949
+ function getCollectFeesInstructionDataCodec() {
950
+ return kit.combineCodec(
951
+ getCollectFeesInstructionDataEncoder(),
952
+ getCollectFeesInstructionDataDecoder()
953
+ );
954
+ }
955
+ async function getCollectFeesInstructionAsync(input, config) {
956
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
957
+ const originalAccounts = {
958
+ pool: { value: input.pool ?? null, isWritable: true },
959
+ position: { value: input.position ?? null, isWritable: true },
960
+ owner: { value: input.owner ?? null, isWritable: false },
961
+ authority: { value: input.authority ?? null, isWritable: false },
962
+ vault0: { value: input.vault0 ?? null, isWritable: true },
963
+ vault1: { value: input.vault1 ?? null, isWritable: true },
964
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
965
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
966
+ user0: { value: input.user0 ?? null, isWritable: true },
967
+ user1: { value: input.user1 ?? null, isWritable: true },
968
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
969
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
677
970
  };
971
+ const accounts = originalAccounts;
972
+ const args = { ...input };
973
+ if (!accounts.authority.value) {
974
+ accounts.authority.value = await kit.getProgramDerivedAddress({
975
+ programAddress,
976
+ seeds: [
977
+ kit.getBytesEncoder().encode(
978
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
979
+ ),
980
+ kit.getAddressEncoder().encode(
981
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
982
+ )
983
+ ]
984
+ });
985
+ }
986
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
987
+ return Object.freeze({
988
+ accounts: [
989
+ getAccountMeta("pool", accounts.pool),
990
+ getAccountMeta("position", accounts.position),
991
+ getAccountMeta("owner", accounts.owner),
992
+ getAccountMeta("authority", accounts.authority),
993
+ getAccountMeta("vault0", accounts.vault0),
994
+ getAccountMeta("vault1", accounts.vault1),
995
+ getAccountMeta("token0Mint", accounts.token0Mint),
996
+ getAccountMeta("token1Mint", accounts.token1Mint),
997
+ getAccountMeta("user0", accounts.user0),
998
+ getAccountMeta("user1", accounts.user1),
999
+ getAccountMeta("token0Program", accounts.token0Program),
1000
+ getAccountMeta("token1Program", accounts.token1Program)
1001
+ ],
1002
+ data: getCollectFeesInstructionDataEncoder().encode(
1003
+ args
1004
+ ),
1005
+ programAddress
1006
+ });
678
1007
  }
679
- function createSkimInstruction(accounts, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
680
- const {
681
- config,
682
- pool,
683
- admin,
684
- authority,
685
- vault0,
686
- vault1,
687
- token0Mint,
688
- token1Mint,
689
- adminAta0,
690
- adminAta1,
691
- tokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS
692
- } = accounts;
693
- const keys = [
694
- { address: config, role: kit.AccountRole.READONLY },
695
- { address: pool, role: kit.AccountRole.READONLY },
696
- { address: admin, role: kit.AccountRole.READONLY_SIGNER },
697
- { address: authority, role: kit.AccountRole.READONLY },
698
- { address: vault0, role: kit.AccountRole.WRITABLE },
699
- { address: vault1, role: kit.AccountRole.WRITABLE },
700
- { address: token0Mint, role: kit.AccountRole.READONLY },
701
- { address: token1Mint, role: kit.AccountRole.READONLY },
702
- { address: adminAta0, role: kit.AccountRole.WRITABLE },
703
- { address: adminAta1, role: kit.AccountRole.WRITABLE },
704
- { address: tokenProgram, role: kit.AccountRole.READONLY }
705
- ];
706
- const data = chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.skim;
707
- return {
708
- programAddress: programId,
709
- accounts: keys,
710
- data
1008
+ function getCollectFeesInstruction(input, config) {
1009
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1010
+ const originalAccounts = {
1011
+ pool: { value: input.pool ?? null, isWritable: true },
1012
+ position: { value: input.position ?? null, isWritable: true },
1013
+ owner: { value: input.owner ?? null, isWritable: false },
1014
+ authority: { value: input.authority ?? null, isWritable: false },
1015
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1016
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1017
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1018
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1019
+ user0: { value: input.user0 ?? null, isWritable: true },
1020
+ user1: { value: input.user1 ?? null, isWritable: true },
1021
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1022
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
711
1023
  };
1024
+ const accounts = originalAccounts;
1025
+ const args = { ...input };
1026
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1027
+ return Object.freeze({
1028
+ accounts: [
1029
+ getAccountMeta("pool", accounts.pool),
1030
+ getAccountMeta("position", accounts.position),
1031
+ getAccountMeta("owner", accounts.owner),
1032
+ getAccountMeta("authority", accounts.authority),
1033
+ getAccountMeta("vault0", accounts.vault0),
1034
+ getAccountMeta("vault1", accounts.vault1),
1035
+ getAccountMeta("token0Mint", accounts.token0Mint),
1036
+ getAccountMeta("token1Mint", accounts.token1Mint),
1037
+ getAccountMeta("user0", accounts.user0),
1038
+ getAccountMeta("user1", accounts.user1),
1039
+ getAccountMeta("token0Program", accounts.token0Program),
1040
+ getAccountMeta("token1Program", accounts.token1Program)
1041
+ ],
1042
+ data: getCollectFeesInstructionDataEncoder().encode(
1043
+ args
1044
+ ),
1045
+ programAddress
1046
+ });
1047
+ }
1048
+ function parseCollectFeesInstruction(instruction) {
1049
+ if (instruction.accounts.length < 12) {
1050
+ throw new kit.SolanaError(
1051
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1052
+ {
1053
+ actualAccountMetas: instruction.accounts.length,
1054
+ expectedAccountMetas: 12
1055
+ }
1056
+ );
1057
+ }
1058
+ let accountIndex = 0;
1059
+ const getNextAccount = () => {
1060
+ const accountMeta = instruction.accounts[accountIndex];
1061
+ accountIndex += 1;
1062
+ return accountMeta;
1063
+ };
1064
+ return {
1065
+ programAddress: instruction.programAddress,
1066
+ accounts: {
1067
+ pool: getNextAccount(),
1068
+ position: getNextAccount(),
1069
+ owner: getNextAccount(),
1070
+ authority: getNextAccount(),
1071
+ vault0: getNextAccount(),
1072
+ vault1: getNextAccount(),
1073
+ token0Mint: getNextAccount(),
1074
+ token1Mint: getNextAccount(),
1075
+ user0: getNextAccount(),
1076
+ user1: getNextAccount(),
1077
+ token0Program: getNextAccount(),
1078
+ token1Program: getNextAccount()
1079
+ },
1080
+ data: getCollectFeesInstructionDataDecoder().decode(instruction.data)
1081
+ };
1082
+ }
1083
+ var COLLECT_PROTOCOL_FEES_DISCRIMINATOR = new Uint8Array([
1084
+ 22,
1085
+ 67,
1086
+ 23,
1087
+ 98,
1088
+ 150,
1089
+ 178,
1090
+ 70,
1091
+ 220
1092
+ ]);
1093
+ function getCollectProtocolFeesDiscriminatorBytes() {
1094
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1095
+ COLLECT_PROTOCOL_FEES_DISCRIMINATOR
1096
+ );
1097
+ }
1098
+ function getCollectProtocolFeesInstructionDataEncoder() {
1099
+ return kit.transformEncoder(
1100
+ kit.getStructEncoder([
1101
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1102
+ ["max0", kit.getU64Encoder()],
1103
+ ["max1", kit.getU64Encoder()]
1104
+ ]),
1105
+ (value) => ({
1106
+ ...value,
1107
+ discriminator: COLLECT_PROTOCOL_FEES_DISCRIMINATOR
1108
+ })
1109
+ );
1110
+ }
1111
+ function getCollectProtocolFeesInstructionDataDecoder() {
1112
+ return kit.getStructDecoder([
1113
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1114
+ ["max0", kit.getU64Decoder()],
1115
+ ["max1", kit.getU64Decoder()]
1116
+ ]);
1117
+ }
1118
+ function getCollectProtocolFeesInstructionDataCodec() {
1119
+ return kit.combineCodec(
1120
+ getCollectProtocolFeesInstructionDataEncoder(),
1121
+ getCollectProtocolFeesInstructionDataDecoder()
1122
+ );
1123
+ }
1124
+ async function getCollectProtocolFeesInstructionAsync(input, config) {
1125
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1126
+ const originalAccounts = {
1127
+ config: { value: input.config ?? null, isWritable: false },
1128
+ pool: { value: input.pool ?? null, isWritable: true },
1129
+ protocolPosition: {
1130
+ value: input.protocolPosition ?? null,
1131
+ isWritable: true
1132
+ },
1133
+ admin: { value: input.admin ?? null, isWritable: false },
1134
+ authority: { value: input.authority ?? null, isWritable: false },
1135
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1136
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1137
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1138
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1139
+ recipient0: { value: input.recipient0 ?? null, isWritable: true },
1140
+ recipient1: { value: input.recipient1 ?? null, isWritable: true },
1141
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1142
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
1143
+ };
1144
+ const accounts = originalAccounts;
1145
+ const args = { ...input };
1146
+ if (!accounts.authority.value) {
1147
+ accounts.authority.value = await kit.getProgramDerivedAddress({
1148
+ programAddress,
1149
+ seeds: [
1150
+ kit.getBytesEncoder().encode(
1151
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
1152
+ ),
1153
+ kit.getAddressEncoder().encode(
1154
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1155
+ )
1156
+ ]
1157
+ });
1158
+ }
1159
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1160
+ return Object.freeze({
1161
+ accounts: [
1162
+ getAccountMeta("config", accounts.config),
1163
+ getAccountMeta("pool", accounts.pool),
1164
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
1165
+ getAccountMeta("admin", accounts.admin),
1166
+ getAccountMeta("authority", accounts.authority),
1167
+ getAccountMeta("vault0", accounts.vault0),
1168
+ getAccountMeta("vault1", accounts.vault1),
1169
+ getAccountMeta("token0Mint", accounts.token0Mint),
1170
+ getAccountMeta("token1Mint", accounts.token1Mint),
1171
+ getAccountMeta("recipient0", accounts.recipient0),
1172
+ getAccountMeta("recipient1", accounts.recipient1),
1173
+ getAccountMeta("token0Program", accounts.token0Program),
1174
+ getAccountMeta("token1Program", accounts.token1Program)
1175
+ ],
1176
+ data: getCollectProtocolFeesInstructionDataEncoder().encode(
1177
+ args
1178
+ ),
1179
+ programAddress
1180
+ });
1181
+ }
1182
+ function getCollectProtocolFeesInstruction(input, config) {
1183
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1184
+ const originalAccounts = {
1185
+ config: { value: input.config ?? null, isWritable: false },
1186
+ pool: { value: input.pool ?? null, isWritable: true },
1187
+ protocolPosition: {
1188
+ value: input.protocolPosition ?? null,
1189
+ isWritable: true
1190
+ },
1191
+ admin: { value: input.admin ?? null, isWritable: false },
1192
+ authority: { value: input.authority ?? null, isWritable: false },
1193
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1194
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1195
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1196
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1197
+ recipient0: { value: input.recipient0 ?? null, isWritable: true },
1198
+ recipient1: { value: input.recipient1 ?? null, isWritable: true },
1199
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1200
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
1201
+ };
1202
+ const accounts = originalAccounts;
1203
+ const args = { ...input };
1204
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1205
+ return Object.freeze({
1206
+ accounts: [
1207
+ getAccountMeta("config", accounts.config),
1208
+ getAccountMeta("pool", accounts.pool),
1209
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
1210
+ getAccountMeta("admin", accounts.admin),
1211
+ getAccountMeta("authority", accounts.authority),
1212
+ getAccountMeta("vault0", accounts.vault0),
1213
+ getAccountMeta("vault1", accounts.vault1),
1214
+ getAccountMeta("token0Mint", accounts.token0Mint),
1215
+ getAccountMeta("token1Mint", accounts.token1Mint),
1216
+ getAccountMeta("recipient0", accounts.recipient0),
1217
+ getAccountMeta("recipient1", accounts.recipient1),
1218
+ getAccountMeta("token0Program", accounts.token0Program),
1219
+ getAccountMeta("token1Program", accounts.token1Program)
1220
+ ],
1221
+ data: getCollectProtocolFeesInstructionDataEncoder().encode(
1222
+ args
1223
+ ),
1224
+ programAddress
1225
+ });
1226
+ }
1227
+ function parseCollectProtocolFeesInstruction(instruction) {
1228
+ if (instruction.accounts.length < 13) {
1229
+ throw new kit.SolanaError(
1230
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1231
+ {
1232
+ actualAccountMetas: instruction.accounts.length,
1233
+ expectedAccountMetas: 13
1234
+ }
1235
+ );
1236
+ }
1237
+ let accountIndex = 0;
1238
+ const getNextAccount = () => {
1239
+ const accountMeta = instruction.accounts[accountIndex];
1240
+ accountIndex += 1;
1241
+ return accountMeta;
1242
+ };
1243
+ return {
1244
+ programAddress: instruction.programAddress,
1245
+ accounts: {
1246
+ config: getNextAccount(),
1247
+ pool: getNextAccount(),
1248
+ protocolPosition: getNextAccount(),
1249
+ admin: getNextAccount(),
1250
+ authority: getNextAccount(),
1251
+ vault0: getNextAccount(),
1252
+ vault1: getNextAccount(),
1253
+ token0Mint: getNextAccount(),
1254
+ token1Mint: getNextAccount(),
1255
+ recipient0: getNextAccount(),
1256
+ recipient1: getNextAccount(),
1257
+ token0Program: getNextAccount(),
1258
+ token1Program: getNextAccount()
1259
+ },
1260
+ data: getCollectProtocolFeesInstructionDataDecoder().decode(
1261
+ instruction.data
1262
+ )
1263
+ };
1264
+ }
1265
+ var CREATE_POSITION_DISCRIMINATOR = new Uint8Array([
1266
+ 48,
1267
+ 215,
1268
+ 197,
1269
+ 153,
1270
+ 96,
1271
+ 203,
1272
+ 180,
1273
+ 133
1274
+ ]);
1275
+ function getCreatePositionDiscriminatorBytes() {
1276
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1277
+ CREATE_POSITION_DISCRIMINATOR
1278
+ );
1279
+ }
1280
+ function getCreatePositionInstructionDataEncoder() {
1281
+ return kit.transformEncoder(
1282
+ kit.getStructEncoder([
1283
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1284
+ ["positionId", kit.getU64Encoder()]
1285
+ ]),
1286
+ (value) => ({ ...value, discriminator: CREATE_POSITION_DISCRIMINATOR })
1287
+ );
1288
+ }
1289
+ function getCreatePositionInstructionDataDecoder() {
1290
+ return kit.getStructDecoder([
1291
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1292
+ ["positionId", kit.getU64Decoder()]
1293
+ ]);
1294
+ }
1295
+ function getCreatePositionInstructionDataCodec() {
1296
+ return kit.combineCodec(
1297
+ getCreatePositionInstructionDataEncoder(),
1298
+ getCreatePositionInstructionDataDecoder()
1299
+ );
1300
+ }
1301
+ async function getCreatePositionInstructionAsync(input, config) {
1302
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1303
+ const originalAccounts = {
1304
+ pool: { value: input.pool ?? null, isWritable: false },
1305
+ position: { value: input.position ?? null, isWritable: true },
1306
+ owner: { value: input.owner ?? null, isWritable: false },
1307
+ payer: { value: input.payer ?? null, isWritable: true },
1308
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1309
+ };
1310
+ const accounts = originalAccounts;
1311
+ const args = { ...input };
1312
+ if (!accounts.position.value) {
1313
+ accounts.position.value = await kit.getProgramDerivedAddress({
1314
+ programAddress,
1315
+ seeds: [
1316
+ kit.getBytesEncoder().encode(
1317
+ new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
1318
+ ),
1319
+ kit.getAddressEncoder().encode(
1320
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1321
+ ),
1322
+ kit.getAddressEncoder().encode(
1323
+ programClientCore.getAddressFromResolvedInstructionAccount(
1324
+ "owner",
1325
+ accounts.owner.value
1326
+ )
1327
+ ),
1328
+ kit.getU64Encoder().encode(
1329
+ programClientCore.getNonNullResolvedInstructionInput("positionId", args.positionId)
1330
+ )
1331
+ ]
1332
+ });
1333
+ }
1334
+ if (!accounts.systemProgram.value) {
1335
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1336
+ }
1337
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1338
+ return Object.freeze({
1339
+ accounts: [
1340
+ getAccountMeta("pool", accounts.pool),
1341
+ getAccountMeta("position", accounts.position),
1342
+ getAccountMeta("owner", accounts.owner),
1343
+ getAccountMeta("payer", accounts.payer),
1344
+ getAccountMeta("systemProgram", accounts.systemProgram)
1345
+ ],
1346
+ data: getCreatePositionInstructionDataEncoder().encode(
1347
+ args
1348
+ ),
1349
+ programAddress
1350
+ });
1351
+ }
1352
+ function getCreatePositionInstruction(input, config) {
1353
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1354
+ const originalAccounts = {
1355
+ pool: { value: input.pool ?? null, isWritable: false },
1356
+ position: { value: input.position ?? null, isWritable: true },
1357
+ owner: { value: input.owner ?? null, isWritable: false },
1358
+ payer: { value: input.payer ?? null, isWritable: true },
1359
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1360
+ };
1361
+ const accounts = originalAccounts;
1362
+ const args = { ...input };
1363
+ if (!accounts.systemProgram.value) {
1364
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1365
+ }
1366
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1367
+ return Object.freeze({
1368
+ accounts: [
1369
+ getAccountMeta("pool", accounts.pool),
1370
+ getAccountMeta("position", accounts.position),
1371
+ getAccountMeta("owner", accounts.owner),
1372
+ getAccountMeta("payer", accounts.payer),
1373
+ getAccountMeta("systemProgram", accounts.systemProgram)
1374
+ ],
1375
+ data: getCreatePositionInstructionDataEncoder().encode(
1376
+ args
1377
+ ),
1378
+ programAddress
1379
+ });
1380
+ }
1381
+ function parseCreatePositionInstruction(instruction) {
1382
+ if (instruction.accounts.length < 5) {
1383
+ throw new kit.SolanaError(
1384
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1385
+ {
1386
+ actualAccountMetas: instruction.accounts.length,
1387
+ expectedAccountMetas: 5
1388
+ }
1389
+ );
1390
+ }
1391
+ let accountIndex = 0;
1392
+ const getNextAccount = () => {
1393
+ const accountMeta = instruction.accounts[accountIndex];
1394
+ accountIndex += 1;
1395
+ return accountMeta;
1396
+ };
1397
+ return {
1398
+ programAddress: instruction.programAddress,
1399
+ accounts: {
1400
+ pool: getNextAccount(),
1401
+ position: getNextAccount(),
1402
+ owner: getNextAccount(),
1403
+ payer: getNextAccount(),
1404
+ systemProgram: getNextAccount()
1405
+ },
1406
+ data: getCreatePositionInstructionDataDecoder().decode(instruction.data)
1407
+ };
1408
+ }
1409
+ var INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([
1410
+ 208,
1411
+ 127,
1412
+ 21,
1413
+ 1,
1414
+ 194,
1415
+ 190,
1416
+ 196,
1417
+ 70
1418
+ ]);
1419
+ function getInitializeConfigDiscriminatorBytes() {
1420
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1421
+ INITIALIZE_CONFIG_DISCRIMINATOR
1422
+ );
1423
+ }
1424
+ function getInitializeConfigInstructionDataEncoder() {
1425
+ return kit.transformEncoder(
1426
+ kit.getStructEncoder([
1427
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1428
+ ["admin", kit.getAddressEncoder()],
1429
+ ["numeraireMint", kit.getAddressEncoder()],
1430
+ ["maxSwapFeeBps", kit.getU16Encoder()],
1431
+ ["maxFeeSplitBps", kit.getU16Encoder()],
1432
+ ["maxRouteHops", kit.getU8Encoder()],
1433
+ ["protocolFeeEnabled", kit.getBooleanEncoder()],
1434
+ ["protocolFeeBps", kit.getU16Encoder()],
1435
+ ["sentinelAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
1436
+ ]),
1437
+ (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
1438
+ );
1439
+ }
1440
+ function getInitializeConfigInstructionDataDecoder() {
1441
+ return kit.getStructDecoder([
1442
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1443
+ ["admin", kit.getAddressDecoder()],
1444
+ ["numeraireMint", kit.getAddressDecoder()],
1445
+ ["maxSwapFeeBps", kit.getU16Decoder()],
1446
+ ["maxFeeSplitBps", kit.getU16Decoder()],
1447
+ ["maxRouteHops", kit.getU8Decoder()],
1448
+ ["protocolFeeEnabled", kit.getBooleanDecoder()],
1449
+ ["protocolFeeBps", kit.getU16Decoder()],
1450
+ ["sentinelAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
1451
+ ]);
1452
+ }
1453
+ function getInitializeConfigInstructionDataCodec() {
1454
+ return kit.combineCodec(
1455
+ getInitializeConfigInstructionDataEncoder(),
1456
+ getInitializeConfigInstructionDataDecoder()
1457
+ );
1458
+ }
1459
+ async function getInitializeConfigInstructionAsync(input, config) {
1460
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1461
+ const originalAccounts = {
1462
+ config: { value: input.config ?? null, isWritable: true },
1463
+ programData: { value: input.programData ?? null, isWritable: false },
1464
+ payer: { value: input.payer ?? null, isWritable: true },
1465
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1466
+ };
1467
+ const accounts = originalAccounts;
1468
+ const args = { ...input };
1469
+ if (!accounts.config.value) {
1470
+ accounts.config.value = await kit.getProgramDerivedAddress({
1471
+ programAddress,
1472
+ seeds: [
1473
+ kit.getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
1474
+ ]
1475
+ });
1476
+ }
1477
+ if (!accounts.systemProgram.value) {
1478
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1479
+ }
1480
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1481
+ return Object.freeze({
1482
+ accounts: [
1483
+ getAccountMeta("config", accounts.config),
1484
+ getAccountMeta("programData", accounts.programData),
1485
+ getAccountMeta("payer", accounts.payer),
1486
+ getAccountMeta("systemProgram", accounts.systemProgram)
1487
+ ],
1488
+ data: getInitializeConfigInstructionDataEncoder().encode(
1489
+ args
1490
+ ),
1491
+ programAddress
1492
+ });
1493
+ }
1494
+ function getInitializeConfigInstruction(input, config) {
1495
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1496
+ const originalAccounts = {
1497
+ config: { value: input.config ?? null, isWritable: true },
1498
+ programData: { value: input.programData ?? null, isWritable: false },
1499
+ payer: { value: input.payer ?? null, isWritable: true },
1500
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1501
+ };
1502
+ const accounts = originalAccounts;
1503
+ const args = { ...input };
1504
+ if (!accounts.systemProgram.value) {
1505
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1506
+ }
1507
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1508
+ return Object.freeze({
1509
+ accounts: [
1510
+ getAccountMeta("config", accounts.config),
1511
+ getAccountMeta("programData", accounts.programData),
1512
+ getAccountMeta("payer", accounts.payer),
1513
+ getAccountMeta("systemProgram", accounts.systemProgram)
1514
+ ],
1515
+ data: getInitializeConfigInstructionDataEncoder().encode(
1516
+ args
1517
+ ),
1518
+ programAddress
1519
+ });
1520
+ }
1521
+ function parseInitializeConfigInstruction(instruction) {
1522
+ if (instruction.accounts.length < 4) {
1523
+ throw new kit.SolanaError(
1524
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1525
+ {
1526
+ actualAccountMetas: instruction.accounts.length,
1527
+ expectedAccountMetas: 4
1528
+ }
1529
+ );
1530
+ }
1531
+ let accountIndex = 0;
1532
+ const getNextAccount = () => {
1533
+ const accountMeta = instruction.accounts[accountIndex];
1534
+ accountIndex += 1;
1535
+ return accountMeta;
1536
+ };
1537
+ return {
1538
+ programAddress: instruction.programAddress,
1539
+ accounts: {
1540
+ config: getNextAccount(),
1541
+ programData: getNextAccount(),
1542
+ payer: getNextAccount(),
1543
+ systemProgram: getNextAccount()
1544
+ },
1545
+ data: getInitializeConfigInstructionDataDecoder().decode(instruction.data)
1546
+ };
1547
+ }
1548
+ var INITIALIZE_ORACLE_DISCRIMINATOR = new Uint8Array([
1549
+ 144,
1550
+ 223,
1551
+ 131,
1552
+ 120,
1553
+ 196,
1554
+ 253,
1555
+ 181,
1556
+ 99
1557
+ ]);
1558
+ function getInitializeOracleDiscriminatorBytes() {
1559
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1560
+ INITIALIZE_ORACLE_DISCRIMINATOR
1561
+ );
1562
+ }
1563
+ function getInitializeOracleInstructionDataEncoder() {
1564
+ return kit.transformEncoder(
1565
+ kit.getStructEncoder([
1566
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1567
+ ["maxPriceChangeRatioQ64", kit.getU128Encoder()],
1568
+ ["observationIntervalSec", kit.getU32Encoder()]
1569
+ ]),
1570
+ (value) => ({ ...value, discriminator: INITIALIZE_ORACLE_DISCRIMINATOR })
1571
+ );
1572
+ }
1573
+ function getInitializeOracleInstructionDataDecoder() {
1574
+ return kit.getStructDecoder([
1575
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1576
+ ["maxPriceChangeRatioQ64", kit.getU128Decoder()],
1577
+ ["observationIntervalSec", kit.getU32Decoder()]
1578
+ ]);
1579
+ }
1580
+ function getInitializeOracleInstructionDataCodec() {
1581
+ return kit.combineCodec(
1582
+ getInitializeOracleInstructionDataEncoder(),
1583
+ getInitializeOracleInstructionDataDecoder()
1584
+ );
1585
+ }
1586
+ async function getInitializeOracleInstructionAsync(input, config) {
1587
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1588
+ const originalAccounts = {
1589
+ config: { value: input.config ?? null, isWritable: false },
1590
+ pool: { value: input.pool ?? null, isWritable: false },
1591
+ oracle: { value: input.oracle ?? null, isWritable: true },
1592
+ admin: { value: input.admin ?? null, isWritable: false },
1593
+ payer: { value: input.payer ?? null, isWritable: true },
1594
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1595
+ };
1596
+ const accounts = originalAccounts;
1597
+ const args = { ...input };
1598
+ if (!accounts.oracle.value) {
1599
+ accounts.oracle.value = await kit.getProgramDerivedAddress({
1600
+ programAddress,
1601
+ seeds: [
1602
+ kit.getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
1603
+ kit.getAddressEncoder().encode(
1604
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1605
+ )
1606
+ ]
1607
+ });
1608
+ }
1609
+ if (!accounts.systemProgram.value) {
1610
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1611
+ }
1612
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1613
+ return Object.freeze({
1614
+ accounts: [
1615
+ getAccountMeta("config", accounts.config),
1616
+ getAccountMeta("pool", accounts.pool),
1617
+ getAccountMeta("oracle", accounts.oracle),
1618
+ getAccountMeta("admin", accounts.admin),
1619
+ getAccountMeta("payer", accounts.payer),
1620
+ getAccountMeta("systemProgram", accounts.systemProgram)
1621
+ ],
1622
+ data: getInitializeOracleInstructionDataEncoder().encode(
1623
+ args
1624
+ ),
1625
+ programAddress
1626
+ });
1627
+ }
1628
+ function getInitializeOracleInstruction(input, config) {
1629
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1630
+ const originalAccounts = {
1631
+ config: { value: input.config ?? null, isWritable: false },
1632
+ pool: { value: input.pool ?? null, isWritable: false },
1633
+ oracle: { value: input.oracle ?? null, isWritable: true },
1634
+ admin: { value: input.admin ?? null, isWritable: false },
1635
+ payer: { value: input.payer ?? null, isWritable: true },
1636
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1637
+ };
1638
+ const accounts = originalAccounts;
1639
+ const args = { ...input };
1640
+ if (!accounts.systemProgram.value) {
1641
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1642
+ }
1643
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1644
+ return Object.freeze({
1645
+ accounts: [
1646
+ getAccountMeta("config", accounts.config),
1647
+ getAccountMeta("pool", accounts.pool),
1648
+ getAccountMeta("oracle", accounts.oracle),
1649
+ getAccountMeta("admin", accounts.admin),
1650
+ getAccountMeta("payer", accounts.payer),
1651
+ getAccountMeta("systemProgram", accounts.systemProgram)
1652
+ ],
1653
+ data: getInitializeOracleInstructionDataEncoder().encode(
1654
+ args
1655
+ ),
1656
+ programAddress
1657
+ });
1658
+ }
1659
+ function parseInitializeOracleInstruction(instruction) {
1660
+ if (instruction.accounts.length < 6) {
1661
+ throw new kit.SolanaError(
1662
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1663
+ {
1664
+ actualAccountMetas: instruction.accounts.length,
1665
+ expectedAccountMetas: 6
1666
+ }
1667
+ );
1668
+ }
1669
+ let accountIndex = 0;
1670
+ const getNextAccount = () => {
1671
+ const accountMeta = instruction.accounts[accountIndex];
1672
+ accountIndex += 1;
1673
+ return accountMeta;
1674
+ };
1675
+ return {
1676
+ programAddress: instruction.programAddress,
1677
+ accounts: {
1678
+ config: getNextAccount(),
1679
+ pool: getNextAccount(),
1680
+ oracle: getNextAccount(),
1681
+ admin: getNextAccount(),
1682
+ payer: getNextAccount(),
1683
+ systemProgram: getNextAccount()
1684
+ },
1685
+ data: getInitializeOracleInstructionDataDecoder().decode(instruction.data)
1686
+ };
1687
+ }
1688
+ var INITIALIZE_POOL_DISCRIMINATOR = new Uint8Array([
1689
+ 95,
1690
+ 180,
1691
+ 10,
1692
+ 172,
1693
+ 84,
1694
+ 174,
1695
+ 232,
1696
+ 40
1697
+ ]);
1698
+ function getInitializePoolDiscriminatorBytes() {
1699
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1700
+ INITIALIZE_POOL_DISCRIMINATOR
1701
+ );
1702
+ }
1703
+ function getInitializePoolInstructionDataEncoder() {
1704
+ return kit.transformEncoder(
1705
+ kit.getStructEncoder([
1706
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1707
+ ["mintA", kit.getAddressEncoder()],
1708
+ ["mintB", kit.getAddressEncoder()],
1709
+ ["initialSwapFeeBps", kit.getU16Encoder()],
1710
+ ["initialFeeSplitBps", kit.getU16Encoder()],
1711
+ ["liquidityMeasureSide", kit.getU8Encoder()],
1712
+ ["numeraireMintOverride", kit.getOptionEncoder(kit.getAddressEncoder())]
1713
+ ]),
1714
+ (value) => ({ ...value, discriminator: INITIALIZE_POOL_DISCRIMINATOR })
1715
+ );
1716
+ }
1717
+ function getInitializePoolInstructionDataDecoder() {
1718
+ return kit.getStructDecoder([
1719
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1720
+ ["mintA", kit.getAddressDecoder()],
1721
+ ["mintB", kit.getAddressDecoder()],
1722
+ ["initialSwapFeeBps", kit.getU16Decoder()],
1723
+ ["initialFeeSplitBps", kit.getU16Decoder()],
1724
+ ["liquidityMeasureSide", kit.getU8Decoder()],
1725
+ ["numeraireMintOverride", kit.getOptionDecoder(kit.getAddressDecoder())]
1726
+ ]);
1727
+ }
1728
+ function getInitializePoolInstructionDataCodec() {
1729
+ return kit.combineCodec(
1730
+ getInitializePoolInstructionDataEncoder(),
1731
+ getInitializePoolInstructionDataDecoder()
1732
+ );
1733
+ }
1734
+ async function getInitializePoolInstructionAsync(input, config) {
1735
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1736
+ const originalAccounts = {
1737
+ config: { value: input.config ?? null, isWritable: false },
1738
+ pool: { value: input.pool ?? null, isWritable: true },
1739
+ protocolPosition: {
1740
+ value: input.protocolPosition ?? null,
1741
+ isWritable: true
1742
+ },
1743
+ authority: { value: input.authority ?? null, isWritable: false },
1744
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1745
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1746
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1747
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1748
+ payer: { value: input.payer ?? null, isWritable: true },
1749
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1750
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
1751
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1752
+ rent: { value: input.rent ?? null, isWritable: false },
1753
+ migrationAuthority: {
1754
+ value: input.migrationAuthority ?? null,
1755
+ isWritable: false
1756
+ }
1757
+ };
1758
+ const accounts = originalAccounts;
1759
+ const args = { ...input };
1760
+ if (!accounts.pool.value) {
1761
+ accounts.pool.value = await kit.getProgramDerivedAddress({
1762
+ programAddress,
1763
+ seeds: [
1764
+ kit.getBytesEncoder().encode(new Uint8Array([112, 111, 111, 108])),
1765
+ kit.getAddressEncoder().encode(
1766
+ programClientCore.getAddressFromResolvedInstructionAccount(
1767
+ "token0Mint",
1768
+ accounts.token0Mint.value
1769
+ )
1770
+ ),
1771
+ kit.getAddressEncoder().encode(
1772
+ programClientCore.getAddressFromResolvedInstructionAccount(
1773
+ "token1Mint",
1774
+ accounts.token1Mint.value
1775
+ )
1776
+ )
1777
+ ]
1778
+ });
1779
+ }
1780
+ if (!accounts.protocolPosition.value) {
1781
+ accounts.protocolPosition.value = await kit.getProgramDerivedAddress({
1782
+ programAddress,
1783
+ seeds: [
1784
+ kit.getBytesEncoder().encode(
1785
+ new Uint8Array([
1786
+ 112,
1787
+ 114,
1788
+ 111,
1789
+ 116,
1790
+ 111,
1791
+ 99,
1792
+ 111,
1793
+ 108,
1794
+ 95,
1795
+ 112,
1796
+ 111,
1797
+ 115,
1798
+ 105,
1799
+ 116,
1800
+ 105,
1801
+ 111,
1802
+ 110
1803
+ ])
1804
+ ),
1805
+ kit.getAddressEncoder().encode(
1806
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1807
+ )
1808
+ ]
1809
+ });
1810
+ }
1811
+ if (!accounts.authority.value) {
1812
+ accounts.authority.value = await kit.getProgramDerivedAddress({
1813
+ programAddress,
1814
+ seeds: [
1815
+ kit.getBytesEncoder().encode(
1816
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
1817
+ ),
1818
+ kit.getAddressEncoder().encode(
1819
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1820
+ )
1821
+ ]
1822
+ });
1823
+ }
1824
+ if (!accounts.vault0.value) {
1825
+ accounts.vault0.value = await kit.getProgramDerivedAddress({
1826
+ programAddress,
1827
+ seeds: [
1828
+ kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 48])),
1829
+ kit.getAddressEncoder().encode(
1830
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1831
+ )
1832
+ ]
1833
+ });
1834
+ }
1835
+ if (!accounts.vault1.value) {
1836
+ accounts.vault1.value = await kit.getProgramDerivedAddress({
1837
+ programAddress,
1838
+ seeds: [
1839
+ kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 49])),
1840
+ kit.getAddressEncoder().encode(
1841
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
1842
+ )
1843
+ ]
1844
+ });
1845
+ }
1846
+ if (!accounts.systemProgram.value) {
1847
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1848
+ }
1849
+ if (!accounts.rent.value) {
1850
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
1851
+ }
1852
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1853
+ return Object.freeze({
1854
+ accounts: [
1855
+ getAccountMeta("config", accounts.config),
1856
+ getAccountMeta("pool", accounts.pool),
1857
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
1858
+ getAccountMeta("authority", accounts.authority),
1859
+ getAccountMeta("vault0", accounts.vault0),
1860
+ getAccountMeta("vault1", accounts.vault1),
1861
+ getAccountMeta("token0Mint", accounts.token0Mint),
1862
+ getAccountMeta("token1Mint", accounts.token1Mint),
1863
+ getAccountMeta("payer", accounts.payer),
1864
+ getAccountMeta("token0Program", accounts.token0Program),
1865
+ getAccountMeta("token1Program", accounts.token1Program),
1866
+ getAccountMeta("systemProgram", accounts.systemProgram),
1867
+ getAccountMeta("rent", accounts.rent),
1868
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority)
1869
+ ],
1870
+ data: getInitializePoolInstructionDataEncoder().encode(
1871
+ args
1872
+ ),
1873
+ programAddress
1874
+ });
1875
+ }
1876
+ function getInitializePoolInstruction(input, config) {
1877
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
1878
+ const originalAccounts = {
1879
+ config: { value: input.config ?? null, isWritable: false },
1880
+ pool: { value: input.pool ?? null, isWritable: true },
1881
+ protocolPosition: {
1882
+ value: input.protocolPosition ?? null,
1883
+ isWritable: true
1884
+ },
1885
+ authority: { value: input.authority ?? null, isWritable: false },
1886
+ vault0: { value: input.vault0 ?? null, isWritable: true },
1887
+ vault1: { value: input.vault1 ?? null, isWritable: true },
1888
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
1889
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
1890
+ payer: { value: input.payer ?? null, isWritable: true },
1891
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
1892
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
1893
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1894
+ rent: { value: input.rent ?? null, isWritable: false },
1895
+ migrationAuthority: {
1896
+ value: input.migrationAuthority ?? null,
1897
+ isWritable: false
1898
+ }
1899
+ };
1900
+ const accounts = originalAccounts;
1901
+ const args = { ...input };
1902
+ if (!accounts.systemProgram.value) {
1903
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1904
+ }
1905
+ if (!accounts.rent.value) {
1906
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
1907
+ }
1908
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
1909
+ return Object.freeze({
1910
+ accounts: [
1911
+ getAccountMeta("config", accounts.config),
1912
+ getAccountMeta("pool", accounts.pool),
1913
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
1914
+ getAccountMeta("authority", accounts.authority),
1915
+ getAccountMeta("vault0", accounts.vault0),
1916
+ getAccountMeta("vault1", accounts.vault1),
1917
+ getAccountMeta("token0Mint", accounts.token0Mint),
1918
+ getAccountMeta("token1Mint", accounts.token1Mint),
1919
+ getAccountMeta("payer", accounts.payer),
1920
+ getAccountMeta("token0Program", accounts.token0Program),
1921
+ getAccountMeta("token1Program", accounts.token1Program),
1922
+ getAccountMeta("systemProgram", accounts.systemProgram),
1923
+ getAccountMeta("rent", accounts.rent),
1924
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority)
1925
+ ],
1926
+ data: getInitializePoolInstructionDataEncoder().encode(
1927
+ args
1928
+ ),
1929
+ programAddress
1930
+ });
1931
+ }
1932
+ function parseInitializePoolInstruction(instruction) {
1933
+ if (instruction.accounts.length < 14) {
1934
+ throw new kit.SolanaError(
1935
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
1936
+ {
1937
+ actualAccountMetas: instruction.accounts.length,
1938
+ expectedAccountMetas: 14
1939
+ }
1940
+ );
1941
+ }
1942
+ let accountIndex = 0;
1943
+ const getNextAccount = () => {
1944
+ const accountMeta = instruction.accounts[accountIndex];
1945
+ accountIndex += 1;
1946
+ return accountMeta;
1947
+ };
1948
+ return {
1949
+ programAddress: instruction.programAddress,
1950
+ accounts: {
1951
+ config: getNextAccount(),
1952
+ pool: getNextAccount(),
1953
+ protocolPosition: getNextAccount(),
1954
+ authority: getNextAccount(),
1955
+ vault0: getNextAccount(),
1956
+ vault1: getNextAccount(),
1957
+ token0Mint: getNextAccount(),
1958
+ token1Mint: getNextAccount(),
1959
+ payer: getNextAccount(),
1960
+ token0Program: getNextAccount(),
1961
+ token1Program: getNextAccount(),
1962
+ systemProgram: getNextAccount(),
1963
+ rent: getNextAccount(),
1964
+ migrationAuthority: getNextAccount()
1965
+ },
1966
+ data: getInitializePoolInstructionDataDecoder().decode(instruction.data)
1967
+ };
1968
+ }
1969
+ var ORACLE_CONSULT_DISCRIMINATOR = new Uint8Array([
1970
+ 239,
1971
+ 237,
1972
+ 255,
1973
+ 177,
1974
+ 142,
1975
+ 72,
1976
+ 96,
1977
+ 175
1978
+ ]);
1979
+ function getOracleConsultDiscriminatorBytes() {
1980
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
1981
+ ORACLE_CONSULT_DISCRIMINATOR
1982
+ );
1983
+ }
1984
+ function getOracleConsultInstructionDataEncoder() {
1985
+ return kit.transformEncoder(
1986
+ kit.getStructEncoder([
1987
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1988
+ ["windowSeconds", kit.getU32Encoder()]
1989
+ ]),
1990
+ (value) => ({ ...value, discriminator: ORACLE_CONSULT_DISCRIMINATOR })
1991
+ );
1992
+ }
1993
+ function getOracleConsultInstructionDataDecoder() {
1994
+ return kit.getStructDecoder([
1995
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
1996
+ ["windowSeconds", kit.getU32Decoder()]
1997
+ ]);
1998
+ }
1999
+ function getOracleConsultInstructionDataCodec() {
2000
+ return kit.combineCodec(
2001
+ getOracleConsultInstructionDataEncoder(),
2002
+ getOracleConsultInstructionDataDecoder()
2003
+ );
2004
+ }
2005
+ async function getOracleConsultInstructionAsync(input, config) {
2006
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2007
+ const originalAccounts = {
2008
+ pool: { value: input.pool ?? null, isWritable: false },
2009
+ oracle: { value: input.oracle ?? null, isWritable: false }
2010
+ };
2011
+ const accounts = originalAccounts;
2012
+ const args = { ...input };
2013
+ if (!accounts.oracle.value) {
2014
+ accounts.oracle.value = await kit.getProgramDerivedAddress({
2015
+ programAddress,
2016
+ seeds: [
2017
+ kit.getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
2018
+ kit.getAddressEncoder().encode(
2019
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2020
+ )
2021
+ ]
2022
+ });
2023
+ }
2024
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2025
+ return Object.freeze({
2026
+ accounts: [
2027
+ getAccountMeta("pool", accounts.pool),
2028
+ getAccountMeta("oracle", accounts.oracle)
2029
+ ],
2030
+ data: getOracleConsultInstructionDataEncoder().encode(
2031
+ args
2032
+ ),
2033
+ programAddress
2034
+ });
2035
+ }
2036
+ function getOracleConsultInstruction(input, config) {
2037
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2038
+ const originalAccounts = {
2039
+ pool: { value: input.pool ?? null, isWritable: false },
2040
+ oracle: { value: input.oracle ?? null, isWritable: false }
2041
+ };
2042
+ const accounts = originalAccounts;
2043
+ const args = { ...input };
2044
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2045
+ return Object.freeze({
2046
+ accounts: [
2047
+ getAccountMeta("pool", accounts.pool),
2048
+ getAccountMeta("oracle", accounts.oracle)
2049
+ ],
2050
+ data: getOracleConsultInstructionDataEncoder().encode(
2051
+ args
2052
+ ),
2053
+ programAddress
2054
+ });
2055
+ }
2056
+ function parseOracleConsultInstruction(instruction) {
2057
+ if (instruction.accounts.length < 2) {
2058
+ throw new kit.SolanaError(
2059
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2060
+ {
2061
+ actualAccountMetas: instruction.accounts.length,
2062
+ expectedAccountMetas: 2
2063
+ }
2064
+ );
2065
+ }
2066
+ let accountIndex = 0;
2067
+ const getNextAccount = () => {
2068
+ const accountMeta = instruction.accounts[accountIndex];
2069
+ accountIndex += 1;
2070
+ return accountMeta;
2071
+ };
2072
+ return {
2073
+ programAddress: instruction.programAddress,
2074
+ accounts: { pool: getNextAccount(), oracle: getNextAccount() },
2075
+ data: getOracleConsultInstructionDataDecoder().decode(instruction.data)
2076
+ };
2077
+ }
2078
+ var ORACLE_UPDATE_DISCRIMINATOR = new Uint8Array([
2079
+ 85,
2080
+ 209,
2081
+ 248,
2082
+ 142,
2083
+ 186,
2084
+ 249,
2085
+ 120,
2086
+ 239
2087
+ ]);
2088
+ function getOracleUpdateDiscriminatorBytes() {
2089
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2090
+ ORACLE_UPDATE_DISCRIMINATOR
2091
+ );
2092
+ }
2093
+ function getOracleUpdateInstructionDataEncoder() {
2094
+ return kit.transformEncoder(
2095
+ kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
2096
+ (value) => ({ ...value, discriminator: ORACLE_UPDATE_DISCRIMINATOR })
2097
+ );
2098
+ }
2099
+ function getOracleUpdateInstructionDataDecoder() {
2100
+ return kit.getStructDecoder([
2101
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
2102
+ ]);
2103
+ }
2104
+ function getOracleUpdateInstructionDataCodec() {
2105
+ return kit.combineCodec(
2106
+ getOracleUpdateInstructionDataEncoder(),
2107
+ getOracleUpdateInstructionDataDecoder()
2108
+ );
2109
+ }
2110
+ async function getOracleUpdateInstructionAsync(input, config) {
2111
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2112
+ const originalAccounts = {
2113
+ pool: { value: input.pool ?? null, isWritable: false },
2114
+ oracle: { value: input.oracle ?? null, isWritable: true }
2115
+ };
2116
+ const accounts = originalAccounts;
2117
+ if (!accounts.oracle.value) {
2118
+ accounts.oracle.value = await kit.getProgramDerivedAddress({
2119
+ programAddress,
2120
+ seeds: [
2121
+ kit.getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
2122
+ kit.getAddressEncoder().encode(
2123
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2124
+ )
2125
+ ]
2126
+ });
2127
+ }
2128
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2129
+ return Object.freeze({
2130
+ accounts: [
2131
+ getAccountMeta("pool", accounts.pool),
2132
+ getAccountMeta("oracle", accounts.oracle)
2133
+ ],
2134
+ data: getOracleUpdateInstructionDataEncoder().encode({}),
2135
+ programAddress
2136
+ });
2137
+ }
2138
+ function getOracleUpdateInstruction(input, config) {
2139
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2140
+ const originalAccounts = {
2141
+ pool: { value: input.pool ?? null, isWritable: false },
2142
+ oracle: { value: input.oracle ?? null, isWritable: true }
2143
+ };
2144
+ const accounts = originalAccounts;
2145
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2146
+ return Object.freeze({
2147
+ accounts: [
2148
+ getAccountMeta("pool", accounts.pool),
2149
+ getAccountMeta("oracle", accounts.oracle)
2150
+ ],
2151
+ data: getOracleUpdateInstructionDataEncoder().encode({}),
2152
+ programAddress
2153
+ });
2154
+ }
2155
+ function parseOracleUpdateInstruction(instruction) {
2156
+ if (instruction.accounts.length < 2) {
2157
+ throw new kit.SolanaError(
2158
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2159
+ {
2160
+ actualAccountMetas: instruction.accounts.length,
2161
+ expectedAccountMetas: 2
2162
+ }
2163
+ );
2164
+ }
2165
+ let accountIndex = 0;
2166
+ const getNextAccount = () => {
2167
+ const accountMeta = instruction.accounts[accountIndex];
2168
+ accountIndex += 1;
2169
+ return accountMeta;
2170
+ };
2171
+ return {
2172
+ programAddress: instruction.programAddress,
2173
+ accounts: { pool: getNextAccount(), oracle: getNextAccount() },
2174
+ data: getOracleUpdateInstructionDataDecoder().decode(instruction.data)
2175
+ };
2176
+ }
2177
+ var PAUSE_DISCRIMINATOR = new Uint8Array([
2178
+ 211,
2179
+ 22,
2180
+ 221,
2181
+ 251,
2182
+ 74,
2183
+ 121,
2184
+ 193,
2185
+ 47
2186
+ ]);
2187
+ function getPauseDiscriminatorBytes() {
2188
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(PAUSE_DISCRIMINATOR);
2189
+ }
2190
+ function getPauseInstructionDataEncoder() {
2191
+ return kit.transformEncoder(
2192
+ kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
2193
+ (value) => ({ ...value, discriminator: PAUSE_DISCRIMINATOR })
2194
+ );
2195
+ }
2196
+ function getPauseInstructionDataDecoder() {
2197
+ return kit.getStructDecoder([
2198
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
2199
+ ]);
2200
+ }
2201
+ function getPauseInstructionDataCodec() {
2202
+ return kit.combineCodec(
2203
+ getPauseInstructionDataEncoder(),
2204
+ getPauseInstructionDataDecoder()
2205
+ );
2206
+ }
2207
+ function getPauseInstruction(input, config) {
2208
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2209
+ const originalAccounts = {
2210
+ config: { value: input.config ?? null, isWritable: true },
2211
+ admin: { value: input.admin ?? null, isWritable: false }
2212
+ };
2213
+ const accounts = originalAccounts;
2214
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2215
+ return Object.freeze({
2216
+ accounts: [
2217
+ getAccountMeta("config", accounts.config),
2218
+ getAccountMeta("admin", accounts.admin)
2219
+ ],
2220
+ data: getPauseInstructionDataEncoder().encode({}),
2221
+ programAddress
2222
+ });
2223
+ }
2224
+ function parsePauseInstruction(instruction) {
2225
+ if (instruction.accounts.length < 2) {
2226
+ throw new kit.SolanaError(
2227
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2228
+ {
2229
+ actualAccountMetas: instruction.accounts.length,
2230
+ expectedAccountMetas: 2
2231
+ }
2232
+ );
2233
+ }
2234
+ let accountIndex = 0;
2235
+ const getNextAccount = () => {
2236
+ const accountMeta = instruction.accounts[accountIndex];
2237
+ accountIndex += 1;
2238
+ return accountMeta;
2239
+ };
2240
+ return {
2241
+ programAddress: instruction.programAddress,
2242
+ accounts: { config: getNextAccount(), admin: getNextAccount() },
2243
+ data: getPauseInstructionDataDecoder().decode(instruction.data)
2244
+ };
2245
+ }
2246
+ var PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
2247
+ 50,
2248
+ 130,
2249
+ 31,
2250
+ 69,
2251
+ 147,
2252
+ 58,
2253
+ 222,
2254
+ 178
2255
+ ]);
2256
+ function getPreviewSwapExactInDiscriminatorBytes() {
2257
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2258
+ PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
2259
+ );
2260
+ }
2261
+ function getPreviewSwapExactInInstructionDataEncoder() {
2262
+ return kit.transformEncoder(
2263
+ kit.getStructEncoder([
2264
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2265
+ ["amountIn", kit.getU64Encoder()],
2266
+ ["direction", kit.getU8Encoder()]
2267
+ ]),
2268
+ (value) => ({
2269
+ ...value,
2270
+ discriminator: PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
2271
+ })
2272
+ );
2273
+ }
2274
+ function getPreviewSwapExactInInstructionDataDecoder() {
2275
+ return kit.getStructDecoder([
2276
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2277
+ ["amountIn", kit.getU64Decoder()],
2278
+ ["direction", kit.getU8Decoder()]
2279
+ ]);
2280
+ }
2281
+ function getPreviewSwapExactInInstructionDataCodec() {
2282
+ return kit.combineCodec(
2283
+ getPreviewSwapExactInInstructionDataEncoder(),
2284
+ getPreviewSwapExactInInstructionDataDecoder()
2285
+ );
2286
+ }
2287
+ function getPreviewSwapExactInInstruction(input, config) {
2288
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2289
+ const originalAccounts = {
2290
+ config: { value: input.config ?? null, isWritable: false },
2291
+ pool: { value: input.pool ?? null, isWritable: false }
2292
+ };
2293
+ const accounts = originalAccounts;
2294
+ const args = { ...input };
2295
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2296
+ return Object.freeze({
2297
+ accounts: [
2298
+ getAccountMeta("config", accounts.config),
2299
+ getAccountMeta("pool", accounts.pool)
2300
+ ],
2301
+ data: getPreviewSwapExactInInstructionDataEncoder().encode(
2302
+ args
2303
+ ),
2304
+ programAddress
2305
+ });
2306
+ }
2307
+ function parsePreviewSwapExactInInstruction(instruction) {
2308
+ if (instruction.accounts.length < 2) {
2309
+ throw new kit.SolanaError(
2310
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2311
+ {
2312
+ actualAccountMetas: instruction.accounts.length,
2313
+ expectedAccountMetas: 2
2314
+ }
2315
+ );
2316
+ }
2317
+ let accountIndex = 0;
2318
+ const getNextAccount = () => {
2319
+ const accountMeta = instruction.accounts[accountIndex];
2320
+ accountIndex += 1;
2321
+ return accountMeta;
2322
+ };
2323
+ return {
2324
+ programAddress: instruction.programAddress,
2325
+ accounts: { config: getNextAccount(), pool: getNextAccount() },
2326
+ data: getPreviewSwapExactInInstructionDataDecoder().decode(
2327
+ instruction.data
2328
+ )
2329
+ };
2330
+ }
2331
+ var QUOTE_TO_NUMERAIRE_DISCRIMINATOR = new Uint8Array([
2332
+ 4,
2333
+ 142,
2334
+ 249,
2335
+ 240,
2336
+ 129,
2337
+ 15,
2338
+ 143,
2339
+ 57
2340
+ ]);
2341
+ function getQuoteToNumeraireDiscriminatorBytes() {
2342
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2343
+ QUOTE_TO_NUMERAIRE_DISCRIMINATOR
2344
+ );
2345
+ }
2346
+ function getQuoteToNumeraireInstructionDataEncoder() {
2347
+ return kit.transformEncoder(
2348
+ kit.getStructEncoder([
2349
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2350
+ ["amount", kit.getU128Encoder()],
2351
+ ["side", kit.getU8Encoder()],
2352
+ ["maxHops", kit.getU8Encoder()],
2353
+ ["useTwap", kit.getBooleanEncoder()],
2354
+ ["windowSeconds", kit.getU32Encoder()]
2355
+ ]),
2356
+ (value) => ({ ...value, discriminator: QUOTE_TO_NUMERAIRE_DISCRIMINATOR })
2357
+ );
2358
+ }
2359
+ function getQuoteToNumeraireInstructionDataDecoder() {
2360
+ return kit.getStructDecoder([
2361
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2362
+ ["amount", kit.getU128Decoder()],
2363
+ ["side", kit.getU8Decoder()],
2364
+ ["maxHops", kit.getU8Decoder()],
2365
+ ["useTwap", kit.getBooleanDecoder()],
2366
+ ["windowSeconds", kit.getU32Decoder()]
2367
+ ]);
2368
+ }
2369
+ function getQuoteToNumeraireInstructionDataCodec() {
2370
+ return kit.combineCodec(
2371
+ getQuoteToNumeraireInstructionDataEncoder(),
2372
+ getQuoteToNumeraireInstructionDataDecoder()
2373
+ );
2374
+ }
2375
+ function getQuoteToNumeraireInstruction(input, config) {
2376
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2377
+ const originalAccounts = {
2378
+ config: { value: input.config ?? null, isWritable: false },
2379
+ startPool: { value: input.startPool ?? null, isWritable: false }
2380
+ };
2381
+ const accounts = originalAccounts;
2382
+ const args = { ...input };
2383
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2384
+ return Object.freeze({
2385
+ accounts: [
2386
+ getAccountMeta("config", accounts.config),
2387
+ getAccountMeta("startPool", accounts.startPool)
2388
+ ],
2389
+ data: getQuoteToNumeraireInstructionDataEncoder().encode(
2390
+ args
2391
+ ),
2392
+ programAddress
2393
+ });
2394
+ }
2395
+ function parseQuoteToNumeraireInstruction(instruction) {
2396
+ if (instruction.accounts.length < 2) {
2397
+ throw new kit.SolanaError(
2398
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2399
+ {
2400
+ actualAccountMetas: instruction.accounts.length,
2401
+ expectedAccountMetas: 2
2402
+ }
2403
+ );
2404
+ }
2405
+ let accountIndex = 0;
2406
+ const getNextAccount = () => {
2407
+ const accountMeta = instruction.accounts[accountIndex];
2408
+ accountIndex += 1;
2409
+ return accountMeta;
2410
+ };
2411
+ return {
2412
+ programAddress: instruction.programAddress,
2413
+ accounts: { config: getNextAccount(), startPool: getNextAccount() },
2414
+ data: getQuoteToNumeraireInstructionDataDecoder().decode(instruction.data)
2415
+ };
2416
+ }
2417
+ var REMOVE_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
2418
+ 80,
2419
+ 85,
2420
+ 209,
2421
+ 72,
2422
+ 24,
2423
+ 206,
2424
+ 177,
2425
+ 108
2426
+ ]);
2427
+ function getRemoveLiquidityDiscriminatorBytes() {
2428
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2429
+ REMOVE_LIQUIDITY_DISCRIMINATOR
2430
+ );
2431
+ }
2432
+ function getRemoveLiquidityInstructionDataEncoder() {
2433
+ return kit.transformEncoder(
2434
+ kit.getStructEncoder([
2435
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2436
+ ["sharesIn", kit.getU128Encoder()],
2437
+ ["minAmount0Out", kit.getU64Encoder()],
2438
+ ["minAmount1Out", kit.getU64Encoder()],
2439
+ ["updateOracle", kit.getBooleanEncoder()]
2440
+ ]),
2441
+ (value) => ({ ...value, discriminator: REMOVE_LIQUIDITY_DISCRIMINATOR })
2442
+ );
2443
+ }
2444
+ function getRemoveLiquidityInstructionDataDecoder() {
2445
+ return kit.getStructDecoder([
2446
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2447
+ ["sharesIn", kit.getU128Decoder()],
2448
+ ["minAmount0Out", kit.getU64Decoder()],
2449
+ ["minAmount1Out", kit.getU64Decoder()],
2450
+ ["updateOracle", kit.getBooleanDecoder()]
2451
+ ]);
2452
+ }
2453
+ function getRemoveLiquidityInstructionDataCodec() {
2454
+ return kit.combineCodec(
2455
+ getRemoveLiquidityInstructionDataEncoder(),
2456
+ getRemoveLiquidityInstructionDataDecoder()
2457
+ );
2458
+ }
2459
+ async function getRemoveLiquidityInstructionAsync(input, config) {
2460
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2461
+ const originalAccounts = {
2462
+ config: { value: input.config ?? null, isWritable: false },
2463
+ pool: { value: input.pool ?? null, isWritable: true },
2464
+ position: { value: input.position ?? null, isWritable: true },
2465
+ protocolPosition: {
2466
+ value: input.protocolPosition ?? null,
2467
+ isWritable: true
2468
+ },
2469
+ owner: { value: input.owner ?? null, isWritable: false },
2470
+ authority: { value: input.authority ?? null, isWritable: false },
2471
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2472
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2473
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2474
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2475
+ user0: { value: input.user0 ?? null, isWritable: true },
2476
+ user1: { value: input.user1 ?? null, isWritable: true },
2477
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2478
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
2479
+ oracle: { value: input.oracle ?? null, isWritable: true }
2480
+ };
2481
+ const accounts = originalAccounts;
2482
+ const args = { ...input };
2483
+ if (!accounts.authority.value) {
2484
+ accounts.authority.value = await kit.getProgramDerivedAddress({
2485
+ programAddress,
2486
+ seeds: [
2487
+ kit.getBytesEncoder().encode(
2488
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2489
+ ),
2490
+ kit.getAddressEncoder().encode(
2491
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2492
+ )
2493
+ ]
2494
+ });
2495
+ }
2496
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2497
+ return Object.freeze({
2498
+ accounts: [
2499
+ getAccountMeta("config", accounts.config),
2500
+ getAccountMeta("pool", accounts.pool),
2501
+ getAccountMeta("position", accounts.position),
2502
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
2503
+ getAccountMeta("owner", accounts.owner),
2504
+ getAccountMeta("authority", accounts.authority),
2505
+ getAccountMeta("vault0", accounts.vault0),
2506
+ getAccountMeta("vault1", accounts.vault1),
2507
+ getAccountMeta("token0Mint", accounts.token0Mint),
2508
+ getAccountMeta("token1Mint", accounts.token1Mint),
2509
+ getAccountMeta("user0", accounts.user0),
2510
+ getAccountMeta("user1", accounts.user1),
2511
+ getAccountMeta("token0Program", accounts.token0Program),
2512
+ getAccountMeta("token1Program", accounts.token1Program),
2513
+ getAccountMeta("oracle", accounts.oracle)
2514
+ ],
2515
+ data: getRemoveLiquidityInstructionDataEncoder().encode(
2516
+ args
2517
+ ),
2518
+ programAddress
2519
+ });
2520
+ }
2521
+ function getRemoveLiquidityInstruction(input, config) {
2522
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2523
+ const originalAccounts = {
2524
+ config: { value: input.config ?? null, isWritable: false },
2525
+ pool: { value: input.pool ?? null, isWritable: true },
2526
+ position: { value: input.position ?? null, isWritable: true },
2527
+ protocolPosition: {
2528
+ value: input.protocolPosition ?? null,
2529
+ isWritable: true
2530
+ },
2531
+ owner: { value: input.owner ?? null, isWritable: false },
2532
+ authority: { value: input.authority ?? null, isWritable: false },
2533
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2534
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2535
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2536
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2537
+ user0: { value: input.user0 ?? null, isWritable: true },
2538
+ user1: { value: input.user1 ?? null, isWritable: true },
2539
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2540
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
2541
+ oracle: { value: input.oracle ?? null, isWritable: true }
2542
+ };
2543
+ const accounts = originalAccounts;
2544
+ const args = { ...input };
2545
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2546
+ return Object.freeze({
2547
+ accounts: [
2548
+ getAccountMeta("config", accounts.config),
2549
+ getAccountMeta("pool", accounts.pool),
2550
+ getAccountMeta("position", accounts.position),
2551
+ getAccountMeta("protocolPosition", accounts.protocolPosition),
2552
+ getAccountMeta("owner", accounts.owner),
2553
+ getAccountMeta("authority", accounts.authority),
2554
+ getAccountMeta("vault0", accounts.vault0),
2555
+ getAccountMeta("vault1", accounts.vault1),
2556
+ getAccountMeta("token0Mint", accounts.token0Mint),
2557
+ getAccountMeta("token1Mint", accounts.token1Mint),
2558
+ getAccountMeta("user0", accounts.user0),
2559
+ getAccountMeta("user1", accounts.user1),
2560
+ getAccountMeta("token0Program", accounts.token0Program),
2561
+ getAccountMeta("token1Program", accounts.token1Program),
2562
+ getAccountMeta("oracle", accounts.oracle)
2563
+ ],
2564
+ data: getRemoveLiquidityInstructionDataEncoder().encode(
2565
+ args
2566
+ ),
2567
+ programAddress
2568
+ });
2569
+ }
2570
+ function parseRemoveLiquidityInstruction(instruction) {
2571
+ if (instruction.accounts.length < 15) {
2572
+ throw new kit.SolanaError(
2573
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2574
+ {
2575
+ actualAccountMetas: instruction.accounts.length,
2576
+ expectedAccountMetas: 15
2577
+ }
2578
+ );
2579
+ }
2580
+ let accountIndex = 0;
2581
+ const getNextAccount = () => {
2582
+ const accountMeta = instruction.accounts[accountIndex];
2583
+ accountIndex += 1;
2584
+ return accountMeta;
2585
+ };
2586
+ const getNextOptionalAccount = () => {
2587
+ const accountMeta = getNextAccount();
2588
+ return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
2589
+ };
2590
+ return {
2591
+ programAddress: instruction.programAddress,
2592
+ accounts: {
2593
+ config: getNextAccount(),
2594
+ pool: getNextAccount(),
2595
+ position: getNextAccount(),
2596
+ protocolPosition: getNextAccount(),
2597
+ owner: getNextAccount(),
2598
+ authority: getNextAccount(),
2599
+ vault0: getNextAccount(),
2600
+ vault1: getNextAccount(),
2601
+ token0Mint: getNextAccount(),
2602
+ token1Mint: getNextAccount(),
2603
+ user0: getNextAccount(),
2604
+ user1: getNextAccount(),
2605
+ token0Program: getNextAccount(),
2606
+ token1Program: getNextAccount(),
2607
+ oracle: getNextOptionalAccount()
2608
+ },
2609
+ data: getRemoveLiquidityInstructionDataDecoder().decode(instruction.data)
2610
+ };
2611
+ }
2612
+ var SET_FEES_DISCRIMINATOR = new Uint8Array([
2613
+ 137,
2614
+ 178,
2615
+ 49,
2616
+ 58,
2617
+ 0,
2618
+ 245,
2619
+ 242,
2620
+ 190
2621
+ ]);
2622
+ function getSetFeesDiscriminatorBytes() {
2623
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_FEES_DISCRIMINATOR);
2624
+ }
2625
+ function getSetFeesInstructionDataEncoder() {
2626
+ return kit.transformEncoder(
2627
+ kit.getStructEncoder([
2628
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2629
+ ["swapFeeBps", kit.getU16Encoder()],
2630
+ ["feeSplitBps", kit.getU16Encoder()]
2631
+ ]),
2632
+ (value) => ({ ...value, discriminator: SET_FEES_DISCRIMINATOR })
2633
+ );
2634
+ }
2635
+ function getSetFeesInstructionDataDecoder() {
2636
+ return kit.getStructDecoder([
2637
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2638
+ ["swapFeeBps", kit.getU16Decoder()],
2639
+ ["feeSplitBps", kit.getU16Decoder()]
2640
+ ]);
2641
+ }
2642
+ function getSetFeesInstructionDataCodec() {
2643
+ return kit.combineCodec(
2644
+ getSetFeesInstructionDataEncoder(),
2645
+ getSetFeesInstructionDataDecoder()
2646
+ );
2647
+ }
2648
+ function getSetFeesInstruction(input, config) {
2649
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2650
+ const originalAccounts = {
2651
+ config: { value: input.config ?? null, isWritable: false },
2652
+ pool: { value: input.pool ?? null, isWritable: true },
2653
+ admin: { value: input.admin ?? null, isWritable: false }
2654
+ };
2655
+ const accounts = originalAccounts;
2656
+ const args = { ...input };
2657
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2658
+ return Object.freeze({
2659
+ accounts: [
2660
+ getAccountMeta("config", accounts.config),
2661
+ getAccountMeta("pool", accounts.pool),
2662
+ getAccountMeta("admin", accounts.admin)
2663
+ ],
2664
+ data: getSetFeesInstructionDataEncoder().encode(
2665
+ args
2666
+ ),
2667
+ programAddress
2668
+ });
2669
+ }
2670
+ function parseSetFeesInstruction(instruction) {
2671
+ if (instruction.accounts.length < 3) {
2672
+ throw new kit.SolanaError(
2673
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2674
+ {
2675
+ actualAccountMetas: instruction.accounts.length,
2676
+ expectedAccountMetas: 3
2677
+ }
2678
+ );
2679
+ }
2680
+ let accountIndex = 0;
2681
+ const getNextAccount = () => {
2682
+ const accountMeta = instruction.accounts[accountIndex];
2683
+ accountIndex += 1;
2684
+ return accountMeta;
2685
+ };
2686
+ return {
2687
+ programAddress: instruction.programAddress,
2688
+ accounts: {
2689
+ config: getNextAccount(),
2690
+ pool: getNextAccount(),
2691
+ admin: getNextAccount()
2692
+ },
2693
+ data: getSetFeesInstructionDataDecoder().decode(instruction.data)
2694
+ };
2695
+ }
2696
+ var SET_ROUTE_DISCRIMINATOR = new Uint8Array([
2697
+ 244,
2698
+ 231,
2699
+ 3,
2700
+ 84,
2701
+ 233,
2702
+ 61,
2703
+ 146,
2704
+ 149
2705
+ ]);
2706
+ function getSetRouteDiscriminatorBytes() {
2707
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_ROUTE_DISCRIMINATOR);
2708
+ }
2709
+ function getSetRouteInstructionDataEncoder() {
2710
+ return kit.transformEncoder(
2711
+ kit.getStructEncoder([
2712
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2713
+ ["routeNextPool", kit.getAddressEncoder()],
2714
+ ["routeBridgeMint", kit.getAddressEncoder()]
2715
+ ]),
2716
+ (value) => ({ ...value, discriminator: SET_ROUTE_DISCRIMINATOR })
2717
+ );
2718
+ }
2719
+ function getSetRouteInstructionDataDecoder() {
2720
+ return kit.getStructDecoder([
2721
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2722
+ ["routeNextPool", kit.getAddressDecoder()],
2723
+ ["routeBridgeMint", kit.getAddressDecoder()]
2724
+ ]);
2725
+ }
2726
+ function getSetRouteInstructionDataCodec() {
2727
+ return kit.combineCodec(
2728
+ getSetRouteInstructionDataEncoder(),
2729
+ getSetRouteInstructionDataDecoder()
2730
+ );
2731
+ }
2732
+ function getSetRouteInstruction(input, config) {
2733
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2734
+ const originalAccounts = {
2735
+ config: { value: input.config ?? null, isWritable: false },
2736
+ pool: { value: input.pool ?? null, isWritable: true },
2737
+ nextPool: { value: input.nextPool ?? null, isWritable: false },
2738
+ admin: { value: input.admin ?? null, isWritable: false }
2739
+ };
2740
+ const accounts = originalAccounts;
2741
+ const args = { ...input };
2742
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2743
+ return Object.freeze({
2744
+ accounts: [
2745
+ getAccountMeta("config", accounts.config),
2746
+ getAccountMeta("pool", accounts.pool),
2747
+ getAccountMeta("nextPool", accounts.nextPool),
2748
+ getAccountMeta("admin", accounts.admin)
2749
+ ],
2750
+ data: getSetRouteInstructionDataEncoder().encode(
2751
+ args
2752
+ ),
2753
+ programAddress
2754
+ });
2755
+ }
2756
+ function parseSetRouteInstruction(instruction) {
2757
+ if (instruction.accounts.length < 4) {
2758
+ throw new kit.SolanaError(
2759
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2760
+ {
2761
+ actualAccountMetas: instruction.accounts.length,
2762
+ expectedAccountMetas: 4
2763
+ }
2764
+ );
2765
+ }
2766
+ let accountIndex = 0;
2767
+ const getNextAccount = () => {
2768
+ const accountMeta = instruction.accounts[accountIndex];
2769
+ accountIndex += 1;
2770
+ return accountMeta;
2771
+ };
2772
+ const getNextOptionalAccount = () => {
2773
+ const accountMeta = getNextAccount();
2774
+ return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
2775
+ };
2776
+ return {
2777
+ programAddress: instruction.programAddress,
2778
+ accounts: {
2779
+ config: getNextAccount(),
2780
+ pool: getNextAccount(),
2781
+ nextPool: getNextOptionalAccount(),
2782
+ admin: getNextAccount()
2783
+ },
2784
+ data: getSetRouteInstructionDataDecoder().decode(instruction.data)
2785
+ };
2786
+ }
2787
+ var SET_SENTINEL_DISCRIMINATOR = new Uint8Array([
2788
+ 94,
2789
+ 200,
2790
+ 82,
2791
+ 129,
2792
+ 53,
2793
+ 149,
2794
+ 232,
2795
+ 113
2796
+ ]);
2797
+ function getSetSentinelDiscriminatorBytes() {
2798
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2799
+ SET_SENTINEL_DISCRIMINATOR
2800
+ );
2801
+ }
2802
+ function getSetSentinelInstructionDataEncoder() {
2803
+ return kit.transformEncoder(
2804
+ kit.getStructEncoder([
2805
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
2806
+ ["sentinelProgram", kit.getAddressEncoder()],
2807
+ ["sentinelFlags", kit.getU32Encoder()]
2808
+ ]),
2809
+ (value) => ({ ...value, discriminator: SET_SENTINEL_DISCRIMINATOR })
2810
+ );
2811
+ }
2812
+ function getSetSentinelInstructionDataDecoder() {
2813
+ return kit.getStructDecoder([
2814
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
2815
+ ["sentinelProgram", kit.getAddressDecoder()],
2816
+ ["sentinelFlags", kit.getU32Decoder()]
2817
+ ]);
2818
+ }
2819
+ function getSetSentinelInstructionDataCodec() {
2820
+ return kit.combineCodec(
2821
+ getSetSentinelInstructionDataEncoder(),
2822
+ getSetSentinelInstructionDataDecoder()
2823
+ );
2824
+ }
2825
+ function getSetSentinelInstruction(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
+ admin: { value: input.admin ?? null, isWritable: false }
2831
+ };
2832
+ const accounts = originalAccounts;
2833
+ const args = { ...input };
2834
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2835
+ return Object.freeze({
2836
+ accounts: [
2837
+ getAccountMeta("config", accounts.config),
2838
+ getAccountMeta("pool", accounts.pool),
2839
+ getAccountMeta("admin", accounts.admin)
2840
+ ],
2841
+ data: getSetSentinelInstructionDataEncoder().encode(
2842
+ args
2843
+ ),
2844
+ programAddress
2845
+ });
2846
+ }
2847
+ function parseSetSentinelInstruction(instruction) {
2848
+ if (instruction.accounts.length < 3) {
2849
+ throw new kit.SolanaError(
2850
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2851
+ {
2852
+ actualAccountMetas: instruction.accounts.length,
2853
+ expectedAccountMetas: 3
2854
+ }
2855
+ );
2856
+ }
2857
+ let accountIndex = 0;
2858
+ const getNextAccount = () => {
2859
+ const accountMeta = instruction.accounts[accountIndex];
2860
+ accountIndex += 1;
2861
+ return accountMeta;
2862
+ };
2863
+ return {
2864
+ programAddress: instruction.programAddress,
2865
+ accounts: {
2866
+ config: getNextAccount(),
2867
+ pool: getNextAccount(),
2868
+ admin: getNextAccount()
2869
+ },
2870
+ data: getSetSentinelInstructionDataDecoder().decode(instruction.data)
2871
+ };
2872
+ }
2873
+ var SKIM_DISCRIMINATOR = new Uint8Array([
2874
+ 238,
2875
+ 120,
2876
+ 221,
2877
+ 138,
2878
+ 82,
2879
+ 60,
2880
+ 100,
2881
+ 218
2882
+ ]);
2883
+ function getSkimDiscriminatorBytes() {
2884
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SKIM_DISCRIMINATOR);
2885
+ }
2886
+ function getSkimInstructionDataEncoder() {
2887
+ return kit.transformEncoder(
2888
+ kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
2889
+ (value) => ({ ...value, discriminator: SKIM_DISCRIMINATOR })
2890
+ );
2891
+ }
2892
+ function getSkimInstructionDataDecoder() {
2893
+ return kit.getStructDecoder([
2894
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
2895
+ ]);
2896
+ }
2897
+ function getSkimInstructionDataCodec() {
2898
+ return kit.combineCodec(
2899
+ getSkimInstructionDataEncoder(),
2900
+ getSkimInstructionDataDecoder()
2901
+ );
2902
+ }
2903
+ async function getSkimInstructionAsync(input, config) {
2904
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2905
+ const originalAccounts = {
2906
+ config: { value: input.config ?? null, isWritable: false },
2907
+ pool: { value: input.pool ?? null, isWritable: false },
2908
+ admin: { value: input.admin ?? null, isWritable: false },
2909
+ authority: { value: input.authority ?? null, isWritable: false },
2910
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2911
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2912
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2913
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2914
+ adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
2915
+ adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
2916
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2917
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
2918
+ };
2919
+ const accounts = originalAccounts;
2920
+ if (!accounts.authority.value) {
2921
+ accounts.authority.value = await kit.getProgramDerivedAddress({
2922
+ programAddress,
2923
+ seeds: [
2924
+ kit.getBytesEncoder().encode(
2925
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2926
+ ),
2927
+ kit.getAddressEncoder().encode(
2928
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2929
+ )
2930
+ ]
2931
+ });
2932
+ }
2933
+ if (!accounts.adminAta0.value) {
2934
+ accounts.adminAta0.value = await kit.getProgramDerivedAddress({
2935
+ programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2936
+ seeds: [
2937
+ kit.getAddressEncoder().encode(
2938
+ programClientCore.getAddressFromResolvedInstructionAccount(
2939
+ "admin",
2940
+ accounts.admin.value
2941
+ )
2942
+ ),
2943
+ kit.getAddressEncoder().encode(
2944
+ programClientCore.getAddressFromResolvedInstructionAccount(
2945
+ "token0Program",
2946
+ accounts.token0Program.value
2947
+ )
2948
+ ),
2949
+ kit.getAddressEncoder().encode(
2950
+ programClientCore.getAddressFromResolvedInstructionAccount(
2951
+ "token0Mint",
2952
+ accounts.token0Mint.value
2953
+ )
2954
+ )
2955
+ ]
2956
+ });
2957
+ }
2958
+ if (!accounts.adminAta1.value) {
2959
+ accounts.adminAta1.value = await kit.getProgramDerivedAddress({
2960
+ programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
2961
+ seeds: [
2962
+ kit.getAddressEncoder().encode(
2963
+ programClientCore.getAddressFromResolvedInstructionAccount(
2964
+ "admin",
2965
+ accounts.admin.value
2966
+ )
2967
+ ),
2968
+ kit.getAddressEncoder().encode(
2969
+ programClientCore.getAddressFromResolvedInstructionAccount(
2970
+ "token1Program",
2971
+ accounts.token1Program.value
2972
+ )
2973
+ ),
2974
+ kit.getAddressEncoder().encode(
2975
+ programClientCore.getAddressFromResolvedInstructionAccount(
2976
+ "token1Mint",
2977
+ accounts.token1Mint.value
2978
+ )
2979
+ )
2980
+ ]
2981
+ });
2982
+ }
2983
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
2984
+ return Object.freeze({
2985
+ accounts: [
2986
+ getAccountMeta("config", accounts.config),
2987
+ getAccountMeta("pool", accounts.pool),
2988
+ getAccountMeta("admin", accounts.admin),
2989
+ getAccountMeta("authority", accounts.authority),
2990
+ getAccountMeta("vault0", accounts.vault0),
2991
+ getAccountMeta("vault1", accounts.vault1),
2992
+ getAccountMeta("token0Mint", accounts.token0Mint),
2993
+ getAccountMeta("token1Mint", accounts.token1Mint),
2994
+ getAccountMeta("adminAta0", accounts.adminAta0),
2995
+ getAccountMeta("adminAta1", accounts.adminAta1),
2996
+ getAccountMeta("token0Program", accounts.token0Program),
2997
+ getAccountMeta("token1Program", accounts.token1Program)
2998
+ ],
2999
+ data: getSkimInstructionDataEncoder().encode({}),
3000
+ programAddress
3001
+ });
3002
+ }
3003
+ function getSkimInstruction(input, config) {
3004
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3005
+ const originalAccounts = {
3006
+ config: { value: input.config ?? null, isWritable: false },
3007
+ pool: { value: input.pool ?? null, isWritable: false },
3008
+ admin: { value: input.admin ?? null, isWritable: false },
3009
+ authority: { value: input.authority ?? null, isWritable: false },
3010
+ vault0: { value: input.vault0 ?? null, isWritable: true },
3011
+ vault1: { value: input.vault1 ?? null, isWritable: true },
3012
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3013
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3014
+ adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
3015
+ adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
3016
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
3017
+ token1Program: { value: input.token1Program ?? null, isWritable: false }
3018
+ };
3019
+ const accounts = originalAccounts;
3020
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
3021
+ return Object.freeze({
3022
+ accounts: [
3023
+ getAccountMeta("config", accounts.config),
3024
+ getAccountMeta("pool", accounts.pool),
3025
+ getAccountMeta("admin", accounts.admin),
3026
+ getAccountMeta("authority", accounts.authority),
3027
+ getAccountMeta("vault0", accounts.vault0),
3028
+ getAccountMeta("vault1", accounts.vault1),
3029
+ getAccountMeta("token0Mint", accounts.token0Mint),
3030
+ getAccountMeta("token1Mint", accounts.token1Mint),
3031
+ getAccountMeta("adminAta0", accounts.adminAta0),
3032
+ getAccountMeta("adminAta1", accounts.adminAta1),
3033
+ getAccountMeta("token0Program", accounts.token0Program),
3034
+ getAccountMeta("token1Program", accounts.token1Program)
3035
+ ],
3036
+ data: getSkimInstructionDataEncoder().encode({}),
3037
+ programAddress
3038
+ });
3039
+ }
3040
+ function parseSkimInstruction(instruction) {
3041
+ if (instruction.accounts.length < 12) {
3042
+ throw new kit.SolanaError(
3043
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3044
+ {
3045
+ actualAccountMetas: instruction.accounts.length,
3046
+ expectedAccountMetas: 12
3047
+ }
3048
+ );
3049
+ }
3050
+ let accountIndex = 0;
3051
+ const getNextAccount = () => {
3052
+ const accountMeta = instruction.accounts[accountIndex];
3053
+ accountIndex += 1;
3054
+ return accountMeta;
3055
+ };
3056
+ return {
3057
+ programAddress: instruction.programAddress,
3058
+ accounts: {
3059
+ config: getNextAccount(),
3060
+ pool: getNextAccount(),
3061
+ admin: getNextAccount(),
3062
+ authority: getNextAccount(),
3063
+ vault0: getNextAccount(),
3064
+ vault1: getNextAccount(),
3065
+ token0Mint: getNextAccount(),
3066
+ token1Mint: getNextAccount(),
3067
+ adminAta0: getNextAccount(),
3068
+ adminAta1: getNextAccount(),
3069
+ token0Program: getNextAccount(),
3070
+ token1Program: getNextAccount()
3071
+ },
3072
+ data: getSkimInstructionDataDecoder().decode(instruction.data)
3073
+ };
3074
+ }
3075
+ var SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
3076
+ 104,
3077
+ 104,
3078
+ 131,
3079
+ 86,
3080
+ 161,
3081
+ 189,
3082
+ 180,
3083
+ 216
3084
+ ]);
3085
+ function getSwapExactInDiscriminatorBytes() {
3086
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
3087
+ SWAP_EXACT_IN_DISCRIMINATOR
3088
+ );
3089
+ }
3090
+ function getSwapExactInInstructionDataEncoder() {
3091
+ return kit.transformEncoder(
3092
+ kit.getStructEncoder([
3093
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
3094
+ ["amountIn", kit.getU64Encoder()],
3095
+ ["minAmountOut", kit.getU64Encoder()],
3096
+ ["direction", kit.getU8Encoder()],
3097
+ ["updateOracle", kit.getBooleanEncoder()]
3098
+ ]),
3099
+ (value) => ({ ...value, discriminator: SWAP_EXACT_IN_DISCRIMINATOR })
3100
+ );
3101
+ }
3102
+ function getSwapExactInInstructionDataDecoder() {
3103
+ return kit.getStructDecoder([
3104
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
3105
+ ["amountIn", kit.getU64Decoder()],
3106
+ ["minAmountOut", kit.getU64Decoder()],
3107
+ ["direction", kit.getU8Decoder()],
3108
+ ["updateOracle", kit.getBooleanDecoder()]
3109
+ ]);
3110
+ }
3111
+ function getSwapExactInInstructionDataCodec() {
3112
+ return kit.combineCodec(
3113
+ getSwapExactInInstructionDataEncoder(),
3114
+ getSwapExactInInstructionDataDecoder()
3115
+ );
3116
+ }
3117
+ async function getSwapExactInInstructionAsync(input, config) {
3118
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3119
+ const originalAccounts = {
3120
+ config: { value: input.config ?? null, isWritable: false },
3121
+ pool: { value: input.pool ?? null, isWritable: true },
3122
+ authority: { value: input.authority ?? null, isWritable: false },
3123
+ vaultIn: { value: input.vaultIn ?? null, isWritable: true },
3124
+ vaultOut: { value: input.vaultOut ?? null, isWritable: true },
3125
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3126
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3127
+ userIn: { value: input.userIn ?? null, isWritable: true },
3128
+ userOut: { value: input.userOut ?? null, isWritable: true },
3129
+ trader: { value: input.trader ?? null, isWritable: false },
3130
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
3131
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
3132
+ oracle: { value: input.oracle ?? null, isWritable: true }
3133
+ };
3134
+ const accounts = originalAccounts;
3135
+ const args = { ...input };
3136
+ if (!accounts.authority.value) {
3137
+ accounts.authority.value = await kit.getProgramDerivedAddress({
3138
+ programAddress,
3139
+ seeds: [
3140
+ kit.getBytesEncoder().encode(
3141
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
3142
+ ),
3143
+ kit.getAddressEncoder().encode(
3144
+ programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
3145
+ )
3146
+ ]
3147
+ });
3148
+ }
3149
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
3150
+ return Object.freeze({
3151
+ accounts: [
3152
+ getAccountMeta("config", accounts.config),
3153
+ getAccountMeta("pool", accounts.pool),
3154
+ getAccountMeta("authority", accounts.authority),
3155
+ getAccountMeta("vaultIn", accounts.vaultIn),
3156
+ getAccountMeta("vaultOut", accounts.vaultOut),
3157
+ getAccountMeta("token0Mint", accounts.token0Mint),
3158
+ getAccountMeta("token1Mint", accounts.token1Mint),
3159
+ getAccountMeta("userIn", accounts.userIn),
3160
+ getAccountMeta("userOut", accounts.userOut),
3161
+ getAccountMeta("trader", accounts.trader),
3162
+ getAccountMeta("token0Program", accounts.token0Program),
3163
+ getAccountMeta("token1Program", accounts.token1Program),
3164
+ getAccountMeta("oracle", accounts.oracle)
3165
+ ],
3166
+ data: getSwapExactInInstructionDataEncoder().encode(
3167
+ args
3168
+ ),
3169
+ programAddress
3170
+ });
3171
+ }
3172
+ function getSwapExactInInstruction(input, config) {
3173
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3174
+ const originalAccounts = {
3175
+ config: { value: input.config ?? null, isWritable: false },
3176
+ pool: { value: input.pool ?? null, isWritable: true },
3177
+ authority: { value: input.authority ?? null, isWritable: false },
3178
+ vaultIn: { value: input.vaultIn ?? null, isWritable: true },
3179
+ vaultOut: { value: input.vaultOut ?? null, isWritable: true },
3180
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
3181
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
3182
+ userIn: { value: input.userIn ?? null, isWritable: true },
3183
+ userOut: { value: input.userOut ?? null, isWritable: true },
3184
+ trader: { value: input.trader ?? null, isWritable: false },
3185
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
3186
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
3187
+ oracle: { value: input.oracle ?? null, isWritable: true }
3188
+ };
3189
+ const accounts = originalAccounts;
3190
+ const args = { ...input };
3191
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
3192
+ return Object.freeze({
3193
+ accounts: [
3194
+ getAccountMeta("config", accounts.config),
3195
+ getAccountMeta("pool", accounts.pool),
3196
+ getAccountMeta("authority", accounts.authority),
3197
+ getAccountMeta("vaultIn", accounts.vaultIn),
3198
+ getAccountMeta("vaultOut", accounts.vaultOut),
3199
+ getAccountMeta("token0Mint", accounts.token0Mint),
3200
+ getAccountMeta("token1Mint", accounts.token1Mint),
3201
+ getAccountMeta("userIn", accounts.userIn),
3202
+ getAccountMeta("userOut", accounts.userOut),
3203
+ getAccountMeta("trader", accounts.trader),
3204
+ getAccountMeta("token0Program", accounts.token0Program),
3205
+ getAccountMeta("token1Program", accounts.token1Program),
3206
+ getAccountMeta("oracle", accounts.oracle)
3207
+ ],
3208
+ data: getSwapExactInInstructionDataEncoder().encode(
3209
+ args
3210
+ ),
3211
+ programAddress
3212
+ });
3213
+ }
3214
+ function parseSwapExactInInstruction(instruction) {
3215
+ if (instruction.accounts.length < 13) {
3216
+ throw new kit.SolanaError(
3217
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3218
+ {
3219
+ actualAccountMetas: instruction.accounts.length,
3220
+ expectedAccountMetas: 13
3221
+ }
3222
+ );
3223
+ }
3224
+ let accountIndex = 0;
3225
+ const getNextAccount = () => {
3226
+ const accountMeta = instruction.accounts[accountIndex];
3227
+ accountIndex += 1;
3228
+ return accountMeta;
3229
+ };
3230
+ const getNextOptionalAccount = () => {
3231
+ const accountMeta = getNextAccount();
3232
+ return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
3233
+ };
3234
+ return {
3235
+ programAddress: instruction.programAddress,
3236
+ accounts: {
3237
+ config: getNextAccount(),
3238
+ pool: getNextAccount(),
3239
+ authority: getNextAccount(),
3240
+ vaultIn: getNextAccount(),
3241
+ vaultOut: getNextAccount(),
3242
+ token0Mint: getNextAccount(),
3243
+ token1Mint: getNextAccount(),
3244
+ userIn: getNextAccount(),
3245
+ userOut: getNextAccount(),
3246
+ trader: getNextAccount(),
3247
+ token0Program: getNextAccount(),
3248
+ token1Program: getNextAccount(),
3249
+ oracle: getNextOptionalAccount()
3250
+ },
3251
+ data: getSwapExactInInstructionDataDecoder().decode(instruction.data)
3252
+ };
3253
+ }
3254
+ var TRANSFER_ADMIN_DISCRIMINATOR = new Uint8Array([
3255
+ 42,
3256
+ 242,
3257
+ 66,
3258
+ 106,
3259
+ 228,
3260
+ 10,
3261
+ 111,
3262
+ 156
3263
+ ]);
3264
+ function getTransferAdminDiscriminatorBytes() {
3265
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
3266
+ TRANSFER_ADMIN_DISCRIMINATOR
3267
+ );
3268
+ }
3269
+ function getTransferAdminInstructionDataEncoder() {
3270
+ return kit.transformEncoder(
3271
+ kit.getStructEncoder([
3272
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
3273
+ ["newAdmin", kit.getAddressEncoder()]
3274
+ ]),
3275
+ (value) => ({ ...value, discriminator: TRANSFER_ADMIN_DISCRIMINATOR })
3276
+ );
3277
+ }
3278
+ function getTransferAdminInstructionDataDecoder() {
3279
+ return kit.getStructDecoder([
3280
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
3281
+ ["newAdmin", kit.getAddressDecoder()]
3282
+ ]);
3283
+ }
3284
+ function getTransferAdminInstructionDataCodec() {
3285
+ return kit.combineCodec(
3286
+ getTransferAdminInstructionDataEncoder(),
3287
+ getTransferAdminInstructionDataDecoder()
3288
+ );
3289
+ }
3290
+ function getTransferAdminInstruction(input, config) {
3291
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3292
+ const originalAccounts = {
3293
+ config: { value: input.config ?? null, isWritable: true },
3294
+ admin: { value: input.admin ?? null, isWritable: false }
3295
+ };
3296
+ const accounts = originalAccounts;
3297
+ const args = { ...input };
3298
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
3299
+ return Object.freeze({
3300
+ accounts: [
3301
+ getAccountMeta("config", accounts.config),
3302
+ getAccountMeta("admin", accounts.admin)
3303
+ ],
3304
+ data: getTransferAdminInstructionDataEncoder().encode(
3305
+ args
3306
+ ),
3307
+ programAddress
3308
+ });
3309
+ }
3310
+ function parseTransferAdminInstruction(instruction) {
3311
+ if (instruction.accounts.length < 2) {
3312
+ throw new kit.SolanaError(
3313
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3314
+ {
3315
+ actualAccountMetas: instruction.accounts.length,
3316
+ expectedAccountMetas: 2
3317
+ }
3318
+ );
3319
+ }
3320
+ let accountIndex = 0;
3321
+ const getNextAccount = () => {
3322
+ const accountMeta = instruction.accounts[accountIndex];
3323
+ accountIndex += 1;
3324
+ return accountMeta;
3325
+ };
3326
+ return {
3327
+ programAddress: instruction.programAddress,
3328
+ accounts: { config: getNextAccount(), admin: getNextAccount() },
3329
+ data: getTransferAdminInstructionDataDecoder().decode(instruction.data)
3330
+ };
3331
+ }
3332
+ var UNPAUSE_DISCRIMINATOR = new Uint8Array([
3333
+ 169,
3334
+ 144,
3335
+ 4,
3336
+ 38,
3337
+ 10,
3338
+ 141,
3339
+ 188,
3340
+ 255
3341
+ ]);
3342
+ function getUnpauseDiscriminatorBytes() {
3343
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(UNPAUSE_DISCRIMINATOR);
3344
+ }
3345
+ function getUnpauseInstructionDataEncoder() {
3346
+ return kit.transformEncoder(
3347
+ kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
3348
+ (value) => ({ ...value, discriminator: UNPAUSE_DISCRIMINATOR })
3349
+ );
3350
+ }
3351
+ function getUnpauseInstructionDataDecoder() {
3352
+ return kit.getStructDecoder([
3353
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
3354
+ ]);
3355
+ }
3356
+ function getUnpauseInstructionDataCodec() {
3357
+ return kit.combineCodec(
3358
+ getUnpauseInstructionDataEncoder(),
3359
+ getUnpauseInstructionDataDecoder()
3360
+ );
3361
+ }
3362
+ function getUnpauseInstruction(input, config) {
3363
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3364
+ const originalAccounts = {
3365
+ config: { value: input.config ?? null, isWritable: true },
3366
+ admin: { value: input.admin ?? null, isWritable: false }
3367
+ };
3368
+ const accounts = originalAccounts;
3369
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
3370
+ return Object.freeze({
3371
+ accounts: [
3372
+ getAccountMeta("config", accounts.config),
3373
+ getAccountMeta("admin", accounts.admin)
3374
+ ],
3375
+ data: getUnpauseInstructionDataEncoder().encode({}),
3376
+ programAddress
3377
+ });
3378
+ }
3379
+ function parseUnpauseInstruction(instruction) {
3380
+ if (instruction.accounts.length < 2) {
3381
+ throw new kit.SolanaError(
3382
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3383
+ {
3384
+ actualAccountMetas: instruction.accounts.length,
3385
+ expectedAccountMetas: 2
3386
+ }
3387
+ );
3388
+ }
3389
+ let accountIndex = 0;
3390
+ const getNextAccount = () => {
3391
+ const accountMeta = instruction.accounts[accountIndex];
3392
+ accountIndex += 1;
3393
+ return accountMeta;
3394
+ };
3395
+ return {
3396
+ programAddress: instruction.programAddress,
3397
+ accounts: { config: getNextAccount(), admin: getNextAccount() },
3398
+ data: getUnpauseInstructionDataDecoder().decode(instruction.data)
3399
+ };
3400
+ }
3401
+ var UPDATE_CONFIG_DISCRIMINATOR = new Uint8Array([
3402
+ 29,
3403
+ 158,
3404
+ 252,
3405
+ 191,
3406
+ 10,
3407
+ 83,
3408
+ 219,
3409
+ 99
3410
+ ]);
3411
+ function getUpdateConfigDiscriminatorBytes() {
3412
+ return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
3413
+ UPDATE_CONFIG_DISCRIMINATOR
3414
+ );
3415
+ }
3416
+ function getUpdateConfigInstructionDataEncoder() {
3417
+ return kit.transformEncoder(
3418
+ kit.getStructEncoder([
3419
+ ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
3420
+ ["numeraireMint", kit.getAddressEncoder()],
3421
+ ["maxSwapFeeBps", kit.getU16Encoder()],
3422
+ ["maxFeeSplitBps", kit.getU16Encoder()],
3423
+ ["maxRouteHops", kit.getU8Encoder()],
3424
+ ["protocolFeeEnabled", kit.getBooleanEncoder()],
3425
+ ["protocolFeeBps", kit.getU16Encoder()],
3426
+ ["sentinelAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
3427
+ ]),
3428
+ (value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR })
3429
+ );
3430
+ }
3431
+ function getUpdateConfigInstructionDataDecoder() {
3432
+ return kit.getStructDecoder([
3433
+ ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
3434
+ ["numeraireMint", kit.getAddressDecoder()],
3435
+ ["maxSwapFeeBps", kit.getU16Decoder()],
3436
+ ["maxFeeSplitBps", kit.getU16Decoder()],
3437
+ ["maxRouteHops", kit.getU8Decoder()],
3438
+ ["protocolFeeEnabled", kit.getBooleanDecoder()],
3439
+ ["protocolFeeBps", kit.getU16Decoder()],
3440
+ ["sentinelAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
3441
+ ]);
3442
+ }
3443
+ function getUpdateConfigInstructionDataCodec() {
3444
+ return kit.combineCodec(
3445
+ getUpdateConfigInstructionDataEncoder(),
3446
+ getUpdateConfigInstructionDataDecoder()
3447
+ );
3448
+ }
3449
+ function getUpdateConfigInstruction(input, config) {
3450
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
3451
+ const originalAccounts = {
3452
+ config: { value: input.config ?? null, isWritable: true },
3453
+ admin: { value: input.admin ?? null, isWritable: false }
3454
+ };
3455
+ const accounts = originalAccounts;
3456
+ const args = { ...input };
3457
+ const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
3458
+ return Object.freeze({
3459
+ accounts: [
3460
+ getAccountMeta("config", accounts.config),
3461
+ getAccountMeta("admin", accounts.admin)
3462
+ ],
3463
+ data: getUpdateConfigInstructionDataEncoder().encode(
3464
+ args
3465
+ ),
3466
+ programAddress
3467
+ });
712
3468
  }
713
- function createSwapExactInInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
714
- const {
715
- config,
716
- pool,
717
- authority,
718
- vaultIn,
719
- vaultOut,
720
- token0Mint,
721
- token1Mint,
722
- userIn,
723
- userOut,
724
- user,
725
- token0Program,
726
- token1Program,
727
- tokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
728
- instructionsSysvar = chunkO6FR7TXY_cjs.SYSVAR_INSTRUCTIONS_ADDRESS,
729
- oracle,
730
- remainingAccounts = []
731
- } = accounts;
732
- const resolvedToken0Program = token0Program ?? tokenProgram;
733
- const resolvedToken1Program = token1Program ?? tokenProgram;
734
- const keys = [
735
- { address: config, role: kit.AccountRole.READONLY },
736
- { address: pool, role: kit.AccountRole.WRITABLE },
737
- { address: authority, role: kit.AccountRole.READONLY },
738
- { address: vaultIn, role: kit.AccountRole.WRITABLE },
739
- { address: vaultOut, role: kit.AccountRole.WRITABLE },
740
- { address: token0Mint, role: kit.AccountRole.READONLY },
741
- { address: token1Mint, role: kit.AccountRole.READONLY },
742
- { address: userIn, role: kit.AccountRole.WRITABLE },
743
- { address: userOut, role: kit.AccountRole.WRITABLE },
744
- { address: user, role: kit.AccountRole.READONLY_SIGNER },
745
- { address: resolvedToken0Program, role: kit.AccountRole.READONLY },
746
- { address: resolvedToken1Program, role: kit.AccountRole.READONLY },
747
- { address: instructionsSysvar, role: kit.AccountRole.READONLY }
748
- ];
749
- if (oracle) {
750
- keys.push({ address: oracle, role: kit.AccountRole.WRITABLE });
751
- }
752
- for (const account of remainingAccounts) {
753
- keys.push({ address: account, role: kit.AccountRole.READONLY });
3469
+ function parseUpdateConfigInstruction(instruction) {
3470
+ if (instruction.accounts.length < 2) {
3471
+ throw new kit.SolanaError(
3472
+ kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
3473
+ {
3474
+ actualAccountMetas: instruction.accounts.length,
3475
+ expectedAccountMetas: 2
3476
+ }
3477
+ );
754
3478
  }
755
- const data = chunkI5JME35L_cjs.encodeInstructionData(
756
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.swapExactIn,
757
- chunkI5JME35L_cjs.swapExactInArgsCodec,
758
- args
759
- );
3479
+ let accountIndex = 0;
3480
+ const getNextAccount = () => {
3481
+ const accountMeta = instruction.accounts[accountIndex];
3482
+ accountIndex += 1;
3483
+ return accountMeta;
3484
+ };
760
3485
  return {
761
- programAddress: programId,
762
- accounts: keys,
763
- data
3486
+ programAddress: instruction.programAddress,
3487
+ accounts: { config: getNextAccount(), admin: getNextAccount() },
3488
+ data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
764
3489
  };
765
3490
  }
766
3491
  function createSwapInstruction(params) {
@@ -779,17 +3504,16 @@ function createSwapInstruction(params) {
779
3504
  minAmountOut,
780
3505
  direction,
781
3506
  oracle,
782
- remainingAccounts,
3507
+ remainingAccounts = [],
783
3508
  updateOracle = false,
784
3509
  token0Program,
785
3510
  token1Program,
786
3511
  tokenProgram,
787
- instructionsSysvar,
788
- programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID
3512
+ programId = CPMM_PROGRAM_ADDRESS
789
3513
  } = params;
790
3514
  const [vaultIn, vaultOut] = direction === 0 ? [vault0, vault1] : [vault1, vault0];
791
3515
  const [userIn, userOut] = direction === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
792
- return createSwapExactInInstruction(
3516
+ const instruction = getSwapExactInInstruction(
793
3517
  {
794
3518
  config,
795
3519
  pool,
@@ -800,275 +3524,29 @@ function createSwapInstruction(params) {
800
3524
  token1Mint,
801
3525
  userIn,
802
3526
  userOut,
803
- user,
804
- token0Program,
805
- token1Program,
806
- tokenProgram,
807
- instructionsSysvar,
3527
+ trader: kit.createNoopSigner(user),
3528
+ token0Program: token0Program ?? tokenProgram ?? chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
3529
+ token1Program: token1Program ?? tokenProgram ?? chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
808
3530
  oracle,
809
- remainingAccounts
810
- },
811
- {
812
3531
  amountIn,
813
3532
  minAmountOut,
814
3533
  direction,
815
3534
  updateOracle
816
3535
  },
817
- programId
818
- );
819
- }
820
- function createCreatePositionInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
821
- const {
822
- pool,
823
- position,
824
- owner,
825
- payer,
826
- systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS
827
- } = accounts;
828
- const keys = [
829
- { address: pool, role: kit.AccountRole.READONLY },
830
- { address: position, role: kit.AccountRole.WRITABLE },
831
- { address: owner, role: kit.AccountRole.READONLY_SIGNER },
832
- { address: payer, role: kit.AccountRole.WRITABLE_SIGNER },
833
- { address: systemProgram, role: kit.AccountRole.READONLY }
834
- ];
835
- const data = chunkI5JME35L_cjs.encodeInstructionData(
836
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.createPosition,
837
- chunkI5JME35L_cjs.createPositionArgsCodec,
838
- args
839
- );
840
- return {
841
- programAddress: programId,
842
- accounts: keys,
843
- data
844
- };
845
- }
846
- function createClosePositionInstruction(accounts, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
847
- const { pool, position, owner, rentRecipient } = accounts;
848
- const keys = [
849
- { address: pool, role: kit.AccountRole.READONLY },
850
- { address: position, role: kit.AccountRole.WRITABLE },
851
- { address: owner, role: kit.AccountRole.READONLY_SIGNER },
852
- { address: rentRecipient, role: kit.AccountRole.WRITABLE }
853
- ];
854
- const data = chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.closePosition;
855
- return {
856
- programAddress: programId,
857
- accounts: keys,
858
- data
859
- };
860
- }
861
- var addLiquidityArgsWithOracleCodec = kit.getStructCodec([
862
- ["amount0Max", kit.getU64Codec()],
863
- ["amount1Max", kit.getU64Codec()],
864
- ["minSharesOut", kit.getU128Codec()],
865
- ["updateOracle", kit.getBooleanCodec()]
866
- ]);
867
- function createAddLiquidityInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
868
- const {
869
- config,
870
- pool,
871
- position,
872
- protocolPosition,
873
- owner,
874
- authority,
875
- vault0,
876
- vault1,
877
- token0Mint,
878
- token1Mint,
879
- user0,
880
- user1,
881
- tokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
882
- oracle,
883
- remainingAccounts = []
884
- } = accounts;
885
- const keys = [
886
- { address: config, role: kit.AccountRole.READONLY },
887
- { address: pool, role: kit.AccountRole.WRITABLE },
888
- { address: position, role: kit.AccountRole.WRITABLE },
889
- { address: protocolPosition, role: kit.AccountRole.WRITABLE },
890
- { address: owner, role: kit.AccountRole.READONLY_SIGNER },
891
- { address: authority, role: kit.AccountRole.READONLY },
892
- { address: vault0, role: kit.AccountRole.WRITABLE },
893
- { address: vault1, role: kit.AccountRole.WRITABLE },
894
- { address: token0Mint, role: kit.AccountRole.READONLY },
895
- { address: token1Mint, role: kit.AccountRole.READONLY },
896
- { address: user0, role: kit.AccountRole.WRITABLE },
897
- { address: user1, role: kit.AccountRole.WRITABLE },
898
- { address: tokenProgram, role: kit.AccountRole.READONLY }
899
- ];
900
- if (oracle) {
901
- keys.push({ address: oracle, role: kit.AccountRole.WRITABLE });
902
- }
903
- for (const account of remainingAccounts) {
904
- keys.push({ address: account, role: kit.AccountRole.READONLY });
905
- }
906
- const data = chunkI5JME35L_cjs.encodeInstructionData(
907
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.addLiquidity,
908
- addLiquidityArgsWithOracleCodec,
909
- args
910
- );
911
- return {
912
- programAddress: programId,
913
- accounts: keys,
914
- data
915
- };
916
- }
917
- function createRemoveLiquidityInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
918
- const {
919
- config,
920
- pool,
921
- position,
922
- protocolPosition,
923
- owner,
924
- authority,
925
- vault0,
926
- vault1,
927
- token0Mint,
928
- token1Mint,
929
- user0,
930
- user1,
931
- tokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
932
- oracle,
933
- remainingAccounts = []
934
- } = accounts;
935
- const keys = [
936
- { address: config, role: kit.AccountRole.READONLY },
937
- { address: pool, role: kit.AccountRole.WRITABLE },
938
- { address: position, role: kit.AccountRole.WRITABLE },
939
- { address: protocolPosition, role: kit.AccountRole.WRITABLE },
940
- { address: owner, role: kit.AccountRole.READONLY_SIGNER },
941
- { address: authority, role: kit.AccountRole.READONLY },
942
- { address: vault0, role: kit.AccountRole.WRITABLE },
943
- { address: vault1, role: kit.AccountRole.WRITABLE },
944
- { address: token0Mint, role: kit.AccountRole.READONLY },
945
- { address: token1Mint, role: kit.AccountRole.READONLY },
946
- { address: user0, role: kit.AccountRole.WRITABLE },
947
- { address: user1, role: kit.AccountRole.WRITABLE },
948
- { address: tokenProgram, role: kit.AccountRole.READONLY }
949
- ];
950
- if (oracle) {
951
- keys.push({ address: oracle, role: kit.AccountRole.WRITABLE });
952
- }
953
- for (const account of remainingAccounts) {
954
- keys.push({ address: account, role: kit.AccountRole.READONLY });
955
- }
956
- const data = chunkI5JME35L_cjs.encodeInstructionData(
957
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.removeLiquidity,
958
- chunkI5JME35L_cjs.removeLiquidityArgsCodec,
959
- args
960
- );
961
- return {
962
- programAddress: programId,
963
- accounts: keys,
964
- data
965
- };
966
- }
967
- function createCollectProtocolFeesInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
968
- const {
969
- config,
970
- pool,
971
- protocolPosition,
972
- admin,
973
- authority,
974
- vault0,
975
- vault1,
976
- token0Mint,
977
- token1Mint,
978
- recipient0,
979
- recipient1,
980
- tokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS
981
- } = accounts;
982
- const keys = [
983
- { address: config, role: kit.AccountRole.READONLY },
984
- { address: pool, role: kit.AccountRole.WRITABLE },
985
- { address: protocolPosition, role: kit.AccountRole.WRITABLE },
986
- { address: admin, role: kit.AccountRole.READONLY_SIGNER },
987
- { address: authority, role: kit.AccountRole.READONLY },
988
- { address: vault0, role: kit.AccountRole.WRITABLE },
989
- { address: vault1, role: kit.AccountRole.WRITABLE },
990
- { address: token0Mint, role: kit.AccountRole.READONLY },
991
- { address: token1Mint, role: kit.AccountRole.READONLY },
992
- { address: recipient0, role: kit.AccountRole.WRITABLE },
993
- { address: recipient1, role: kit.AccountRole.WRITABLE },
994
- { address: tokenProgram, role: kit.AccountRole.READONLY }
995
- ];
996
- const data = chunkI5JME35L_cjs.encodeInstructionData(
997
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.collectProtocolFees,
998
- chunkI5JME35L_cjs.collectProtocolFeesArgsCodec,
999
- args
1000
- );
1001
- return {
1002
- programAddress: programId,
1003
- accounts: keys,
1004
- data
1005
- };
1006
- }
1007
- function createOracleUpdateInstruction(accounts, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
1008
- const { pool, oracle } = accounts;
1009
- const keys = [
1010
- { address: pool, role: kit.AccountRole.READONLY },
1011
- { address: oracle, role: kit.AccountRole.WRITABLE }
1012
- ];
1013
- const data = chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.oracleUpdate;
1014
- return {
1015
- programAddress: programId,
1016
- accounts: keys,
1017
- data
1018
- };
1019
- }
1020
- var oracleConsultResultCodec = kit.getStructCodec([
1021
- ["price0Q64", kit.getU128Codec()],
1022
- ["price1Q64", kit.getU128Codec()]
1023
- ]);
1024
- function decodeOracleConsultResult(data) {
1025
- return oracleConsultResultCodec.decode(data);
1026
- }
1027
- function createOracleConsultInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
1028
- const { pool, oracle } = accounts;
1029
- const keys = [
1030
- { address: pool, role: kit.AccountRole.READONLY },
1031
- { address: oracle, role: kit.AccountRole.READONLY }
1032
- ];
1033
- const data = chunkI5JME35L_cjs.encodeInstructionData(
1034
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.oracleConsult,
1035
- chunkI5JME35L_cjs.oracleConsultArgsCodec,
1036
- args
1037
- );
1038
- return {
1039
- programAddress: programId,
1040
- accounts: keys,
1041
- data
1042
- };
1043
- }
1044
- var quoteToNumeraireResultCodec = kit.getStructCodec([
1045
- ["amountInNumeraire", kit.getU128Codec()],
1046
- ["endMint", kit.getAddressCodec()],
1047
- ["hopsUsed", kit.getU8Codec()]
1048
- ]);
1049
- function decodeQuoteToNumeraireResult(data) {
1050
- return quoteToNumeraireResultCodec.decode(data);
1051
- }
1052
- function createQuoteToNumeraireInstruction(accounts, args, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID) {
1053
- const { config, startPool, remainingAccounts = [] } = accounts;
1054
- const keys = [
1055
- { address: config, role: kit.AccountRole.READONLY },
1056
- { address: startPool, role: kit.AccountRole.READONLY }
1057
- ];
1058
- for (const account of remainingAccounts) {
1059
- keys.push({ address: account, role: kit.AccountRole.READONLY });
1060
- }
1061
- const data = chunkI5JME35L_cjs.encodeInstructionData(
1062
- chunkO6FR7TXY_cjs.INSTRUCTION_DISCRIMINATORS.quoteToNumeraire,
1063
- chunkI5JME35L_cjs.quoteToNumeraireArgsCodec,
1064
- args
3536
+ { programAddress: programId }
1065
3537
  );
1066
3538
  return {
1067
- programAddress: programId,
1068
- accounts: keys,
1069
- data
3539
+ ...instruction,
3540
+ accounts: [
3541
+ ...instruction.accounts ?? [],
3542
+ ...remainingAccounts.map((address3) => ({
3543
+ address: address3,
3544
+ role: kit.AccountRole.READONLY
3545
+ }))
3546
+ ]
1070
3547
  };
1071
3548
  }
3549
+ var MAX_FEE_AMOUNT = BigInt("18446744073709551615");
1072
3550
 
1073
3551
  // src/solana/client/config.ts
1074
3552
  function base64ToBytes(base64) {
@@ -1079,8 +3557,8 @@ function base64ToBytes(base64) {
1079
3557
  }
1080
3558
  return bytes;
1081
3559
  }
1082
- async function fetchConfig(rpc, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID, commitment) {
1083
- const [configAddress] = await chunkO6FR7TXY_cjs.getConfigAddress(programId);
3560
+ async function fetchConfig(rpc, programId = chunk6FRZFA5R_cjs.CPMM_PROGRAM_ID, commitment) {
3561
+ const [configAddress] = await chunk6FRZFA5R_cjs.getConfigAddress(programId);
1084
3562
  const response = await rpc.getAccountInfo(configAddress, {
1085
3563
  encoding: "base64",
1086
3564
  commitment
@@ -1088,10 +3566,10 @@ async function fetchConfig(rpc, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID, c
1088
3566
  if (!response.value) {
1089
3567
  return null;
1090
3568
  }
1091
- return chunkI5JME35L_cjs.decodeAmmConfig(base64ToBytes(response.value.data[0]));
3569
+ return chunk5USQGM5X_cjs.decodeAmmConfig(base64ToBytes(response.value.data[0]));
1092
3570
  }
1093
- async function fetchConfigWithAddress(rpc, programId = chunkO6FR7TXY_cjs.CPMM_PROGRAM_ID, commitment) {
1094
- const [configAddress] = await chunkO6FR7TXY_cjs.getConfigAddress(programId);
3571
+ async function fetchConfigWithAddress(rpc, programId = chunk6FRZFA5R_cjs.CPMM_PROGRAM_ID, commitment) {
3572
+ const [configAddress] = await chunk6FRZFA5R_cjs.getConfigAddress(programId);
1095
3573
  const account = await fetchConfig(rpc, programId, commitment);
1096
3574
  if (!account) {
1097
3575
  return null;
@@ -1128,7 +3606,7 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
1128
3606
  SF_BEFORE_SWAP: () => SF_BEFORE_SWAP2,
1129
3607
  computeRemainingAccountsHash: () => computeRemainingAccountsHash,
1130
3608
  createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
1131
- createInitializeConfigInstruction: () => createInitializeConfigInstruction2,
3609
+ createInitializeConfigInstruction: () => createInitializeConfigInstruction,
1132
3610
  createInitializeLaunchInstruction: () => createInitializeLaunchInstruction,
1133
3611
  createMigrateLaunchInstruction: () => createMigrateLaunchInstruction,
1134
3612
  createPreviewMigrationInstruction: () => createPreviewMigrationInstruction,
@@ -1426,6 +3904,10 @@ function getInitializeLaunchArgsEncoder() {
1426
3904
  kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
1427
3905
  ],
1428
3906
  ["sentinelRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
3907
+ [
3908
+ "migratorInitRemainingAccountsHash",
3909
+ kit.fixEncoderSize(kit.getBytesEncoder(), 32)
3910
+ ],
1429
3911
  ["migratorRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
1430
3912
  ["metadataName", kit.addEncoderSizePrefix(kit.getUtf8Encoder(), kit.getU32Encoder())],
1431
3913
  ["metadataSymbol", kit.addEncoderSizePrefix(kit.getUtf8Encoder(), kit.getU32Encoder())],
@@ -1463,6 +3945,10 @@ function getInitializeLaunchArgsDecoder() {
1463
3945
  kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())
1464
3946
  ],
1465
3947
  ["sentinelRemainingAccountsHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
3948
+ [
3949
+ "migratorInitRemainingAccountsHash",
3950
+ kit.fixDecoderSize(kit.getBytesDecoder(), 32)
3951
+ ],
1466
3952
  ["migratorRemainingAccountsHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
1467
3953
  ["metadataName", kit.addDecoderSizePrefix(kit.getUtf8Decoder(), kit.getU32Decoder())],
1468
3954
  ["metadataSymbol", kit.addDecoderSizePrefix(kit.getUtf8Decoder(), kit.getU32Decoder())],
@@ -1594,7 +4080,7 @@ function getCurveSwapExactInInstructionDataEncoder() {
1594
4080
  (value) => ({ ...value, discriminator: CURVE_SWAP_EXACT_IN_DISCRIMINATOR })
1595
4081
  );
1596
4082
  }
1597
- var INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([
4083
+ var INITIALIZE_CONFIG_DISCRIMINATOR2 = new Uint8Array([
1598
4084
  208,
1599
4085
  127,
1600
4086
  21,
@@ -1604,14 +4090,14 @@ var INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([
1604
4090
  196,
1605
4091
  70
1606
4092
  ]);
1607
- function getInitializeConfigInstructionDataEncoder() {
4093
+ function getInitializeConfigInstructionDataEncoder2() {
1608
4094
  return kit.transformEncoder(
1609
4095
  kit.getStructEncoder([
1610
4096
  ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
1611
4097
  ["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())],
1612
4098
  ["sentinelAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
1613
4099
  ]),
1614
- (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
4100
+ (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR2 })
1615
4101
  );
1616
4102
  }
1617
4103
  var INITIALIZE_LAUNCH_DISCRIMINATOR = new Uint8Array([
@@ -1657,6 +4143,10 @@ function getInitializeLaunchInstructionDataEncoder() {
1657
4143
  kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
1658
4144
  ],
1659
4145
  ["sentinelRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
4146
+ [
4147
+ "migratorInitRemainingAccountsHash",
4148
+ kit.fixEncoderSize(kit.getBytesEncoder(), 32)
4149
+ ],
1660
4150
  ["migratorRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
1661
4151
  ["metadataName", kit.addEncoderSizePrefix(kit.getUtf8Encoder(), kit.getU32Encoder())],
1662
4152
  [
@@ -1668,7 +4158,7 @@ function getInitializeLaunchInstructionDataEncoder() {
1668
4158
  (value) => ({ ...value, discriminator: INITIALIZE_LAUNCH_DISCRIMINATOR })
1669
4159
  );
1670
4160
  }
1671
- var PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
4161
+ var PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR2 = new Uint8Array([
1672
4162
  50,
1673
4163
  130,
1674
4164
  31,
@@ -1678,7 +4168,7 @@ var PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
1678
4168
  222,
1679
4169
  178
1680
4170
  ]);
1681
- function getPreviewSwapExactInInstructionDataEncoder() {
4171
+ function getPreviewSwapExactInInstructionDataEncoder2() {
1682
4172
  return kit.transformEncoder(
1683
4173
  kit.getStructEncoder([
1684
4174
  ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
@@ -1687,7 +4177,7 @@ function getPreviewSwapExactInInstructionDataEncoder() {
1687
4177
  ]),
1688
4178
  (value) => ({
1689
4179
  ...value,
1690
- discriminator: PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
4180
+ discriminator: PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR2
1691
4181
  })
1692
4182
  );
1693
4183
  }
@@ -1783,40 +4273,38 @@ function launchIdFromU64(launchId) {
1783
4273
  out.set(encodeU64LE(launchId), 0);
1784
4274
  return out;
1785
4275
  }
1786
- function isTransactionSigner2(value) {
4276
+ function isTransactionSigner(value) {
1787
4277
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
1788
4278
  }
1789
- function createSignerAccountMeta2(value, role) {
1790
- if (isTransactionSigner2(value)) {
4279
+ function createSignerAccountMeta(value, role) {
4280
+ if (isTransactionSigner(value)) {
1791
4281
  return { address: value.address, role, signer: value };
1792
4282
  }
1793
4283
  return { address: value, role };
1794
4284
  }
1795
- function createInitializeConfigInstruction2(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
4285
+ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
1796
4286
  const {
1797
4287
  admin,
1798
4288
  config,
1799
4289
  programData,
1800
- systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS,
1801
- instructionsSysvar = chunkO6FR7TXY_cjs.SYSVAR_INSTRUCTIONS_ADDRESS
4290
+ systemProgram = chunk6FRZFA5R_cjs.SYSTEM_PROGRAM_ADDRESS
1802
4291
  } = accounts;
1803
4292
  const keys = [
1804
- createSignerAccountMeta2(admin, kit.AccountRole.WRITABLE_SIGNER),
4293
+ createSignerAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
1805
4294
  { address: config, role: kit.AccountRole.WRITABLE },
1806
4295
  { address: programData, role: kit.AccountRole.READONLY },
1807
- { address: systemProgram, role: kit.AccountRole.READONLY },
1808
- { address: instructionsSysvar, role: kit.AccountRole.READONLY }
4296
+ { address: systemProgram, role: kit.AccountRole.READONLY }
1809
4297
  ];
1810
4298
  const data = new Uint8Array(
1811
- getInitializeConfigInstructionDataEncoder().encode(args)
4299
+ getInitializeConfigInstructionDataEncoder2().encode(args)
1812
4300
  );
1813
4301
  return { programAddress: programId, accounts: keys, data };
1814
4302
  }
1815
- function isTransactionSigner3(value) {
4303
+ function isTransactionSigner2(value) {
1816
4304
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
1817
4305
  }
1818
- function createSignerAccountMeta3(value, role) {
1819
- if (isTransactionSigner3(value)) {
4306
+ function createSignerAccountMeta2(value, role) {
4307
+ if (isTransactionSigner2(value)) {
1820
4308
  return { address: value.address, role, signer: value };
1821
4309
  }
1822
4310
  return { address: value, role };
@@ -1824,7 +4312,7 @@ function createSignerAccountMeta3(value, role) {
1824
4312
  function createSetMigratorAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
1825
4313
  const { admin, config } = accounts;
1826
4314
  const keys = [
1827
- createSignerAccountMeta3(admin, kit.AccountRole.WRITABLE_SIGNER),
4315
+ createSignerAccountMeta2(admin, kit.AccountRole.WRITABLE_SIGNER),
1828
4316
  { address: config, role: kit.AccountRole.WRITABLE }
1829
4317
  ];
1830
4318
  const data = new Uint8Array(
@@ -1832,11 +4320,11 @@ function createSetMigratorAllowlistInstruction(accounts, allowlist, programId =
1832
4320
  );
1833
4321
  return { programAddress: programId, accounts: keys, data };
1834
4322
  }
1835
- function isTransactionSigner4(value) {
4323
+ function isTransactionSigner3(value) {
1836
4324
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
1837
4325
  }
1838
- function createSignerAccountMeta4(value, role) {
1839
- if (isTransactionSigner4(value)) {
4326
+ function createSignerAccountMeta3(value, role) {
4327
+ if (isTransactionSigner3(value)) {
1840
4328
  return { address: value.address, role, signer: value };
1841
4329
  }
1842
4330
  return { address: value, role };
@@ -1844,7 +4332,7 @@ function createSignerAccountMeta4(value, role) {
1844
4332
  function createSetSentinelAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
1845
4333
  const { admin, config } = accounts;
1846
4334
  const keys = [
1847
- createSignerAccountMeta4(admin, kit.AccountRole.WRITABLE_SIGNER),
4335
+ createSignerAccountMeta3(admin, kit.AccountRole.WRITABLE_SIGNER),
1848
4336
  { address: config, role: kit.AccountRole.WRITABLE }
1849
4337
  ];
1850
4338
  const data = new Uint8Array(
@@ -2494,7 +4982,7 @@ async function fetchAllMaybeMarket(rpc, addresses, config) {
2494
4982
  function getMarketSize() {
2495
4983
  return 208;
2496
4984
  }
2497
- var ORACLE_STATE_DISCRIMINATOR = new Uint8Array([
4985
+ var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
2498
4986
  97,
2499
4987
  156,
2500
4988
  157,
@@ -2506,7 +4994,7 @@ var ORACLE_STATE_DISCRIMINATOR = new Uint8Array([
2506
4994
  ]);
2507
4995
  function getOracleStateDiscriminatorBytes() {
2508
4996
  return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
2509
- ORACLE_STATE_DISCRIMINATOR
4997
+ ORACLE_STATE_DISCRIMINATOR2
2510
4998
  );
2511
4999
  }
2512
5000
  function getOracleStateEncoder() {
@@ -2521,7 +5009,7 @@ function getOracleStateEncoder() {
2521
5009
  ["bump", kit.getU8Encoder()],
2522
5010
  ["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 31)]
2523
5011
  ]),
2524
- (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR })
5012
+ (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR2 })
2525
5013
  );
2526
5014
  }
2527
5015
  function getOracleStateDecoder() {
@@ -2536,7 +5024,7 @@ function getOracleStateDecoder() {
2536
5024
  ["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 31)]
2537
5025
  ]);
2538
5026
  }
2539
- function getOracleStateCodec() {
5027
+ function getOracleStateCodec2() {
2540
5028
  return kit.combineCodec(getOracleStateEncoder(), getOracleStateDecoder());
2541
5029
  }
2542
5030
  function decodeOracleState2(encodedAccount) {
@@ -2610,6 +5098,7 @@ async function getClaimInstructionAsync(input, config) {
2610
5098
  },
2611
5099
  potVault: { value: input.potVault ?? null, isWritable: true },
2612
5100
  winnerMint: { value: input.winnerMint ?? null, isWritable: true },
5101
+ quoteMint: { value: input.quoteMint ?? null, isWritable: false },
2613
5102
  entryByMint: { value: input.entryByMint ?? null, isWritable: false },
2614
5103
  claimerWinnerAta: {
2615
5104
  value: input.claimerWinnerAta ?? null,
@@ -2619,7 +5108,14 @@ async function getClaimInstructionAsync(input, config) {
2619
5108
  claimer: { value: input.claimer ?? null, isWritable: false },
2620
5109
  receipt: { value: input.receipt ?? null, isWritable: true },
2621
5110
  payer: { value: input.payer ?? null, isWritable: true },
2622
- tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
5111
+ baseTokenProgram: {
5112
+ value: input.baseTokenProgram ?? null,
5113
+ isWritable: false
5114
+ },
5115
+ quoteTokenProgram: {
5116
+ value: input.quoteTokenProgram ?? null,
5117
+ isWritable: false
5118
+ },
2623
5119
  systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2624
5120
  };
2625
5121
  const accounts = originalAccounts;
@@ -2715,9 +5211,6 @@ async function getClaimInstructionAsync(input, config) {
2715
5211
  ]
2716
5212
  });
2717
5213
  }
2718
- if (!accounts.tokenProgram.value) {
2719
- accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2720
- }
2721
5214
  if (!accounts.systemProgram.value) {
2722
5215
  accounts.systemProgram.value = "11111111111111111111111111111111";
2723
5216
  }
@@ -2728,13 +5221,15 @@ async function getClaimInstructionAsync(input, config) {
2728
5221
  getAccountMeta("marketAuthority", accounts.marketAuthority),
2729
5222
  getAccountMeta("potVault", accounts.potVault),
2730
5223
  getAccountMeta("winnerMint", accounts.winnerMint),
5224
+ getAccountMeta("quoteMint", accounts.quoteMint),
2731
5225
  getAccountMeta("entryByMint", accounts.entryByMint),
2732
5226
  getAccountMeta("claimerWinnerAta", accounts.claimerWinnerAta),
2733
5227
  getAccountMeta("claimerQuoteAta", accounts.claimerQuoteAta),
2734
5228
  getAccountMeta("claimer", accounts.claimer),
2735
5229
  getAccountMeta("receipt", accounts.receipt),
2736
5230
  getAccountMeta("payer", accounts.payer),
2737
- getAccountMeta("tokenProgram", accounts.tokenProgram),
5231
+ getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
5232
+ getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
2738
5233
  getAccountMeta("systemProgram", accounts.systemProgram)
2739
5234
  ],
2740
5235
  data: getClaimInstructionDataEncoder().encode(
@@ -2753,6 +5248,7 @@ function getClaimInstruction(input, config) {
2753
5248
  },
2754
5249
  potVault: { value: input.potVault ?? null, isWritable: true },
2755
5250
  winnerMint: { value: input.winnerMint ?? null, isWritable: true },
5251
+ quoteMint: { value: input.quoteMint ?? null, isWritable: false },
2756
5252
  entryByMint: { value: input.entryByMint ?? null, isWritable: false },
2757
5253
  claimerWinnerAta: {
2758
5254
  value: input.claimerWinnerAta ?? null,
@@ -2762,14 +5258,18 @@ function getClaimInstruction(input, config) {
2762
5258
  claimer: { value: input.claimer ?? null, isWritable: false },
2763
5259
  receipt: { value: input.receipt ?? null, isWritable: true },
2764
5260
  payer: { value: input.payer ?? null, isWritable: true },
2765
- tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
5261
+ baseTokenProgram: {
5262
+ value: input.baseTokenProgram ?? null,
5263
+ isWritable: false
5264
+ },
5265
+ quoteTokenProgram: {
5266
+ value: input.quoteTokenProgram ?? null,
5267
+ isWritable: false
5268
+ },
2766
5269
  systemProgram: { value: input.systemProgram ?? null, isWritable: false }
2767
5270
  };
2768
5271
  const accounts = originalAccounts;
2769
5272
  const args = { ...input };
2770
- if (!accounts.tokenProgram.value) {
2771
- accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2772
- }
2773
5273
  if (!accounts.systemProgram.value) {
2774
5274
  accounts.systemProgram.value = "11111111111111111111111111111111";
2775
5275
  }
@@ -2780,13 +5280,15 @@ function getClaimInstruction(input, config) {
2780
5280
  getAccountMeta("marketAuthority", accounts.marketAuthority),
2781
5281
  getAccountMeta("potVault", accounts.potVault),
2782
5282
  getAccountMeta("winnerMint", accounts.winnerMint),
5283
+ getAccountMeta("quoteMint", accounts.quoteMint),
2783
5284
  getAccountMeta("entryByMint", accounts.entryByMint),
2784
5285
  getAccountMeta("claimerWinnerAta", accounts.claimerWinnerAta),
2785
5286
  getAccountMeta("claimerQuoteAta", accounts.claimerQuoteAta),
2786
5287
  getAccountMeta("claimer", accounts.claimer),
2787
5288
  getAccountMeta("receipt", accounts.receipt),
2788
5289
  getAccountMeta("payer", accounts.payer),
2789
- getAccountMeta("tokenProgram", accounts.tokenProgram),
5290
+ getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
5291
+ getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
2790
5292
  getAccountMeta("systemProgram", accounts.systemProgram)
2791
5293
  ],
2792
5294
  data: getClaimInstructionDataEncoder().encode(
@@ -2796,12 +5298,12 @@ function getClaimInstruction(input, config) {
2796
5298
  });
2797
5299
  }
2798
5300
  function parseClaimInstruction(instruction) {
2799
- if (instruction.accounts.length < 12) {
5301
+ if (instruction.accounts.length < 14) {
2800
5302
  throw new kit.SolanaError(
2801
5303
  kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2802
5304
  {
2803
5305
  actualAccountMetas: instruction.accounts.length,
2804
- expectedAccountMetas: 12
5306
+ expectedAccountMetas: 14
2805
5307
  }
2806
5308
  );
2807
5309
  }
@@ -2818,13 +5320,15 @@ function parseClaimInstruction(instruction) {
2818
5320
  marketAuthority: getNextAccount(),
2819
5321
  potVault: getNextAccount(),
2820
5322
  winnerMint: getNextAccount(),
5323
+ quoteMint: getNextAccount(),
2821
5324
  entryByMint: getNextAccount(),
2822
5325
  claimerWinnerAta: getNextAccount(),
2823
5326
  claimerQuoteAta: getNextAccount(),
2824
5327
  claimer: getNextAccount(),
2825
5328
  receipt: getNextAccount(),
2826
5329
  payer: getNextAccount(),
2827
- tokenProgram: getNextAccount(),
5330
+ baseTokenProgram: getNextAccount(),
5331
+ quoteTokenProgram: getNextAccount(),
2828
5332
  systemProgram: getNextAccount()
2829
5333
  },
2830
5334
  data: getClaimInstructionDataDecoder().decode(instruction.data)
@@ -3730,7 +6234,7 @@ function predictionMigratorProgram() {
3730
6234
  entryByMint: programClientCore.addSelfFetchFunctions(client, getEntryByMintCodec()),
3731
6235
  launch: programClientCore.addSelfFetchFunctions(client, getLaunchCodec2()),
3732
6236
  market: programClientCore.addSelfFetchFunctions(client, getMarketCodec()),
3733
- oracleState: programClientCore.addSelfFetchFunctions(client, getOracleStateCodec())
6237
+ oracleState: programClientCore.addSelfFetchFunctions(client, getOracleStateCodec2())
3734
6238
  },
3735
6239
  instructions: {
3736
6240
  claim: (input) => programClientCore.addSelfPlanAndSendFunctions(
@@ -3808,11 +6312,11 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
3808
6312
  }
3809
6313
 
3810
6314
  // src/solana/initializer/instructions/initializeLaunch.ts
3811
- function isTransactionSigner5(value) {
6315
+ function isTransactionSigner4(value) {
3812
6316
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
3813
6317
  }
3814
6318
  function createAccountMeta(value, role) {
3815
- if (isTransactionSigner5(value)) {
6319
+ if (isTransactionSigner4(value)) {
3816
6320
  return { address: value.address, role, signer: value };
3817
6321
  }
3818
6322
  return { address: value, role };
@@ -3820,21 +6324,21 @@ function createAccountMeta(value, role) {
3820
6324
  async function getTokenMetadataAddress(mint) {
3821
6325
  const encoder = kit.getAddressEncoder();
3822
6326
  const [metadataAddress] = await kit.getProgramDerivedAddress({
3823
- programAddress: chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID,
6327
+ programAddress: chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID,
3824
6328
  seeds: [
3825
6329
  new TextEncoder().encode("metadata"),
3826
- encoder.encode(chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID),
6330
+ encoder.encode(chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID),
3827
6331
  encoder.encode(mint)
3828
6332
  ]
3829
6333
  });
3830
6334
  return metadataAddress;
3831
6335
  }
3832
6336
  var ALT_INDEX = {
3833
- [chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS]: 0,
3834
- [chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS]: 1,
6337
+ [chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS]: 0,
6338
+ [chunk6FRZFA5R_cjs.SYSTEM_PROGRAM_ADDRESS]: 1,
3835
6339
  SysvarRent111111111111111111111111111111111: 2,
3836
6340
  [INITIALIZER_PROGRAM_ID]: 3,
3837
- [chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID]: 4,
6341
+ [chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID]: 4,
3838
6342
  [CPMM_MIGRATOR_PROGRAM_ID]: 5,
3839
6343
  So11111111111111111111111111111111111111112: 6,
3840
6344
  [PREDICTION_MIGRATOR_PROGRAM_ADDRESS]: 8
@@ -3862,13 +6366,12 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
3862
6366
  payer,
3863
6367
  authority,
3864
6368
  migratorProgram,
3865
- baseTokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
3866
- quoteTokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
3867
- systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS,
6369
+ baseTokenProgram = chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
6370
+ quoteTokenProgram = chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
6371
+ systemProgram = chunk6FRZFA5R_cjs.SYSTEM_PROGRAM_ADDRESS,
3868
6372
  rent,
3869
6373
  metadataAccount,
3870
- metadataProgram = chunkO6FR7TXY_cjs.TOKEN_METADATA_PROGRAM_ID,
3871
- instructionsSysvar = chunkO6FR7TXY_cjs.SYSVAR_INSTRUCTIONS_ADDRESS,
6374
+ metadataProgram = chunk6FRZFA5R_cjs.TOKEN_METADATA_PROGRAM_ID,
3872
6375
  addressLookupTable: alt
3873
6376
  } = accounts;
3874
6377
  const withMetadata = Boolean(
@@ -3918,12 +6421,11 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
3918
6421
  keys.push({ address: programId, role: kit.AccountRole.READONLY });
3919
6422
  keys.push({ address: programId, role: kit.AccountRole.READONLY });
3920
6423
  }
3921
- keys.push({ address: instructionsSysvar, role: kit.AccountRole.READONLY });
3922
6424
  const encoderArgs = {
3923
6425
  ...args,
3924
6426
  allowBuy: args.allowBuy ? 1 : 0,
3925
6427
  allowSell: args.allowSell ? 1 : 0,
3926
- migratorProgram: migratorProgram ?? chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS
6428
+ migratorProgram: migratorProgram ?? chunk6FRZFA5R_cjs.SYSTEM_PROGRAM_ADDRESS
3927
6429
  };
3928
6430
  const data = new Uint8Array(
3929
6431
  getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
@@ -3941,7 +6443,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
3941
6443
  if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
3942
6444
  const oracleState = args.namespace;
3943
6445
  const entryId = args.launchId;
3944
- const baseMintAddress = isTransactionSigner5(baseMint) ? baseMint.address : baseMint;
6446
+ const baseMintAddress = isTransactionSigner4(baseMint) ? baseMint.address : baseMint;
3945
6447
  const [market] = await getPredictionMarketAddress(oracleState, quoteMint);
3946
6448
  const [potVault] = await getPredictionPotVaultAddress(market);
3947
6449
  const [marketAuthority] = await getPredictionMarketAuthorityAddress(market);
@@ -3959,11 +6461,11 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
3959
6461
  }
3960
6462
  return { programAddress: programId, accounts: keys, data };
3961
6463
  }
3962
- function isTransactionSigner6(value) {
6464
+ function isTransactionSigner5(value) {
3963
6465
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
3964
6466
  }
3965
6467
  function createAccountMeta2(value, role) {
3966
- if (isTransactionSigner6(value)) {
6468
+ if (isTransactionSigner5(value)) {
3967
6469
  return { address: value.address, role, signer: value };
3968
6470
  }
3969
6471
  return { address: value, role };
@@ -3980,10 +6482,9 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
3980
6482
  baseMint,
3981
6483
  quoteMint,
3982
6484
  user,
3983
- sentinelProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS,
3984
- baseTokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
3985
- quoteTokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
3986
- instructionsSysvar = chunkO6FR7TXY_cjs.SYSVAR_INSTRUCTIONS_ADDRESS
6485
+ sentinelProgram = chunk6FRZFA5R_cjs.SYSTEM_PROGRAM_ADDRESS,
6486
+ baseTokenProgram = chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
6487
+ quoteTokenProgram = chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS
3987
6488
  } = accounts;
3988
6489
  const keys = [
3989
6490
  { address: config, role: kit.AccountRole.READONLY },
@@ -4001,19 +6502,18 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
4001
6502
  // no-op placeholder when no real sentinel is configured.
4002
6503
  { address: sentinelProgram, role: kit.AccountRole.READONLY },
4003
6504
  { address: baseTokenProgram, role: kit.AccountRole.READONLY },
4004
- { address: quoteTokenProgram, role: kit.AccountRole.READONLY },
4005
- { address: instructionsSysvar, role: kit.AccountRole.READONLY }
6505
+ { address: quoteTokenProgram, role: kit.AccountRole.READONLY }
4006
6506
  ];
4007
6507
  const data = new Uint8Array(
4008
6508
  getCurveSwapExactInInstructionDataEncoder().encode(args)
4009
6509
  );
4010
6510
  return { programAddress: programId, accounts: keys, data };
4011
6511
  }
4012
- function isTransactionSigner7(value) {
6512
+ function isTransactionSigner6(value) {
4013
6513
  return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
4014
6514
  }
4015
- function createSignerAccountMeta5(value, role) {
4016
- if (isTransactionSigner7(value)) {
6515
+ function createSignerAccountMeta4(value, role) {
6516
+ if (isTransactionSigner6(value)) {
4017
6517
  return { address: value.address, role, signer: value };
4018
6518
  }
4019
6519
  return { address: value, role };
@@ -4029,11 +6529,10 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
4029
6529
  quoteVault,
4030
6530
  migratorProgram,
4031
6531
  payer,
4032
- baseTokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
4033
- quoteTokenProgram = chunkO6FR7TXY_cjs.TOKEN_PROGRAM_ADDRESS,
4034
- systemProgram = chunkO6FR7TXY_cjs.SYSTEM_PROGRAM_ADDRESS,
4035
- rent,
4036
- instructionsSysvar = chunkO6FR7TXY_cjs.SYSVAR_INSTRUCTIONS_ADDRESS
6532
+ baseTokenProgram = chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
6533
+ quoteTokenProgram = chunk6FRZFA5R_cjs.TOKEN_PROGRAM_ADDRESS,
6534
+ systemProgram = chunk6FRZFA5R_cjs.SYSTEM_PROGRAM_ADDRESS,
6535
+ rent
4037
6536
  } = accounts;
4038
6537
  const keys = [
4039
6538
  { address: config, role: kit.AccountRole.READONLY },
@@ -4044,14 +6543,13 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
4044
6543
  { address: baseVault, role: kit.AccountRole.WRITABLE },
4045
6544
  { address: quoteVault, role: kit.AccountRole.WRITABLE },
4046
6545
  { address: migratorProgram, role: kit.AccountRole.READONLY },
4047
- createSignerAccountMeta5(payer, kit.AccountRole.WRITABLE_SIGNER),
6546
+ createSignerAccountMeta4(payer, kit.AccountRole.WRITABLE_SIGNER),
4048
6547
  { address: baseTokenProgram, role: kit.AccountRole.READONLY },
4049
6548
  { address: quoteTokenProgram, role: kit.AccountRole.READONLY },
4050
6549
  { address: systemProgram, role: kit.AccountRole.READONLY },
4051
- { address: rent, role: kit.AccountRole.READONLY },
4052
- { address: instructionsSysvar, role: kit.AccountRole.READONLY }
6550
+ { address: rent, role: kit.AccountRole.READONLY }
4053
6551
  ];
4054
- const data = chunkI5JME35L_cjs.encodeInstructionData(
6552
+ const data = chunk5USQGM5X_cjs.encodeInstructionData(
4055
6553
  INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
4056
6554
  );
4057
6555
  return { programAddress: programId, accounts: keys, data };
@@ -4069,7 +6567,7 @@ function createPreviewSwapExactInInstruction(accounts, args, programId = INITIAL
4069
6567
  ];
4070
6568
  const accountsList = sentinelProgram ? [...keys, { address: sentinelProgram, role: kit.AccountRole.READONLY }] : keys;
4071
6569
  const data = new Uint8Array(
4072
- getPreviewSwapExactInInstructionDataEncoder().encode(args)
6570
+ getPreviewSwapExactInInstructionDataEncoder2().encode(args)
4073
6571
  );
4074
6572
  return { programAddress: programId, accounts: accountsList, data };
4075
6573
  }
@@ -4089,7 +6587,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
4089
6587
  { address: baseVault, role: kit.AccountRole.READONLY },
4090
6588
  { address: quoteVault, role: kit.AccountRole.READONLY }
4091
6589
  ];
4092
- const data = chunkI5JME35L_cjs.encodeInstructionData(
6590
+ const data = chunk5USQGM5X_cjs.encodeInstructionData(
4093
6591
  INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
4094
6592
  );
4095
6593
  return { programAddress: programId, accounts: keys, data };
@@ -4405,7 +6903,7 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
4405
6903
  LAUNCH_DISCRIMINATOR: () => LAUNCH_DISCRIMINATOR2,
4406
6904
  MARKET_DISCRIMINATOR: () => MARKET_DISCRIMINATOR,
4407
6905
  MIGRATE_ENTRY_DISCRIMINATOR: () => MIGRATE_ENTRY_DISCRIMINATOR,
4408
- ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR,
6906
+ ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR2,
4409
6907
  PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED,
4410
6908
  PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED,
4411
6909
  PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED,
@@ -4519,7 +7017,7 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
4519
7017
  getMigrateEntryInstructionDataCodec: () => getMigrateEntryInstructionDataCodec,
4520
7018
  getMigrateEntryInstructionDataDecoder: () => getMigrateEntryInstructionDataDecoder,
4521
7019
  getMigrateEntryInstructionDataEncoder: () => getMigrateEntryInstructionDataEncoder,
4522
- getOracleStateCodec: () => getOracleStateCodec,
7020
+ getOracleStateCodec: () => getOracleStateCodec2,
4523
7021
  getOracleStateDecoder: () => getOracleStateDecoder,
4524
7022
  getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes,
4525
7023
  getOracleStateEncoder: () => getOracleStateEncoder,
@@ -4624,8 +7122,8 @@ function isPredictionMigratorError(error, transactionMessage, code) {
4624
7122
  var trustedOracle_exports = {};
4625
7123
  chunkQ7SFCCGT_cjs.__export(trustedOracle_exports, {
4626
7124
  FINALIZE_DISCRIMINATOR: () => FINALIZE_DISCRIMINATOR,
4627
- INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
4628
- ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR2,
7125
+ INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR2,
7126
+ ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR3,
4629
7127
  TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED: () => TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED,
4630
7128
  TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT: () => TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT,
4631
7129
  TRUSTED_ORACLE_ERROR__NOT_FINALIZED: () => TRUSTED_ORACLE_ERROR__NOT_FINALIZED,
@@ -4646,13 +7144,13 @@ chunkQ7SFCCGT_cjs.__export(trustedOracle_exports, {
4646
7144
  getInitializeOracleArgsCodec: () => getInitializeOracleArgsCodec,
4647
7145
  getInitializeOracleArgsDecoder: () => getInitializeOracleArgsDecoder,
4648
7146
  getInitializeOracleArgsEncoder: () => getInitializeOracleArgsEncoder,
4649
- getInitializeOracleDiscriminatorBytes: () => getInitializeOracleDiscriminatorBytes,
4650
- getInitializeOracleInstruction: () => getInitializeOracleInstruction,
4651
- getInitializeOracleInstructionDataCodec: () => getInitializeOracleInstructionDataCodec,
4652
- getInitializeOracleInstructionDataDecoder: () => getInitializeOracleInstructionDataDecoder,
4653
- getInitializeOracleInstructionDataEncoder: () => getInitializeOracleInstructionDataEncoder,
7147
+ getInitializeOracleDiscriminatorBytes: () => getInitializeOracleDiscriminatorBytes2,
7148
+ getInitializeOracleInstruction: () => getInitializeOracleInstruction2,
7149
+ getInitializeOracleInstructionDataCodec: () => getInitializeOracleInstructionDataCodec2,
7150
+ getInitializeOracleInstructionDataDecoder: () => getInitializeOracleInstructionDataDecoder2,
7151
+ getInitializeOracleInstructionDataEncoder: () => getInitializeOracleInstructionDataEncoder2,
4654
7152
  getOracleStateAddress: () => getOracleStateAddress,
4655
- getOracleStateCodec: () => getOracleStateCodec2,
7153
+ getOracleStateCodec: () => getOracleStateCodec3,
4656
7154
  getOracleStateDecoder: () => getOracleStateDecoder2,
4657
7155
  getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes2,
4658
7156
  getOracleStateEncoder: () => getOracleStateEncoder2,
@@ -4662,11 +7160,11 @@ chunkQ7SFCCGT_cjs.__export(trustedOracle_exports, {
4662
7160
  identifyTrustedOracleInstruction: () => identifyTrustedOracleInstruction,
4663
7161
  isTrustedOracleError: () => isTrustedOracleError,
4664
7162
  parseFinalizeInstruction: () => parseFinalizeInstruction,
4665
- parseInitializeOracleInstruction: () => parseInitializeOracleInstruction,
7163
+ parseInitializeOracleInstruction: () => parseInitializeOracleInstruction2,
4666
7164
  parseTrustedOracleInstruction: () => parseTrustedOracleInstruction,
4667
7165
  trustedOracleProgram: () => trustedOracleProgram
4668
7166
  });
4669
- var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
7167
+ var ORACLE_STATE_DISCRIMINATOR3 = new Uint8Array([
4670
7168
  97,
4671
7169
  156,
4672
7170
  157,
@@ -4678,7 +7176,7 @@ var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
4678
7176
  ]);
4679
7177
  function getOracleStateDiscriminatorBytes2() {
4680
7178
  return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
4681
- ORACLE_STATE_DISCRIMINATOR2
7179
+ ORACLE_STATE_DISCRIMINATOR3
4682
7180
  );
4683
7181
  }
4684
7182
  function getOracleStateEncoder2() {
@@ -4693,7 +7191,7 @@ function getOracleStateEncoder2() {
4693
7191
  ["bump", kit.getU8Encoder()],
4694
7192
  ["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 31)]
4695
7193
  ]),
4696
- (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR2 })
7194
+ (value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR3 })
4697
7195
  );
4698
7196
  }
4699
7197
  function getOracleStateDecoder2() {
@@ -4708,7 +7206,7 @@ function getOracleStateDecoder2() {
4708
7206
  ["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 31)]
4709
7207
  ]);
4710
7208
  }
4711
- function getOracleStateCodec2() {
7209
+ function getOracleStateCodec3() {
4712
7210
  return kit.combineCodec(getOracleStateEncoder2(), getOracleStateDecoder2());
4713
7211
  }
4714
7212
  function decodeOracleState3(encodedAccount) {
@@ -4820,7 +7318,7 @@ function parseFinalizeInstruction(instruction) {
4820
7318
  data: getFinalizeInstructionDataDecoder().decode(instruction.data)
4821
7319
  };
4822
7320
  }
4823
- var INITIALIZE_ORACLE_DISCRIMINATOR = new Uint8Array([
7321
+ var INITIALIZE_ORACLE_DISCRIMINATOR2 = new Uint8Array([
4824
7322
  144,
4825
7323
  223,
4826
7324
  131,
@@ -4830,35 +7328,35 @@ var INITIALIZE_ORACLE_DISCRIMINATOR = new Uint8Array([
4830
7328
  181,
4831
7329
  99
4832
7330
  ]);
4833
- function getInitializeOracleDiscriminatorBytes() {
7331
+ function getInitializeOracleDiscriminatorBytes2() {
4834
7332
  return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
4835
- INITIALIZE_ORACLE_DISCRIMINATOR
7333
+ INITIALIZE_ORACLE_DISCRIMINATOR2
4836
7334
  );
4837
7335
  }
4838
- function getInitializeOracleInstructionDataEncoder() {
7336
+ function getInitializeOracleInstructionDataEncoder2() {
4839
7337
  return kit.transformEncoder(
4840
7338
  kit.getStructEncoder([
4841
7339
  ["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
4842
7340
  ["nonce", kit.getU64Encoder()],
4843
7341
  ["quoteMint", kit.getAddressEncoder()]
4844
7342
  ]),
4845
- (value) => ({ ...value, discriminator: INITIALIZE_ORACLE_DISCRIMINATOR })
7343
+ (value) => ({ ...value, discriminator: INITIALIZE_ORACLE_DISCRIMINATOR2 })
4846
7344
  );
4847
7345
  }
4848
- function getInitializeOracleInstructionDataDecoder() {
7346
+ function getInitializeOracleInstructionDataDecoder2() {
4849
7347
  return kit.getStructDecoder([
4850
7348
  ["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
4851
7349
  ["nonce", kit.getU64Decoder()],
4852
7350
  ["quoteMint", kit.getAddressDecoder()]
4853
7351
  ]);
4854
7352
  }
4855
- function getInitializeOracleInstructionDataCodec() {
7353
+ function getInitializeOracleInstructionDataCodec2() {
4856
7354
  return kit.combineCodec(
4857
- getInitializeOracleInstructionDataEncoder(),
4858
- getInitializeOracleInstructionDataDecoder()
7355
+ getInitializeOracleInstructionDataEncoder2(),
7356
+ getInitializeOracleInstructionDataDecoder2()
4859
7357
  );
4860
7358
  }
4861
- function getInitializeOracleInstruction(input, config) {
7359
+ function getInitializeOracleInstruction2(input, config) {
4862
7360
  const programAddress = config?.programAddress ?? TRUSTED_ORACLE_PROGRAM_ADDRESS;
4863
7361
  const originalAccounts = {
4864
7362
  oracleAuthority: { value: input.oracleAuthority ?? null, isWritable: true },
@@ -4877,13 +7375,13 @@ function getInitializeOracleInstruction(input, config) {
4877
7375
  getAccountMeta("oracleState", accounts.oracleState),
4878
7376
  getAccountMeta("systemProgram", accounts.systemProgram)
4879
7377
  ],
4880
- data: getInitializeOracleInstructionDataEncoder().encode(
7378
+ data: getInitializeOracleInstructionDataEncoder2().encode(
4881
7379
  args
4882
7380
  ),
4883
7381
  programAddress
4884
7382
  });
4885
7383
  }
4886
- function parseInitializeOracleInstruction(instruction) {
7384
+ function parseInitializeOracleInstruction2(instruction) {
4887
7385
  if (instruction.accounts.length < 3) {
4888
7386
  throw new kit.SolanaError(
4889
7387
  kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
@@ -4906,7 +7404,7 @@ function parseInitializeOracleInstruction(instruction) {
4906
7404
  oracleState: getNextAccount(),
4907
7405
  systemProgram: getNextAccount()
4908
7406
  },
4909
- data: getInitializeOracleInstructionDataDecoder().decode(instruction.data)
7407
+ data: getInitializeOracleInstructionDataDecoder2().decode(instruction.data)
4910
7408
  };
4911
7409
  }
4912
7410
 
@@ -4976,7 +7474,7 @@ function parseTrustedOracleInstruction(instruction) {
4976
7474
  kit.assertIsInstructionWithAccounts(instruction);
4977
7475
  return {
4978
7476
  instructionType: 1 /* InitializeOracle */,
4979
- ...parseInitializeOracleInstruction(instruction)
7477
+ ...parseInitializeOracleInstruction2(instruction)
4980
7478
  };
4981
7479
  }
4982
7480
  default:
@@ -4995,13 +7493,13 @@ function trustedOracleProgram() {
4995
7493
  ...client,
4996
7494
  trustedOracle: {
4997
7495
  accounts: {
4998
- oracleState: programClientCore.addSelfFetchFunctions(client, getOracleStateCodec2())
7496
+ oracleState: programClientCore.addSelfFetchFunctions(client, getOracleStateCodec3())
4999
7497
  },
5000
7498
  instructions: {
5001
7499
  finalize: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getFinalizeInstruction(input)),
5002
7500
  initializeOracle: (input) => programClientCore.addSelfPlanAndSendFunctions(
5003
7501
  client,
5004
- getInitializeOracleInstruction(input)
7502
+ getInitializeOracleInstruction2(input)
5005
7503
  )
5006
7504
  }
5007
7505
  }