@whetstone-research/doppler-sdk 1.0.19 → 1.0.20
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/dist/chunk-BESE77DM.js +3840 -0
- package/dist/chunk-BESE77DM.js.map +1 -0
- package/dist/chunk-KJ6W44WF.cjs +4089 -0
- package/dist/chunk-KJ6W44WF.cjs.map +1 -0
- package/dist/{chunk-AKLS6T3R.cjs → chunk-Y6TJIH33.cjs} +36 -24
- package/dist/chunk-Y6TJIH33.cjs.map +1 -0
- package/dist/{chunk-6TOPYGOG.js → chunk-ZUJKBFXW.js} +35 -24
- package/dist/chunk-ZUJKBFXW.js.map +1 -0
- package/dist/{oracle-7PmpwwPx.d.ts → oracle-D1wPWydZ.d.cts} +1 -33
- package/dist/{oracle-7PmpwwPx.d.cts → oracle-D1wPWydZ.d.ts} +1 -33
- package/dist/{pda-PZRHQJMK.cjs → pda-A4PIAS5Y.cjs} +20 -16
- package/dist/pda-A4PIAS5Y.cjs.map +1 -0
- package/dist/{pda-N6ULJYLG.js → pda-JVAD45XJ.js} +3 -3
- package/dist/pda-JVAD45XJ.js.map +1 -0
- package/dist/solana/index.cjs +391 -3247
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +176 -207
- package/dist/solana/index.d.ts +176 -207
- package/dist/solana/index.js +67 -2923
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +53 -85
- package/dist/solana/react/index.cjs.map +1 -1
- package/dist/solana/react/index.d.cts +7 -1
- package/dist/solana/react/index.d.ts +7 -1
- package/dist/solana/react/index.js +15 -47
- package/dist/solana/react/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-6TOPYGOG.js.map +0 -1
- package/dist/chunk-AKLS6T3R.cjs.map +0 -1
- package/dist/chunk-C2D7CIXP.js +0 -977
- package/dist/chunk-C2D7CIXP.js.map +0 -1
- package/dist/chunk-GUGN3EYX.cjs +0 -1069
- package/dist/chunk-GUGN3EYX.cjs.map +0 -1
- package/dist/pda-N6ULJYLG.js.map +0 -1
- package/dist/pda-PZRHQJMK.cjs.map +0 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkKJ6W44WF_cjs = require('../chunk-KJ6W44WF.cjs');
|
|
4
|
+
var chunkY6TJIH33_cjs = require('../chunk-Y6TJIH33.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');
|
|
@@ -11,345 +11,334 @@ var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
|
11
11
|
// src/solana/cpmm/index.ts
|
|
12
12
|
var cpmm_exports = {};
|
|
13
13
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
14
|
-
ACCOUNT_DISCRIMINATORS: () =>
|
|
15
|
-
ACCOUNT_VERSION: () =>
|
|
16
|
-
ADD_LIQUIDITY_DISCRIMINATOR: () => ADD_LIQUIDITY_DISCRIMINATOR,
|
|
17
|
-
BPS_DENOM: () =>
|
|
18
|
-
CLOSE_POSITION_DISCRIMINATOR: () => CLOSE_POSITION_DISCRIMINATOR,
|
|
19
|
-
COLLECT_FEES_DISCRIMINATOR: () => COLLECT_FEES_DISCRIMINATOR,
|
|
20
|
-
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
14
|
+
ACCOUNT_DISCRIMINATORS: () => chunkY6TJIH33_cjs.ACCOUNT_DISCRIMINATORS,
|
|
15
|
+
ACCOUNT_VERSION: () => chunkY6TJIH33_cjs.ACCOUNT_VERSION,
|
|
16
|
+
ADD_LIQUIDITY_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.ADD_LIQUIDITY_DISCRIMINATOR,
|
|
17
|
+
BPS_DENOM: () => chunkY6TJIH33_cjs.BPS_DENOM,
|
|
18
|
+
CLOSE_POSITION_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.CLOSE_POSITION_DISCRIMINATOR,
|
|
19
|
+
COLLECT_FEES_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.COLLECT_FEES_DISCRIMINATOR,
|
|
20
|
+
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
21
21
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
22
|
-
CPMM_PROGRAM_ID: () =>
|
|
23
|
-
CREATE_POSITION_DISCRIMINATOR: () => CREATE_POSITION_DISCRIMINATOR,
|
|
22
|
+
CPMM_PROGRAM_ID: () => chunkY6TJIH33_cjs.CPMM_PROGRAM_ID,
|
|
23
|
+
CREATE_POSITION_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.CREATE_POSITION_DISCRIMINATOR,
|
|
24
24
|
CpmmError: () => CpmmError,
|
|
25
25
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
26
|
-
HF_AFTER_ADD_LIQ: () =>
|
|
27
|
-
HF_AFTER_REMOVE_LIQ: () =>
|
|
28
|
-
HF_AFTER_SWAP: () =>
|
|
29
|
-
HF_BEFORE_ADD_LIQ: () =>
|
|
30
|
-
HF_BEFORE_REMOVE_LIQ: () =>
|
|
31
|
-
HF_BEFORE_SWAP: () =>
|
|
32
|
-
HF_FORWARD_READONLY_SIGNERS: () =>
|
|
33
|
-
HF_REQUIRE_ORACLE: () =>
|
|
34
|
-
HOOK_NO_CHANGE: () =>
|
|
35
|
-
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
36
|
-
INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
37
|
-
INITIALIZE_POOL_DISCRIMINATOR: () => INITIALIZE_POOL_DISCRIMINATOR,
|
|
38
|
-
INSTRUCTION_DISCRIMINATORS: () =>
|
|
26
|
+
HF_AFTER_ADD_LIQ: () => chunkY6TJIH33_cjs.HF_AFTER_ADD_LIQ,
|
|
27
|
+
HF_AFTER_REMOVE_LIQ: () => chunkY6TJIH33_cjs.HF_AFTER_REMOVE_LIQ,
|
|
28
|
+
HF_AFTER_SWAP: () => chunkY6TJIH33_cjs.HF_AFTER_SWAP,
|
|
29
|
+
HF_BEFORE_ADD_LIQ: () => chunkY6TJIH33_cjs.HF_BEFORE_ADD_LIQ,
|
|
30
|
+
HF_BEFORE_REMOVE_LIQ: () => chunkY6TJIH33_cjs.HF_BEFORE_REMOVE_LIQ,
|
|
31
|
+
HF_BEFORE_SWAP: () => chunkY6TJIH33_cjs.HF_BEFORE_SWAP,
|
|
32
|
+
HF_FORWARD_READONLY_SIGNERS: () => chunkY6TJIH33_cjs.HF_FORWARD_READONLY_SIGNERS,
|
|
33
|
+
HF_REQUIRE_ORACLE: () => chunkY6TJIH33_cjs.HF_REQUIRE_ORACLE,
|
|
34
|
+
HOOK_NO_CHANGE: () => chunkY6TJIH33_cjs.HOOK_NO_CHANGE,
|
|
35
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
36
|
+
INITIALIZE_ORACLE_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
37
|
+
INITIALIZE_POOL_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.INITIALIZE_POOL_DISCRIMINATOR,
|
|
38
|
+
INSTRUCTION_DISCRIMINATORS: () => chunkY6TJIH33_cjs.INSTRUCTION_DISCRIMINATORS,
|
|
39
39
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
40
|
-
MAX_HOOK_ALLOWLIST: () =>
|
|
41
|
-
MAX_ORACLE_OBSERVATIONS: () =>
|
|
42
|
-
ORACLE_CONSULT_DISCRIMINATOR: () => ORACLE_CONSULT_DISCRIMINATOR,
|
|
43
|
-
ORACLE_UPDATE_DISCRIMINATOR: () => ORACLE_UPDATE_DISCRIMINATOR,
|
|
44
|
-
PAUSE_DISCRIMINATOR: () => PAUSE_DISCRIMINATOR,
|
|
45
|
-
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
46
|
-
Q64_ONE: () =>
|
|
47
|
-
|
|
48
|
-
REMOVE_LIQUIDITY_DISCRIMINATOR: () => REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
49
|
-
SEED_AUTHORITY: () =>
|
|
50
|
-
SEED_CONFIG: () =>
|
|
51
|
-
SEED_ORACLE: () =>
|
|
52
|
-
SEED_POOL: () =>
|
|
53
|
-
SEED_POSITION: () =>
|
|
54
|
-
|
|
55
|
-
SET_FEES_DISCRIMINATOR: () => SET_FEES_DISCRIMINATOR,
|
|
56
|
-
SET_HOOK_DISCRIMINATOR: () => SET_HOOK_DISCRIMINATOR,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
createSetHookInstruction: () => getSetHookInstruction,
|
|
93
|
-
createSetRouteInstruction: () => getSetRouteInstruction,
|
|
94
|
-
createSwapExactInInstruction: () => getSwapExactInInstruction,
|
|
40
|
+
MAX_HOOK_ALLOWLIST: () => chunkY6TJIH33_cjs.MAX_HOOK_ALLOWLIST,
|
|
41
|
+
MAX_ORACLE_OBSERVATIONS: () => chunkY6TJIH33_cjs.MAX_ORACLE_OBSERVATIONS,
|
|
42
|
+
ORACLE_CONSULT_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.ORACLE_CONSULT_DISCRIMINATOR,
|
|
43
|
+
ORACLE_UPDATE_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.ORACLE_UPDATE_DISCRIMINATOR,
|
|
44
|
+
PAUSE_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.PAUSE_DISCRIMINATOR,
|
|
45
|
+
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
46
|
+
Q64_ONE: () => chunkY6TJIH33_cjs.Q64_ONE,
|
|
47
|
+
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.REDEEM_PROTOCOL_SHARES_DISCRIMINATOR,
|
|
48
|
+
REMOVE_LIQUIDITY_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
49
|
+
SEED_AUTHORITY: () => chunkY6TJIH33_cjs.SEED_AUTHORITY,
|
|
50
|
+
SEED_CONFIG: () => chunkY6TJIH33_cjs.SEED_CONFIG,
|
|
51
|
+
SEED_ORACLE: () => chunkY6TJIH33_cjs.SEED_ORACLE,
|
|
52
|
+
SEED_POOL: () => chunkY6TJIH33_cjs.SEED_POOL,
|
|
53
|
+
SEED_POSITION: () => chunkY6TJIH33_cjs.SEED_POSITION,
|
|
54
|
+
SEED_PROTOCOL_FEE_OWNER: () => chunkY6TJIH33_cjs.SEED_PROTOCOL_FEE_OWNER,
|
|
55
|
+
SET_FEES_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.SET_FEES_DISCRIMINATOR,
|
|
56
|
+
SET_HOOK_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.SET_HOOK_DISCRIMINATOR,
|
|
57
|
+
SWAP_EXACT_IN_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.SWAP_EXACT_IN_DISCRIMINATOR,
|
|
58
|
+
TOKEN_METADATA_PROGRAM_ID: () => chunkY6TJIH33_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
59
|
+
TRANSFER_ADMIN_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.TRANSFER_ADMIN_DISCRIMINATOR,
|
|
60
|
+
UNPAUSE_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.UNPAUSE_DISCRIMINATOR,
|
|
61
|
+
UPDATE_CONFIG_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.UPDATE_CONFIG_DISCRIMINATOR,
|
|
62
|
+
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () => chunkKJ6W44WF_cjs.WITHDRAW_VAULT_EXCESS_DISCRIMINATOR,
|
|
63
|
+
addLiquidityArgsCodec: () => chunkKJ6W44WF_cjs.addLiquidityArgsCodec,
|
|
64
|
+
ammConfigDataCodec: () => chunkKJ6W44WF_cjs.ammConfigDataCodec,
|
|
65
|
+
areMintsOrdered: () => chunkY6TJIH33_cjs.areMintsOrdered,
|
|
66
|
+
calculateAccruedFees: () => chunkKJ6W44WF_cjs.calculateAccruedFees,
|
|
67
|
+
calculateTwap: () => chunkKJ6W44WF_cjs.calculateTwap,
|
|
68
|
+
calculateTwapNumber: () => chunkKJ6W44WF_cjs.calculateTwapNumber,
|
|
69
|
+
ceilDiv: () => chunkKJ6W44WF_cjs.ceilDiv,
|
|
70
|
+
collectFeesArgsCodec: () => chunkKJ6W44WF_cjs.collectFeesArgsCodec,
|
|
71
|
+
collectProtocolFeesArgsCodec: () => chunkKJ6W44WF_cjs.collectProtocolFeesArgsCodec,
|
|
72
|
+
comparePoolAndOraclePrices: () => chunkKJ6W44WF_cjs.comparePoolAndOraclePrices,
|
|
73
|
+
computePrice0Q64: () => chunkKJ6W44WF_cjs.computePrice0Q64,
|
|
74
|
+
computePrice1Q64: () => chunkKJ6W44WF_cjs.computePrice1Q64,
|
|
75
|
+
consultTwap: () => chunkKJ6W44WF_cjs.consultTwap,
|
|
76
|
+
createAddLiquidityInstruction: () => chunkKJ6W44WF_cjs.getAddLiquidityInstruction,
|
|
77
|
+
createClosePositionInstruction: () => chunkKJ6W44WF_cjs.getClosePositionInstruction,
|
|
78
|
+
createCollectFeesInstruction: () => chunkKJ6W44WF_cjs.getCollectFeesInstruction,
|
|
79
|
+
createCollectProtocolFeesInstruction: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesInstruction,
|
|
80
|
+
createCreatePositionInstruction: () => chunkKJ6W44WF_cjs.getCreatePositionInstruction,
|
|
81
|
+
createInitializeConfigInstruction: () => chunkKJ6W44WF_cjs.getInitializeConfigInstruction,
|
|
82
|
+
createInitializeOracleInstruction: () => chunkKJ6W44WF_cjs.getInitializeOracleInstruction,
|
|
83
|
+
createInitializePoolInstruction: () => chunkKJ6W44WF_cjs.getInitializePoolInstruction,
|
|
84
|
+
createOracleConsultInstruction: () => chunkKJ6W44WF_cjs.getOracleConsultInstruction,
|
|
85
|
+
createOracleUpdateInstruction: () => chunkKJ6W44WF_cjs.getOracleUpdateInstruction,
|
|
86
|
+
createPauseInstruction: () => chunkKJ6W44WF_cjs.getPauseInstruction,
|
|
87
|
+
createPositionArgsCodec: () => chunkKJ6W44WF_cjs.createPositionArgsCodec,
|
|
88
|
+
createRemoveLiquidityInstruction: () => chunkKJ6W44WF_cjs.getRemoveLiquidityInstruction,
|
|
89
|
+
createSetFeesInstruction: () => chunkKJ6W44WF_cjs.getSetFeesInstruction,
|
|
90
|
+
createSetHookInstruction: () => chunkKJ6W44WF_cjs.getSetHookInstruction,
|
|
91
|
+
createSwapExactInInstruction: () => chunkKJ6W44WF_cjs.getSwapExactInInstruction,
|
|
95
92
|
createSwapInstruction: () => createSwapInstruction,
|
|
96
|
-
createTransferAdminInstruction: () => getTransferAdminInstruction,
|
|
97
|
-
createUnpauseInstruction: () => getUnpauseInstruction,
|
|
98
|
-
createWithdrawVaultExcessInstruction: () => getWithdrawVaultExcessInstruction,
|
|
93
|
+
createTransferAdminInstruction: () => chunkKJ6W44WF_cjs.getTransferAdminInstruction,
|
|
94
|
+
createUnpauseInstruction: () => chunkKJ6W44WF_cjs.getUnpauseInstruction,
|
|
95
|
+
createWithdrawVaultExcessInstruction: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessInstruction,
|
|
99
96
|
curveParamsToMarketCap: () => curveParamsToMarketCap,
|
|
100
|
-
decodeAmmConfig: () =>
|
|
101
|
-
decodeOracleState: () =>
|
|
102
|
-
decodePool: () =>
|
|
103
|
-
decodePosition: () =>
|
|
104
|
-
encodeAddLiquidityArgs: () =>
|
|
105
|
-
encodeCollectFeesArgs: () =>
|
|
106
|
-
encodeCollectProtocolFeesArgs: () =>
|
|
107
|
-
encodeCreatePositionArgs: () =>
|
|
108
|
-
encodeInitializeConfigArgs: () =>
|
|
109
|
-
encodeInitializeOracleArgs: () =>
|
|
110
|
-
encodeInitializePoolArgs: () =>
|
|
111
|
-
encodeInstructionData: () =>
|
|
112
|
-
encodeOracleConsultArgs: () =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
encodeTransferAdminArgs: () => chunkGUGN3EYX_cjs.encodeTransferAdminArgs,
|
|
120
|
-
fetchAllPools: () => chunkGUGN3EYX_cjs.fetchAllPools,
|
|
97
|
+
decodeAmmConfig: () => chunkKJ6W44WF_cjs.decodeAmmConfig,
|
|
98
|
+
decodeOracleState: () => chunkKJ6W44WF_cjs.decodeOracleState,
|
|
99
|
+
decodePool: () => chunkKJ6W44WF_cjs.decodePool,
|
|
100
|
+
decodePosition: () => chunkKJ6W44WF_cjs.decodePosition,
|
|
101
|
+
encodeAddLiquidityArgs: () => chunkKJ6W44WF_cjs.encodeAddLiquidityArgs,
|
|
102
|
+
encodeCollectFeesArgs: () => chunkKJ6W44WF_cjs.encodeCollectFeesArgs,
|
|
103
|
+
encodeCollectProtocolFeesArgs: () => chunkKJ6W44WF_cjs.encodeCollectProtocolFeesArgs,
|
|
104
|
+
encodeCreatePositionArgs: () => chunkKJ6W44WF_cjs.encodeCreatePositionArgs,
|
|
105
|
+
encodeInitializeConfigArgs: () => chunkKJ6W44WF_cjs.encodeInitializeConfigArgs,
|
|
106
|
+
encodeInitializeOracleArgs: () => chunkKJ6W44WF_cjs.encodeInitializeOracleArgs,
|
|
107
|
+
encodeInitializePoolArgs: () => chunkKJ6W44WF_cjs.encodeInitializePoolArgs,
|
|
108
|
+
encodeInstructionData: () => chunkKJ6W44WF_cjs.encodeInstructionData,
|
|
109
|
+
encodeOracleConsultArgs: () => chunkKJ6W44WF_cjs.encodeOracleConsultArgs,
|
|
110
|
+
encodeRemoveLiquidityArgs: () => chunkKJ6W44WF_cjs.encodeRemoveLiquidityArgs,
|
|
111
|
+
encodeSetFeesArgs: () => chunkKJ6W44WF_cjs.encodeSetFeesArgs,
|
|
112
|
+
encodeSetHookArgs: () => chunkKJ6W44WF_cjs.encodeSetHookArgs,
|
|
113
|
+
encodeSwapExactInArgs: () => chunkKJ6W44WF_cjs.encodeSwapExactInArgs,
|
|
114
|
+
encodeTransferAdminArgs: () => chunkKJ6W44WF_cjs.encodeTransferAdminArgs,
|
|
115
|
+
fetchAllPools: () => chunkKJ6W44WF_cjs.fetchAllPools,
|
|
121
116
|
fetchConfig: () => fetchConfig,
|
|
122
117
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
123
|
-
fetchOracle: () =>
|
|
124
|
-
fetchOraclesBatch: () =>
|
|
125
|
-
fetchPool: () =>
|
|
126
|
-
fetchPoolPositions: () =>
|
|
127
|
-
fetchPoolsBatch: () =>
|
|
128
|
-
fetchPosition: () =>
|
|
129
|
-
fetchPositionByParams: () =>
|
|
130
|
-
fetchPositionsBatch: () =>
|
|
131
|
-
fetchUserPositions: () =>
|
|
132
|
-
filterActivePositions: () =>
|
|
133
|
-
filterPoolsByMint: () =>
|
|
134
|
-
getAddLiquidityDiscriminatorBytes: () => getAddLiquidityDiscriminatorBytes,
|
|
135
|
-
getAddLiquidityInstruction: () => getAddLiquidityInstruction,
|
|
136
|
-
getAddLiquidityInstructionAsync: () => getAddLiquidityInstructionAsync,
|
|
137
|
-
getAddLiquidityInstructionDataCodec: () => getAddLiquidityInstructionDataCodec,
|
|
138
|
-
getAddLiquidityInstructionDataDecoder: () => getAddLiquidityInstructionDataDecoder,
|
|
139
|
-
getAddLiquidityInstructionDataEncoder: () => getAddLiquidityInstructionDataEncoder,
|
|
140
|
-
getAddLiquidityQuote: () =>
|
|
141
|
-
getClosePositionDiscriminatorBytes: () => getClosePositionDiscriminatorBytes,
|
|
142
|
-
getClosePositionInstruction: () => getClosePositionInstruction,
|
|
143
|
-
getClosePositionInstructionDataCodec: () => getClosePositionInstructionDataCodec,
|
|
144
|
-
getClosePositionInstructionDataDecoder: () => getClosePositionInstructionDataDecoder,
|
|
145
|
-
getClosePositionInstructionDataEncoder: () => getClosePositionInstructionDataEncoder,
|
|
146
|
-
getCollectFeesDiscriminatorBytes: () => getCollectFeesDiscriminatorBytes,
|
|
147
|
-
getCollectFeesInstruction: () => getCollectFeesInstruction,
|
|
148
|
-
getCollectFeesInstructionAsync: () => getCollectFeesInstructionAsync,
|
|
149
|
-
getCollectFeesInstructionDataCodec: () => getCollectFeesInstructionDataCodec,
|
|
150
|
-
getCollectFeesInstructionDataDecoder: () => getCollectFeesInstructionDataDecoder,
|
|
151
|
-
getCollectFeesInstructionDataEncoder: () => getCollectFeesInstructionDataEncoder,
|
|
152
|
-
getCollectProtocolFeesDiscriminatorBytes: () => getCollectProtocolFeesDiscriminatorBytes,
|
|
153
|
-
getCollectProtocolFeesInstruction: () => getCollectProtocolFeesInstruction,
|
|
154
|
-
getCollectProtocolFeesInstructionAsync: () => getCollectProtocolFeesInstructionAsync,
|
|
155
|
-
getCollectProtocolFeesInstructionDataCodec: () => getCollectProtocolFeesInstructionDataCodec,
|
|
156
|
-
getCollectProtocolFeesInstructionDataDecoder: () => getCollectProtocolFeesInstructionDataDecoder,
|
|
157
|
-
getCollectProtocolFeesInstructionDataEncoder: () => getCollectProtocolFeesInstructionDataEncoder,
|
|
158
|
-
getConfigAddress: () =>
|
|
159
|
-
getCreatePositionDiscriminatorBytes: () => getCreatePositionDiscriminatorBytes,
|
|
160
|
-
getCreatePositionInstruction: () => getCreatePositionInstruction,
|
|
161
|
-
getCreatePositionInstructionAsync: () => getCreatePositionInstructionAsync,
|
|
162
|
-
getCreatePositionInstructionDataCodec: () => getCreatePositionInstructionDataCodec,
|
|
163
|
-
getCreatePositionInstructionDataDecoder: () => getCreatePositionInstructionDataDecoder,
|
|
164
|
-
getCreatePositionInstructionDataEncoder: () => getCreatePositionInstructionDataEncoder,
|
|
118
|
+
fetchOracle: () => chunkKJ6W44WF_cjs.fetchOracle,
|
|
119
|
+
fetchOraclesBatch: () => chunkKJ6W44WF_cjs.fetchOraclesBatch,
|
|
120
|
+
fetchPool: () => chunkKJ6W44WF_cjs.fetchPool,
|
|
121
|
+
fetchPoolPositions: () => chunkKJ6W44WF_cjs.fetchPoolPositions,
|
|
122
|
+
fetchPoolsBatch: () => chunkKJ6W44WF_cjs.fetchPoolsBatch,
|
|
123
|
+
fetchPosition: () => chunkKJ6W44WF_cjs.fetchPosition,
|
|
124
|
+
fetchPositionByParams: () => chunkKJ6W44WF_cjs.fetchPositionByParams,
|
|
125
|
+
fetchPositionsBatch: () => chunkKJ6W44WF_cjs.fetchPositionsBatch,
|
|
126
|
+
fetchUserPositions: () => chunkKJ6W44WF_cjs.fetchUserPositions,
|
|
127
|
+
filterActivePositions: () => chunkKJ6W44WF_cjs.filterActivePositions,
|
|
128
|
+
filterPoolsByMint: () => chunkKJ6W44WF_cjs.filterPoolsByMint,
|
|
129
|
+
getAddLiquidityDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getAddLiquidityDiscriminatorBytes,
|
|
130
|
+
getAddLiquidityInstruction: () => chunkKJ6W44WF_cjs.getAddLiquidityInstruction,
|
|
131
|
+
getAddLiquidityInstructionAsync: () => chunkKJ6W44WF_cjs.getAddLiquidityInstructionAsync,
|
|
132
|
+
getAddLiquidityInstructionDataCodec: () => chunkKJ6W44WF_cjs.getAddLiquidityInstructionDataCodec,
|
|
133
|
+
getAddLiquidityInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getAddLiquidityInstructionDataDecoder,
|
|
134
|
+
getAddLiquidityInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getAddLiquidityInstructionDataEncoder,
|
|
135
|
+
getAddLiquidityQuote: () => chunkKJ6W44WF_cjs.getAddLiquidityQuote,
|
|
136
|
+
getClosePositionDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getClosePositionDiscriminatorBytes,
|
|
137
|
+
getClosePositionInstruction: () => chunkKJ6W44WF_cjs.getClosePositionInstruction,
|
|
138
|
+
getClosePositionInstructionDataCodec: () => chunkKJ6W44WF_cjs.getClosePositionInstructionDataCodec,
|
|
139
|
+
getClosePositionInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getClosePositionInstructionDataDecoder,
|
|
140
|
+
getClosePositionInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getClosePositionInstructionDataEncoder,
|
|
141
|
+
getCollectFeesDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getCollectFeesDiscriminatorBytes,
|
|
142
|
+
getCollectFeesInstruction: () => chunkKJ6W44WF_cjs.getCollectFeesInstruction,
|
|
143
|
+
getCollectFeesInstructionAsync: () => chunkKJ6W44WF_cjs.getCollectFeesInstructionAsync,
|
|
144
|
+
getCollectFeesInstructionDataCodec: () => chunkKJ6W44WF_cjs.getCollectFeesInstructionDataCodec,
|
|
145
|
+
getCollectFeesInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getCollectFeesInstructionDataDecoder,
|
|
146
|
+
getCollectFeesInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getCollectFeesInstructionDataEncoder,
|
|
147
|
+
getCollectProtocolFeesDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesDiscriminatorBytes,
|
|
148
|
+
getCollectProtocolFeesInstruction: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesInstruction,
|
|
149
|
+
getCollectProtocolFeesInstructionAsync: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesInstructionAsync,
|
|
150
|
+
getCollectProtocolFeesInstructionDataCodec: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesInstructionDataCodec,
|
|
151
|
+
getCollectProtocolFeesInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesInstructionDataDecoder,
|
|
152
|
+
getCollectProtocolFeesInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getCollectProtocolFeesInstructionDataEncoder,
|
|
153
|
+
getConfigAddress: () => chunkY6TJIH33_cjs.getConfigAddress,
|
|
154
|
+
getCreatePositionDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getCreatePositionDiscriminatorBytes,
|
|
155
|
+
getCreatePositionInstruction: () => chunkKJ6W44WF_cjs.getCreatePositionInstruction,
|
|
156
|
+
getCreatePositionInstructionAsync: () => chunkKJ6W44WF_cjs.getCreatePositionInstructionAsync,
|
|
157
|
+
getCreatePositionInstructionDataCodec: () => chunkKJ6W44WF_cjs.getCreatePositionInstructionDataCodec,
|
|
158
|
+
getCreatePositionInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getCreatePositionInstructionDataDecoder,
|
|
159
|
+
getCreatePositionInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getCreatePositionInstructionDataEncoder,
|
|
165
160
|
getErrorMessage: () => getErrorMessage,
|
|
166
|
-
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes,
|
|
167
|
-
getInitializeConfigInstruction: () => getInitializeConfigInstruction,
|
|
168
|
-
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync,
|
|
169
|
-
getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec,
|
|
170
|
-
getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder,
|
|
171
|
-
getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder,
|
|
172
|
-
getInitializeOracleDiscriminatorBytes: () => getInitializeOracleDiscriminatorBytes,
|
|
173
|
-
getInitializeOracleInstruction: () => getInitializeOracleInstruction,
|
|
174
|
-
getInitializeOracleInstructionAsync: () => getInitializeOracleInstructionAsync,
|
|
175
|
-
getInitializeOracleInstructionDataCodec: () => getInitializeOracleInstructionDataCodec,
|
|
176
|
-
getInitializeOracleInstructionDataDecoder: () => getInitializeOracleInstructionDataDecoder,
|
|
177
|
-
getInitializeOracleInstructionDataEncoder: () => getInitializeOracleInstructionDataEncoder,
|
|
178
|
-
getInitializePoolDiscriminatorBytes: () => getInitializePoolDiscriminatorBytes,
|
|
179
|
-
getInitializePoolInstruction: () => getInitializePoolInstruction,
|
|
180
|
-
getInitializePoolInstructionAsync: () => getInitializePoolInstructionAsync,
|
|
181
|
-
getInitializePoolInstructionDataCodec: () => getInitializePoolInstructionDataCodec,
|
|
182
|
-
getInitializePoolInstructionDataDecoder: () => getInitializePoolInstructionDataDecoder,
|
|
183
|
-
getInitializePoolInstructionDataEncoder: () => getInitializePoolInstructionDataEncoder,
|
|
184
|
-
getK: () =>
|
|
185
|
-
getLiquidityAddresses: () =>
|
|
161
|
+
getInitializeConfigDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getInitializeConfigDiscriminatorBytes,
|
|
162
|
+
getInitializeConfigInstruction: () => chunkKJ6W44WF_cjs.getInitializeConfigInstruction,
|
|
163
|
+
getInitializeConfigInstructionAsync: () => chunkKJ6W44WF_cjs.getInitializeConfigInstructionAsync,
|
|
164
|
+
getInitializeConfigInstructionDataCodec: () => chunkKJ6W44WF_cjs.getInitializeConfigInstructionDataCodec,
|
|
165
|
+
getInitializeConfigInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getInitializeConfigInstructionDataDecoder,
|
|
166
|
+
getInitializeConfigInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getInitializeConfigInstructionDataEncoder,
|
|
167
|
+
getInitializeOracleDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getInitializeOracleDiscriminatorBytes,
|
|
168
|
+
getInitializeOracleInstruction: () => chunkKJ6W44WF_cjs.getInitializeOracleInstruction,
|
|
169
|
+
getInitializeOracleInstructionAsync: () => chunkKJ6W44WF_cjs.getInitializeOracleInstructionAsync,
|
|
170
|
+
getInitializeOracleInstructionDataCodec: () => chunkKJ6W44WF_cjs.getInitializeOracleInstructionDataCodec,
|
|
171
|
+
getInitializeOracleInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getInitializeOracleInstructionDataDecoder,
|
|
172
|
+
getInitializeOracleInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getInitializeOracleInstructionDataEncoder,
|
|
173
|
+
getInitializePoolDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getInitializePoolDiscriminatorBytes,
|
|
174
|
+
getInitializePoolInstruction: () => chunkKJ6W44WF_cjs.getInitializePoolInstruction,
|
|
175
|
+
getInitializePoolInstructionAsync: () => chunkKJ6W44WF_cjs.getInitializePoolInstructionAsync,
|
|
176
|
+
getInitializePoolInstructionDataCodec: () => chunkKJ6W44WF_cjs.getInitializePoolInstructionDataCodec,
|
|
177
|
+
getInitializePoolInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getInitializePoolInstructionDataDecoder,
|
|
178
|
+
getInitializePoolInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getInitializePoolInstructionDataEncoder,
|
|
179
|
+
getK: () => chunkKJ6W44WF_cjs.getK,
|
|
180
|
+
getLiquidityAddresses: () => chunkY6TJIH33_cjs.getLiquidityAddresses,
|
|
186
181
|
getMetadataAddress: () => getMetadataAddress,
|
|
187
|
-
getOracleAddress: () =>
|
|
188
|
-
getOracleAddressFromPool: () =>
|
|
189
|
-
getOracleAge: () =>
|
|
190
|
-
getOracleBufferStats: () =>
|
|
191
|
-
getOracleConsultDiscriminatorBytes: () => getOracleConsultDiscriminatorBytes,
|
|
192
|
-
getOracleConsultInstruction: () => getOracleConsultInstruction,
|
|
193
|
-
getOracleConsultInstructionAsync: () => getOracleConsultInstructionAsync,
|
|
194
|
-
getOracleConsultInstructionDataCodec: () => getOracleConsultInstructionDataCodec,
|
|
195
|
-
getOracleConsultInstructionDataDecoder: () => getOracleConsultInstructionDataDecoder,
|
|
196
|
-
getOracleConsultInstructionDataEncoder: () => getOracleConsultInstructionDataEncoder,
|
|
197
|
-
getOracleDeviation: () =>
|
|
198
|
-
getOracleForPool: () =>
|
|
199
|
-
getOracleSpotPrices: () =>
|
|
200
|
-
getOracleUpdateDiscriminatorBytes: () => getOracleUpdateDiscriminatorBytes,
|
|
201
|
-
getOracleUpdateInstruction: () => getOracleUpdateInstruction,
|
|
202
|
-
getOracleUpdateInstructionAsync: () => getOracleUpdateInstructionAsync,
|
|
203
|
-
getOracleUpdateInstructionDataCodec: () => getOracleUpdateInstructionDataCodec,
|
|
204
|
-
getOracleUpdateInstructionDataDecoder: () => getOracleUpdateInstructionDataDecoder,
|
|
205
|
-
getOracleUpdateInstructionDataEncoder: () => getOracleUpdateInstructionDataEncoder,
|
|
206
|
-
getPauseDiscriminatorBytes: () => getPauseDiscriminatorBytes,
|
|
207
|
-
getPauseInstruction: () => getPauseInstruction,
|
|
208
|
-
getPauseInstructionDataCodec: () => getPauseInstructionDataCodec,
|
|
209
|
-
getPauseInstructionDataDecoder: () => getPauseInstructionDataDecoder,
|
|
210
|
-
getPauseInstructionDataEncoder: () => getPauseInstructionDataEncoder,
|
|
211
|
-
getPendingFees: () =>
|
|
212
|
-
getPoolAddress: () =>
|
|
213
|
-
getPoolAddressFromMints: () =>
|
|
214
|
-
getPoolAuthorityAddress: () =>
|
|
215
|
-
getPoolByMints: () =>
|
|
216
|
-
getPoolInitAddresses: () =>
|
|
217
|
-
getPoolVault0Address: () =>
|
|
218
|
-
getPoolVault1Address: () =>
|
|
219
|
-
getPositionAddress: () =>
|
|
220
|
-
getPositionAddressFromParams: () =>
|
|
221
|
-
getPositionValue: () =>
|
|
222
|
-
getPreviewSwapExactInDiscriminatorBytes: () => getPreviewSwapExactInDiscriminatorBytes,
|
|
223
|
-
getPreviewSwapExactInInstruction: () => getPreviewSwapExactInInstruction,
|
|
224
|
-
getPreviewSwapExactInInstructionDataCodec: () => getPreviewSwapExactInInstructionDataCodec,
|
|
225
|
-
getPreviewSwapExactInInstructionDataDecoder: () => getPreviewSwapExactInInstructionDataDecoder,
|
|
226
|
-
getPreviewSwapExactInInstructionDataEncoder: () => getPreviewSwapExactInInstructionDataEncoder,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
initializeConfigArgsCodec: () => chunkGUGN3EYX_cjs.initializeConfigArgsCodec,
|
|
289
|
-
initializeOracleArgsCodec: () => chunkGUGN3EYX_cjs.initializeOracleArgsCodec,
|
|
290
|
-
initializePoolArgsCodec: () => chunkGUGN3EYX_cjs.initializePoolArgsCodec,
|
|
182
|
+
getOracleAddress: () => chunkY6TJIH33_cjs.getOracleAddress,
|
|
183
|
+
getOracleAddressFromPool: () => chunkKJ6W44WF_cjs.getOracleAddressFromPool,
|
|
184
|
+
getOracleAge: () => chunkKJ6W44WF_cjs.getOracleAge,
|
|
185
|
+
getOracleBufferStats: () => chunkKJ6W44WF_cjs.getOracleBufferStats,
|
|
186
|
+
getOracleConsultDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getOracleConsultDiscriminatorBytes,
|
|
187
|
+
getOracleConsultInstruction: () => chunkKJ6W44WF_cjs.getOracleConsultInstruction,
|
|
188
|
+
getOracleConsultInstructionAsync: () => chunkKJ6W44WF_cjs.getOracleConsultInstructionAsync,
|
|
189
|
+
getOracleConsultInstructionDataCodec: () => chunkKJ6W44WF_cjs.getOracleConsultInstructionDataCodec,
|
|
190
|
+
getOracleConsultInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getOracleConsultInstructionDataDecoder,
|
|
191
|
+
getOracleConsultInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getOracleConsultInstructionDataEncoder,
|
|
192
|
+
getOracleDeviation: () => chunkKJ6W44WF_cjs.getOracleDeviation,
|
|
193
|
+
getOracleForPool: () => chunkKJ6W44WF_cjs.getOracleForPool,
|
|
194
|
+
getOracleSpotPrices: () => chunkKJ6W44WF_cjs.getOracleSpotPrices,
|
|
195
|
+
getOracleUpdateDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getOracleUpdateDiscriminatorBytes,
|
|
196
|
+
getOracleUpdateInstruction: () => chunkKJ6W44WF_cjs.getOracleUpdateInstruction,
|
|
197
|
+
getOracleUpdateInstructionAsync: () => chunkKJ6W44WF_cjs.getOracleUpdateInstructionAsync,
|
|
198
|
+
getOracleUpdateInstructionDataCodec: () => chunkKJ6W44WF_cjs.getOracleUpdateInstructionDataCodec,
|
|
199
|
+
getOracleUpdateInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getOracleUpdateInstructionDataDecoder,
|
|
200
|
+
getOracleUpdateInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getOracleUpdateInstructionDataEncoder,
|
|
201
|
+
getPauseDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getPauseDiscriminatorBytes,
|
|
202
|
+
getPauseInstruction: () => chunkKJ6W44WF_cjs.getPauseInstruction,
|
|
203
|
+
getPauseInstructionDataCodec: () => chunkKJ6W44WF_cjs.getPauseInstructionDataCodec,
|
|
204
|
+
getPauseInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getPauseInstructionDataDecoder,
|
|
205
|
+
getPauseInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getPauseInstructionDataEncoder,
|
|
206
|
+
getPendingFees: () => chunkKJ6W44WF_cjs.getPendingFees,
|
|
207
|
+
getPoolAddress: () => chunkY6TJIH33_cjs.getPoolAddress,
|
|
208
|
+
getPoolAddressFromMints: () => chunkKJ6W44WF_cjs.getPoolAddressFromMints,
|
|
209
|
+
getPoolAuthorityAddress: () => chunkY6TJIH33_cjs.getPoolAuthorityAddress,
|
|
210
|
+
getPoolByMints: () => chunkKJ6W44WF_cjs.getPoolByMints,
|
|
211
|
+
getPoolInitAddresses: () => chunkY6TJIH33_cjs.getPoolInitAddresses,
|
|
212
|
+
getPoolVault0Address: () => chunkY6TJIH33_cjs.getPoolVault0Address,
|
|
213
|
+
getPoolVault1Address: () => chunkY6TJIH33_cjs.getPoolVault1Address,
|
|
214
|
+
getPositionAddress: () => chunkY6TJIH33_cjs.getPositionAddress,
|
|
215
|
+
getPositionAddressFromParams: () => chunkKJ6W44WF_cjs.getPositionAddressFromParams,
|
|
216
|
+
getPositionValue: () => chunkKJ6W44WF_cjs.getPositionValue,
|
|
217
|
+
getPreviewSwapExactInDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getPreviewSwapExactInDiscriminatorBytes,
|
|
218
|
+
getPreviewSwapExactInInstruction: () => chunkKJ6W44WF_cjs.getPreviewSwapExactInInstruction,
|
|
219
|
+
getPreviewSwapExactInInstructionDataCodec: () => chunkKJ6W44WF_cjs.getPreviewSwapExactInInstructionDataCodec,
|
|
220
|
+
getPreviewSwapExactInInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getPreviewSwapExactInInstructionDataDecoder,
|
|
221
|
+
getPreviewSwapExactInInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getPreviewSwapExactInInstructionDataEncoder,
|
|
222
|
+
getProtocolFeeOwnerAddress: () => chunkY6TJIH33_cjs.getProtocolFeeOwnerAddress,
|
|
223
|
+
getProtocolFeePositionAddress: () => chunkY6TJIH33_cjs.getProtocolFeePositionAddress,
|
|
224
|
+
getRedeemProtocolSharesDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getRedeemProtocolSharesDiscriminatorBytes,
|
|
225
|
+
getRedeemProtocolSharesInstruction: () => chunkKJ6W44WF_cjs.getRedeemProtocolSharesInstruction,
|
|
226
|
+
getRedeemProtocolSharesInstructionAsync: () => chunkKJ6W44WF_cjs.getRedeemProtocolSharesInstructionAsync,
|
|
227
|
+
getRedeemProtocolSharesInstructionDataCodec: () => chunkKJ6W44WF_cjs.getRedeemProtocolSharesInstructionDataCodec,
|
|
228
|
+
getRedeemProtocolSharesInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getRedeemProtocolSharesInstructionDataDecoder,
|
|
229
|
+
getRedeemProtocolSharesInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getRedeemProtocolSharesInstructionDataEncoder,
|
|
230
|
+
getRemoveLiquidityDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getRemoveLiquidityDiscriminatorBytes,
|
|
231
|
+
getRemoveLiquidityInstruction: () => chunkKJ6W44WF_cjs.getRemoveLiquidityInstruction,
|
|
232
|
+
getRemoveLiquidityInstructionAsync: () => chunkKJ6W44WF_cjs.getRemoveLiquidityInstructionAsync,
|
|
233
|
+
getRemoveLiquidityInstructionDataCodec: () => chunkKJ6W44WF_cjs.getRemoveLiquidityInstructionDataCodec,
|
|
234
|
+
getRemoveLiquidityInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getRemoveLiquidityInstructionDataDecoder,
|
|
235
|
+
getRemoveLiquidityInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getRemoveLiquidityInstructionDataEncoder,
|
|
236
|
+
getRemoveLiquidityQuote: () => chunkKJ6W44WF_cjs.getRemoveLiquidityQuote,
|
|
237
|
+
getSetFeesDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getSetFeesDiscriminatorBytes,
|
|
238
|
+
getSetFeesInstruction: () => chunkKJ6W44WF_cjs.getSetFeesInstruction,
|
|
239
|
+
getSetFeesInstructionDataCodec: () => chunkKJ6W44WF_cjs.getSetFeesInstructionDataCodec,
|
|
240
|
+
getSetFeesInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getSetFeesInstructionDataDecoder,
|
|
241
|
+
getSetFeesInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getSetFeesInstructionDataEncoder,
|
|
242
|
+
getSetHookDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getSetHookDiscriminatorBytes,
|
|
243
|
+
getSetHookInstruction: () => chunkKJ6W44WF_cjs.getSetHookInstruction,
|
|
244
|
+
getSetHookInstructionDataCodec: () => chunkKJ6W44WF_cjs.getSetHookInstructionDataCodec,
|
|
245
|
+
getSetHookInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getSetHookInstructionDataDecoder,
|
|
246
|
+
getSetHookInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getSetHookInstructionDataEncoder,
|
|
247
|
+
getSpotPrice0: () => chunkKJ6W44WF_cjs.getSpotPrice0,
|
|
248
|
+
getSpotPrice1: () => chunkKJ6W44WF_cjs.getSpotPrice1,
|
|
249
|
+
getSwapAddresses: () => chunkY6TJIH33_cjs.getSwapAddresses,
|
|
250
|
+
getSwapExactInDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getSwapExactInDiscriminatorBytes,
|
|
251
|
+
getSwapExactInInstruction: () => chunkKJ6W44WF_cjs.getSwapExactInInstruction,
|
|
252
|
+
getSwapExactInInstructionAsync: () => chunkKJ6W44WF_cjs.getSwapExactInInstructionAsync,
|
|
253
|
+
getSwapExactInInstructionDataCodec: () => chunkKJ6W44WF_cjs.getSwapExactInInstructionDataCodec,
|
|
254
|
+
getSwapExactInInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getSwapExactInInstructionDataDecoder,
|
|
255
|
+
getSwapExactInInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getSwapExactInInstructionDataEncoder,
|
|
256
|
+
getSwapQuote: () => chunkKJ6W44WF_cjs.getSwapQuote,
|
|
257
|
+
getSwapQuoteExactOut: () => chunkKJ6W44WF_cjs.getSwapQuoteExactOut,
|
|
258
|
+
getTransferAdminDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getTransferAdminDiscriminatorBytes,
|
|
259
|
+
getTransferAdminInstruction: () => chunkKJ6W44WF_cjs.getTransferAdminInstruction,
|
|
260
|
+
getTransferAdminInstructionDataCodec: () => chunkKJ6W44WF_cjs.getTransferAdminInstructionDataCodec,
|
|
261
|
+
getTransferAdminInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getTransferAdminInstructionDataDecoder,
|
|
262
|
+
getTransferAdminInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getTransferAdminInstructionDataEncoder,
|
|
263
|
+
getTvl: () => chunkKJ6W44WF_cjs.getTvl,
|
|
264
|
+
getUnpauseDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getUnpauseDiscriminatorBytes,
|
|
265
|
+
getUnpauseInstruction: () => chunkKJ6W44WF_cjs.getUnpauseInstruction,
|
|
266
|
+
getUnpauseInstructionDataCodec: () => chunkKJ6W44WF_cjs.getUnpauseInstructionDataCodec,
|
|
267
|
+
getUnpauseInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getUnpauseInstructionDataDecoder,
|
|
268
|
+
getUnpauseInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getUnpauseInstructionDataEncoder,
|
|
269
|
+
getUpdateConfigDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getUpdateConfigDiscriminatorBytes,
|
|
270
|
+
getUpdateConfigInstruction: () => chunkKJ6W44WF_cjs.getUpdateConfigInstruction,
|
|
271
|
+
getUpdateConfigInstructionDataCodec: () => chunkKJ6W44WF_cjs.getUpdateConfigInstructionDataCodec,
|
|
272
|
+
getUpdateConfigInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getUpdateConfigInstructionDataDecoder,
|
|
273
|
+
getUpdateConfigInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getUpdateConfigInstructionDataEncoder,
|
|
274
|
+
getWithdrawVaultExcessDiscriminatorBytes: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessDiscriminatorBytes,
|
|
275
|
+
getWithdrawVaultExcessInstruction: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessInstruction,
|
|
276
|
+
getWithdrawVaultExcessInstructionAsync: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessInstructionAsync,
|
|
277
|
+
getWithdrawVaultExcessInstructionDataCodec: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessInstructionDataCodec,
|
|
278
|
+
getWithdrawVaultExcessInstructionDataDecoder: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessInstructionDataDecoder,
|
|
279
|
+
getWithdrawVaultExcessInstructionDataEncoder: () => chunkKJ6W44WF_cjs.getWithdrawVaultExcessInstructionDataEncoder,
|
|
280
|
+
initializeConfigArgsCodec: () => chunkKJ6W44WF_cjs.initializeConfigArgsCodec,
|
|
281
|
+
initializeOracleArgsCodec: () => chunkKJ6W44WF_cjs.initializeOracleArgsCodec,
|
|
282
|
+
initializePoolArgsCodec: () => chunkKJ6W44WF_cjs.initializePoolArgsCodec,
|
|
291
283
|
isCpmmError: () => isCpmmError,
|
|
292
|
-
isOracleStale: () =>
|
|
293
|
-
isqrt: () =>
|
|
284
|
+
isOracleStale: () => chunkKJ6W44WF_cjs.isOracleStale,
|
|
285
|
+
isqrt: () => chunkKJ6W44WF_cjs.isqrt,
|
|
294
286
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
295
287
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
296
288
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
297
|
-
maxBigInt: () =>
|
|
298
|
-
minBigInt: () =>
|
|
299
|
-
numberToQ64: () =>
|
|
300
|
-
observationCodec: () =>
|
|
301
|
-
oracleConsultArgsCodec: () =>
|
|
302
|
-
oracleStateDataCodec: () =>
|
|
303
|
-
parseAddLiquidityInstruction: () => parseAddLiquidityInstruction,
|
|
304
|
-
parseClosePositionInstruction: () => parseClosePositionInstruction,
|
|
305
|
-
parseCollectFeesInstruction: () => parseCollectFeesInstruction,
|
|
306
|
-
parseCollectProtocolFeesInstruction: () => parseCollectProtocolFeesInstruction,
|
|
307
|
-
parseCreatePositionInstruction: () => parseCreatePositionInstruction,
|
|
289
|
+
maxBigInt: () => chunkKJ6W44WF_cjs.maxBigInt,
|
|
290
|
+
minBigInt: () => chunkKJ6W44WF_cjs.minBigInt,
|
|
291
|
+
numberToQ64: () => chunkKJ6W44WF_cjs.numberToQ64,
|
|
292
|
+
observationCodec: () => chunkKJ6W44WF_cjs.observationCodec,
|
|
293
|
+
oracleConsultArgsCodec: () => chunkKJ6W44WF_cjs.oracleConsultArgsCodec,
|
|
294
|
+
oracleStateDataCodec: () => chunkKJ6W44WF_cjs.oracleStateDataCodec,
|
|
295
|
+
parseAddLiquidityInstruction: () => chunkKJ6W44WF_cjs.parseAddLiquidityInstruction,
|
|
296
|
+
parseClosePositionInstruction: () => chunkKJ6W44WF_cjs.parseClosePositionInstruction,
|
|
297
|
+
parseCollectFeesInstruction: () => chunkKJ6W44WF_cjs.parseCollectFeesInstruction,
|
|
298
|
+
parseCollectProtocolFeesInstruction: () => chunkKJ6W44WF_cjs.parseCollectProtocolFeesInstruction,
|
|
299
|
+
parseCreatePositionInstruction: () => chunkKJ6W44WF_cjs.parseCreatePositionInstruction,
|
|
308
300
|
parseErrorFromLogs: () => parseErrorFromLogs,
|
|
309
|
-
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction,
|
|
310
|
-
parseInitializeOracleInstruction: () => parseInitializeOracleInstruction,
|
|
311
|
-
parseInitializePoolInstruction: () => parseInitializePoolInstruction,
|
|
312
|
-
parseOracleConsultInstruction: () => parseOracleConsultInstruction,
|
|
313
|
-
parseOracleUpdateInstruction: () => parseOracleUpdateInstruction,
|
|
314
|
-
parsePauseInstruction: () => parsePauseInstruction,
|
|
315
|
-
parsePreviewSwapExactInInstruction: () => parsePreviewSwapExactInInstruction,
|
|
316
|
-
|
|
317
|
-
parseRemoveLiquidityInstruction: () => parseRemoveLiquidityInstruction,
|
|
318
|
-
parseSetFeesInstruction: () => parseSetFeesInstruction,
|
|
319
|
-
parseSetHookInstruction: () => parseSetHookInstruction,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
sortPositionsByShares: () => chunkGUGN3EYX_cjs.sortPositionsByShares,
|
|
341
|
-
swapExactInArgsCodec: () => chunkGUGN3EYX_cjs.swapExactInArgsCodec,
|
|
342
|
-
transferAdminArgsCodec: () => chunkGUGN3EYX_cjs.transferAdminArgsCodec,
|
|
301
|
+
parseInitializeConfigInstruction: () => chunkKJ6W44WF_cjs.parseInitializeConfigInstruction,
|
|
302
|
+
parseInitializeOracleInstruction: () => chunkKJ6W44WF_cjs.parseInitializeOracleInstruction,
|
|
303
|
+
parseInitializePoolInstruction: () => chunkKJ6W44WF_cjs.parseInitializePoolInstruction,
|
|
304
|
+
parseOracleConsultInstruction: () => chunkKJ6W44WF_cjs.parseOracleConsultInstruction,
|
|
305
|
+
parseOracleUpdateInstruction: () => chunkKJ6W44WF_cjs.parseOracleUpdateInstruction,
|
|
306
|
+
parsePauseInstruction: () => chunkKJ6W44WF_cjs.parsePauseInstruction,
|
|
307
|
+
parsePreviewSwapExactInInstruction: () => chunkKJ6W44WF_cjs.parsePreviewSwapExactInInstruction,
|
|
308
|
+
parseRedeemProtocolSharesInstruction: () => chunkKJ6W44WF_cjs.parseRedeemProtocolSharesInstruction,
|
|
309
|
+
parseRemoveLiquidityInstruction: () => chunkKJ6W44WF_cjs.parseRemoveLiquidityInstruction,
|
|
310
|
+
parseSetFeesInstruction: () => chunkKJ6W44WF_cjs.parseSetFeesInstruction,
|
|
311
|
+
parseSetHookInstruction: () => chunkKJ6W44WF_cjs.parseSetHookInstruction,
|
|
312
|
+
parseSwapExactInInstruction: () => chunkKJ6W44WF_cjs.parseSwapExactInInstruction,
|
|
313
|
+
parseTransferAdminInstruction: () => chunkKJ6W44WF_cjs.parseTransferAdminInstruction,
|
|
314
|
+
parseUnpauseInstruction: () => chunkKJ6W44WF_cjs.parseUnpauseInstruction,
|
|
315
|
+
parseUpdateConfigInstruction: () => chunkKJ6W44WF_cjs.parseUpdateConfigInstruction,
|
|
316
|
+
parseWithdrawVaultExcessInstruction: () => chunkKJ6W44WF_cjs.parseWithdrawVaultExcessInstruction,
|
|
317
|
+
poolDataCodec: () => chunkKJ6W44WF_cjs.poolDataCodec,
|
|
318
|
+
poolExists: () => chunkKJ6W44WF_cjs.poolExists,
|
|
319
|
+
positionDataCodec: () => chunkKJ6W44WF_cjs.positionDataCodec,
|
|
320
|
+
q64Div: () => chunkKJ6W44WF_cjs.q64Div,
|
|
321
|
+
q64Mul: () => chunkKJ6W44WF_cjs.q64Mul,
|
|
322
|
+
q64ToNumber: () => chunkKJ6W44WF_cjs.q64ToNumber,
|
|
323
|
+
ratioToNumber: () => chunkKJ6W44WF_cjs.ratioToNumber,
|
|
324
|
+
removeLiquidityArgsCodec: () => chunkKJ6W44WF_cjs.removeLiquidityArgsCodec,
|
|
325
|
+
setFeesArgsCodec: () => chunkKJ6W44WF_cjs.setFeesArgsCodec,
|
|
326
|
+
setHookArgsCodec: () => chunkKJ6W44WF_cjs.setHookArgsCodec,
|
|
327
|
+
sortMints: () => chunkY6TJIH33_cjs.sortMints,
|
|
328
|
+
sortPoolsByReserves: () => chunkKJ6W44WF_cjs.sortPoolsByReserves,
|
|
329
|
+
sortPositionsByShares: () => chunkKJ6W44WF_cjs.sortPositionsByShares,
|
|
330
|
+
swapExactInArgsCodec: () => chunkKJ6W44WF_cjs.swapExactInArgsCodec,
|
|
331
|
+
transferAdminArgsCodec: () => chunkKJ6W44WF_cjs.transferAdminArgsCodec,
|
|
343
332
|
validateMarketCapParameters: () => validateMarketCapParameters
|
|
344
333
|
});
|
|
345
334
|
var addressCodec = kit.getAddressCodec();
|
|
346
335
|
var textEncoder = new TextEncoder();
|
|
347
336
|
async function getMetadataAddress(mint) {
|
|
348
337
|
return kit.getProgramDerivedAddress({
|
|
349
|
-
programAddress:
|
|
338
|
+
programAddress: chunkY6TJIH33_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
350
339
|
seeds: [
|
|
351
340
|
textEncoder.encode("metadata"),
|
|
352
|
-
addressCodec.encode(
|
|
341
|
+
addressCodec.encode(chunkY6TJIH33_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
353
342
|
addressCodec.encode(mint)
|
|
354
343
|
]
|
|
355
344
|
});
|
|
@@ -641,2869 +630,6 @@ function getErrorMessage(code) {
|
|
|
641
630
|
}
|
|
642
631
|
return `Unknown error code: ${code}`;
|
|
643
632
|
}
|
|
644
|
-
|
|
645
|
-
// src/solana/generated/cpmm/programs/cpmm.ts
|
|
646
|
-
var CPMM_PROGRAM_ADDRESS = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
647
|
-
|
|
648
|
-
// src/solana/generated/cpmm/instructions/addLiquidity.ts
|
|
649
|
-
var ADD_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
|
|
650
|
-
181,
|
|
651
|
-
157,
|
|
652
|
-
89,
|
|
653
|
-
67,
|
|
654
|
-
143,
|
|
655
|
-
182,
|
|
656
|
-
52,
|
|
657
|
-
72
|
|
658
|
-
]);
|
|
659
|
-
function getAddLiquidityDiscriminatorBytes() {
|
|
660
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
661
|
-
ADD_LIQUIDITY_DISCRIMINATOR
|
|
662
|
-
);
|
|
663
|
-
}
|
|
664
|
-
function getAddLiquidityInstructionDataEncoder() {
|
|
665
|
-
return kit.transformEncoder(
|
|
666
|
-
kit.getStructEncoder([
|
|
667
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
668
|
-
["amount0Max", kit.getU64Encoder()],
|
|
669
|
-
["amount1Max", kit.getU64Encoder()],
|
|
670
|
-
["minSharesOut", kit.getU128Encoder()],
|
|
671
|
-
["updateOracle", kit.getBooleanEncoder()]
|
|
672
|
-
]),
|
|
673
|
-
(value) => ({ ...value, discriminator: ADD_LIQUIDITY_DISCRIMINATOR })
|
|
674
|
-
);
|
|
675
|
-
}
|
|
676
|
-
function getAddLiquidityInstructionDataDecoder() {
|
|
677
|
-
return kit.getStructDecoder([
|
|
678
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
679
|
-
["amount0Max", kit.getU64Decoder()],
|
|
680
|
-
["amount1Max", kit.getU64Decoder()],
|
|
681
|
-
["minSharesOut", kit.getU128Decoder()],
|
|
682
|
-
["updateOracle", kit.getBooleanDecoder()]
|
|
683
|
-
]);
|
|
684
|
-
}
|
|
685
|
-
function getAddLiquidityInstructionDataCodec() {
|
|
686
|
-
return kit.combineCodec(
|
|
687
|
-
getAddLiquidityInstructionDataEncoder(),
|
|
688
|
-
getAddLiquidityInstructionDataDecoder()
|
|
689
|
-
);
|
|
690
|
-
}
|
|
691
|
-
async function getAddLiquidityInstructionAsync(input, config) {
|
|
692
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
693
|
-
const originalAccounts = {
|
|
694
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
695
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
696
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
697
|
-
protocolFeePosition: {
|
|
698
|
-
value: input.protocolFeePosition ?? null,
|
|
699
|
-
isWritable: true
|
|
700
|
-
},
|
|
701
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
702
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
703
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
704
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
705
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
706
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
707
|
-
user0: { value: input.user0 ?? null, isWritable: true },
|
|
708
|
-
user1: { value: input.user1 ?? null, isWritable: true },
|
|
709
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
710
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
711
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
712
|
-
};
|
|
713
|
-
const accounts = originalAccounts;
|
|
714
|
-
const args = { ...input };
|
|
715
|
-
if (!accounts.authority.value) {
|
|
716
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
717
|
-
programAddress,
|
|
718
|
-
seeds: [
|
|
719
|
-
kit.getBytesEncoder().encode(
|
|
720
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
721
|
-
),
|
|
722
|
-
kit.getAddressEncoder().encode(
|
|
723
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
724
|
-
)
|
|
725
|
-
]
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
729
|
-
return Object.freeze({
|
|
730
|
-
accounts: [
|
|
731
|
-
getAccountMeta("config", accounts.config),
|
|
732
|
-
getAccountMeta("pool", accounts.pool),
|
|
733
|
-
getAccountMeta("position", accounts.position),
|
|
734
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
735
|
-
getAccountMeta("owner", accounts.owner),
|
|
736
|
-
getAccountMeta("authority", accounts.authority),
|
|
737
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
738
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
739
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
740
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
741
|
-
getAccountMeta("user0", accounts.user0),
|
|
742
|
-
getAccountMeta("user1", accounts.user1),
|
|
743
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
744
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
745
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
746
|
-
],
|
|
747
|
-
data: getAddLiquidityInstructionDataEncoder().encode(
|
|
748
|
-
args
|
|
749
|
-
),
|
|
750
|
-
programAddress
|
|
751
|
-
});
|
|
752
|
-
}
|
|
753
|
-
function getAddLiquidityInstruction(input, config) {
|
|
754
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
755
|
-
const originalAccounts = {
|
|
756
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
757
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
758
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
759
|
-
protocolFeePosition: {
|
|
760
|
-
value: input.protocolFeePosition ?? null,
|
|
761
|
-
isWritable: true
|
|
762
|
-
},
|
|
763
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
764
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
765
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
766
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
767
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
768
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
769
|
-
user0: { value: input.user0 ?? null, isWritable: true },
|
|
770
|
-
user1: { value: input.user1 ?? null, isWritable: true },
|
|
771
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
772
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
773
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
774
|
-
};
|
|
775
|
-
const accounts = originalAccounts;
|
|
776
|
-
const args = { ...input };
|
|
777
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
778
|
-
return Object.freeze({
|
|
779
|
-
accounts: [
|
|
780
|
-
getAccountMeta("config", accounts.config),
|
|
781
|
-
getAccountMeta("pool", accounts.pool),
|
|
782
|
-
getAccountMeta("position", accounts.position),
|
|
783
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
784
|
-
getAccountMeta("owner", accounts.owner),
|
|
785
|
-
getAccountMeta("authority", accounts.authority),
|
|
786
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
787
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
788
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
789
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
790
|
-
getAccountMeta("user0", accounts.user0),
|
|
791
|
-
getAccountMeta("user1", accounts.user1),
|
|
792
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
793
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
794
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
795
|
-
],
|
|
796
|
-
data: getAddLiquidityInstructionDataEncoder().encode(
|
|
797
|
-
args
|
|
798
|
-
),
|
|
799
|
-
programAddress
|
|
800
|
-
});
|
|
801
|
-
}
|
|
802
|
-
function parseAddLiquidityInstruction(instruction) {
|
|
803
|
-
if (instruction.accounts.length < 15) {
|
|
804
|
-
throw new kit.SolanaError(
|
|
805
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
806
|
-
{
|
|
807
|
-
actualAccountMetas: instruction.accounts.length,
|
|
808
|
-
expectedAccountMetas: 15
|
|
809
|
-
}
|
|
810
|
-
);
|
|
811
|
-
}
|
|
812
|
-
let accountIndex = 0;
|
|
813
|
-
const getNextAccount = () => {
|
|
814
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
815
|
-
accountIndex += 1;
|
|
816
|
-
return accountMeta;
|
|
817
|
-
};
|
|
818
|
-
const getNextOptionalAccount = () => {
|
|
819
|
-
const accountMeta = getNextAccount();
|
|
820
|
-
return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
821
|
-
};
|
|
822
|
-
return {
|
|
823
|
-
programAddress: instruction.programAddress,
|
|
824
|
-
accounts: {
|
|
825
|
-
config: getNextAccount(),
|
|
826
|
-
pool: getNextAccount(),
|
|
827
|
-
position: getNextAccount(),
|
|
828
|
-
protocolFeePosition: getNextAccount(),
|
|
829
|
-
owner: getNextAccount(),
|
|
830
|
-
authority: getNextAccount(),
|
|
831
|
-
vault0: getNextAccount(),
|
|
832
|
-
vault1: getNextAccount(),
|
|
833
|
-
token0Mint: getNextAccount(),
|
|
834
|
-
token1Mint: getNextAccount(),
|
|
835
|
-
user0: getNextAccount(),
|
|
836
|
-
user1: getNextAccount(),
|
|
837
|
-
token0Program: getNextAccount(),
|
|
838
|
-
token1Program: getNextAccount(),
|
|
839
|
-
oracle: getNextOptionalAccount()
|
|
840
|
-
},
|
|
841
|
-
data: getAddLiquidityInstructionDataDecoder().decode(instruction.data)
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
var CLOSE_POSITION_DISCRIMINATOR = new Uint8Array([
|
|
845
|
-
123,
|
|
846
|
-
134,
|
|
847
|
-
81,
|
|
848
|
-
0,
|
|
849
|
-
49,
|
|
850
|
-
68,
|
|
851
|
-
98,
|
|
852
|
-
98
|
|
853
|
-
]);
|
|
854
|
-
function getClosePositionDiscriminatorBytes() {
|
|
855
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
856
|
-
CLOSE_POSITION_DISCRIMINATOR
|
|
857
|
-
);
|
|
858
|
-
}
|
|
859
|
-
function getClosePositionInstructionDataEncoder() {
|
|
860
|
-
return kit.transformEncoder(
|
|
861
|
-
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
862
|
-
(value) => ({ ...value, discriminator: CLOSE_POSITION_DISCRIMINATOR })
|
|
863
|
-
);
|
|
864
|
-
}
|
|
865
|
-
function getClosePositionInstructionDataDecoder() {
|
|
866
|
-
return kit.getStructDecoder([
|
|
867
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
868
|
-
]);
|
|
869
|
-
}
|
|
870
|
-
function getClosePositionInstructionDataCodec() {
|
|
871
|
-
return kit.combineCodec(
|
|
872
|
-
getClosePositionInstructionDataEncoder(),
|
|
873
|
-
getClosePositionInstructionDataDecoder()
|
|
874
|
-
);
|
|
875
|
-
}
|
|
876
|
-
function getClosePositionInstruction(input, config) {
|
|
877
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
878
|
-
const originalAccounts = {
|
|
879
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
880
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
881
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
882
|
-
rentRecipient: { value: input.rentRecipient ?? null, isWritable: true }
|
|
883
|
-
};
|
|
884
|
-
const accounts = originalAccounts;
|
|
885
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
886
|
-
return Object.freeze({
|
|
887
|
-
accounts: [
|
|
888
|
-
getAccountMeta("pool", accounts.pool),
|
|
889
|
-
getAccountMeta("position", accounts.position),
|
|
890
|
-
getAccountMeta("owner", accounts.owner),
|
|
891
|
-
getAccountMeta("rentRecipient", accounts.rentRecipient)
|
|
892
|
-
],
|
|
893
|
-
data: getClosePositionInstructionDataEncoder().encode({}),
|
|
894
|
-
programAddress
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
function parseClosePositionInstruction(instruction) {
|
|
898
|
-
if (instruction.accounts.length < 4) {
|
|
899
|
-
throw new kit.SolanaError(
|
|
900
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
901
|
-
{
|
|
902
|
-
actualAccountMetas: instruction.accounts.length,
|
|
903
|
-
expectedAccountMetas: 4
|
|
904
|
-
}
|
|
905
|
-
);
|
|
906
|
-
}
|
|
907
|
-
let accountIndex = 0;
|
|
908
|
-
const getNextAccount = () => {
|
|
909
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
910
|
-
accountIndex += 1;
|
|
911
|
-
return accountMeta;
|
|
912
|
-
};
|
|
913
|
-
return {
|
|
914
|
-
programAddress: instruction.programAddress,
|
|
915
|
-
accounts: {
|
|
916
|
-
pool: getNextAccount(),
|
|
917
|
-
position: getNextAccount(),
|
|
918
|
-
owner: getNextAccount(),
|
|
919
|
-
rentRecipient: getNextAccount()
|
|
920
|
-
},
|
|
921
|
-
data: getClosePositionInstructionDataDecoder().decode(instruction.data)
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
var COLLECT_FEES_DISCRIMINATOR = new Uint8Array([
|
|
925
|
-
164,
|
|
926
|
-
152,
|
|
927
|
-
207,
|
|
928
|
-
99,
|
|
929
|
-
30,
|
|
930
|
-
186,
|
|
931
|
-
19,
|
|
932
|
-
182
|
|
933
|
-
]);
|
|
934
|
-
function getCollectFeesDiscriminatorBytes() {
|
|
935
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
936
|
-
COLLECT_FEES_DISCRIMINATOR
|
|
937
|
-
);
|
|
938
|
-
}
|
|
939
|
-
function getCollectFeesInstructionDataEncoder() {
|
|
940
|
-
return kit.transformEncoder(
|
|
941
|
-
kit.getStructEncoder([
|
|
942
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
943
|
-
["max0", kit.getU64Encoder()],
|
|
944
|
-
["max1", kit.getU64Encoder()]
|
|
945
|
-
]),
|
|
946
|
-
(value) => ({ ...value, discriminator: COLLECT_FEES_DISCRIMINATOR })
|
|
947
|
-
);
|
|
948
|
-
}
|
|
949
|
-
function getCollectFeesInstructionDataDecoder() {
|
|
950
|
-
return kit.getStructDecoder([
|
|
951
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
952
|
-
["max0", kit.getU64Decoder()],
|
|
953
|
-
["max1", kit.getU64Decoder()]
|
|
954
|
-
]);
|
|
955
|
-
}
|
|
956
|
-
function getCollectFeesInstructionDataCodec() {
|
|
957
|
-
return kit.combineCodec(
|
|
958
|
-
getCollectFeesInstructionDataEncoder(),
|
|
959
|
-
getCollectFeesInstructionDataDecoder()
|
|
960
|
-
);
|
|
961
|
-
}
|
|
962
|
-
async function getCollectFeesInstructionAsync(input, config) {
|
|
963
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
964
|
-
const originalAccounts = {
|
|
965
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
966
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
967
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
968
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
969
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
970
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
971
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
972
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
973
|
-
user0: { value: input.user0 ?? null, isWritable: true },
|
|
974
|
-
user1: { value: input.user1 ?? null, isWritable: true },
|
|
975
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
976
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
977
|
-
};
|
|
978
|
-
const accounts = originalAccounts;
|
|
979
|
-
const args = { ...input };
|
|
980
|
-
if (!accounts.authority.value) {
|
|
981
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
982
|
-
programAddress,
|
|
983
|
-
seeds: [
|
|
984
|
-
kit.getBytesEncoder().encode(
|
|
985
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
986
|
-
),
|
|
987
|
-
kit.getAddressEncoder().encode(
|
|
988
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
989
|
-
)
|
|
990
|
-
]
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
994
|
-
return Object.freeze({
|
|
995
|
-
accounts: [
|
|
996
|
-
getAccountMeta("pool", accounts.pool),
|
|
997
|
-
getAccountMeta("position", accounts.position),
|
|
998
|
-
getAccountMeta("owner", accounts.owner),
|
|
999
|
-
getAccountMeta("authority", accounts.authority),
|
|
1000
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
1001
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
1002
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
1003
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
1004
|
-
getAccountMeta("user0", accounts.user0),
|
|
1005
|
-
getAccountMeta("user1", accounts.user1),
|
|
1006
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
1007
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
1008
|
-
],
|
|
1009
|
-
data: getCollectFeesInstructionDataEncoder().encode(
|
|
1010
|
-
args
|
|
1011
|
-
),
|
|
1012
|
-
programAddress
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
function getCollectFeesInstruction(input, config) {
|
|
1016
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1017
|
-
const originalAccounts = {
|
|
1018
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
1019
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
1020
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
1021
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
1022
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
1023
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
1024
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
1025
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
1026
|
-
user0: { value: input.user0 ?? null, isWritable: true },
|
|
1027
|
-
user1: { value: input.user1 ?? null, isWritable: true },
|
|
1028
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
1029
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
1030
|
-
};
|
|
1031
|
-
const accounts = originalAccounts;
|
|
1032
|
-
const args = { ...input };
|
|
1033
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1034
|
-
return Object.freeze({
|
|
1035
|
-
accounts: [
|
|
1036
|
-
getAccountMeta("pool", accounts.pool),
|
|
1037
|
-
getAccountMeta("position", accounts.position),
|
|
1038
|
-
getAccountMeta("owner", accounts.owner),
|
|
1039
|
-
getAccountMeta("authority", accounts.authority),
|
|
1040
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
1041
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
1042
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
1043
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
1044
|
-
getAccountMeta("user0", accounts.user0),
|
|
1045
|
-
getAccountMeta("user1", accounts.user1),
|
|
1046
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
1047
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
1048
|
-
],
|
|
1049
|
-
data: getCollectFeesInstructionDataEncoder().encode(
|
|
1050
|
-
args
|
|
1051
|
-
),
|
|
1052
|
-
programAddress
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
function parseCollectFeesInstruction(instruction) {
|
|
1056
|
-
if (instruction.accounts.length < 12) {
|
|
1057
|
-
throw new kit.SolanaError(
|
|
1058
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
1059
|
-
{
|
|
1060
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1061
|
-
expectedAccountMetas: 12
|
|
1062
|
-
}
|
|
1063
|
-
);
|
|
1064
|
-
}
|
|
1065
|
-
let accountIndex = 0;
|
|
1066
|
-
const getNextAccount = () => {
|
|
1067
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1068
|
-
accountIndex += 1;
|
|
1069
|
-
return accountMeta;
|
|
1070
|
-
};
|
|
1071
|
-
return {
|
|
1072
|
-
programAddress: instruction.programAddress,
|
|
1073
|
-
accounts: {
|
|
1074
|
-
pool: getNextAccount(),
|
|
1075
|
-
position: getNextAccount(),
|
|
1076
|
-
owner: getNextAccount(),
|
|
1077
|
-
authority: getNextAccount(),
|
|
1078
|
-
vault0: getNextAccount(),
|
|
1079
|
-
vault1: getNextAccount(),
|
|
1080
|
-
token0Mint: getNextAccount(),
|
|
1081
|
-
token1Mint: getNextAccount(),
|
|
1082
|
-
user0: getNextAccount(),
|
|
1083
|
-
user1: getNextAccount(),
|
|
1084
|
-
token0Program: getNextAccount(),
|
|
1085
|
-
token1Program: getNextAccount()
|
|
1086
|
-
},
|
|
1087
|
-
data: getCollectFeesInstructionDataDecoder().decode(instruction.data)
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
var COLLECT_PROTOCOL_FEES_DISCRIMINATOR = new Uint8Array([
|
|
1091
|
-
22,
|
|
1092
|
-
67,
|
|
1093
|
-
23,
|
|
1094
|
-
98,
|
|
1095
|
-
150,
|
|
1096
|
-
178,
|
|
1097
|
-
70,
|
|
1098
|
-
220
|
|
1099
|
-
]);
|
|
1100
|
-
function getCollectProtocolFeesDiscriminatorBytes() {
|
|
1101
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
1102
|
-
COLLECT_PROTOCOL_FEES_DISCRIMINATOR
|
|
1103
|
-
);
|
|
1104
|
-
}
|
|
1105
|
-
function getCollectProtocolFeesInstructionDataEncoder() {
|
|
1106
|
-
return kit.transformEncoder(
|
|
1107
|
-
kit.getStructEncoder([
|
|
1108
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
1109
|
-
["max0", kit.getU64Encoder()],
|
|
1110
|
-
["max1", kit.getU64Encoder()]
|
|
1111
|
-
]),
|
|
1112
|
-
(value) => ({
|
|
1113
|
-
...value,
|
|
1114
|
-
discriminator: COLLECT_PROTOCOL_FEES_DISCRIMINATOR
|
|
1115
|
-
})
|
|
1116
|
-
);
|
|
1117
|
-
}
|
|
1118
|
-
function getCollectProtocolFeesInstructionDataDecoder() {
|
|
1119
|
-
return kit.getStructDecoder([
|
|
1120
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
1121
|
-
["max0", kit.getU64Decoder()],
|
|
1122
|
-
["max1", kit.getU64Decoder()]
|
|
1123
|
-
]);
|
|
1124
|
-
}
|
|
1125
|
-
function getCollectProtocolFeesInstructionDataCodec() {
|
|
1126
|
-
return kit.combineCodec(
|
|
1127
|
-
getCollectProtocolFeesInstructionDataEncoder(),
|
|
1128
|
-
getCollectProtocolFeesInstructionDataDecoder()
|
|
1129
|
-
);
|
|
1130
|
-
}
|
|
1131
|
-
async function getCollectProtocolFeesInstructionAsync(input, config) {
|
|
1132
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1133
|
-
const originalAccounts = {
|
|
1134
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
1135
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
1136
|
-
protocolFeePosition: {
|
|
1137
|
-
value: input.protocolFeePosition ?? null,
|
|
1138
|
-
isWritable: true
|
|
1139
|
-
},
|
|
1140
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
1141
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
1142
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
1143
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
1144
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
1145
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
1146
|
-
recipient0: { value: input.recipient0 ?? null, isWritable: true },
|
|
1147
|
-
recipient1: { value: input.recipient1 ?? null, isWritable: true },
|
|
1148
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
1149
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
1150
|
-
};
|
|
1151
|
-
const accounts = originalAccounts;
|
|
1152
|
-
const args = { ...input };
|
|
1153
|
-
if (!accounts.authority.value) {
|
|
1154
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
1155
|
-
programAddress,
|
|
1156
|
-
seeds: [
|
|
1157
|
-
kit.getBytesEncoder().encode(
|
|
1158
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1159
|
-
),
|
|
1160
|
-
kit.getAddressEncoder().encode(
|
|
1161
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1162
|
-
)
|
|
1163
|
-
]
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1167
|
-
return Object.freeze({
|
|
1168
|
-
accounts: [
|
|
1169
|
-
getAccountMeta("config", accounts.config),
|
|
1170
|
-
getAccountMeta("pool", accounts.pool),
|
|
1171
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1172
|
-
getAccountMeta("admin", accounts.admin),
|
|
1173
|
-
getAccountMeta("authority", accounts.authority),
|
|
1174
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
1175
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
1176
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
1177
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
1178
|
-
getAccountMeta("recipient0", accounts.recipient0),
|
|
1179
|
-
getAccountMeta("recipient1", accounts.recipient1),
|
|
1180
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
1181
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
1182
|
-
],
|
|
1183
|
-
data: getCollectProtocolFeesInstructionDataEncoder().encode(
|
|
1184
|
-
args
|
|
1185
|
-
),
|
|
1186
|
-
programAddress
|
|
1187
|
-
});
|
|
1188
|
-
}
|
|
1189
|
-
function getCollectProtocolFeesInstruction(input, config) {
|
|
1190
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1191
|
-
const originalAccounts = {
|
|
1192
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
1193
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
1194
|
-
protocolFeePosition: {
|
|
1195
|
-
value: input.protocolFeePosition ?? null,
|
|
1196
|
-
isWritable: true
|
|
1197
|
-
},
|
|
1198
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
1199
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
1200
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
1201
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
1202
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
1203
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
1204
|
-
recipient0: { value: input.recipient0 ?? null, isWritable: true },
|
|
1205
|
-
recipient1: { value: input.recipient1 ?? null, isWritable: true },
|
|
1206
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
1207
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
1208
|
-
};
|
|
1209
|
-
const accounts = originalAccounts;
|
|
1210
|
-
const args = { ...input };
|
|
1211
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1212
|
-
return Object.freeze({
|
|
1213
|
-
accounts: [
|
|
1214
|
-
getAccountMeta("config", accounts.config),
|
|
1215
|
-
getAccountMeta("pool", accounts.pool),
|
|
1216
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1217
|
-
getAccountMeta("admin", accounts.admin),
|
|
1218
|
-
getAccountMeta("authority", accounts.authority),
|
|
1219
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
1220
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
1221
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
1222
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
1223
|
-
getAccountMeta("recipient0", accounts.recipient0),
|
|
1224
|
-
getAccountMeta("recipient1", accounts.recipient1),
|
|
1225
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
1226
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
1227
|
-
],
|
|
1228
|
-
data: getCollectProtocolFeesInstructionDataEncoder().encode(
|
|
1229
|
-
args
|
|
1230
|
-
),
|
|
1231
|
-
programAddress
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
function parseCollectProtocolFeesInstruction(instruction) {
|
|
1235
|
-
if (instruction.accounts.length < 13) {
|
|
1236
|
-
throw new kit.SolanaError(
|
|
1237
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
1238
|
-
{
|
|
1239
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1240
|
-
expectedAccountMetas: 13
|
|
1241
|
-
}
|
|
1242
|
-
);
|
|
1243
|
-
}
|
|
1244
|
-
let accountIndex = 0;
|
|
1245
|
-
const getNextAccount = () => {
|
|
1246
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1247
|
-
accountIndex += 1;
|
|
1248
|
-
return accountMeta;
|
|
1249
|
-
};
|
|
1250
|
-
return {
|
|
1251
|
-
programAddress: instruction.programAddress,
|
|
1252
|
-
accounts: {
|
|
1253
|
-
config: getNextAccount(),
|
|
1254
|
-
pool: getNextAccount(),
|
|
1255
|
-
protocolFeePosition: getNextAccount(),
|
|
1256
|
-
admin: getNextAccount(),
|
|
1257
|
-
authority: getNextAccount(),
|
|
1258
|
-
vault0: getNextAccount(),
|
|
1259
|
-
vault1: getNextAccount(),
|
|
1260
|
-
token0Mint: getNextAccount(),
|
|
1261
|
-
token1Mint: getNextAccount(),
|
|
1262
|
-
recipient0: getNextAccount(),
|
|
1263
|
-
recipient1: getNextAccount(),
|
|
1264
|
-
token0Program: getNextAccount(),
|
|
1265
|
-
token1Program: getNextAccount()
|
|
1266
|
-
},
|
|
1267
|
-
data: getCollectProtocolFeesInstructionDataDecoder().decode(
|
|
1268
|
-
instruction.data
|
|
1269
|
-
)
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
|
-
var CREATE_POSITION_DISCRIMINATOR = new Uint8Array([
|
|
1273
|
-
48,
|
|
1274
|
-
215,
|
|
1275
|
-
197,
|
|
1276
|
-
153,
|
|
1277
|
-
96,
|
|
1278
|
-
203,
|
|
1279
|
-
180,
|
|
1280
|
-
133
|
|
1281
|
-
]);
|
|
1282
|
-
function getCreatePositionDiscriminatorBytes() {
|
|
1283
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
1284
|
-
CREATE_POSITION_DISCRIMINATOR
|
|
1285
|
-
);
|
|
1286
|
-
}
|
|
1287
|
-
function getCreatePositionInstructionDataEncoder() {
|
|
1288
|
-
return kit.transformEncoder(
|
|
1289
|
-
kit.getStructEncoder([
|
|
1290
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
1291
|
-
["positionId", kit.getU64Encoder()]
|
|
1292
|
-
]),
|
|
1293
|
-
(value) => ({ ...value, discriminator: CREATE_POSITION_DISCRIMINATOR })
|
|
1294
|
-
);
|
|
1295
|
-
}
|
|
1296
|
-
function getCreatePositionInstructionDataDecoder() {
|
|
1297
|
-
return kit.getStructDecoder([
|
|
1298
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
1299
|
-
["positionId", kit.getU64Decoder()]
|
|
1300
|
-
]);
|
|
1301
|
-
}
|
|
1302
|
-
function getCreatePositionInstructionDataCodec() {
|
|
1303
|
-
return kit.combineCodec(
|
|
1304
|
-
getCreatePositionInstructionDataEncoder(),
|
|
1305
|
-
getCreatePositionInstructionDataDecoder()
|
|
1306
|
-
);
|
|
1307
|
-
}
|
|
1308
|
-
async function getCreatePositionInstructionAsync(input, config) {
|
|
1309
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1310
|
-
const originalAccounts = {
|
|
1311
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
1312
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
1313
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
1314
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1315
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1316
|
-
};
|
|
1317
|
-
const accounts = originalAccounts;
|
|
1318
|
-
const args = { ...input };
|
|
1319
|
-
if (!accounts.position.value) {
|
|
1320
|
-
accounts.position.value = await kit.getProgramDerivedAddress({
|
|
1321
|
-
programAddress,
|
|
1322
|
-
seeds: [
|
|
1323
|
-
kit.getBytesEncoder().encode(
|
|
1324
|
-
new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
|
|
1325
|
-
),
|
|
1326
|
-
kit.getAddressEncoder().encode(
|
|
1327
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1328
|
-
),
|
|
1329
|
-
kit.getAddressEncoder().encode(
|
|
1330
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
1331
|
-
"owner",
|
|
1332
|
-
accounts.owner.value
|
|
1333
|
-
)
|
|
1334
|
-
),
|
|
1335
|
-
kit.getU64Encoder().encode(
|
|
1336
|
-
programClientCore.getNonNullResolvedInstructionInput("positionId", args.positionId)
|
|
1337
|
-
)
|
|
1338
|
-
]
|
|
1339
|
-
});
|
|
1340
|
-
}
|
|
1341
|
-
if (!accounts.systemProgram.value) {
|
|
1342
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1343
|
-
}
|
|
1344
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1345
|
-
return Object.freeze({
|
|
1346
|
-
accounts: [
|
|
1347
|
-
getAccountMeta("pool", accounts.pool),
|
|
1348
|
-
getAccountMeta("position", accounts.position),
|
|
1349
|
-
getAccountMeta("owner", accounts.owner),
|
|
1350
|
-
getAccountMeta("payer", accounts.payer),
|
|
1351
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1352
|
-
],
|
|
1353
|
-
data: getCreatePositionInstructionDataEncoder().encode(
|
|
1354
|
-
args
|
|
1355
|
-
),
|
|
1356
|
-
programAddress
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
function getCreatePositionInstruction(input, config) {
|
|
1360
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1361
|
-
const originalAccounts = {
|
|
1362
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
1363
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
1364
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
1365
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1366
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1367
|
-
};
|
|
1368
|
-
const accounts = originalAccounts;
|
|
1369
|
-
const args = { ...input };
|
|
1370
|
-
if (!accounts.systemProgram.value) {
|
|
1371
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1372
|
-
}
|
|
1373
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1374
|
-
return Object.freeze({
|
|
1375
|
-
accounts: [
|
|
1376
|
-
getAccountMeta("pool", accounts.pool),
|
|
1377
|
-
getAccountMeta("position", accounts.position),
|
|
1378
|
-
getAccountMeta("owner", accounts.owner),
|
|
1379
|
-
getAccountMeta("payer", accounts.payer),
|
|
1380
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1381
|
-
],
|
|
1382
|
-
data: getCreatePositionInstructionDataEncoder().encode(
|
|
1383
|
-
args
|
|
1384
|
-
),
|
|
1385
|
-
programAddress
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
function parseCreatePositionInstruction(instruction) {
|
|
1389
|
-
if (instruction.accounts.length < 5) {
|
|
1390
|
-
throw new kit.SolanaError(
|
|
1391
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
1392
|
-
{
|
|
1393
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1394
|
-
expectedAccountMetas: 5
|
|
1395
|
-
}
|
|
1396
|
-
);
|
|
1397
|
-
}
|
|
1398
|
-
let accountIndex = 0;
|
|
1399
|
-
const getNextAccount = () => {
|
|
1400
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1401
|
-
accountIndex += 1;
|
|
1402
|
-
return accountMeta;
|
|
1403
|
-
};
|
|
1404
|
-
return {
|
|
1405
|
-
programAddress: instruction.programAddress,
|
|
1406
|
-
accounts: {
|
|
1407
|
-
pool: getNextAccount(),
|
|
1408
|
-
position: getNextAccount(),
|
|
1409
|
-
owner: getNextAccount(),
|
|
1410
|
-
payer: getNextAccount(),
|
|
1411
|
-
systemProgram: getNextAccount()
|
|
1412
|
-
},
|
|
1413
|
-
data: getCreatePositionInstructionDataDecoder().decode(instruction.data)
|
|
1414
|
-
};
|
|
1415
|
-
}
|
|
1416
|
-
var INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
1417
|
-
208,
|
|
1418
|
-
127,
|
|
1419
|
-
21,
|
|
1420
|
-
1,
|
|
1421
|
-
194,
|
|
1422
|
-
190,
|
|
1423
|
-
196,
|
|
1424
|
-
70
|
|
1425
|
-
]);
|
|
1426
|
-
function getInitializeConfigDiscriminatorBytes() {
|
|
1427
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
1428
|
-
INITIALIZE_CONFIG_DISCRIMINATOR
|
|
1429
|
-
);
|
|
1430
|
-
}
|
|
1431
|
-
function getInitializeConfigInstructionDataEncoder() {
|
|
1432
|
-
return kit.transformEncoder(
|
|
1433
|
-
kit.getStructEncoder([
|
|
1434
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
1435
|
-
["admin", kit.getAddressEncoder()],
|
|
1436
|
-
["numeraireMint", kit.getAddressEncoder()],
|
|
1437
|
-
["maxSwapFeeBps", kit.getU16Encoder()],
|
|
1438
|
-
["maxFeeSplitBps", kit.getU16Encoder()],
|
|
1439
|
-
["maxRouteHops", kit.getU8Encoder()],
|
|
1440
|
-
["protocolFeeEnabled", kit.getBooleanEncoder()],
|
|
1441
|
-
["protocolFeeBps", kit.getU16Encoder()],
|
|
1442
|
-
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
1443
|
-
]),
|
|
1444
|
-
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR })
|
|
1445
|
-
);
|
|
1446
|
-
}
|
|
1447
|
-
function getInitializeConfigInstructionDataDecoder() {
|
|
1448
|
-
return kit.getStructDecoder([
|
|
1449
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
1450
|
-
["admin", kit.getAddressDecoder()],
|
|
1451
|
-
["numeraireMint", kit.getAddressDecoder()],
|
|
1452
|
-
["maxSwapFeeBps", kit.getU16Decoder()],
|
|
1453
|
-
["maxFeeSplitBps", kit.getU16Decoder()],
|
|
1454
|
-
["maxRouteHops", kit.getU8Decoder()],
|
|
1455
|
-
["protocolFeeEnabled", kit.getBooleanDecoder()],
|
|
1456
|
-
["protocolFeeBps", kit.getU16Decoder()],
|
|
1457
|
-
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
1458
|
-
]);
|
|
1459
|
-
}
|
|
1460
|
-
function getInitializeConfigInstructionDataCodec() {
|
|
1461
|
-
return kit.combineCodec(
|
|
1462
|
-
getInitializeConfigInstructionDataEncoder(),
|
|
1463
|
-
getInitializeConfigInstructionDataDecoder()
|
|
1464
|
-
);
|
|
1465
|
-
}
|
|
1466
|
-
async function getInitializeConfigInstructionAsync(input, config) {
|
|
1467
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1468
|
-
const originalAccounts = {
|
|
1469
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
1470
|
-
programData: { value: input.programData ?? null, isWritable: false },
|
|
1471
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1472
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1473
|
-
};
|
|
1474
|
-
const accounts = originalAccounts;
|
|
1475
|
-
const args = { ...input };
|
|
1476
|
-
if (!accounts.config.value) {
|
|
1477
|
-
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
1478
|
-
programAddress,
|
|
1479
|
-
seeds: [
|
|
1480
|
-
kit.getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
|
|
1481
|
-
]
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
if (!accounts.systemProgram.value) {
|
|
1485
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1486
|
-
}
|
|
1487
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1488
|
-
return Object.freeze({
|
|
1489
|
-
accounts: [
|
|
1490
|
-
getAccountMeta("config", accounts.config),
|
|
1491
|
-
getAccountMeta("programData", accounts.programData),
|
|
1492
|
-
getAccountMeta("payer", accounts.payer),
|
|
1493
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1494
|
-
],
|
|
1495
|
-
data: getInitializeConfigInstructionDataEncoder().encode(
|
|
1496
|
-
args
|
|
1497
|
-
),
|
|
1498
|
-
programAddress
|
|
1499
|
-
});
|
|
1500
|
-
}
|
|
1501
|
-
function getInitializeConfigInstruction(input, config) {
|
|
1502
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1503
|
-
const originalAccounts = {
|
|
1504
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
1505
|
-
programData: { value: input.programData ?? null, isWritable: false },
|
|
1506
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1507
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1508
|
-
};
|
|
1509
|
-
const accounts = originalAccounts;
|
|
1510
|
-
const args = { ...input };
|
|
1511
|
-
if (!accounts.systemProgram.value) {
|
|
1512
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1513
|
-
}
|
|
1514
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1515
|
-
return Object.freeze({
|
|
1516
|
-
accounts: [
|
|
1517
|
-
getAccountMeta("config", accounts.config),
|
|
1518
|
-
getAccountMeta("programData", accounts.programData),
|
|
1519
|
-
getAccountMeta("payer", accounts.payer),
|
|
1520
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1521
|
-
],
|
|
1522
|
-
data: getInitializeConfigInstructionDataEncoder().encode(
|
|
1523
|
-
args
|
|
1524
|
-
),
|
|
1525
|
-
programAddress
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
function parseInitializeConfigInstruction(instruction) {
|
|
1529
|
-
if (instruction.accounts.length < 4) {
|
|
1530
|
-
throw new kit.SolanaError(
|
|
1531
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
1532
|
-
{
|
|
1533
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1534
|
-
expectedAccountMetas: 4
|
|
1535
|
-
}
|
|
1536
|
-
);
|
|
1537
|
-
}
|
|
1538
|
-
let accountIndex = 0;
|
|
1539
|
-
const getNextAccount = () => {
|
|
1540
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1541
|
-
accountIndex += 1;
|
|
1542
|
-
return accountMeta;
|
|
1543
|
-
};
|
|
1544
|
-
return {
|
|
1545
|
-
programAddress: instruction.programAddress,
|
|
1546
|
-
accounts: {
|
|
1547
|
-
config: getNextAccount(),
|
|
1548
|
-
programData: getNextAccount(),
|
|
1549
|
-
payer: getNextAccount(),
|
|
1550
|
-
systemProgram: getNextAccount()
|
|
1551
|
-
},
|
|
1552
|
-
data: getInitializeConfigInstructionDataDecoder().decode(instruction.data)
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
var INITIALIZE_ORACLE_DISCRIMINATOR = new Uint8Array([
|
|
1556
|
-
144,
|
|
1557
|
-
223,
|
|
1558
|
-
131,
|
|
1559
|
-
120,
|
|
1560
|
-
196,
|
|
1561
|
-
253,
|
|
1562
|
-
181,
|
|
1563
|
-
99
|
|
1564
|
-
]);
|
|
1565
|
-
function getInitializeOracleDiscriminatorBytes() {
|
|
1566
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
1567
|
-
INITIALIZE_ORACLE_DISCRIMINATOR
|
|
1568
|
-
);
|
|
1569
|
-
}
|
|
1570
|
-
function getInitializeOracleInstructionDataEncoder() {
|
|
1571
|
-
return kit.transformEncoder(
|
|
1572
|
-
kit.getStructEncoder([
|
|
1573
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
1574
|
-
["maxPriceChangeRatioQ64", kit.getU128Encoder()],
|
|
1575
|
-
["observationIntervalSec", kit.getU32Encoder()]
|
|
1576
|
-
]),
|
|
1577
|
-
(value) => ({ ...value, discriminator: INITIALIZE_ORACLE_DISCRIMINATOR })
|
|
1578
|
-
);
|
|
1579
|
-
}
|
|
1580
|
-
function getInitializeOracleInstructionDataDecoder() {
|
|
1581
|
-
return kit.getStructDecoder([
|
|
1582
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
1583
|
-
["maxPriceChangeRatioQ64", kit.getU128Decoder()],
|
|
1584
|
-
["observationIntervalSec", kit.getU32Decoder()]
|
|
1585
|
-
]);
|
|
1586
|
-
}
|
|
1587
|
-
function getInitializeOracleInstructionDataCodec() {
|
|
1588
|
-
return kit.combineCodec(
|
|
1589
|
-
getInitializeOracleInstructionDataEncoder(),
|
|
1590
|
-
getInitializeOracleInstructionDataDecoder()
|
|
1591
|
-
);
|
|
1592
|
-
}
|
|
1593
|
-
async function getInitializeOracleInstructionAsync(input, config) {
|
|
1594
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1595
|
-
const originalAccounts = {
|
|
1596
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
1597
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
1598
|
-
oracle: { value: input.oracle ?? null, isWritable: true },
|
|
1599
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
1600
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1601
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1602
|
-
};
|
|
1603
|
-
const accounts = originalAccounts;
|
|
1604
|
-
const args = { ...input };
|
|
1605
|
-
if (!accounts.oracle.value) {
|
|
1606
|
-
accounts.oracle.value = await kit.getProgramDerivedAddress({
|
|
1607
|
-
programAddress,
|
|
1608
|
-
seeds: [
|
|
1609
|
-
kit.getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
|
|
1610
|
-
kit.getAddressEncoder().encode(
|
|
1611
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1612
|
-
)
|
|
1613
|
-
]
|
|
1614
|
-
});
|
|
1615
|
-
}
|
|
1616
|
-
if (!accounts.systemProgram.value) {
|
|
1617
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1618
|
-
}
|
|
1619
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1620
|
-
return Object.freeze({
|
|
1621
|
-
accounts: [
|
|
1622
|
-
getAccountMeta("config", accounts.config),
|
|
1623
|
-
getAccountMeta("pool", accounts.pool),
|
|
1624
|
-
getAccountMeta("oracle", accounts.oracle),
|
|
1625
|
-
getAccountMeta("admin", accounts.admin),
|
|
1626
|
-
getAccountMeta("payer", accounts.payer),
|
|
1627
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1628
|
-
],
|
|
1629
|
-
data: getInitializeOracleInstructionDataEncoder().encode(
|
|
1630
|
-
args
|
|
1631
|
-
),
|
|
1632
|
-
programAddress
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
function getInitializeOracleInstruction(input, config) {
|
|
1636
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1637
|
-
const originalAccounts = {
|
|
1638
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
1639
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
1640
|
-
oracle: { value: input.oracle ?? null, isWritable: true },
|
|
1641
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
1642
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1643
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1644
|
-
};
|
|
1645
|
-
const accounts = originalAccounts;
|
|
1646
|
-
const args = { ...input };
|
|
1647
|
-
if (!accounts.systemProgram.value) {
|
|
1648
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1649
|
-
}
|
|
1650
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1651
|
-
return Object.freeze({
|
|
1652
|
-
accounts: [
|
|
1653
|
-
getAccountMeta("config", accounts.config),
|
|
1654
|
-
getAccountMeta("pool", accounts.pool),
|
|
1655
|
-
getAccountMeta("oracle", accounts.oracle),
|
|
1656
|
-
getAccountMeta("admin", accounts.admin),
|
|
1657
|
-
getAccountMeta("payer", accounts.payer),
|
|
1658
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1659
|
-
],
|
|
1660
|
-
data: getInitializeOracleInstructionDataEncoder().encode(
|
|
1661
|
-
args
|
|
1662
|
-
),
|
|
1663
|
-
programAddress
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1666
|
-
function parseInitializeOracleInstruction(instruction) {
|
|
1667
|
-
if (instruction.accounts.length < 6) {
|
|
1668
|
-
throw new kit.SolanaError(
|
|
1669
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
1670
|
-
{
|
|
1671
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1672
|
-
expectedAccountMetas: 6
|
|
1673
|
-
}
|
|
1674
|
-
);
|
|
1675
|
-
}
|
|
1676
|
-
let accountIndex = 0;
|
|
1677
|
-
const getNextAccount = () => {
|
|
1678
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1679
|
-
accountIndex += 1;
|
|
1680
|
-
return accountMeta;
|
|
1681
|
-
};
|
|
1682
|
-
return {
|
|
1683
|
-
programAddress: instruction.programAddress,
|
|
1684
|
-
accounts: {
|
|
1685
|
-
config: getNextAccount(),
|
|
1686
|
-
pool: getNextAccount(),
|
|
1687
|
-
oracle: getNextAccount(),
|
|
1688
|
-
admin: getNextAccount(),
|
|
1689
|
-
payer: getNextAccount(),
|
|
1690
|
-
systemProgram: getNextAccount()
|
|
1691
|
-
},
|
|
1692
|
-
data: getInitializeOracleInstructionDataDecoder().decode(instruction.data)
|
|
1693
|
-
};
|
|
1694
|
-
}
|
|
1695
|
-
var INITIALIZE_POOL_DISCRIMINATOR = new Uint8Array([
|
|
1696
|
-
95,
|
|
1697
|
-
180,
|
|
1698
|
-
10,
|
|
1699
|
-
172,
|
|
1700
|
-
84,
|
|
1701
|
-
174,
|
|
1702
|
-
232,
|
|
1703
|
-
40
|
|
1704
|
-
]);
|
|
1705
|
-
function getInitializePoolDiscriminatorBytes() {
|
|
1706
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
1707
|
-
INITIALIZE_POOL_DISCRIMINATOR
|
|
1708
|
-
);
|
|
1709
|
-
}
|
|
1710
|
-
function getInitializePoolInstructionDataEncoder() {
|
|
1711
|
-
return kit.transformEncoder(
|
|
1712
|
-
kit.getStructEncoder([
|
|
1713
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
1714
|
-
["mintA", kit.getAddressEncoder()],
|
|
1715
|
-
["mintB", kit.getAddressEncoder()],
|
|
1716
|
-
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
1717
|
-
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
1718
|
-
["liquidityMeasureTokenIndex", kit.getU8Encoder()],
|
|
1719
|
-
["numeraireMintOverride", kit.getOptionEncoder(kit.getAddressEncoder())],
|
|
1720
|
-
["hookProgram", kit.getAddressEncoder()],
|
|
1721
|
-
["hookFlags", kit.getU32Encoder()]
|
|
1722
|
-
]),
|
|
1723
|
-
(value) => ({ ...value, discriminator: INITIALIZE_POOL_DISCRIMINATOR })
|
|
1724
|
-
);
|
|
1725
|
-
}
|
|
1726
|
-
function getInitializePoolInstructionDataDecoder() {
|
|
1727
|
-
return kit.getStructDecoder([
|
|
1728
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
1729
|
-
["mintA", kit.getAddressDecoder()],
|
|
1730
|
-
["mintB", kit.getAddressDecoder()],
|
|
1731
|
-
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
1732
|
-
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
1733
|
-
["liquidityMeasureTokenIndex", kit.getU8Decoder()],
|
|
1734
|
-
["numeraireMintOverride", kit.getOptionDecoder(kit.getAddressDecoder())],
|
|
1735
|
-
["hookProgram", kit.getAddressDecoder()],
|
|
1736
|
-
["hookFlags", kit.getU32Decoder()]
|
|
1737
|
-
]);
|
|
1738
|
-
}
|
|
1739
|
-
function getInitializePoolInstructionDataCodec() {
|
|
1740
|
-
return kit.combineCodec(
|
|
1741
|
-
getInitializePoolInstructionDataEncoder(),
|
|
1742
|
-
getInitializePoolInstructionDataDecoder()
|
|
1743
|
-
);
|
|
1744
|
-
}
|
|
1745
|
-
async function getInitializePoolInstructionAsync(input, config) {
|
|
1746
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1747
|
-
const originalAccounts = {
|
|
1748
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
1749
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
1750
|
-
protocolFeePosition: {
|
|
1751
|
-
value: input.protocolFeePosition ?? null,
|
|
1752
|
-
isWritable: true
|
|
1753
|
-
},
|
|
1754
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
1755
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
1756
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
1757
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
1758
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
1759
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1760
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
1761
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
1762
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1763
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
1764
|
-
migrationAuthority: {
|
|
1765
|
-
value: input.migrationAuthority ?? null,
|
|
1766
|
-
isWritable: false
|
|
1767
|
-
}
|
|
1768
|
-
};
|
|
1769
|
-
const accounts = originalAccounts;
|
|
1770
|
-
const args = { ...input };
|
|
1771
|
-
if (!accounts.pool.value) {
|
|
1772
|
-
accounts.pool.value = await kit.getProgramDerivedAddress({
|
|
1773
|
-
programAddress,
|
|
1774
|
-
seeds: [
|
|
1775
|
-
kit.getBytesEncoder().encode(new Uint8Array([112, 111, 111, 108])),
|
|
1776
|
-
kit.getAddressEncoder().encode(
|
|
1777
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
1778
|
-
"token0Mint",
|
|
1779
|
-
accounts.token0Mint.value
|
|
1780
|
-
)
|
|
1781
|
-
),
|
|
1782
|
-
kit.getAddressEncoder().encode(
|
|
1783
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
1784
|
-
"token1Mint",
|
|
1785
|
-
accounts.token1Mint.value
|
|
1786
|
-
)
|
|
1787
|
-
)
|
|
1788
|
-
]
|
|
1789
|
-
});
|
|
1790
|
-
}
|
|
1791
|
-
if (!accounts.protocolFeePosition.value) {
|
|
1792
|
-
accounts.protocolFeePosition.value = await kit.getProgramDerivedAddress({
|
|
1793
|
-
programAddress,
|
|
1794
|
-
seeds: [
|
|
1795
|
-
kit.getBytesEncoder().encode(
|
|
1796
|
-
new Uint8Array([
|
|
1797
|
-
112,
|
|
1798
|
-
114,
|
|
1799
|
-
111,
|
|
1800
|
-
116,
|
|
1801
|
-
111,
|
|
1802
|
-
99,
|
|
1803
|
-
111,
|
|
1804
|
-
108,
|
|
1805
|
-
95,
|
|
1806
|
-
112,
|
|
1807
|
-
111,
|
|
1808
|
-
115,
|
|
1809
|
-
105,
|
|
1810
|
-
116,
|
|
1811
|
-
105,
|
|
1812
|
-
111,
|
|
1813
|
-
110
|
|
1814
|
-
])
|
|
1815
|
-
),
|
|
1816
|
-
kit.getAddressEncoder().encode(
|
|
1817
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1818
|
-
)
|
|
1819
|
-
]
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
if (!accounts.authority.value) {
|
|
1823
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
1824
|
-
programAddress,
|
|
1825
|
-
seeds: [
|
|
1826
|
-
kit.getBytesEncoder().encode(
|
|
1827
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
1828
|
-
),
|
|
1829
|
-
kit.getAddressEncoder().encode(
|
|
1830
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1831
|
-
)
|
|
1832
|
-
]
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
1835
|
-
if (!accounts.vault0.value) {
|
|
1836
|
-
accounts.vault0.value = await kit.getProgramDerivedAddress({
|
|
1837
|
-
programAddress,
|
|
1838
|
-
seeds: [
|
|
1839
|
-
kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 48])),
|
|
1840
|
-
kit.getAddressEncoder().encode(
|
|
1841
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1842
|
-
)
|
|
1843
|
-
]
|
|
1844
|
-
});
|
|
1845
|
-
}
|
|
1846
|
-
if (!accounts.vault1.value) {
|
|
1847
|
-
accounts.vault1.value = await kit.getProgramDerivedAddress({
|
|
1848
|
-
programAddress,
|
|
1849
|
-
seeds: [
|
|
1850
|
-
kit.getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 49])),
|
|
1851
|
-
kit.getAddressEncoder().encode(
|
|
1852
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
1853
|
-
)
|
|
1854
|
-
]
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
if (!accounts.systemProgram.value) {
|
|
1858
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1859
|
-
}
|
|
1860
|
-
if (!accounts.rent.value) {
|
|
1861
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
1862
|
-
}
|
|
1863
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1864
|
-
return Object.freeze({
|
|
1865
|
-
accounts: [
|
|
1866
|
-
getAccountMeta("config", accounts.config),
|
|
1867
|
-
getAccountMeta("pool", accounts.pool),
|
|
1868
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1869
|
-
getAccountMeta("authority", accounts.authority),
|
|
1870
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
1871
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
1872
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
1873
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
1874
|
-
getAccountMeta("payer", accounts.payer),
|
|
1875
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
1876
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
1877
|
-
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1878
|
-
getAccountMeta("rent", accounts.rent),
|
|
1879
|
-
getAccountMeta("migrationAuthority", accounts.migrationAuthority)
|
|
1880
|
-
],
|
|
1881
|
-
data: getInitializePoolInstructionDataEncoder().encode(
|
|
1882
|
-
args
|
|
1883
|
-
),
|
|
1884
|
-
programAddress
|
|
1885
|
-
});
|
|
1886
|
-
}
|
|
1887
|
-
function getInitializePoolInstruction(input, config) {
|
|
1888
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
1889
|
-
const originalAccounts = {
|
|
1890
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
1891
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
1892
|
-
protocolFeePosition: {
|
|
1893
|
-
value: input.protocolFeePosition ?? null,
|
|
1894
|
-
isWritable: true
|
|
1895
|
-
},
|
|
1896
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
1897
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
1898
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
1899
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
1900
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
1901
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
1902
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
1903
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
1904
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1905
|
-
rent: { value: input.rent ?? null, isWritable: false },
|
|
1906
|
-
migrationAuthority: {
|
|
1907
|
-
value: input.migrationAuthority ?? null,
|
|
1908
|
-
isWritable: false
|
|
1909
|
-
}
|
|
1910
|
-
};
|
|
1911
|
-
const accounts = originalAccounts;
|
|
1912
|
-
const args = { ...input };
|
|
1913
|
-
if (!accounts.systemProgram.value) {
|
|
1914
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1915
|
-
}
|
|
1916
|
-
if (!accounts.rent.value) {
|
|
1917
|
-
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
1918
|
-
}
|
|
1919
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
1920
|
-
return Object.freeze({
|
|
1921
|
-
accounts: [
|
|
1922
|
-
getAccountMeta("config", accounts.config),
|
|
1923
|
-
getAccountMeta("pool", accounts.pool),
|
|
1924
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
1925
|
-
getAccountMeta("authority", accounts.authority),
|
|
1926
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
1927
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
1928
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
1929
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
1930
|
-
getAccountMeta("payer", accounts.payer),
|
|
1931
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
1932
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
1933
|
-
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1934
|
-
getAccountMeta("rent", accounts.rent),
|
|
1935
|
-
getAccountMeta("migrationAuthority", accounts.migrationAuthority)
|
|
1936
|
-
],
|
|
1937
|
-
data: getInitializePoolInstructionDataEncoder().encode(
|
|
1938
|
-
args
|
|
1939
|
-
),
|
|
1940
|
-
programAddress
|
|
1941
|
-
});
|
|
1942
|
-
}
|
|
1943
|
-
function parseInitializePoolInstruction(instruction) {
|
|
1944
|
-
if (instruction.accounts.length < 14) {
|
|
1945
|
-
throw new kit.SolanaError(
|
|
1946
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
1947
|
-
{
|
|
1948
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1949
|
-
expectedAccountMetas: 14
|
|
1950
|
-
}
|
|
1951
|
-
);
|
|
1952
|
-
}
|
|
1953
|
-
let accountIndex = 0;
|
|
1954
|
-
const getNextAccount = () => {
|
|
1955
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1956
|
-
accountIndex += 1;
|
|
1957
|
-
return accountMeta;
|
|
1958
|
-
};
|
|
1959
|
-
return {
|
|
1960
|
-
programAddress: instruction.programAddress,
|
|
1961
|
-
accounts: {
|
|
1962
|
-
config: getNextAccount(),
|
|
1963
|
-
pool: getNextAccount(),
|
|
1964
|
-
protocolFeePosition: getNextAccount(),
|
|
1965
|
-
authority: getNextAccount(),
|
|
1966
|
-
vault0: getNextAccount(),
|
|
1967
|
-
vault1: getNextAccount(),
|
|
1968
|
-
token0Mint: getNextAccount(),
|
|
1969
|
-
token1Mint: getNextAccount(),
|
|
1970
|
-
payer: getNextAccount(),
|
|
1971
|
-
token0Program: getNextAccount(),
|
|
1972
|
-
token1Program: getNextAccount(),
|
|
1973
|
-
systemProgram: getNextAccount(),
|
|
1974
|
-
rent: getNextAccount(),
|
|
1975
|
-
migrationAuthority: getNextAccount()
|
|
1976
|
-
},
|
|
1977
|
-
data: getInitializePoolInstructionDataDecoder().decode(instruction.data)
|
|
1978
|
-
};
|
|
1979
|
-
}
|
|
1980
|
-
var ORACLE_CONSULT_DISCRIMINATOR = new Uint8Array([
|
|
1981
|
-
239,
|
|
1982
|
-
237,
|
|
1983
|
-
255,
|
|
1984
|
-
177,
|
|
1985
|
-
142,
|
|
1986
|
-
72,
|
|
1987
|
-
96,
|
|
1988
|
-
175
|
|
1989
|
-
]);
|
|
1990
|
-
function getOracleConsultDiscriminatorBytes() {
|
|
1991
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
1992
|
-
ORACLE_CONSULT_DISCRIMINATOR
|
|
1993
|
-
);
|
|
1994
|
-
}
|
|
1995
|
-
function getOracleConsultInstructionDataEncoder() {
|
|
1996
|
-
return kit.transformEncoder(
|
|
1997
|
-
kit.getStructEncoder([
|
|
1998
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
1999
|
-
["windowSeconds", kit.getU32Encoder()]
|
|
2000
|
-
]),
|
|
2001
|
-
(value) => ({ ...value, discriminator: ORACLE_CONSULT_DISCRIMINATOR })
|
|
2002
|
-
);
|
|
2003
|
-
}
|
|
2004
|
-
function getOracleConsultInstructionDataDecoder() {
|
|
2005
|
-
return kit.getStructDecoder([
|
|
2006
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2007
|
-
["windowSeconds", kit.getU32Decoder()]
|
|
2008
|
-
]);
|
|
2009
|
-
}
|
|
2010
|
-
function getOracleConsultInstructionDataCodec() {
|
|
2011
|
-
return kit.combineCodec(
|
|
2012
|
-
getOracleConsultInstructionDataEncoder(),
|
|
2013
|
-
getOracleConsultInstructionDataDecoder()
|
|
2014
|
-
);
|
|
2015
|
-
}
|
|
2016
|
-
async function getOracleConsultInstructionAsync(input, config) {
|
|
2017
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2018
|
-
const originalAccounts = {
|
|
2019
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
2020
|
-
oracle: { value: input.oracle ?? null, isWritable: false }
|
|
2021
|
-
};
|
|
2022
|
-
const accounts = originalAccounts;
|
|
2023
|
-
const args = { ...input };
|
|
2024
|
-
if (!accounts.oracle.value) {
|
|
2025
|
-
accounts.oracle.value = await kit.getProgramDerivedAddress({
|
|
2026
|
-
programAddress,
|
|
2027
|
-
seeds: [
|
|
2028
|
-
kit.getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
|
|
2029
|
-
kit.getAddressEncoder().encode(
|
|
2030
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
2031
|
-
)
|
|
2032
|
-
]
|
|
2033
|
-
});
|
|
2034
|
-
}
|
|
2035
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2036
|
-
return Object.freeze({
|
|
2037
|
-
accounts: [
|
|
2038
|
-
getAccountMeta("pool", accounts.pool),
|
|
2039
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2040
|
-
],
|
|
2041
|
-
data: getOracleConsultInstructionDataEncoder().encode(
|
|
2042
|
-
args
|
|
2043
|
-
),
|
|
2044
|
-
programAddress
|
|
2045
|
-
});
|
|
2046
|
-
}
|
|
2047
|
-
function getOracleConsultInstruction(input, config) {
|
|
2048
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2049
|
-
const originalAccounts = {
|
|
2050
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
2051
|
-
oracle: { value: input.oracle ?? null, isWritable: false }
|
|
2052
|
-
};
|
|
2053
|
-
const accounts = originalAccounts;
|
|
2054
|
-
const args = { ...input };
|
|
2055
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2056
|
-
return Object.freeze({
|
|
2057
|
-
accounts: [
|
|
2058
|
-
getAccountMeta("pool", accounts.pool),
|
|
2059
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2060
|
-
],
|
|
2061
|
-
data: getOracleConsultInstructionDataEncoder().encode(
|
|
2062
|
-
args
|
|
2063
|
-
),
|
|
2064
|
-
programAddress
|
|
2065
|
-
});
|
|
2066
|
-
}
|
|
2067
|
-
function parseOracleConsultInstruction(instruction) {
|
|
2068
|
-
if (instruction.accounts.length < 2) {
|
|
2069
|
-
throw new kit.SolanaError(
|
|
2070
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2071
|
-
{
|
|
2072
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2073
|
-
expectedAccountMetas: 2
|
|
2074
|
-
}
|
|
2075
|
-
);
|
|
2076
|
-
}
|
|
2077
|
-
let accountIndex = 0;
|
|
2078
|
-
const getNextAccount = () => {
|
|
2079
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2080
|
-
accountIndex += 1;
|
|
2081
|
-
return accountMeta;
|
|
2082
|
-
};
|
|
2083
|
-
return {
|
|
2084
|
-
programAddress: instruction.programAddress,
|
|
2085
|
-
accounts: { pool: getNextAccount(), oracle: getNextAccount() },
|
|
2086
|
-
data: getOracleConsultInstructionDataDecoder().decode(instruction.data)
|
|
2087
|
-
};
|
|
2088
|
-
}
|
|
2089
|
-
var ORACLE_UPDATE_DISCRIMINATOR = new Uint8Array([
|
|
2090
|
-
85,
|
|
2091
|
-
209,
|
|
2092
|
-
248,
|
|
2093
|
-
142,
|
|
2094
|
-
186,
|
|
2095
|
-
249,
|
|
2096
|
-
120,
|
|
2097
|
-
239
|
|
2098
|
-
]);
|
|
2099
|
-
function getOracleUpdateDiscriminatorBytes() {
|
|
2100
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2101
|
-
ORACLE_UPDATE_DISCRIMINATOR
|
|
2102
|
-
);
|
|
2103
|
-
}
|
|
2104
|
-
function getOracleUpdateInstructionDataEncoder() {
|
|
2105
|
-
return kit.transformEncoder(
|
|
2106
|
-
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
2107
|
-
(value) => ({ ...value, discriminator: ORACLE_UPDATE_DISCRIMINATOR })
|
|
2108
|
-
);
|
|
2109
|
-
}
|
|
2110
|
-
function getOracleUpdateInstructionDataDecoder() {
|
|
2111
|
-
return kit.getStructDecoder([
|
|
2112
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
2113
|
-
]);
|
|
2114
|
-
}
|
|
2115
|
-
function getOracleUpdateInstructionDataCodec() {
|
|
2116
|
-
return kit.combineCodec(
|
|
2117
|
-
getOracleUpdateInstructionDataEncoder(),
|
|
2118
|
-
getOracleUpdateInstructionDataDecoder()
|
|
2119
|
-
);
|
|
2120
|
-
}
|
|
2121
|
-
async function getOracleUpdateInstructionAsync(input, config) {
|
|
2122
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2123
|
-
const originalAccounts = {
|
|
2124
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
2125
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
2126
|
-
};
|
|
2127
|
-
const accounts = originalAccounts;
|
|
2128
|
-
if (!accounts.oracle.value) {
|
|
2129
|
-
accounts.oracle.value = await kit.getProgramDerivedAddress({
|
|
2130
|
-
programAddress,
|
|
2131
|
-
seeds: [
|
|
2132
|
-
kit.getBytesEncoder().encode(new Uint8Array([111, 114, 97, 99, 108, 101])),
|
|
2133
|
-
kit.getAddressEncoder().encode(
|
|
2134
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
2135
|
-
)
|
|
2136
|
-
]
|
|
2137
|
-
});
|
|
2138
|
-
}
|
|
2139
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2140
|
-
return Object.freeze({
|
|
2141
|
-
accounts: [
|
|
2142
|
-
getAccountMeta("pool", accounts.pool),
|
|
2143
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2144
|
-
],
|
|
2145
|
-
data: getOracleUpdateInstructionDataEncoder().encode({}),
|
|
2146
|
-
programAddress
|
|
2147
|
-
});
|
|
2148
|
-
}
|
|
2149
|
-
function getOracleUpdateInstruction(input, config) {
|
|
2150
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2151
|
-
const originalAccounts = {
|
|
2152
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
2153
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
2154
|
-
};
|
|
2155
|
-
const accounts = originalAccounts;
|
|
2156
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2157
|
-
return Object.freeze({
|
|
2158
|
-
accounts: [
|
|
2159
|
-
getAccountMeta("pool", accounts.pool),
|
|
2160
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2161
|
-
],
|
|
2162
|
-
data: getOracleUpdateInstructionDataEncoder().encode({}),
|
|
2163
|
-
programAddress
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
function parseOracleUpdateInstruction(instruction) {
|
|
2167
|
-
if (instruction.accounts.length < 2) {
|
|
2168
|
-
throw new kit.SolanaError(
|
|
2169
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2170
|
-
{
|
|
2171
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2172
|
-
expectedAccountMetas: 2
|
|
2173
|
-
}
|
|
2174
|
-
);
|
|
2175
|
-
}
|
|
2176
|
-
let accountIndex = 0;
|
|
2177
|
-
const getNextAccount = () => {
|
|
2178
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2179
|
-
accountIndex += 1;
|
|
2180
|
-
return accountMeta;
|
|
2181
|
-
};
|
|
2182
|
-
return {
|
|
2183
|
-
programAddress: instruction.programAddress,
|
|
2184
|
-
accounts: { pool: getNextAccount(), oracle: getNextAccount() },
|
|
2185
|
-
data: getOracleUpdateInstructionDataDecoder().decode(instruction.data)
|
|
2186
|
-
};
|
|
2187
|
-
}
|
|
2188
|
-
var PAUSE_DISCRIMINATOR = new Uint8Array([
|
|
2189
|
-
211,
|
|
2190
|
-
22,
|
|
2191
|
-
221,
|
|
2192
|
-
251,
|
|
2193
|
-
74,
|
|
2194
|
-
121,
|
|
2195
|
-
193,
|
|
2196
|
-
47
|
|
2197
|
-
]);
|
|
2198
|
-
function getPauseDiscriminatorBytes() {
|
|
2199
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(PAUSE_DISCRIMINATOR);
|
|
2200
|
-
}
|
|
2201
|
-
function getPauseInstructionDataEncoder() {
|
|
2202
|
-
return kit.transformEncoder(
|
|
2203
|
-
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
2204
|
-
(value) => ({ ...value, discriminator: PAUSE_DISCRIMINATOR })
|
|
2205
|
-
);
|
|
2206
|
-
}
|
|
2207
|
-
function getPauseInstructionDataDecoder() {
|
|
2208
|
-
return kit.getStructDecoder([
|
|
2209
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
2210
|
-
]);
|
|
2211
|
-
}
|
|
2212
|
-
function getPauseInstructionDataCodec() {
|
|
2213
|
-
return kit.combineCodec(
|
|
2214
|
-
getPauseInstructionDataEncoder(),
|
|
2215
|
-
getPauseInstructionDataDecoder()
|
|
2216
|
-
);
|
|
2217
|
-
}
|
|
2218
|
-
function getPauseInstruction(input, config) {
|
|
2219
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2220
|
-
const originalAccounts = {
|
|
2221
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
2222
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
2223
|
-
};
|
|
2224
|
-
const accounts = originalAccounts;
|
|
2225
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2226
|
-
return Object.freeze({
|
|
2227
|
-
accounts: [
|
|
2228
|
-
getAccountMeta("config", accounts.config),
|
|
2229
|
-
getAccountMeta("admin", accounts.admin)
|
|
2230
|
-
],
|
|
2231
|
-
data: getPauseInstructionDataEncoder().encode({}),
|
|
2232
|
-
programAddress
|
|
2233
|
-
});
|
|
2234
|
-
}
|
|
2235
|
-
function parsePauseInstruction(instruction) {
|
|
2236
|
-
if (instruction.accounts.length < 2) {
|
|
2237
|
-
throw new kit.SolanaError(
|
|
2238
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2239
|
-
{
|
|
2240
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2241
|
-
expectedAccountMetas: 2
|
|
2242
|
-
}
|
|
2243
|
-
);
|
|
2244
|
-
}
|
|
2245
|
-
let accountIndex = 0;
|
|
2246
|
-
const getNextAccount = () => {
|
|
2247
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2248
|
-
accountIndex += 1;
|
|
2249
|
-
return accountMeta;
|
|
2250
|
-
};
|
|
2251
|
-
return {
|
|
2252
|
-
programAddress: instruction.programAddress,
|
|
2253
|
-
accounts: { config: getNextAccount(), admin: getNextAccount() },
|
|
2254
|
-
data: getPauseInstructionDataDecoder().decode(instruction.data)
|
|
2255
|
-
};
|
|
2256
|
-
}
|
|
2257
|
-
var PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
|
|
2258
|
-
50,
|
|
2259
|
-
130,
|
|
2260
|
-
31,
|
|
2261
|
-
69,
|
|
2262
|
-
147,
|
|
2263
|
-
58,
|
|
2264
|
-
222,
|
|
2265
|
-
178
|
|
2266
|
-
]);
|
|
2267
|
-
function getPreviewSwapExactInDiscriminatorBytes() {
|
|
2268
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2269
|
-
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
|
|
2270
|
-
);
|
|
2271
|
-
}
|
|
2272
|
-
function getPreviewSwapExactInInstructionDataEncoder() {
|
|
2273
|
-
return kit.transformEncoder(
|
|
2274
|
-
kit.getStructEncoder([
|
|
2275
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2276
|
-
["amountIn", kit.getU64Encoder()],
|
|
2277
|
-
["tradeDirection", kit.getU8Encoder()]
|
|
2278
|
-
]),
|
|
2279
|
-
(value) => ({
|
|
2280
|
-
...value,
|
|
2281
|
-
discriminator: PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR
|
|
2282
|
-
})
|
|
2283
|
-
);
|
|
2284
|
-
}
|
|
2285
|
-
function getPreviewSwapExactInInstructionDataDecoder() {
|
|
2286
|
-
return kit.getStructDecoder([
|
|
2287
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2288
|
-
["amountIn", kit.getU64Decoder()],
|
|
2289
|
-
["tradeDirection", kit.getU8Decoder()]
|
|
2290
|
-
]);
|
|
2291
|
-
}
|
|
2292
|
-
function getPreviewSwapExactInInstructionDataCodec() {
|
|
2293
|
-
return kit.combineCodec(
|
|
2294
|
-
getPreviewSwapExactInInstructionDataEncoder(),
|
|
2295
|
-
getPreviewSwapExactInInstructionDataDecoder()
|
|
2296
|
-
);
|
|
2297
|
-
}
|
|
2298
|
-
function getPreviewSwapExactInInstruction(input, config) {
|
|
2299
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2300
|
-
const originalAccounts = {
|
|
2301
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2302
|
-
pool: { value: input.pool ?? null, isWritable: false }
|
|
2303
|
-
};
|
|
2304
|
-
const accounts = originalAccounts;
|
|
2305
|
-
const args = { ...input };
|
|
2306
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2307
|
-
return Object.freeze({
|
|
2308
|
-
accounts: [
|
|
2309
|
-
getAccountMeta("config", accounts.config),
|
|
2310
|
-
getAccountMeta("pool", accounts.pool)
|
|
2311
|
-
],
|
|
2312
|
-
data: getPreviewSwapExactInInstructionDataEncoder().encode(
|
|
2313
|
-
args
|
|
2314
|
-
),
|
|
2315
|
-
programAddress
|
|
2316
|
-
});
|
|
2317
|
-
}
|
|
2318
|
-
function parsePreviewSwapExactInInstruction(instruction) {
|
|
2319
|
-
if (instruction.accounts.length < 2) {
|
|
2320
|
-
throw new kit.SolanaError(
|
|
2321
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2322
|
-
{
|
|
2323
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2324
|
-
expectedAccountMetas: 2
|
|
2325
|
-
}
|
|
2326
|
-
);
|
|
2327
|
-
}
|
|
2328
|
-
let accountIndex = 0;
|
|
2329
|
-
const getNextAccount = () => {
|
|
2330
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2331
|
-
accountIndex += 1;
|
|
2332
|
-
return accountMeta;
|
|
2333
|
-
};
|
|
2334
|
-
return {
|
|
2335
|
-
programAddress: instruction.programAddress,
|
|
2336
|
-
accounts: { config: getNextAccount(), pool: getNextAccount() },
|
|
2337
|
-
data: getPreviewSwapExactInInstructionDataDecoder().decode(
|
|
2338
|
-
instruction.data
|
|
2339
|
-
)
|
|
2340
|
-
};
|
|
2341
|
-
}
|
|
2342
|
-
var QUOTE_TO_NUMERAIRE_DISCRIMINATOR = new Uint8Array([
|
|
2343
|
-
4,
|
|
2344
|
-
142,
|
|
2345
|
-
249,
|
|
2346
|
-
240,
|
|
2347
|
-
129,
|
|
2348
|
-
15,
|
|
2349
|
-
143,
|
|
2350
|
-
57
|
|
2351
|
-
]);
|
|
2352
|
-
function getQuoteToNumeraireDiscriminatorBytes() {
|
|
2353
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2354
|
-
QUOTE_TO_NUMERAIRE_DISCRIMINATOR
|
|
2355
|
-
);
|
|
2356
|
-
}
|
|
2357
|
-
function getQuoteToNumeraireInstructionDataEncoder() {
|
|
2358
|
-
return kit.transformEncoder(
|
|
2359
|
-
kit.getStructEncoder([
|
|
2360
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2361
|
-
["amount", kit.getU128Encoder()],
|
|
2362
|
-
["inputTokenIndex", kit.getU8Encoder()],
|
|
2363
|
-
["maxHops", kit.getU8Encoder()],
|
|
2364
|
-
["useTwap", kit.getBooleanEncoder()],
|
|
2365
|
-
["windowSeconds", kit.getU32Encoder()]
|
|
2366
|
-
]),
|
|
2367
|
-
(value) => ({ ...value, discriminator: QUOTE_TO_NUMERAIRE_DISCRIMINATOR })
|
|
2368
|
-
);
|
|
2369
|
-
}
|
|
2370
|
-
function getQuoteToNumeraireInstructionDataDecoder() {
|
|
2371
|
-
return kit.getStructDecoder([
|
|
2372
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2373
|
-
["amount", kit.getU128Decoder()],
|
|
2374
|
-
["inputTokenIndex", kit.getU8Decoder()],
|
|
2375
|
-
["maxHops", kit.getU8Decoder()],
|
|
2376
|
-
["useTwap", kit.getBooleanDecoder()],
|
|
2377
|
-
["windowSeconds", kit.getU32Decoder()]
|
|
2378
|
-
]);
|
|
2379
|
-
}
|
|
2380
|
-
function getQuoteToNumeraireInstructionDataCodec() {
|
|
2381
|
-
return kit.combineCodec(
|
|
2382
|
-
getQuoteToNumeraireInstructionDataEncoder(),
|
|
2383
|
-
getQuoteToNumeraireInstructionDataDecoder()
|
|
2384
|
-
);
|
|
2385
|
-
}
|
|
2386
|
-
function getQuoteToNumeraireInstruction(input, config) {
|
|
2387
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2388
|
-
const originalAccounts = {
|
|
2389
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2390
|
-
startPool: { value: input.startPool ?? null, isWritable: false }
|
|
2391
|
-
};
|
|
2392
|
-
const accounts = originalAccounts;
|
|
2393
|
-
const args = { ...input };
|
|
2394
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2395
|
-
return Object.freeze({
|
|
2396
|
-
accounts: [
|
|
2397
|
-
getAccountMeta("config", accounts.config),
|
|
2398
|
-
getAccountMeta("startPool", accounts.startPool)
|
|
2399
|
-
],
|
|
2400
|
-
data: getQuoteToNumeraireInstructionDataEncoder().encode(
|
|
2401
|
-
args
|
|
2402
|
-
),
|
|
2403
|
-
programAddress
|
|
2404
|
-
});
|
|
2405
|
-
}
|
|
2406
|
-
function parseQuoteToNumeraireInstruction(instruction) {
|
|
2407
|
-
if (instruction.accounts.length < 2) {
|
|
2408
|
-
throw new kit.SolanaError(
|
|
2409
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2410
|
-
{
|
|
2411
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2412
|
-
expectedAccountMetas: 2
|
|
2413
|
-
}
|
|
2414
|
-
);
|
|
2415
|
-
}
|
|
2416
|
-
let accountIndex = 0;
|
|
2417
|
-
const getNextAccount = () => {
|
|
2418
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2419
|
-
accountIndex += 1;
|
|
2420
|
-
return accountMeta;
|
|
2421
|
-
};
|
|
2422
|
-
return {
|
|
2423
|
-
programAddress: instruction.programAddress,
|
|
2424
|
-
accounts: { config: getNextAccount(), startPool: getNextAccount() },
|
|
2425
|
-
data: getQuoteToNumeraireInstructionDataDecoder().decode(instruction.data)
|
|
2426
|
-
};
|
|
2427
|
-
}
|
|
2428
|
-
var REMOVE_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
|
|
2429
|
-
80,
|
|
2430
|
-
85,
|
|
2431
|
-
209,
|
|
2432
|
-
72,
|
|
2433
|
-
24,
|
|
2434
|
-
206,
|
|
2435
|
-
177,
|
|
2436
|
-
108
|
|
2437
|
-
]);
|
|
2438
|
-
function getRemoveLiquidityDiscriminatorBytes() {
|
|
2439
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2440
|
-
REMOVE_LIQUIDITY_DISCRIMINATOR
|
|
2441
|
-
);
|
|
2442
|
-
}
|
|
2443
|
-
function getRemoveLiquidityInstructionDataEncoder() {
|
|
2444
|
-
return kit.transformEncoder(
|
|
2445
|
-
kit.getStructEncoder([
|
|
2446
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2447
|
-
["sharesIn", kit.getU128Encoder()],
|
|
2448
|
-
["minAmount0Out", kit.getU64Encoder()],
|
|
2449
|
-
["minAmount1Out", kit.getU64Encoder()],
|
|
2450
|
-
["updateOracle", kit.getBooleanEncoder()]
|
|
2451
|
-
]),
|
|
2452
|
-
(value) => ({ ...value, discriminator: REMOVE_LIQUIDITY_DISCRIMINATOR })
|
|
2453
|
-
);
|
|
2454
|
-
}
|
|
2455
|
-
function getRemoveLiquidityInstructionDataDecoder() {
|
|
2456
|
-
return kit.getStructDecoder([
|
|
2457
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2458
|
-
["sharesIn", kit.getU128Decoder()],
|
|
2459
|
-
["minAmount0Out", kit.getU64Decoder()],
|
|
2460
|
-
["minAmount1Out", kit.getU64Decoder()],
|
|
2461
|
-
["updateOracle", kit.getBooleanDecoder()]
|
|
2462
|
-
]);
|
|
2463
|
-
}
|
|
2464
|
-
function getRemoveLiquidityInstructionDataCodec() {
|
|
2465
|
-
return kit.combineCodec(
|
|
2466
|
-
getRemoveLiquidityInstructionDataEncoder(),
|
|
2467
|
-
getRemoveLiquidityInstructionDataDecoder()
|
|
2468
|
-
);
|
|
2469
|
-
}
|
|
2470
|
-
async function getRemoveLiquidityInstructionAsync(input, config) {
|
|
2471
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2472
|
-
const originalAccounts = {
|
|
2473
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2474
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2475
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
2476
|
-
protocolFeePosition: {
|
|
2477
|
-
value: input.protocolFeePosition ?? null,
|
|
2478
|
-
isWritable: true
|
|
2479
|
-
},
|
|
2480
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
2481
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
2482
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
2483
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
2484
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
2485
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
2486
|
-
user0: { value: input.user0 ?? null, isWritable: true },
|
|
2487
|
-
user1: { value: input.user1 ?? null, isWritable: true },
|
|
2488
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
2489
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
2490
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
2491
|
-
};
|
|
2492
|
-
const accounts = originalAccounts;
|
|
2493
|
-
const args = { ...input };
|
|
2494
|
-
if (!accounts.authority.value) {
|
|
2495
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
2496
|
-
programAddress,
|
|
2497
|
-
seeds: [
|
|
2498
|
-
kit.getBytesEncoder().encode(
|
|
2499
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2500
|
-
),
|
|
2501
|
-
kit.getAddressEncoder().encode(
|
|
2502
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
2503
|
-
)
|
|
2504
|
-
]
|
|
2505
|
-
});
|
|
2506
|
-
}
|
|
2507
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2508
|
-
return Object.freeze({
|
|
2509
|
-
accounts: [
|
|
2510
|
-
getAccountMeta("config", accounts.config),
|
|
2511
|
-
getAccountMeta("pool", accounts.pool),
|
|
2512
|
-
getAccountMeta("position", accounts.position),
|
|
2513
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
2514
|
-
getAccountMeta("owner", accounts.owner),
|
|
2515
|
-
getAccountMeta("authority", accounts.authority),
|
|
2516
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
2517
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
2518
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
2519
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
2520
|
-
getAccountMeta("user0", accounts.user0),
|
|
2521
|
-
getAccountMeta("user1", accounts.user1),
|
|
2522
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
2523
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
2524
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2525
|
-
],
|
|
2526
|
-
data: getRemoveLiquidityInstructionDataEncoder().encode(
|
|
2527
|
-
args
|
|
2528
|
-
),
|
|
2529
|
-
programAddress
|
|
2530
|
-
});
|
|
2531
|
-
}
|
|
2532
|
-
function getRemoveLiquidityInstruction(input, config) {
|
|
2533
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2534
|
-
const originalAccounts = {
|
|
2535
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2536
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2537
|
-
position: { value: input.position ?? null, isWritable: true },
|
|
2538
|
-
protocolFeePosition: {
|
|
2539
|
-
value: input.protocolFeePosition ?? null,
|
|
2540
|
-
isWritable: true
|
|
2541
|
-
},
|
|
2542
|
-
owner: { value: input.owner ?? null, isWritable: false },
|
|
2543
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
2544
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
2545
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
2546
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
2547
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
2548
|
-
user0: { value: input.user0 ?? null, isWritable: true },
|
|
2549
|
-
user1: { value: input.user1 ?? null, isWritable: true },
|
|
2550
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
2551
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
2552
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
2553
|
-
};
|
|
2554
|
-
const accounts = originalAccounts;
|
|
2555
|
-
const args = { ...input };
|
|
2556
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2557
|
-
return Object.freeze({
|
|
2558
|
-
accounts: [
|
|
2559
|
-
getAccountMeta("config", accounts.config),
|
|
2560
|
-
getAccountMeta("pool", accounts.pool),
|
|
2561
|
-
getAccountMeta("position", accounts.position),
|
|
2562
|
-
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
2563
|
-
getAccountMeta("owner", accounts.owner),
|
|
2564
|
-
getAccountMeta("authority", accounts.authority),
|
|
2565
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
2566
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
2567
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
2568
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
2569
|
-
getAccountMeta("user0", accounts.user0),
|
|
2570
|
-
getAccountMeta("user1", accounts.user1),
|
|
2571
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
2572
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
2573
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2574
|
-
],
|
|
2575
|
-
data: getRemoveLiquidityInstructionDataEncoder().encode(
|
|
2576
|
-
args
|
|
2577
|
-
),
|
|
2578
|
-
programAddress
|
|
2579
|
-
});
|
|
2580
|
-
}
|
|
2581
|
-
function parseRemoveLiquidityInstruction(instruction) {
|
|
2582
|
-
if (instruction.accounts.length < 15) {
|
|
2583
|
-
throw new kit.SolanaError(
|
|
2584
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2585
|
-
{
|
|
2586
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2587
|
-
expectedAccountMetas: 15
|
|
2588
|
-
}
|
|
2589
|
-
);
|
|
2590
|
-
}
|
|
2591
|
-
let accountIndex = 0;
|
|
2592
|
-
const getNextAccount = () => {
|
|
2593
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2594
|
-
accountIndex += 1;
|
|
2595
|
-
return accountMeta;
|
|
2596
|
-
};
|
|
2597
|
-
const getNextOptionalAccount = () => {
|
|
2598
|
-
const accountMeta = getNextAccount();
|
|
2599
|
-
return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
2600
|
-
};
|
|
2601
|
-
return {
|
|
2602
|
-
programAddress: instruction.programAddress,
|
|
2603
|
-
accounts: {
|
|
2604
|
-
config: getNextAccount(),
|
|
2605
|
-
pool: getNextAccount(),
|
|
2606
|
-
position: getNextAccount(),
|
|
2607
|
-
protocolFeePosition: getNextAccount(),
|
|
2608
|
-
owner: getNextAccount(),
|
|
2609
|
-
authority: getNextAccount(),
|
|
2610
|
-
vault0: getNextAccount(),
|
|
2611
|
-
vault1: getNextAccount(),
|
|
2612
|
-
token0Mint: getNextAccount(),
|
|
2613
|
-
token1Mint: getNextAccount(),
|
|
2614
|
-
user0: getNextAccount(),
|
|
2615
|
-
user1: getNextAccount(),
|
|
2616
|
-
token0Program: getNextAccount(),
|
|
2617
|
-
token1Program: getNextAccount(),
|
|
2618
|
-
oracle: getNextOptionalAccount()
|
|
2619
|
-
},
|
|
2620
|
-
data: getRemoveLiquidityInstructionDataDecoder().decode(instruction.data)
|
|
2621
|
-
};
|
|
2622
|
-
}
|
|
2623
|
-
var SET_FEES_DISCRIMINATOR = new Uint8Array([
|
|
2624
|
-
137,
|
|
2625
|
-
178,
|
|
2626
|
-
49,
|
|
2627
|
-
58,
|
|
2628
|
-
0,
|
|
2629
|
-
245,
|
|
2630
|
-
242,
|
|
2631
|
-
190
|
|
2632
|
-
]);
|
|
2633
|
-
function getSetFeesDiscriminatorBytes() {
|
|
2634
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_FEES_DISCRIMINATOR);
|
|
2635
|
-
}
|
|
2636
|
-
function getSetFeesInstructionDataEncoder() {
|
|
2637
|
-
return kit.transformEncoder(
|
|
2638
|
-
kit.getStructEncoder([
|
|
2639
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2640
|
-
["swapFeeBps", kit.getU16Encoder()],
|
|
2641
|
-
["feeSplitBps", kit.getU16Encoder()]
|
|
2642
|
-
]),
|
|
2643
|
-
(value) => ({ ...value, discriminator: SET_FEES_DISCRIMINATOR })
|
|
2644
|
-
);
|
|
2645
|
-
}
|
|
2646
|
-
function getSetFeesInstructionDataDecoder() {
|
|
2647
|
-
return kit.getStructDecoder([
|
|
2648
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2649
|
-
["swapFeeBps", kit.getU16Decoder()],
|
|
2650
|
-
["feeSplitBps", kit.getU16Decoder()]
|
|
2651
|
-
]);
|
|
2652
|
-
}
|
|
2653
|
-
function getSetFeesInstructionDataCodec() {
|
|
2654
|
-
return kit.combineCodec(
|
|
2655
|
-
getSetFeesInstructionDataEncoder(),
|
|
2656
|
-
getSetFeesInstructionDataDecoder()
|
|
2657
|
-
);
|
|
2658
|
-
}
|
|
2659
|
-
function getSetFeesInstruction(input, config) {
|
|
2660
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2661
|
-
const originalAccounts = {
|
|
2662
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2663
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2664
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
2665
|
-
};
|
|
2666
|
-
const accounts = originalAccounts;
|
|
2667
|
-
const args = { ...input };
|
|
2668
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2669
|
-
return Object.freeze({
|
|
2670
|
-
accounts: [
|
|
2671
|
-
getAccountMeta("config", accounts.config),
|
|
2672
|
-
getAccountMeta("pool", accounts.pool),
|
|
2673
|
-
getAccountMeta("admin", accounts.admin)
|
|
2674
|
-
],
|
|
2675
|
-
data: getSetFeesInstructionDataEncoder().encode(
|
|
2676
|
-
args
|
|
2677
|
-
),
|
|
2678
|
-
programAddress
|
|
2679
|
-
});
|
|
2680
|
-
}
|
|
2681
|
-
function parseSetFeesInstruction(instruction) {
|
|
2682
|
-
if (instruction.accounts.length < 3) {
|
|
2683
|
-
throw new kit.SolanaError(
|
|
2684
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2685
|
-
{
|
|
2686
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2687
|
-
expectedAccountMetas: 3
|
|
2688
|
-
}
|
|
2689
|
-
);
|
|
2690
|
-
}
|
|
2691
|
-
let accountIndex = 0;
|
|
2692
|
-
const getNextAccount = () => {
|
|
2693
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2694
|
-
accountIndex += 1;
|
|
2695
|
-
return accountMeta;
|
|
2696
|
-
};
|
|
2697
|
-
return {
|
|
2698
|
-
programAddress: instruction.programAddress,
|
|
2699
|
-
accounts: {
|
|
2700
|
-
config: getNextAccount(),
|
|
2701
|
-
pool: getNextAccount(),
|
|
2702
|
-
admin: getNextAccount()
|
|
2703
|
-
},
|
|
2704
|
-
data: getSetFeesInstructionDataDecoder().decode(instruction.data)
|
|
2705
|
-
};
|
|
2706
|
-
}
|
|
2707
|
-
var SET_HOOK_DISCRIMINATOR = new Uint8Array([
|
|
2708
|
-
175,
|
|
2709
|
-
16,
|
|
2710
|
-
187,
|
|
2711
|
-
252,
|
|
2712
|
-
19,
|
|
2713
|
-
54,
|
|
2714
|
-
111,
|
|
2715
|
-
221
|
|
2716
|
-
]);
|
|
2717
|
-
function getSetHookDiscriminatorBytes() {
|
|
2718
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_HOOK_DISCRIMINATOR);
|
|
2719
|
-
}
|
|
2720
|
-
function getSetHookInstructionDataEncoder() {
|
|
2721
|
-
return kit.transformEncoder(
|
|
2722
|
-
kit.getStructEncoder([
|
|
2723
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2724
|
-
["hookProgram", kit.getAddressEncoder()],
|
|
2725
|
-
["hookFlags", kit.getU32Encoder()]
|
|
2726
|
-
]),
|
|
2727
|
-
(value) => ({ ...value, discriminator: SET_HOOK_DISCRIMINATOR })
|
|
2728
|
-
);
|
|
2729
|
-
}
|
|
2730
|
-
function getSetHookInstructionDataDecoder() {
|
|
2731
|
-
return kit.getStructDecoder([
|
|
2732
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2733
|
-
["hookProgram", kit.getAddressDecoder()],
|
|
2734
|
-
["hookFlags", kit.getU32Decoder()]
|
|
2735
|
-
]);
|
|
2736
|
-
}
|
|
2737
|
-
function getSetHookInstructionDataCodec() {
|
|
2738
|
-
return kit.combineCodec(
|
|
2739
|
-
getSetHookInstructionDataEncoder(),
|
|
2740
|
-
getSetHookInstructionDataDecoder()
|
|
2741
|
-
);
|
|
2742
|
-
}
|
|
2743
|
-
function getSetHookInstruction(input, config) {
|
|
2744
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2745
|
-
const originalAccounts = {
|
|
2746
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2747
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2748
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
2749
|
-
};
|
|
2750
|
-
const accounts = originalAccounts;
|
|
2751
|
-
const args = { ...input };
|
|
2752
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2753
|
-
return Object.freeze({
|
|
2754
|
-
accounts: [
|
|
2755
|
-
getAccountMeta("config", accounts.config),
|
|
2756
|
-
getAccountMeta("pool", accounts.pool),
|
|
2757
|
-
getAccountMeta("admin", accounts.admin)
|
|
2758
|
-
],
|
|
2759
|
-
data: getSetHookInstructionDataEncoder().encode(
|
|
2760
|
-
args
|
|
2761
|
-
),
|
|
2762
|
-
programAddress
|
|
2763
|
-
});
|
|
2764
|
-
}
|
|
2765
|
-
function parseSetHookInstruction(instruction) {
|
|
2766
|
-
if (instruction.accounts.length < 3) {
|
|
2767
|
-
throw new kit.SolanaError(
|
|
2768
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2769
|
-
{
|
|
2770
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2771
|
-
expectedAccountMetas: 3
|
|
2772
|
-
}
|
|
2773
|
-
);
|
|
2774
|
-
}
|
|
2775
|
-
let accountIndex = 0;
|
|
2776
|
-
const getNextAccount = () => {
|
|
2777
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2778
|
-
accountIndex += 1;
|
|
2779
|
-
return accountMeta;
|
|
2780
|
-
};
|
|
2781
|
-
return {
|
|
2782
|
-
programAddress: instruction.programAddress,
|
|
2783
|
-
accounts: {
|
|
2784
|
-
config: getNextAccount(),
|
|
2785
|
-
pool: getNextAccount(),
|
|
2786
|
-
admin: getNextAccount()
|
|
2787
|
-
},
|
|
2788
|
-
data: getSetHookInstructionDataDecoder().decode(instruction.data)
|
|
2789
|
-
};
|
|
2790
|
-
}
|
|
2791
|
-
var SET_ROUTE_DISCRIMINATOR = new Uint8Array([
|
|
2792
|
-
244,
|
|
2793
|
-
231,
|
|
2794
|
-
3,
|
|
2795
|
-
84,
|
|
2796
|
-
233,
|
|
2797
|
-
61,
|
|
2798
|
-
146,
|
|
2799
|
-
149
|
|
2800
|
-
]);
|
|
2801
|
-
function getSetRouteDiscriminatorBytes() {
|
|
2802
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(SET_ROUTE_DISCRIMINATOR);
|
|
2803
|
-
}
|
|
2804
|
-
function getSetRouteInstructionDataEncoder() {
|
|
2805
|
-
return kit.transformEncoder(
|
|
2806
|
-
kit.getStructEncoder([
|
|
2807
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2808
|
-
["routeNextPool", kit.getAddressEncoder()],
|
|
2809
|
-
["routeBridgeMint", kit.getAddressEncoder()]
|
|
2810
|
-
]),
|
|
2811
|
-
(value) => ({ ...value, discriminator: SET_ROUTE_DISCRIMINATOR })
|
|
2812
|
-
);
|
|
2813
|
-
}
|
|
2814
|
-
function getSetRouteInstructionDataDecoder() {
|
|
2815
|
-
return kit.getStructDecoder([
|
|
2816
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2817
|
-
["routeNextPool", kit.getAddressDecoder()],
|
|
2818
|
-
["routeBridgeMint", kit.getAddressDecoder()]
|
|
2819
|
-
]);
|
|
2820
|
-
}
|
|
2821
|
-
function getSetRouteInstructionDataCodec() {
|
|
2822
|
-
return kit.combineCodec(
|
|
2823
|
-
getSetRouteInstructionDataEncoder(),
|
|
2824
|
-
getSetRouteInstructionDataDecoder()
|
|
2825
|
-
);
|
|
2826
|
-
}
|
|
2827
|
-
function getSetRouteInstruction(input, config) {
|
|
2828
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2829
|
-
const originalAccounts = {
|
|
2830
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2831
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2832
|
-
nextPool: { value: input.nextPool ?? null, isWritable: false },
|
|
2833
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
2834
|
-
};
|
|
2835
|
-
const accounts = originalAccounts;
|
|
2836
|
-
const args = { ...input };
|
|
2837
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2838
|
-
return Object.freeze({
|
|
2839
|
-
accounts: [
|
|
2840
|
-
getAccountMeta("config", accounts.config),
|
|
2841
|
-
getAccountMeta("pool", accounts.pool),
|
|
2842
|
-
getAccountMeta("nextPool", accounts.nextPool),
|
|
2843
|
-
getAccountMeta("admin", accounts.admin)
|
|
2844
|
-
],
|
|
2845
|
-
data: getSetRouteInstructionDataEncoder().encode(
|
|
2846
|
-
args
|
|
2847
|
-
),
|
|
2848
|
-
programAddress
|
|
2849
|
-
});
|
|
2850
|
-
}
|
|
2851
|
-
function parseSetRouteInstruction(instruction) {
|
|
2852
|
-
if (instruction.accounts.length < 4) {
|
|
2853
|
-
throw new kit.SolanaError(
|
|
2854
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
2855
|
-
{
|
|
2856
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2857
|
-
expectedAccountMetas: 4
|
|
2858
|
-
}
|
|
2859
|
-
);
|
|
2860
|
-
}
|
|
2861
|
-
let accountIndex = 0;
|
|
2862
|
-
const getNextAccount = () => {
|
|
2863
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2864
|
-
accountIndex += 1;
|
|
2865
|
-
return accountMeta;
|
|
2866
|
-
};
|
|
2867
|
-
const getNextOptionalAccount = () => {
|
|
2868
|
-
const accountMeta = getNextAccount();
|
|
2869
|
-
return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
2870
|
-
};
|
|
2871
|
-
return {
|
|
2872
|
-
programAddress: instruction.programAddress,
|
|
2873
|
-
accounts: {
|
|
2874
|
-
config: getNextAccount(),
|
|
2875
|
-
pool: getNextAccount(),
|
|
2876
|
-
nextPool: getNextOptionalAccount(),
|
|
2877
|
-
admin: getNextAccount()
|
|
2878
|
-
},
|
|
2879
|
-
data: getSetRouteInstructionDataDecoder().decode(instruction.data)
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2882
|
-
var SWAP_EXACT_IN_DISCRIMINATOR = new Uint8Array([
|
|
2883
|
-
104,
|
|
2884
|
-
104,
|
|
2885
|
-
131,
|
|
2886
|
-
86,
|
|
2887
|
-
161,
|
|
2888
|
-
189,
|
|
2889
|
-
180,
|
|
2890
|
-
216
|
|
2891
|
-
]);
|
|
2892
|
-
function getSwapExactInDiscriminatorBytes() {
|
|
2893
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
2894
|
-
SWAP_EXACT_IN_DISCRIMINATOR
|
|
2895
|
-
);
|
|
2896
|
-
}
|
|
2897
|
-
function getSwapExactInInstructionDataEncoder() {
|
|
2898
|
-
return kit.transformEncoder(
|
|
2899
|
-
kit.getStructEncoder([
|
|
2900
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2901
|
-
["amountIn", kit.getU64Encoder()],
|
|
2902
|
-
["minAmountOut", kit.getU64Encoder()],
|
|
2903
|
-
["tradeDirection", kit.getU8Encoder()],
|
|
2904
|
-
["updateOracle", kit.getBooleanEncoder()]
|
|
2905
|
-
]),
|
|
2906
|
-
(value) => ({ ...value, discriminator: SWAP_EXACT_IN_DISCRIMINATOR })
|
|
2907
|
-
);
|
|
2908
|
-
}
|
|
2909
|
-
function getSwapExactInInstructionDataDecoder() {
|
|
2910
|
-
return kit.getStructDecoder([
|
|
2911
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
2912
|
-
["amountIn", kit.getU64Decoder()],
|
|
2913
|
-
["minAmountOut", kit.getU64Decoder()],
|
|
2914
|
-
["tradeDirection", kit.getU8Decoder()],
|
|
2915
|
-
["updateOracle", kit.getBooleanDecoder()]
|
|
2916
|
-
]);
|
|
2917
|
-
}
|
|
2918
|
-
function getSwapExactInInstructionDataCodec() {
|
|
2919
|
-
return kit.combineCodec(
|
|
2920
|
-
getSwapExactInInstructionDataEncoder(),
|
|
2921
|
-
getSwapExactInInstructionDataDecoder()
|
|
2922
|
-
);
|
|
2923
|
-
}
|
|
2924
|
-
async function getSwapExactInInstructionAsync(input, config) {
|
|
2925
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2926
|
-
const originalAccounts = {
|
|
2927
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2928
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2929
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
2930
|
-
vaultIn: { value: input.vaultIn ?? null, isWritable: true },
|
|
2931
|
-
vaultOut: { value: input.vaultOut ?? null, isWritable: true },
|
|
2932
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
2933
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
2934
|
-
userIn: { value: input.userIn ?? null, isWritable: true },
|
|
2935
|
-
userOut: { value: input.userOut ?? null, isWritable: true },
|
|
2936
|
-
trader: { value: input.trader ?? null, isWritable: false },
|
|
2937
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
2938
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
2939
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
2940
|
-
};
|
|
2941
|
-
const accounts = originalAccounts;
|
|
2942
|
-
const args = { ...input };
|
|
2943
|
-
if (!accounts.authority.value) {
|
|
2944
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
2945
|
-
programAddress,
|
|
2946
|
-
seeds: [
|
|
2947
|
-
kit.getBytesEncoder().encode(
|
|
2948
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
2949
|
-
),
|
|
2950
|
-
kit.getAddressEncoder().encode(
|
|
2951
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
2952
|
-
)
|
|
2953
|
-
]
|
|
2954
|
-
});
|
|
2955
|
-
}
|
|
2956
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2957
|
-
return Object.freeze({
|
|
2958
|
-
accounts: [
|
|
2959
|
-
getAccountMeta("config", accounts.config),
|
|
2960
|
-
getAccountMeta("pool", accounts.pool),
|
|
2961
|
-
getAccountMeta("authority", accounts.authority),
|
|
2962
|
-
getAccountMeta("vaultIn", accounts.vaultIn),
|
|
2963
|
-
getAccountMeta("vaultOut", accounts.vaultOut),
|
|
2964
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
2965
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
2966
|
-
getAccountMeta("userIn", accounts.userIn),
|
|
2967
|
-
getAccountMeta("userOut", accounts.userOut),
|
|
2968
|
-
getAccountMeta("trader", accounts.trader),
|
|
2969
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
2970
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
2971
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
2972
|
-
],
|
|
2973
|
-
data: getSwapExactInInstructionDataEncoder().encode(
|
|
2974
|
-
args
|
|
2975
|
-
),
|
|
2976
|
-
programAddress
|
|
2977
|
-
});
|
|
2978
|
-
}
|
|
2979
|
-
function getSwapExactInInstruction(input, config) {
|
|
2980
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
2981
|
-
const originalAccounts = {
|
|
2982
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
2983
|
-
pool: { value: input.pool ?? null, isWritable: true },
|
|
2984
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
2985
|
-
vaultIn: { value: input.vaultIn ?? null, isWritable: true },
|
|
2986
|
-
vaultOut: { value: input.vaultOut ?? null, isWritable: true },
|
|
2987
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
2988
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
2989
|
-
userIn: { value: input.userIn ?? null, isWritable: true },
|
|
2990
|
-
userOut: { value: input.userOut ?? null, isWritable: true },
|
|
2991
|
-
trader: { value: input.trader ?? null, isWritable: false },
|
|
2992
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
2993
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
2994
|
-
oracle: { value: input.oracle ?? null, isWritable: true }
|
|
2995
|
-
};
|
|
2996
|
-
const accounts = originalAccounts;
|
|
2997
|
-
const args = { ...input };
|
|
2998
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
2999
|
-
return Object.freeze({
|
|
3000
|
-
accounts: [
|
|
3001
|
-
getAccountMeta("config", accounts.config),
|
|
3002
|
-
getAccountMeta("pool", accounts.pool),
|
|
3003
|
-
getAccountMeta("authority", accounts.authority),
|
|
3004
|
-
getAccountMeta("vaultIn", accounts.vaultIn),
|
|
3005
|
-
getAccountMeta("vaultOut", accounts.vaultOut),
|
|
3006
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
3007
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
3008
|
-
getAccountMeta("userIn", accounts.userIn),
|
|
3009
|
-
getAccountMeta("userOut", accounts.userOut),
|
|
3010
|
-
getAccountMeta("trader", accounts.trader),
|
|
3011
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
3012
|
-
getAccountMeta("token1Program", accounts.token1Program),
|
|
3013
|
-
getAccountMeta("oracle", accounts.oracle)
|
|
3014
|
-
],
|
|
3015
|
-
data: getSwapExactInInstructionDataEncoder().encode(
|
|
3016
|
-
args
|
|
3017
|
-
),
|
|
3018
|
-
programAddress
|
|
3019
|
-
});
|
|
3020
|
-
}
|
|
3021
|
-
function parseSwapExactInInstruction(instruction) {
|
|
3022
|
-
if (instruction.accounts.length < 13) {
|
|
3023
|
-
throw new kit.SolanaError(
|
|
3024
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3025
|
-
{
|
|
3026
|
-
actualAccountMetas: instruction.accounts.length,
|
|
3027
|
-
expectedAccountMetas: 13
|
|
3028
|
-
}
|
|
3029
|
-
);
|
|
3030
|
-
}
|
|
3031
|
-
let accountIndex = 0;
|
|
3032
|
-
const getNextAccount = () => {
|
|
3033
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3034
|
-
accountIndex += 1;
|
|
3035
|
-
return accountMeta;
|
|
3036
|
-
};
|
|
3037
|
-
const getNextOptionalAccount = () => {
|
|
3038
|
-
const accountMeta = getNextAccount();
|
|
3039
|
-
return accountMeta.address === CPMM_PROGRAM_ADDRESS ? void 0 : accountMeta;
|
|
3040
|
-
};
|
|
3041
|
-
return {
|
|
3042
|
-
programAddress: instruction.programAddress,
|
|
3043
|
-
accounts: {
|
|
3044
|
-
config: getNextAccount(),
|
|
3045
|
-
pool: getNextAccount(),
|
|
3046
|
-
authority: getNextAccount(),
|
|
3047
|
-
vaultIn: getNextAccount(),
|
|
3048
|
-
vaultOut: getNextAccount(),
|
|
3049
|
-
token0Mint: getNextAccount(),
|
|
3050
|
-
token1Mint: getNextAccount(),
|
|
3051
|
-
userIn: getNextAccount(),
|
|
3052
|
-
userOut: getNextAccount(),
|
|
3053
|
-
trader: getNextAccount(),
|
|
3054
|
-
token0Program: getNextAccount(),
|
|
3055
|
-
token1Program: getNextAccount(),
|
|
3056
|
-
oracle: getNextOptionalAccount()
|
|
3057
|
-
},
|
|
3058
|
-
data: getSwapExactInInstructionDataDecoder().decode(instruction.data)
|
|
3059
|
-
};
|
|
3060
|
-
}
|
|
3061
|
-
var TRANSFER_ADMIN_DISCRIMINATOR = new Uint8Array([
|
|
3062
|
-
42,
|
|
3063
|
-
242,
|
|
3064
|
-
66,
|
|
3065
|
-
106,
|
|
3066
|
-
228,
|
|
3067
|
-
10,
|
|
3068
|
-
111,
|
|
3069
|
-
156
|
|
3070
|
-
]);
|
|
3071
|
-
function getTransferAdminDiscriminatorBytes() {
|
|
3072
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3073
|
-
TRANSFER_ADMIN_DISCRIMINATOR
|
|
3074
|
-
);
|
|
3075
|
-
}
|
|
3076
|
-
function getTransferAdminInstructionDataEncoder() {
|
|
3077
|
-
return kit.transformEncoder(
|
|
3078
|
-
kit.getStructEncoder([
|
|
3079
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
3080
|
-
["newAdmin", kit.getAddressEncoder()]
|
|
3081
|
-
]),
|
|
3082
|
-
(value) => ({ ...value, discriminator: TRANSFER_ADMIN_DISCRIMINATOR })
|
|
3083
|
-
);
|
|
3084
|
-
}
|
|
3085
|
-
function getTransferAdminInstructionDataDecoder() {
|
|
3086
|
-
return kit.getStructDecoder([
|
|
3087
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
3088
|
-
["newAdmin", kit.getAddressDecoder()]
|
|
3089
|
-
]);
|
|
3090
|
-
}
|
|
3091
|
-
function getTransferAdminInstructionDataCodec() {
|
|
3092
|
-
return kit.combineCodec(
|
|
3093
|
-
getTransferAdminInstructionDataEncoder(),
|
|
3094
|
-
getTransferAdminInstructionDataDecoder()
|
|
3095
|
-
);
|
|
3096
|
-
}
|
|
3097
|
-
function getTransferAdminInstruction(input, config) {
|
|
3098
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3099
|
-
const originalAccounts = {
|
|
3100
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
3101
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
3102
|
-
};
|
|
3103
|
-
const accounts = originalAccounts;
|
|
3104
|
-
const args = { ...input };
|
|
3105
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3106
|
-
return Object.freeze({
|
|
3107
|
-
accounts: [
|
|
3108
|
-
getAccountMeta("config", accounts.config),
|
|
3109
|
-
getAccountMeta("admin", accounts.admin)
|
|
3110
|
-
],
|
|
3111
|
-
data: getTransferAdminInstructionDataEncoder().encode(
|
|
3112
|
-
args
|
|
3113
|
-
),
|
|
3114
|
-
programAddress
|
|
3115
|
-
});
|
|
3116
|
-
}
|
|
3117
|
-
function parseTransferAdminInstruction(instruction) {
|
|
3118
|
-
if (instruction.accounts.length < 2) {
|
|
3119
|
-
throw new kit.SolanaError(
|
|
3120
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3121
|
-
{
|
|
3122
|
-
actualAccountMetas: instruction.accounts.length,
|
|
3123
|
-
expectedAccountMetas: 2
|
|
3124
|
-
}
|
|
3125
|
-
);
|
|
3126
|
-
}
|
|
3127
|
-
let accountIndex = 0;
|
|
3128
|
-
const getNextAccount = () => {
|
|
3129
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3130
|
-
accountIndex += 1;
|
|
3131
|
-
return accountMeta;
|
|
3132
|
-
};
|
|
3133
|
-
return {
|
|
3134
|
-
programAddress: instruction.programAddress,
|
|
3135
|
-
accounts: { config: getNextAccount(), admin: getNextAccount() },
|
|
3136
|
-
data: getTransferAdminInstructionDataDecoder().decode(instruction.data)
|
|
3137
|
-
};
|
|
3138
|
-
}
|
|
3139
|
-
var UNPAUSE_DISCRIMINATOR = new Uint8Array([
|
|
3140
|
-
169,
|
|
3141
|
-
144,
|
|
3142
|
-
4,
|
|
3143
|
-
38,
|
|
3144
|
-
10,
|
|
3145
|
-
141,
|
|
3146
|
-
188,
|
|
3147
|
-
255
|
|
3148
|
-
]);
|
|
3149
|
-
function getUnpauseDiscriminatorBytes() {
|
|
3150
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(UNPAUSE_DISCRIMINATOR);
|
|
3151
|
-
}
|
|
3152
|
-
function getUnpauseInstructionDataEncoder() {
|
|
3153
|
-
return kit.transformEncoder(
|
|
3154
|
-
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
3155
|
-
(value) => ({ ...value, discriminator: UNPAUSE_DISCRIMINATOR })
|
|
3156
|
-
);
|
|
3157
|
-
}
|
|
3158
|
-
function getUnpauseInstructionDataDecoder() {
|
|
3159
|
-
return kit.getStructDecoder([
|
|
3160
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
3161
|
-
]);
|
|
3162
|
-
}
|
|
3163
|
-
function getUnpauseInstructionDataCodec() {
|
|
3164
|
-
return kit.combineCodec(
|
|
3165
|
-
getUnpauseInstructionDataEncoder(),
|
|
3166
|
-
getUnpauseInstructionDataDecoder()
|
|
3167
|
-
);
|
|
3168
|
-
}
|
|
3169
|
-
function getUnpauseInstruction(input, config) {
|
|
3170
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3171
|
-
const originalAccounts = {
|
|
3172
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
3173
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
3174
|
-
};
|
|
3175
|
-
const accounts = originalAccounts;
|
|
3176
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3177
|
-
return Object.freeze({
|
|
3178
|
-
accounts: [
|
|
3179
|
-
getAccountMeta("config", accounts.config),
|
|
3180
|
-
getAccountMeta("admin", accounts.admin)
|
|
3181
|
-
],
|
|
3182
|
-
data: getUnpauseInstructionDataEncoder().encode({}),
|
|
3183
|
-
programAddress
|
|
3184
|
-
});
|
|
3185
|
-
}
|
|
3186
|
-
function parseUnpauseInstruction(instruction) {
|
|
3187
|
-
if (instruction.accounts.length < 2) {
|
|
3188
|
-
throw new kit.SolanaError(
|
|
3189
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3190
|
-
{
|
|
3191
|
-
actualAccountMetas: instruction.accounts.length,
|
|
3192
|
-
expectedAccountMetas: 2
|
|
3193
|
-
}
|
|
3194
|
-
);
|
|
3195
|
-
}
|
|
3196
|
-
let accountIndex = 0;
|
|
3197
|
-
const getNextAccount = () => {
|
|
3198
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3199
|
-
accountIndex += 1;
|
|
3200
|
-
return accountMeta;
|
|
3201
|
-
};
|
|
3202
|
-
return {
|
|
3203
|
-
programAddress: instruction.programAddress,
|
|
3204
|
-
accounts: { config: getNextAccount(), admin: getNextAccount() },
|
|
3205
|
-
data: getUnpauseInstructionDataDecoder().decode(instruction.data)
|
|
3206
|
-
};
|
|
3207
|
-
}
|
|
3208
|
-
var UPDATE_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
3209
|
-
29,
|
|
3210
|
-
158,
|
|
3211
|
-
252,
|
|
3212
|
-
191,
|
|
3213
|
-
10,
|
|
3214
|
-
83,
|
|
3215
|
-
219,
|
|
3216
|
-
99
|
|
3217
|
-
]);
|
|
3218
|
-
function getUpdateConfigDiscriminatorBytes() {
|
|
3219
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3220
|
-
UPDATE_CONFIG_DISCRIMINATOR
|
|
3221
|
-
);
|
|
3222
|
-
}
|
|
3223
|
-
function getUpdateConfigInstructionDataEncoder() {
|
|
3224
|
-
return kit.transformEncoder(
|
|
3225
|
-
kit.getStructEncoder([
|
|
3226
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
3227
|
-
["numeraireMint", kit.getAddressEncoder()],
|
|
3228
|
-
["maxSwapFeeBps", kit.getU16Encoder()],
|
|
3229
|
-
["maxFeeSplitBps", kit.getU16Encoder()],
|
|
3230
|
-
["maxRouteHops", kit.getU8Encoder()],
|
|
3231
|
-
["protocolFeeEnabled", kit.getBooleanEncoder()],
|
|
3232
|
-
["protocolFeeBps", kit.getU16Encoder()],
|
|
3233
|
-
["hookAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
3234
|
-
]),
|
|
3235
|
-
(value) => ({ ...value, discriminator: UPDATE_CONFIG_DISCRIMINATOR })
|
|
3236
|
-
);
|
|
3237
|
-
}
|
|
3238
|
-
function getUpdateConfigInstructionDataDecoder() {
|
|
3239
|
-
return kit.getStructDecoder([
|
|
3240
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
3241
|
-
["numeraireMint", kit.getAddressDecoder()],
|
|
3242
|
-
["maxSwapFeeBps", kit.getU16Decoder()],
|
|
3243
|
-
["maxFeeSplitBps", kit.getU16Decoder()],
|
|
3244
|
-
["maxRouteHops", kit.getU8Decoder()],
|
|
3245
|
-
["protocolFeeEnabled", kit.getBooleanDecoder()],
|
|
3246
|
-
["protocolFeeBps", kit.getU16Decoder()],
|
|
3247
|
-
["hookAllowlist", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
3248
|
-
]);
|
|
3249
|
-
}
|
|
3250
|
-
function getUpdateConfigInstructionDataCodec() {
|
|
3251
|
-
return kit.combineCodec(
|
|
3252
|
-
getUpdateConfigInstructionDataEncoder(),
|
|
3253
|
-
getUpdateConfigInstructionDataDecoder()
|
|
3254
|
-
);
|
|
3255
|
-
}
|
|
3256
|
-
function getUpdateConfigInstruction(input, config) {
|
|
3257
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3258
|
-
const originalAccounts = {
|
|
3259
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
3260
|
-
admin: { value: input.admin ?? null, isWritable: false }
|
|
3261
|
-
};
|
|
3262
|
-
const accounts = originalAccounts;
|
|
3263
|
-
const args = { ...input };
|
|
3264
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3265
|
-
return Object.freeze({
|
|
3266
|
-
accounts: [
|
|
3267
|
-
getAccountMeta("config", accounts.config),
|
|
3268
|
-
getAccountMeta("admin", accounts.admin)
|
|
3269
|
-
],
|
|
3270
|
-
data: getUpdateConfigInstructionDataEncoder().encode(
|
|
3271
|
-
args
|
|
3272
|
-
),
|
|
3273
|
-
programAddress
|
|
3274
|
-
});
|
|
3275
|
-
}
|
|
3276
|
-
function parseUpdateConfigInstruction(instruction) {
|
|
3277
|
-
if (instruction.accounts.length < 2) {
|
|
3278
|
-
throw new kit.SolanaError(
|
|
3279
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3280
|
-
{
|
|
3281
|
-
actualAccountMetas: instruction.accounts.length,
|
|
3282
|
-
expectedAccountMetas: 2
|
|
3283
|
-
}
|
|
3284
|
-
);
|
|
3285
|
-
}
|
|
3286
|
-
let accountIndex = 0;
|
|
3287
|
-
const getNextAccount = () => {
|
|
3288
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3289
|
-
accountIndex += 1;
|
|
3290
|
-
return accountMeta;
|
|
3291
|
-
};
|
|
3292
|
-
return {
|
|
3293
|
-
programAddress: instruction.programAddress,
|
|
3294
|
-
accounts: { config: getNextAccount(), admin: getNextAccount() },
|
|
3295
|
-
data: getUpdateConfigInstructionDataDecoder().decode(instruction.data)
|
|
3296
|
-
};
|
|
3297
|
-
}
|
|
3298
|
-
var WITHDRAW_VAULT_EXCESS_DISCRIMINATOR = new Uint8Array([
|
|
3299
|
-
235,
|
|
3300
|
-
197,
|
|
3301
|
-
247,
|
|
3302
|
-
177,
|
|
3303
|
-
137,
|
|
3304
|
-
72,
|
|
3305
|
-
135,
|
|
3306
|
-
113
|
|
3307
|
-
]);
|
|
3308
|
-
function getWithdrawVaultExcessDiscriminatorBytes() {
|
|
3309
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
3310
|
-
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
|
|
3311
|
-
);
|
|
3312
|
-
}
|
|
3313
|
-
function getWithdrawVaultExcessInstructionDataEncoder() {
|
|
3314
|
-
return kit.transformEncoder(
|
|
3315
|
-
kit.getStructEncoder([["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)]]),
|
|
3316
|
-
(value) => ({
|
|
3317
|
-
...value,
|
|
3318
|
-
discriminator: WITHDRAW_VAULT_EXCESS_DISCRIMINATOR
|
|
3319
|
-
})
|
|
3320
|
-
);
|
|
3321
|
-
}
|
|
3322
|
-
function getWithdrawVaultExcessInstructionDataDecoder() {
|
|
3323
|
-
return kit.getStructDecoder([
|
|
3324
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)]
|
|
3325
|
-
]);
|
|
3326
|
-
}
|
|
3327
|
-
function getWithdrawVaultExcessInstructionDataCodec() {
|
|
3328
|
-
return kit.combineCodec(
|
|
3329
|
-
getWithdrawVaultExcessInstructionDataEncoder(),
|
|
3330
|
-
getWithdrawVaultExcessInstructionDataDecoder()
|
|
3331
|
-
);
|
|
3332
|
-
}
|
|
3333
|
-
async function getWithdrawVaultExcessInstructionAsync(input, config) {
|
|
3334
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3335
|
-
const originalAccounts = {
|
|
3336
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
3337
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
3338
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
3339
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
3340
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
3341
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
3342
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
3343
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
3344
|
-
adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
|
|
3345
|
-
adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
|
|
3346
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
3347
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
3348
|
-
};
|
|
3349
|
-
const accounts = originalAccounts;
|
|
3350
|
-
if (!accounts.authority.value) {
|
|
3351
|
-
accounts.authority.value = await kit.getProgramDerivedAddress({
|
|
3352
|
-
programAddress,
|
|
3353
|
-
seeds: [
|
|
3354
|
-
kit.getBytesEncoder().encode(
|
|
3355
|
-
new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
|
|
3356
|
-
),
|
|
3357
|
-
kit.getAddressEncoder().encode(
|
|
3358
|
-
programClientCore.getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
|
|
3359
|
-
)
|
|
3360
|
-
]
|
|
3361
|
-
});
|
|
3362
|
-
}
|
|
3363
|
-
if (!accounts.adminAta0.value) {
|
|
3364
|
-
accounts.adminAta0.value = await kit.getProgramDerivedAddress({
|
|
3365
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
3366
|
-
seeds: [
|
|
3367
|
-
kit.getAddressEncoder().encode(
|
|
3368
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3369
|
-
"admin",
|
|
3370
|
-
accounts.admin.value
|
|
3371
|
-
)
|
|
3372
|
-
),
|
|
3373
|
-
kit.getAddressEncoder().encode(
|
|
3374
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3375
|
-
"token0Program",
|
|
3376
|
-
accounts.token0Program.value
|
|
3377
|
-
)
|
|
3378
|
-
),
|
|
3379
|
-
kit.getAddressEncoder().encode(
|
|
3380
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3381
|
-
"token0Mint",
|
|
3382
|
-
accounts.token0Mint.value
|
|
3383
|
-
)
|
|
3384
|
-
)
|
|
3385
|
-
]
|
|
3386
|
-
});
|
|
3387
|
-
}
|
|
3388
|
-
if (!accounts.adminAta1.value) {
|
|
3389
|
-
accounts.adminAta1.value = await kit.getProgramDerivedAddress({
|
|
3390
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
3391
|
-
seeds: [
|
|
3392
|
-
kit.getAddressEncoder().encode(
|
|
3393
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3394
|
-
"admin",
|
|
3395
|
-
accounts.admin.value
|
|
3396
|
-
)
|
|
3397
|
-
),
|
|
3398
|
-
kit.getAddressEncoder().encode(
|
|
3399
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3400
|
-
"token1Program",
|
|
3401
|
-
accounts.token1Program.value
|
|
3402
|
-
)
|
|
3403
|
-
),
|
|
3404
|
-
kit.getAddressEncoder().encode(
|
|
3405
|
-
programClientCore.getAddressFromResolvedInstructionAccount(
|
|
3406
|
-
"token1Mint",
|
|
3407
|
-
accounts.token1Mint.value
|
|
3408
|
-
)
|
|
3409
|
-
)
|
|
3410
|
-
]
|
|
3411
|
-
});
|
|
3412
|
-
}
|
|
3413
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3414
|
-
return Object.freeze({
|
|
3415
|
-
accounts: [
|
|
3416
|
-
getAccountMeta("config", accounts.config),
|
|
3417
|
-
getAccountMeta("pool", accounts.pool),
|
|
3418
|
-
getAccountMeta("admin", accounts.admin),
|
|
3419
|
-
getAccountMeta("authority", accounts.authority),
|
|
3420
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
3421
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
3422
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
3423
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
3424
|
-
getAccountMeta("adminAta0", accounts.adminAta0),
|
|
3425
|
-
getAccountMeta("adminAta1", accounts.adminAta1),
|
|
3426
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
3427
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
3428
|
-
],
|
|
3429
|
-
data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
|
|
3430
|
-
programAddress
|
|
3431
|
-
});
|
|
3432
|
-
}
|
|
3433
|
-
function getWithdrawVaultExcessInstruction(input, config) {
|
|
3434
|
-
const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
|
|
3435
|
-
const originalAccounts = {
|
|
3436
|
-
config: { value: input.config ?? null, isWritable: false },
|
|
3437
|
-
pool: { value: input.pool ?? null, isWritable: false },
|
|
3438
|
-
admin: { value: input.admin ?? null, isWritable: false },
|
|
3439
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
3440
|
-
vault0: { value: input.vault0 ?? null, isWritable: true },
|
|
3441
|
-
vault1: { value: input.vault1 ?? null, isWritable: true },
|
|
3442
|
-
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
3443
|
-
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
3444
|
-
adminAta0: { value: input.adminAta0 ?? null, isWritable: true },
|
|
3445
|
-
adminAta1: { value: input.adminAta1 ?? null, isWritable: true },
|
|
3446
|
-
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
3447
|
-
token1Program: { value: input.token1Program ?? null, isWritable: false }
|
|
3448
|
-
};
|
|
3449
|
-
const accounts = originalAccounts;
|
|
3450
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
3451
|
-
return Object.freeze({
|
|
3452
|
-
accounts: [
|
|
3453
|
-
getAccountMeta("config", accounts.config),
|
|
3454
|
-
getAccountMeta("pool", accounts.pool),
|
|
3455
|
-
getAccountMeta("admin", accounts.admin),
|
|
3456
|
-
getAccountMeta("authority", accounts.authority),
|
|
3457
|
-
getAccountMeta("vault0", accounts.vault0),
|
|
3458
|
-
getAccountMeta("vault1", accounts.vault1),
|
|
3459
|
-
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
3460
|
-
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
3461
|
-
getAccountMeta("adminAta0", accounts.adminAta0),
|
|
3462
|
-
getAccountMeta("adminAta1", accounts.adminAta1),
|
|
3463
|
-
getAccountMeta("token0Program", accounts.token0Program),
|
|
3464
|
-
getAccountMeta("token1Program", accounts.token1Program)
|
|
3465
|
-
],
|
|
3466
|
-
data: getWithdrawVaultExcessInstructionDataEncoder().encode({}),
|
|
3467
|
-
programAddress
|
|
3468
|
-
});
|
|
3469
|
-
}
|
|
3470
|
-
function parseWithdrawVaultExcessInstruction(instruction) {
|
|
3471
|
-
if (instruction.accounts.length < 12) {
|
|
3472
|
-
throw new kit.SolanaError(
|
|
3473
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
3474
|
-
{
|
|
3475
|
-
actualAccountMetas: instruction.accounts.length,
|
|
3476
|
-
expectedAccountMetas: 12
|
|
3477
|
-
}
|
|
3478
|
-
);
|
|
3479
|
-
}
|
|
3480
|
-
let accountIndex = 0;
|
|
3481
|
-
const getNextAccount = () => {
|
|
3482
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
3483
|
-
accountIndex += 1;
|
|
3484
|
-
return accountMeta;
|
|
3485
|
-
};
|
|
3486
|
-
return {
|
|
3487
|
-
programAddress: instruction.programAddress,
|
|
3488
|
-
accounts: {
|
|
3489
|
-
config: getNextAccount(),
|
|
3490
|
-
pool: getNextAccount(),
|
|
3491
|
-
admin: getNextAccount(),
|
|
3492
|
-
authority: getNextAccount(),
|
|
3493
|
-
vault0: getNextAccount(),
|
|
3494
|
-
vault1: getNextAccount(),
|
|
3495
|
-
token0Mint: getNextAccount(),
|
|
3496
|
-
token1Mint: getNextAccount(),
|
|
3497
|
-
adminAta0: getNextAccount(),
|
|
3498
|
-
adminAta1: getNextAccount(),
|
|
3499
|
-
token0Program: getNextAccount(),
|
|
3500
|
-
token1Program: getNextAccount()
|
|
3501
|
-
},
|
|
3502
|
-
data: getWithdrawVaultExcessInstructionDataDecoder().decode(
|
|
3503
|
-
instruction.data
|
|
3504
|
-
)
|
|
3505
|
-
};
|
|
3506
|
-
}
|
|
3507
633
|
function isTransactionSigner(value) {
|
|
3508
634
|
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3509
635
|
}
|
|
@@ -3541,12 +667,12 @@ function createSwapInstruction(params) {
|
|
|
3541
667
|
token0Program,
|
|
3542
668
|
token1Program,
|
|
3543
669
|
tokenProgram,
|
|
3544
|
-
programId = CPMM_PROGRAM_ADDRESS
|
|
670
|
+
programId = chunkKJ6W44WF_cjs.CPMM_PROGRAM_ADDRESS
|
|
3545
671
|
} = params;
|
|
3546
672
|
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
3547
673
|
const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
3548
674
|
const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
3549
|
-
const instruction = getSwapExactInInstruction(
|
|
675
|
+
const instruction = chunkKJ6W44WF_cjs.getSwapExactInInstruction(
|
|
3550
676
|
{
|
|
3551
677
|
config,
|
|
3552
678
|
pool,
|
|
@@ -3558,8 +684,8 @@ function createSwapInstruction(params) {
|
|
|
3558
684
|
userIn,
|
|
3559
685
|
userOut,
|
|
3560
686
|
trader,
|
|
3561
|
-
token0Program: token0Program ?? tokenProgram ??
|
|
3562
|
-
token1Program: token1Program ?? tokenProgram ??
|
|
687
|
+
token0Program: token0Program ?? tokenProgram ?? chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
688
|
+
token1Program: token1Program ?? tokenProgram ?? chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
3563
689
|
oracle,
|
|
3564
690
|
amountIn,
|
|
3565
691
|
minAmountOut,
|
|
@@ -3587,8 +713,8 @@ function base64ToBytes(base64) {
|
|
|
3587
713
|
}
|
|
3588
714
|
return bytes;
|
|
3589
715
|
}
|
|
3590
|
-
async function fetchConfig(rpc, programId =
|
|
3591
|
-
const [configAddress] = await
|
|
716
|
+
async function fetchConfig(rpc, programId = chunkY6TJIH33_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
717
|
+
const [configAddress] = await chunkY6TJIH33_cjs.getConfigAddress(programId);
|
|
3592
718
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
3593
719
|
encoding: "base64",
|
|
3594
720
|
commitment
|
|
@@ -3596,10 +722,10 @@ async function fetchConfig(rpc, programId = chunkAKLS6T3R_cjs.CPMM_PROGRAM_ID, c
|
|
|
3596
722
|
if (!response.value) {
|
|
3597
723
|
return null;
|
|
3598
724
|
}
|
|
3599
|
-
return
|
|
725
|
+
return chunkKJ6W44WF_cjs.decodeAmmConfig(base64ToBytes(response.value.data[0]));
|
|
3600
726
|
}
|
|
3601
|
-
async function fetchConfigWithAddress(rpc, programId =
|
|
3602
|
-
const [configAddress] = await
|
|
727
|
+
async function fetchConfigWithAddress(rpc, programId = chunkY6TJIH33_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
728
|
+
const [configAddress] = await chunkY6TJIH33_cjs.getConfigAddress(programId);
|
|
3603
729
|
const account = await fetchConfig(rpc, programId, commitment);
|
|
3604
730
|
if (!account) {
|
|
3605
731
|
return null;
|
|
@@ -4860,6 +1986,14 @@ function getFeeBeneficiaryInputDecoder() {
|
|
|
4860
1986
|
["shareBps", kit.getU16Decoder()]
|
|
4861
1987
|
]);
|
|
4862
1988
|
}
|
|
1989
|
+
var FeeClaimRole = /* @__PURE__ */ ((FeeClaimRole2) => {
|
|
1990
|
+
FeeClaimRole2[FeeClaimRole2["Protocol"] = 0] = "Protocol";
|
|
1991
|
+
FeeClaimRole2[FeeClaimRole2["Beneficiary"] = 1] = "Beneficiary";
|
|
1992
|
+
return FeeClaimRole2;
|
|
1993
|
+
})(FeeClaimRole || {});
|
|
1994
|
+
function getFeeClaimRoleEncoder() {
|
|
1995
|
+
return kit.getEnumEncoder(FeeClaimRole);
|
|
1996
|
+
}
|
|
4863
1997
|
function getInitializeConfigArgsEncoder2() {
|
|
4864
1998
|
return kit.getStructEncoder([
|
|
4865
1999
|
["migratorAllowlist", kit.getArrayEncoder(kit.getAddressEncoder())],
|
|
@@ -5097,7 +2231,6 @@ function getLaunchFeeStateEncoder() {
|
|
|
5097
2231
|
kit.getStructEncoder([
|
|
5098
2232
|
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5099
2233
|
["launch", kit.getAddressEncoder()],
|
|
5100
|
-
["protocolBeneficiary", kit.getAddressEncoder()],
|
|
5101
2234
|
["beneficiaryLen", kit.getU8Encoder()],
|
|
5102
2235
|
["bump", kit.getU8Encoder()],
|
|
5103
2236
|
["protocolFeeBps", kit.getU16Encoder()],
|
|
@@ -5129,7 +2262,6 @@ function getLaunchFeeStateDecoder() {
|
|
|
5129
2262
|
return kit.getStructDecoder([
|
|
5130
2263
|
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5131
2264
|
["launch", kit.getAddressDecoder()],
|
|
5132
|
-
["protocolBeneficiary", kit.getAddressDecoder()],
|
|
5133
2265
|
["beneficiaryLen", kit.getU8Decoder()],
|
|
5134
2266
|
["bump", kit.getU8Decoder()],
|
|
5135
2267
|
["protocolFeeBps", kit.getU16Decoder()],
|
|
@@ -5167,20 +2299,23 @@ var CLAIM_FEES_DISCRIMINATOR = new Uint8Array([
|
|
|
5167
2299
|
]);
|
|
5168
2300
|
function getClaimFeesInstructionDataEncoder() {
|
|
5169
2301
|
return kit.transformEncoder(
|
|
5170
|
-
kit.getStructEncoder([
|
|
2302
|
+
kit.getStructEncoder([
|
|
2303
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
2304
|
+
["role", getFeeClaimRoleEncoder()]
|
|
2305
|
+
]),
|
|
5171
2306
|
(value) => ({ ...value, discriminator: CLAIM_FEES_DISCRIMINATOR })
|
|
5172
2307
|
);
|
|
5173
2308
|
}
|
|
5174
2309
|
async function getClaimFeesInstructionAsync(input, config) {
|
|
5175
2310
|
const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
|
|
5176
2311
|
const originalAccounts = {
|
|
2312
|
+
config: { value: input.config ?? null, isWritable: false },
|
|
5177
2313
|
launch: { value: input.launch ?? null, isWritable: false },
|
|
5178
2314
|
launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
|
|
5179
2315
|
launchAuthority: {
|
|
5180
2316
|
value: input.launchAuthority ?? null,
|
|
5181
2317
|
isWritable: false
|
|
5182
2318
|
},
|
|
5183
|
-
recipient: { value: input.recipient ?? null, isWritable: false },
|
|
5184
2319
|
baseMint: { value: input.baseMint ?? null, isWritable: false },
|
|
5185
2320
|
quoteMint: { value: input.quoteMint ?? null, isWritable: false },
|
|
5186
2321
|
baseVault: { value: input.baseVault ?? null, isWritable: true },
|
|
@@ -5203,6 +2338,15 @@ async function getClaimFeesInstructionAsync(input, config) {
|
|
|
5203
2338
|
}
|
|
5204
2339
|
};
|
|
5205
2340
|
const accounts = originalAccounts;
|
|
2341
|
+
const args = { ...input };
|
|
2342
|
+
if (!accounts.config.value) {
|
|
2343
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
2344
|
+
programAddress,
|
|
2345
|
+
seeds: [
|
|
2346
|
+
kit.getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
|
|
2347
|
+
]
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
5206
2350
|
if (!accounts.launchFeeState.value) {
|
|
5207
2351
|
accounts.launchFeeState.value = await kit.getProgramDerivedAddress({
|
|
5208
2352
|
programAddress,
|
|
@@ -5272,10 +2416,10 @@ async function getClaimFeesInstructionAsync(input, config) {
|
|
|
5272
2416
|
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5273
2417
|
return Object.freeze({
|
|
5274
2418
|
accounts: [
|
|
2419
|
+
getAccountMeta("config", accounts.config),
|
|
5275
2420
|
getAccountMeta("launch", accounts.launch),
|
|
5276
2421
|
getAccountMeta("launchFeeState", accounts.launchFeeState),
|
|
5277
2422
|
getAccountMeta("launchAuthority", accounts.launchAuthority),
|
|
5278
|
-
getAccountMeta("recipient", accounts.recipient),
|
|
5279
2423
|
getAccountMeta("baseMint", accounts.baseMint),
|
|
5280
2424
|
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
5281
2425
|
getAccountMeta("baseVault", accounts.baseVault),
|
|
@@ -5285,7 +2429,9 @@ async function getClaimFeesInstructionAsync(input, config) {
|
|
|
5285
2429
|
getAccountMeta("baseTokenProgram", accounts.baseTokenProgram),
|
|
5286
2430
|
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
5287
2431
|
],
|
|
5288
|
-
data: getClaimFeesInstructionDataEncoder().encode(
|
|
2432
|
+
data: getClaimFeesInstructionDataEncoder().encode(
|
|
2433
|
+
args
|
|
2434
|
+
),
|
|
5289
2435
|
programAddress
|
|
5290
2436
|
});
|
|
5291
2437
|
}
|
|
@@ -5589,6 +2735,7 @@ function getReplaceFeeBeneficiaryInstructionDataEncoder() {
|
|
|
5589
2735
|
async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
|
|
5590
2736
|
const programAddress = config?.programAddress ?? INITIALIZER_PROGRAM_ADDRESS;
|
|
5591
2737
|
const originalAccounts = {
|
|
2738
|
+
config: { value: input.config ?? null, isWritable: false },
|
|
5592
2739
|
launch: { value: input.launch ?? null, isWritable: false },
|
|
5593
2740
|
launchFeeState: { value: input.launchFeeState ?? null, isWritable: true },
|
|
5594
2741
|
currentBeneficiary: {
|
|
@@ -5598,6 +2745,14 @@ async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
|
|
|
5598
2745
|
};
|
|
5599
2746
|
const accounts = originalAccounts;
|
|
5600
2747
|
const args = { ...input };
|
|
2748
|
+
if (!accounts.config.value) {
|
|
2749
|
+
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
2750
|
+
programAddress,
|
|
2751
|
+
seeds: [
|
|
2752
|
+
kit.getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103]))
|
|
2753
|
+
]
|
|
2754
|
+
});
|
|
2755
|
+
}
|
|
5601
2756
|
if (!accounts.launchFeeState.value) {
|
|
5602
2757
|
accounts.launchFeeState.value = await kit.getProgramDerivedAddress({
|
|
5603
2758
|
programAddress,
|
|
@@ -5634,6 +2789,7 @@ async function getReplaceFeeBeneficiaryInstructionAsync(input, config) {
|
|
|
5634
2789
|
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5635
2790
|
return Object.freeze({
|
|
5636
2791
|
accounts: [
|
|
2792
|
+
getAccountMeta("config", accounts.config),
|
|
5637
2793
|
getAccountMeta("launch", accounts.launch),
|
|
5638
2794
|
getAccountMeta("launchFeeState", accounts.launchFeeState),
|
|
5639
2795
|
getAccountMeta("currentBeneficiary", accounts.currentBeneficiary)
|
|
@@ -5808,7 +2964,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
5808
2964
|
admin,
|
|
5809
2965
|
config,
|
|
5810
2966
|
programData,
|
|
5811
|
-
systemProgram =
|
|
2967
|
+
systemProgram = chunkY6TJIH33_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
5812
2968
|
} = accounts;
|
|
5813
2969
|
const keys = [
|
|
5814
2970
|
createSignerAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
@@ -6602,7 +3758,7 @@ async function fetchAllMaybeMarket(rpc, addresses, config) {
|
|
|
6602
3758
|
function getMarketSize() {
|
|
6603
3759
|
return 208;
|
|
6604
3760
|
}
|
|
6605
|
-
var
|
|
3761
|
+
var ORACLE_STATE_DISCRIMINATOR = new Uint8Array([
|
|
6606
3762
|
97,
|
|
6607
3763
|
156,
|
|
6608
3764
|
157,
|
|
@@ -6614,7 +3770,7 @@ var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
|
|
|
6614
3770
|
]);
|
|
6615
3771
|
function getOracleStateDiscriminatorBytes() {
|
|
6616
3772
|
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6617
|
-
|
|
3773
|
+
ORACLE_STATE_DISCRIMINATOR
|
|
6618
3774
|
);
|
|
6619
3775
|
}
|
|
6620
3776
|
function getOracleStateEncoder() {
|
|
@@ -6629,7 +3785,7 @@ function getOracleStateEncoder() {
|
|
|
6629
3785
|
["bump", kit.getU8Encoder()],
|
|
6630
3786
|
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 31)]
|
|
6631
3787
|
]),
|
|
6632
|
-
(value) => ({ ...value, discriminator:
|
|
3788
|
+
(value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR })
|
|
6633
3789
|
);
|
|
6634
3790
|
}
|
|
6635
3791
|
function getOracleStateDecoder() {
|
|
@@ -6644,7 +3800,7 @@ function getOracleStateDecoder() {
|
|
|
6644
3800
|
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 31)]
|
|
6645
3801
|
]);
|
|
6646
3802
|
}
|
|
6647
|
-
function
|
|
3803
|
+
function getOracleStateCodec() {
|
|
6648
3804
|
return kit.combineCodec(getOracleStateEncoder(), getOracleStateDecoder());
|
|
6649
3805
|
}
|
|
6650
3806
|
function decodeOracleState2(encodedAccount) {
|
|
@@ -7865,7 +5021,7 @@ function predictionMigratorProgram() {
|
|
|
7865
5021
|
initConfig: programClientCore.addSelfFetchFunctions(client, getInitConfigCodec2()),
|
|
7866
5022
|
launch: programClientCore.addSelfFetchFunctions(client, getLaunchCodec2()),
|
|
7867
5023
|
market: programClientCore.addSelfFetchFunctions(client, getMarketCodec()),
|
|
7868
|
-
oracleState: programClientCore.addSelfFetchFunctions(client,
|
|
5024
|
+
oracleState: programClientCore.addSelfFetchFunctions(client, getOracleStateCodec())
|
|
7869
5025
|
},
|
|
7870
5026
|
instructions: {
|
|
7871
5027
|
claim: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
@@ -7955,10 +5111,10 @@ function createAccountMeta(value, role) {
|
|
|
7955
5111
|
async function getTokenMetadataAddress(mint) {
|
|
7956
5112
|
const encoder = kit.getAddressEncoder();
|
|
7957
5113
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
7958
|
-
programAddress:
|
|
5114
|
+
programAddress: chunkY6TJIH33_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
7959
5115
|
seeds: [
|
|
7960
5116
|
new TextEncoder().encode("metadata"),
|
|
7961
|
-
encoder.encode(
|
|
5117
|
+
encoder.encode(chunkY6TJIH33_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
7962
5118
|
encoder.encode(mint)
|
|
7963
5119
|
]
|
|
7964
5120
|
});
|
|
@@ -7989,12 +5145,12 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
7989
5145
|
authority,
|
|
7990
5146
|
hookProgram,
|
|
7991
5147
|
migratorProgram,
|
|
7992
|
-
baseTokenProgram =
|
|
7993
|
-
quoteTokenProgram =
|
|
7994
|
-
systemProgram =
|
|
5148
|
+
baseTokenProgram = chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5149
|
+
quoteTokenProgram = chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5150
|
+
systemProgram = chunkY6TJIH33_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
7995
5151
|
rent,
|
|
7996
5152
|
metadataAccount,
|
|
7997
|
-
metadataProgram =
|
|
5153
|
+
metadataProgram = chunkY6TJIH33_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
7998
5154
|
hookCreateRemainingAccounts = []
|
|
7999
5155
|
} = accounts;
|
|
8000
5156
|
const withMetadata = Boolean(
|
|
@@ -8053,9 +5209,9 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
8053
5209
|
feeBeneficiaries: args.feeBeneficiaries ?? [],
|
|
8054
5210
|
allowBuy: args.allowBuy ? 1 : 0,
|
|
8055
5211
|
allowSell: args.allowSell ? 1 : 0,
|
|
8056
|
-
hookProgram: args.hookProgram ?? hookProgram ??
|
|
5212
|
+
hookProgram: args.hookProgram ?? hookProgram ?? chunkY6TJIH33_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
8057
5213
|
hookCreateRemainingAccountsLen: args.hookCreateRemainingAccountsLen ?? hookCreateRemainingAccounts.length,
|
|
8058
|
-
migratorProgram: migratorProgram ??
|
|
5214
|
+
migratorProgram: migratorProgram ?? chunkY6TJIH33_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
8059
5215
|
hookCreateRemainingAccountsHash: args.hookCreateRemainingAccountsHash ?? (createHooksEnabled ? computeRemainingAccountsHash(hookCreateRemainingAccountAddresses) : new Uint8Array(32))
|
|
8060
5216
|
};
|
|
8061
5217
|
const data = new Uint8Array(
|
|
@@ -8141,10 +5297,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
8141
5297
|
baseMint,
|
|
8142
5298
|
quoteMint,
|
|
8143
5299
|
user,
|
|
8144
|
-
hookProgram =
|
|
5300
|
+
hookProgram = chunkY6TJIH33_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
8145
5301
|
launchFeeState,
|
|
8146
|
-
baseTokenProgram =
|
|
8147
|
-
quoteTokenProgram =
|
|
5302
|
+
baseTokenProgram = chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5303
|
+
quoteTokenProgram = chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
8148
5304
|
remainingAccounts = []
|
|
8149
5305
|
} = accounts;
|
|
8150
5306
|
const keys = [
|
|
@@ -8193,9 +5349,9 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
8193
5349
|
launchFeeState,
|
|
8194
5350
|
migratorProgram,
|
|
8195
5351
|
payer,
|
|
8196
|
-
baseTokenProgram =
|
|
8197
|
-
quoteTokenProgram =
|
|
8198
|
-
systemProgram =
|
|
5352
|
+
baseTokenProgram = chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5353
|
+
quoteTokenProgram = chunkY6TJIH33_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5354
|
+
systemProgram = chunkY6TJIH33_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
8199
5355
|
rent
|
|
8200
5356
|
} = accounts;
|
|
8201
5357
|
const keys = [
|
|
@@ -8214,7 +5370,7 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
8214
5370
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
8215
5371
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
8216
5372
|
];
|
|
8217
|
-
const data =
|
|
5373
|
+
const data = chunkKJ6W44WF_cjs.encodeInstructionData(
|
|
8218
5374
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
8219
5375
|
);
|
|
8220
5376
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -8280,7 +5436,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
8280
5436
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
8281
5437
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
8282
5438
|
];
|
|
8283
|
-
const data =
|
|
5439
|
+
const data = chunkKJ6W44WF_cjs.encodeInstructionData(
|
|
8284
5440
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
8285
5441
|
);
|
|
8286
5442
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -8653,7 +5809,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
8653
5809
|
adminBaseAta,
|
|
8654
5810
|
adminQuoteAta,
|
|
8655
5811
|
recipientAtas,
|
|
8656
|
-
cpmmProgram =
|
|
5812
|
+
cpmmProgram = chunkY6TJIH33_cjs.CPMM_PROGRAM_ID,
|
|
8657
5813
|
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
8658
5814
|
}) {
|
|
8659
5815
|
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
|
|
@@ -8661,9 +5817,9 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
8661
5817
|
cpmmMigratorProgram
|
|
8662
5818
|
);
|
|
8663
5819
|
const [migrationAuthority] = await getCpmmMigrationAuthorityAddress(cpmmMigratorProgram);
|
|
8664
|
-
const poolInit = await
|
|
5820
|
+
const poolInit = await chunkY6TJIH33_cjs.getPoolInitAddresses(baseMint, quoteMint, cpmmProgram);
|
|
8665
5821
|
const pool = poolInit.pool[0];
|
|
8666
|
-
const [launchLpPosition] = await
|
|
5822
|
+
const [launchLpPosition] = await chunkY6TJIH33_cjs.getPositionAddress(
|
|
8667
5823
|
pool,
|
|
8668
5824
|
launchAuthority,
|
|
8669
5825
|
0n,
|
|
@@ -8676,6 +5832,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
8676
5832
|
poolInit.authority[0],
|
|
8677
5833
|
poolInit.vault0[0],
|
|
8678
5834
|
poolInit.vault1[0],
|
|
5835
|
+
poolInit.protocolFeeOwner[0],
|
|
8679
5836
|
poolInit.protocolFeePosition[0],
|
|
8680
5837
|
launchLpPosition,
|
|
8681
5838
|
cpmmProgram,
|
|
@@ -8694,6 +5851,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
8694
5851
|
{ address: poolInit.authority[0], role: kit.AccountRole.READONLY },
|
|
8695
5852
|
{ address: poolInit.vault0[0], role: kit.AccountRole.WRITABLE },
|
|
8696
5853
|
{ address: poolInit.vault1[0], role: kit.AccountRole.WRITABLE },
|
|
5854
|
+
{ address: poolInit.protocolFeeOwner[0], role: kit.AccountRole.READONLY },
|
|
8697
5855
|
{ address: poolInit.protocolFeePosition[0], role: kit.AccountRole.WRITABLE },
|
|
8698
5856
|
{ address: launchLpPosition, role: kit.AccountRole.WRITABLE },
|
|
8699
5857
|
{ address: cpmmProgram, role: kit.AccountRole.READONLY },
|
|
@@ -8711,6 +5869,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
8711
5869
|
poolAuthority: poolInit.authority[0],
|
|
8712
5870
|
poolVault0: poolInit.vault0[0],
|
|
8713
5871
|
poolVault1: poolInit.vault1[0],
|
|
5872
|
+
protocolFeeOwner: poolInit.protocolFeeOwner[0],
|
|
8714
5873
|
protocolFeePosition: poolInit.protocolFeePosition[0],
|
|
8715
5874
|
launchLpPosition,
|
|
8716
5875
|
migrationAuthority
|
|
@@ -8747,11 +5906,8 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
|
8747
5906
|
LAUNCH_DISCRIMINATOR: () => LAUNCH_DISCRIMINATOR2,
|
|
8748
5907
|
MARKET_DISCRIMINATOR: () => MARKET_DISCRIMINATOR,
|
|
8749
5908
|
MIGRATE_ENTRY_DISCRIMINATOR: () => MIGRATE_ENTRY_DISCRIMINATOR,
|
|
8750
|
-
ORACLE_STATE_DISCRIMINATOR: () =>
|
|
5909
|
+
ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR,
|
|
8751
5910
|
PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED,
|
|
8752
|
-
PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED,
|
|
8753
|
-
PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED,
|
|
8754
|
-
PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED: () => PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED,
|
|
8755
5911
|
PREDICTION_MIGRATOR_ERROR__INSUFFICIENT_BALANCE: () => PREDICTION_MIGRATOR_ERROR__INSUFFICIENT_BALANCE,
|
|
8756
5912
|
PREDICTION_MIGRATOR_ERROR__INVALID_ENTRY_ID: () => PREDICTION_MIGRATOR_ERROR__INVALID_ENTRY_ID,
|
|
8757
5913
|
PREDICTION_MIGRATOR_ERROR__INVALID_INPUT: () => PREDICTION_MIGRATOR_ERROR__INVALID_INPUT,
|
|
@@ -8762,7 +5918,6 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
|
8762
5918
|
PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT: () => PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT,
|
|
8763
5919
|
PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED: () => PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED,
|
|
8764
5920
|
PREDICTION_MIGRATOR_ERROR__MATH_OVERFLOW: () => PREDICTION_MIGRATOR_ERROR__MATH_OVERFLOW,
|
|
8765
|
-
PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS: () => PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS,
|
|
8766
5921
|
PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED: () => PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED,
|
|
8767
5922
|
PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH: () => PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH,
|
|
8768
5923
|
PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED: () => PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED,
|
|
@@ -8868,7 +6023,7 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
|
8868
6023
|
getMigrateEntryInstructionDataCodec: () => getMigrateEntryInstructionDataCodec,
|
|
8869
6024
|
getMigrateEntryInstructionDataDecoder: () => getMigrateEntryInstructionDataDecoder,
|
|
8870
6025
|
getMigrateEntryInstructionDataEncoder: () => getMigrateEntryInstructionDataEncoder,
|
|
8871
|
-
getOracleStateCodec: () =>
|
|
6026
|
+
getOracleStateCodec: () => getOracleStateCodec,
|
|
8872
6027
|
getOracleStateDecoder: () => getOracleStateDecoder,
|
|
8873
6028
|
getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes,
|
|
8874
6029
|
getOracleStateEncoder: () => getOracleStateEncoder,
|
|
@@ -8914,10 +6069,7 @@ chunkQ7SFCCGT_cjs.__export(predictionMigrator_exports, {
|
|
|
8914
6069
|
});
|
|
8915
6070
|
var PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED = 6e3;
|
|
8916
6071
|
var PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH = 6001;
|
|
8917
|
-
var PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED = 6002;
|
|
8918
|
-
var PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED = 6003;
|
|
8919
6072
|
var PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED = 6004;
|
|
8920
|
-
var PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED = 6005;
|
|
8921
6073
|
var PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED = 6006;
|
|
8922
6074
|
var PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED = 6007;
|
|
8923
6075
|
var PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT = 6008;
|
|
@@ -8928,7 +6080,6 @@ var PREDICTION_MIGRATOR_ERROR__INVALID_MARKET = 6012;
|
|
|
8928
6080
|
var PREDICTION_MIGRATOR_ERROR__INVALID_VAULT = 6013;
|
|
8929
6081
|
var PREDICTION_MIGRATOR_ERROR__INVALID_MINT = 6014;
|
|
8930
6082
|
var PREDICTION_MIGRATOR_ERROR__WINNING_ENTRY_NOT_MIGRATED = 6015;
|
|
8931
|
-
var PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS = 6016;
|
|
8932
6083
|
var PREDICTION_MIGRATOR_ERROR__INVALID_ORACLE = 6017;
|
|
8933
6084
|
var PREDICTION_MIGRATOR_ERROR__ZERO_CLAIMABLE_SUPPLY = 6018;
|
|
8934
6085
|
var PREDICTION_MIGRATOR_ERROR__INVALID_INPUT = 6019;
|
|
@@ -8936,9 +6087,6 @@ var predictionMigratorErrorMessages;
|
|
|
8936
6087
|
if (process.env.NODE_ENV !== "production") {
|
|
8937
6088
|
predictionMigratorErrorMessages = {
|
|
8938
6089
|
[PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_MIGRATED]: `Entry already migrated`,
|
|
8939
|
-
[PREDICTION_MIGRATOR_ERROR__ENTRY_ALREADY_REGISTERED]: `Entry already registered`,
|
|
8940
|
-
[PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_MIGRATED]: `Entry not migrated`,
|
|
8941
|
-
[PREDICTION_MIGRATOR_ERROR__ENTRY_NOT_REGISTERED]: `Entry not registered`,
|
|
8942
6090
|
[PREDICTION_MIGRATOR_ERROR__INSUFFICIENT_BALANCE]: `Insufficient balance`,
|
|
8943
6091
|
[PREDICTION_MIGRATOR_ERROR__INVALID_ENTRY_ID]: `Invalid entry ID`,
|
|
8944
6092
|
[PREDICTION_MIGRATOR_ERROR__INVALID_INPUT]: `Invalid input`,
|
|
@@ -8949,7 +6097,6 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
8949
6097
|
[PREDICTION_MIGRATOR_ERROR__INVALID_WINNER_MINT]: `Invalid winner mint`,
|
|
8950
6098
|
[PREDICTION_MIGRATOR_ERROR__MARKET_NOT_RESOLVED]: `Market not resolved`,
|
|
8951
6099
|
[PREDICTION_MIGRATOR_ERROR__MATH_OVERFLOW]: `Math overflow`,
|
|
8952
|
-
[PREDICTION_MIGRATOR_ERROR__NO_PENDING_REWARDS]: `No pending rewards`,
|
|
8953
6100
|
[PREDICTION_MIGRATOR_ERROR__ORACLE_NOT_FINALIZED]: `Oracle not finalized`,
|
|
8954
6101
|
[PREDICTION_MIGRATOR_ERROR__QUOTE_MINT_MISMATCH]: `Quote mint mismatch`,
|
|
8955
6102
|
[PREDICTION_MIGRATOR_ERROR__UNAUTHORIZED]: `Unauthorized`,
|
|
@@ -8977,10 +6124,9 @@ var trustedOracle_exports = {};
|
|
|
8977
6124
|
chunkQ7SFCCGT_cjs.__export(trustedOracle_exports, {
|
|
8978
6125
|
FINALIZE_DISCRIMINATOR: () => FINALIZE_DISCRIMINATOR,
|
|
8979
6126
|
INITIALIZE_ORACLE_DISCRIMINATOR: () => INITIALIZE_ORACLE_DISCRIMINATOR2,
|
|
8980
|
-
ORACLE_STATE_DISCRIMINATOR: () =>
|
|
6127
|
+
ORACLE_STATE_DISCRIMINATOR: () => ORACLE_STATE_DISCRIMINATOR2,
|
|
8981
6128
|
TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED: () => TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED,
|
|
8982
6129
|
TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT: () => TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT,
|
|
8983
|
-
TRUSTED_ORACLE_ERROR__NOT_FINALIZED: () => TRUSTED_ORACLE_ERROR__NOT_FINALIZED,
|
|
8984
6130
|
TRUSTED_ORACLE_ERROR__UNAUTHORIZED: () => TRUSTED_ORACLE_ERROR__UNAUTHORIZED,
|
|
8985
6131
|
TRUSTED_ORACLE_PROGRAM_ADDRESS: () => TRUSTED_ORACLE_PROGRAM_ADDRESS,
|
|
8986
6132
|
TrustedOracleAccount: () => TrustedOracleAccount,
|
|
@@ -9004,7 +6150,7 @@ chunkQ7SFCCGT_cjs.__export(trustedOracle_exports, {
|
|
|
9004
6150
|
getInitializeOracleInstructionDataDecoder: () => getInitializeOracleInstructionDataDecoder2,
|
|
9005
6151
|
getInitializeOracleInstructionDataEncoder: () => getInitializeOracleInstructionDataEncoder2,
|
|
9006
6152
|
getOracleStateAddress: () => getOracleStateAddress,
|
|
9007
|
-
getOracleStateCodec: () =>
|
|
6153
|
+
getOracleStateCodec: () => getOracleStateCodec2,
|
|
9008
6154
|
getOracleStateDecoder: () => getOracleStateDecoder2,
|
|
9009
6155
|
getOracleStateDiscriminatorBytes: () => getOracleStateDiscriminatorBytes2,
|
|
9010
6156
|
getOracleStateEncoder: () => getOracleStateEncoder2,
|
|
@@ -9018,7 +6164,7 @@ chunkQ7SFCCGT_cjs.__export(trustedOracle_exports, {
|
|
|
9018
6164
|
parseTrustedOracleInstruction: () => parseTrustedOracleInstruction,
|
|
9019
6165
|
trustedOracleProgram: () => trustedOracleProgram
|
|
9020
6166
|
});
|
|
9021
|
-
var
|
|
6167
|
+
var ORACLE_STATE_DISCRIMINATOR2 = new Uint8Array([
|
|
9022
6168
|
97,
|
|
9023
6169
|
156,
|
|
9024
6170
|
157,
|
|
@@ -9030,7 +6176,7 @@ var ORACLE_STATE_DISCRIMINATOR3 = new Uint8Array([
|
|
|
9030
6176
|
]);
|
|
9031
6177
|
function getOracleStateDiscriminatorBytes2() {
|
|
9032
6178
|
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
9033
|
-
|
|
6179
|
+
ORACLE_STATE_DISCRIMINATOR2
|
|
9034
6180
|
);
|
|
9035
6181
|
}
|
|
9036
6182
|
function getOracleStateEncoder2() {
|
|
@@ -9045,7 +6191,7 @@ function getOracleStateEncoder2() {
|
|
|
9045
6191
|
["bump", kit.getU8Encoder()],
|
|
9046
6192
|
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 31)]
|
|
9047
6193
|
]),
|
|
9048
|
-
(value) => ({ ...value, discriminator:
|
|
6194
|
+
(value) => ({ ...value, discriminator: ORACLE_STATE_DISCRIMINATOR2 })
|
|
9049
6195
|
);
|
|
9050
6196
|
}
|
|
9051
6197
|
function getOracleStateDecoder2() {
|
|
@@ -9060,7 +6206,7 @@ function getOracleStateDecoder2() {
|
|
|
9060
6206
|
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 31)]
|
|
9061
6207
|
]);
|
|
9062
6208
|
}
|
|
9063
|
-
function
|
|
6209
|
+
function getOracleStateCodec2() {
|
|
9064
6210
|
return kit.combineCodec(getOracleStateEncoder2(), getOracleStateDecoder2());
|
|
9065
6211
|
}
|
|
9066
6212
|
function decodeOracleState3(encodedAccount) {
|
|
@@ -9347,7 +6493,7 @@ function trustedOracleProgram() {
|
|
|
9347
6493
|
...client,
|
|
9348
6494
|
trustedOracle: {
|
|
9349
6495
|
accounts: {
|
|
9350
|
-
oracleState: programClientCore.addSelfFetchFunctions(client,
|
|
6496
|
+
oracleState: programClientCore.addSelfFetchFunctions(client, getOracleStateCodec2())
|
|
9351
6497
|
},
|
|
9352
6498
|
instructions: {
|
|
9353
6499
|
finalize: (input) => programClientCore.addSelfPlanAndSendFunctions(client, getFinalizeInstruction(input)),
|
|
@@ -9364,14 +6510,12 @@ function trustedOracleProgram() {
|
|
|
9364
6510
|
// src/solana/generated/trustedOracle/errors/trustedOracle.ts
|
|
9365
6511
|
var TRUSTED_ORACLE_ERROR__UNAUTHORIZED = 6e3;
|
|
9366
6512
|
var TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED = 6001;
|
|
9367
|
-
var TRUSTED_ORACLE_ERROR__NOT_FINALIZED = 6002;
|
|
9368
6513
|
var TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT = 6003;
|
|
9369
6514
|
var trustedOracleErrorMessages;
|
|
9370
6515
|
if (process.env.NODE_ENV !== "production") {
|
|
9371
6516
|
trustedOracleErrorMessages = {
|
|
9372
6517
|
[TRUSTED_ORACLE_ERROR__ALREADY_FINALIZED]: `Oracle already finalized`,
|
|
9373
6518
|
[TRUSTED_ORACLE_ERROR__INVALID_WINNING_MINT]: `Invalid winning mint`,
|
|
9374
|
-
[TRUSTED_ORACLE_ERROR__NOT_FINALIZED]: `Oracle not finalized`,
|
|
9375
6519
|
[TRUSTED_ORACLE_ERROR__UNAUTHORIZED]: `Unauthorized: only oracle authority can perform this action`
|
|
9376
6520
|
};
|
|
9377
6521
|
}
|
|
@@ -9422,14 +6566,14 @@ async function getOracleStateAddress(oracleAuthority, nonce) {
|
|
|
9422
6566
|
|
|
9423
6567
|
// src/solana/deployment.ts
|
|
9424
6568
|
var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
9425
|
-
cpmmProgram:
|
|
6569
|
+
cpmmProgram: chunkY6TJIH33_cjs.CPMM_PROGRAM_ID,
|
|
9426
6570
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
9427
6571
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
9428
6572
|
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID,
|
|
9429
6573
|
cosignerHookProgram: COSIGNER_HOOK_PROGRAM_ID
|
|
9430
6574
|
};
|
|
9431
6575
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
9432
|
-
const [cpmmConfig] = await
|
|
6576
|
+
const [cpmmConfig] = await chunkY6TJIH33_cjs.getConfigAddress(programs.cpmmProgram);
|
|
9433
6577
|
const [initializerConfig] = await getConfigAddress2(
|
|
9434
6578
|
programs.initializerProgram
|
|
9435
6579
|
);
|