@whetstone-research/doppler-sdk 1.0.12 → 1.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -13
- package/dist/{chunk-AT33RY6T.cjs → chunk-3BW6IVP3.cjs} +46 -37
- package/dist/chunk-3BW6IVP3.cjs.map +1 -0
- package/dist/{chunk-ZQEEGBXT.js → chunk-NMTYI3TB.js} +23 -26
- package/dist/chunk-NMTYI3TB.js.map +1 -0
- package/dist/{chunk-2NFQKIOB.js → chunk-TVBSIQIX.js} +35 -26
- package/dist/chunk-TVBSIQIX.js.map +1 -0
- package/dist/{chunk-LL7TW3GU.cjs → chunk-W5TMS4RD.cjs} +56 -59
- package/dist/chunk-W5TMS4RD.cjs.map +1 -0
- package/dist/evm/index.cjs +226 -115
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +6 -0
- package/dist/evm/index.d.ts +6 -0
- package/dist/evm/index.js +227 -116
- package/dist/evm/index.js.map +1 -1
- package/dist/{oracle-CU-nZnja.d.cts → oracle-DN8BrGPh.d.cts} +28 -28
- package/dist/{oracle-CU-nZnja.d.ts → oracle-DN8BrGPh.d.ts} +28 -28
- package/dist/{pda-FLNTBIC5.js → pda-5D3GD5S6.js} +3 -3
- package/dist/pda-5D3GD5S6.js.map +1 -0
- package/dist/{pda-G25AJSXG.cjs → pda-GNZYNRUH.cjs} +17 -17
- package/dist/{pda-G25AJSXG.cjs.map → pda-GNZYNRUH.cjs.map} +1 -1
- package/dist/solana/index.cjs +875 -740
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +545 -471
- package/dist/solana/index.d.ts +545 -471
- package/dist/solana/index.js +738 -603
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +57 -57
- package/dist/solana/react/index.cjs.map +1 -1
- package/dist/solana/react/index.d.cts +5 -5
- package/dist/solana/react/index.d.ts +5 -5
- package/dist/solana/react/index.js +15 -15
- package/dist/solana/react/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/chunk-2NFQKIOB.js.map +0 -1
- package/dist/chunk-AT33RY6T.cjs.map +0 -1
- package/dist/chunk-LL7TW3GU.cjs.map +0 -1
- package/dist/chunk-ZQEEGBXT.js.map +0 -1
- package/dist/pda-FLNTBIC5.js.map +0 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -1,78 +1,79 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkW5TMS4RD_cjs = require('../chunk-W5TMS4RD.cjs');
|
|
4
|
+
var chunk3BW6IVP3_cjs = require('../chunk-3BW6IVP3.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');
|
|
8
8
|
var sha3_js = require('@noble/hashes/sha3.js');
|
|
9
|
+
var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
9
10
|
|
|
10
11
|
// src/solana/cpmm/index.ts
|
|
11
12
|
var cpmm_exports = {};
|
|
12
13
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
13
|
-
ACCOUNT_DISCRIMINATORS: () =>
|
|
14
|
-
ACCOUNT_VERSION: () =>
|
|
14
|
+
ACCOUNT_DISCRIMINATORS: () => chunk3BW6IVP3_cjs.ACCOUNT_DISCRIMINATORS,
|
|
15
|
+
ACCOUNT_VERSION: () => chunk3BW6IVP3_cjs.ACCOUNT_VERSION,
|
|
15
16
|
ADD_LIQUIDITY_DISCRIMINATOR: () => ADD_LIQUIDITY_DISCRIMINATOR,
|
|
16
|
-
BPS_DENOM: () =>
|
|
17
|
+
BPS_DENOM: () => chunk3BW6IVP3_cjs.BPS_DENOM,
|
|
17
18
|
CLOSE_POSITION_DISCRIMINATOR: () => CLOSE_POSITION_DISCRIMINATOR,
|
|
18
19
|
COLLECT_FEES_DISCRIMINATOR: () => COLLECT_FEES_DISCRIMINATOR,
|
|
19
20
|
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
20
21
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
21
|
-
CPMM_PROGRAM_ID: () =>
|
|
22
|
+
CPMM_PROGRAM_ID: () => chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID,
|
|
22
23
|
CREATE_POSITION_DISCRIMINATOR: () => CREATE_POSITION_DISCRIMINATOR,
|
|
23
24
|
CpmmError: () => CpmmError,
|
|
24
25
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
26
|
+
HF_AFTER_ADD_LIQ: () => chunk3BW6IVP3_cjs.HF_AFTER_ADD_LIQ,
|
|
27
|
+
HF_AFTER_REMOVE_LIQ: () => chunk3BW6IVP3_cjs.HF_AFTER_REMOVE_LIQ,
|
|
28
|
+
HF_AFTER_SWAP: () => chunk3BW6IVP3_cjs.HF_AFTER_SWAP,
|
|
29
|
+
HF_BEFORE_ADD_LIQ: () => chunk3BW6IVP3_cjs.HF_BEFORE_ADD_LIQ,
|
|
30
|
+
HF_BEFORE_REMOVE_LIQ: () => chunk3BW6IVP3_cjs.HF_BEFORE_REMOVE_LIQ,
|
|
31
|
+
HF_BEFORE_SWAP: () => chunk3BW6IVP3_cjs.HF_BEFORE_SWAP,
|
|
32
|
+
HF_FORWARD_READONLY_SIGNERS: () => chunk3BW6IVP3_cjs.HF_FORWARD_READONLY_SIGNERS,
|
|
33
|
+
HF_REQUIRE_ORACLE: () => chunk3BW6IVP3_cjs.HF_REQUIRE_ORACLE,
|
|
34
|
+
HOOK_NO_CHANGE: () => chunk3BW6IVP3_cjs.HOOK_NO_CHANGE,
|
|
25
35
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
26
36
|
INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
27
37
|
INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
|
|
28
|
-
INSTRUCTION_DISCRIMINATORS: () =>
|
|
38
|
+
INSTRUCTION_DISCRIMINATORS: () => chunk3BW6IVP3_cjs.INSTRUCTION_DISCRIMINATORS,
|
|
29
39
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
MAX_HOOK_ALLOWLIST: () => chunk3BW6IVP3_cjs.MAX_HOOK_ALLOWLIST,
|
|
41
|
+
MAX_ORACLE_OBSERVATIONS: () => chunk3BW6IVP3_cjs.MAX_ORACLE_OBSERVATIONS,
|
|
32
42
|
ORACLE_CONSULT_DISCRIMINATOR: () => ORACLE_CONSULT_DISCRIMINATOR,
|
|
33
43
|
ORACLE_UPDATE_DISCRIMINATOR: () => ORACLE_UPDATE_DISCRIMINATOR,
|
|
34
44
|
PAUSE_DISCRIMINATOR: () => PAUSE_DISCRIMINATOR,
|
|
35
45
|
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
36
|
-
Q64_ONE: () =>
|
|
46
|
+
Q64_ONE: () => chunk3BW6IVP3_cjs.Q64_ONE,
|
|
37
47
|
QUOTE_TO_NUMERAIRE_DISCRIMINATOR: () => QUOTE_TO_NUMERAIRE_DISCRIMINATOR,
|
|
38
48
|
REMOVE_LIQUIDITY_DISCRIMINATOR: () => REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
39
|
-
SEED_AUTHORITY: () =>
|
|
40
|
-
SEED_CONFIG: () =>
|
|
41
|
-
SEED_ORACLE: () =>
|
|
42
|
-
SEED_POOL: () =>
|
|
43
|
-
SEED_POSITION: () =>
|
|
44
|
-
|
|
45
|
-
SENTINEL_NO_CHANGE: () => chunkAT33RY6T_cjs.SENTINEL_NO_CHANGE,
|
|
49
|
+
SEED_AUTHORITY: () => chunk3BW6IVP3_cjs.SEED_AUTHORITY,
|
|
50
|
+
SEED_CONFIG: () => chunk3BW6IVP3_cjs.SEED_CONFIG,
|
|
51
|
+
SEED_ORACLE: () => chunk3BW6IVP3_cjs.SEED_ORACLE,
|
|
52
|
+
SEED_POOL: () => chunk3BW6IVP3_cjs.SEED_POOL,
|
|
53
|
+
SEED_POSITION: () => chunk3BW6IVP3_cjs.SEED_POSITION,
|
|
54
|
+
SEED_PROTOCOL_FEE_POSITION: () => chunk3BW6IVP3_cjs.SEED_PROTOCOL_FEE_POSITION,
|
|
46
55
|
SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
|
|
56
|
+
SET_HOOK_DISCRIMINATOR: () => SET_HOOK_DISCRIMINATOR,
|
|
47
57
|
SET_ROUTE_DISCRIMINATOR: () => SET_ROUTE_DISCRIMINATOR,
|
|
48
|
-
SET_SENTINEL_DISCRIMINATOR: () => SET_SENTINEL_DISCRIMINATOR,
|
|
49
|
-
SF_AFTER_ADD_LIQ: () => chunkAT33RY6T_cjs.SF_AFTER_ADD_LIQ,
|
|
50
|
-
SF_AFTER_REMOVE_LIQ: () => chunkAT33RY6T_cjs.SF_AFTER_REMOVE_LIQ,
|
|
51
|
-
SF_AFTER_SWAP: () => chunkAT33RY6T_cjs.SF_AFTER_SWAP,
|
|
52
|
-
SF_BEFORE_ADD_LIQ: () => chunkAT33RY6T_cjs.SF_BEFORE_ADD_LIQ,
|
|
53
|
-
SF_BEFORE_REMOVE_LIQ: () => chunkAT33RY6T_cjs.SF_BEFORE_REMOVE_LIQ,
|
|
54
|
-
SF_BEFORE_SWAP: () => chunkAT33RY6T_cjs.SF_BEFORE_SWAP,
|
|
55
|
-
SF_FORWARD_READONLY_SIGNERS: () => chunkAT33RY6T_cjs.SF_FORWARD_READONLY_SIGNERS,
|
|
56
|
-
SF_REQUIRE_ORACLE: () => chunkAT33RY6T_cjs.SF_REQUIRE_ORACLE,
|
|
57
|
-
SKIM_DISCRIMINATOR: () => SKIM_DISCRIMINATOR,
|
|
58
58
|
SWAP_EXACT_IN_DISCRIMINATOR: () => SWAP_EXACT_IN_DISCRIMINATOR,
|
|
59
|
-
TOKEN_METADATA_PROGRAM_ID: () =>
|
|
59
|
+
TOKEN_METADATA_PROGRAM_ID: () => chunk3BW6IVP3_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
60
60
|
TRANSFER_ADMIN_DISCRIMINATOR: () => TRANSFER_ADMIN_DISCRIMINATOR,
|
|
61
61
|
UNPAUSE_DISCRIMINATOR: () => UNPAUSE_DISCRIMINATOR,
|
|
62
62
|
UPDATE_CONFIG_DISCRIMINATOR: () => UPDATE_CONFIG_DISCRIMINATOR,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () => WITHDRAW_VAULT_EXCESS_DISCRIMINATOR,
|
|
64
|
+
addLiquidityArgsCodec: () => chunkW5TMS4RD_cjs.addLiquidityArgsCodec,
|
|
65
|
+
ammConfigDataCodec: () => chunkW5TMS4RD_cjs.ammConfigDataCodec,
|
|
66
|
+
areMintsOrdered: () => chunk3BW6IVP3_cjs.areMintsOrdered,
|
|
67
|
+
calculateAccruedFees: () => chunkW5TMS4RD_cjs.calculateAccruedFees,
|
|
68
|
+
calculateTwap: () => chunkW5TMS4RD_cjs.calculateTwap,
|
|
69
|
+
calculateTwapNumber: () => chunkW5TMS4RD_cjs.calculateTwapNumber,
|
|
70
|
+
ceilDiv: () => chunkW5TMS4RD_cjs.ceilDiv,
|
|
71
|
+
collectFeesArgsCodec: () => chunkW5TMS4RD_cjs.collectFeesArgsCodec,
|
|
72
|
+
collectProtocolFeesArgsCodec: () => chunkW5TMS4RD_cjs.collectProtocolFeesArgsCodec,
|
|
73
|
+
comparePoolAndOraclePrices: () => chunkW5TMS4RD_cjs.comparePoolAndOraclePrices,
|
|
74
|
+
computePrice0Q64: () => chunkW5TMS4RD_cjs.computePrice0Q64,
|
|
75
|
+
computePrice1Q64: () => chunkW5TMS4RD_cjs.computePrice1Q64,
|
|
76
|
+
consultTwap: () => chunkW5TMS4RD_cjs.consultTwap,
|
|
76
77
|
createAddLiquidityInstruction: () => getAddLiquidityInstruction,
|
|
77
78
|
createClosePositionInstruction: () => getClosePositionInstruction,
|
|
78
79
|
createCollectFeesInstruction: () => getCollectFeesInstruction,
|
|
@@ -84,59 +85,59 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
84
85
|
createOracleConsultInstruction: () => getOracleConsultInstruction,
|
|
85
86
|
createOracleUpdateInstruction: () => getOracleUpdateInstruction,
|
|
86
87
|
createPauseInstruction: () => getPauseInstruction,
|
|
87
|
-
createPositionArgsCodec: () =>
|
|
88
|
+
createPositionArgsCodec: () => chunkW5TMS4RD_cjs.createPositionArgsCodec,
|
|
88
89
|
createQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
|
|
89
90
|
createRemoveLiquidityInstruction: () => getRemoveLiquidityInstruction,
|
|
90
91
|
createSetFeesInstruction: () => getSetFeesInstruction,
|
|
92
|
+
createSetHookInstruction: () => getSetHookInstruction,
|
|
91
93
|
createSetRouteInstruction: () => getSetRouteInstruction,
|
|
92
|
-
createSetSentinelInstruction: () => getSetSentinelInstruction,
|
|
93
|
-
createSkimInstruction: () => getSkimInstruction,
|
|
94
94
|
createSwapExactInInstruction: () => getSwapExactInInstruction,
|
|
95
95
|
createSwapInstruction: () => createSwapInstruction,
|
|
96
96
|
createTransferAdminInstruction: () => getTransferAdminInstruction,
|
|
97
97
|
createUnpauseInstruction: () => getUnpauseInstruction,
|
|
98
|
+
createWithdrawVaultExcessInstruction: () => getWithdrawVaultExcessInstruction,
|
|
98
99
|
curveParamsToMarketCap: () => curveParamsToMarketCap,
|
|
99
|
-
decodeAmmConfig: () =>
|
|
100
|
-
decodeOracleState: () =>
|
|
101
|
-
decodePool: () =>
|
|
102
|
-
decodePosition: () =>
|
|
103
|
-
encodeAddLiquidityArgs: () =>
|
|
104
|
-
encodeCollectFeesArgs: () =>
|
|
105
|
-
encodeCollectProtocolFeesArgs: () =>
|
|
106
|
-
encodeCreatePositionArgs: () =>
|
|
107
|
-
encodeInitializeConfigArgs: () =>
|
|
108
|
-
encodeInitializeOracleArgs: () =>
|
|
109
|
-
encodeInitializePoolArgs: () =>
|
|
110
|
-
encodeInstructionData: () =>
|
|
111
|
-
encodeOracleConsultArgs: () =>
|
|
112
|
-
encodeQuoteToNumeraireArgs: () =>
|
|
113
|
-
encodeRemoveLiquidityArgs: () =>
|
|
114
|
-
encodeSetFeesArgs: () =>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
encodeSwapExactInArgs: () =>
|
|
118
|
-
encodeTransferAdminArgs: () =>
|
|
119
|
-
fetchAllPools: () =>
|
|
100
|
+
decodeAmmConfig: () => chunkW5TMS4RD_cjs.decodeAmmConfig,
|
|
101
|
+
decodeOracleState: () => chunkW5TMS4RD_cjs.decodeOracleState,
|
|
102
|
+
decodePool: () => chunkW5TMS4RD_cjs.decodePool,
|
|
103
|
+
decodePosition: () => chunkW5TMS4RD_cjs.decodePosition,
|
|
104
|
+
encodeAddLiquidityArgs: () => chunkW5TMS4RD_cjs.encodeAddLiquidityArgs,
|
|
105
|
+
encodeCollectFeesArgs: () => chunkW5TMS4RD_cjs.encodeCollectFeesArgs,
|
|
106
|
+
encodeCollectProtocolFeesArgs: () => chunkW5TMS4RD_cjs.encodeCollectProtocolFeesArgs,
|
|
107
|
+
encodeCreatePositionArgs: () => chunkW5TMS4RD_cjs.encodeCreatePositionArgs,
|
|
108
|
+
encodeInitializeConfigArgs: () => chunkW5TMS4RD_cjs.encodeInitializeConfigArgs,
|
|
109
|
+
encodeInitializeOracleArgs: () => chunkW5TMS4RD_cjs.encodeInitializeOracleArgs,
|
|
110
|
+
encodeInitializePoolArgs: () => chunkW5TMS4RD_cjs.encodeInitializePoolArgs,
|
|
111
|
+
encodeInstructionData: () => chunkW5TMS4RD_cjs.encodeInstructionData,
|
|
112
|
+
encodeOracleConsultArgs: () => chunkW5TMS4RD_cjs.encodeOracleConsultArgs,
|
|
113
|
+
encodeQuoteToNumeraireArgs: () => chunkW5TMS4RD_cjs.encodeQuoteToNumeraireArgs,
|
|
114
|
+
encodeRemoveLiquidityArgs: () => chunkW5TMS4RD_cjs.encodeRemoveLiquidityArgs,
|
|
115
|
+
encodeSetFeesArgs: () => chunkW5TMS4RD_cjs.encodeSetFeesArgs,
|
|
116
|
+
encodeSetHookArgs: () => chunkW5TMS4RD_cjs.encodeSetHookArgs,
|
|
117
|
+
encodeSetRouteArgs: () => chunkW5TMS4RD_cjs.encodeSetRouteArgs,
|
|
118
|
+
encodeSwapExactInArgs: () => chunkW5TMS4RD_cjs.encodeSwapExactInArgs,
|
|
119
|
+
encodeTransferAdminArgs: () => chunkW5TMS4RD_cjs.encodeTransferAdminArgs,
|
|
120
|
+
fetchAllPools: () => chunkW5TMS4RD_cjs.fetchAllPools,
|
|
120
121
|
fetchConfig: () => fetchConfig,
|
|
121
122
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
122
|
-
fetchOracle: () =>
|
|
123
|
-
fetchOraclesBatch: () =>
|
|
124
|
-
fetchPool: () =>
|
|
125
|
-
fetchPoolPositions: () =>
|
|
126
|
-
fetchPoolsBatch: () =>
|
|
127
|
-
fetchPosition: () =>
|
|
128
|
-
fetchPositionByParams: () =>
|
|
129
|
-
fetchPositionsBatch: () =>
|
|
130
|
-
fetchUserPositions: () =>
|
|
131
|
-
filterActivePositions: () =>
|
|
132
|
-
filterPoolsByMint: () =>
|
|
123
|
+
fetchOracle: () => chunkW5TMS4RD_cjs.fetchOracle,
|
|
124
|
+
fetchOraclesBatch: () => chunkW5TMS4RD_cjs.fetchOraclesBatch,
|
|
125
|
+
fetchPool: () => chunkW5TMS4RD_cjs.fetchPool,
|
|
126
|
+
fetchPoolPositions: () => chunkW5TMS4RD_cjs.fetchPoolPositions,
|
|
127
|
+
fetchPoolsBatch: () => chunkW5TMS4RD_cjs.fetchPoolsBatch,
|
|
128
|
+
fetchPosition: () => chunkW5TMS4RD_cjs.fetchPosition,
|
|
129
|
+
fetchPositionByParams: () => chunkW5TMS4RD_cjs.fetchPositionByParams,
|
|
130
|
+
fetchPositionsBatch: () => chunkW5TMS4RD_cjs.fetchPositionsBatch,
|
|
131
|
+
fetchUserPositions: () => chunkW5TMS4RD_cjs.fetchUserPositions,
|
|
132
|
+
filterActivePositions: () => chunkW5TMS4RD_cjs.filterActivePositions,
|
|
133
|
+
filterPoolsByMint: () => chunkW5TMS4RD_cjs.filterPoolsByMint,
|
|
133
134
|
getAddLiquidityDiscriminatorBytes: () => getAddLiquidityDiscriminatorBytes,
|
|
134
135
|
getAddLiquidityInstruction: () => getAddLiquidityInstruction,
|
|
135
136
|
getAddLiquidityInstructionAsync: () => getAddLiquidityInstructionAsync,
|
|
136
137
|
getAddLiquidityInstructionDataCodec: () => getAddLiquidityInstructionDataCodec,
|
|
137
138
|
getAddLiquidityInstructionDataDecoder: () => getAddLiquidityInstructionDataDecoder,
|
|
138
139
|
getAddLiquidityInstructionDataEncoder: () => getAddLiquidityInstructionDataEncoder,
|
|
139
|
-
getAddLiquidityQuote: () =>
|
|
140
|
+
getAddLiquidityQuote: () => chunkW5TMS4RD_cjs.getAddLiquidityQuote,
|
|
140
141
|
getClosePositionDiscriminatorBytes: () => getClosePositionDiscriminatorBytes,
|
|
141
142
|
getClosePositionInstruction: () => getClosePositionInstruction,
|
|
142
143
|
getClosePositionInstructionDataCodec: () => getClosePositionInstructionDataCodec,
|
|
@@ -154,7 +155,7 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
154
155
|
getCollectProtocolFeesInstructionDataCodec: () => getCollectProtocolFeesInstructionDataCodec,
|
|
155
156
|
getCollectProtocolFeesInstructionDataDecoder: () => getCollectProtocolFeesInstructionDataDecoder,
|
|
156
157
|
getCollectProtocolFeesInstructionDataEncoder: () => getCollectProtocolFeesInstructionDataEncoder,
|
|
157
|
-
getConfigAddress: () =>
|
|
158
|
+
getConfigAddress: () => chunk3BW6IVP3_cjs.getConfigAddress,
|
|
158
159
|
getCreatePositionDiscriminatorBytes: () => getCreatePositionDiscriminatorBytes,
|
|
159
160
|
getCreatePositionInstruction: () => getCreatePositionInstruction,
|
|
160
161
|
getCreatePositionInstructionAsync: () => getCreatePositionInstructionAsync,
|
|
@@ -180,22 +181,22 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
180
181
|
getInitializePoolInstructionDataCodec: () => getInitializePoolInstructionDataCodec,
|
|
181
182
|
getInitializePoolInstructionDataDecoder: () => getInitializePoolInstructionDataDecoder,
|
|
182
183
|
getInitializePoolInstructionDataEncoder: () => getInitializePoolInstructionDataEncoder,
|
|
183
|
-
getK: () =>
|
|
184
|
-
getLiquidityAddresses: () =>
|
|
184
|
+
getK: () => chunkW5TMS4RD_cjs.getK,
|
|
185
|
+
getLiquidityAddresses: () => chunk3BW6IVP3_cjs.getLiquidityAddresses,
|
|
185
186
|
getMetadataAddress: () => getMetadataAddress,
|
|
186
|
-
getOracleAddress: () =>
|
|
187
|
-
getOracleAddressFromPool: () =>
|
|
188
|
-
getOracleAge: () =>
|
|
189
|
-
getOracleBufferStats: () =>
|
|
187
|
+
getOracleAddress: () => chunk3BW6IVP3_cjs.getOracleAddress,
|
|
188
|
+
getOracleAddressFromPool: () => chunkW5TMS4RD_cjs.getOracleAddressFromPool,
|
|
189
|
+
getOracleAge: () => chunkW5TMS4RD_cjs.getOracleAge,
|
|
190
|
+
getOracleBufferStats: () => chunkW5TMS4RD_cjs.getOracleBufferStats,
|
|
190
191
|
getOracleConsultDiscriminatorBytes: () => getOracleConsultDiscriminatorBytes,
|
|
191
192
|
getOracleConsultInstruction: () => getOracleConsultInstruction,
|
|
192
193
|
getOracleConsultInstructionAsync: () => getOracleConsultInstructionAsync,
|
|
193
194
|
getOracleConsultInstructionDataCodec: () => getOracleConsultInstructionDataCodec,
|
|
194
195
|
getOracleConsultInstructionDataDecoder: () => getOracleConsultInstructionDataDecoder,
|
|
195
196
|
getOracleConsultInstructionDataEncoder: () => getOracleConsultInstructionDataEncoder,
|
|
196
|
-
getOracleDeviation: () =>
|
|
197
|
-
getOracleForPool: () =>
|
|
198
|
-
getOracleSpotPrices: () =>
|
|
197
|
+
getOracleDeviation: () => chunkW5TMS4RD_cjs.getOracleDeviation,
|
|
198
|
+
getOracleForPool: () => chunkW5TMS4RD_cjs.getOracleForPool,
|
|
199
|
+
getOracleSpotPrices: () => chunkW5TMS4RD_cjs.getOracleSpotPrices,
|
|
199
200
|
getOracleUpdateDiscriminatorBytes: () => getOracleUpdateDiscriminatorBytes,
|
|
200
201
|
getOracleUpdateInstruction: () => getOracleUpdateInstruction,
|
|
201
202
|
getOracleUpdateInstructionAsync: () => getOracleUpdateInstructionAsync,
|
|
@@ -207,23 +208,23 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
207
208
|
getPauseInstructionDataCodec: () => getPauseInstructionDataCodec,
|
|
208
209
|
getPauseInstructionDataDecoder: () => getPauseInstructionDataDecoder,
|
|
209
210
|
getPauseInstructionDataEncoder: () => getPauseInstructionDataEncoder,
|
|
210
|
-
getPendingFees: () =>
|
|
211
|
-
getPoolAddress: () =>
|
|
212
|
-
getPoolAddressFromMints: () =>
|
|
213
|
-
getPoolAuthorityAddress: () =>
|
|
214
|
-
getPoolByMints: () =>
|
|
215
|
-
getPoolInitAddresses: () =>
|
|
216
|
-
getPoolVault0Address: () =>
|
|
217
|
-
getPoolVault1Address: () =>
|
|
218
|
-
getPositionAddress: () =>
|
|
219
|
-
getPositionAddressFromParams: () =>
|
|
220
|
-
getPositionValue: () =>
|
|
211
|
+
getPendingFees: () => chunkW5TMS4RD_cjs.getPendingFees,
|
|
212
|
+
getPoolAddress: () => chunk3BW6IVP3_cjs.getPoolAddress,
|
|
213
|
+
getPoolAddressFromMints: () => chunkW5TMS4RD_cjs.getPoolAddressFromMints,
|
|
214
|
+
getPoolAuthorityAddress: () => chunk3BW6IVP3_cjs.getPoolAuthorityAddress,
|
|
215
|
+
getPoolByMints: () => chunkW5TMS4RD_cjs.getPoolByMints,
|
|
216
|
+
getPoolInitAddresses: () => chunk3BW6IVP3_cjs.getPoolInitAddresses,
|
|
217
|
+
getPoolVault0Address: () => chunk3BW6IVP3_cjs.getPoolVault0Address,
|
|
218
|
+
getPoolVault1Address: () => chunk3BW6IVP3_cjs.getPoolVault1Address,
|
|
219
|
+
getPositionAddress: () => chunk3BW6IVP3_cjs.getPositionAddress,
|
|
220
|
+
getPositionAddressFromParams: () => chunkW5TMS4RD_cjs.getPositionAddressFromParams,
|
|
221
|
+
getPositionValue: () => chunkW5TMS4RD_cjs.getPositionValue,
|
|
221
222
|
getPreviewSwapExactInDiscriminatorBytes: () => getPreviewSwapExactInDiscriminatorBytes,
|
|
222
223
|
getPreviewSwapExactInInstruction: () => getPreviewSwapExactInInstruction,
|
|
223
224
|
getPreviewSwapExactInInstructionDataCodec: () => getPreviewSwapExactInInstructionDataCodec,
|
|
224
225
|
getPreviewSwapExactInInstructionDataDecoder: () => getPreviewSwapExactInInstructionDataDecoder,
|
|
225
226
|
getPreviewSwapExactInInstructionDataEncoder: () => getPreviewSwapExactInInstructionDataEncoder,
|
|
226
|
-
|
|
227
|
+
getProtocolFeePositionAddress: () => chunk3BW6IVP3_cjs.getProtocolFeePositionAddress,
|
|
227
228
|
getQuoteToNumeraireDiscriminatorBytes: () => getQuoteToNumeraireDiscriminatorBytes,
|
|
228
229
|
getQuoteToNumeraireInstruction: () => getQuoteToNumeraireInstruction,
|
|
229
230
|
getQuoteToNumeraireInstructionDataCodec: () => getQuoteToNumeraireInstructionDataCodec,
|
|
@@ -235,45 +236,39 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
235
236
|
getRemoveLiquidityInstructionDataCodec: () => getRemoveLiquidityInstructionDataCodec,
|
|
236
237
|
getRemoveLiquidityInstructionDataDecoder: () => getRemoveLiquidityInstructionDataDecoder,
|
|
237
238
|
getRemoveLiquidityInstructionDataEncoder: () => getRemoveLiquidityInstructionDataEncoder,
|
|
238
|
-
getRemoveLiquidityQuote: () =>
|
|
239
|
+
getRemoveLiquidityQuote: () => chunkW5TMS4RD_cjs.getRemoveLiquidityQuote,
|
|
239
240
|
getSetFeesDiscriminatorBytes: () => getSetFeesDiscriminatorBytes,
|
|
240
241
|
getSetFeesInstruction: () => getSetFeesInstruction,
|
|
241
242
|
getSetFeesInstructionDataCodec: () => getSetFeesInstructionDataCodec,
|
|
242
243
|
getSetFeesInstructionDataDecoder: () => getSetFeesInstructionDataDecoder,
|
|
243
244
|
getSetFeesInstructionDataEncoder: () => getSetFeesInstructionDataEncoder,
|
|
245
|
+
getSetHookDiscriminatorBytes: () => getSetHookDiscriminatorBytes,
|
|
246
|
+
getSetHookInstruction: () => getSetHookInstruction,
|
|
247
|
+
getSetHookInstructionDataCodec: () => getSetHookInstructionDataCodec,
|
|
248
|
+
getSetHookInstructionDataDecoder: () => getSetHookInstructionDataDecoder,
|
|
249
|
+
getSetHookInstructionDataEncoder: () => getSetHookInstructionDataEncoder,
|
|
244
250
|
getSetRouteDiscriminatorBytes: () => getSetRouteDiscriminatorBytes,
|
|
245
251
|
getSetRouteInstruction: () => getSetRouteInstruction,
|
|
246
252
|
getSetRouteInstructionDataCodec: () => getSetRouteInstructionDataCodec,
|
|
247
253
|
getSetRouteInstructionDataDecoder: () => getSetRouteInstructionDataDecoder,
|
|
248
254
|
getSetRouteInstructionDataEncoder: () => getSetRouteInstructionDataEncoder,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
getSetSentinelInstructionDataDecoder: () => getSetSentinelInstructionDataDecoder,
|
|
253
|
-
getSetSentinelInstructionDataEncoder: () => getSetSentinelInstructionDataEncoder,
|
|
254
|
-
getSkimDiscriminatorBytes: () => getSkimDiscriminatorBytes,
|
|
255
|
-
getSkimInstruction: () => getSkimInstruction,
|
|
256
|
-
getSkimInstructionAsync: () => getSkimInstructionAsync,
|
|
257
|
-
getSkimInstructionDataCodec: () => getSkimInstructionDataCodec,
|
|
258
|
-
getSkimInstructionDataDecoder: () => getSkimInstructionDataDecoder,
|
|
259
|
-
getSkimInstructionDataEncoder: () => getSkimInstructionDataEncoder,
|
|
260
|
-
getSpotPrice0: () => chunkLL7TW3GU_cjs.getSpotPrice0,
|
|
261
|
-
getSpotPrice1: () => chunkLL7TW3GU_cjs.getSpotPrice1,
|
|
262
|
-
getSwapAddresses: () => chunkAT33RY6T_cjs.getSwapAddresses,
|
|
255
|
+
getSpotPrice0: () => chunkW5TMS4RD_cjs.getSpotPrice0,
|
|
256
|
+
getSpotPrice1: () => chunkW5TMS4RD_cjs.getSpotPrice1,
|
|
257
|
+
getSwapAddresses: () => chunk3BW6IVP3_cjs.getSwapAddresses,
|
|
263
258
|
getSwapExactInDiscriminatorBytes: () => getSwapExactInDiscriminatorBytes,
|
|
264
259
|
getSwapExactInInstruction: () => getSwapExactInInstruction,
|
|
265
260
|
getSwapExactInInstructionAsync: () => getSwapExactInInstructionAsync,
|
|
266
261
|
getSwapExactInInstructionDataCodec: () => getSwapExactInInstructionDataCodec,
|
|
267
262
|
getSwapExactInInstructionDataDecoder: () => getSwapExactInInstructionDataDecoder,
|
|
268
263
|
getSwapExactInInstructionDataEncoder: () => getSwapExactInInstructionDataEncoder,
|
|
269
|
-
getSwapQuote: () =>
|
|
270
|
-
getSwapQuoteExactOut: () =>
|
|
264
|
+
getSwapQuote: () => chunkW5TMS4RD_cjs.getSwapQuote,
|
|
265
|
+
getSwapQuoteExactOut: () => chunkW5TMS4RD_cjs.getSwapQuoteExactOut,
|
|
271
266
|
getTransferAdminDiscriminatorBytes: () => getTransferAdminDiscriminatorBytes,
|
|
272
267
|
getTransferAdminInstruction: () => getTransferAdminInstruction,
|
|
273
268
|
getTransferAdminInstructionDataCodec: () => getTransferAdminInstructionDataCodec,
|
|
274
269
|
getTransferAdminInstructionDataDecoder: () => getTransferAdminInstructionDataDecoder,
|
|
275
270
|
getTransferAdminInstructionDataEncoder: () => getTransferAdminInstructionDataEncoder,
|
|
276
|
-
getTvl: () =>
|
|
271
|
+
getTvl: () => chunkW5TMS4RD_cjs.getTvl,
|
|
277
272
|
getUnpauseDiscriminatorBytes: () => getUnpauseDiscriminatorBytes,
|
|
278
273
|
getUnpauseInstruction: () => getUnpauseInstruction,
|
|
279
274
|
getUnpauseInstructionDataCodec: () => getUnpauseInstructionDataCodec,
|
|
@@ -284,21 +279,27 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
284
279
|
getUpdateConfigInstructionDataCodec: () => getUpdateConfigInstructionDataCodec,
|
|
285
280
|
getUpdateConfigInstructionDataDecoder: () => getUpdateConfigInstructionDataDecoder,
|
|
286
281
|
getUpdateConfigInstructionDataEncoder: () => getUpdateConfigInstructionDataEncoder,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
282
|
+
getWithdrawVaultExcessDiscriminatorBytes: () => getWithdrawVaultExcessDiscriminatorBytes,
|
|
283
|
+
getWithdrawVaultExcessInstruction: () => getWithdrawVaultExcessInstruction,
|
|
284
|
+
getWithdrawVaultExcessInstructionAsync: () => getWithdrawVaultExcessInstructionAsync,
|
|
285
|
+
getWithdrawVaultExcessInstructionDataCodec: () => getWithdrawVaultExcessInstructionDataCodec,
|
|
286
|
+
getWithdrawVaultExcessInstructionDataDecoder: () => getWithdrawVaultExcessInstructionDataDecoder,
|
|
287
|
+
getWithdrawVaultExcessInstructionDataEncoder: () => getWithdrawVaultExcessInstructionDataEncoder,
|
|
288
|
+
initializeConfigArgsCodec: () => chunkW5TMS4RD_cjs.initializeConfigArgsCodec,
|
|
289
|
+
initializeOracleArgsCodec: () => chunkW5TMS4RD_cjs.initializeOracleArgsCodec,
|
|
290
|
+
initializePoolArgsCodec: () => chunkW5TMS4RD_cjs.initializePoolArgsCodec,
|
|
290
291
|
isCpmmError: () => isCpmmError,
|
|
291
|
-
isOracleStale: () =>
|
|
292
|
-
isqrt: () =>
|
|
292
|
+
isOracleStale: () => chunkW5TMS4RD_cjs.isOracleStale,
|
|
293
|
+
isqrt: () => chunkW5TMS4RD_cjs.isqrt,
|
|
293
294
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
294
295
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
295
296
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
296
|
-
maxBigInt: () =>
|
|
297
|
-
minBigInt: () =>
|
|
298
|
-
numberToQ64: () =>
|
|
299
|
-
observationCodec: () =>
|
|
300
|
-
oracleConsultArgsCodec: () =>
|
|
301
|
-
oracleStateDataCodec: () =>
|
|
297
|
+
maxBigInt: () => chunkW5TMS4RD_cjs.maxBigInt,
|
|
298
|
+
minBigInt: () => chunkW5TMS4RD_cjs.minBigInt,
|
|
299
|
+
numberToQ64: () => chunkW5TMS4RD_cjs.numberToQ64,
|
|
300
|
+
observationCodec: () => chunkW5TMS4RD_cjs.observationCodec,
|
|
301
|
+
oracleConsultArgsCodec: () => chunkW5TMS4RD_cjs.oracleConsultArgsCodec,
|
|
302
|
+
oracleStateDataCodec: () => chunkW5TMS4RD_cjs.oracleStateDataCodec,
|
|
302
303
|
parseAddLiquidityInstruction: () => parseAddLiquidityInstruction,
|
|
303
304
|
parseClosePositionInstruction: () => parseClosePositionInstruction,
|
|
304
305
|
parseCollectFeesInstruction: () => parseCollectFeesInstruction,
|
|
@@ -315,40 +316,40 @@ chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
|
315
316
|
parseQuoteToNumeraireInstruction: () => parseQuoteToNumeraireInstruction,
|
|
316
317
|
parseRemoveLiquidityInstruction: () => parseRemoveLiquidityInstruction,
|
|
317
318
|
parseSetFeesInstruction: () => parseSetFeesInstruction,
|
|
319
|
+
parseSetHookInstruction: () => parseSetHookInstruction,
|
|
318
320
|
parseSetRouteInstruction: () => parseSetRouteInstruction,
|
|
319
|
-
parseSetSentinelInstruction: () => parseSetSentinelInstruction,
|
|
320
|
-
parseSkimInstruction: () => parseSkimInstruction,
|
|
321
321
|
parseSwapExactInInstruction: () => parseSwapExactInInstruction,
|
|
322
322
|
parseTransferAdminInstruction: () => parseTransferAdminInstruction,
|
|
323
323
|
parseUnpauseInstruction: () => parseUnpauseInstruction,
|
|
324
324
|
parseUpdateConfigInstruction: () => parseUpdateConfigInstruction,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
325
|
+
parseWithdrawVaultExcessInstruction: () => parseWithdrawVaultExcessInstruction,
|
|
326
|
+
poolDataCodec: () => chunkW5TMS4RD_cjs.poolDataCodec,
|
|
327
|
+
poolExists: () => chunkW5TMS4RD_cjs.poolExists,
|
|
328
|
+
positionDataCodec: () => chunkW5TMS4RD_cjs.positionDataCodec,
|
|
329
|
+
q64Div: () => chunkW5TMS4RD_cjs.q64Div,
|
|
330
|
+
q64Mul: () => chunkW5TMS4RD_cjs.q64Mul,
|
|
331
|
+
q64ToNumber: () => chunkW5TMS4RD_cjs.q64ToNumber,
|
|
332
|
+
quoteToNumeraireArgsCodec: () => chunkW5TMS4RD_cjs.quoteToNumeraireArgsCodec,
|
|
333
|
+
ratioToNumber: () => chunkW5TMS4RD_cjs.ratioToNumber,
|
|
334
|
+
removeLiquidityArgsCodec: () => chunkW5TMS4RD_cjs.removeLiquidityArgsCodec,
|
|
335
|
+
setFeesArgsCodec: () => chunkW5TMS4RD_cjs.setFeesArgsCodec,
|
|
336
|
+
setHookArgsCodec: () => chunkW5TMS4RD_cjs.setHookArgsCodec,
|
|
337
|
+
setRouteArgsCodec: () => chunkW5TMS4RD_cjs.setRouteArgsCodec,
|
|
338
|
+
sortMints: () => chunk3BW6IVP3_cjs.sortMints,
|
|
339
|
+
sortPoolsByReserves: () => chunkW5TMS4RD_cjs.sortPoolsByReserves,
|
|
340
|
+
sortPositionsByShares: () => chunkW5TMS4RD_cjs.sortPositionsByShares,
|
|
341
|
+
swapExactInArgsCodec: () => chunkW5TMS4RD_cjs.swapExactInArgsCodec,
|
|
342
|
+
transferAdminArgsCodec: () => chunkW5TMS4RD_cjs.transferAdminArgsCodec,
|
|
342
343
|
validateMarketCapParameters: () => validateMarketCapParameters
|
|
343
344
|
});
|
|
344
345
|
var addressCodec = kit.getAddressCodec();
|
|
345
346
|
var textEncoder = new TextEncoder();
|
|
346
347
|
async function getMetadataAddress(mint) {
|
|
347
348
|
return kit.getProgramDerivedAddress({
|
|
348
|
-
programAddress:
|
|
349
|
+
programAddress: chunk3BW6IVP3_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
349
350
|
seeds: [
|
|
350
351
|
textEncoder.encode("metadata"),
|
|
351
|
-
addressCodec.encode(
|
|
352
|
+
addressCodec.encode(chunk3BW6IVP3_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
352
353
|
addressCodec.encode(mint)
|
|
353
354
|
]
|
|
354
355
|
});
|
|
@@ -521,7 +522,7 @@ var CpmmErrorCode = /* @__PURE__ */ ((CpmmErrorCode2) => {
|
|
|
521
522
|
CpmmErrorCode2[CpmmErrorCode2["PoolLocked"] = 6001] = "PoolLocked";
|
|
522
523
|
CpmmErrorCode2[CpmmErrorCode2["InvalidFee"] = 6002] = "InvalidFee";
|
|
523
524
|
CpmmErrorCode2[CpmmErrorCode2["InvalidFeeSplit"] = 6003] = "InvalidFeeSplit";
|
|
524
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
525
|
+
CpmmErrorCode2[CpmmErrorCode2["InvalidTradeDirection"] = 6004] = "InvalidTradeDirection";
|
|
525
526
|
CpmmErrorCode2[CpmmErrorCode2["InsufficientLiquidity"] = 6005] = "InsufficientLiquidity";
|
|
526
527
|
CpmmErrorCode2[CpmmErrorCode2["SlippageExceeded"] = 6006] = "SlippageExceeded";
|
|
527
528
|
CpmmErrorCode2[CpmmErrorCode2["MathOverflow"] = 6007] = "MathOverflow";
|
|
@@ -534,13 +535,13 @@ var CpmmErrorCode = /* @__PURE__ */ ((CpmmErrorCode2) => {
|
|
|
534
535
|
CpmmErrorCode2[CpmmErrorCode2["NotSupportedInV0_1"] = 6014] = "NotSupportedInV0_1";
|
|
535
536
|
CpmmErrorCode2[CpmmErrorCode2["OracleNotInitialized"] = 6015] = "OracleNotInitialized";
|
|
536
537
|
CpmmErrorCode2[CpmmErrorCode2["ZeroSharesOut"] = 6016] = "ZeroSharesOut";
|
|
537
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
538
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
539
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
540
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
541
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
542
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
543
|
-
CpmmErrorCode2[CpmmErrorCode2["
|
|
538
|
+
CpmmErrorCode2[CpmmErrorCode2["HookRejected"] = 6017] = "HookRejected";
|
|
539
|
+
CpmmErrorCode2[CpmmErrorCode2["HookCpiFailed"] = 6018] = "HookCpiFailed";
|
|
540
|
+
CpmmErrorCode2[CpmmErrorCode2["HookProgramNotProvided"] = 6019] = "HookProgramNotProvided";
|
|
541
|
+
CpmmErrorCode2[CpmmErrorCode2["HookProgramNotExecutable"] = 6020] = "HookProgramNotExecutable";
|
|
542
|
+
CpmmErrorCode2[CpmmErrorCode2["HookReturnDataMissing"] = 6021] = "HookReturnDataMissing";
|
|
543
|
+
CpmmErrorCode2[CpmmErrorCode2["HookReturnDataInvalid"] = 6022] = "HookReturnDataInvalid";
|
|
544
|
+
CpmmErrorCode2[CpmmErrorCode2["HookNotAllowlisted"] = 6023] = "HookNotAllowlisted";
|
|
544
545
|
CpmmErrorCode2[CpmmErrorCode2["TotalSharesZero"] = 6024] = "TotalSharesZero";
|
|
545
546
|
CpmmErrorCode2[CpmmErrorCode2["AmountZero"] = 6025] = "AmountZero";
|
|
546
547
|
CpmmErrorCode2[CpmmErrorCode2["Paused"] = 6026] = "Paused";
|
|
@@ -548,6 +549,8 @@ var CpmmErrorCode = /* @__PURE__ */ ((CpmmErrorCode2) => {
|
|
|
548
549
|
CpmmErrorCode2[CpmmErrorCode2["InvalidMint"] = 6028] = "InvalidMint";
|
|
549
550
|
CpmmErrorCode2[CpmmErrorCode2["InvalidInput"] = 6029] = "InvalidInput";
|
|
550
551
|
CpmmErrorCode2[CpmmErrorCode2["Reentrancy"] = 6030] = "Reentrancy";
|
|
552
|
+
CpmmErrorCode2[CpmmErrorCode2["CpiForbidden"] = 6031] = "CpiForbidden";
|
|
553
|
+
CpmmErrorCode2[CpmmErrorCode2["UseCollectProtocolFees"] = 6032] = "UseCollectProtocolFees";
|
|
551
554
|
return CpmmErrorCode2;
|
|
552
555
|
})(CpmmErrorCode || {});
|
|
553
556
|
var CPMM_ERROR_MESSAGES = {
|
|
@@ -555,7 +558,7 @@ var CPMM_ERROR_MESSAGES = {
|
|
|
555
558
|
[6001 /* PoolLocked */]: "Pool is currently locked (reentrancy protection)",
|
|
556
559
|
[6002 /* InvalidFee */]: "Invalid fee value (exceeds max or invalid range)",
|
|
557
560
|
[6003 /* InvalidFeeSplit */]: "Invalid fee split value (exceeds max or invalid range)",
|
|
558
|
-
[6004 /*
|
|
561
|
+
[6004 /* InvalidTradeDirection */]: "Invalid trade direction (must be 0 or 1)",
|
|
559
562
|
[6005 /* InsufficientLiquidity */]: "Insufficient liquidity for this operation",
|
|
560
563
|
[6006 /* SlippageExceeded */]: "Slippage exceeded: Output amount less than minimum",
|
|
561
564
|
[6007 /* MathOverflow */]: "Math operation overflowed",
|
|
@@ -568,20 +571,22 @@ var CPMM_ERROR_MESSAGES = {
|
|
|
568
571
|
[6014 /* NotSupportedInV0_1 */]: "Not supported in v0.1",
|
|
569
572
|
[6015 /* OracleNotInitialized */]: "Oracle not initialized for this pool",
|
|
570
573
|
[6016 /* ZeroSharesOut */]: "Zero shares out",
|
|
571
|
-
[6017 /*
|
|
572
|
-
[6018 /*
|
|
573
|
-
[6019 /*
|
|
574
|
-
[6020 /*
|
|
575
|
-
[6021 /*
|
|
576
|
-
[6022 /*
|
|
577
|
-
[6023 /*
|
|
574
|
+
[6017 /* HookRejected */]: "Hook rejected",
|
|
575
|
+
[6018 /* HookCpiFailed */]: "Hook CPI failed",
|
|
576
|
+
[6019 /* HookProgramNotProvided */]: "Hook program account not provided",
|
|
577
|
+
[6020 /* HookProgramNotExecutable */]: "Hook program account is not executable",
|
|
578
|
+
[6021 /* HookReturnDataMissing */]: "Hook return data missing or wrong program id",
|
|
579
|
+
[6022 /* HookReturnDataInvalid */]: "Hook return data invalid length or could not deserialize",
|
|
580
|
+
[6023 /* HookNotAllowlisted */]: "Hook not allowlisted",
|
|
578
581
|
[6024 /* TotalSharesZero */]: "Pool has zero shares (no liquidity)",
|
|
579
582
|
[6025 /* AmountZero */]: "Amount cannot be zero",
|
|
580
583
|
[6026 /* Paused */]: "Pool is paused by admin",
|
|
581
584
|
[6027 /* InvariantViolation */]: "Internal invariant violation",
|
|
582
585
|
[6028 /* InvalidMint */]: "Invalid mint address",
|
|
583
586
|
[6029 /* InvalidInput */]: "Invalid input parameter",
|
|
584
|
-
[6030 /* Reentrancy */]: "Reentrancy detected"
|
|
587
|
+
[6030 /* Reentrancy */]: "Reentrancy detected",
|
|
588
|
+
[6031 /* CpiForbidden */]: "CPI calls into this program are forbidden",
|
|
589
|
+
[6032 /* UseCollectProtocolFees */]: "Protocol fee position must be claimed via collect_protocol_fees"
|
|
585
590
|
};
|
|
586
591
|
var CpmmError = class extends Error {
|
|
587
592
|
constructor(code, logs) {
|
|
@@ -604,14 +609,14 @@ function parseErrorFromLogs(logs) {
|
|
|
604
609
|
);
|
|
605
610
|
if (anchorMatch) {
|
|
606
611
|
const errorNumber = parseInt(anchorMatch[2], 10);
|
|
607
|
-
if (errorNumber >= 6e3 && errorNumber <=
|
|
612
|
+
if (errorNumber >= 6e3 && errorNumber <= 6032) {
|
|
608
613
|
return new CpmmError(errorNumber, logs);
|
|
609
614
|
}
|
|
610
615
|
}
|
|
611
616
|
const hexMatch = log.match(/Error Number:\s*0x([0-9a-fA-F]+)/);
|
|
612
617
|
if (hexMatch) {
|
|
613
618
|
const errorNumber = parseInt(hexMatch[1], 16);
|
|
614
|
-
if (errorNumber >= 6e3 && errorNumber <=
|
|
619
|
+
if (errorNumber >= 6e3 && errorNumber <= 6032) {
|
|
615
620
|
return new CpmmError(errorNumber, logs);
|
|
616
621
|
}
|
|
617
622
|
}
|
|
@@ -628,7 +633,7 @@ function parseErrorFromLogs(logs) {
|
|
|
628
633
|
return null;
|
|
629
634
|
}
|
|
630
635
|
function isCpmmError(code) {
|
|
631
|
-
return code >= 6e3 && code <=
|
|
636
|
+
return code >= 6e3 && code <= 6032;
|
|
632
637
|
}
|
|
633
638
|
function getErrorMessage(code) {
|
|
634
639
|
if (isCpmmError(code)) {
|
|
@@ -689,8 +694,8 @@ async function getAddLiquidityInstructionAsync(input, config) {
|
|
|
689
694
|
config: { value: input.config ?? null, isWritable: false },
|
|
690
695
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
691
696
|
position: { value: input.position ?? null, isWritable: true },
|
|
692
|
-
|
|
693
|
-
value: input.
|
|
697
|
+
protocolFeePosition: {
|
|
698
|
+
value: input.protocolFeePosition ?? null,
|
|
694
699
|
isWritable: true
|
|
695
700
|
},
|
|
696
701
|
owner: { value: input.owner ?? null, isWritable: false },
|
|
@@ -726,7 +731,7 @@ async function getAddLiquidityInstructionAsync(input, config) {
|
|
|
726
731
|
getAccountMeta("config", accounts.config),
|
|
727
732
|
getAccountMeta("pool", accounts.pool),
|
|
728
733
|
getAccountMeta("position", accounts.position),
|
|
729
|
-
getAccountMeta("
|
|
734
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
730
735
|
getAccountMeta("owner", accounts.owner),
|
|
731
736
|
getAccountMeta("authority", accounts.authority),
|
|
732
737
|
getAccountMeta("vault0", accounts.vault0),
|
|
@@ -751,8 +756,8 @@ function getAddLiquidityInstruction(input, config) {
|
|
|
751
756
|
config: { value: input.config ?? null, isWritable: false },
|
|
752
757
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
753
758
|
position: { value: input.position ?? null, isWritable: true },
|
|
754
|
-
|
|
755
|
-
value: input.
|
|
759
|
+
protocolFeePosition: {
|
|
760
|
+
value: input.protocolFeePosition ?? null,
|
|
756
761
|
isWritable: true
|
|
757
762
|
},
|
|
758
763
|
owner: { value: input.owner ?? null, isWritable: false },
|
|
@@ -775,7 +780,7 @@ function getAddLiquidityInstruction(input, config) {
|
|
|
775
780
|
getAccountMeta("config", accounts.config),
|
|
776
781
|
getAccountMeta("pool", accounts.pool),
|
|
777
782
|
getAccountMeta("position", accounts.position),
|
|
778
|
-
getAccountMeta("
|
|
783
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
779
784
|
getAccountMeta("owner", accounts.owner),
|
|
780
785
|
getAccountMeta("authority", accounts.authority),
|
|
781
786
|
getAccountMeta("vault0", accounts.vault0),
|
|
@@ -820,7 +825,7 @@ function parseAddLiquidityInstruction(instruction) {
|
|
|
820
825
|
config: getNextAccount(),
|
|
821
826
|
pool: getNextAccount(),
|
|
822
827
|
position: getNextAccount(),
|
|
823
|
-
|
|
828
|
+
protocolFeePosition: getNextAccount(),
|
|
824
829
|
owner: getNextAccount(),
|
|
825
830
|
authority: getNextAccount(),
|
|
826
831
|
vault0: getNextAccount(),
|
|
@@ -1128,8 +1133,8 @@ async function getCollectProtocolFeesInstructionAsync(input, config) {
|
|
|
1128
1133
|
const originalAccounts = {
|
|
1129
1134
|
config: { value: input.config ?? null, isWritable: false },
|
|
1130
1135
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
1131
|
-
|
|
1132
|
-
value: input.
|
|
1136
|
+
protocolFeePosition: {
|
|
1137
|
+
value: input.protocolFeePosition ?? null,
|
|
1133
1138
|
isWritable: true
|
|
1134
1139
|
},
|
|
1135
1140
|
admin: { value: input.admin ?? null, isWritable: false },
|
|
@@ -1163,7 +1168,7 @@ async function getCollectProtocolFeesInstructionAsync(input, config) {
|
|
|
1163
1168
|
accounts: [
|
|
1164
1169
|
getAccountMeta("config", accounts.config),
|
|
1165
1170
|
getAccountMeta("pool", accounts.pool),
|
|
1166
|
-
getAccountMeta("
|
|
1171
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1167
1172
|
getAccountMeta("admin", accounts.admin),
|
|
1168
1173
|
getAccountMeta("authority", accounts.authority),
|
|
1169
1174
|
getAccountMeta("vault0", accounts.vault0),
|
|
@@ -1186,8 +1191,8 @@ function getCollectProtocolFeesInstruction(input, config) {
|
|
|
1186
1191
|
const originalAccounts = {
|
|
1187
1192
|
config: { value: input.config ?? null, isWritable: false },
|
|
1188
1193
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
1189
|
-
|
|
1190
|
-
value: input.
|
|
1194
|
+
protocolFeePosition: {
|
|
1195
|
+
value: input.protocolFeePosition ?? null,
|
|
1191
1196
|
isWritable: true
|
|
1192
1197
|
},
|
|
1193
1198
|
admin: { value: input.admin ?? null, isWritable: false },
|
|
@@ -1208,7 +1213,7 @@ function getCollectProtocolFeesInstruction(input, config) {
|
|
|
1208
1213
|
accounts: [
|
|
1209
1214
|
getAccountMeta("config", accounts.config),
|
|
1210
1215
|
getAccountMeta("pool", accounts.pool),
|
|
1211
|
-
getAccountMeta("
|
|
1216
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1212
1217
|
getAccountMeta("admin", accounts.admin),
|
|
1213
1218
|
getAccountMeta("authority", accounts.authority),
|
|
1214
1219
|
getAccountMeta("vault0", accounts.vault0),
|
|
@@ -1247,7 +1252,7 @@ function parseCollectProtocolFeesInstruction(instruction) {
|
|
|
1247
1252
|
accounts: {
|
|
1248
1253
|
config: getNextAccount(),
|
|
1249
1254
|
pool: getNextAccount(),
|
|
1250
|
-
|
|
1255
|
+
protocolFeePosition: getNextAccount(),
|
|
1251
1256
|
admin: getNextAccount(),
|
|
1252
1257
|
authority: getNextAccount(),
|
|
1253
1258
|
vault0: getNextAccount(),
|
|
@@ -1434,7 +1439,7 @@ function getInitializeConfigInstructionDataEncoder() {
|
|
|
1434
1439
|
["maxRouteHops", kit.getU8Encoder()],
|
|
1435
1440
|
["protocolFeeEnabled", kit.getBooleanEncoder()],
|
|
1436
1441
|
["protocolFeeBps", kit.getU16Encoder()],
|
|
1437
|
-
["
|
|
1442
|
+
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
1438
1443
|
]),
|
|
1439
1444
|
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
|
|
1440
1445
|
);
|
|
@@ -1449,7 +1454,7 @@ function getInitializeConfigInstructionDataDecoder() {
|
|
|
1449
1454
|
["maxRouteHops", kit.getU8Decoder()],
|
|
1450
1455
|
["protocolFeeEnabled", kit.getBooleanDecoder()],
|
|
1451
1456
|
["protocolFeeBps", kit.getU16Decoder()],
|
|
1452
|
-
["
|
|
1457
|
+
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
1453
1458
|
]);
|
|
1454
1459
|
}
|
|
1455
1460
|
function getInitializeConfigInstructionDataCodec() {
|
|
@@ -1710,7 +1715,7 @@ function getInitializePoolInstructionDataEncoder() {
|
|
|
1710
1715
|
["mintB", kit.getAddressEncoder()],
|
|
1711
1716
|
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
1712
1717
|
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
1713
|
-
["
|
|
1718
|
+
["liquidityMeasureTokenIndex", kit.getU8Encoder()],
|
|
1714
1719
|
["numeraireMintOverride", kit.getOptionEncoder(kit.getAddressEncoder())]
|
|
1715
1720
|
]),
|
|
1716
1721
|
(value) => ({ ...value, discriminator: INITIALIZE_POOL_DISCRIMINATOR })
|
|
@@ -1723,7 +1728,7 @@ function getInitializePoolInstructionDataDecoder() {
|
|
|
1723
1728
|
["mintB", kit.getAddressDecoder()],
|
|
1724
1729
|
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
1725
1730
|
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
1726
|
-
["
|
|
1731
|
+
["liquidityMeasureTokenIndex", kit.getU8Decoder()],
|
|
1727
1732
|
["numeraireMintOverride", kit.getOptionDecoder(kit.getAddressDecoder())]
|
|
1728
1733
|
]);
|
|
1729
1734
|
}
|
|
@@ -1738,8 +1743,8 @@ async function getInitializePoolInstructionAsync(input, config) {
|
|
|
1738
1743
|
const originalAccounts = {
|
|
1739
1744
|
config: { value: input.config ?? null, isWritable: false },
|
|
1740
1745
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
1741
|
-
|
|
1742
|
-
value: input.
|
|
1746
|
+
protocolFeePosition: {
|
|
1747
|
+
value: input.protocolFeePosition ?? null,
|
|
1743
1748
|
isWritable: true
|
|
1744
1749
|
},
|
|
1745
1750
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
@@ -1779,8 +1784,8 @@ async function getInitializePoolInstructionAsync(input, config) {
|
|
|
1779
1784
|
]
|
|
1780
1785
|
});
|
|
1781
1786
|
}
|
|
1782
|
-
if (!accounts.
|
|
1783
|
-
accounts.
|
|
1787
|
+
if (!accounts.protocolFeePosition.value) {
|
|
1788
|
+
accounts.protocolFeePosition.value = await kit.getProgramDerivedAddress({
|
|
1784
1789
|
programAddress,
|
|
1785
1790
|
seeds: [
|
|
1786
1791
|
kit.getBytesEncoder().encode(
|
|
@@ -1856,7 +1861,7 @@ async function getInitializePoolInstructionAsync(input, config) {
|
|
|
1856
1861
|
accounts: [
|
|
1857
1862
|
getAccountMeta("config", accounts.config),
|
|
1858
1863
|
getAccountMeta("pool", accounts.pool),
|
|
1859
|
-
getAccountMeta("
|
|
1864
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1860
1865
|
getAccountMeta("authority", accounts.authority),
|
|
1861
1866
|
getAccountMeta("vault0", accounts.vault0),
|
|
1862
1867
|
getAccountMeta("vault1", accounts.vault1),
|
|
@@ -1880,8 +1885,8 @@ function getInitializePoolInstruction(input, config) {
|
|
|
1880
1885
|
const originalAccounts = {
|
|
1881
1886
|
config: { value: input.config ?? null, isWritable: false },
|
|
1882
1887
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
1883
|
-
|
|
1884
|
-
value: input.
|
|
1888
|
+
protocolFeePosition: {
|
|
1889
|
+
value: input.protocolFeePosition ?? null,
|
|
1885
1890
|
isWritable: true
|
|
1886
1891
|
},
|
|
1887
1892
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
@@ -1912,7 +1917,7 @@ function getInitializePoolInstruction(input, config) {
|
|
|
1912
1917
|
accounts: [
|
|
1913
1918
|
getAccountMeta("config", accounts.config),
|
|
1914
1919
|
getAccountMeta("pool", accounts.pool),
|
|
1915
|
-
getAccountMeta("
|
|
1920
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1916
1921
|
getAccountMeta("authority", accounts.authority),
|
|
1917
1922
|
getAccountMeta("vault0", accounts.vault0),
|
|
1918
1923
|
getAccountMeta("vault1", accounts.vault1),
|
|
@@ -1952,7 +1957,7 @@ function parseInitializePoolInstruction(instruction) {
|
|
|
1952
1957
|
accounts: {
|
|
1953
1958
|
config: getNextAccount(),
|
|
1954
1959
|
pool: getNextAccount(),
|
|
1955
|
-
|
|
1960
|
+
protocolFeePosition: getNextAccount(),
|
|
1956
1961
|
authority: getNextAccount(),
|
|
1957
1962
|
vault0: getNextAccount(),
|
|
1958
1963
|
vault1: getNextAccount(),
|
|
@@ -2265,7 +2270,7 @@ function getPreviewSwapExactInInstructionDataEncoder() {
|
|
|
2265
2270
|
kit.getStructEncoder([
|
|
2266
2271
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2267
2272
|
["amountIn", kit.getU64Encoder()],
|
|
2268
|
-
["
|
|
2273
|
+
["tradeDirection", kit.getU8Encoder()]
|
|
2269
2274
|
]),
|
|
2270
2275
|
(value) => ({
|
|
2271
2276
|
...value,
|
|
@@ -2277,7 +2282,7 @@ function getPreviewSwapExactInInstructionDataDecoder() {
|
|
|
2277
2282
|
return kit.getStructDecoder([
|
|
2278
2283
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2279
2284
|
["amountIn", kit.getU64Decoder()],
|
|
2280
|
-
["
|
|
2285
|
+
["tradeDirection", kit.getU8Decoder()]
|
|
2281
2286
|
]);
|
|
2282
2287
|
}
|
|
2283
2288
|
function getPreviewSwapExactInInstructionDataCodec() {
|
|
@@ -2350,7 +2355,7 @@ function getQuoteToNumeraireInstructionDataEncoder() {
|
|
|
2350
2355
|
kit.getStructEncoder([
|
|
2351
2356
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2352
2357
|
["amount", kit.getU128Encoder()],
|
|
2353
|
-
["
|
|
2358
|
+
["inputTokenIndex", kit.getU8Encoder()],
|
|
2354
2359
|
["maxHops", kit.getU8Encoder()],
|
|
2355
2360
|
["useTwap", kit.getBooleanEncoder()],
|
|
2356
2361
|
["windowSeconds", kit.getU32Encoder()]
|
|
@@ -2362,7 +2367,7 @@ function getQuoteToNumeraireInstructionDataDecoder() {
|
|
|
2362
2367
|
return kit.getStructDecoder([
|
|
2363
2368
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2364
2369
|
["amount", kit.getU128Decoder()],
|
|
2365
|
-
["
|
|
2370
|
+
["inputTokenIndex", kit.getU8Decoder()],
|
|
2366
2371
|
["maxHops", kit.getU8Decoder()],
|
|
2367
2372
|
["useTwap", kit.getBooleanDecoder()],
|
|
2368
2373
|
["windowSeconds", kit.getU32Decoder()]
|
|
@@ -2464,8 +2469,8 @@ async function getRemoveLiquidityInstructionAsync(input, config) {
|
|
|
2464
2469
|
config: { value: input.config ?? null, isWritable: false },
|
|
2465
2470
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
2466
2471
|
position: { value: input.position ?? null, isWritable: true },
|
|
2467
|
-
|
|
2468
|
-
value: input.
|
|
2472
|
+
protocolFeePosition: {
|
|
2473
|
+
value: input.protocolFeePosition ?? null,
|
|
2469
2474
|
isWritable: true
|
|
2470
2475
|
},
|
|
2471
2476
|
owner: { value: input.owner ?? null, isWritable: false },
|
|
@@ -2501,7 +2506,7 @@ async function getRemoveLiquidityInstructionAsync(input, config) {
|
|
|
2501
2506
|
getAccountMeta("config", accounts.config),
|
|
2502
2507
|
getAccountMeta("pool", accounts.pool),
|
|
2503
2508
|
getAccountMeta("position", accounts.position),
|
|
2504
|
-
getAccountMeta("
|
|
2509
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
2505
2510
|
getAccountMeta("owner", accounts.owner),
|
|
2506
2511
|
getAccountMeta("authority", accounts.authority),
|
|
2507
2512
|
getAccountMeta("vault0", accounts.vault0),
|
|
@@ -2526,8 +2531,8 @@ function getRemoveLiquidityInstruction(input, config) {
|
|
|
2526
2531
|
config: { value: input.config ?? null, isWritable: false },
|
|
2527
2532
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
2528
2533
|
position: { value: input.position ?? null, isWritable: true },
|
|
2529
|
-
|
|
2530
|
-
value: input.
|
|
2534
|
+
protocolFeePosition: {
|
|
2535
|
+
value: input.protocolFeePosition ?? null,
|
|
2531
2536
|
isWritable: true
|
|
2532
2537
|
},
|
|
2533
2538
|
owner: { value: input.owner ?? null, isWritable: false },
|
|
@@ -2550,7 +2555,7 @@ function getRemoveLiquidityInstruction(input, config) {
|
|
|
2550
2555
|
getAccountMeta("config", accounts.config),
|
|
2551
2556
|
getAccountMeta("pool", accounts.pool),
|
|
2552
2557
|
getAccountMeta("position", accounts.position),
|
|
2553
|
-
getAccountMeta("
|
|
2558
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
2554
2559
|
getAccountMeta("owner", accounts.owner),
|
|
2555
2560
|
getAccountMeta("authority", accounts.authority),
|
|
2556
2561
|
getAccountMeta("vault0", accounts.vault0),
|
|
@@ -2595,7 +2600,7 @@ function parseRemoveLiquidityInstruction(instruction) {
|
|
|
2595
2600
|
config: getNextAccount(),
|
|
2596
2601
|
pool: getNextAccount(),
|
|
2597
2602
|
position: getNextAccount(),
|
|
2598
|
-
|
|
2603
|
+
protocolFeePosition: getNextAccount(),
|
|
2599
2604
|
owner: getNextAccount(),
|
|
2600
2605
|
authority: getNextAccount(),
|
|
2601
2606
|
vault0: getNextAccount(),
|
|
@@ -2695,48 +2700,47 @@ function parseSetFeesInstruction(instruction) {
|
|
|
2695
2700
|
data: getSetFeesInstructionDataDecoder().decode(instruction.data)
|
|
2696
2701
|
};
|
|
2697
2702
|
}
|
|
2698
|
-
var
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2703
|
+
var SET_HOOK_DISCRIMINATOR = new Uint8Array([
|
|
2704
|
+
175,
|
|
2705
|
+
16,
|
|
2706
|
+
187,
|
|
2707
|
+
252,
|
|
2708
|
+
19,
|
|
2709
|
+
54,
|
|
2710
|
+
111,
|
|
2711
|
+
221
|
|
2707
2712
|
]);
|
|
2708
|
-
function
|
|
2709
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2713
|
+
function getSetHookDiscriminatorBytes() {
|
|
2714
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_HOOK_DISCRIMINATOR);
|
|
2710
2715
|
}
|
|
2711
|
-
function
|
|
2716
|
+
function getSetHookInstructionDataEncoder() {
|
|
2712
2717
|
return kit.transformEncoder(
|
|
2713
2718
|
kit.getStructEncoder([
|
|
2714
2719
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2715
|
-
["
|
|
2716
|
-
["
|
|
2720
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
2721
|
+
["hookFlags", kit.getU32Encoder()]
|
|
2717
2722
|
]),
|
|
2718
|
-
(value) => ({ ...value, discriminator:
|
|
2723
|
+
(value) => ({ ...value, discriminator: SET_HOOK_DISCRIMINATOR })
|
|
2719
2724
|
);
|
|
2720
2725
|
}
|
|
2721
|
-
function
|
|
2726
|
+
function getSetHookInstructionDataDecoder() {
|
|
2722
2727
|
return kit.getStructDecoder([
|
|
2723
2728
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2724
|
-
["
|
|
2725
|
-
["
|
|
2729
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
2730
|
+
["hookFlags", kit.getU32Decoder()]
|
|
2726
2731
|
]);
|
|
2727
2732
|
}
|
|
2728
|
-
function
|
|
2733
|
+
function getSetHookInstructionDataCodec() {
|
|
2729
2734
|
return kit.combineCodec(
|
|
2730
|
-
|
|
2731
|
-
|
|
2735
|
+
getSetHookInstructionDataEncoder(),
|
|
2736
|
+
getSetHookInstructionDataDecoder()
|
|
2732
2737
|
);
|
|
2733
2738
|
}
|
|
2734
|
-
function
|
|
2739
|
+
function getSetHookInstruction(input, config) {
|
|
2735
2740
|
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2736
2741
|
const originalAccounts = {
|
|
2737
2742
|
config: { value: input.config ?? null, isWritable: false },
|
|
2738
2743
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
2739
|
-
nextPool: { value: input.nextPool ?? null, isWritable: false },
|
|
2740
2744
|
admin: { value: input.admin ?? null, isWritable: false }
|
|
2741
2745
|
};
|
|
2742
2746
|
const accounts = originalAccounts;
|
|
@@ -2746,22 +2750,21 @@ function getSetRouteInstruction(input, config) {
|
|
|
2746
2750
|
accounts: [
|
|
2747
2751
|
getAccountMeta("config", accounts.config),
|
|
2748
2752
|
getAccountMeta("pool", accounts.pool),
|
|
2749
|
-
getAccountMeta("nextPool", accounts.nextPool),
|
|
2750
2753
|
getAccountMeta("admin", accounts.admin)
|
|
2751
2754
|
],
|
|
2752
|
-
data:
|
|
2755
|
+
data: getSetHookInstructionDataEncoder().encode(
|
|
2753
2756
|
args
|
|
2754
2757
|
),
|
|
2755
2758
|
programAddress
|
|
2756
2759
|
});
|
|
2757
2760
|
}
|
|
2758
|
-
function
|
|
2759
|
-
if (instruction.accounts.length <
|
|
2761
|
+
function parseSetHookInstruction(instruction) {
|
|
2762
|
+
if (instruction.accounts.length < 3) {
|
|
2760
2763
|
throw new kit.SolanaError(
|
|
2761
2764
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2762
2765
|
{
|
|
2763
2766
|
actualAccountMetas: instruction.accounts.length,
|
|
2764
|
-
expectedAccountMetas:
|
|
2767
|
+
expectedAccountMetas: 3
|
|
2765
2768
|
}
|
|
2766
2769
|
);
|
|
2767
2770
|
}
|
|
@@ -2771,64 +2774,58 @@ function parseSetRouteInstruction(instruction) {
|
|
|
2771
2774
|
accountIndex += 1;
|
|
2772
2775
|
return accountMeta;
|
|
2773
2776
|
};
|
|
2774
|
-
const getNextOptionalAccount = () => {
|
|
2775
|
-
const accountMeta = getNextAccount();
|
|
2776
|
-
return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
2777
|
-
};
|
|
2778
2777
|
return {
|
|
2779
2778
|
programAddress: instruction.programAddress,
|
|
2780
2779
|
accounts: {
|
|
2781
2780
|
config: getNextAccount(),
|
|
2782
2781
|
pool: getNextAccount(),
|
|
2783
|
-
nextPool: getNextOptionalAccount(),
|
|
2784
2782
|
admin: getNextAccount()
|
|
2785
2783
|
},
|
|
2786
|
-
data:
|
|
2784
|
+
data: getSetHookInstructionDataDecoder().decode(instruction.data)
|
|
2787
2785
|
};
|
|
2788
2786
|
}
|
|
2789
|
-
var
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2787
|
+
var SET_ROUTE_DISCRIMINATOR = new Uint8Array([
|
|
2788
|
+
244,
|
|
2789
|
+
231,
|
|
2790
|
+
3,
|
|
2791
|
+
84,
|
|
2792
|
+
233,
|
|
2793
|
+
61,
|
|
2794
|
+
146,
|
|
2795
|
+
149
|
|
2798
2796
|
]);
|
|
2799
|
-
function
|
|
2800
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2801
|
-
SET_SENTINEL_DISCRIMINATOR
|
|
2802
|
-
);
|
|
2797
|
+
function getSetRouteDiscriminatorBytes() {
|
|
2798
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_ROUTE_DISCRIMINATOR);
|
|
2803
2799
|
}
|
|
2804
|
-
function
|
|
2800
|
+
function getSetRouteInstructionDataEncoder() {
|
|
2805
2801
|
return kit.transformEncoder(
|
|
2806
2802
|
kit.getStructEncoder([
|
|
2807
2803
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2808
|
-
["
|
|
2809
|
-
["
|
|
2804
|
+
["routeNextPool", kit.getAddressEncoder()],
|
|
2805
|
+
["routeBridgeMint", kit.getAddressEncoder()]
|
|
2810
2806
|
]),
|
|
2811
|
-
(value) => ({ ...value, discriminator:
|
|
2807
|
+
(value) => ({ ...value, discriminator: SET_ROUTE_DISCRIMINATOR })
|
|
2812
2808
|
);
|
|
2813
2809
|
}
|
|
2814
|
-
function
|
|
2810
|
+
function getSetRouteInstructionDataDecoder() {
|
|
2815
2811
|
return kit.getStructDecoder([
|
|
2816
2812
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2817
|
-
["
|
|
2818
|
-
["
|
|
2813
|
+
["routeNextPool", kit.getAddressDecoder()],
|
|
2814
|
+
["routeBridgeMint", kit.getAddressDecoder()]
|
|
2819
2815
|
]);
|
|
2820
2816
|
}
|
|
2821
|
-
function
|
|
2817
|
+
function getSetRouteInstructionDataCodec() {
|
|
2822
2818
|
return kit.combineCodec(
|
|
2823
|
-
|
|
2824
|
-
|
|
2819
|
+
getSetRouteInstructionDataEncoder(),
|
|
2820
|
+
getSetRouteInstructionDataDecoder()
|
|
2825
2821
|
);
|
|
2826
2822
|
}
|
|
2827
|
-
function
|
|
2823
|
+
function getSetRouteInstruction(input, config) {
|
|
2828
2824
|
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2829
2825
|
const originalAccounts = {
|
|
2830
2826
|
config: { value: input.config ?? null, isWritable: false },
|
|
2831
2827
|
pool: { value: input.pool ?? null, isWritable: true },
|
|
2828
|
+
nextPool: { value: input.nextPool ?? null, isWritable: false },
|
|
2832
2829
|
admin: { value: input.admin ?? null, isWritable: false }
|
|
2833
2830
|
};
|
|
2834
2831
|
const accounts = originalAccounts;
|
|
@@ -2838,21 +2835,22 @@ function getSetSentinelInstruction(input, config) {
|
|
|
2838
2835
|
accounts: [
|
|
2839
2836
|
getAccountMeta("config", accounts.config),
|
|
2840
2837
|
getAccountMeta("pool", accounts.pool),
|
|
2838
|
+
getAccountMeta("nextPool", accounts.nextPool),
|
|
2841
2839
|
getAccountMeta("admin", accounts.admin)
|
|
2842
2840
|
],
|
|
2843
|
-
data:
|
|
2841
|
+
data: getSetRouteInstructionDataEncoder().encode(
|
|
2844
2842
|
args
|
|
2845
2843
|
),
|
|
2846
2844
|
programAddress
|
|
2847
2845
|
});
|
|
2848
2846
|
}
|
|
2849
|
-
function
|
|
2850
|
-
if (instruction.accounts.length <
|
|
2847
|
+
function parseSetRouteInstruction(instruction) {
|
|
2848
|
+
if (instruction.accounts.length < 4) {
|
|
2851
2849
|
throw new kit.SolanaError(
|
|
2852
2850
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2853
2851
|
{
|
|
2854
2852
|
actualAccountMetas: instruction.accounts.length,
|
|
2855
|
-
expectedAccountMetas:
|
|
2853
|
+
expectedAccountMetas: 4
|
|
2856
2854
|
}
|
|
2857
2855
|
);
|
|
2858
2856
|
}
|
|
@@ -2862,216 +2860,19 @@ function parseSetSentinelInstruction(instruction) {
|
|
|
2862
2860
|
accountIndex += 1;
|
|
2863
2861
|
return accountMeta;
|
|
2864
2862
|
};
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
config: getNextAccount(),
|
|
2869
|
-
pool: getNextAccount(),
|
|
2870
|
-
admin: getNextAccount()
|
|
2871
|
-
},
|
|
2872
|
-
data: getSetSentinelInstructionDataDecoder().decode(instruction.data)
|
|
2873
|
-
};
|
|
2874
|
-
}
|
|
2875
|
-
var SKIM_DISCRIMINATOR = new Uint8Array([
|
|
2876
|
-
238,
|
|
2877
|
-
120,
|
|
2878
|
-
221,
|
|
2879
|
-
138,
|
|
2880
|
-
82,
|
|
2881
|
-
60,
|
|
2882
|
-
100,
|
|
2883
|
-
218
|
|
2884
|
-
]);
|
|
2885
|
-
function getSkimDiscriminatorBytes() {
|
|
2886
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SKIM_DISCRIMINATOR);
|
|
2887
|
-
}
|
|
2888
|
-
function getSkimInstructionDataEncoder() {
|
|
2889
|
-
return kit.transformEncoder(
|
|
2890
|
-
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
2891
|
-
(value) => ({ ...value, discriminator: SKIM_DISCRIMINATOR })
|
|
2892
|
-
);
|
|
2893
|
-
}
|
|
2894
|
-
function getSkimInstructionDataDecoder() {
|
|
2895
|
-
return kit.getStructDecoder([
|
|
2896
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
2897
|
-
]);
|
|
2898
|
-
}
|
|
2899
|
-
function getSkimInstructionDataCodec() {
|
|
2900
|
-
return kit.combineCodec(
|
|
2901
|
-
getSkimInstructionDataEncoder(),
|
|
2902
|
-
getSkimInstructionDataDecoder()
|
|
2903
|
-
);
|
|
2904
|
-
}
|
|
2905
|
-
async function getSkimInstructionAsync(input, config) {
|
|
2906
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2907
|
-
const originalAccounts = {
|
|
2908
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2909
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
2910
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
2911
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
2912
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
2913
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
2914
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
2915
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
2916
|
-
adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
|
|
2917
|
-
adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
|
|
2918
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
2919
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
2920
|
-
};
|
|
2921
|
-
const accounts = originalAccounts;
|
|
2922
|
-
if (!accounts.authority.value) {
|
|
2923
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
2924
|
-
programAddress,
|
|
2925
|
-
seeds: [
|
|
2926
|
-
kit.getBytesEncoder().encode(
|
|
2927
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2928
|
-
),
|
|
2929
|
-
kit.getAddressEncoder().encode(
|
|
2930
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
2931
|
-
)
|
|
2932
|
-
]
|
|
2933
|
-
});
|
|
2934
|
-
}
|
|
2935
|
-
if (!accounts.adminAta0.value) {
|
|
2936
|
-
accounts.adminAta0.value = await kit.getProgramDerivedAddress({
|
|
2937
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2938
|
-
seeds: [
|
|
2939
|
-
kit.getAddressEncoder().encode(
|
|
2940
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
2941
|
-
"admin",
|
|
2942
|
-
accounts.admin.value
|
|
2943
|
-
)
|
|
2944
|
-
),
|
|
2945
|
-
kit.getAddressEncoder().encode(
|
|
2946
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
2947
|
-
"token0Program",
|
|
2948
|
-
accounts.token0Program.value
|
|
2949
|
-
)
|
|
2950
|
-
),
|
|
2951
|
-
kit.getAddressEncoder().encode(
|
|
2952
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
2953
|
-
"token0Mint",
|
|
2954
|
-
accounts.token0Mint.value
|
|
2955
|
-
)
|
|
2956
|
-
)
|
|
2957
|
-
]
|
|
2958
|
-
});
|
|
2959
|
-
}
|
|
2960
|
-
if (!accounts.adminAta1.value) {
|
|
2961
|
-
accounts.adminAta1.value = await kit.getProgramDerivedAddress({
|
|
2962
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2963
|
-
seeds: [
|
|
2964
|
-
kit.getAddressEncoder().encode(
|
|
2965
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
2966
|
-
"admin",
|
|
2967
|
-
accounts.admin.value
|
|
2968
|
-
)
|
|
2969
|
-
),
|
|
2970
|
-
kit.getAddressEncoder().encode(
|
|
2971
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
2972
|
-
"token1Program",
|
|
2973
|
-
accounts.token1Program.value
|
|
2974
|
-
)
|
|
2975
|
-
),
|
|
2976
|
-
kit.getAddressEncoder().encode(
|
|
2977
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
2978
|
-
"token1Mint",
|
|
2979
|
-
accounts.token1Mint.value
|
|
2980
|
-
)
|
|
2981
|
-
)
|
|
2982
|
-
]
|
|
2983
|
-
});
|
|
2984
|
-
}
|
|
2985
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2986
|
-
return Object.freeze({
|
|
2987
|
-
accounts: [
|
|
2988
|
-
getAccountMeta("config", accounts.config),
|
|
2989
|
-
getAccountMeta("pool", accounts.pool),
|
|
2990
|
-
getAccountMeta("admin", accounts.admin),
|
|
2991
|
-
getAccountMeta("authority", accounts.authority),
|
|
2992
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
2993
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
2994
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
2995
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
2996
|
-
getAccountMeta("adminAta0", accounts.adminAta0),
|
|
2997
|
-
getAccountMeta("adminAta1", accounts.adminAta1),
|
|
2998
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
2999
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
3000
|
-
],
|
|
3001
|
-
data: getSkimInstructionDataEncoder().encode({}),
|
|
3002
|
-
programAddress
|
|
3003
|
-
});
|
|
3004
|
-
}
|
|
3005
|
-
function getSkimInstruction(input, config) {
|
|
3006
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3007
|
-
const originalAccounts = {
|
|
3008
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
3009
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
3010
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
3011
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
3012
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
3013
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
3014
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
3015
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
3016
|
-
adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
|
|
3017
|
-
adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
|
|
3018
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
3019
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
3020
|
-
};
|
|
3021
|
-
const accounts = originalAccounts;
|
|
3022
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3023
|
-
return Object.freeze({
|
|
3024
|
-
accounts: [
|
|
3025
|
-
getAccountMeta("config", accounts.config),
|
|
3026
|
-
getAccountMeta("pool", accounts.pool),
|
|
3027
|
-
getAccountMeta("admin", accounts.admin),
|
|
3028
|
-
getAccountMeta("authority", accounts.authority),
|
|
3029
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
3030
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
3031
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
3032
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
3033
|
-
getAccountMeta("adminAta0", accounts.adminAta0),
|
|
3034
|
-
getAccountMeta("adminAta1", accounts.adminAta1),
|
|
3035
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
3036
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
3037
|
-
],
|
|
3038
|
-
data: getSkimInstructionDataEncoder().encode({}),
|
|
3039
|
-
programAddress
|
|
3040
|
-
});
|
|
3041
|
-
}
|
|
3042
|
-
function parseSkimInstruction(instruction) {
|
|
3043
|
-
if (instruction.accounts.length < 12) {
|
|
3044
|
-
throw new kit.SolanaError(
|
|
3045
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3046
|
-
{
|
|
3047
|
-
actualAccountMetas: instruction.accounts.length,
|
|
3048
|
-
expectedAccountMetas: 12
|
|
3049
|
-
}
|
|
3050
|
-
);
|
|
3051
|
-
}
|
|
3052
|
-
let accountIndex = 0;
|
|
3053
|
-
const getNextAccount = () => {
|
|
3054
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3055
|
-
accountIndex += 1;
|
|
3056
|
-
return accountMeta;
|
|
2863
|
+
const getNextOptionalAccount = () => {
|
|
2864
|
+
const accountMeta = getNextAccount();
|
|
2865
|
+
return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
3057
2866
|
};
|
|
3058
2867
|
return {
|
|
3059
2868
|
programAddress: instruction.programAddress,
|
|
3060
2869
|
accounts: {
|
|
3061
2870
|
config: getNextAccount(),
|
|
3062
2871
|
pool: getNextAccount(),
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
vault0: getNextAccount(),
|
|
3066
|
-
vault1: getNextAccount(),
|
|
3067
|
-
token0Mint: getNextAccount(),
|
|
3068
|
-
token1Mint: getNextAccount(),
|
|
3069
|
-
adminAta0: getNextAccount(),
|
|
3070
|
-
adminAta1: getNextAccount(),
|
|
3071
|
-
token0Program: getNextAccount(),
|
|
3072
|
-
token1Program: getNextAccount()
|
|
2872
|
+
nextPool: getNextOptionalAccount(),
|
|
2873
|
+
admin: getNextAccount()
|
|
3073
2874
|
},
|
|
3074
|
-
data:
|
|
2875
|
+
data: getSetRouteInstructionDataDecoder().decode(instruction.data)
|
|
3075
2876
|
};
|
|
3076
2877
|
}
|
|
3077
2878
|
var SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
|
|
@@ -3095,7 +2896,7 @@ function getSwapExactInInstructionDataEncoder() {
|
|
|
3095
2896
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
3096
2897
|
["amountIn", kit.getU64Encoder()],
|
|
3097
2898
|
["minAmountOut", kit.getU64Encoder()],
|
|
3098
|
-
["
|
|
2899
|
+
["tradeDirection", kit.getU8Encoder()],
|
|
3099
2900
|
["updateOracle", kit.getBooleanEncoder()]
|
|
3100
2901
|
]),
|
|
3101
2902
|
(value) => ({ ...value, discriminator: SWAP_EXACT_IN_DISCRIMINATOR })
|
|
@@ -3106,7 +2907,7 @@ function getSwapExactInInstructionDataDecoder() {
|
|
|
3106
2907
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
3107
2908
|
["amountIn", kit.getU64Decoder()],
|
|
3108
2909
|
["minAmountOut", kit.getU64Decoder()],
|
|
3109
|
-
["
|
|
2910
|
+
["tradeDirection", kit.getU8Decoder()],
|
|
3110
2911
|
["updateOracle", kit.getBooleanDecoder()]
|
|
3111
2912
|
]);
|
|
3112
2913
|
}
|
|
@@ -3425,7 +3226,7 @@ function getUpdateConfigInstructionDataEncoder() {
|
|
|
3425
3226
|
["maxRouteHops", kit.getU8Encoder()],
|
|
3426
3227
|
["protocolFeeEnabled", kit.getBooleanEncoder()],
|
|
3427
3228
|
["protocolFeeBps", kit.getU16Encoder()],
|
|
3428
|
-
["
|
|
3229
|
+
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
3429
3230
|
]),
|
|
3430
3231
|
(value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR })
|
|
3431
3232
|
);
|
|
@@ -3439,7 +3240,7 @@ function getUpdateConfigInstructionDataDecoder() {
|
|
|
3439
3240
|
["maxRouteHops", kit.getU8Decoder()],
|
|
3440
3241
|
["protocolFeeEnabled", kit.getBooleanDecoder()],
|
|
3441
3242
|
["protocolFeeBps", kit.getU16Decoder()],
|
|
3442
|
-
["
|
|
3243
|
+
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
3443
3244
|
]);
|
|
3444
3245
|
}
|
|
3445
3246
|
function getUpdateConfigInstructionDataCodec() {
|
|
@@ -3448,33 +3249,227 @@ function getUpdateConfigInstructionDataCodec() {
|
|
|
3448
3249
|
getUpdateConfigInstructionDataDecoder()
|
|
3449
3250
|
);
|
|
3450
3251
|
}
|
|
3451
|
-
function getUpdateConfigInstruction(input, config) {
|
|
3252
|
+
function getUpdateConfigInstruction(input, config) {
|
|
3253
|
+
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3254
|
+
const originalAccounts = {
|
|
3255
|
+
config: { value: input.config ?? null, isWritable: true },
|
|
3256
|
+
admin: { value: input.admin ?? null, isWritable: false }
|
|
3257
|
+
};
|
|
3258
|
+
const accounts = originalAccounts;
|
|
3259
|
+
const args = { ...input };
|
|
3260
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3261
|
+
return Object.freeze({
|
|
3262
|
+
accounts: [
|
|
3263
|
+
getAccountMeta("config", accounts.config),
|
|
3264
|
+
getAccountMeta("admin", accounts.admin)
|
|
3265
|
+
],
|
|
3266
|
+
data: getUpdateConfigInstructionDataEncoder().encode(
|
|
3267
|
+
args
|
|
3268
|
+
),
|
|
3269
|
+
programAddress
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
function parseUpdateConfigInstruction(instruction) {
|
|
3273
|
+
if (instruction.accounts.length < 2) {
|
|
3274
|
+
throw new kit.SolanaError(
|
|
3275
|
+
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3276
|
+
{
|
|
3277
|
+
actualAccountMetas: instruction.accounts.length,
|
|
3278
|
+
expectedAccountMetas: 2
|
|
3279
|
+
}
|
|
3280
|
+
);
|
|
3281
|
+
}
|
|
3282
|
+
let accountIndex = 0;
|
|
3283
|
+
const getNextAccount = () => {
|
|
3284
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
3285
|
+
accountIndex += 1;
|
|
3286
|
+
return accountMeta;
|
|
3287
|
+
};
|
|
3288
|
+
return {
|
|
3289
|
+
programAddress: instruction.programAddress,
|
|
3290
|
+
accounts: { config: getNextAccount(), admin: getNextAccount() },
|
|
3291
|
+
data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
|
|
3292
|
+
};
|
|
3293
|
+
}
|
|
3294
|
+
var WITHDRAW_VAULT_EXCESS_DISCRIMINATOR = new Uint8Array([
|
|
3295
|
+
235,
|
|
3296
|
+
197,
|
|
3297
|
+
247,
|
|
3298
|
+
177,
|
|
3299
|
+
137,
|
|
3300
|
+
72,
|
|
3301
|
+
135,
|
|
3302
|
+
113
|
|
3303
|
+
]);
|
|
3304
|
+
function getWithdrawVaultExcessDiscriminatorBytes() {
|
|
3305
|
+
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3306
|
+
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
|
|
3307
|
+
);
|
|
3308
|
+
}
|
|
3309
|
+
function getWithdrawVaultExcessInstructionDataEncoder() {
|
|
3310
|
+
return kit.transformEncoder(
|
|
3311
|
+
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
3312
|
+
(value) => ({
|
|
3313
|
+
...value,
|
|
3314
|
+
discriminator: WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
|
|
3315
|
+
})
|
|
3316
|
+
);
|
|
3317
|
+
}
|
|
3318
|
+
function getWithdrawVaultExcessInstructionDataDecoder() {
|
|
3319
|
+
return kit.getStructDecoder([
|
|
3320
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
3321
|
+
]);
|
|
3322
|
+
}
|
|
3323
|
+
function getWithdrawVaultExcessInstructionDataCodec() {
|
|
3324
|
+
return kit.combineCodec(
|
|
3325
|
+
getWithdrawVaultExcessInstructionDataEncoder(),
|
|
3326
|
+
getWithdrawVaultExcessInstructionDataDecoder()
|
|
3327
|
+
);
|
|
3328
|
+
}
|
|
3329
|
+
async function getWithdrawVaultExcessInstructionAsync(input, config) {
|
|
3330
|
+
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3331
|
+
const originalAccounts = {
|
|
3332
|
+
config: { value: input.config ?? null, isWritable: false },
|
|
3333
|
+
pool: { value: input.pool ?? null, isWritable: false },
|
|
3334
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
3335
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
3336
|
+
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
3337
|
+
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
3338
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
3339
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
3340
|
+
adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
|
|
3341
|
+
adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
|
|
3342
|
+
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
3343
|
+
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
3344
|
+
};
|
|
3345
|
+
const accounts = originalAccounts;
|
|
3346
|
+
if (!accounts.authority.value) {
|
|
3347
|
+
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
3348
|
+
programAddress,
|
|
3349
|
+
seeds: [
|
|
3350
|
+
kit.getBytesEncoder().encode(
|
|
3351
|
+
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
3352
|
+
),
|
|
3353
|
+
kit.getAddressEncoder().encode(
|
|
3354
|
+
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
3355
|
+
)
|
|
3356
|
+
]
|
|
3357
|
+
});
|
|
3358
|
+
}
|
|
3359
|
+
if (!accounts.adminAta0.value) {
|
|
3360
|
+
accounts.adminAta0.value = await kit.getProgramDerivedAddress({
|
|
3361
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
3362
|
+
seeds: [
|
|
3363
|
+
kit.getAddressEncoder().encode(
|
|
3364
|
+
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3365
|
+
"admin",
|
|
3366
|
+
accounts.admin.value
|
|
3367
|
+
)
|
|
3368
|
+
),
|
|
3369
|
+
kit.getAddressEncoder().encode(
|
|
3370
|
+
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3371
|
+
"token0Program",
|
|
3372
|
+
accounts.token0Program.value
|
|
3373
|
+
)
|
|
3374
|
+
),
|
|
3375
|
+
kit.getAddressEncoder().encode(
|
|
3376
|
+
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3377
|
+
"token0Mint",
|
|
3378
|
+
accounts.token0Mint.value
|
|
3379
|
+
)
|
|
3380
|
+
)
|
|
3381
|
+
]
|
|
3382
|
+
});
|
|
3383
|
+
}
|
|
3384
|
+
if (!accounts.adminAta1.value) {
|
|
3385
|
+
accounts.adminAta1.value = await kit.getProgramDerivedAddress({
|
|
3386
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
3387
|
+
seeds: [
|
|
3388
|
+
kit.getAddressEncoder().encode(
|
|
3389
|
+
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3390
|
+
"admin",
|
|
3391
|
+
accounts.admin.value
|
|
3392
|
+
)
|
|
3393
|
+
),
|
|
3394
|
+
kit.getAddressEncoder().encode(
|
|
3395
|
+
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3396
|
+
"token1Program",
|
|
3397
|
+
accounts.token1Program.value
|
|
3398
|
+
)
|
|
3399
|
+
),
|
|
3400
|
+
kit.getAddressEncoder().encode(
|
|
3401
|
+
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3402
|
+
"token1Mint",
|
|
3403
|
+
accounts.token1Mint.value
|
|
3404
|
+
)
|
|
3405
|
+
)
|
|
3406
|
+
]
|
|
3407
|
+
});
|
|
3408
|
+
}
|
|
3409
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3410
|
+
return Object.freeze({
|
|
3411
|
+
accounts: [
|
|
3412
|
+
getAccountMeta("config", accounts.config),
|
|
3413
|
+
getAccountMeta("pool", accounts.pool),
|
|
3414
|
+
getAccountMeta("admin", accounts.admin),
|
|
3415
|
+
getAccountMeta("authority", accounts.authority),
|
|
3416
|
+
getAccountMeta("vault0", accounts.vault0),
|
|
3417
|
+
getAccountMeta("vault1", accounts.vault1),
|
|
3418
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
3419
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
3420
|
+
getAccountMeta("adminAta0", accounts.adminAta0),
|
|
3421
|
+
getAccountMeta("adminAta1", accounts.adminAta1),
|
|
3422
|
+
getAccountMeta("token0Program", accounts.token0Program),
|
|
3423
|
+
getAccountMeta("token1Program", accounts.token1Program)
|
|
3424
|
+
],
|
|
3425
|
+
data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
|
|
3426
|
+
programAddress
|
|
3427
|
+
});
|
|
3428
|
+
}
|
|
3429
|
+
function getWithdrawVaultExcessInstruction(input, config) {
|
|
3452
3430
|
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3453
3431
|
const originalAccounts = {
|
|
3454
|
-
config: { value: input.config ?? null, isWritable:
|
|
3455
|
-
|
|
3432
|
+
config: { value: input.config ?? null, isWritable: false },
|
|
3433
|
+
pool: { value: input.pool ?? null, isWritable: false },
|
|
3434
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
3435
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
3436
|
+
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
3437
|
+
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
3438
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
3439
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
3440
|
+
adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
|
|
3441
|
+
adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
|
|
3442
|
+
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
3443
|
+
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
3456
3444
|
};
|
|
3457
3445
|
const accounts = originalAccounts;
|
|
3458
|
-
const args = { ...input };
|
|
3459
3446
|
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3460
3447
|
return Object.freeze({
|
|
3461
3448
|
accounts: [
|
|
3462
3449
|
getAccountMeta("config", accounts.config),
|
|
3463
|
-
getAccountMeta("
|
|
3450
|
+
getAccountMeta("pool", accounts.pool),
|
|
3451
|
+
getAccountMeta("admin", accounts.admin),
|
|
3452
|
+
getAccountMeta("authority", accounts.authority),
|
|
3453
|
+
getAccountMeta("vault0", accounts.vault0),
|
|
3454
|
+
getAccountMeta("vault1", accounts.vault1),
|
|
3455
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
3456
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
3457
|
+
getAccountMeta("adminAta0", accounts.adminAta0),
|
|
3458
|
+
getAccountMeta("adminAta1", accounts.adminAta1),
|
|
3459
|
+
getAccountMeta("token0Program", accounts.token0Program),
|
|
3460
|
+
getAccountMeta("token1Program", accounts.token1Program)
|
|
3464
3461
|
],
|
|
3465
|
-
data:
|
|
3466
|
-
args
|
|
3467
|
-
),
|
|
3462
|
+
data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
|
|
3468
3463
|
programAddress
|
|
3469
3464
|
});
|
|
3470
3465
|
}
|
|
3471
|
-
function
|
|
3472
|
-
if (instruction.accounts.length <
|
|
3466
|
+
function parseWithdrawVaultExcessInstruction(instruction) {
|
|
3467
|
+
if (instruction.accounts.length < 12) {
|
|
3473
3468
|
throw new kit.SolanaError(
|
|
3474
3469
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3475
3470
|
{
|
|
3476
3471
|
actualAccountMetas: instruction.accounts.length,
|
|
3477
|
-
expectedAccountMetas:
|
|
3472
|
+
expectedAccountMetas: 12
|
|
3478
3473
|
}
|
|
3479
3474
|
);
|
|
3480
3475
|
}
|
|
@@ -3486,8 +3481,23 @@ function parseUpdateConfigInstruction(instruction) {
|
|
|
3486
3481
|
};
|
|
3487
3482
|
return {
|
|
3488
3483
|
programAddress: instruction.programAddress,
|
|
3489
|
-
accounts: {
|
|
3490
|
-
|
|
3484
|
+
accounts: {
|
|
3485
|
+
config: getNextAccount(),
|
|
3486
|
+
pool: getNextAccount(),
|
|
3487
|
+
admin: getNextAccount(),
|
|
3488
|
+
authority: getNextAccount(),
|
|
3489
|
+
vault0: getNextAccount(),
|
|
3490
|
+
vault1: getNextAccount(),
|
|
3491
|
+
token0Mint: getNextAccount(),
|
|
3492
|
+
token1Mint: getNextAccount(),
|
|
3493
|
+
adminAta0: getNextAccount(),
|
|
3494
|
+
adminAta1: getNextAccount(),
|
|
3495
|
+
token0Program: getNextAccount(),
|
|
3496
|
+
token1Program: getNextAccount()
|
|
3497
|
+
},
|
|
3498
|
+
data: getWithdrawVaultExcessInstructionDataDecoder().decode(
|
|
3499
|
+
instruction.data
|
|
3500
|
+
)
|
|
3491
3501
|
};
|
|
3492
3502
|
}
|
|
3493
3503
|
function isTransactionSigner(value) {
|
|
@@ -3520,7 +3530,7 @@ function createSwapInstruction(params) {
|
|
|
3520
3530
|
user,
|
|
3521
3531
|
amountIn,
|
|
3522
3532
|
minAmountOut,
|
|
3523
|
-
|
|
3533
|
+
tradeDirection,
|
|
3524
3534
|
oracle,
|
|
3525
3535
|
remainingAccounts = [],
|
|
3526
3536
|
updateOracle = false,
|
|
@@ -3530,8 +3540,8 @@ function createSwapInstruction(params) {
|
|
|
3530
3540
|
programId = CPMM_PROGRAM_ADDRESS
|
|
3531
3541
|
} = params;
|
|
3532
3542
|
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
3533
|
-
const [vaultIn, vaultOut] =
|
|
3534
|
-
const [userIn, userOut] =
|
|
3543
|
+
const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
3544
|
+
const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
3535
3545
|
const instruction = getSwapExactInInstruction(
|
|
3536
3546
|
{
|
|
3537
3547
|
config,
|
|
@@ -3544,12 +3554,12 @@ function createSwapInstruction(params) {
|
|
|
3544
3554
|
userIn,
|
|
3545
3555
|
userOut,
|
|
3546
3556
|
trader,
|
|
3547
|
-
token0Program: token0Program ?? tokenProgram ??
|
|
3548
|
-
token1Program: token1Program ?? tokenProgram ??
|
|
3557
|
+
token0Program: token0Program ?? tokenProgram ?? chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
3558
|
+
token1Program: token1Program ?? tokenProgram ?? chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
3549
3559
|
oracle,
|
|
3550
3560
|
amountIn,
|
|
3551
3561
|
minAmountOut,
|
|
3552
|
-
|
|
3562
|
+
tradeDirection,
|
|
3553
3563
|
updateOracle
|
|
3554
3564
|
},
|
|
3555
3565
|
{ programAddress: programId }
|
|
@@ -3573,8 +3583,8 @@ function base64ToBytes(base64) {
|
|
|
3573
3583
|
}
|
|
3574
3584
|
return bytes;
|
|
3575
3585
|
}
|
|
3576
|
-
async function fetchConfig(rpc, programId =
|
|
3577
|
-
const [configAddress] = await
|
|
3586
|
+
async function fetchConfig(rpc, programId = chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
3587
|
+
const [configAddress] = await chunk3BW6IVP3_cjs.getConfigAddress(programId);
|
|
3578
3588
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
3579
3589
|
encoding: "base64",
|
|
3580
3590
|
commitment
|
|
@@ -3582,10 +3592,10 @@ async function fetchConfig(rpc, programId = chunkAT33RY6T_cjs.CPMM_PROGRAM_ID, c
|
|
|
3582
3592
|
if (!response.value) {
|
|
3583
3593
|
return null;
|
|
3584
3594
|
}
|
|
3585
|
-
return
|
|
3595
|
+
return chunkW5TMS4RD_cjs.decodeAmmConfig(base64ToBytes(response.value.data[0]));
|
|
3586
3596
|
}
|
|
3587
|
-
async function fetchConfigWithAddress(rpc, programId =
|
|
3588
|
-
const [configAddress] = await
|
|
3597
|
+
async function fetchConfigWithAddress(rpc, programId = chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
3598
|
+
const [configAddress] = await chunk3BW6IVP3_cjs.getConfigAddress(programId);
|
|
3589
3599
|
const account = await fetchConfig(rpc, programId, commitment);
|
|
3590
3600
|
if (!account) {
|
|
3591
3601
|
return null;
|
|
@@ -3597,33 +3607,35 @@ async function fetchConfigWithAddress(rpc, programId = chunkAT33RY6T_cjs.CPMM_PR
|
|
|
3597
3607
|
var initializer_exports = {};
|
|
3598
3608
|
chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
3599
3609
|
BPF_LOADER_UPGRADEABLE_PROGRAM_ID: () => BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
|
|
3600
|
-
|
|
3610
|
+
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
3601
3611
|
CURVE_KIND_XYK: () => CURVE_KIND_XYK,
|
|
3602
3612
|
CURVE_PARAMS_FORMAT_XYK_V0: () => CURVE_PARAMS_FORMAT_XYK_V0,
|
|
3603
|
-
|
|
3604
|
-
DIRECTION_SELL: () => DIRECTION_SELL,
|
|
3605
|
-
DOPPLER_DEVNET_ALT: () => DOPPLER_DEVNET_ALT,
|
|
3613
|
+
DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND: () => DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND,
|
|
3606
3614
|
EMPTY_REMAINING_ACCOUNTS_HASH: () => EMPTY_REMAINING_ACCOUNTS_HASH,
|
|
3615
|
+
HF_AFTER_CREATE: () => HF_AFTER_CREATE,
|
|
3616
|
+
HF_AFTER_MIGRATE: () => HF_AFTER_MIGRATE,
|
|
3617
|
+
HF_AFTER_SWAP: () => HF_AFTER_SWAP2,
|
|
3618
|
+
HF_BEFORE_CREATE: () => HF_BEFORE_CREATE,
|
|
3619
|
+
HF_BEFORE_MIGRATE: () => HF_BEFORE_MIGRATE,
|
|
3620
|
+
HF_BEFORE_SWAP: () => HF_BEFORE_SWAP2,
|
|
3621
|
+
HOOK_NO_CHANGE: () => HOOK_NO_CHANGE2,
|
|
3607
3622
|
INITIALIZER_ACCOUNT_DISCRIMINATORS: () => INITIALIZER_ACCOUNT_DISCRIMINATORS,
|
|
3608
3623
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS: () => INITIALIZER_INSTRUCTION_DISCRIMINATORS,
|
|
3609
3624
|
INITIALIZER_PROGRAM_ID: () => INITIALIZER_PROGRAM_ID,
|
|
3610
|
-
|
|
3625
|
+
MAX_HOOK_ALLOWLIST: () => MAX_HOOK_ALLOWLIST2,
|
|
3611
3626
|
MAX_MIGRATOR_ALLOWLIST: () => MAX_MIGRATOR_ALLOWLIST,
|
|
3612
|
-
|
|
3627
|
+
MAX_PAYLOAD: () => MAX_PAYLOAD,
|
|
3613
3628
|
PHASE_ABORTED: () => PHASE_ABORTED,
|
|
3614
3629
|
PHASE_MIGRATED: () => PHASE_MIGRATED,
|
|
3615
3630
|
PHASE_TRADING: () => PHASE_TRADING,
|
|
3616
|
-
|
|
3631
|
+
PREDICTION_HOOK_PROGRAM_ID: () => PREDICTION_HOOK_PROGRAM_ID,
|
|
3617
3632
|
SEED_CONFIG: () => SEED_CONFIG2,
|
|
3618
3633
|
SEED_LAUNCH: () => SEED_LAUNCH,
|
|
3619
3634
|
SEED_LAUNCH_AUTHORITY: () => SEED_LAUNCH_AUTHORITY,
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
SF_BEFORE_CREATE: () => SF_BEFORE_CREATE,
|
|
3625
|
-
SF_BEFORE_MIGRATE: () => SF_BEFORE_MIGRATE,
|
|
3626
|
-
SF_BEFORE_SWAP: () => SF_BEFORE_SWAP2,
|
|
3635
|
+
TRADE_DIRECTION_BUY: () => TRADE_DIRECTION_BUY,
|
|
3636
|
+
TRADE_DIRECTION_SELL: () => TRADE_DIRECTION_SELL,
|
|
3637
|
+
buildAddressLookupTableSetupInstructions: () => buildAddressLookupTableSetupInstructions,
|
|
3638
|
+
compressTransactionMessageWithLookupTable: () => compressTransactionMessageWithLookupTable,
|
|
3627
3639
|
computeRemainingAccountsHash: () => computeRemainingAccountsHash,
|
|
3628
3640
|
createCurveSwapExactInInstruction: () => createCurveSwapExactInInstruction,
|
|
3629
3641
|
createInitializeConfigInstruction: () => createInitializeConfigInstruction,
|
|
@@ -3631,8 +3643,8 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
3631
3643
|
createMigrateLaunchInstruction: () => createMigrateLaunchInstruction,
|
|
3632
3644
|
createPreviewMigrationInstruction: () => createPreviewMigrationInstruction,
|
|
3633
3645
|
createPreviewSwapExactInInstruction: () => createPreviewSwapExactInInstruction,
|
|
3646
|
+
createSetHookAllowlistInstruction: () => createSetHookAllowlistInstruction,
|
|
3634
3647
|
createSetMigratorAllowlistInstruction: () => createSetMigratorAllowlistInstruction,
|
|
3635
|
-
createSetSentinelAllowlistInstruction: () => createSetSentinelAllowlistInstruction,
|
|
3636
3648
|
decodePreviewMigrationResult: () => decodePreviewMigrationResult,
|
|
3637
3649
|
decodePreviewSwapExactInResult: () => decodePreviewSwapExactInResult,
|
|
3638
3650
|
encodeU64LE: () => encodeU64LE,
|
|
@@ -3649,6 +3661,7 @@ chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
|
3649
3661
|
getInitializeLaunchArgsCodec: () => getInitializeLaunchArgsCodec,
|
|
3650
3662
|
getInitializeLaunchArgsDecoder: () => getInitializeLaunchArgsDecoder,
|
|
3651
3663
|
getInitializeLaunchArgsEncoder: () => getInitializeLaunchArgsEncoder,
|
|
3664
|
+
getInstructionLookupTableAddresses: () => getInstructionLookupTableAddresses,
|
|
3652
3665
|
getLaunchAddress: () => getLaunchAddress,
|
|
3653
3666
|
getLaunchAuthorityAddress: () => getLaunchAuthorityAddress,
|
|
3654
3667
|
getLaunchCodec: () => getLaunchCodec,
|
|
@@ -3666,10 +3679,10 @@ var INITIALIZER_PROGRAM_ID = kit.address(
|
|
|
3666
3679
|
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = kit.address(
|
|
3667
3680
|
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
3668
3681
|
);
|
|
3669
|
-
var
|
|
3682
|
+
var CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
3670
3683
|
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
3671
3684
|
);
|
|
3672
|
-
var
|
|
3685
|
+
var PREDICTION_HOOK_PROGRAM_ID = kit.address(
|
|
3673
3686
|
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
3674
3687
|
);
|
|
3675
3688
|
var SEED_CONFIG2 = "config";
|
|
@@ -3709,26 +3722,23 @@ var EMPTY_REMAINING_ACCOUNTS_HASH = new Uint8Array([
|
|
|
3709
3722
|
36,
|
|
3710
3723
|
76
|
|
3711
3724
|
]);
|
|
3712
|
-
var DOPPLER_DEVNET_ALT = kit.address(
|
|
3713
|
-
"7r5rdLkGMzTq5Q2kBhkePw4ZTeZEooHgTXktYoamNmVq"
|
|
3714
|
-
);
|
|
3715
3725
|
var MAX_MIGRATOR_ALLOWLIST = 32;
|
|
3716
|
-
var
|
|
3717
|
-
var
|
|
3726
|
+
var MAX_HOOK_ALLOWLIST2 = 32;
|
|
3727
|
+
var MAX_PAYLOAD = 256;
|
|
3718
3728
|
var PHASE_TRADING = 0;
|
|
3719
3729
|
var PHASE_MIGRATED = 1;
|
|
3720
3730
|
var PHASE_ABORTED = 2;
|
|
3721
|
-
var
|
|
3722
|
-
var
|
|
3731
|
+
var TRADE_DIRECTION_BUY = 0;
|
|
3732
|
+
var TRADE_DIRECTION_SELL = 1;
|
|
3723
3733
|
var CURVE_KIND_XYK = 0;
|
|
3724
3734
|
var CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
3725
|
-
var
|
|
3726
|
-
var
|
|
3727
|
-
var
|
|
3728
|
-
var
|
|
3729
|
-
var
|
|
3730
|
-
var
|
|
3731
|
-
var
|
|
3735
|
+
var HF_BEFORE_SWAP2 = 1 << 0;
|
|
3736
|
+
var HF_AFTER_SWAP2 = 1 << 1;
|
|
3737
|
+
var HF_BEFORE_CREATE = 1 << 2;
|
|
3738
|
+
var HF_AFTER_CREATE = 1 << 3;
|
|
3739
|
+
var HF_BEFORE_MIGRATE = 1 << 4;
|
|
3740
|
+
var HF_AFTER_MIGRATE = 1 << 5;
|
|
3741
|
+
var HOOK_NO_CHANGE2 = 65535;
|
|
3732
3742
|
var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
3733
3743
|
// SHA256("global:initialize_config")[0:8]
|
|
3734
3744
|
initializeConfig: new Uint8Array([
|
|
@@ -3752,16 +3762,16 @@ var INITIALIZER_INSTRUCTION_DISCRIMINATORS = {
|
|
|
3752
3762
|
233,
|
|
3753
3763
|
168
|
|
3754
3764
|
]),
|
|
3755
|
-
// SHA256("global:
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
+
// SHA256("global:set_hook_allowlist")[0:8]
|
|
3766
|
+
setHookAllowlist: new Uint8Array([
|
|
3767
|
+
232,
|
|
3768
|
+
28,
|
|
3769
|
+
40,
|
|
3770
|
+
143,
|
|
3771
|
+
121,
|
|
3772
|
+
182,
|
|
3773
|
+
77,
|
|
3774
|
+
103
|
|
3765
3775
|
]),
|
|
3766
3776
|
// SHA256("global:initialize_launch")[0:8]
|
|
3767
3777
|
initializeLaunch: new Uint8Array([
|
|
@@ -3842,8 +3852,8 @@ function getInitConfigEncoder() {
|
|
|
3842
3852
|
["admin", kit.getAddressEncoder()],
|
|
3843
3853
|
["migratorAllowlistLen", kit.getU8Encoder()],
|
|
3844
3854
|
["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder(), { size: 32 })],
|
|
3845
|
-
["
|
|
3846
|
-
["
|
|
3855
|
+
["hookAllowlistLen", kit.getU8Encoder()],
|
|
3856
|
+
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder(), { size: 32 })],
|
|
3847
3857
|
["bump", kit.getU8Encoder()],
|
|
3848
3858
|
["version", kit.getU8Encoder()],
|
|
3849
3859
|
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 31)]
|
|
@@ -3857,8 +3867,8 @@ function getInitConfigDecoder() {
|
|
|
3857
3867
|
["admin", kit.getAddressDecoder()],
|
|
3858
3868
|
["migratorAllowlistLen", kit.getU8Decoder()],
|
|
3859
3869
|
["migratorAllowlist", kit.getArrayDecoder(kit.getAddressDecoder(), { size: 32 })],
|
|
3860
|
-
["
|
|
3861
|
-
["
|
|
3870
|
+
["hookAllowlistLen", kit.getU8Decoder()],
|
|
3871
|
+
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder(), { size: 32 })],
|
|
3862
3872
|
["bump", kit.getU8Decoder()],
|
|
3863
3873
|
["version", kit.getU8Decoder()],
|
|
3864
3874
|
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 31)]
|
|
@@ -3867,28 +3877,16 @@ function getInitConfigDecoder() {
|
|
|
3867
3877
|
function getInitConfigCodec() {
|
|
3868
3878
|
return kit.combineCodec(getInitConfigEncoder(), getInitConfigDecoder());
|
|
3869
3879
|
}
|
|
3870
|
-
function getCalldataBufEncoder() {
|
|
3871
|
-
return kit.getStructEncoder([
|
|
3872
|
-
["len", kit.getU16Encoder()],
|
|
3873
|
-
["bytes", kit.fixEncoderSize(kit.getBytesEncoder(), 256)]
|
|
3874
|
-
]);
|
|
3875
|
-
}
|
|
3876
|
-
function getCalldataBufDecoder() {
|
|
3877
|
-
return kit.getStructDecoder([
|
|
3878
|
-
["len", kit.getU16Decoder()],
|
|
3879
|
-
["bytes", kit.fixDecoderSize(kit.getBytesDecoder(), 256)]
|
|
3880
|
-
]);
|
|
3881
|
-
}
|
|
3882
3880
|
function getInitializeConfigArgsEncoder() {
|
|
3883
3881
|
return kit.getStructEncoder([
|
|
3884
3882
|
["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())],
|
|
3885
|
-
["
|
|
3883
|
+
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
3886
3884
|
]);
|
|
3887
3885
|
}
|
|
3888
3886
|
function getInitializeConfigArgsDecoder() {
|
|
3889
3887
|
return kit.getStructDecoder([
|
|
3890
3888
|
["migratorAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())],
|
|
3891
|
-
["
|
|
3889
|
+
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
3892
3890
|
]);
|
|
3893
3891
|
}
|
|
3894
3892
|
function getInitializeConfigArgsCodec() {
|
|
@@ -3912,27 +3910,21 @@ function getInitializeLaunchArgsEncoder() {
|
|
|
3912
3910
|
["curveParams", kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())],
|
|
3913
3911
|
["allowBuy", kit.getU8Encoder()],
|
|
3914
3912
|
["allowSell", kit.getU8Encoder()],
|
|
3915
|
-
["
|
|
3916
|
-
["
|
|
3917
|
-
[
|
|
3918
|
-
|
|
3919
|
-
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
3920
|
-
],
|
|
3921
|
-
["sentinelCreateRemainingAccountsLen", kit.getU32Encoder()],
|
|
3913
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
3914
|
+
["hookFlags", kit.getU32Encoder()],
|
|
3915
|
+
["hookPayload", kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())],
|
|
3916
|
+
["hookCreateRemainingAccountsLen", kit.getU32Encoder()],
|
|
3922
3917
|
["migratorProgram", kit.getAddressEncoder()],
|
|
3923
3918
|
[
|
|
3924
|
-
"
|
|
3919
|
+
"migratorInitPayload",
|
|
3925
3920
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
3926
3921
|
],
|
|
3927
3922
|
[
|
|
3928
|
-
"
|
|
3923
|
+
"migratorMigratePayload",
|
|
3929
3924
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
3930
3925
|
],
|
|
3931
|
-
[
|
|
3932
|
-
|
|
3933
|
-
kit.fixEncoderSize(kit.getBytesEncoder(), 32)
|
|
3934
|
-
],
|
|
3935
|
-
["sentinelRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
3926
|
+
["hookCreateRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
3927
|
+
["hookRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
3936
3928
|
[
|
|
3937
3929
|
"migratorInitRemainingAccountsHash",
|
|
3938
3930
|
kit.fixEncoderSize(kit.getBytesEncoder(), 32)
|
|
@@ -3958,27 +3950,21 @@ function getInitializeLaunchArgsDecoder() {
|
|
|
3958
3950
|
["curveParams", kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())],
|
|
3959
3951
|
["allowBuy", kit.getU8Decoder()],
|
|
3960
3952
|
["allowSell", kit.getU8Decoder()],
|
|
3961
|
-
["
|
|
3962
|
-
["
|
|
3963
|
-
[
|
|
3964
|
-
|
|
3965
|
-
kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())
|
|
3966
|
-
],
|
|
3967
|
-
["sentinelCreateRemainingAccountsLen", kit.getU32Decoder()],
|
|
3953
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
3954
|
+
["hookFlags", kit.getU32Decoder()],
|
|
3955
|
+
["hookPayload", kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())],
|
|
3956
|
+
["hookCreateRemainingAccountsLen", kit.getU32Decoder()],
|
|
3968
3957
|
["migratorProgram", kit.getAddressDecoder()],
|
|
3969
3958
|
[
|
|
3970
|
-
"
|
|
3959
|
+
"migratorInitPayload",
|
|
3971
3960
|
kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())
|
|
3972
3961
|
],
|
|
3973
3962
|
[
|
|
3974
|
-
"
|
|
3963
|
+
"migratorMigratePayload",
|
|
3975
3964
|
kit.addDecoderSizePrefix(kit.getBytesDecoder(), kit.getU32Decoder())
|
|
3976
3965
|
],
|
|
3977
|
-
[
|
|
3978
|
-
|
|
3979
|
-
kit.fixDecoderSize(kit.getBytesDecoder(), 32)
|
|
3980
|
-
],
|
|
3981
|
-
["sentinelRemainingAccountsHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
3966
|
+
["hookCreateRemainingAccountsHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
3967
|
+
["hookRemainingAccountsHash", kit.fixDecoderSize(kit.getBytesDecoder(), 32)],
|
|
3982
3968
|
[
|
|
3983
3969
|
"migratorInitRemainingAccountsHash",
|
|
3984
3970
|
kit.fixDecoderSize(kit.getBytesDecoder(), 32)
|
|
@@ -3995,6 +3981,18 @@ function getInitializeLaunchArgsCodec() {
|
|
|
3995
3981
|
getInitializeLaunchArgsDecoder()
|
|
3996
3982
|
);
|
|
3997
3983
|
}
|
|
3984
|
+
function getPayloadBufEncoder() {
|
|
3985
|
+
return kit.getStructEncoder([
|
|
3986
|
+
["len", kit.getU16Encoder()],
|
|
3987
|
+
["bytes", kit.fixEncoderSize(kit.getBytesEncoder(), 256)]
|
|
3988
|
+
]);
|
|
3989
|
+
}
|
|
3990
|
+
function getPayloadBufDecoder() {
|
|
3991
|
+
return kit.getStructDecoder([
|
|
3992
|
+
["len", kit.getU16Decoder()],
|
|
3993
|
+
["bytes", kit.fixDecoderSize(kit.getBytesDecoder(), 256)]
|
|
3994
|
+
]);
|
|
3995
|
+
}
|
|
3998
3996
|
|
|
3999
3997
|
// src/solana/generated/initializer/accounts/launch.ts
|
|
4000
3998
|
var LAUNCH_DISCRIMINATOR = new Uint8Array([
|
|
@@ -4033,17 +4031,17 @@ function getLaunchEncoder() {
|
|
|
4033
4031
|
["allowBuy", kit.getU8Encoder()],
|
|
4034
4032
|
["allowSell", kit.getU8Encoder()],
|
|
4035
4033
|
["pad2", kit.fixEncoderSize(kit.getBytesEncoder(), 6)],
|
|
4036
|
-
["
|
|
4037
|
-
["
|
|
4034
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
4035
|
+
["hookFlags", kit.getU32Encoder()],
|
|
4038
4036
|
["pad3", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
4039
|
-
["
|
|
4037
|
+
["hookPayload", getPayloadBufEncoder()],
|
|
4040
4038
|
["migratorProgram", kit.getAddressEncoder()],
|
|
4041
|
-
["
|
|
4042
|
-
["
|
|
4039
|
+
["migratorInitPayload", getPayloadBufEncoder()],
|
|
4040
|
+
["migratorMigratePayload", getPayloadBufEncoder()],
|
|
4043
4041
|
["curveKind", kit.getU8Encoder()],
|
|
4044
4042
|
["swapLock", kit.getU8Encoder()],
|
|
4045
4043
|
["pad4", kit.fixEncoderSize(kit.getBytesEncoder(), 6)],
|
|
4046
|
-
["curveParams",
|
|
4044
|
+
["curveParams", getPayloadBufEncoder()],
|
|
4047
4045
|
["quoteDeposited", kit.getU64Encoder()],
|
|
4048
4046
|
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 64)]
|
|
4049
4047
|
]),
|
|
@@ -4075,17 +4073,17 @@ function getLaunchDecoder() {
|
|
|
4075
4073
|
["allowBuy", kit.getU8Decoder()],
|
|
4076
4074
|
["allowSell", kit.getU8Decoder()],
|
|
4077
4075
|
["pad2", kit.fixDecoderSize(kit.getBytesDecoder(), 6)],
|
|
4078
|
-
["
|
|
4079
|
-
["
|
|
4076
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
4077
|
+
["hookFlags", kit.getU32Decoder()],
|
|
4080
4078
|
["pad3", kit.fixDecoderSize(kit.getBytesDecoder(), 4)],
|
|
4081
|
-
["
|
|
4079
|
+
["hookPayload", getPayloadBufDecoder()],
|
|
4082
4080
|
["migratorProgram", kit.getAddressDecoder()],
|
|
4083
|
-
["
|
|
4084
|
-
["
|
|
4081
|
+
["migratorInitPayload", getPayloadBufDecoder()],
|
|
4082
|
+
["migratorMigratePayload", getPayloadBufDecoder()],
|
|
4085
4083
|
["curveKind", kit.getU8Decoder()],
|
|
4086
4084
|
["swapLock", kit.getU8Decoder()],
|
|
4087
4085
|
["pad4", kit.fixDecoderSize(kit.getBytesDecoder(), 6)],
|
|
4088
|
-
["curveParams",
|
|
4086
|
+
["curveParams", getPayloadBufDecoder()],
|
|
4089
4087
|
["quoteDeposited", kit.getU64Decoder()],
|
|
4090
4088
|
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 64)]
|
|
4091
4089
|
]);
|
|
@@ -4109,7 +4107,7 @@ function getCurveSwapExactInInstructionDataEncoder() {
|
|
|
4109
4107
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4110
4108
|
["amountIn", kit.getU64Encoder()],
|
|
4111
4109
|
["minAmountOut", kit.getU64Encoder()],
|
|
4112
|
-
["
|
|
4110
|
+
["tradeDirection", kit.getU8Encoder()]
|
|
4113
4111
|
]),
|
|
4114
4112
|
(value) => ({ ...value, discriminator: CURVE_SWAP_EXACT_IN_DISCRIMINATOR })
|
|
4115
4113
|
);
|
|
@@ -4129,7 +4127,7 @@ function getInitializeConfigInstructionDataEncoder2() {
|
|
|
4129
4127
|
kit.getStructEncoder([
|
|
4130
4128
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4131
4129
|
["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())],
|
|
4132
|
-
["
|
|
4130
|
+
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
4133
4131
|
]),
|
|
4134
4132
|
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR2 })
|
|
4135
4133
|
);
|
|
@@ -4161,27 +4159,24 @@ function getInitializeLaunchInstructionDataEncoder() {
|
|
|
4161
4159
|
["curveParams", kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())],
|
|
4162
4160
|
["allowBuy", kit.getU8Encoder()],
|
|
4163
4161
|
["allowSell", kit.getU8Encoder()],
|
|
4164
|
-
["
|
|
4165
|
-
["
|
|
4166
|
-
[
|
|
4167
|
-
|
|
4168
|
-
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
4169
|
-
],
|
|
4170
|
-
["sentinelCreateRemainingAccountsLen", kit.getU32Encoder()],
|
|
4162
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
4163
|
+
["hookFlags", kit.getU32Encoder()],
|
|
4164
|
+
["hookPayload", kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())],
|
|
4165
|
+
["hookCreateRemainingAccountsLen", kit.getU32Encoder()],
|
|
4171
4166
|
["migratorProgram", kit.getAddressEncoder()],
|
|
4172
4167
|
[
|
|
4173
|
-
"
|
|
4168
|
+
"migratorInitPayload",
|
|
4174
4169
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
4175
4170
|
],
|
|
4176
4171
|
[
|
|
4177
|
-
"
|
|
4172
|
+
"migratorMigratePayload",
|
|
4178
4173
|
kit.addEncoderSizePrefix(kit.getBytesEncoder(), kit.getU32Encoder())
|
|
4179
4174
|
],
|
|
4180
4175
|
[
|
|
4181
|
-
"
|
|
4176
|
+
"hookCreateRemainingAccountsHash",
|
|
4182
4177
|
kit.fixEncoderSize(kit.getBytesEncoder(), 32)
|
|
4183
4178
|
],
|
|
4184
|
-
["
|
|
4179
|
+
["hookRemainingAccountsHash", kit.fixEncoderSize(kit.getBytesEncoder(), 32)],
|
|
4185
4180
|
[
|
|
4186
4181
|
"migratorInitRemainingAccountsHash",
|
|
4187
4182
|
kit.fixEncoderSize(kit.getBytesEncoder(), 32)
|
|
@@ -4212,7 +4207,7 @@ function getPreviewSwapExactInInstructionDataEncoder2() {
|
|
|
4212
4207
|
kit.getStructEncoder([
|
|
4213
4208
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4214
4209
|
["amountIn", kit.getU64Encoder()],
|
|
4215
|
-
["
|
|
4210
|
+
["tradeDirection", kit.getU8Encoder()]
|
|
4216
4211
|
]),
|
|
4217
4212
|
(value) => ({
|
|
4218
4213
|
...value,
|
|
@@ -4220,6 +4215,25 @@ function getPreviewSwapExactInInstructionDataEncoder2() {
|
|
|
4220
4215
|
})
|
|
4221
4216
|
);
|
|
4222
4217
|
}
|
|
4218
|
+
var SET_HOOK_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
|
|
4219
|
+
232,
|
|
4220
|
+
28,
|
|
4221
|
+
40,
|
|
4222
|
+
143,
|
|
4223
|
+
121,
|
|
4224
|
+
182,
|
|
4225
|
+
77,
|
|
4226
|
+
103
|
|
4227
|
+
]);
|
|
4228
|
+
function getSetHookAllowlistInstructionDataEncoder() {
|
|
4229
|
+
return kit.transformEncoder(
|
|
4230
|
+
kit.getStructEncoder([
|
|
4231
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4232
|
+
["allowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
4233
|
+
]),
|
|
4234
|
+
(value) => ({ ...value, discriminator: SET_HOOK_ALLOWLIST_DISCRIMINATOR })
|
|
4235
|
+
);
|
|
4236
|
+
}
|
|
4223
4237
|
var SET_MIGRATOR_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
|
|
4224
4238
|
209,
|
|
4225
4239
|
90,
|
|
@@ -4242,28 +4256,6 @@ function getSetMigratorAllowlistInstructionDataEncoder() {
|
|
|
4242
4256
|
})
|
|
4243
4257
|
);
|
|
4244
4258
|
}
|
|
4245
|
-
var SET_SENTINEL_ALLOWLIST_DISCRIMINATOR = new Uint8Array([
|
|
4246
|
-
233,
|
|
4247
|
-
72,
|
|
4248
|
-
180,
|
|
4249
|
-
246,
|
|
4250
|
-
171,
|
|
4251
|
-
117,
|
|
4252
|
-
21,
|
|
4253
|
-
50
|
|
4254
|
-
]);
|
|
4255
|
-
function getSetSentinelAllowlistInstructionDataEncoder() {
|
|
4256
|
-
return kit.transformEncoder(
|
|
4257
|
-
kit.getStructEncoder([
|
|
4258
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
4259
|
-
["allowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
4260
|
-
]),
|
|
4261
|
-
(value) => ({
|
|
4262
|
-
...value,
|
|
4263
|
-
discriminator: SET_SENTINEL_ALLOWLIST_DISCRIMINATOR
|
|
4264
|
-
})
|
|
4265
|
-
);
|
|
4266
|
-
}
|
|
4267
4259
|
if (process.env.NODE_ENV !== "production") ;
|
|
4268
4260
|
var addressCodec2 = kit.getAddressCodec();
|
|
4269
4261
|
var textEncoder2 = new TextEncoder();
|
|
@@ -4326,7 +4318,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
4326
4318
|
admin,
|
|
4327
4319
|
config,
|
|
4328
4320
|
programData,
|
|
4329
|
-
systemProgram =
|
|
4321
|
+
systemProgram = chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
4330
4322
|
} = accounts;
|
|
4331
4323
|
const keys = [
|
|
4332
4324
|
createSignerAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
@@ -4368,14 +4360,14 @@ function createSignerAccountMeta3(value, role) {
|
|
|
4368
4360
|
}
|
|
4369
4361
|
return { address: value, role };
|
|
4370
4362
|
}
|
|
4371
|
-
function
|
|
4363
|
+
function createSetHookAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
4372
4364
|
const { admin, config } = accounts;
|
|
4373
4365
|
const keys = [
|
|
4374
4366
|
createSignerAccountMeta3(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
4375
4367
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
4376
4368
|
];
|
|
4377
4369
|
const data = new Uint8Array(
|
|
4378
|
-
|
|
4370
|
+
getSetHookAllowlistInstructionDataEncoder().encode({ allowlist })
|
|
4379
4371
|
);
|
|
4380
4372
|
return { programAddress: programId, accounts: keys, data };
|
|
4381
4373
|
}
|
|
@@ -4676,21 +4668,6 @@ function getAccumulatorUpdatedCodec() {
|
|
|
4676
4668
|
getAccumulatorUpdatedDecoder()
|
|
4677
4669
|
);
|
|
4678
4670
|
}
|
|
4679
|
-
function getCalldataBufEncoder2() {
|
|
4680
|
-
return kit.getStructEncoder([
|
|
4681
|
-
["len", kit.getU16Encoder()],
|
|
4682
|
-
["bytes", kit.fixEncoderSize(kit.getBytesEncoder(), 256)]
|
|
4683
|
-
]);
|
|
4684
|
-
}
|
|
4685
|
-
function getCalldataBufDecoder2() {
|
|
4686
|
-
return kit.getStructDecoder([
|
|
4687
|
-
["len", kit.getU16Decoder()],
|
|
4688
|
-
["bytes", kit.fixDecoderSize(kit.getBytesDecoder(), 256)]
|
|
4689
|
-
]);
|
|
4690
|
-
}
|
|
4691
|
-
function getCalldataBufCodec() {
|
|
4692
|
-
return kit.combineCodec(getCalldataBufEncoder2(), getCalldataBufDecoder2());
|
|
4693
|
-
}
|
|
4694
4671
|
function getEntryMigratedEncoder() {
|
|
4695
4672
|
return kit.getStructEncoder([
|
|
4696
4673
|
["market", kit.getAddressEncoder()],
|
|
@@ -4783,6 +4760,21 @@ function getMigrateEntryArgsCodec() {
|
|
|
4783
4760
|
getMigrateEntryArgsDecoder()
|
|
4784
4761
|
);
|
|
4785
4762
|
}
|
|
4763
|
+
function getPayloadBufEncoder2() {
|
|
4764
|
+
return kit.getStructEncoder([
|
|
4765
|
+
["len", kit.getU16Encoder()],
|
|
4766
|
+
["bytes", kit.fixEncoderSize(kit.getBytesEncoder(), 256)]
|
|
4767
|
+
]);
|
|
4768
|
+
}
|
|
4769
|
+
function getPayloadBufDecoder2() {
|
|
4770
|
+
return kit.getStructDecoder([
|
|
4771
|
+
["len", kit.getU16Decoder()],
|
|
4772
|
+
["bytes", kit.fixDecoderSize(kit.getBytesDecoder(), 256)]
|
|
4773
|
+
]);
|
|
4774
|
+
}
|
|
4775
|
+
function getPayloadBufCodec() {
|
|
4776
|
+
return kit.combineCodec(getPayloadBufEncoder2(), getPayloadBufDecoder2());
|
|
4777
|
+
}
|
|
4786
4778
|
function getPreviewPayoutIfWinnerArgsEncoder() {
|
|
4787
4779
|
return kit.getStructEncoder([
|
|
4788
4780
|
["candidateWinnerMint", kit.getAddressEncoder()],
|
|
@@ -4875,17 +4867,17 @@ function getLaunchEncoder2() {
|
|
|
4875
4867
|
["allowBuy", kit.getU8Encoder()],
|
|
4876
4868
|
["allowSell", kit.getU8Encoder()],
|
|
4877
4869
|
["pad2", kit.fixEncoderSize(kit.getBytesEncoder(), 6)],
|
|
4878
|
-
["
|
|
4879
|
-
["
|
|
4870
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
4871
|
+
["hookFlags", kit.getU32Encoder()],
|
|
4880
4872
|
["pad3", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
4881
|
-
["
|
|
4873
|
+
["hookPayload", getPayloadBufEncoder2()],
|
|
4882
4874
|
["migratorProgram", kit.getAddressEncoder()],
|
|
4883
|
-
["
|
|
4884
|
-
["
|
|
4875
|
+
["migratorInitPayload", getPayloadBufEncoder2()],
|
|
4876
|
+
["migratorMigratePayload", getPayloadBufEncoder2()],
|
|
4885
4877
|
["curveKind", kit.getU8Encoder()],
|
|
4886
4878
|
["swapLock", kit.getU8Encoder()],
|
|
4887
4879
|
["pad4", kit.fixEncoderSize(kit.getBytesEncoder(), 6)],
|
|
4888
|
-
["curveParams",
|
|
4880
|
+
["curveParams", getPayloadBufEncoder2()],
|
|
4889
4881
|
["quoteDeposited", kit.getU64Encoder()],
|
|
4890
4882
|
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 64)]
|
|
4891
4883
|
]),
|
|
@@ -4917,17 +4909,17 @@ function getLaunchDecoder2() {
|
|
|
4917
4909
|
["allowBuy", kit.getU8Decoder()],
|
|
4918
4910
|
["allowSell", kit.getU8Decoder()],
|
|
4919
4911
|
["pad2", kit.fixDecoderSize(kit.getBytesDecoder(), 6)],
|
|
4920
|
-
["
|
|
4921
|
-
["
|
|
4912
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
4913
|
+
["hookFlags", kit.getU32Decoder()],
|
|
4922
4914
|
["pad3", kit.fixDecoderSize(kit.getBytesDecoder(), 4)],
|
|
4923
|
-
["
|
|
4915
|
+
["hookPayload", getPayloadBufDecoder2()],
|
|
4924
4916
|
["migratorProgram", kit.getAddressDecoder()],
|
|
4925
|
-
["
|
|
4926
|
-
["
|
|
4917
|
+
["migratorInitPayload", getPayloadBufDecoder2()],
|
|
4918
|
+
["migratorMigratePayload", getPayloadBufDecoder2()],
|
|
4927
4919
|
["curveKind", kit.getU8Decoder()],
|
|
4928
4920
|
["swapLock", kit.getU8Decoder()],
|
|
4929
4921
|
["pad4", kit.fixDecoderSize(kit.getBytesDecoder(), 6)],
|
|
4930
|
-
["curveParams",
|
|
4922
|
+
["curveParams", getPayloadBufDecoder2()],
|
|
4931
4923
|
["quoteDeposited", kit.getU64Decoder()],
|
|
4932
4924
|
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 64)]
|
|
4933
4925
|
]);
|
|
@@ -6384,26 +6376,15 @@ function createAccountMeta(value, role) {
|
|
|
6384
6376
|
async function getTokenMetadataAddress(mint) {
|
|
6385
6377
|
const encoder = kit.getAddressEncoder();
|
|
6386
6378
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
6387
|
-
programAddress:
|
|
6379
|
+
programAddress: chunk3BW6IVP3_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
6388
6380
|
seeds: [
|
|
6389
6381
|
new TextEncoder().encode("metadata"),
|
|
6390
|
-
encoder.encode(
|
|
6382
|
+
encoder.encode(chunk3BW6IVP3_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
6391
6383
|
encoder.encode(mint)
|
|
6392
6384
|
]
|
|
6393
6385
|
});
|
|
6394
6386
|
return metadataAddress;
|
|
6395
6387
|
}
|
|
6396
|
-
var ALT_INDEX = {
|
|
6397
|
-
[chunkAT33RY6T_cjs.TOKEN_PROGRAM_ADDRESS]: 0,
|
|
6398
|
-
[chunkAT33RY6T_cjs.SYSTEM_PROGRAM_ADDRESS]: 1,
|
|
6399
|
-
SysvarRent111111111111111111111111111111111: 2,
|
|
6400
|
-
[INITIALIZER_PROGRAM_ID]: 3,
|
|
6401
|
-
[chunkAT33RY6T_cjs.TOKEN_METADATA_PROGRAM_ID]: 4,
|
|
6402
|
-
[CPMM_MIGRATOR_PROGRAM_ID]: 5,
|
|
6403
|
-
So11111111111111111111111111111111111111112: 6,
|
|
6404
|
-
[PREDICTION_MIGRATOR_PROGRAM_ADDRESS]: 8,
|
|
6405
|
-
A9DojSvj32PMTTGctEcWZu9GSKuQVEhPkBXxDxmYu34o: 10
|
|
6406
|
-
};
|
|
6407
6388
|
function validateInitializeLaunchCurveParams(args) {
|
|
6408
6389
|
if (args.curveKind !== CURVE_KIND_XYK) {
|
|
6409
6390
|
throw new Error(
|
|
@@ -6426,16 +6407,15 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6426
6407
|
quoteVault,
|
|
6427
6408
|
payer,
|
|
6428
6409
|
authority,
|
|
6429
|
-
|
|
6410
|
+
hookProgram,
|
|
6430
6411
|
migratorProgram,
|
|
6431
|
-
baseTokenProgram =
|
|
6432
|
-
quoteTokenProgram =
|
|
6433
|
-
systemProgram =
|
|
6412
|
+
baseTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6413
|
+
quoteTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6414
|
+
systemProgram = chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6434
6415
|
rent,
|
|
6435
6416
|
metadataAccount,
|
|
6436
|
-
metadataProgram =
|
|
6437
|
-
|
|
6438
|
-
addressLookupTable: alt
|
|
6417
|
+
metadataProgram = chunk3BW6IVP3_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
6418
|
+
hookCreateRemainingAccounts = []
|
|
6439
6419
|
} = accounts;
|
|
6440
6420
|
const withMetadata = Boolean(
|
|
6441
6421
|
args.metadataName && args.metadataName.length > 0
|
|
@@ -6445,66 +6425,54 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6445
6425
|
"metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
|
|
6446
6426
|
);
|
|
6447
6427
|
}
|
|
6448
|
-
const createHooksEnabled = (args.
|
|
6449
|
-
const
|
|
6428
|
+
const createHooksEnabled = (args.hookFlags & (HF_BEFORE_CREATE | HF_AFTER_CREATE)) !== 0;
|
|
6429
|
+
const hookCreateRemainingAccountAddresses = hookCreateRemainingAccounts.map(
|
|
6450
6430
|
(account) => isTransactionSigner5(account) ? account.address : account
|
|
6451
6431
|
);
|
|
6452
|
-
const altIndexMap = alt ? ALT_INDEX : {};
|
|
6453
|
-
function staticOrLookup(addr, role) {
|
|
6454
|
-
if (alt && altIndexMap[addr] !== void 0) {
|
|
6455
|
-
return {
|
|
6456
|
-
address: addr,
|
|
6457
|
-
role,
|
|
6458
|
-
lookupTableAddress: alt,
|
|
6459
|
-
addressIndex: altIndexMap[addr]
|
|
6460
|
-
};
|
|
6461
|
-
}
|
|
6462
|
-
return { address: addr, role };
|
|
6463
|
-
}
|
|
6464
6432
|
const keys = [
|
|
6465
|
-
|
|
6433
|
+
{ address: config, role: kit.AccountRole.READONLY },
|
|
6466
6434
|
{ address: launch, role: kit.AccountRole.WRITABLE },
|
|
6467
6435
|
{ address: launchAuthority, role: kit.AccountRole.READONLY },
|
|
6468
6436
|
createAccountMeta(baseMint, kit.AccountRole.WRITABLE_SIGNER),
|
|
6469
|
-
|
|
6437
|
+
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
6470
6438
|
createAccountMeta(baseVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
6471
6439
|
createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
6472
6440
|
createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
6473
6441
|
];
|
|
6474
6442
|
keys.push(
|
|
6475
|
-
authority ? createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) :
|
|
6443
|
+
authority ? createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : { address: programId, role: kit.AccountRole.READONLY }
|
|
6476
6444
|
);
|
|
6477
6445
|
keys.push(
|
|
6478
|
-
|
|
6446
|
+
hookProgram ? { address: hookProgram, role: kit.AccountRole.READONLY } : { address: programId, role: kit.AccountRole.READONLY }
|
|
6479
6447
|
);
|
|
6480
6448
|
keys.push(
|
|
6481
|
-
migratorProgram ?
|
|
6449
|
+
migratorProgram ? { address: migratorProgram, role: kit.AccountRole.READONLY } : { address: programId, role: kit.AccountRole.READONLY }
|
|
6482
6450
|
);
|
|
6483
|
-
keys.push(
|
|
6484
|
-
keys.push(
|
|
6485
|
-
keys.push(
|
|
6486
|
-
keys.push(
|
|
6451
|
+
keys.push({ address: baseTokenProgram, role: kit.AccountRole.READONLY });
|
|
6452
|
+
keys.push({ address: quoteTokenProgram, role: kit.AccountRole.READONLY });
|
|
6453
|
+
keys.push({ address: systemProgram, role: kit.AccountRole.READONLY });
|
|
6454
|
+
keys.push({ address: rent, role: kit.AccountRole.READONLY });
|
|
6487
6455
|
if (withMetadata) {
|
|
6488
6456
|
keys.push({ address: metadataAccount, role: kit.AccountRole.WRITABLE });
|
|
6489
|
-
keys.push(
|
|
6457
|
+
keys.push({ address: metadataProgram, role: kit.AccountRole.READONLY });
|
|
6490
6458
|
} else {
|
|
6491
|
-
keys.push(
|
|
6492
|
-
keys.push(
|
|
6459
|
+
keys.push({ address: programId, role: kit.AccountRole.READONLY });
|
|
6460
|
+
keys.push({ address: programId, role: kit.AccountRole.READONLY });
|
|
6493
6461
|
}
|
|
6494
6462
|
const encoderArgs = {
|
|
6495
6463
|
...args,
|
|
6496
6464
|
allowBuy: args.allowBuy ? 1 : 0,
|
|
6497
6465
|
allowSell: args.allowSell ? 1 : 0,
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
migratorProgram: migratorProgram ??
|
|
6501
|
-
|
|
6466
|
+
hookProgram: args.hookProgram ?? hookProgram ?? chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6467
|
+
hookCreateRemainingAccountsLen: args.hookCreateRemainingAccountsLen ?? hookCreateRemainingAccounts.length,
|
|
6468
|
+
migratorProgram: migratorProgram ?? chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6469
|
+
hookCreateRemainingAccountsHash: args.hookCreateRemainingAccountsHash ?? (createHooksEnabled ? computeRemainingAccountsHash(hookCreateRemainingAccountAddresses) : new Uint8Array(32))
|
|
6502
6470
|
};
|
|
6503
6471
|
const data = new Uint8Array(
|
|
6504
6472
|
getInitializeLaunchInstructionDataEncoder().encode(encoderArgs)
|
|
6505
6473
|
);
|
|
6506
6474
|
keys.push(
|
|
6507
|
-
...
|
|
6475
|
+
...hookCreateRemainingAccounts.map(
|
|
6508
6476
|
(account) => createAccountMeta(
|
|
6509
6477
|
account,
|
|
6510
6478
|
isTransactionSigner5(account) ? kit.AccountRole.READONLY_SIGNER : kit.AccountRole.READONLY
|
|
@@ -6517,8 +6485,8 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
6517
6485
|
"cpmmConfig is required when migratorProgram is CPMM_MIGRATOR_PROGRAM_ID"
|
|
6518
6486
|
);
|
|
6519
6487
|
}
|
|
6520
|
-
const [
|
|
6521
|
-
keys.push({ address:
|
|
6488
|
+
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(launch);
|
|
6489
|
+
keys.push({ address: cpmmMigrationState, role: kit.AccountRole.WRITABLE });
|
|
6522
6490
|
keys.push({ address: accounts.cpmmConfig, role: kit.AccountRole.READONLY });
|
|
6523
6491
|
}
|
|
6524
6492
|
if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
@@ -6563,9 +6531,9 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6563
6531
|
baseMint,
|
|
6564
6532
|
quoteMint,
|
|
6565
6533
|
user,
|
|
6566
|
-
|
|
6567
|
-
baseTokenProgram =
|
|
6568
|
-
quoteTokenProgram =
|
|
6534
|
+
hookProgram = chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6535
|
+
baseTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6536
|
+
quoteTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS
|
|
6569
6537
|
} = accounts;
|
|
6570
6538
|
const keys = [
|
|
6571
6539
|
{ address: config, role: kit.AccountRole.READONLY },
|
|
@@ -6578,10 +6546,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
6578
6546
|
{ address: baseMint, role: kit.AccountRole.READONLY },
|
|
6579
6547
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
6580
6548
|
createAccountMeta2(user, kit.AccountRole.READONLY_SIGNER),
|
|
6581
|
-
//
|
|
6549
|
+
// hook_program is Optional in the on-chain struct but still occupies a fixed
|
|
6582
6550
|
// slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
|
|
6583
|
-
// no-op placeholder when no real
|
|
6584
|
-
{ address:
|
|
6551
|
+
// no-op placeholder when no real hook is configured.
|
|
6552
|
+
{ address: hookProgram, role: kit.AccountRole.READONLY },
|
|
6585
6553
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
6586
6554
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY }
|
|
6587
6555
|
];
|
|
@@ -6610,9 +6578,9 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6610
6578
|
quoteVault,
|
|
6611
6579
|
migratorProgram,
|
|
6612
6580
|
payer,
|
|
6613
|
-
baseTokenProgram =
|
|
6614
|
-
quoteTokenProgram =
|
|
6615
|
-
systemProgram =
|
|
6581
|
+
baseTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6582
|
+
quoteTokenProgram = chunk3BW6IVP3_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6583
|
+
systemProgram = chunk3BW6IVP3_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6616
6584
|
rent
|
|
6617
6585
|
} = accounts;
|
|
6618
6586
|
const keys = [
|
|
@@ -6630,7 +6598,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
6630
6598
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
6631
6599
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
6632
6600
|
];
|
|
6633
|
-
const data =
|
|
6601
|
+
const data = chunkW5TMS4RD_cjs.encodeInstructionData(
|
|
6634
6602
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
6635
6603
|
);
|
|
6636
6604
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -6640,13 +6608,13 @@ var previewSwapExactInResultCodec = kit.getStructCodec([
|
|
|
6640
6608
|
["feePaid", kit.getU64Codec()]
|
|
6641
6609
|
]);
|
|
6642
6610
|
function createPreviewSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
6643
|
-
const { launch, baseVault, quoteVault,
|
|
6611
|
+
const { launch, baseVault, quoteVault, hookProgram } = accounts;
|
|
6644
6612
|
const keys = [
|
|
6645
6613
|
{ address: launch, role: kit.AccountRole.READONLY },
|
|
6646
6614
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
6647
6615
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
6648
6616
|
];
|
|
6649
|
-
const accountsList =
|
|
6617
|
+
const accountsList = hookProgram ? [...keys, { address: hookProgram, role: kit.AccountRole.READONLY }] : keys;
|
|
6650
6618
|
const data = new Uint8Array(
|
|
6651
6619
|
getPreviewSwapExactInInstructionDataEncoder2().encode(args)
|
|
6652
6620
|
);
|
|
@@ -6668,7 +6636,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
6668
6636
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
6669
6637
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
6670
6638
|
];
|
|
6671
|
-
const data =
|
|
6639
|
+
const data = chunkW5TMS4RD_cjs.encodeInstructionData(
|
|
6672
6640
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
6673
6641
|
);
|
|
6674
6642
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -6676,6 +6644,77 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
6676
6644
|
function decodePreviewMigrationResult(data) {
|
|
6677
6645
|
return previewMigrationResultCodec.decode(data);
|
|
6678
6646
|
}
|
|
6647
|
+
var DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND = 20;
|
|
6648
|
+
function getInstructionLookupTableAddresses(instructions) {
|
|
6649
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6650
|
+
const addresses = [];
|
|
6651
|
+
for (const instruction of Array.isArray(instructions) ? instructions : [instructions]) {
|
|
6652
|
+
for (const account of instruction.accounts ?? []) {
|
|
6653
|
+
if ("signer" in account || account.role === kit.AccountRole.READONLY_SIGNER || account.role === kit.AccountRole.WRITABLE_SIGNER) {
|
|
6654
|
+
continue;
|
|
6655
|
+
}
|
|
6656
|
+
if (!seen.has(account.address)) {
|
|
6657
|
+
seen.add(account.address);
|
|
6658
|
+
addresses.push(account.address);
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6662
|
+
return addresses;
|
|
6663
|
+
}
|
|
6664
|
+
async function buildAddressLookupTableSetupInstructions({
|
|
6665
|
+
authority,
|
|
6666
|
+
payer,
|
|
6667
|
+
recentSlot,
|
|
6668
|
+
addresses,
|
|
6669
|
+
addressesPerExtendInstruction = DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND
|
|
6670
|
+
}) {
|
|
6671
|
+
if (addressesPerExtendInstruction <= 0) {
|
|
6672
|
+
throw new Error("addressesPerExtendInstruction must be greater than zero");
|
|
6673
|
+
}
|
|
6674
|
+
const dedupedAddresses = [...new Set(addresses)];
|
|
6675
|
+
const lookupTablePda = await addressLookupTable.findAddressLookupTablePda({
|
|
6676
|
+
authority: authority.address,
|
|
6677
|
+
recentSlot
|
|
6678
|
+
});
|
|
6679
|
+
const [lookupTableAddress] = lookupTablePda;
|
|
6680
|
+
const createInstruction = addressLookupTable.getCreateLookupTableInstruction({
|
|
6681
|
+
address: lookupTablePda,
|
|
6682
|
+
authority: authority.address,
|
|
6683
|
+
payer,
|
|
6684
|
+
recentSlot
|
|
6685
|
+
});
|
|
6686
|
+
const extendInstructions = [];
|
|
6687
|
+
for (let start = 0; start < dedupedAddresses.length; start += addressesPerExtendInstruction) {
|
|
6688
|
+
extendInstructions.push(
|
|
6689
|
+
addressLookupTable.getExtendLookupTableInstruction({
|
|
6690
|
+
address: lookupTableAddress,
|
|
6691
|
+
authority,
|
|
6692
|
+
payer,
|
|
6693
|
+
addresses: dedupedAddresses.slice(
|
|
6694
|
+
start,
|
|
6695
|
+
start + addressesPerExtendInstruction
|
|
6696
|
+
)
|
|
6697
|
+
})
|
|
6698
|
+
);
|
|
6699
|
+
}
|
|
6700
|
+
return {
|
|
6701
|
+
lookupTableAddress,
|
|
6702
|
+
createInstruction,
|
|
6703
|
+
extendInstructions,
|
|
6704
|
+
addresses: dedupedAddresses
|
|
6705
|
+
};
|
|
6706
|
+
}
|
|
6707
|
+
function compressTransactionMessageWithLookupTable(transactionMessage, {
|
|
6708
|
+
lookupTableAddress,
|
|
6709
|
+
addresses
|
|
6710
|
+
}) {
|
|
6711
|
+
return kit.compressTransactionMessageUsingAddressLookupTables(
|
|
6712
|
+
transactionMessage,
|
|
6713
|
+
{
|
|
6714
|
+
[lookupTableAddress]: [...addresses]
|
|
6715
|
+
}
|
|
6716
|
+
);
|
|
6717
|
+
}
|
|
6679
6718
|
var addressCodec5 = kit.getAddressCodec();
|
|
6680
6719
|
function bytesToBase64(bytes) {
|
|
6681
6720
|
let binary = "";
|
|
@@ -6789,8 +6828,10 @@ chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
|
6789
6828
|
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
6790
6829
|
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
6791
6830
|
SEED_STATE: () => SEED_STATE,
|
|
6792
|
-
|
|
6793
|
-
|
|
6831
|
+
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
6832
|
+
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
6833
|
+
encodeMigratePayload: () => encodeMigratePayload,
|
|
6834
|
+
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
6794
6835
|
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
6795
6836
|
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
6796
6837
|
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
@@ -6822,6 +6863,18 @@ function getMigrateArgsDecoder() {
|
|
|
6822
6863
|
function getMigrateArgsCodec() {
|
|
6823
6864
|
return kit.combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
6824
6865
|
}
|
|
6866
|
+
function getMigratedPoolHookConfigEncoder() {
|
|
6867
|
+
return kit.getStructEncoder([
|
|
6868
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
6869
|
+
["hookFlags", kit.getU32Encoder()]
|
|
6870
|
+
]);
|
|
6871
|
+
}
|
|
6872
|
+
function getMigratedPoolHookConfigDecoder() {
|
|
6873
|
+
return kit.getStructDecoder([
|
|
6874
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
6875
|
+
["hookFlags", kit.getU32Decoder()]
|
|
6876
|
+
]);
|
|
6877
|
+
}
|
|
6825
6878
|
function getRecipientEncoder() {
|
|
6826
6879
|
return kit.getStructEncoder([
|
|
6827
6880
|
["wallet", kit.getAddressEncoder()],
|
|
@@ -6844,7 +6897,11 @@ function getRegisterLaunchArgsEncoder() {
|
|
|
6844
6897
|
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
6845
6898
|
["recipients", kit.getArrayEncoder(getRecipientEncoder())],
|
|
6846
6899
|
["minRaiseQuote", kit.getU64Encoder()],
|
|
6847
|
-
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())]
|
|
6900
|
+
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
6901
|
+
[
|
|
6902
|
+
"migratedPoolHookConfig",
|
|
6903
|
+
kit.getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
6904
|
+
]
|
|
6848
6905
|
]);
|
|
6849
6906
|
}
|
|
6850
6907
|
function getRegisterLaunchArgsDecoder() {
|
|
@@ -6854,7 +6911,11 @@ function getRegisterLaunchArgsDecoder() {
|
|
|
6854
6911
|
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
6855
6912
|
["recipients", kit.getArrayDecoder(getRecipientDecoder())],
|
|
6856
6913
|
["minRaiseQuote", kit.getU64Decoder()],
|
|
6857
|
-
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())]
|
|
6914
|
+
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
6915
|
+
[
|
|
6916
|
+
"migratedPoolHookConfig",
|
|
6917
|
+
kit.getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
6918
|
+
]
|
|
6858
6919
|
]);
|
|
6859
6920
|
}
|
|
6860
6921
|
function getRegisterLaunchArgsCodec() {
|
|
@@ -6885,6 +6946,8 @@ function getCpmmMigratorStateEncoder() {
|
|
|
6885
6946
|
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
6886
6947
|
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
6887
6948
|
["pad0", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
6949
|
+
["migratedPoolHookProgram", kit.getAddressEncoder()],
|
|
6950
|
+
["migratedPoolHookFlags", kit.getU32Encoder()],
|
|
6888
6951
|
["recipients", kit.getArrayEncoder(getRecipientEncoder(), { size: 2 })],
|
|
6889
6952
|
["minRaiseQuote", kit.getU64Encoder()],
|
|
6890
6953
|
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
@@ -6904,6 +6967,8 @@ function getCpmmMigratorStateDecoder() {
|
|
|
6904
6967
|
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
6905
6968
|
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
6906
6969
|
["pad0", kit.fixDecoderSize(kit.getBytesDecoder(), 4)],
|
|
6970
|
+
["migratedPoolHookProgram", kit.getAddressDecoder()],
|
|
6971
|
+
["migratedPoolHookFlags", kit.getU32Decoder()],
|
|
6907
6972
|
["recipients", kit.getArrayDecoder(getRecipientDecoder(), { size: 2 })],
|
|
6908
6973
|
["minRaiseQuote", kit.getU64Decoder()],
|
|
6909
6974
|
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
@@ -6936,16 +7001,86 @@ async function fetchCpmmMigratorState(rpc, address3) {
|
|
|
6936
7001
|
base64ToBytes3(response.value.data[0])
|
|
6937
7002
|
);
|
|
6938
7003
|
}
|
|
7004
|
+
async function buildCpmmMigrationRemainingAccounts({
|
|
7005
|
+
launch,
|
|
7006
|
+
baseMint,
|
|
7007
|
+
quoteMint,
|
|
7008
|
+
launchAuthority,
|
|
7009
|
+
adminBaseAta,
|
|
7010
|
+
adminQuoteAta,
|
|
7011
|
+
recipientAtas,
|
|
7012
|
+
cpmmProgram = chunk3BW6IVP3_cjs.CPMM_PROGRAM_ID
|
|
7013
|
+
}) {
|
|
7014
|
+
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(launch);
|
|
7015
|
+
const [migrationAuthority] = await getCpmmMigrationAuthorityAddress();
|
|
7016
|
+
const poolInit = await chunk3BW6IVP3_cjs.getPoolInitAddresses(baseMint, quoteMint, cpmmProgram);
|
|
7017
|
+
const pool = poolInit.pool[0];
|
|
7018
|
+
const [launchLpPosition] = await chunk3BW6IVP3_cjs.getPositionAddress(
|
|
7019
|
+
pool,
|
|
7020
|
+
launchAuthority,
|
|
7021
|
+
0n,
|
|
7022
|
+
cpmmProgram
|
|
7023
|
+
);
|
|
7024
|
+
const addresses = [
|
|
7025
|
+
cpmmMigrationState,
|
|
7026
|
+
poolInit.config[0],
|
|
7027
|
+
pool,
|
|
7028
|
+
poolInit.authority[0],
|
|
7029
|
+
poolInit.vault0[0],
|
|
7030
|
+
poolInit.vault1[0],
|
|
7031
|
+
poolInit.protocolFeePosition[0],
|
|
7032
|
+
launchLpPosition,
|
|
7033
|
+
cpmmProgram,
|
|
7034
|
+
migrationAuthority,
|
|
7035
|
+
adminBaseAta,
|
|
7036
|
+
adminQuoteAta,
|
|
7037
|
+
...recipientAtas
|
|
7038
|
+
];
|
|
7039
|
+
return {
|
|
7040
|
+
addresses,
|
|
7041
|
+
hash: computeRemainingAccountsHash(addresses),
|
|
7042
|
+
metas: [
|
|
7043
|
+
{ address: cpmmMigrationState, role: kit.AccountRole.WRITABLE },
|
|
7044
|
+
{ address: poolInit.config[0], role: kit.AccountRole.READONLY },
|
|
7045
|
+
{ address: pool, role: kit.AccountRole.WRITABLE },
|
|
7046
|
+
{ address: poolInit.authority[0], role: kit.AccountRole.READONLY },
|
|
7047
|
+
{ address: poolInit.vault0[0], role: kit.AccountRole.WRITABLE },
|
|
7048
|
+
{ address: poolInit.vault1[0], role: kit.AccountRole.WRITABLE },
|
|
7049
|
+
{ address: poolInit.protocolFeePosition[0], role: kit.AccountRole.WRITABLE },
|
|
7050
|
+
{ address: launchLpPosition, role: kit.AccountRole.WRITABLE },
|
|
7051
|
+
{ address: cpmmProgram, role: kit.AccountRole.READONLY },
|
|
7052
|
+
{ address: migrationAuthority, role: kit.AccountRole.READONLY },
|
|
7053
|
+
{ address: adminBaseAta, role: kit.AccountRole.WRITABLE },
|
|
7054
|
+
{ address: adminQuoteAta, role: kit.AccountRole.WRITABLE },
|
|
7055
|
+
...recipientAtas.map((address3) => ({
|
|
7056
|
+
address: address3,
|
|
7057
|
+
role: kit.AccountRole.WRITABLE
|
|
7058
|
+
}))
|
|
7059
|
+
],
|
|
7060
|
+
cpmmMigrationState,
|
|
7061
|
+
cpmmConfig: poolInit.config[0],
|
|
7062
|
+
pool,
|
|
7063
|
+
poolAuthority: poolInit.authority[0],
|
|
7064
|
+
poolVault0: poolInit.vault0[0],
|
|
7065
|
+
poolVault1: poolInit.vault1[0],
|
|
7066
|
+
protocolFeePosition: poolInit.protocolFeePosition[0],
|
|
7067
|
+
launchLpPosition,
|
|
7068
|
+
migrationAuthority
|
|
7069
|
+
};
|
|
7070
|
+
}
|
|
7071
|
+
async function buildCpmmMigrationRemainingAccountsHash(input) {
|
|
7072
|
+
return (await buildCpmmMigrationRemainingAccounts(input)).hash;
|
|
7073
|
+
}
|
|
6939
7074
|
|
|
6940
7075
|
// src/solana/migrators/cpmmMigrator/index.ts
|
|
6941
|
-
function
|
|
7076
|
+
function encodeRegisterLaunchPayload(args) {
|
|
6942
7077
|
const encoded = new Uint8Array(getRegisterLaunchArgsEncoder().encode(args));
|
|
6943
7078
|
return kit.mergeBytes([
|
|
6944
7079
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.registerLaunch,
|
|
6945
7080
|
encoded
|
|
6946
7081
|
]);
|
|
6947
7082
|
}
|
|
6948
|
-
function
|
|
7083
|
+
function encodeMigratePayload(args) {
|
|
6949
7084
|
const encoded = new Uint8Array(getMigrateArgsEncoder().encode(args));
|
|
6950
7085
|
return kit.mergeBytes([
|
|
6951
7086
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.migrate,
|
|
@@ -7022,9 +7157,6 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
|
7022
7157
|
getAccumulatorUpdatedCodec: () => getAccumulatorUpdatedCodec,
|
|
7023
7158
|
getAccumulatorUpdatedDecoder: () => getAccumulatorUpdatedDecoder,
|
|
7024
7159
|
getAccumulatorUpdatedEncoder: () => getAccumulatorUpdatedEncoder,
|
|
7025
|
-
getCalldataBufCodec: () => getCalldataBufCodec,
|
|
7026
|
-
getCalldataBufDecoder: () => getCalldataBufDecoder2,
|
|
7027
|
-
getCalldataBufEncoder: () => getCalldataBufEncoder2,
|
|
7028
7160
|
getClaimDiscriminatorBytes: () => getClaimDiscriminatorBytes,
|
|
7029
7161
|
getClaimInstruction: () => getClaimInstruction,
|
|
7030
7162
|
getClaimInstructionAsync: () => getClaimInstructionAsync,
|
|
@@ -7082,6 +7214,9 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
|
7082
7214
|
getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes,
|
|
7083
7215
|
getOracleStateEncoder: () => getOracleStateEncoder,
|
|
7084
7216
|
getOracleStateSize: () => getOracleStateSize,
|
|
7217
|
+
getPayloadBufCodec: () => getPayloadBufCodec,
|
|
7218
|
+
getPayloadBufDecoder: () => getPayloadBufDecoder2,
|
|
7219
|
+
getPayloadBufEncoder: () => getPayloadBufEncoder2,
|
|
7085
7220
|
getPredictionEntryAddress: () => getPredictionEntryAddress,
|
|
7086
7221
|
getPredictionEntryByMintAddress: () => getPredictionEntryByMintAddress,
|
|
7087
7222
|
getPredictionMarketAddress: () => getPredictionMarketAddress,
|