@whetstone-research/doppler-sdk 1.0.28 → 1.0.29
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-U6B52TBT.cjs → chunk-4CI2M2F6.cjs} +27 -2
- package/dist/chunk-4CI2M2F6.cjs.map +1 -0
- package/dist/{chunk-4WY5GNZD.cjs → chunk-7PXLEMBJ.cjs} +336 -36
- package/dist/chunk-7PXLEMBJ.cjs.map +1 -0
- package/dist/{chunk-WD5VOZGI.js → chunk-AFXFT3BD.js} +24 -3
- package/dist/chunk-AFXFT3BD.js.map +1 -0
- package/dist/{chunk-AYVFWD5P.js → chunk-PSLY7M7C.js} +296 -4
- package/dist/chunk-PSLY7M7C.js.map +1 -0
- package/dist/{pda-H6VMGONM.cjs → pda-44IHEORD.cjs} +21 -17
- package/dist/pda-44IHEORD.cjs.map +1 -0
- package/dist/{pda-UJLXCO6I.js → pda-WJVDXQPW.js} +3 -3
- package/dist/pda-WJVDXQPW.js.map +1 -0
- package/dist/solana/index.cjs +1360 -1937
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +1293 -1376
- package/dist/solana/index.d.ts +1293 -1376
- package/dist/solana/index.js +967 -1543
- package/dist/solana/index.js.map +1 -1
- package/dist/solana/react/index.cjs +45 -45
- package/dist/solana/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-4WY5GNZD.cjs.map +0 -1
- package/dist/chunk-AYVFWD5P.js.map +0 -1
- package/dist/chunk-U6B52TBT.cjs.map +0 -1
- package/dist/chunk-WD5VOZGI.js.map +0 -1
- package/dist/pda-H6VMGONM.cjs.map +0 -1
- package/dist/pda-UJLXCO6I.js.map +0 -1
package/dist/solana/index.cjs
CHANGED
|
@@ -1,357 +1,368 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk7PXLEMBJ_cjs = require('../chunk-7PXLEMBJ.cjs');
|
|
4
|
+
var chunk4CI2M2F6_cjs = require('../chunk-4CI2M2F6.cjs');
|
|
5
5
|
var chunkQ7SFCCGT_cjs = require('../chunk-Q7SFCCGT.cjs');
|
|
6
6
|
var kit = require('@solana/kit');
|
|
7
7
|
var programClientCore = require('@solana/program-client-core');
|
|
8
8
|
var sha3_js = require('@noble/hashes/sha3.js');
|
|
9
9
|
var token = require('@solana-program/token');
|
|
10
|
-
var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
11
10
|
var system = require('@solana-program/system');
|
|
11
|
+
var sysvars = require('@solana/sysvars');
|
|
12
|
+
var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
12
13
|
|
|
13
14
|
// src/solana/cpmm/index.ts
|
|
14
15
|
var cpmm_exports = {};
|
|
15
16
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
16
|
-
ACCOUNT_DISCRIMINATORS: () =>
|
|
17
|
-
ACCOUNT_VERSION: () =>
|
|
18
|
-
ADD_LIQUIDITY_DISCRIMINATOR: () =>
|
|
19
|
-
BPS_DENOM: () =>
|
|
20
|
-
CLOSE_POSITION_DISCRIMINATOR: () =>
|
|
21
|
-
COLLECT_FEES_DISCRIMINATOR: () =>
|
|
22
|
-
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () =>
|
|
17
|
+
ACCOUNT_DISCRIMINATORS: () => chunk4CI2M2F6_cjs.ACCOUNT_DISCRIMINATORS,
|
|
18
|
+
ACCOUNT_VERSION: () => chunk4CI2M2F6_cjs.ACCOUNT_VERSION,
|
|
19
|
+
ADD_LIQUIDITY_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.ADD_LIQUIDITY_DISCRIMINATOR,
|
|
20
|
+
BPS_DENOM: () => chunk4CI2M2F6_cjs.BPS_DENOM,
|
|
21
|
+
CLOSE_POSITION_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.CLOSE_POSITION_DISCRIMINATOR,
|
|
22
|
+
COLLECT_FEES_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.COLLECT_FEES_DISCRIMINATOR,
|
|
23
|
+
COLLECT_PROTOCOL_FEES_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.COLLECT_PROTOCOL_FEES_DISCRIMINATOR,
|
|
23
24
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
24
|
-
CPMM_PROGRAM_ID: () =>
|
|
25
|
-
CREATE_POSITION_DISCRIMINATOR: () =>
|
|
25
|
+
CPMM_PROGRAM_ID: () => chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
26
|
+
CREATE_POSITION_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.CREATE_POSITION_DISCRIMINATOR,
|
|
26
27
|
CpmmError: () => CpmmError,
|
|
27
28
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
28
|
-
HF_AFTER_ADD_LIQ: () =>
|
|
29
|
-
HF_AFTER_REMOVE_LIQ: () =>
|
|
30
|
-
HF_AFTER_SWAP: () =>
|
|
31
|
-
HF_BEFORE_ADD_LIQ: () =>
|
|
32
|
-
HF_BEFORE_REMOVE_LIQ: () =>
|
|
33
|
-
HF_BEFORE_SWAP: () =>
|
|
34
|
-
HF_FORWARD_READONLY_SIGNERS: () =>
|
|
35
|
-
HF_REQUIRE_ORACLE: () =>
|
|
36
|
-
HOOK_NO_CHANGE: () =>
|
|
37
|
-
INITIALIZE_CONFIG_DISCRIMINATOR: () =>
|
|
38
|
-
INITIALIZE_ORACLE_DISCRIMINATOR: () =>
|
|
39
|
-
INITIALIZE_POOL_DISCRIMINATOR: () =>
|
|
40
|
-
|
|
29
|
+
HF_AFTER_ADD_LIQ: () => chunk4CI2M2F6_cjs.HF_AFTER_ADD_LIQ,
|
|
30
|
+
HF_AFTER_REMOVE_LIQ: () => chunk4CI2M2F6_cjs.HF_AFTER_REMOVE_LIQ,
|
|
31
|
+
HF_AFTER_SWAP: () => chunk4CI2M2F6_cjs.HF_AFTER_SWAP,
|
|
32
|
+
HF_BEFORE_ADD_LIQ: () => chunk4CI2M2F6_cjs.HF_BEFORE_ADD_LIQ,
|
|
33
|
+
HF_BEFORE_REMOVE_LIQ: () => chunk4CI2M2F6_cjs.HF_BEFORE_REMOVE_LIQ,
|
|
34
|
+
HF_BEFORE_SWAP: () => chunk4CI2M2F6_cjs.HF_BEFORE_SWAP,
|
|
35
|
+
HF_FORWARD_READONLY_SIGNERS: () => chunk4CI2M2F6_cjs.HF_FORWARD_READONLY_SIGNERS,
|
|
36
|
+
HF_REQUIRE_ORACLE: () => chunk4CI2M2F6_cjs.HF_REQUIRE_ORACLE,
|
|
37
|
+
HOOK_NO_CHANGE: () => chunk4CI2M2F6_cjs.HOOK_NO_CHANGE,
|
|
38
|
+
INITIALIZE_CONFIG_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.INITIALIZE_CONFIG_DISCRIMINATOR,
|
|
39
|
+
INITIALIZE_ORACLE_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.INITIALIZE_ORACLE_DISCRIMINATOR,
|
|
40
|
+
INITIALIZE_POOL_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.INITIALIZE_POOL_DISCRIMINATOR,
|
|
41
|
+
INITIALIZE_SPOT_POOL_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.INITIALIZE_SPOT_POOL_DISCRIMINATOR,
|
|
42
|
+
INSTRUCTION_DISCRIMINATORS: () => chunk4CI2M2F6_cjs.INSTRUCTION_DISCRIMINATORS,
|
|
41
43
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
42
|
-
MAX_HOOK_ALLOWLIST: () =>
|
|
43
|
-
MAX_ORACLE_OBSERVATIONS: () =>
|
|
44
|
-
ORACLE_CONSULT_DISCRIMINATOR: () =>
|
|
45
|
-
ORACLE_UPDATE_DISCRIMINATOR: () =>
|
|
46
|
-
PAUSE_DISCRIMINATOR: () =>
|
|
47
|
-
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () =>
|
|
48
|
-
Q64_ONE: () =>
|
|
49
|
-
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () =>
|
|
50
|
-
REMOVE_LIQUIDITY_DISCRIMINATOR: () =>
|
|
51
|
-
SEED_AUTHORITY: () =>
|
|
52
|
-
SEED_CONFIG: () =>
|
|
53
|
-
SEED_ORACLE: () =>
|
|
54
|
-
SEED_POOL: () =>
|
|
55
|
-
SEED_POSITION: () =>
|
|
56
|
-
SEED_PROTOCOL_FEE_OWNER: () =>
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
44
|
+
MAX_HOOK_ALLOWLIST: () => chunk4CI2M2F6_cjs.MAX_HOOK_ALLOWLIST,
|
|
45
|
+
MAX_ORACLE_OBSERVATIONS: () => chunk4CI2M2F6_cjs.MAX_ORACLE_OBSERVATIONS,
|
|
46
|
+
ORACLE_CONSULT_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.ORACLE_CONSULT_DISCRIMINATOR,
|
|
47
|
+
ORACLE_UPDATE_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.ORACLE_UPDATE_DISCRIMINATOR,
|
|
48
|
+
PAUSE_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.PAUSE_DISCRIMINATOR,
|
|
49
|
+
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR,
|
|
50
|
+
Q64_ONE: () => chunk4CI2M2F6_cjs.Q64_ONE,
|
|
51
|
+
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.REDEEM_PROTOCOL_SHARES_DISCRIMINATOR,
|
|
52
|
+
REMOVE_LIQUIDITY_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.REMOVE_LIQUIDITY_DISCRIMINATOR,
|
|
53
|
+
SEED_AUTHORITY: () => chunk4CI2M2F6_cjs.SEED_AUTHORITY,
|
|
54
|
+
SEED_CONFIG: () => chunk4CI2M2F6_cjs.SEED_CONFIG,
|
|
55
|
+
SEED_ORACLE: () => chunk4CI2M2F6_cjs.SEED_ORACLE,
|
|
56
|
+
SEED_POOL: () => chunk4CI2M2F6_cjs.SEED_POOL,
|
|
57
|
+
SEED_POSITION: () => chunk4CI2M2F6_cjs.SEED_POSITION,
|
|
58
|
+
SEED_PROTOCOL_FEE_OWNER: () => chunk4CI2M2F6_cjs.SEED_PROTOCOL_FEE_OWNER,
|
|
59
|
+
SEED_SPOT_POOL: () => chunk4CI2M2F6_cjs.SEED_SPOT_POOL,
|
|
60
|
+
SET_FEES_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.SET_FEES_DISCRIMINATOR,
|
|
61
|
+
SET_HOOK_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.SET_HOOK_DISCRIMINATOR,
|
|
62
|
+
SWAP_EXACT_IN_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.SWAP_EXACT_IN_DISCRIMINATOR,
|
|
63
|
+
TOKEN_METADATA_PROGRAM_ID: () => chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
64
|
+
TRANSFER_ADMIN_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.TRANSFER_ADMIN_DISCRIMINATOR,
|
|
65
|
+
UNPAUSE_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.UNPAUSE_DISCRIMINATOR,
|
|
66
|
+
UPDATE_CONFIG_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.UPDATE_CONFIG_DISCRIMINATOR,
|
|
67
|
+
WITHDRAW_VAULT_EXCESS_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.WITHDRAW_VAULT_EXCESS_DISCRIMINATOR,
|
|
68
|
+
addLiquidityArgsCodec: () => chunk7PXLEMBJ_cjs.addLiquidityArgsCodec,
|
|
69
|
+
addressToBase58EncodedBytes: () => chunk7PXLEMBJ_cjs.addressToBase58EncodedBytes,
|
|
70
|
+
ammConfigDataCodec: () => chunk7PXLEMBJ_cjs.ammConfigDataCodec,
|
|
71
|
+
areMintsOrdered: () => chunk4CI2M2F6_cjs.areMintsOrdered,
|
|
72
|
+
base64ToBytes: () => chunk7PXLEMBJ_cjs.base64ToBytes,
|
|
73
|
+
bytesToBase64: () => chunk7PXLEMBJ_cjs.bytesToBase64,
|
|
74
|
+
bytesToBase64EncodedBytes: () => chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes,
|
|
75
|
+
calculateAccruedFees: () => chunk7PXLEMBJ_cjs.calculateAccruedFees,
|
|
76
|
+
calculateTwap: () => chunk7PXLEMBJ_cjs.calculateTwap,
|
|
77
|
+
calculateTwapNumber: () => chunk7PXLEMBJ_cjs.calculateTwapNumber,
|
|
78
|
+
ceilDiv: () => chunk7PXLEMBJ_cjs.ceilDiv,
|
|
79
|
+
collectFeesArgsCodec: () => chunk7PXLEMBJ_cjs.collectFeesArgsCodec,
|
|
80
|
+
collectProtocolFeesArgsCodec: () => chunk7PXLEMBJ_cjs.collectProtocolFeesArgsCodec,
|
|
81
|
+
comparePoolAndOraclePrices: () => chunk7PXLEMBJ_cjs.comparePoolAndOraclePrices,
|
|
82
|
+
computePrice0Q64: () => chunk7PXLEMBJ_cjs.computePrice0Q64,
|
|
83
|
+
computePrice1Q64: () => chunk7PXLEMBJ_cjs.computePrice1Q64,
|
|
84
|
+
consultTwap: () => chunk7PXLEMBJ_cjs.consultTwap,
|
|
85
|
+
createAccountMeta: () => chunk7PXLEMBJ_cjs.createAccountMeta,
|
|
86
|
+
createAddLiquidityInstruction: () => chunk7PXLEMBJ_cjs.getAddLiquidityInstruction,
|
|
87
|
+
createClosePositionInstruction: () => chunk7PXLEMBJ_cjs.getClosePositionInstruction,
|
|
88
|
+
createCollectFeesInstruction: () => chunk7PXLEMBJ_cjs.getCollectFeesInstruction,
|
|
89
|
+
createCollectProtocolFeesInstruction: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesInstruction,
|
|
90
|
+
createCreatePositionInstruction: () => chunk7PXLEMBJ_cjs.getCreatePositionInstruction,
|
|
91
|
+
createInitializeConfigInstruction: () => chunk7PXLEMBJ_cjs.getInitializeConfigInstruction,
|
|
92
|
+
createInitializeOracleInstruction: () => chunk7PXLEMBJ_cjs.getInitializeOracleInstruction,
|
|
93
|
+
createInitializePoolInstruction: () => chunk7PXLEMBJ_cjs.getInitializePoolInstruction,
|
|
94
|
+
createOracleConsultInstruction: () => chunk7PXLEMBJ_cjs.getOracleConsultInstruction,
|
|
95
|
+
createOracleUpdateInstruction: () => chunk7PXLEMBJ_cjs.getOracleUpdateInstruction,
|
|
96
|
+
createPauseInstruction: () => chunk7PXLEMBJ_cjs.getPauseInstruction,
|
|
97
|
+
createPositionArgsCodec: () => chunk7PXLEMBJ_cjs.createPositionArgsCodec,
|
|
98
|
+
createReadonlyRemainingAccountMeta: () => chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta,
|
|
99
|
+
createRemoveLiquidityInstruction: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityInstruction,
|
|
100
|
+
createSetFeesInstruction: () => chunk7PXLEMBJ_cjs.getSetFeesInstruction,
|
|
101
|
+
createSetHookInstruction: () => chunk7PXLEMBJ_cjs.getSetHookInstruction,
|
|
102
|
+
createSwapExactInInstruction: () => chunk7PXLEMBJ_cjs.getSwapExactInInstruction,
|
|
100
103
|
createSwapInstruction: () => createSwapInstruction,
|
|
101
|
-
createTransferAdminInstruction: () =>
|
|
102
|
-
createUnpauseInstruction: () =>
|
|
103
|
-
createWithdrawVaultExcessInstruction: () =>
|
|
104
|
+
createTransferAdminInstruction: () => chunk7PXLEMBJ_cjs.getTransferAdminInstruction,
|
|
105
|
+
createUnpauseInstruction: () => chunk7PXLEMBJ_cjs.getUnpauseInstruction,
|
|
106
|
+
createWithdrawVaultExcessInstruction: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstruction,
|
|
104
107
|
curveParamsToMarketCap: () => curveParamsToMarketCap,
|
|
105
|
-
decodeAmmConfig: () =>
|
|
106
|
-
decodeOracleState: () =>
|
|
107
|
-
decodePool: () =>
|
|
108
|
-
decodePosition: () =>
|
|
109
|
-
encodeAddLiquidityArgs: () =>
|
|
110
|
-
encodeCollectFeesArgs: () =>
|
|
111
|
-
encodeCollectProtocolFeesArgs: () =>
|
|
112
|
-
encodeCreatePositionArgs: () =>
|
|
113
|
-
encodeInitializeConfigArgs: () =>
|
|
114
|
-
encodeInitializeOracleArgs: () =>
|
|
115
|
-
encodeInitializePoolArgs: () =>
|
|
116
|
-
encodeInstructionData: () =>
|
|
117
|
-
encodeOracleConsultArgs: () =>
|
|
118
|
-
encodeRemoveLiquidityArgs: () =>
|
|
119
|
-
encodeSetFeesArgs: () =>
|
|
120
|
-
encodeSetHookArgs: () =>
|
|
121
|
-
encodeSwapExactInArgs: () =>
|
|
122
|
-
encodeTransferAdminArgs: () =>
|
|
123
|
-
fetchAllPools: () =>
|
|
108
|
+
decodeAmmConfig: () => chunk7PXLEMBJ_cjs.decodeAmmConfig,
|
|
109
|
+
decodeOracleState: () => chunk7PXLEMBJ_cjs.decodeOracleState,
|
|
110
|
+
decodePool: () => chunk7PXLEMBJ_cjs.decodePool,
|
|
111
|
+
decodePosition: () => chunk7PXLEMBJ_cjs.decodePosition,
|
|
112
|
+
encodeAddLiquidityArgs: () => chunk7PXLEMBJ_cjs.encodeAddLiquidityArgs,
|
|
113
|
+
encodeCollectFeesArgs: () => chunk7PXLEMBJ_cjs.encodeCollectFeesArgs,
|
|
114
|
+
encodeCollectProtocolFeesArgs: () => chunk7PXLEMBJ_cjs.encodeCollectProtocolFeesArgs,
|
|
115
|
+
encodeCreatePositionArgs: () => chunk7PXLEMBJ_cjs.encodeCreatePositionArgs,
|
|
116
|
+
encodeInitializeConfigArgs: () => chunk7PXLEMBJ_cjs.encodeInitializeConfigArgs,
|
|
117
|
+
encodeInitializeOracleArgs: () => chunk7PXLEMBJ_cjs.encodeInitializeOracleArgs,
|
|
118
|
+
encodeInitializePoolArgs: () => chunk7PXLEMBJ_cjs.encodeInitializePoolArgs,
|
|
119
|
+
encodeInstructionData: () => chunk7PXLEMBJ_cjs.encodeInstructionData,
|
|
120
|
+
encodeOracleConsultArgs: () => chunk7PXLEMBJ_cjs.encodeOracleConsultArgs,
|
|
121
|
+
encodeRemoveLiquidityArgs: () => chunk7PXLEMBJ_cjs.encodeRemoveLiquidityArgs,
|
|
122
|
+
encodeSetFeesArgs: () => chunk7PXLEMBJ_cjs.encodeSetFeesArgs,
|
|
123
|
+
encodeSetHookArgs: () => chunk7PXLEMBJ_cjs.encodeSetHookArgs,
|
|
124
|
+
encodeSwapExactInArgs: () => chunk7PXLEMBJ_cjs.encodeSwapExactInArgs,
|
|
125
|
+
encodeTransferAdminArgs: () => chunk7PXLEMBJ_cjs.encodeTransferAdminArgs,
|
|
126
|
+
fetchAllPools: () => chunk7PXLEMBJ_cjs.fetchAllPools,
|
|
124
127
|
fetchConfig: () => fetchConfig,
|
|
125
128
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
126
|
-
fetchOracle: () =>
|
|
127
|
-
fetchOraclesBatch: () =>
|
|
128
|
-
fetchPool: () =>
|
|
129
|
-
fetchPoolPositions: () =>
|
|
130
|
-
fetchPoolsBatch: () =>
|
|
131
|
-
fetchPosition: () =>
|
|
132
|
-
fetchPositionByParams: () =>
|
|
133
|
-
fetchPositionsBatch: () =>
|
|
134
|
-
fetchUserPositions: () =>
|
|
135
|
-
filterActivePositions: () =>
|
|
136
|
-
filterPoolsByMint: () =>
|
|
137
|
-
getAddLiquidityDiscriminatorBytes: () =>
|
|
138
|
-
getAddLiquidityInstruction: () =>
|
|
139
|
-
getAddLiquidityInstructionAsync: () =>
|
|
140
|
-
getAddLiquidityInstructionDataCodec: () =>
|
|
141
|
-
getAddLiquidityInstructionDataDecoder: () =>
|
|
142
|
-
getAddLiquidityInstructionDataEncoder: () =>
|
|
143
|
-
getAddLiquidityQuote: () =>
|
|
144
|
-
getAddressFromAddressOrSigner: () =>
|
|
145
|
-
getAddressFromRemainingAccount: () =>
|
|
146
|
-
getClosePositionDiscriminatorBytes: () =>
|
|
147
|
-
getClosePositionInstruction: () =>
|
|
148
|
-
getClosePositionInstructionDataCodec: () =>
|
|
149
|
-
getClosePositionInstructionDataDecoder: () =>
|
|
150
|
-
getClosePositionInstructionDataEncoder: () =>
|
|
151
|
-
getCollectFeesDiscriminatorBytes: () =>
|
|
152
|
-
getCollectFeesInstruction: () =>
|
|
153
|
-
getCollectFeesInstructionAsync: () =>
|
|
154
|
-
getCollectFeesInstructionDataCodec: () =>
|
|
155
|
-
getCollectFeesInstructionDataDecoder: () =>
|
|
156
|
-
getCollectFeesInstructionDataEncoder: () =>
|
|
157
|
-
getCollectProtocolFeesDiscriminatorBytes: () =>
|
|
158
|
-
getCollectProtocolFeesInstruction: () =>
|
|
159
|
-
getCollectProtocolFeesInstructionAsync: () =>
|
|
160
|
-
getCollectProtocolFeesInstructionDataCodec: () =>
|
|
161
|
-
getCollectProtocolFeesInstructionDataDecoder: () =>
|
|
162
|
-
getCollectProtocolFeesInstructionDataEncoder: () =>
|
|
163
|
-
getConfigAddress: () =>
|
|
164
|
-
getCreatePositionDiscriminatorBytes: () =>
|
|
165
|
-
getCreatePositionInstruction: () =>
|
|
166
|
-
getCreatePositionInstructionAsync: () =>
|
|
167
|
-
getCreatePositionInstructionDataCodec: () =>
|
|
168
|
-
getCreatePositionInstructionDataDecoder: () =>
|
|
169
|
-
getCreatePositionInstructionDataEncoder: () =>
|
|
129
|
+
fetchOracle: () => chunk7PXLEMBJ_cjs.fetchOracle,
|
|
130
|
+
fetchOraclesBatch: () => chunk7PXLEMBJ_cjs.fetchOraclesBatch,
|
|
131
|
+
fetchPool: () => chunk7PXLEMBJ_cjs.fetchPool,
|
|
132
|
+
fetchPoolPositions: () => chunk7PXLEMBJ_cjs.fetchPoolPositions,
|
|
133
|
+
fetchPoolsBatch: () => chunk7PXLEMBJ_cjs.fetchPoolsBatch,
|
|
134
|
+
fetchPosition: () => chunk7PXLEMBJ_cjs.fetchPosition,
|
|
135
|
+
fetchPositionByParams: () => chunk7PXLEMBJ_cjs.fetchPositionByParams,
|
|
136
|
+
fetchPositionsBatch: () => chunk7PXLEMBJ_cjs.fetchPositionsBatch,
|
|
137
|
+
fetchUserPositions: () => chunk7PXLEMBJ_cjs.fetchUserPositions,
|
|
138
|
+
filterActivePositions: () => chunk7PXLEMBJ_cjs.filterActivePositions,
|
|
139
|
+
filterPoolsByMint: () => chunk7PXLEMBJ_cjs.filterPoolsByMint,
|
|
140
|
+
getAddLiquidityDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getAddLiquidityDiscriminatorBytes,
|
|
141
|
+
getAddLiquidityInstruction: () => chunk7PXLEMBJ_cjs.getAddLiquidityInstruction,
|
|
142
|
+
getAddLiquidityInstructionAsync: () => chunk7PXLEMBJ_cjs.getAddLiquidityInstructionAsync,
|
|
143
|
+
getAddLiquidityInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getAddLiquidityInstructionDataCodec,
|
|
144
|
+
getAddLiquidityInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getAddLiquidityInstructionDataDecoder,
|
|
145
|
+
getAddLiquidityInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getAddLiquidityInstructionDataEncoder,
|
|
146
|
+
getAddLiquidityQuote: () => chunk7PXLEMBJ_cjs.getAddLiquidityQuote,
|
|
147
|
+
getAddressFromAddressOrSigner: () => chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner,
|
|
148
|
+
getAddressFromRemainingAccount: () => chunk7PXLEMBJ_cjs.getAddressFromRemainingAccount,
|
|
149
|
+
getClosePositionDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getClosePositionDiscriminatorBytes,
|
|
150
|
+
getClosePositionInstruction: () => chunk7PXLEMBJ_cjs.getClosePositionInstruction,
|
|
151
|
+
getClosePositionInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getClosePositionInstructionDataCodec,
|
|
152
|
+
getClosePositionInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getClosePositionInstructionDataDecoder,
|
|
153
|
+
getClosePositionInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getClosePositionInstructionDataEncoder,
|
|
154
|
+
getCollectFeesDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getCollectFeesDiscriminatorBytes,
|
|
155
|
+
getCollectFeesInstruction: () => chunk7PXLEMBJ_cjs.getCollectFeesInstruction,
|
|
156
|
+
getCollectFeesInstructionAsync: () => chunk7PXLEMBJ_cjs.getCollectFeesInstructionAsync,
|
|
157
|
+
getCollectFeesInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getCollectFeesInstructionDataCodec,
|
|
158
|
+
getCollectFeesInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getCollectFeesInstructionDataDecoder,
|
|
159
|
+
getCollectFeesInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getCollectFeesInstructionDataEncoder,
|
|
160
|
+
getCollectProtocolFeesDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesDiscriminatorBytes,
|
|
161
|
+
getCollectProtocolFeesInstruction: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesInstruction,
|
|
162
|
+
getCollectProtocolFeesInstructionAsync: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesInstructionAsync,
|
|
163
|
+
getCollectProtocolFeesInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesInstructionDataCodec,
|
|
164
|
+
getCollectProtocolFeesInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesInstructionDataDecoder,
|
|
165
|
+
getCollectProtocolFeesInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getCollectProtocolFeesInstructionDataEncoder,
|
|
166
|
+
getConfigAddress: () => chunk4CI2M2F6_cjs.getConfigAddress,
|
|
167
|
+
getCreatePositionDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getCreatePositionDiscriminatorBytes,
|
|
168
|
+
getCreatePositionInstruction: () => chunk7PXLEMBJ_cjs.getCreatePositionInstruction,
|
|
169
|
+
getCreatePositionInstructionAsync: () => chunk7PXLEMBJ_cjs.getCreatePositionInstructionAsync,
|
|
170
|
+
getCreatePositionInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getCreatePositionInstructionDataCodec,
|
|
171
|
+
getCreatePositionInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getCreatePositionInstructionDataDecoder,
|
|
172
|
+
getCreatePositionInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getCreatePositionInstructionDataEncoder,
|
|
170
173
|
getErrorMessage: () => getErrorMessage,
|
|
171
|
-
getInitializeConfigDiscriminatorBytes: () =>
|
|
172
|
-
getInitializeConfigInstruction: () =>
|
|
173
|
-
getInitializeConfigInstructionAsync: () =>
|
|
174
|
-
getInitializeConfigInstructionDataCodec: () =>
|
|
175
|
-
getInitializeConfigInstructionDataDecoder: () =>
|
|
176
|
-
getInitializeConfigInstructionDataEncoder: () =>
|
|
177
|
-
getInitializeOracleDiscriminatorBytes: () =>
|
|
178
|
-
getInitializeOracleInstruction: () =>
|
|
179
|
-
getInitializeOracleInstructionAsync: () =>
|
|
180
|
-
getInitializeOracleInstructionDataCodec: () =>
|
|
181
|
-
getInitializeOracleInstructionDataDecoder: () =>
|
|
182
|
-
getInitializeOracleInstructionDataEncoder: () =>
|
|
183
|
-
getInitializePoolDiscriminatorBytes: () =>
|
|
184
|
-
getInitializePoolInstruction: () =>
|
|
185
|
-
getInitializePoolInstructionAsync: () =>
|
|
186
|
-
getInitializePoolInstructionDataCodec: () =>
|
|
187
|
-
getInitializePoolInstructionDataDecoder: () =>
|
|
188
|
-
getInitializePoolInstructionDataEncoder: () =>
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
getInitializeConfigDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getInitializeConfigDiscriminatorBytes,
|
|
175
|
+
getInitializeConfigInstruction: () => chunk7PXLEMBJ_cjs.getInitializeConfigInstruction,
|
|
176
|
+
getInitializeConfigInstructionAsync: () => chunk7PXLEMBJ_cjs.getInitializeConfigInstructionAsync,
|
|
177
|
+
getInitializeConfigInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getInitializeConfigInstructionDataCodec,
|
|
178
|
+
getInitializeConfigInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getInitializeConfigInstructionDataDecoder,
|
|
179
|
+
getInitializeConfigInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getInitializeConfigInstructionDataEncoder,
|
|
180
|
+
getInitializeOracleDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getInitializeOracleDiscriminatorBytes,
|
|
181
|
+
getInitializeOracleInstruction: () => chunk7PXLEMBJ_cjs.getInitializeOracleInstruction,
|
|
182
|
+
getInitializeOracleInstructionAsync: () => chunk7PXLEMBJ_cjs.getInitializeOracleInstructionAsync,
|
|
183
|
+
getInitializeOracleInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getInitializeOracleInstructionDataCodec,
|
|
184
|
+
getInitializeOracleInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getInitializeOracleInstructionDataDecoder,
|
|
185
|
+
getInitializeOracleInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getInitializeOracleInstructionDataEncoder,
|
|
186
|
+
getInitializePoolDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getInitializePoolDiscriminatorBytes,
|
|
187
|
+
getInitializePoolInstruction: () => chunk7PXLEMBJ_cjs.getInitializePoolInstruction,
|
|
188
|
+
getInitializePoolInstructionAsync: () => chunk7PXLEMBJ_cjs.getInitializePoolInstructionAsync,
|
|
189
|
+
getInitializePoolInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getInitializePoolInstructionDataCodec,
|
|
190
|
+
getInitializePoolInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getInitializePoolInstructionDataDecoder,
|
|
191
|
+
getInitializePoolInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getInitializePoolInstructionDataEncoder,
|
|
192
|
+
getInitializeSpotPoolDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getInitializeSpotPoolDiscriminatorBytes,
|
|
193
|
+
getInitializeSpotPoolInstruction: () => chunk7PXLEMBJ_cjs.getInitializeSpotPoolInstruction,
|
|
194
|
+
getInitializeSpotPoolInstructionAsync: () => chunk7PXLEMBJ_cjs.getInitializeSpotPoolInstructionAsync,
|
|
195
|
+
getInitializeSpotPoolInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getInitializeSpotPoolInstructionDataCodec,
|
|
196
|
+
getInitializeSpotPoolInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getInitializeSpotPoolInstructionDataDecoder,
|
|
197
|
+
getInitializeSpotPoolInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getInitializeSpotPoolInstructionDataEncoder,
|
|
198
|
+
getK: () => chunk7PXLEMBJ_cjs.getK,
|
|
199
|
+
getLiquidityAddresses: () => chunk4CI2M2F6_cjs.getLiquidityAddresses,
|
|
191
200
|
getMetadataAddress: () => getMetadataAddress,
|
|
192
|
-
getOracleAddress: () =>
|
|
193
|
-
getOracleAddressFromPool: () =>
|
|
194
|
-
getOracleAge: () =>
|
|
195
|
-
getOracleBufferStats: () =>
|
|
196
|
-
getOracleConsultDiscriminatorBytes: () =>
|
|
197
|
-
getOracleConsultInstruction: () =>
|
|
198
|
-
getOracleConsultInstructionAsync: () =>
|
|
199
|
-
getOracleConsultInstructionDataCodec: () =>
|
|
200
|
-
getOracleConsultInstructionDataDecoder: () =>
|
|
201
|
-
getOracleConsultInstructionDataEncoder: () =>
|
|
202
|
-
getOracleDeviation: () =>
|
|
203
|
-
getOracleForPool: () =>
|
|
204
|
-
getOracleSpotPrices: () =>
|
|
205
|
-
getOracleUpdateDiscriminatorBytes: () =>
|
|
206
|
-
getOracleUpdateInstruction: () =>
|
|
207
|
-
getOracleUpdateInstructionAsync: () =>
|
|
208
|
-
getOracleUpdateInstructionDataCodec: () =>
|
|
209
|
-
getOracleUpdateInstructionDataDecoder: () =>
|
|
210
|
-
getOracleUpdateInstructionDataEncoder: () =>
|
|
211
|
-
getPauseDiscriminatorBytes: () =>
|
|
212
|
-
getPauseInstruction: () =>
|
|
213
|
-
getPauseInstructionDataCodec: () =>
|
|
214
|
-
getPauseInstructionDataDecoder: () =>
|
|
215
|
-
getPauseInstructionDataEncoder: () =>
|
|
216
|
-
getPendingFees: () =>
|
|
217
|
-
getPoolAddress: () =>
|
|
218
|
-
getPoolAddressFromMints: () =>
|
|
219
|
-
getPoolAuthorityAddress: () =>
|
|
220
|
-
getPoolByMints: () =>
|
|
221
|
-
getPoolInitAddresses: () =>
|
|
222
|
-
getPoolVault0Address: () =>
|
|
223
|
-
getPoolVault1Address: () =>
|
|
224
|
-
getPositionAddress: () =>
|
|
225
|
-
getPositionAddressFromParams: () =>
|
|
226
|
-
getPositionValue: () =>
|
|
227
|
-
getPreviewSwapExactInDiscriminatorBytes: () =>
|
|
228
|
-
getPreviewSwapExactInInstruction: () =>
|
|
229
|
-
getPreviewSwapExactInInstructionDataCodec: () =>
|
|
230
|
-
getPreviewSwapExactInInstructionDataDecoder: () =>
|
|
231
|
-
getPreviewSwapExactInInstructionDataEncoder: () =>
|
|
232
|
-
getProtocolFeeOwnerAddress: () =>
|
|
233
|
-
getProtocolFeePositionAddress: () =>
|
|
234
|
-
getRedeemProtocolSharesDiscriminatorBytes: () =>
|
|
235
|
-
getRedeemProtocolSharesInstruction: () =>
|
|
236
|
-
getRedeemProtocolSharesInstructionAsync: () =>
|
|
237
|
-
getRedeemProtocolSharesInstructionDataCodec: () =>
|
|
238
|
-
getRedeemProtocolSharesInstructionDataDecoder: () =>
|
|
239
|
-
getRedeemProtocolSharesInstructionDataEncoder: () =>
|
|
240
|
-
getRemoveLiquidityDiscriminatorBytes: () =>
|
|
241
|
-
getRemoveLiquidityInstruction: () =>
|
|
242
|
-
getRemoveLiquidityInstructionAsync: () =>
|
|
243
|
-
getRemoveLiquidityInstructionDataCodec: () =>
|
|
244
|
-
getRemoveLiquidityInstructionDataDecoder: () =>
|
|
245
|
-
getRemoveLiquidityInstructionDataEncoder: () =>
|
|
246
|
-
getRemoveLiquidityQuote: () =>
|
|
247
|
-
getSetFeesDiscriminatorBytes: () =>
|
|
248
|
-
getSetFeesInstruction: () =>
|
|
249
|
-
getSetFeesInstructionDataCodec: () =>
|
|
250
|
-
getSetFeesInstructionDataDecoder: () =>
|
|
251
|
-
getSetFeesInstructionDataEncoder: () =>
|
|
252
|
-
getSetHookDiscriminatorBytes: () =>
|
|
253
|
-
getSetHookInstruction: () =>
|
|
254
|
-
getSetHookInstructionDataCodec: () =>
|
|
255
|
-
getSetHookInstructionDataDecoder: () =>
|
|
256
|
-
getSetHookInstructionDataEncoder: () =>
|
|
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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
201
|
+
getOracleAddress: () => chunk4CI2M2F6_cjs.getOracleAddress,
|
|
202
|
+
getOracleAddressFromPool: () => chunk7PXLEMBJ_cjs.getOracleAddressFromPool,
|
|
203
|
+
getOracleAge: () => chunk7PXLEMBJ_cjs.getOracleAge,
|
|
204
|
+
getOracleBufferStats: () => chunk7PXLEMBJ_cjs.getOracleBufferStats,
|
|
205
|
+
getOracleConsultDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getOracleConsultDiscriminatorBytes,
|
|
206
|
+
getOracleConsultInstruction: () => chunk7PXLEMBJ_cjs.getOracleConsultInstruction,
|
|
207
|
+
getOracleConsultInstructionAsync: () => chunk7PXLEMBJ_cjs.getOracleConsultInstructionAsync,
|
|
208
|
+
getOracleConsultInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getOracleConsultInstructionDataCodec,
|
|
209
|
+
getOracleConsultInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getOracleConsultInstructionDataDecoder,
|
|
210
|
+
getOracleConsultInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getOracleConsultInstructionDataEncoder,
|
|
211
|
+
getOracleDeviation: () => chunk7PXLEMBJ_cjs.getOracleDeviation,
|
|
212
|
+
getOracleForPool: () => chunk7PXLEMBJ_cjs.getOracleForPool,
|
|
213
|
+
getOracleSpotPrices: () => chunk7PXLEMBJ_cjs.getOracleSpotPrices,
|
|
214
|
+
getOracleUpdateDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getOracleUpdateDiscriminatorBytes,
|
|
215
|
+
getOracleUpdateInstruction: () => chunk7PXLEMBJ_cjs.getOracleUpdateInstruction,
|
|
216
|
+
getOracleUpdateInstructionAsync: () => chunk7PXLEMBJ_cjs.getOracleUpdateInstructionAsync,
|
|
217
|
+
getOracleUpdateInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getOracleUpdateInstructionDataCodec,
|
|
218
|
+
getOracleUpdateInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getOracleUpdateInstructionDataDecoder,
|
|
219
|
+
getOracleUpdateInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getOracleUpdateInstructionDataEncoder,
|
|
220
|
+
getPauseDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getPauseDiscriminatorBytes,
|
|
221
|
+
getPauseInstruction: () => chunk7PXLEMBJ_cjs.getPauseInstruction,
|
|
222
|
+
getPauseInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getPauseInstructionDataCodec,
|
|
223
|
+
getPauseInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getPauseInstructionDataDecoder,
|
|
224
|
+
getPauseInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getPauseInstructionDataEncoder,
|
|
225
|
+
getPendingFees: () => chunk7PXLEMBJ_cjs.getPendingFees,
|
|
226
|
+
getPoolAddress: () => chunk4CI2M2F6_cjs.getPoolAddress,
|
|
227
|
+
getPoolAddressFromMints: () => chunk7PXLEMBJ_cjs.getPoolAddressFromMints,
|
|
228
|
+
getPoolAuthorityAddress: () => chunk4CI2M2F6_cjs.getPoolAuthorityAddress,
|
|
229
|
+
getPoolByMints: () => chunk7PXLEMBJ_cjs.getPoolByMints,
|
|
230
|
+
getPoolInitAddresses: () => chunk4CI2M2F6_cjs.getPoolInitAddresses,
|
|
231
|
+
getPoolVault0Address: () => chunk4CI2M2F6_cjs.getPoolVault0Address,
|
|
232
|
+
getPoolVault1Address: () => chunk4CI2M2F6_cjs.getPoolVault1Address,
|
|
233
|
+
getPositionAddress: () => chunk4CI2M2F6_cjs.getPositionAddress,
|
|
234
|
+
getPositionAddressFromParams: () => chunk7PXLEMBJ_cjs.getPositionAddressFromParams,
|
|
235
|
+
getPositionValue: () => chunk7PXLEMBJ_cjs.getPositionValue,
|
|
236
|
+
getPreviewSwapExactInDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getPreviewSwapExactInDiscriminatorBytes,
|
|
237
|
+
getPreviewSwapExactInInstruction: () => chunk7PXLEMBJ_cjs.getPreviewSwapExactInInstruction,
|
|
238
|
+
getPreviewSwapExactInInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getPreviewSwapExactInInstructionDataCodec,
|
|
239
|
+
getPreviewSwapExactInInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getPreviewSwapExactInInstructionDataDecoder,
|
|
240
|
+
getPreviewSwapExactInInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getPreviewSwapExactInInstructionDataEncoder,
|
|
241
|
+
getProtocolFeeOwnerAddress: () => chunk4CI2M2F6_cjs.getProtocolFeeOwnerAddress,
|
|
242
|
+
getProtocolFeePositionAddress: () => chunk4CI2M2F6_cjs.getProtocolFeePositionAddress,
|
|
243
|
+
getRedeemProtocolSharesDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getRedeemProtocolSharesDiscriminatorBytes,
|
|
244
|
+
getRedeemProtocolSharesInstruction: () => chunk7PXLEMBJ_cjs.getRedeemProtocolSharesInstruction,
|
|
245
|
+
getRedeemProtocolSharesInstructionAsync: () => chunk7PXLEMBJ_cjs.getRedeemProtocolSharesInstructionAsync,
|
|
246
|
+
getRedeemProtocolSharesInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getRedeemProtocolSharesInstructionDataCodec,
|
|
247
|
+
getRedeemProtocolSharesInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getRedeemProtocolSharesInstructionDataDecoder,
|
|
248
|
+
getRedeemProtocolSharesInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getRedeemProtocolSharesInstructionDataEncoder,
|
|
249
|
+
getRemoveLiquidityDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityDiscriminatorBytes,
|
|
250
|
+
getRemoveLiquidityInstruction: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityInstruction,
|
|
251
|
+
getRemoveLiquidityInstructionAsync: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityInstructionAsync,
|
|
252
|
+
getRemoveLiquidityInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityInstructionDataCodec,
|
|
253
|
+
getRemoveLiquidityInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityInstructionDataDecoder,
|
|
254
|
+
getRemoveLiquidityInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityInstructionDataEncoder,
|
|
255
|
+
getRemoveLiquidityQuote: () => chunk7PXLEMBJ_cjs.getRemoveLiquidityQuote,
|
|
256
|
+
getSetFeesDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getSetFeesDiscriminatorBytes,
|
|
257
|
+
getSetFeesInstruction: () => chunk7PXLEMBJ_cjs.getSetFeesInstruction,
|
|
258
|
+
getSetFeesInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getSetFeesInstructionDataCodec,
|
|
259
|
+
getSetFeesInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getSetFeesInstructionDataDecoder,
|
|
260
|
+
getSetFeesInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getSetFeesInstructionDataEncoder,
|
|
261
|
+
getSetHookDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getSetHookDiscriminatorBytes,
|
|
262
|
+
getSetHookInstruction: () => chunk7PXLEMBJ_cjs.getSetHookInstruction,
|
|
263
|
+
getSetHookInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getSetHookInstructionDataCodec,
|
|
264
|
+
getSetHookInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getSetHookInstructionDataDecoder,
|
|
265
|
+
getSetHookInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getSetHookInstructionDataEncoder,
|
|
266
|
+
getSpotPoolAddress: () => chunk4CI2M2F6_cjs.getSpotPoolAddress,
|
|
267
|
+
getSpotPrice0: () => chunk7PXLEMBJ_cjs.getSpotPrice0,
|
|
268
|
+
getSpotPrice1: () => chunk7PXLEMBJ_cjs.getSpotPrice1,
|
|
269
|
+
getSwapAddresses: () => chunk4CI2M2F6_cjs.getSwapAddresses,
|
|
270
|
+
getSwapExactInDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getSwapExactInDiscriminatorBytes,
|
|
271
|
+
getSwapExactInInstruction: () => chunk7PXLEMBJ_cjs.getSwapExactInInstruction,
|
|
272
|
+
getSwapExactInInstructionAsync: () => chunk7PXLEMBJ_cjs.getSwapExactInInstructionAsync,
|
|
273
|
+
getSwapExactInInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getSwapExactInInstructionDataCodec,
|
|
274
|
+
getSwapExactInInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getSwapExactInInstructionDataDecoder,
|
|
275
|
+
getSwapExactInInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getSwapExactInInstructionDataEncoder,
|
|
276
|
+
getSwapQuote: () => chunk7PXLEMBJ_cjs.getSwapQuote,
|
|
277
|
+
getSwapQuoteExactOut: () => chunk7PXLEMBJ_cjs.getSwapQuoteExactOut,
|
|
278
|
+
getTransferAdminDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getTransferAdminDiscriminatorBytes,
|
|
279
|
+
getTransferAdminInstruction: () => chunk7PXLEMBJ_cjs.getTransferAdminInstruction,
|
|
280
|
+
getTransferAdminInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getTransferAdminInstructionDataCodec,
|
|
281
|
+
getTransferAdminInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getTransferAdminInstructionDataDecoder,
|
|
282
|
+
getTransferAdminInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getTransferAdminInstructionDataEncoder,
|
|
283
|
+
getTvl: () => chunk7PXLEMBJ_cjs.getTvl,
|
|
284
|
+
getUnpauseDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getUnpauseDiscriminatorBytes,
|
|
285
|
+
getUnpauseInstruction: () => chunk7PXLEMBJ_cjs.getUnpauseInstruction,
|
|
286
|
+
getUnpauseInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getUnpauseInstructionDataCodec,
|
|
287
|
+
getUnpauseInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getUnpauseInstructionDataDecoder,
|
|
288
|
+
getUnpauseInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getUnpauseInstructionDataEncoder,
|
|
289
|
+
getUpdateConfigDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getUpdateConfigDiscriminatorBytes,
|
|
290
|
+
getUpdateConfigInstruction: () => chunk7PXLEMBJ_cjs.getUpdateConfigInstruction,
|
|
291
|
+
getUpdateConfigInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getUpdateConfigInstructionDataCodec,
|
|
292
|
+
getUpdateConfigInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getUpdateConfigInstructionDataDecoder,
|
|
293
|
+
getUpdateConfigInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getUpdateConfigInstructionDataEncoder,
|
|
294
|
+
getWithdrawVaultExcessDiscriminatorBytes: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessDiscriminatorBytes,
|
|
295
|
+
getWithdrawVaultExcessInstruction: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstruction,
|
|
296
|
+
getWithdrawVaultExcessInstructionAsync: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstructionAsync,
|
|
297
|
+
getWithdrawVaultExcessInstructionDataCodec: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstructionDataCodec,
|
|
298
|
+
getWithdrawVaultExcessInstructionDataDecoder: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstructionDataDecoder,
|
|
299
|
+
getWithdrawVaultExcessInstructionDataEncoder: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstructionDataEncoder,
|
|
300
|
+
initializeConfigArgsCodec: () => chunk7PXLEMBJ_cjs.initializeConfigArgsCodec,
|
|
301
|
+
initializeOracleArgsCodec: () => chunk7PXLEMBJ_cjs.initializeOracleArgsCodec,
|
|
302
|
+
initializePoolArgsCodec: () => chunk7PXLEMBJ_cjs.initializePoolArgsCodec,
|
|
293
303
|
isCpmmError: () => isCpmmError,
|
|
294
|
-
isOracleStale: () =>
|
|
295
|
-
isTransactionSigner: () =>
|
|
296
|
-
isqrt: () =>
|
|
304
|
+
isOracleStale: () => chunk7PXLEMBJ_cjs.isOracleStale,
|
|
305
|
+
isTransactionSigner: () => chunk7PXLEMBJ_cjs.isTransactionSigner,
|
|
306
|
+
isqrt: () => chunk7PXLEMBJ_cjs.isqrt,
|
|
297
307
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
298
308
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
299
309
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
300
|
-
maxBigInt: () =>
|
|
301
|
-
minBigInt: () =>
|
|
302
|
-
normalizeProgramAccountsResponse: () =>
|
|
303
|
-
numberToQ64: () =>
|
|
304
|
-
observationCodec: () =>
|
|
305
|
-
oracleConsultArgsCodec: () =>
|
|
306
|
-
oracleStateDataCodec: () =>
|
|
307
|
-
parseAddLiquidityInstruction: () =>
|
|
308
|
-
parseClosePositionInstruction: () =>
|
|
309
|
-
parseCollectFeesInstruction: () =>
|
|
310
|
-
parseCollectProtocolFeesInstruction: () =>
|
|
311
|
-
parseCreatePositionInstruction: () =>
|
|
310
|
+
maxBigInt: () => chunk7PXLEMBJ_cjs.maxBigInt,
|
|
311
|
+
minBigInt: () => chunk7PXLEMBJ_cjs.minBigInt,
|
|
312
|
+
normalizeProgramAccountsResponse: () => chunk7PXLEMBJ_cjs.normalizeProgramAccountsResponse,
|
|
313
|
+
numberToQ64: () => chunk7PXLEMBJ_cjs.numberToQ64,
|
|
314
|
+
observationCodec: () => chunk7PXLEMBJ_cjs.observationCodec,
|
|
315
|
+
oracleConsultArgsCodec: () => chunk7PXLEMBJ_cjs.oracleConsultArgsCodec,
|
|
316
|
+
oracleStateDataCodec: () => chunk7PXLEMBJ_cjs.oracleStateDataCodec,
|
|
317
|
+
parseAddLiquidityInstruction: () => chunk7PXLEMBJ_cjs.parseAddLiquidityInstruction,
|
|
318
|
+
parseClosePositionInstruction: () => chunk7PXLEMBJ_cjs.parseClosePositionInstruction,
|
|
319
|
+
parseCollectFeesInstruction: () => chunk7PXLEMBJ_cjs.parseCollectFeesInstruction,
|
|
320
|
+
parseCollectProtocolFeesInstruction: () => chunk7PXLEMBJ_cjs.parseCollectProtocolFeesInstruction,
|
|
321
|
+
parseCreatePositionInstruction: () => chunk7PXLEMBJ_cjs.parseCreatePositionInstruction,
|
|
312
322
|
parseErrorFromLogs: () => parseErrorFromLogs,
|
|
313
|
-
parseInitializeConfigInstruction: () =>
|
|
314
|
-
parseInitializeOracleInstruction: () =>
|
|
315
|
-
parseInitializePoolInstruction: () =>
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
323
|
+
parseInitializeConfigInstruction: () => chunk7PXLEMBJ_cjs.parseInitializeConfigInstruction,
|
|
324
|
+
parseInitializeOracleInstruction: () => chunk7PXLEMBJ_cjs.parseInitializeOracleInstruction,
|
|
325
|
+
parseInitializePoolInstruction: () => chunk7PXLEMBJ_cjs.parseInitializePoolInstruction,
|
|
326
|
+
parseInitializeSpotPoolInstruction: () => chunk7PXLEMBJ_cjs.parseInitializeSpotPoolInstruction,
|
|
327
|
+
parseOracleConsultInstruction: () => chunk7PXLEMBJ_cjs.parseOracleConsultInstruction,
|
|
328
|
+
parseOracleUpdateInstruction: () => chunk7PXLEMBJ_cjs.parseOracleUpdateInstruction,
|
|
329
|
+
parsePauseInstruction: () => chunk7PXLEMBJ_cjs.parsePauseInstruction,
|
|
330
|
+
parsePreviewSwapExactInInstruction: () => chunk7PXLEMBJ_cjs.parsePreviewSwapExactInInstruction,
|
|
331
|
+
parseRedeemProtocolSharesInstruction: () => chunk7PXLEMBJ_cjs.parseRedeemProtocolSharesInstruction,
|
|
332
|
+
parseRemoveLiquidityInstruction: () => chunk7PXLEMBJ_cjs.parseRemoveLiquidityInstruction,
|
|
333
|
+
parseSetFeesInstruction: () => chunk7PXLEMBJ_cjs.parseSetFeesInstruction,
|
|
334
|
+
parseSetHookInstruction: () => chunk7PXLEMBJ_cjs.parseSetHookInstruction,
|
|
335
|
+
parseSwapExactInInstruction: () => chunk7PXLEMBJ_cjs.parseSwapExactInInstruction,
|
|
336
|
+
parseTransferAdminInstruction: () => chunk7PXLEMBJ_cjs.parseTransferAdminInstruction,
|
|
337
|
+
parseUnpauseInstruction: () => chunk7PXLEMBJ_cjs.parseUnpauseInstruction,
|
|
338
|
+
parseUpdateConfigInstruction: () => chunk7PXLEMBJ_cjs.parseUpdateConfigInstruction,
|
|
339
|
+
parseWithdrawVaultExcessInstruction: () => chunk7PXLEMBJ_cjs.parseWithdrawVaultExcessInstruction,
|
|
340
|
+
poolDataCodec: () => chunk7PXLEMBJ_cjs.poolDataCodec,
|
|
341
|
+
poolExists: () => chunk7PXLEMBJ_cjs.poolExists,
|
|
342
|
+
positionDataCodec: () => chunk7PXLEMBJ_cjs.positionDataCodec,
|
|
343
|
+
q64Div: () => chunk7PXLEMBJ_cjs.q64Div,
|
|
344
|
+
q64Mul: () => chunk7PXLEMBJ_cjs.q64Mul,
|
|
345
|
+
q64ToNumber: () => chunk7PXLEMBJ_cjs.q64ToNumber,
|
|
346
|
+
ratioToNumber: () => chunk7PXLEMBJ_cjs.ratioToNumber,
|
|
347
|
+
removeLiquidityArgsCodec: () => chunk7PXLEMBJ_cjs.removeLiquidityArgsCodec,
|
|
348
|
+
setFeesArgsCodec: () => chunk7PXLEMBJ_cjs.setFeesArgsCodec,
|
|
349
|
+
setHookArgsCodec: () => chunk7PXLEMBJ_cjs.setHookArgsCodec,
|
|
350
|
+
sortMints: () => chunk4CI2M2F6_cjs.sortMints,
|
|
351
|
+
sortPoolsByReserves: () => chunk7PXLEMBJ_cjs.sortPoolsByReserves,
|
|
352
|
+
sortPositionsByShares: () => chunk7PXLEMBJ_cjs.sortPositionsByShares,
|
|
353
|
+
swapExactInArgsCodec: () => chunk7PXLEMBJ_cjs.swapExactInArgsCodec,
|
|
354
|
+
transferAdminArgsCodec: () => chunk7PXLEMBJ_cjs.transferAdminArgsCodec,
|
|
344
355
|
validateMarketCapParameters: () => validateMarketCapParameters,
|
|
345
|
-
warnAccountDecodeFailure: () =>
|
|
356
|
+
warnAccountDecodeFailure: () => chunk7PXLEMBJ_cjs.warnAccountDecodeFailure
|
|
346
357
|
});
|
|
347
358
|
var addressCodec = kit.getAddressCodec();
|
|
348
359
|
var textEncoder = new TextEncoder();
|
|
349
360
|
async function getMetadataAddress(mint) {
|
|
350
361
|
return kit.getProgramDerivedAddress({
|
|
351
|
-
programAddress:
|
|
362
|
+
programAddress: chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
352
363
|
seeds: [
|
|
353
364
|
textEncoder.encode("metadata"),
|
|
354
|
-
addressCodec.encode(
|
|
365
|
+
addressCodec.encode(chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
355
366
|
addressCodec.encode(mint)
|
|
356
367
|
]
|
|
357
368
|
});
|
|
@@ -664,12 +675,12 @@ function createSwapInstruction(params) {
|
|
|
664
675
|
token0Program,
|
|
665
676
|
token1Program,
|
|
666
677
|
tokenProgram,
|
|
667
|
-
programId =
|
|
678
|
+
programId = chunk7PXLEMBJ_cjs.CPMM_PROGRAM_ADDRESS
|
|
668
679
|
} = params;
|
|
669
680
|
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
670
681
|
const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
671
682
|
const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
672
|
-
const instruction =
|
|
683
|
+
const instruction = chunk7PXLEMBJ_cjs.getSwapExactInInstruction(
|
|
673
684
|
{
|
|
674
685
|
config,
|
|
675
686
|
pool,
|
|
@@ -681,8 +692,8 @@ function createSwapInstruction(params) {
|
|
|
681
692
|
userIn,
|
|
682
693
|
userOut,
|
|
683
694
|
trader,
|
|
684
|
-
token0Program: token0Program ?? tokenProgram ??
|
|
685
|
-
token1Program: token1Program ?? tokenProgram ??
|
|
695
|
+
token0Program: token0Program ?? tokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
696
|
+
token1Program: token1Program ?? tokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
686
697
|
oracle,
|
|
687
698
|
amountIn,
|
|
688
699
|
minAmountOut,
|
|
@@ -695,15 +706,15 @@ function createSwapInstruction(params) {
|
|
|
695
706
|
...instruction,
|
|
696
707
|
accounts: [
|
|
697
708
|
...instruction.accounts ?? [],
|
|
698
|
-
...remainingAccounts.map(
|
|
709
|
+
...remainingAccounts.map(chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta)
|
|
699
710
|
]
|
|
700
711
|
};
|
|
701
712
|
}
|
|
702
713
|
var MAX_FEE_AMOUNT = BigInt("18446744073709551615");
|
|
703
714
|
|
|
704
715
|
// src/solana/client/config.ts
|
|
705
|
-
async function fetchConfig(rpc, programId =
|
|
706
|
-
const [configAddress] = await
|
|
716
|
+
async function fetchConfig(rpc, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
717
|
+
const [configAddress] = await chunk4CI2M2F6_cjs.getConfigAddress(programId);
|
|
707
718
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
708
719
|
encoding: "base64",
|
|
709
720
|
commitment
|
|
@@ -711,10 +722,10 @@ async function fetchConfig(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, c
|
|
|
711
722
|
if (!response.value) {
|
|
712
723
|
return null;
|
|
713
724
|
}
|
|
714
|
-
return
|
|
725
|
+
return chunk7PXLEMBJ_cjs.decodeAmmConfig(chunk7PXLEMBJ_cjs.base64ToBytes(response.value.data[0]));
|
|
715
726
|
}
|
|
716
|
-
async function fetchConfigWithAddress(rpc, programId =
|
|
717
|
-
const [configAddress] = await
|
|
727
|
+
async function fetchConfigWithAddress(rpc, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
728
|
+
const [configAddress] = await chunk4CI2M2F6_cjs.getConfigAddress(programId);
|
|
718
729
|
const account = await fetchConfig(rpc, programId, commitment);
|
|
719
730
|
if (!account) {
|
|
720
731
|
return null;
|
|
@@ -722,22 +733,32 @@ async function fetchConfigWithAddress(rpc, programId = chunkU6B52TBT_cjs.CPMM_PR
|
|
|
722
733
|
return { address: configAddress, account };
|
|
723
734
|
}
|
|
724
735
|
|
|
725
|
-
// src/solana/
|
|
726
|
-
var
|
|
727
|
-
chunkQ7SFCCGT_cjs.__export(
|
|
736
|
+
// src/solana/cpmmHook/index.ts
|
|
737
|
+
var cpmmHook_exports = {};
|
|
738
|
+
chunkQ7SFCCGT_cjs.__export(cpmmHook_exports, {
|
|
728
739
|
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR,
|
|
729
740
|
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR,
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
+
CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW: () => CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW,
|
|
742
|
+
CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS: () => CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS,
|
|
743
|
+
CPMM_HOOK_ERROR__COSIGNER_LIST_FULL: () => CPMM_HOOK_ERROR__COSIGNER_LIST_FULL,
|
|
744
|
+
CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND: () => CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND,
|
|
745
|
+
CPMM_HOOK_ERROR__INVALID_AUTHORITY: () => CPMM_HOOK_ERROR__INVALID_AUTHORITY,
|
|
746
|
+
CPMM_HOOK_ERROR__INVALID_CONFIG: () => CPMM_HOOK_ERROR__INVALID_CONFIG,
|
|
747
|
+
CPMM_HOOK_ERROR__INVALID_COSIGNER: () => CPMM_HOOK_ERROR__INVALID_COSIGNER,
|
|
748
|
+
CPMM_HOOK_ERROR__INVALID_DURATION: () => CPMM_HOOK_ERROR__INVALID_DURATION,
|
|
749
|
+
CPMM_HOOK_ERROR__INVALID_FEE: () => CPMM_HOOK_ERROR__INVALID_FEE,
|
|
750
|
+
CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA: () => CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA,
|
|
751
|
+
CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA: () => CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA,
|
|
752
|
+
CPMM_HOOK_PROGRAM_ADDRESS: () => CPMM_HOOK_PROGRAM_ADDRESS,
|
|
753
|
+
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
754
|
+
CpmmHookAccount: () => CpmmHookAccount,
|
|
755
|
+
CpmmHookInstruction: () => CpmmHookInstruction,
|
|
756
|
+
DEVNET_CPMM_HOOK_PROGRAM_ID: () => DEVNET_CPMM_HOOK_PROGRAM_ID,
|
|
757
|
+
DYNAMIC_FEE_SCHEDULE_HEADER_LEN: () => DYNAMIC_FEE_SCHEDULE_HEADER_LEN,
|
|
758
|
+
DYNAMIC_FEE_SCHEDULE_LEN: () => DYNAMIC_FEE_SCHEDULE_LEN,
|
|
759
|
+
DYNAMIC_FEE_SCHEDULE_MAGIC: () => DYNAMIC_FEE_SCHEDULE_MAGIC,
|
|
760
|
+
DYNAMIC_FEE_SCHEDULE_MAX_BPS: () => DYNAMIC_FEE_SCHEDULE_MAX_BPS,
|
|
761
|
+
DYNAMIC_FEE_SCHEDULE_VERSION: () => DYNAMIC_FEE_SCHEDULE_VERSION,
|
|
741
762
|
GATE_EXPIRY_DISABLED: () => GATE_EXPIRY_DISABLED,
|
|
742
763
|
GATE_EXPIRY_HEADER_LEN: () => GATE_EXPIRY_HEADER_LEN,
|
|
743
764
|
GATE_EXPIRY_PAYLOAD_LEN: () => GATE_EXPIRY_PAYLOAD_LEN,
|
|
@@ -747,12 +768,15 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
747
768
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR2,
|
|
748
769
|
MAX_COSIGNERS: () => MAX_COSIGNERS,
|
|
749
770
|
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR,
|
|
750
|
-
|
|
771
|
+
SEED_CPMM_HOOK_CONFIG: () => SEED_CPMM_HOOK_CONFIG,
|
|
751
772
|
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR,
|
|
752
|
-
|
|
773
|
+
cpmmHookProgram: () => cpmmHookProgram,
|
|
753
774
|
decodeCosignerConfig: () => decodeCosignerConfig,
|
|
754
775
|
decodeCosignerGateExpiryPayload: () => decodeCosignerGateExpiryPayload,
|
|
755
776
|
encodeCosignerGateExpiryPayload: () => encodeCosignerGateExpiryPayload,
|
|
777
|
+
encodeCpmmHookPayload: () => encodeCpmmHookPayload,
|
|
778
|
+
encodeDynamicFeeCosignerGatePayload: () => encodeDynamicFeeCosignerGatePayload,
|
|
779
|
+
encodeDynamicFeeSchedule: () => encodeDynamicFeeSchedule,
|
|
756
780
|
fetchAllCosignerConfig: () => fetchAllCosignerConfig,
|
|
757
781
|
fetchAllMaybeCosignerConfig: () => fetchAllMaybeCosignerConfig,
|
|
758
782
|
fetchCosignerConfig: () => fetchCosignerConfig,
|
|
@@ -772,9 +796,10 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
772
796
|
getCosignerConfigEncoder: () => getCosignerConfigEncoder,
|
|
773
797
|
getCosignerConfigSize: () => getCosignerConfigSize,
|
|
774
798
|
getCosignerGateStatus: () => getCosignerGateStatus,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
799
|
+
getCpmmHookConfigAddress: () => getCpmmHookConfigAddress,
|
|
800
|
+
getCpmmHookErrorMessage: () => getCpmmHookErrorMessage,
|
|
801
|
+
getCpmmHookRemainingAccountAddresses: () => getCpmmHookRemainingAccountAddresses,
|
|
802
|
+
getCpmmHookRemainingAccounts: () => getCpmmHookRemainingAccounts,
|
|
778
803
|
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
779
804
|
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
780
805
|
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
@@ -799,15 +824,17 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
799
824
|
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec,
|
|
800
825
|
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder,
|
|
801
826
|
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder,
|
|
802
|
-
|
|
803
|
-
|
|
827
|
+
identifyCpmmHookAccount: () => identifyCpmmHookAccount,
|
|
828
|
+
identifyCpmmHookInstruction: () => identifyCpmmHookInstruction,
|
|
804
829
|
isCosignerGateEnforced: () => isCosignerGateEnforced,
|
|
805
|
-
|
|
830
|
+
isCpmmHookError: () => isCpmmHookError,
|
|
831
|
+
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
806
832
|
parseAddCosignerInstruction: () => parseAddCosignerInstruction,
|
|
807
|
-
|
|
833
|
+
parseCpmmHookInstruction: () => parseCpmmHookInstruction,
|
|
808
834
|
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction2,
|
|
809
835
|
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction,
|
|
810
|
-
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction
|
|
836
|
+
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction,
|
|
837
|
+
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
811
838
|
});
|
|
812
839
|
var COSIGNER_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
813
840
|
133,
|
|
@@ -858,13 +885,13 @@ function decodeCosignerConfig(encodedAccount) {
|
|
|
858
885
|
getCosignerConfigDecoder()
|
|
859
886
|
);
|
|
860
887
|
}
|
|
861
|
-
async function fetchCosignerConfig(rpc,
|
|
862
|
-
const maybeAccount = await fetchMaybeCosignerConfig(rpc,
|
|
888
|
+
async function fetchCosignerConfig(rpc, address6, config) {
|
|
889
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address6, config);
|
|
863
890
|
kit.assertAccountExists(maybeAccount);
|
|
864
891
|
return maybeAccount;
|
|
865
892
|
}
|
|
866
|
-
async function fetchMaybeCosignerConfig(rpc,
|
|
867
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
893
|
+
async function fetchMaybeCosignerConfig(rpc, address6, config) {
|
|
894
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
868
895
|
return decodeCosignerConfig(maybeAccount);
|
|
869
896
|
}
|
|
870
897
|
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
@@ -922,7 +949,7 @@ function getAddCosignerInstructionDataCodec() {
|
|
|
922
949
|
);
|
|
923
950
|
}
|
|
924
951
|
async function getAddCosignerInstructionAsync(input, config) {
|
|
925
|
-
const programAddress = config?.programAddress ??
|
|
952
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
926
953
|
const originalAccounts = {
|
|
927
954
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
928
955
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -973,7 +1000,7 @@ async function getAddCosignerInstructionAsync(input, config) {
|
|
|
973
1000
|
});
|
|
974
1001
|
}
|
|
975
1002
|
function getAddCosignerInstruction(input, config) {
|
|
976
|
-
const programAddress = config?.programAddress ??
|
|
1003
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
977
1004
|
const originalAccounts = {
|
|
978
1005
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
979
1006
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1004,9 +1031,9 @@ function parseAddCosignerInstruction(instruction) {
|
|
|
1004
1031
|
}
|
|
1005
1032
|
let accountIndex = 0;
|
|
1006
1033
|
const getNextAccount = () => {
|
|
1007
|
-
const
|
|
1034
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1008
1035
|
accountIndex += 1;
|
|
1009
|
-
return
|
|
1036
|
+
return accountMeta2;
|
|
1010
1037
|
};
|
|
1011
1038
|
return {
|
|
1012
1039
|
programAddress: instruction.programAddress,
|
|
@@ -1051,7 +1078,7 @@ function getInitializeConfigInstructionDataCodec2() {
|
|
|
1051
1078
|
);
|
|
1052
1079
|
}
|
|
1053
1080
|
async function getInitializeConfigInstructionAsync2(input, config) {
|
|
1054
|
-
const programAddress = config?.programAddress ??
|
|
1081
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1055
1082
|
const originalAccounts = {
|
|
1056
1083
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1057
1084
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1111,7 +1138,7 @@ async function getInitializeConfigInstructionAsync2(input, config) {
|
|
|
1111
1138
|
});
|
|
1112
1139
|
}
|
|
1113
1140
|
function getInitializeConfigInstruction2(input, config) {
|
|
1114
|
-
const programAddress = config?.programAddress ??
|
|
1141
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1115
1142
|
const originalAccounts = {
|
|
1116
1143
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1117
1144
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1151,9 +1178,9 @@ function parseInitializeConfigInstruction2(instruction) {
|
|
|
1151
1178
|
}
|
|
1152
1179
|
let accountIndex = 0;
|
|
1153
1180
|
const getNextAccount = () => {
|
|
1154
|
-
const
|
|
1181
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1155
1182
|
accountIndex += 1;
|
|
1156
|
-
return
|
|
1183
|
+
return accountMeta2;
|
|
1157
1184
|
};
|
|
1158
1185
|
return {
|
|
1159
1186
|
programAddress: instruction.programAddress,
|
|
@@ -1204,7 +1231,7 @@ function getRemoveCosignerInstructionDataCodec() {
|
|
|
1204
1231
|
);
|
|
1205
1232
|
}
|
|
1206
1233
|
async function getRemoveCosignerInstructionAsync(input, config) {
|
|
1207
|
-
const programAddress = config?.programAddress ??
|
|
1234
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1208
1235
|
const originalAccounts = {
|
|
1209
1236
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1210
1237
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1255,7 +1282,7 @@ async function getRemoveCosignerInstructionAsync(input, config) {
|
|
|
1255
1282
|
});
|
|
1256
1283
|
}
|
|
1257
1284
|
function getRemoveCosignerInstruction(input, config) {
|
|
1258
|
-
const programAddress = config?.programAddress ??
|
|
1285
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1259
1286
|
const originalAccounts = {
|
|
1260
1287
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1261
1288
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1286,9 +1313,9 @@ function parseRemoveCosignerInstruction(instruction) {
|
|
|
1286
1313
|
}
|
|
1287
1314
|
let accountIndex = 0;
|
|
1288
1315
|
const getNextAccount = () => {
|
|
1289
|
-
const
|
|
1316
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1290
1317
|
accountIndex += 1;
|
|
1291
|
-
return
|
|
1318
|
+
return accountMeta2;
|
|
1292
1319
|
};
|
|
1293
1320
|
return {
|
|
1294
1321
|
programAddress: instruction.programAddress,
|
|
@@ -1333,7 +1360,7 @@ function getSetAuthorityInstructionDataCodec() {
|
|
|
1333
1360
|
);
|
|
1334
1361
|
}
|
|
1335
1362
|
async function getSetAuthorityInstructionAsync(input, config) {
|
|
1336
|
-
const programAddress = config?.programAddress ??
|
|
1363
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1337
1364
|
const originalAccounts = {
|
|
1338
1365
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1339
1366
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1384,7 +1411,7 @@ async function getSetAuthorityInstructionAsync(input, config) {
|
|
|
1384
1411
|
});
|
|
1385
1412
|
}
|
|
1386
1413
|
function getSetAuthorityInstruction(input, config) {
|
|
1387
|
-
const programAddress = config?.programAddress ??
|
|
1414
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1388
1415
|
const originalAccounts = {
|
|
1389
1416
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1390
1417
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1415,9 +1442,9 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1415
1442
|
}
|
|
1416
1443
|
let accountIndex = 0;
|
|
1417
1444
|
const getNextAccount = () => {
|
|
1418
|
-
const
|
|
1445
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1419
1446
|
accountIndex += 1;
|
|
1420
|
-
return
|
|
1447
|
+
return accountMeta2;
|
|
1421
1448
|
};
|
|
1422
1449
|
return {
|
|
1423
1450
|
programAddress: instruction.programAddress,
|
|
@@ -1426,13 +1453,13 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1426
1453
|
};
|
|
1427
1454
|
}
|
|
1428
1455
|
|
|
1429
|
-
// src/solana/generated/
|
|
1430
|
-
var
|
|
1431
|
-
var
|
|
1432
|
-
|
|
1433
|
-
return
|
|
1434
|
-
})(
|
|
1435
|
-
function
|
|
1456
|
+
// src/solana/generated/cpmmHook/programs/cpmmHook.ts
|
|
1457
|
+
var CPMM_HOOK_PROGRAM_ADDRESS = "HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i";
|
|
1458
|
+
var CpmmHookAccount = /* @__PURE__ */ ((CpmmHookAccount2) => {
|
|
1459
|
+
CpmmHookAccount2[CpmmHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
1460
|
+
return CpmmHookAccount2;
|
|
1461
|
+
})(CpmmHookAccount || {});
|
|
1462
|
+
function identifyCpmmHookAccount(account) {
|
|
1436
1463
|
const data = "data" in account ? account.data : account;
|
|
1437
1464
|
if (kit.containsBytes(
|
|
1438
1465
|
data,
|
|
@@ -1445,17 +1472,17 @@ function identifyCosignerHookAccount(account) {
|
|
|
1445
1472
|
}
|
|
1446
1473
|
throw new kit.SolanaError(
|
|
1447
1474
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
1448
|
-
{ accountData: data, programName: "
|
|
1475
|
+
{ accountData: data, programName: "cpmmHook" }
|
|
1449
1476
|
);
|
|
1450
1477
|
}
|
|
1451
|
-
var
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
return
|
|
1457
|
-
})(
|
|
1458
|
-
function
|
|
1478
|
+
var CpmmHookInstruction = /* @__PURE__ */ ((CpmmHookInstruction2) => {
|
|
1479
|
+
CpmmHookInstruction2[CpmmHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
1480
|
+
CpmmHookInstruction2[CpmmHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
1481
|
+
CpmmHookInstruction2[CpmmHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
1482
|
+
CpmmHookInstruction2[CpmmHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
1483
|
+
return CpmmHookInstruction2;
|
|
1484
|
+
})(CpmmHookInstruction || {});
|
|
1485
|
+
function identifyCpmmHookInstruction(instruction) {
|
|
1459
1486
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
1460
1487
|
if (kit.containsBytes(
|
|
1461
1488
|
data,
|
|
@@ -1495,11 +1522,11 @@ function identifyCosignerHookInstruction(instruction) {
|
|
|
1495
1522
|
}
|
|
1496
1523
|
throw new kit.SolanaError(
|
|
1497
1524
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
1498
|
-
{ instructionData: data, programName: "
|
|
1525
|
+
{ instructionData: data, programName: "cpmmHook" }
|
|
1499
1526
|
);
|
|
1500
1527
|
}
|
|
1501
|
-
function
|
|
1502
|
-
const instructionType =
|
|
1528
|
+
function parseCpmmHookInstruction(instruction) {
|
|
1529
|
+
const instructionType = identifyCpmmHookInstruction(instruction);
|
|
1503
1530
|
switch (instructionType) {
|
|
1504
1531
|
case 0 /* AddCosigner */: {
|
|
1505
1532
|
kit.assertIsInstructionWithAccounts(instruction);
|
|
@@ -1532,18 +1559,15 @@ function parseCosignerHookInstruction(instruction) {
|
|
|
1532
1559
|
default:
|
|
1533
1560
|
throw new kit.SolanaError(
|
|
1534
1561
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
1535
|
-
{
|
|
1536
|
-
instructionType,
|
|
1537
|
-
programName: "cosignerHook"
|
|
1538
|
-
}
|
|
1562
|
+
{ instructionType, programName: "cpmmHook" }
|
|
1539
1563
|
);
|
|
1540
1564
|
}
|
|
1541
1565
|
}
|
|
1542
|
-
function
|
|
1566
|
+
function cpmmHookProgram() {
|
|
1543
1567
|
return (client) => {
|
|
1544
1568
|
return {
|
|
1545
1569
|
...client,
|
|
1546
|
-
|
|
1570
|
+
cpmmHook: {
|
|
1547
1571
|
accounts: {
|
|
1548
1572
|
cosignerConfig: programClientCore.addSelfFetchFunctions(
|
|
1549
1573
|
client,
|
|
@@ -1576,35 +1600,45 @@ function cosignerHookProgram() {
|
|
|
1576
1600
|
};
|
|
1577
1601
|
}
|
|
1578
1602
|
|
|
1579
|
-
// src/solana/generated/
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1583
|
-
var
|
|
1584
|
-
var
|
|
1585
|
-
var
|
|
1586
|
-
var
|
|
1603
|
+
// src/solana/generated/cpmmHook/errors/cpmmHook.ts
|
|
1604
|
+
var CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA = 6e3;
|
|
1605
|
+
var CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA = 6001;
|
|
1606
|
+
var CPMM_HOOK_ERROR__INVALID_FEE = 6002;
|
|
1607
|
+
var CPMM_HOOK_ERROR__INVALID_DURATION = 6003;
|
|
1608
|
+
var CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW = 6004;
|
|
1609
|
+
var CPMM_HOOK_ERROR__INVALID_AUTHORITY = 6005;
|
|
1610
|
+
var CPMM_HOOK_ERROR__INVALID_CONFIG = 6006;
|
|
1611
|
+
var CPMM_HOOK_ERROR__INVALID_COSIGNER = 6007;
|
|
1612
|
+
var CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6008;
|
|
1613
|
+
var CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND = 6009;
|
|
1614
|
+
var CPMM_HOOK_ERROR__COSIGNER_LIST_FULL = 6010;
|
|
1615
|
+
var cpmmHookErrorMessages;
|
|
1587
1616
|
if (process.env.NODE_ENV !== "production") {
|
|
1588
|
-
|
|
1589
|
-
[
|
|
1590
|
-
[
|
|
1591
|
-
[
|
|
1592
|
-
[
|
|
1593
|
-
[
|
|
1594
|
-
[
|
|
1617
|
+
cpmmHookErrorMessages = {
|
|
1618
|
+
[CPMM_HOOK_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
1619
|
+
[CPMM_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
1620
|
+
[CPMM_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
1621
|
+
[CPMM_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
1622
|
+
[CPMM_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
|
|
1623
|
+
[CPMM_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
1624
|
+
[CPMM_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`,
|
|
1625
|
+
[CPMM_HOOK_ERROR__INVALID_DURATION]: `Invalid fee duration`,
|
|
1626
|
+
[CPMM_HOOK_ERROR__INVALID_FEE]: `Invalid fee`,
|
|
1627
|
+
[CPMM_HOOK_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
|
|
1628
|
+
[CPMM_HOOK_ERROR__INVALID_SCHEDULE_DATA]: `Invalid schedule payload`
|
|
1595
1629
|
};
|
|
1596
1630
|
}
|
|
1597
|
-
function
|
|
1631
|
+
function getCpmmHookErrorMessage(code) {
|
|
1598
1632
|
if (process.env.NODE_ENV !== "production") {
|
|
1599
|
-
return
|
|
1633
|
+
return cpmmHookErrorMessages[code];
|
|
1600
1634
|
}
|
|
1601
1635
|
return "Error message not available in production bundles.";
|
|
1602
1636
|
}
|
|
1603
|
-
function
|
|
1637
|
+
function isCpmmHookError(error, transactionMessage, code) {
|
|
1604
1638
|
return kit.isProgramError(
|
|
1605
1639
|
error,
|
|
1606
1640
|
transactionMessage,
|
|
1607
|
-
|
|
1641
|
+
CPMM_HOOK_PROGRAM_ADDRESS,
|
|
1608
1642
|
code
|
|
1609
1643
|
);
|
|
1610
1644
|
}
|
|
@@ -1645,11 +1679,11 @@ function getSetAuthorityArgsCodec() {
|
|
|
1645
1679
|
getSetAuthorityArgsDecoder()
|
|
1646
1680
|
);
|
|
1647
1681
|
}
|
|
1648
|
-
var
|
|
1649
|
-
"
|
|
1682
|
+
var DEVNET_CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
1683
|
+
"HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i"
|
|
1650
1684
|
);
|
|
1651
|
-
var
|
|
1652
|
-
var
|
|
1685
|
+
var CPMM_HOOK_PROGRAM_ID = DEVNET_CPMM_HOOK_PROGRAM_ID;
|
|
1686
|
+
var SEED_CPMM_HOOK_CONFIG = "cosigner_hook_config";
|
|
1653
1687
|
var MAX_COSIGNERS = 32;
|
|
1654
1688
|
var GATE_EXPIRY_DISABLED = 0;
|
|
1655
1689
|
var GATE_EXPIRY_UNIX_TIMESTAMP = 1;
|
|
@@ -1657,15 +1691,146 @@ var GATE_EXPIRY_SLOT = 2;
|
|
|
1657
1691
|
var GATE_EXPIRY_PAYLOAD_VERSION = 1;
|
|
1658
1692
|
var GATE_EXPIRY_HEADER_LEN = 10;
|
|
1659
1693
|
var GATE_EXPIRY_PAYLOAD_LEN = 42;
|
|
1694
|
+
var DYNAMIC_FEE_SCHEDULE_MAGIC = new Uint8Array([
|
|
1695
|
+
68,
|
|
1696
|
+
70,
|
|
1697
|
+
69,
|
|
1698
|
+
69,
|
|
1699
|
+
86,
|
|
1700
|
+
49,
|
|
1701
|
+
95,
|
|
1702
|
+
95
|
|
1703
|
+
]);
|
|
1704
|
+
var DYNAMIC_FEE_SCHEDULE_VERSION = 1;
|
|
1705
|
+
var DYNAMIC_FEE_SCHEDULE_LEN = 32;
|
|
1706
|
+
var DYNAMIC_FEE_SCHEDULE_HEADER_LEN = 16;
|
|
1707
|
+
var DYNAMIC_FEE_SCHEDULE_MAX_BPS = 1e4;
|
|
1708
|
+
var MAX_U64 = (1n << 64n) - 1n;
|
|
1709
|
+
function toBigInt(value) {
|
|
1710
|
+
return typeof value === "bigint" ? value : BigInt(value);
|
|
1711
|
+
}
|
|
1712
|
+
function isValidExpiryMode(mode) {
|
|
1713
|
+
return mode === GATE_EXPIRY_UNIX_TIMESTAMP || mode === GATE_EXPIRY_SLOT;
|
|
1714
|
+
}
|
|
1715
|
+
function readU64Le(bytes, offset) {
|
|
1716
|
+
let value = 0n;
|
|
1717
|
+
for (let i = 0; i < 8; i++) {
|
|
1718
|
+
value |= BigInt(bytes[offset + i] ?? 0) << BigInt(i * 8);
|
|
1719
|
+
}
|
|
1720
|
+
return value;
|
|
1721
|
+
}
|
|
1722
|
+
function writeU64Le(bytes, offset, value) {
|
|
1723
|
+
for (let i = 0; i < 8; i++) {
|
|
1724
|
+
bytes[offset + i] = Number(value >> BigInt(i * 8) & 0xffn);
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
function encodeCosignerGateExpiryPayload(expiry) {
|
|
1728
|
+
if (expiry.mode === GATE_EXPIRY_DISABLED) {
|
|
1729
|
+
if (expiry.cosigner !== void 0) {
|
|
1730
|
+
throw new Error("Cosigner hint cannot be encoded for disabled gates");
|
|
1731
|
+
}
|
|
1732
|
+
return new Uint8Array();
|
|
1733
|
+
}
|
|
1734
|
+
if (!isValidExpiryMode(expiry.mode)) {
|
|
1735
|
+
throw new Error(`Invalid cosigner gate expiry mode: ${expiry.mode}`);
|
|
1736
|
+
}
|
|
1737
|
+
const value = toBigInt(expiry.value);
|
|
1738
|
+
if (value < 0n || value > MAX_U64) {
|
|
1739
|
+
throw new Error(`Invalid cosigner gate expiry value: ${expiry.value}`);
|
|
1740
|
+
}
|
|
1741
|
+
if (expiry.cosigner === void 0) {
|
|
1742
|
+
throw new Error("Cosigner hint is required for expiring gates");
|
|
1743
|
+
}
|
|
1744
|
+
const payload = new Uint8Array(GATE_EXPIRY_PAYLOAD_LEN);
|
|
1745
|
+
payload[0] = GATE_EXPIRY_PAYLOAD_VERSION;
|
|
1746
|
+
payload[1] = expiry.mode;
|
|
1747
|
+
writeU64Le(payload, 2, value);
|
|
1748
|
+
payload.set(
|
|
1749
|
+
kit.getAddressEncoder().encode(expiry.cosigner),
|
|
1750
|
+
GATE_EXPIRY_HEADER_LEN
|
|
1751
|
+
);
|
|
1752
|
+
return payload;
|
|
1753
|
+
}
|
|
1754
|
+
function decodeCosignerGateExpiryPayload(payload) {
|
|
1755
|
+
if (!payload || payload.length === 0) {
|
|
1756
|
+
return { mode: GATE_EXPIRY_DISABLED, value: 0n };
|
|
1757
|
+
}
|
|
1758
|
+
if (payload.length !== GATE_EXPIRY_PAYLOAD_LEN || payload[0] !== GATE_EXPIRY_PAYLOAD_VERSION) {
|
|
1759
|
+
return null;
|
|
1760
|
+
}
|
|
1761
|
+
const mode = payload[1] ?? GATE_EXPIRY_DISABLED;
|
|
1762
|
+
if (!isValidExpiryMode(mode)) {
|
|
1763
|
+
return null;
|
|
1764
|
+
}
|
|
1765
|
+
return {
|
|
1766
|
+
mode,
|
|
1767
|
+
value: readU64Le(payload, 2),
|
|
1768
|
+
cosigner: kit.getAddressDecoder().decode(
|
|
1769
|
+
payload.slice(GATE_EXPIRY_HEADER_LEN, GATE_EXPIRY_PAYLOAD_LEN)
|
|
1770
|
+
)
|
|
1771
|
+
};
|
|
1772
|
+
}
|
|
1773
|
+
function getCosignerGateStatus(hookPayload, clock = {}) {
|
|
1774
|
+
const expiry = decodeCosignerGateExpiryPayload(hookPayload);
|
|
1775
|
+
if (!expiry) {
|
|
1776
|
+
return {
|
|
1777
|
+
gateEnforced: true,
|
|
1778
|
+
expiryMode: GATE_EXPIRY_DISABLED,
|
|
1779
|
+
expiryValue: 0n,
|
|
1780
|
+
reason: "invalid_expiry_payload"
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
if (expiry.mode === GATE_EXPIRY_DISABLED) {
|
|
1784
|
+
return {
|
|
1785
|
+
gateEnforced: true,
|
|
1786
|
+
expiryMode: expiry.mode,
|
|
1787
|
+
expiryValue: expiry.value,
|
|
1788
|
+
reason: "expiry_disabled"
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
if (expiry.mode === GATE_EXPIRY_UNIX_TIMESTAMP) {
|
|
1792
|
+
const unixTimestamp = clock.unixTimestamp === void 0 ? BigInt(Math.floor(Date.now() / 1e3)) : toBigInt(clock.unixTimestamp);
|
|
1793
|
+
const expired = unixTimestamp >= expiry.value;
|
|
1794
|
+
return {
|
|
1795
|
+
gateEnforced: !expired,
|
|
1796
|
+
expiryMode: expiry.mode,
|
|
1797
|
+
expiryValue: expiry.value,
|
|
1798
|
+
reason: expired ? "timestamp_expired" : "timestamp_pending"
|
|
1799
|
+
};
|
|
1800
|
+
}
|
|
1801
|
+
if (expiry.mode === GATE_EXPIRY_SLOT) {
|
|
1802
|
+
if (clock.slot === void 0) {
|
|
1803
|
+
return {
|
|
1804
|
+
gateEnforced: true,
|
|
1805
|
+
expiryMode: expiry.mode,
|
|
1806
|
+
expiryValue: expiry.value,
|
|
1807
|
+
reason: "slot_unavailable"
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
const expired = toBigInt(clock.slot) >= expiry.value;
|
|
1811
|
+
return {
|
|
1812
|
+
gateEnforced: !expired,
|
|
1813
|
+
expiryMode: expiry.mode,
|
|
1814
|
+
expiryValue: expiry.value,
|
|
1815
|
+
reason: expired ? "slot_expired" : "slot_pending"
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
return {
|
|
1819
|
+
gateEnforced: true,
|
|
1820
|
+
expiryMode: expiry.mode,
|
|
1821
|
+
expiryValue: expiry.value,
|
|
1822
|
+
reason: "invalid_expiry_mode"
|
|
1823
|
+
};
|
|
1824
|
+
}
|
|
1825
|
+
function isCosignerGateEnforced(hookPayload, clock = {}) {
|
|
1826
|
+
return getCosignerGateStatus(hookPayload, clock).gateEnforced;
|
|
1827
|
+
}
|
|
1660
1828
|
var INITIALIZER_PROGRAM_ID = kit.address(
|
|
1661
1829
|
"4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
|
|
1662
1830
|
);
|
|
1663
1831
|
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = kit.address(
|
|
1664
1832
|
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
1665
1833
|
);
|
|
1666
|
-
var CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
1667
|
-
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
1668
|
-
);
|
|
1669
1834
|
var PREDICTION_HOOK_PROGRAM_ID = kit.address(
|
|
1670
1835
|
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
1671
1836
|
);
|
|
@@ -1847,10 +2012,10 @@ function getCurveSwapFeeAmount(amountIn, swapFeeBps) {
|
|
|
1847
2012
|
if (amountIn < 0n) {
|
|
1848
2013
|
throw new Error("amountIn must be non-negative");
|
|
1849
2014
|
}
|
|
1850
|
-
if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(
|
|
2015
|
+
if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(chunk4CI2M2F6_cjs.BPS_DENOM)) {
|
|
1851
2016
|
throw new Error("swapFeeBps must be an integer from 0 to 10000");
|
|
1852
2017
|
}
|
|
1853
|
-
return
|
|
2018
|
+
return chunk7PXLEMBJ_cjs.ceilDiv(amountIn * BigInt(swapFeeBps), chunk4CI2M2F6_cjs.BPS_DENOM);
|
|
1854
2019
|
}
|
|
1855
2020
|
function phaseLabel(phase) {
|
|
1856
2021
|
switch (phase) {
|
|
@@ -1865,148 +2030,112 @@ function phaseLabel(phase) {
|
|
|
1865
2030
|
}
|
|
1866
2031
|
}
|
|
1867
2032
|
|
|
1868
|
-
// src/solana/
|
|
1869
|
-
var
|
|
1870
|
-
|
|
2033
|
+
// src/solana/cpmmHook/payload.ts
|
|
2034
|
+
var MAX_I64 = (1n << 63n) - 1n;
|
|
2035
|
+
var MAX_U32 = (1n << 32n) - 1n;
|
|
2036
|
+
function toBigInt2(value) {
|
|
1871
2037
|
return typeof value === "bigint" ? value : BigInt(value);
|
|
1872
2038
|
}
|
|
1873
|
-
function
|
|
1874
|
-
|
|
1875
|
-
}
|
|
1876
|
-
function readU64Le(bytes, offset) {
|
|
1877
|
-
let value = 0n;
|
|
1878
|
-
for (let i = 0; i < 8; i++) {
|
|
1879
|
-
value |= BigInt(bytes[offset + i] ?? 0) << BigInt(i * 8);
|
|
2039
|
+
function assertU16Bps(label, value) {
|
|
2040
|
+
if (!Number.isInteger(value) || value < 0 || value > DYNAMIC_FEE_SCHEDULE_MAX_BPS) {
|
|
2041
|
+
throw new Error(`${label} must be an integer between 0 and 10000`);
|
|
1880
2042
|
}
|
|
1881
|
-
return value;
|
|
1882
2043
|
}
|
|
1883
|
-
function
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
}
|
|
2044
|
+
function writeI64Le(bytes, offset, value) {
|
|
2045
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2046
|
+
view.setBigInt64(offset, value, true);
|
|
1887
2047
|
}
|
|
1888
|
-
function
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
2048
|
+
function writeU16Le(bytes, offset, value) {
|
|
2049
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2050
|
+
view.setUint16(offset, value, true);
|
|
2051
|
+
}
|
|
2052
|
+
function writeU32Le(bytes, offset, value) {
|
|
2053
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2054
|
+
view.setUint32(offset, Number(value), true);
|
|
2055
|
+
}
|
|
2056
|
+
function validateDynamicFeeScheduleArgs(schedule) {
|
|
2057
|
+
const startingTime = toBigInt2(schedule.startingTime);
|
|
2058
|
+
if (startingTime < 0n || startingTime > MAX_I64) {
|
|
2059
|
+
throw new Error("startingTime must be between 0 and i64::MAX");
|
|
1894
2060
|
}
|
|
1895
|
-
|
|
1896
|
-
|
|
2061
|
+
assertU16Bps("startFeeBps", schedule.startFeeBps);
|
|
2062
|
+
assertU16Bps("endFeeBps", schedule.endFeeBps);
|
|
2063
|
+
if (schedule.endFeeBps > schedule.startFeeBps) {
|
|
2064
|
+
throw new Error("endFeeBps must be less than or equal to startFeeBps");
|
|
1897
2065
|
}
|
|
1898
|
-
const
|
|
1899
|
-
if (
|
|
1900
|
-
throw new Error(
|
|
2066
|
+
const durationSeconds = toBigInt2(schedule.durationSeconds);
|
|
2067
|
+
if (durationSeconds < 0n || durationSeconds > MAX_U32) {
|
|
2068
|
+
throw new Error("durationSeconds must be between 0 and u32::MAX");
|
|
1901
2069
|
}
|
|
1902
|
-
if (
|
|
1903
|
-
throw new Error("
|
|
2070
|
+
if (schedule.startFeeBps > schedule.endFeeBps && durationSeconds === 0n) {
|
|
2071
|
+
throw new Error("durationSeconds must be nonzero for decaying schedules");
|
|
1904
2072
|
}
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
payload
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
);
|
|
2073
|
+
return { startingTime, durationSeconds };
|
|
2074
|
+
}
|
|
2075
|
+
function encodeDynamicFeeSchedule(schedule) {
|
|
2076
|
+
const { startingTime, durationSeconds } = validateDynamicFeeScheduleArgs(schedule);
|
|
2077
|
+
const payload = new Uint8Array(DYNAMIC_FEE_SCHEDULE_LEN);
|
|
2078
|
+
payload.set(DYNAMIC_FEE_SCHEDULE_MAGIC, 0);
|
|
2079
|
+
payload[8] = DYNAMIC_FEE_SCHEDULE_VERSION;
|
|
2080
|
+
writeI64Le(payload, DYNAMIC_FEE_SCHEDULE_HEADER_LEN, startingTime);
|
|
2081
|
+
writeU16Le(payload, 24, schedule.startFeeBps);
|
|
2082
|
+
writeU16Le(payload, 26, schedule.endFeeBps);
|
|
2083
|
+
writeU32Le(payload, 28, durationSeconds);
|
|
1913
2084
|
return payload;
|
|
1914
2085
|
}
|
|
1915
|
-
function
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
2086
|
+
function encodeCpmmHookPayload(args = {}) {
|
|
2087
|
+
const schedulePayload = args.schedule ? encodeDynamicFeeSchedule(args.schedule) : new Uint8Array();
|
|
2088
|
+
const gatePayload = args.gateExpiry ? encodeCosignerGateExpiryPayload(args.gateExpiry) : new Uint8Array();
|
|
2089
|
+
const payload = new Uint8Array(schedulePayload.length + gatePayload.length);
|
|
2090
|
+
payload.set(schedulePayload, 0);
|
|
2091
|
+
payload.set(gatePayload, schedulePayload.length);
|
|
2092
|
+
return payload;
|
|
2093
|
+
}
|
|
2094
|
+
function encodeDynamicFeeCosignerGatePayload(args) {
|
|
2095
|
+
return encodeCosignerGateExpiryPayload(args);
|
|
2096
|
+
}
|
|
2097
|
+
function getCpmmHookRemainingAccounts({
|
|
2098
|
+
namespace,
|
|
2099
|
+
config,
|
|
2100
|
+
cosigner
|
|
2101
|
+
}) {
|
|
2102
|
+
const signedHookRemainingAccounts = [namespace];
|
|
2103
|
+
if (config && config !== namespace) {
|
|
2104
|
+
signedHookRemainingAccounts.push(config);
|
|
1921
2105
|
}
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
return null;
|
|
1925
|
-
}
|
|
1926
|
-
return {
|
|
1927
|
-
mode,
|
|
1928
|
-
value: readU64Le(payload, 2),
|
|
1929
|
-
cosigner: kit.getAddressDecoder().decode(
|
|
1930
|
-
payload.slice(GATE_EXPIRY_HEADER_LEN, GATE_EXPIRY_PAYLOAD_LEN)
|
|
1931
|
-
)
|
|
1932
|
-
};
|
|
1933
|
-
}
|
|
1934
|
-
function getCosignerGateStatus(hookPayload, clock = {}) {
|
|
1935
|
-
const expiry = decodeCosignerGateExpiryPayload(hookPayload);
|
|
1936
|
-
if (!expiry) {
|
|
1937
|
-
return {
|
|
1938
|
-
gateEnforced: true,
|
|
1939
|
-
expiryMode: GATE_EXPIRY_DISABLED,
|
|
1940
|
-
expiryValue: 0n,
|
|
1941
|
-
reason: "invalid_expiry_payload"
|
|
1942
|
-
};
|
|
1943
|
-
}
|
|
1944
|
-
if (expiry.mode === GATE_EXPIRY_DISABLED) {
|
|
1945
|
-
return {
|
|
1946
|
-
gateEnforced: true,
|
|
1947
|
-
expiryMode: expiry.mode,
|
|
1948
|
-
expiryValue: expiry.value,
|
|
1949
|
-
reason: "expiry_disabled"
|
|
1950
|
-
};
|
|
1951
|
-
}
|
|
1952
|
-
if (expiry.mode === GATE_EXPIRY_UNIX_TIMESTAMP) {
|
|
1953
|
-
const unixTimestamp = clock.unixTimestamp === void 0 ? BigInt(Math.floor(Date.now() / 1e3)) : toBigInt(clock.unixTimestamp);
|
|
1954
|
-
const expired = unixTimestamp >= expiry.value;
|
|
1955
|
-
return {
|
|
1956
|
-
gateEnforced: !expired,
|
|
1957
|
-
expiryMode: expiry.mode,
|
|
1958
|
-
expiryValue: expiry.value,
|
|
1959
|
-
reason: expired ? "timestamp_expired" : "timestamp_pending"
|
|
1960
|
-
};
|
|
1961
|
-
}
|
|
1962
|
-
if (expiry.mode === GATE_EXPIRY_SLOT) {
|
|
1963
|
-
if (clock.slot === void 0) {
|
|
1964
|
-
return {
|
|
1965
|
-
gateEnforced: true,
|
|
1966
|
-
expiryMode: expiry.mode,
|
|
1967
|
-
expiryValue: expiry.value,
|
|
1968
|
-
reason: "slot_unavailable"
|
|
1969
|
-
};
|
|
1970
|
-
}
|
|
1971
|
-
const expired = toBigInt(clock.slot) >= expiry.value;
|
|
1972
|
-
return {
|
|
1973
|
-
gateEnforced: !expired,
|
|
1974
|
-
expiryMode: expiry.mode,
|
|
1975
|
-
expiryValue: expiry.value,
|
|
1976
|
-
reason: expired ? "slot_expired" : "slot_pending"
|
|
1977
|
-
};
|
|
2106
|
+
if (cosigner) {
|
|
2107
|
+
signedHookRemainingAccounts.push(cosigner);
|
|
1978
2108
|
}
|
|
2109
|
+
const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
|
|
2110
|
+
chunk7PXLEMBJ_cjs.getAddressFromRemainingAccount
|
|
2111
|
+
);
|
|
1979
2112
|
return {
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
2113
|
+
signedHookRemainingAccounts,
|
|
2114
|
+
unsignedHookRemainingAccounts,
|
|
2115
|
+
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
2116
|
+
unsignedHookRemainingAccounts
|
|
2117
|
+
)
|
|
1984
2118
|
};
|
|
1985
2119
|
}
|
|
1986
|
-
function
|
|
1987
|
-
return getCosignerGateStatus(hookPayload, clock).gateEnforced;
|
|
1988
|
-
}
|
|
1989
|
-
function getCosignerHookRemainingAccounts({
|
|
2120
|
+
function getCpmmHookRemainingAccountAddresses({
|
|
1990
2121
|
namespace,
|
|
2122
|
+
config,
|
|
1991
2123
|
cosigner
|
|
1992
2124
|
}) {
|
|
1993
|
-
|
|
2125
|
+
return getCpmmHookRemainingAccounts({
|
|
1994
2126
|
namespace,
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
unsignedHookRemainingAccounts
|
|
2002
|
-
)
|
|
2003
|
-
};
|
|
2127
|
+
config,
|
|
2128
|
+
cosigner
|
|
2129
|
+
}).unsignedHookRemainingAccounts;
|
|
2130
|
+
}
|
|
2131
|
+
function isDynamicFeeSchedulePayload(payload) {
|
|
2132
|
+
return payload.length >= DYNAMIC_FEE_SCHEDULE_LEN && DYNAMIC_FEE_SCHEDULE_MAGIC.every((byte, index) => payload[index] === byte);
|
|
2004
2133
|
}
|
|
2005
2134
|
var textEncoder2 = new TextEncoder();
|
|
2006
|
-
async function
|
|
2135
|
+
async function getCpmmHookConfigAddress(programId = CPMM_HOOK_PROGRAM_ID) {
|
|
2007
2136
|
return kit.getProgramDerivedAddress({
|
|
2008
2137
|
programAddress: programId,
|
|
2009
|
-
seeds: [textEncoder2.encode(
|
|
2138
|
+
seeds: [textEncoder2.encode(SEED_CPMM_HOOK_CONFIG)]
|
|
2010
2139
|
});
|
|
2011
2140
|
}
|
|
2012
2141
|
|
|
@@ -2014,7 +2143,6 @@ async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID
|
|
|
2014
2143
|
var initializer_exports = {};
|
|
2015
2144
|
chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
2016
2145
|
BPF_LOADER_UPGRADEABLE_PROGRAM_ID: () => BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
|
|
2017
|
-
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
2018
2146
|
CURVE_KIND_XYK: () => CURVE_KIND_XYK,
|
|
2019
2147
|
CURVE_PARAMS_FORMAT_XYK_V0: () => CURVE_PARAMS_FORMAT_XYK_V0,
|
|
2020
2148
|
DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND: () => DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND,
|
|
@@ -3136,10 +3264,10 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3136
3264
|
admin,
|
|
3137
3265
|
config,
|
|
3138
3266
|
programData,
|
|
3139
|
-
systemProgram =
|
|
3267
|
+
systemProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
3140
3268
|
} = accounts;
|
|
3141
3269
|
const keys = [
|
|
3142
|
-
|
|
3270
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3143
3271
|
{ address: config, role: kit.AccountRole.WRITABLE },
|
|
3144
3272
|
{ address: programData, role: kit.AccountRole.READONLY },
|
|
3145
3273
|
{ address: systemProgram, role: kit.AccountRole.READONLY }
|
|
@@ -3152,7 +3280,7 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3152
3280
|
function createSetMigratorAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
3153
3281
|
const { admin, config } = accounts;
|
|
3154
3282
|
const keys = [
|
|
3155
|
-
|
|
3283
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3156
3284
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
3157
3285
|
];
|
|
3158
3286
|
const data = new Uint8Array(
|
|
@@ -3163,7 +3291,7 @@ function createSetMigratorAllowlistInstruction(accounts, allowlist, programId =
|
|
|
3163
3291
|
function createSetHookAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
3164
3292
|
const { admin, config } = accounts;
|
|
3165
3293
|
const keys = [
|
|
3166
|
-
|
|
3294
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3167
3295
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
3168
3296
|
];
|
|
3169
3297
|
const data = new Uint8Array(
|
|
@@ -3178,6 +3306,17 @@ var SEED_STATE = "state";
|
|
|
3178
3306
|
var SEED_MIGRATION_AUTHORITY = "migration_authority";
|
|
3179
3307
|
var MAX_RECIPIENTS = 2;
|
|
3180
3308
|
var CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS = {
|
|
3309
|
+
// SHA256("global:create_spot_pool")[0:8]
|
|
3310
|
+
createSpotPool: new Uint8Array([
|
|
3311
|
+
13,
|
|
3312
|
+
137,
|
|
3313
|
+
16,
|
|
3314
|
+
26,
|
|
3315
|
+
40,
|
|
3316
|
+
36,
|
|
3317
|
+
110,
|
|
3318
|
+
26
|
|
3319
|
+
]),
|
|
3181
3320
|
// SHA256("global:register_launch")[0:8]
|
|
3182
3321
|
registerLaunch: new Uint8Array([
|
|
3183
3322
|
114,
|
|
@@ -3268,13 +3407,13 @@ function decodeClaimReceipt(encodedAccount) {
|
|
|
3268
3407
|
getClaimReceiptDecoder()
|
|
3269
3408
|
);
|
|
3270
3409
|
}
|
|
3271
|
-
async function fetchClaimReceipt(rpc,
|
|
3272
|
-
const maybeAccount = await fetchMaybeClaimReceipt(rpc,
|
|
3410
|
+
async function fetchClaimReceipt(rpc, address6, config) {
|
|
3411
|
+
const maybeAccount = await fetchMaybeClaimReceipt(rpc, address6, config);
|
|
3273
3412
|
kit.assertAccountExists(maybeAccount);
|
|
3274
3413
|
return maybeAccount;
|
|
3275
3414
|
}
|
|
3276
|
-
async function fetchMaybeClaimReceipt(rpc,
|
|
3277
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3415
|
+
async function fetchMaybeClaimReceipt(rpc, address6, config) {
|
|
3416
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3278
3417
|
return decodeClaimReceipt(maybeAccount);
|
|
3279
3418
|
}
|
|
3280
3419
|
async function fetchAllClaimReceipt(rpc, addresses, config) {
|
|
@@ -3338,13 +3477,13 @@ function decodeEntry(encodedAccount) {
|
|
|
3338
3477
|
getEntryDecoder()
|
|
3339
3478
|
);
|
|
3340
3479
|
}
|
|
3341
|
-
async function fetchEntry(rpc,
|
|
3342
|
-
const maybeAccount = await fetchMaybeEntry(rpc,
|
|
3480
|
+
async function fetchEntry(rpc, address6, config) {
|
|
3481
|
+
const maybeAccount = await fetchMaybeEntry(rpc, address6, config);
|
|
3343
3482
|
kit.assertAccountExists(maybeAccount);
|
|
3344
3483
|
return maybeAccount;
|
|
3345
3484
|
}
|
|
3346
|
-
async function fetchMaybeEntry(rpc,
|
|
3347
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3485
|
+
async function fetchMaybeEntry(rpc, address6, config) {
|
|
3486
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3348
3487
|
return decodeEntry(maybeAccount);
|
|
3349
3488
|
}
|
|
3350
3489
|
async function fetchAllEntry(rpc, addresses, config) {
|
|
@@ -3406,13 +3545,13 @@ function decodeEntryByMint(encodedAccount) {
|
|
|
3406
3545
|
getEntryByMintDecoder()
|
|
3407
3546
|
);
|
|
3408
3547
|
}
|
|
3409
|
-
async function fetchEntryByMint(rpc,
|
|
3410
|
-
const maybeAccount = await fetchMaybeEntryByMint(rpc,
|
|
3548
|
+
async function fetchEntryByMint(rpc, address6, config) {
|
|
3549
|
+
const maybeAccount = await fetchMaybeEntryByMint(rpc, address6, config);
|
|
3411
3550
|
kit.assertAccountExists(maybeAccount);
|
|
3412
3551
|
return maybeAccount;
|
|
3413
3552
|
}
|
|
3414
|
-
async function fetchMaybeEntryByMint(rpc,
|
|
3415
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3553
|
+
async function fetchMaybeEntryByMint(rpc, address6, config) {
|
|
3554
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3416
3555
|
return decodeEntryByMint(maybeAccount);
|
|
3417
3556
|
}
|
|
3418
3557
|
async function fetchAllEntryByMint(rpc, addresses, config) {
|
|
@@ -3484,13 +3623,13 @@ function decodeInitConfig(encodedAccount) {
|
|
|
3484
3623
|
getInitConfigDecoder2()
|
|
3485
3624
|
);
|
|
3486
3625
|
}
|
|
3487
|
-
async function fetchInitConfig(rpc,
|
|
3488
|
-
const maybeAccount = await fetchMaybeInitConfig(rpc,
|
|
3626
|
+
async function fetchInitConfig(rpc, address6, config) {
|
|
3627
|
+
const maybeAccount = await fetchMaybeInitConfig(rpc, address6, config);
|
|
3489
3628
|
kit.assertAccountExists(maybeAccount);
|
|
3490
3629
|
return maybeAccount;
|
|
3491
3630
|
}
|
|
3492
|
-
async function fetchMaybeInitConfig(rpc,
|
|
3493
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3631
|
+
async function fetchMaybeInitConfig(rpc, address6, config) {
|
|
3632
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3494
3633
|
return decodeInitConfig(maybeAccount);
|
|
3495
3634
|
}
|
|
3496
3635
|
async function fetchAllInitConfig(rpc, addresses, config) {
|
|
@@ -3790,13 +3929,13 @@ function decodeLaunch(encodedAccount) {
|
|
|
3790
3929
|
getLaunchDecoder2()
|
|
3791
3930
|
);
|
|
3792
3931
|
}
|
|
3793
|
-
async function fetchLaunch(rpc,
|
|
3794
|
-
const maybeAccount = await fetchMaybeLaunch(rpc,
|
|
3932
|
+
async function fetchLaunch(rpc, address6, config) {
|
|
3933
|
+
const maybeAccount = await fetchMaybeLaunch(rpc, address6, config);
|
|
3795
3934
|
kit.assertAccountExists(maybeAccount);
|
|
3796
3935
|
return maybeAccount;
|
|
3797
3936
|
}
|
|
3798
|
-
async function fetchMaybeLaunch(rpc,
|
|
3799
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3937
|
+
async function fetchMaybeLaunch(rpc, address6, config) {
|
|
3938
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3800
3939
|
return decodeLaunch(maybeAccount);
|
|
3801
3940
|
}
|
|
3802
3941
|
async function fetchAllLaunch(rpc, addresses, config) {
|
|
@@ -3870,13 +4009,13 @@ function decodeMarket(encodedAccount) {
|
|
|
3870
4009
|
getMarketDecoder()
|
|
3871
4010
|
);
|
|
3872
4011
|
}
|
|
3873
|
-
async function fetchMarket(rpc,
|
|
3874
|
-
const maybeAccount = await fetchMaybeMarket(rpc,
|
|
4012
|
+
async function fetchMarket(rpc, address6, config) {
|
|
4013
|
+
const maybeAccount = await fetchMaybeMarket(rpc, address6, config);
|
|
3875
4014
|
kit.assertAccountExists(maybeAccount);
|
|
3876
4015
|
return maybeAccount;
|
|
3877
4016
|
}
|
|
3878
|
-
async function fetchMaybeMarket(rpc,
|
|
3879
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
4017
|
+
async function fetchMaybeMarket(rpc, address6, config) {
|
|
4018
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3880
4019
|
return decodeMarket(maybeAccount);
|
|
3881
4020
|
}
|
|
3882
4021
|
async function fetchAllMarket(rpc, addresses, config) {
|
|
@@ -3942,13 +4081,13 @@ function decodeOracleState2(encodedAccount) {
|
|
|
3942
4081
|
getOracleStateDecoder()
|
|
3943
4082
|
);
|
|
3944
4083
|
}
|
|
3945
|
-
async function fetchOracleState(rpc,
|
|
3946
|
-
const maybeAccount = await fetchMaybeOracleState(rpc,
|
|
4084
|
+
async function fetchOracleState(rpc, address6, config) {
|
|
4085
|
+
const maybeAccount = await fetchMaybeOracleState(rpc, address6, config);
|
|
3947
4086
|
kit.assertAccountExists(maybeAccount);
|
|
3948
4087
|
return maybeAccount;
|
|
3949
4088
|
}
|
|
3950
|
-
async function fetchMaybeOracleState(rpc,
|
|
3951
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
4089
|
+
async function fetchMaybeOracleState(rpc, address6, config) {
|
|
4090
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3952
4091
|
return decodeOracleState2(maybeAccount);
|
|
3953
4092
|
}
|
|
3954
4093
|
async function fetchAllOracleState(rpc, addresses, config) {
|
|
@@ -4218,9 +4357,9 @@ function parseClaimInstruction(instruction) {
|
|
|
4218
4357
|
}
|
|
4219
4358
|
let accountIndex = 0;
|
|
4220
4359
|
const getNextAccount = () => {
|
|
4221
|
-
const
|
|
4360
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4222
4361
|
accountIndex += 1;
|
|
4223
|
-
return
|
|
4362
|
+
return accountMeta2;
|
|
4224
4363
|
};
|
|
4225
4364
|
return {
|
|
4226
4365
|
programAddress: instruction.programAddress,
|
|
@@ -4526,9 +4665,9 @@ function parseMigrateEntryInstruction(instruction) {
|
|
|
4526
4665
|
}
|
|
4527
4666
|
let accountIndex = 0;
|
|
4528
4667
|
const getNextAccount = () => {
|
|
4529
|
-
const
|
|
4668
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4530
4669
|
accountIndex += 1;
|
|
4531
|
-
return
|
|
4670
|
+
return accountMeta2;
|
|
4532
4671
|
};
|
|
4533
4672
|
return {
|
|
4534
4673
|
programAddress: instruction.programAddress,
|
|
@@ -4628,9 +4767,9 @@ function parsePreviewPayoutIfWinnerInstruction(instruction) {
|
|
|
4628
4767
|
}
|
|
4629
4768
|
let accountIndex = 0;
|
|
4630
4769
|
const getNextAccount = () => {
|
|
4631
|
-
const
|
|
4770
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4632
4771
|
accountIndex += 1;
|
|
4633
|
-
return
|
|
4772
|
+
return accountMeta2;
|
|
4634
4773
|
};
|
|
4635
4774
|
return {
|
|
4636
4775
|
programAddress: instruction.programAddress,
|
|
@@ -4939,9 +5078,9 @@ function parseRegisterEntryInstruction(instruction) {
|
|
|
4939
5078
|
}
|
|
4940
5079
|
let accountIndex = 0;
|
|
4941
5080
|
const getNextAccount = () => {
|
|
4942
|
-
const
|
|
5081
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4943
5082
|
accountIndex += 1;
|
|
4944
|
-
return
|
|
5083
|
+
return accountMeta2;
|
|
4945
5084
|
};
|
|
4946
5085
|
return {
|
|
4947
5086
|
programAddress: instruction.programAddress,
|
|
@@ -5235,10 +5374,10 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
|
|
|
5235
5374
|
async function getTokenMetadataAddress(mint) {
|
|
5236
5375
|
const encoder = kit.getAddressEncoder();
|
|
5237
5376
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
5238
|
-
programAddress:
|
|
5377
|
+
programAddress: chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
5239
5378
|
seeds: [
|
|
5240
5379
|
new TextEncoder().encode("metadata"),
|
|
5241
|
-
encoder.encode(
|
|
5380
|
+
encoder.encode(chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
5242
5381
|
encoder.encode(mint)
|
|
5243
5382
|
]
|
|
5244
5383
|
});
|
|
@@ -5269,18 +5408,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5269
5408
|
authority,
|
|
5270
5409
|
hookProgram,
|
|
5271
5410
|
migratorProgram,
|
|
5272
|
-
baseTokenProgram =
|
|
5273
|
-
quoteTokenProgram =
|
|
5274
|
-
systemProgram =
|
|
5411
|
+
baseTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5412
|
+
quoteTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5413
|
+
systemProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5275
5414
|
rent,
|
|
5276
5415
|
metadataAccount,
|
|
5277
|
-
metadataProgram =
|
|
5416
|
+
metadataProgram = chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
5278
5417
|
hookCreateRemainingAccounts = []
|
|
5279
5418
|
} = accounts;
|
|
5280
5419
|
const withMetadata = Boolean(
|
|
5281
5420
|
args.metadataName && args.metadataName.length > 0
|
|
5282
5421
|
);
|
|
5283
|
-
const withToken2022Metadata = withMetadata && baseTokenProgram ===
|
|
5422
|
+
const withToken2022Metadata = withMetadata && baseTokenProgram === chunk4CI2M2F6_cjs.TOKEN_2022_PROGRAM_ADDRESS;
|
|
5284
5423
|
if (withMetadata && !metadataAccount) {
|
|
5285
5424
|
throw new Error(
|
|
5286
5425
|
"metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
|
|
@@ -5288,7 +5427,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5288
5427
|
}
|
|
5289
5428
|
const createHooksEnabled = (args.hookFlags & (HF_BEFORE_CREATE | HF_AFTER_CREATE)) !== 0;
|
|
5290
5429
|
const hookCreateRemainingAccountAddresses = hookCreateRemainingAccounts.map(
|
|
5291
|
-
|
|
5430
|
+
chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner
|
|
5292
5431
|
);
|
|
5293
5432
|
const swapFeeBps = args.swapFeeBps ?? args.curveFeeBps;
|
|
5294
5433
|
if (swapFeeBps === void 0) {
|
|
@@ -5298,18 +5437,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5298
5437
|
{ address: config, role: kit.AccountRole.READONLY },
|
|
5299
5438
|
{ address: launch, role: kit.AccountRole.WRITABLE },
|
|
5300
5439
|
{ address: launchAuthority, role: kit.AccountRole.READONLY },
|
|
5301
|
-
|
|
5440
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(baseMint, kit.AccountRole.WRITABLE_SIGNER),
|
|
5302
5441
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
5303
|
-
|
|
5304
|
-
|
|
5442
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(baseVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5443
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5305
5444
|
{
|
|
5306
5445
|
address: launchFeeState ?? (await getLaunchFeeStateAddress(launch, programId))[0],
|
|
5307
5446
|
role: kit.AccountRole.WRITABLE
|
|
5308
5447
|
},
|
|
5309
|
-
|
|
5448
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
5310
5449
|
];
|
|
5311
5450
|
keys.push(
|
|
5312
|
-
authority ?
|
|
5451
|
+
authority ? chunk7PXLEMBJ_cjs.createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : { address: programId, role: kit.AccountRole.READONLY }
|
|
5313
5452
|
);
|
|
5314
5453
|
keys.push(
|
|
5315
5454
|
hookProgram ? { address: hookProgram, role: kit.AccountRole.READONLY } : { address: programId, role: kit.AccountRole.READONLY }
|
|
@@ -5342,15 +5481,15 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5342
5481
|
);
|
|
5343
5482
|
if (withToken2022Metadata) {
|
|
5344
5483
|
keys.push({
|
|
5345
|
-
address:
|
|
5484
|
+
address: chunk4CI2M2F6_cjs.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
5346
5485
|
role: kit.AccountRole.READONLY
|
|
5347
5486
|
});
|
|
5348
5487
|
}
|
|
5349
5488
|
keys.push(
|
|
5350
5489
|
...hookCreateRemainingAccounts.map(
|
|
5351
|
-
(account) =>
|
|
5490
|
+
(account) => chunk7PXLEMBJ_cjs.createAccountMeta(
|
|
5352
5491
|
account,
|
|
5353
|
-
|
|
5492
|
+
chunk7PXLEMBJ_cjs.isTransactionSigner(account) ? kit.AccountRole.READONLY_SIGNER : kit.AccountRole.READONLY
|
|
5354
5493
|
)
|
|
5355
5494
|
)
|
|
5356
5495
|
);
|
|
@@ -5374,7 +5513,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5374
5513
|
if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
5375
5514
|
const oracleState = args.namespace;
|
|
5376
5515
|
const entryId = args.launchId;
|
|
5377
|
-
const baseMintAddress =
|
|
5516
|
+
const baseMintAddress = chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner(baseMint);
|
|
5378
5517
|
const [market] = await getPredictionMarketAddress(oracleState, quoteMint);
|
|
5379
5518
|
const [potVault] = await getPredictionPotVaultAddress(market);
|
|
5380
5519
|
const [marketAuthority] = await getPredictionMarketAuthorityAddress(market);
|
|
@@ -5403,10 +5542,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5403
5542
|
baseMint,
|
|
5404
5543
|
quoteMint,
|
|
5405
5544
|
user,
|
|
5406
|
-
hookProgram =
|
|
5545
|
+
hookProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5407
5546
|
launchFeeState,
|
|
5408
|
-
baseTokenProgram =
|
|
5409
|
-
quoteTokenProgram =
|
|
5547
|
+
baseTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5548
|
+
quoteTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5410
5549
|
remainingAccounts = []
|
|
5411
5550
|
} = accounts;
|
|
5412
5551
|
const keys = [
|
|
@@ -5418,7 +5557,7 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5418
5557
|
{ address: userQuoteAccount, role: kit.AccountRole.WRITABLE },
|
|
5419
5558
|
{ address: baseMint, role: kit.AccountRole.READONLY },
|
|
5420
5559
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
5421
|
-
|
|
5560
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(user, kit.AccountRole.READONLY_SIGNER),
|
|
5422
5561
|
// hook_program is Optional in the on-chain struct but still occupies a fixed
|
|
5423
5562
|
// slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
|
|
5424
5563
|
// no-op placeholder when no real hook is configured.
|
|
@@ -5426,7 +5565,7 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5426
5565
|
{ address: launchFeeState, role: kit.AccountRole.WRITABLE },
|
|
5427
5566
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
5428
5567
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
5429
|
-
...remainingAccounts.map(
|
|
5568
|
+
...remainingAccounts.map(chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta)
|
|
5430
5569
|
];
|
|
5431
5570
|
const data = new Uint8Array(
|
|
5432
5571
|
getCurveSwapExactInInstructionDataEncoder().encode(args)
|
|
@@ -5445,9 +5584,9 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5445
5584
|
launchFeeState,
|
|
5446
5585
|
migratorProgram,
|
|
5447
5586
|
payer,
|
|
5448
|
-
baseTokenProgram =
|
|
5449
|
-
quoteTokenProgram =
|
|
5450
|
-
systemProgram =
|
|
5587
|
+
baseTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5588
|
+
quoteTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5589
|
+
systemProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5451
5590
|
rent
|
|
5452
5591
|
} = accounts;
|
|
5453
5592
|
const keys = [
|
|
@@ -5460,13 +5599,13 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5460
5599
|
{ address: quoteVault, role: kit.AccountRole.WRITABLE },
|
|
5461
5600
|
{ address: launchFeeState, role: kit.AccountRole.READONLY },
|
|
5462
5601
|
{ address: migratorProgram, role: kit.AccountRole.READONLY },
|
|
5463
|
-
|
|
5602
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER),
|
|
5464
5603
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
5465
5604
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
5466
5605
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
5467
5606
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
5468
5607
|
];
|
|
5469
|
-
const data =
|
|
5608
|
+
const data = chunk7PXLEMBJ_cjs.encodeInstructionData(
|
|
5470
5609
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
5471
5610
|
);
|
|
5472
5611
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -5493,7 +5632,7 @@ function createPreviewSwapExactInInstruction(accounts, args, programId = INITIAL
|
|
|
5493
5632
|
const accountsList = hookProgram ? [...keys, { address: hookProgram, role: kit.AccountRole.READONLY }] : keys;
|
|
5494
5633
|
const accountsWithRemaining = [
|
|
5495
5634
|
...accountsList,
|
|
5496
|
-
...remainingAccounts.map(
|
|
5635
|
+
...remainingAccounts.map(chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta)
|
|
5497
5636
|
];
|
|
5498
5637
|
const data = new Uint8Array(
|
|
5499
5638
|
getPreviewSwapExactInInstructionDataEncoder2().encode(args)
|
|
@@ -5516,7 +5655,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
5516
5655
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
5517
5656
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
5518
5657
|
];
|
|
5519
|
-
const data =
|
|
5658
|
+
const data = chunk7PXLEMBJ_cjs.encodeInstructionData(
|
|
5520
5659
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
5521
5660
|
);
|
|
5522
5661
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -5525,1178 +5664,144 @@ function decodePreviewMigrationResult(data) {
|
|
|
5525
5664
|
return previewMigrationResultCodec.decode(data);
|
|
5526
5665
|
}
|
|
5527
5666
|
|
|
5528
|
-
// src/solana/
|
|
5529
|
-
var
|
|
5530
|
-
chunkQ7SFCCGT_cjs.__export(
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
fetchMaybeCosignerConfig: () => fetchMaybeCosignerConfig2,
|
|
5568
|
-
getAddCosignerDiscriminatorBytes: () => getAddCosignerDiscriminatorBytes2,
|
|
5569
|
-
getAddCosignerInstruction: () => getAddCosignerInstruction2,
|
|
5570
|
-
getAddCosignerInstructionAsync: () => getAddCosignerInstructionAsync2,
|
|
5571
|
-
getAddCosignerInstructionDataCodec: () => getAddCosignerInstructionDataCodec2,
|
|
5572
|
-
getAddCosignerInstructionDataDecoder: () => getAddCosignerInstructionDataDecoder2,
|
|
5573
|
-
getAddCosignerInstructionDataEncoder: () => getAddCosignerInstructionDataEncoder2,
|
|
5574
|
-
getCosignerArgCodec: () => getCosignerArgCodec2,
|
|
5575
|
-
getCosignerArgDecoder: () => getCosignerArgDecoder2,
|
|
5576
|
-
getCosignerArgEncoder: () => getCosignerArgEncoder2,
|
|
5577
|
-
getCosignerConfigCodec: () => getCosignerConfigCodec2,
|
|
5578
|
-
getCosignerConfigDecoder: () => getCosignerConfigDecoder2,
|
|
5579
|
-
getCosignerConfigDiscriminatorBytes: () => getCosignerConfigDiscriminatorBytes2,
|
|
5580
|
-
getCosignerConfigEncoder: () => getCosignerConfigEncoder2,
|
|
5581
|
-
getCosignerConfigSize: () => getCosignerConfigSize2,
|
|
5582
|
-
getDynamicFeeHookConfigAddress: () => getDynamicFeeHookConfigAddress,
|
|
5583
|
-
getDynamicFeeHookErrorMessage: () => getDynamicFeeHookErrorMessage,
|
|
5584
|
-
getDynamicFeeHookRemainingAccountAddresses: () => getDynamicFeeHookRemainingAccountAddresses,
|
|
5585
|
-
getDynamicFeeHookRemainingAccounts: () => getDynamicFeeHookRemainingAccounts,
|
|
5586
|
-
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec3,
|
|
5587
|
-
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder3,
|
|
5588
|
-
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder3,
|
|
5589
|
-
getInitializeConfigDiscriminatorBytes: () => getInitializeConfigDiscriminatorBytes3,
|
|
5590
|
-
getInitializeConfigInstruction: () => getInitializeConfigInstruction3,
|
|
5591
|
-
getInitializeConfigInstructionAsync: () => getInitializeConfigInstructionAsync4,
|
|
5592
|
-
getInitializeConfigInstructionDataCodec: () => getInitializeConfigInstructionDataCodec3,
|
|
5593
|
-
getInitializeConfigInstructionDataDecoder: () => getInitializeConfigInstructionDataDecoder3,
|
|
5594
|
-
getInitializeConfigInstructionDataEncoder: () => getInitializeConfigInstructionDataEncoder4,
|
|
5595
|
-
getRemoveCosignerDiscriminatorBytes: () => getRemoveCosignerDiscriminatorBytes2,
|
|
5596
|
-
getRemoveCosignerInstruction: () => getRemoveCosignerInstruction2,
|
|
5597
|
-
getRemoveCosignerInstructionAsync: () => getRemoveCosignerInstructionAsync2,
|
|
5598
|
-
getRemoveCosignerInstructionDataCodec: () => getRemoveCosignerInstructionDataCodec2,
|
|
5599
|
-
getRemoveCosignerInstructionDataDecoder: () => getRemoveCosignerInstructionDataDecoder2,
|
|
5600
|
-
getRemoveCosignerInstructionDataEncoder: () => getRemoveCosignerInstructionDataEncoder2,
|
|
5601
|
-
getSetAuthorityArgsCodec: () => getSetAuthorityArgsCodec2,
|
|
5602
|
-
getSetAuthorityArgsDecoder: () => getSetAuthorityArgsDecoder2,
|
|
5603
|
-
getSetAuthorityArgsEncoder: () => getSetAuthorityArgsEncoder2,
|
|
5604
|
-
getSetAuthorityDiscriminatorBytes: () => getSetAuthorityDiscriminatorBytes2,
|
|
5605
|
-
getSetAuthorityInstruction: () => getSetAuthorityInstruction2,
|
|
5606
|
-
getSetAuthorityInstructionAsync: () => getSetAuthorityInstructionAsync2,
|
|
5607
|
-
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec2,
|
|
5608
|
-
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder2,
|
|
5609
|
-
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder2,
|
|
5610
|
-
identifyDynamicFeeHookAccount: () => identifyDynamicFeeHookAccount,
|
|
5611
|
-
identifyDynamicFeeHookInstruction: () => identifyDynamicFeeHookInstruction,
|
|
5612
|
-
isDynamicFeeHookError: () => isDynamicFeeHookError,
|
|
5613
|
-
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
5614
|
-
parseAddCosignerInstruction: () => parseAddCosignerInstruction2,
|
|
5615
|
-
parseDynamicFeeHookInstruction: () => parseDynamicFeeHookInstruction,
|
|
5616
|
-
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction4,
|
|
5617
|
-
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction2,
|
|
5618
|
-
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction2,
|
|
5619
|
-
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
5667
|
+
// src/solana/migrators/cpmmMigrator/index.ts
|
|
5668
|
+
var cpmmMigrator_exports = {};
|
|
5669
|
+
chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
5670
|
+
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
5671
|
+
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
5672
|
+
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
5673
|
+
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
5674
|
+
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
5675
|
+
SEED_STATE: () => SEED_STATE,
|
|
5676
|
+
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
5677
|
+
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
5678
|
+
createSpotPoolInstruction: () => createSpotPoolInstruction,
|
|
5679
|
+
deriveSpotPoolAccounts: () => deriveSpotPoolAccounts,
|
|
5680
|
+
encodeCreateSpotPoolPayload: () => encodeCreateSpotPoolPayload,
|
|
5681
|
+
encodeMigratePayload: () => encodeMigratePayload,
|
|
5682
|
+
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
5683
|
+
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
5684
|
+
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
5685
|
+
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
5686
|
+
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
5687
|
+
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
5688
|
+
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
5689
|
+
getCreateSpotPoolArgsCodec: () => getCreateSpotPoolArgsCodec,
|
|
5690
|
+
getCreateSpotPoolArgsDecoder: () => getCreateSpotPoolArgsDecoder,
|
|
5691
|
+
getCreateSpotPoolArgsEncoder: () => getCreateSpotPoolArgsEncoder,
|
|
5692
|
+
getCreateSpotPoolInstruction: () => getCreateSpotPoolInstruction,
|
|
5693
|
+
getCreateSpotPoolInstructionAsync: () => getCreateSpotPoolInstructionAsync,
|
|
5694
|
+
getCreateSpotPoolInstructionDataCodec: () => getCreateSpotPoolInstructionDataCodec,
|
|
5695
|
+
getCreateSpotPoolInstructionDataDecoder: () => getCreateSpotPoolInstructionDataDecoder,
|
|
5696
|
+
getCreateSpotPoolInstructionDataEncoder: () => getCreateSpotPoolInstructionDataEncoder,
|
|
5697
|
+
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
5698
|
+
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
5699
|
+
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
5700
|
+
getRecipientCodec: () => getRecipientCodec,
|
|
5701
|
+
getRecipientDecoder: () => getRecipientDecoder,
|
|
5702
|
+
getRecipientEncoder: () => getRecipientEncoder,
|
|
5703
|
+
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
5704
|
+
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
5705
|
+
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
5620
5706
|
});
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
183
|
|
5630
|
-
]);
|
|
5631
|
-
function getCosignerConfigDiscriminatorBytes2() {
|
|
5632
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5633
|
-
COSIGNER_CONFIG_DISCRIMINATOR2
|
|
5634
|
-
);
|
|
5635
|
-
}
|
|
5636
|
-
function getCosignerConfigEncoder2() {
|
|
5637
|
-
return kit.transformEncoder(
|
|
5638
|
-
kit.getStructEncoder([
|
|
5639
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5640
|
-
["adminAuthority", kit.getAddressEncoder()],
|
|
5641
|
-
["cosignerCount", kit.getU8Encoder()],
|
|
5642
|
-
["bump", kit.getU8Encoder()],
|
|
5643
|
-
["version", kit.getU8Encoder()],
|
|
5644
|
-
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 37)],
|
|
5645
|
-
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder(), { size: 32 })]
|
|
5646
|
-
]),
|
|
5647
|
-
(value) => ({ ...value, discriminator: COSIGNER_CONFIG_DISCRIMINATOR2 })
|
|
5648
|
-
);
|
|
5707
|
+
function getCreateSpotPoolArgsEncoder() {
|
|
5708
|
+
return kit.getStructEncoder([
|
|
5709
|
+
["swapFeeBps", kit.getU16Encoder()],
|
|
5710
|
+
["positionId", kit.getU64Encoder()],
|
|
5711
|
+
["amount0Max", kit.getU64Encoder()],
|
|
5712
|
+
["amount1Max", kit.getU64Encoder()],
|
|
5713
|
+
["minSharesOut", kit.getU128Encoder()]
|
|
5714
|
+
]);
|
|
5649
5715
|
}
|
|
5650
|
-
function
|
|
5716
|
+
function getCreateSpotPoolArgsDecoder() {
|
|
5651
5717
|
return kit.getStructDecoder([
|
|
5652
|
-
["
|
|
5653
|
-
["
|
|
5654
|
-
["
|
|
5655
|
-
["
|
|
5656
|
-
["
|
|
5657
|
-
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 37)],
|
|
5658
|
-
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder(), { size: 32 })]
|
|
5718
|
+
["swapFeeBps", kit.getU16Decoder()],
|
|
5719
|
+
["positionId", kit.getU64Decoder()],
|
|
5720
|
+
["amount0Max", kit.getU64Decoder()],
|
|
5721
|
+
["amount1Max", kit.getU64Decoder()],
|
|
5722
|
+
["minSharesOut", kit.getU128Decoder()]
|
|
5659
5723
|
]);
|
|
5660
5724
|
}
|
|
5661
|
-
function
|
|
5662
|
-
return kit.combineCodec(
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
return kit.decodeAccount(
|
|
5666
|
-
encodedAccount,
|
|
5667
|
-
getCosignerConfigDecoder2()
|
|
5725
|
+
function getCreateSpotPoolArgsCodec() {
|
|
5726
|
+
return kit.combineCodec(
|
|
5727
|
+
getCreateSpotPoolArgsEncoder(),
|
|
5728
|
+
getCreateSpotPoolArgsDecoder()
|
|
5668
5729
|
);
|
|
5669
5730
|
}
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5731
|
+
function getMigrateArgsEncoder() {
|
|
5732
|
+
return kit.getStructEncoder([
|
|
5733
|
+
["baseForDistribution", kit.getU64Encoder()],
|
|
5734
|
+
["baseForLiquidity", kit.getU64Encoder()]
|
|
5735
|
+
]);
|
|
5674
5736
|
}
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5737
|
+
function getMigrateArgsDecoder() {
|
|
5738
|
+
return kit.getStructDecoder([
|
|
5739
|
+
["baseForDistribution", kit.getU64Decoder()],
|
|
5740
|
+
["baseForLiquidity", kit.getU64Decoder()]
|
|
5741
|
+
]);
|
|
5678
5742
|
}
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
rpc,
|
|
5682
|
-
addresses,
|
|
5683
|
-
config
|
|
5684
|
-
);
|
|
5685
|
-
kit.assertAccountsExist(maybeAccounts);
|
|
5686
|
-
return maybeAccounts;
|
|
5743
|
+
function getMigrateArgsCodec() {
|
|
5744
|
+
return kit.combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
5687
5745
|
}
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
);
|
|
5746
|
+
function getMigratedPoolHookConfigEncoder() {
|
|
5747
|
+
return kit.getStructEncoder([
|
|
5748
|
+
["hookProgram", kit.getAddressEncoder()],
|
|
5749
|
+
["hookFlags", kit.getU32Encoder()]
|
|
5750
|
+
]);
|
|
5693
5751
|
}
|
|
5694
|
-
function
|
|
5695
|
-
return
|
|
5752
|
+
function getMigratedPoolHookConfigDecoder() {
|
|
5753
|
+
return kit.getStructDecoder([
|
|
5754
|
+
["hookProgram", kit.getAddressDecoder()],
|
|
5755
|
+
["hookFlags", kit.getU32Decoder()]
|
|
5756
|
+
]);
|
|
5696
5757
|
}
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
202,
|
|
5703
|
-
255,
|
|
5704
|
-
218,
|
|
5705
|
-
233
|
|
5706
|
-
]);
|
|
5707
|
-
function getAddCosignerDiscriminatorBytes2() {
|
|
5708
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5709
|
-
ADD_COSIGNER_DISCRIMINATOR2
|
|
5710
|
-
);
|
|
5758
|
+
function getRecipientEncoder() {
|
|
5759
|
+
return kit.getStructEncoder([
|
|
5760
|
+
["wallet", kit.getAddressEncoder()],
|
|
5761
|
+
["amount", kit.getU64Encoder()]
|
|
5762
|
+
]);
|
|
5711
5763
|
}
|
|
5712
|
-
function
|
|
5713
|
-
return kit.
|
|
5714
|
-
kit.
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
);
|
|
5764
|
+
function getRecipientDecoder() {
|
|
5765
|
+
return kit.getStructDecoder([
|
|
5766
|
+
["wallet", kit.getAddressDecoder()],
|
|
5767
|
+
["amount", kit.getU64Decoder()]
|
|
5768
|
+
]);
|
|
5769
|
+
}
|
|
5770
|
+
function getRecipientCodec() {
|
|
5771
|
+
return kit.combineCodec(getRecipientEncoder(), getRecipientDecoder());
|
|
5720
5772
|
}
|
|
5721
|
-
function
|
|
5773
|
+
function getRegisterLaunchArgsEncoder() {
|
|
5774
|
+
return kit.getStructEncoder([
|
|
5775
|
+
["cpmmConfig", kit.getAddressEncoder()],
|
|
5776
|
+
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
5777
|
+
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
5778
|
+
["recipients", kit.getArrayEncoder(getRecipientEncoder())],
|
|
5779
|
+
["minRaiseQuote", kit.getU64Encoder()],
|
|
5780
|
+
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
5781
|
+
[
|
|
5782
|
+
"migratedPoolHookConfig",
|
|
5783
|
+
kit.getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
5784
|
+
]
|
|
5785
|
+
]);
|
|
5786
|
+
}
|
|
5787
|
+
function getRegisterLaunchArgsDecoder() {
|
|
5722
5788
|
return kit.getStructDecoder([
|
|
5723
|
-
["
|
|
5724
|
-
["
|
|
5789
|
+
["cpmmConfig", kit.getAddressDecoder()],
|
|
5790
|
+
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
5791
|
+
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
5792
|
+
["recipients", kit.getArrayDecoder(getRecipientDecoder())],
|
|
5793
|
+
["minRaiseQuote", kit.getU64Decoder()],
|
|
5794
|
+
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
5795
|
+
[
|
|
5796
|
+
"migratedPoolHookConfig",
|
|
5797
|
+
kit.getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
5798
|
+
]
|
|
5725
5799
|
]);
|
|
5726
5800
|
}
|
|
5727
|
-
function
|
|
5801
|
+
function getRegisterLaunchArgsCodec() {
|
|
5728
5802
|
return kit.combineCodec(
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
);
|
|
5732
|
-
}
|
|
5733
|
-
async function getAddCosignerInstructionAsync2(input, config) {
|
|
5734
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5735
|
-
const originalAccounts = {
|
|
5736
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5737
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
5738
|
-
};
|
|
5739
|
-
const accounts = originalAccounts;
|
|
5740
|
-
const args = { ...input };
|
|
5741
|
-
if (!accounts.config.value) {
|
|
5742
|
-
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
5743
|
-
programAddress,
|
|
5744
|
-
seeds: [
|
|
5745
|
-
kit.getBytesEncoder().encode(
|
|
5746
|
-
new Uint8Array([
|
|
5747
|
-
99,
|
|
5748
|
-
111,
|
|
5749
|
-
115,
|
|
5750
|
-
105,
|
|
5751
|
-
103,
|
|
5752
|
-
110,
|
|
5753
|
-
101,
|
|
5754
|
-
114,
|
|
5755
|
-
95,
|
|
5756
|
-
104,
|
|
5757
|
-
111,
|
|
5758
|
-
111,
|
|
5759
|
-
107,
|
|
5760
|
-
95,
|
|
5761
|
-
99,
|
|
5762
|
-
111,
|
|
5763
|
-
110,
|
|
5764
|
-
102,
|
|
5765
|
-
105,
|
|
5766
|
-
103
|
|
5767
|
-
])
|
|
5768
|
-
)
|
|
5769
|
-
]
|
|
5770
|
-
});
|
|
5771
|
-
}
|
|
5772
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5773
|
-
return Object.freeze({
|
|
5774
|
-
accounts: [
|
|
5775
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5776
|
-
getAccountMeta("config", accounts.config)
|
|
5777
|
-
],
|
|
5778
|
-
data: getAddCosignerInstructionDataEncoder2().encode(
|
|
5779
|
-
args
|
|
5780
|
-
),
|
|
5781
|
-
programAddress
|
|
5782
|
-
});
|
|
5783
|
-
}
|
|
5784
|
-
function getAddCosignerInstruction2(input, config) {
|
|
5785
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5786
|
-
const originalAccounts = {
|
|
5787
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5788
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
5789
|
-
};
|
|
5790
|
-
const accounts = originalAccounts;
|
|
5791
|
-
const args = { ...input };
|
|
5792
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5793
|
-
return Object.freeze({
|
|
5794
|
-
accounts: [
|
|
5795
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5796
|
-
getAccountMeta("config", accounts.config)
|
|
5797
|
-
],
|
|
5798
|
-
data: getAddCosignerInstructionDataEncoder2().encode(
|
|
5799
|
-
args
|
|
5800
|
-
),
|
|
5801
|
-
programAddress
|
|
5802
|
-
});
|
|
5803
|
-
}
|
|
5804
|
-
function parseAddCosignerInstruction2(instruction) {
|
|
5805
|
-
if (instruction.accounts.length < 2) {
|
|
5806
|
-
throw new kit.SolanaError(
|
|
5807
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
5808
|
-
{
|
|
5809
|
-
actualAccountMetas: instruction.accounts.length,
|
|
5810
|
-
expectedAccountMetas: 2
|
|
5811
|
-
}
|
|
5812
|
-
);
|
|
5813
|
-
}
|
|
5814
|
-
let accountIndex = 0;
|
|
5815
|
-
const getNextAccount = () => {
|
|
5816
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
5817
|
-
accountIndex += 1;
|
|
5818
|
-
return accountMeta;
|
|
5819
|
-
};
|
|
5820
|
-
return {
|
|
5821
|
-
programAddress: instruction.programAddress,
|
|
5822
|
-
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
5823
|
-
data: getAddCosignerInstructionDataDecoder2().decode(instruction.data)
|
|
5824
|
-
};
|
|
5825
|
-
}
|
|
5826
|
-
var INITIALIZE_CONFIG_DISCRIMINATOR4 = new Uint8Array([
|
|
5827
|
-
208,
|
|
5828
|
-
127,
|
|
5829
|
-
21,
|
|
5830
|
-
1,
|
|
5831
|
-
194,
|
|
5832
|
-
190,
|
|
5833
|
-
196,
|
|
5834
|
-
70
|
|
5835
|
-
]);
|
|
5836
|
-
function getInitializeConfigDiscriminatorBytes3() {
|
|
5837
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5838
|
-
INITIALIZE_CONFIG_DISCRIMINATOR4
|
|
5839
|
-
);
|
|
5840
|
-
}
|
|
5841
|
-
function getInitializeConfigInstructionDataEncoder4() {
|
|
5842
|
-
return kit.transformEncoder(
|
|
5843
|
-
kit.getStructEncoder([
|
|
5844
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5845
|
-
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
5846
|
-
]),
|
|
5847
|
-
(value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR4 })
|
|
5848
|
-
);
|
|
5849
|
-
}
|
|
5850
|
-
function getInitializeConfigInstructionDataDecoder3() {
|
|
5851
|
-
return kit.getStructDecoder([
|
|
5852
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5853
|
-
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
5854
|
-
]);
|
|
5855
|
-
}
|
|
5856
|
-
function getInitializeConfigInstructionDataCodec3() {
|
|
5857
|
-
return kit.combineCodec(
|
|
5858
|
-
getInitializeConfigInstructionDataEncoder4(),
|
|
5859
|
-
getInitializeConfigInstructionDataDecoder3()
|
|
5860
|
-
);
|
|
5861
|
-
}
|
|
5862
|
-
async function getInitializeConfigInstructionAsync4(input, config) {
|
|
5863
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5864
|
-
const originalAccounts = {
|
|
5865
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
5866
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5867
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
5868
|
-
programData: { value: input.programData ?? null, isWritable: false },
|
|
5869
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
5870
|
-
};
|
|
5871
|
-
const accounts = originalAccounts;
|
|
5872
|
-
const args = { ...input };
|
|
5873
|
-
if (!accounts.config.value) {
|
|
5874
|
-
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
5875
|
-
programAddress,
|
|
5876
|
-
seeds: [
|
|
5877
|
-
kit.getBytesEncoder().encode(
|
|
5878
|
-
new Uint8Array([
|
|
5879
|
-
99,
|
|
5880
|
-
111,
|
|
5881
|
-
115,
|
|
5882
|
-
105,
|
|
5883
|
-
103,
|
|
5884
|
-
110,
|
|
5885
|
-
101,
|
|
5886
|
-
114,
|
|
5887
|
-
95,
|
|
5888
|
-
104,
|
|
5889
|
-
111,
|
|
5890
|
-
111,
|
|
5891
|
-
107,
|
|
5892
|
-
95,
|
|
5893
|
-
99,
|
|
5894
|
-
111,
|
|
5895
|
-
110,
|
|
5896
|
-
102,
|
|
5897
|
-
105,
|
|
5898
|
-
103
|
|
5899
|
-
])
|
|
5900
|
-
)
|
|
5901
|
-
]
|
|
5902
|
-
});
|
|
5903
|
-
}
|
|
5904
|
-
if (!accounts.systemProgram.value) {
|
|
5905
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5906
|
-
}
|
|
5907
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5908
|
-
return Object.freeze({
|
|
5909
|
-
accounts: [
|
|
5910
|
-
getAccountMeta("payer", accounts.payer),
|
|
5911
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5912
|
-
getAccountMeta("config", accounts.config),
|
|
5913
|
-
getAccountMeta("programData", accounts.programData),
|
|
5914
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
5915
|
-
],
|
|
5916
|
-
data: getInitializeConfigInstructionDataEncoder4().encode(
|
|
5917
|
-
args
|
|
5918
|
-
),
|
|
5919
|
-
programAddress
|
|
5920
|
-
});
|
|
5921
|
-
}
|
|
5922
|
-
function getInitializeConfigInstruction3(input, config) {
|
|
5923
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
5924
|
-
const originalAccounts = {
|
|
5925
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
5926
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
5927
|
-
config: { value: input.config ?? null, isWritable: true },
|
|
5928
|
-
programData: { value: input.programData ?? null, isWritable: false },
|
|
5929
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
5930
|
-
};
|
|
5931
|
-
const accounts = originalAccounts;
|
|
5932
|
-
const args = { ...input };
|
|
5933
|
-
if (!accounts.systemProgram.value) {
|
|
5934
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5935
|
-
}
|
|
5936
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5937
|
-
return Object.freeze({
|
|
5938
|
-
accounts: [
|
|
5939
|
-
getAccountMeta("payer", accounts.payer),
|
|
5940
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
5941
|
-
getAccountMeta("config", accounts.config),
|
|
5942
|
-
getAccountMeta("programData", accounts.programData),
|
|
5943
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
5944
|
-
],
|
|
5945
|
-
data: getInitializeConfigInstructionDataEncoder4().encode(
|
|
5946
|
-
args
|
|
5947
|
-
),
|
|
5948
|
-
programAddress
|
|
5949
|
-
});
|
|
5950
|
-
}
|
|
5951
|
-
function parseInitializeConfigInstruction4(instruction) {
|
|
5952
|
-
if (instruction.accounts.length < 5) {
|
|
5953
|
-
throw new kit.SolanaError(
|
|
5954
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
5955
|
-
{
|
|
5956
|
-
actualAccountMetas: instruction.accounts.length,
|
|
5957
|
-
expectedAccountMetas: 5
|
|
5958
|
-
}
|
|
5959
|
-
);
|
|
5960
|
-
}
|
|
5961
|
-
let accountIndex = 0;
|
|
5962
|
-
const getNextAccount = () => {
|
|
5963
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
5964
|
-
accountIndex += 1;
|
|
5965
|
-
return accountMeta;
|
|
5966
|
-
};
|
|
5967
|
-
return {
|
|
5968
|
-
programAddress: instruction.programAddress,
|
|
5969
|
-
accounts: {
|
|
5970
|
-
payer: getNextAccount(),
|
|
5971
|
-
adminAuthority: getNextAccount(),
|
|
5972
|
-
config: getNextAccount(),
|
|
5973
|
-
programData: getNextAccount(),
|
|
5974
|
-
systemProgram: getNextAccount()
|
|
5975
|
-
},
|
|
5976
|
-
data: getInitializeConfigInstructionDataDecoder3().decode(instruction.data)
|
|
5977
|
-
};
|
|
5978
|
-
}
|
|
5979
|
-
var REMOVE_COSIGNER_DISCRIMINATOR2 = new Uint8Array([
|
|
5980
|
-
174,
|
|
5981
|
-
11,
|
|
5982
|
-
171,
|
|
5983
|
-
252,
|
|
5984
|
-
179,
|
|
5985
|
-
99,
|
|
5986
|
-
220,
|
|
5987
|
-
27
|
|
5988
|
-
]);
|
|
5989
|
-
function getRemoveCosignerDiscriminatorBytes2() {
|
|
5990
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
5991
|
-
REMOVE_COSIGNER_DISCRIMINATOR2
|
|
5992
|
-
);
|
|
5993
|
-
}
|
|
5994
|
-
function getRemoveCosignerInstructionDataEncoder2() {
|
|
5995
|
-
return kit.transformEncoder(
|
|
5996
|
-
kit.getStructEncoder([
|
|
5997
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5998
|
-
["cosigner", kit.getAddressEncoder()]
|
|
5999
|
-
]),
|
|
6000
|
-
(value) => ({ ...value, discriminator: REMOVE_COSIGNER_DISCRIMINATOR2 })
|
|
6001
|
-
);
|
|
6002
|
-
}
|
|
6003
|
-
function getRemoveCosignerInstructionDataDecoder2() {
|
|
6004
|
-
return kit.getStructDecoder([
|
|
6005
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
6006
|
-
["cosigner", kit.getAddressDecoder()]
|
|
6007
|
-
]);
|
|
6008
|
-
}
|
|
6009
|
-
function getRemoveCosignerInstructionDataCodec2() {
|
|
6010
|
-
return kit.combineCodec(
|
|
6011
|
-
getRemoveCosignerInstructionDataEncoder2(),
|
|
6012
|
-
getRemoveCosignerInstructionDataDecoder2()
|
|
6013
|
-
);
|
|
6014
|
-
}
|
|
6015
|
-
async function getRemoveCosignerInstructionAsync2(input, config) {
|
|
6016
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6017
|
-
const originalAccounts = {
|
|
6018
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6019
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6020
|
-
};
|
|
6021
|
-
const accounts = originalAccounts;
|
|
6022
|
-
const args = { ...input };
|
|
6023
|
-
if (!accounts.config.value) {
|
|
6024
|
-
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
6025
|
-
programAddress,
|
|
6026
|
-
seeds: [
|
|
6027
|
-
kit.getBytesEncoder().encode(
|
|
6028
|
-
new Uint8Array([
|
|
6029
|
-
99,
|
|
6030
|
-
111,
|
|
6031
|
-
115,
|
|
6032
|
-
105,
|
|
6033
|
-
103,
|
|
6034
|
-
110,
|
|
6035
|
-
101,
|
|
6036
|
-
114,
|
|
6037
|
-
95,
|
|
6038
|
-
104,
|
|
6039
|
-
111,
|
|
6040
|
-
111,
|
|
6041
|
-
107,
|
|
6042
|
-
95,
|
|
6043
|
-
99,
|
|
6044
|
-
111,
|
|
6045
|
-
110,
|
|
6046
|
-
102,
|
|
6047
|
-
105,
|
|
6048
|
-
103
|
|
6049
|
-
])
|
|
6050
|
-
)
|
|
6051
|
-
]
|
|
6052
|
-
});
|
|
6053
|
-
}
|
|
6054
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6055
|
-
return Object.freeze({
|
|
6056
|
-
accounts: [
|
|
6057
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6058
|
-
getAccountMeta("config", accounts.config)
|
|
6059
|
-
],
|
|
6060
|
-
data: getRemoveCosignerInstructionDataEncoder2().encode(
|
|
6061
|
-
args
|
|
6062
|
-
),
|
|
6063
|
-
programAddress
|
|
6064
|
-
});
|
|
6065
|
-
}
|
|
6066
|
-
function getRemoveCosignerInstruction2(input, config) {
|
|
6067
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6068
|
-
const originalAccounts = {
|
|
6069
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6070
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6071
|
-
};
|
|
6072
|
-
const accounts = originalAccounts;
|
|
6073
|
-
const args = { ...input };
|
|
6074
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6075
|
-
return Object.freeze({
|
|
6076
|
-
accounts: [
|
|
6077
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6078
|
-
getAccountMeta("config", accounts.config)
|
|
6079
|
-
],
|
|
6080
|
-
data: getRemoveCosignerInstructionDataEncoder2().encode(
|
|
6081
|
-
args
|
|
6082
|
-
),
|
|
6083
|
-
programAddress
|
|
6084
|
-
});
|
|
6085
|
-
}
|
|
6086
|
-
function parseRemoveCosignerInstruction2(instruction) {
|
|
6087
|
-
if (instruction.accounts.length < 2) {
|
|
6088
|
-
throw new kit.SolanaError(
|
|
6089
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
6090
|
-
{
|
|
6091
|
-
actualAccountMetas: instruction.accounts.length,
|
|
6092
|
-
expectedAccountMetas: 2
|
|
6093
|
-
}
|
|
6094
|
-
);
|
|
6095
|
-
}
|
|
6096
|
-
let accountIndex = 0;
|
|
6097
|
-
const getNextAccount = () => {
|
|
6098
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
6099
|
-
accountIndex += 1;
|
|
6100
|
-
return accountMeta;
|
|
6101
|
-
};
|
|
6102
|
-
return {
|
|
6103
|
-
programAddress: instruction.programAddress,
|
|
6104
|
-
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
6105
|
-
data: getRemoveCosignerInstructionDataDecoder2().decode(instruction.data)
|
|
6106
|
-
};
|
|
6107
|
-
}
|
|
6108
|
-
var SET_AUTHORITY_DISCRIMINATOR2 = new Uint8Array([
|
|
6109
|
-
133,
|
|
6110
|
-
250,
|
|
6111
|
-
37,
|
|
6112
|
-
21,
|
|
6113
|
-
110,
|
|
6114
|
-
163,
|
|
6115
|
-
26,
|
|
6116
|
-
121
|
|
6117
|
-
]);
|
|
6118
|
-
function getSetAuthorityDiscriminatorBytes2() {
|
|
6119
|
-
return kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6120
|
-
SET_AUTHORITY_DISCRIMINATOR2
|
|
6121
|
-
);
|
|
6122
|
-
}
|
|
6123
|
-
function getSetAuthorityInstructionDataEncoder2() {
|
|
6124
|
-
return kit.transformEncoder(
|
|
6125
|
-
kit.getStructEncoder([
|
|
6126
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
6127
|
-
["adminAuthority", kit.getAddressEncoder()]
|
|
6128
|
-
]),
|
|
6129
|
-
(value) => ({ ...value, discriminator: SET_AUTHORITY_DISCRIMINATOR2 })
|
|
6130
|
-
);
|
|
6131
|
-
}
|
|
6132
|
-
function getSetAuthorityInstructionDataDecoder2() {
|
|
6133
|
-
return kit.getStructDecoder([
|
|
6134
|
-
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
6135
|
-
["adminAuthority", kit.getAddressDecoder()]
|
|
6136
|
-
]);
|
|
6137
|
-
}
|
|
6138
|
-
function getSetAuthorityInstructionDataCodec2() {
|
|
6139
|
-
return kit.combineCodec(
|
|
6140
|
-
getSetAuthorityInstructionDataEncoder2(),
|
|
6141
|
-
getSetAuthorityInstructionDataDecoder2()
|
|
6142
|
-
);
|
|
6143
|
-
}
|
|
6144
|
-
async function getSetAuthorityInstructionAsync2(input, config) {
|
|
6145
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6146
|
-
const originalAccounts = {
|
|
6147
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6148
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6149
|
-
};
|
|
6150
|
-
const accounts = originalAccounts;
|
|
6151
|
-
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
6152
|
-
if (!accounts.config.value) {
|
|
6153
|
-
accounts.config.value = await kit.getProgramDerivedAddress({
|
|
6154
|
-
programAddress,
|
|
6155
|
-
seeds: [
|
|
6156
|
-
kit.getBytesEncoder().encode(
|
|
6157
|
-
new Uint8Array([
|
|
6158
|
-
99,
|
|
6159
|
-
111,
|
|
6160
|
-
115,
|
|
6161
|
-
105,
|
|
6162
|
-
103,
|
|
6163
|
-
110,
|
|
6164
|
-
101,
|
|
6165
|
-
114,
|
|
6166
|
-
95,
|
|
6167
|
-
104,
|
|
6168
|
-
111,
|
|
6169
|
-
111,
|
|
6170
|
-
107,
|
|
6171
|
-
95,
|
|
6172
|
-
99,
|
|
6173
|
-
111,
|
|
6174
|
-
110,
|
|
6175
|
-
102,
|
|
6176
|
-
105,
|
|
6177
|
-
103
|
|
6178
|
-
])
|
|
6179
|
-
)
|
|
6180
|
-
]
|
|
6181
|
-
});
|
|
6182
|
-
}
|
|
6183
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6184
|
-
return Object.freeze({
|
|
6185
|
-
accounts: [
|
|
6186
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6187
|
-
getAccountMeta("config", accounts.config)
|
|
6188
|
-
],
|
|
6189
|
-
data: getSetAuthorityInstructionDataEncoder2().encode(
|
|
6190
|
-
args
|
|
6191
|
-
),
|
|
6192
|
-
programAddress
|
|
6193
|
-
});
|
|
6194
|
-
}
|
|
6195
|
-
function getSetAuthorityInstruction2(input, config) {
|
|
6196
|
-
const programAddress = config?.programAddress ?? DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS;
|
|
6197
|
-
const originalAccounts = {
|
|
6198
|
-
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
6199
|
-
config: { value: input.config ?? null, isWritable: true }
|
|
6200
|
-
};
|
|
6201
|
-
const accounts = originalAccounts;
|
|
6202
|
-
const args = { ...input, adminAuthority: input.adminAuthorityArg };
|
|
6203
|
-
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6204
|
-
return Object.freeze({
|
|
6205
|
-
accounts: [
|
|
6206
|
-
getAccountMeta("adminAuthority", accounts.adminAuthority),
|
|
6207
|
-
getAccountMeta("config", accounts.config)
|
|
6208
|
-
],
|
|
6209
|
-
data: getSetAuthorityInstructionDataEncoder2().encode(
|
|
6210
|
-
args
|
|
6211
|
-
),
|
|
6212
|
-
programAddress
|
|
6213
|
-
});
|
|
6214
|
-
}
|
|
6215
|
-
function parseSetAuthorityInstruction2(instruction) {
|
|
6216
|
-
if (instruction.accounts.length < 2) {
|
|
6217
|
-
throw new kit.SolanaError(
|
|
6218
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
6219
|
-
{
|
|
6220
|
-
actualAccountMetas: instruction.accounts.length,
|
|
6221
|
-
expectedAccountMetas: 2
|
|
6222
|
-
}
|
|
6223
|
-
);
|
|
6224
|
-
}
|
|
6225
|
-
let accountIndex = 0;
|
|
6226
|
-
const getNextAccount = () => {
|
|
6227
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
6228
|
-
accountIndex += 1;
|
|
6229
|
-
return accountMeta;
|
|
6230
|
-
};
|
|
6231
|
-
return {
|
|
6232
|
-
programAddress: instruction.programAddress,
|
|
6233
|
-
accounts: { adminAuthority: getNextAccount(), config: getNextAccount() },
|
|
6234
|
-
data: getSetAuthorityInstructionDataDecoder2().decode(instruction.data)
|
|
6235
|
-
};
|
|
6236
|
-
}
|
|
6237
|
-
|
|
6238
|
-
// src/solana/generated/dynamicFeeHook/programs/dynamicFeeHook.ts
|
|
6239
|
-
var DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS = "HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i";
|
|
6240
|
-
var DynamicFeeHookAccount = /* @__PURE__ */ ((DynamicFeeHookAccount2) => {
|
|
6241
|
-
DynamicFeeHookAccount2[DynamicFeeHookAccount2["CosignerConfig"] = 0] = "CosignerConfig";
|
|
6242
|
-
return DynamicFeeHookAccount2;
|
|
6243
|
-
})(DynamicFeeHookAccount || {});
|
|
6244
|
-
function identifyDynamicFeeHookAccount(account) {
|
|
6245
|
-
const data = "data" in account ? account.data : account;
|
|
6246
|
-
if (kit.containsBytes(
|
|
6247
|
-
data,
|
|
6248
|
-
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6249
|
-
new Uint8Array([133, 227, 177, 74, 145, 74, 247, 183])
|
|
6250
|
-
),
|
|
6251
|
-
0
|
|
6252
|
-
)) {
|
|
6253
|
-
return 0 /* CosignerConfig */;
|
|
6254
|
-
}
|
|
6255
|
-
throw new kit.SolanaError(
|
|
6256
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
6257
|
-
{ accountData: data, programName: "dynamicFeeHook" }
|
|
6258
|
-
);
|
|
6259
|
-
}
|
|
6260
|
-
var DynamicFeeHookInstruction = /* @__PURE__ */ ((DynamicFeeHookInstruction2) => {
|
|
6261
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["AddCosigner"] = 0] = "AddCosigner";
|
|
6262
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["InitializeConfig"] = 1] = "InitializeConfig";
|
|
6263
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["RemoveCosigner"] = 2] = "RemoveCosigner";
|
|
6264
|
-
DynamicFeeHookInstruction2[DynamicFeeHookInstruction2["SetAuthority"] = 3] = "SetAuthority";
|
|
6265
|
-
return DynamicFeeHookInstruction2;
|
|
6266
|
-
})(DynamicFeeHookInstruction || {});
|
|
6267
|
-
function identifyDynamicFeeHookInstruction(instruction) {
|
|
6268
|
-
const data = "data" in instruction ? instruction.data : instruction;
|
|
6269
|
-
if (kit.containsBytes(
|
|
6270
|
-
data,
|
|
6271
|
-
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6272
|
-
new Uint8Array([17, 34, 183, 119, 202, 255, 218, 233])
|
|
6273
|
-
),
|
|
6274
|
-
0
|
|
6275
|
-
)) {
|
|
6276
|
-
return 0 /* AddCosigner */;
|
|
6277
|
-
}
|
|
6278
|
-
if (kit.containsBytes(
|
|
6279
|
-
data,
|
|
6280
|
-
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6281
|
-
new Uint8Array([208, 127, 21, 1, 194, 190, 196, 70])
|
|
6282
|
-
),
|
|
6283
|
-
0
|
|
6284
|
-
)) {
|
|
6285
|
-
return 1 /* InitializeConfig */;
|
|
6286
|
-
}
|
|
6287
|
-
if (kit.containsBytes(
|
|
6288
|
-
data,
|
|
6289
|
-
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6290
|
-
new Uint8Array([174, 11, 171, 252, 179, 99, 220, 27])
|
|
6291
|
-
),
|
|
6292
|
-
0
|
|
6293
|
-
)) {
|
|
6294
|
-
return 2 /* RemoveCosigner */;
|
|
6295
|
-
}
|
|
6296
|
-
if (kit.containsBytes(
|
|
6297
|
-
data,
|
|
6298
|
-
kit.fixEncoderSize(kit.getBytesEncoder(), 8).encode(
|
|
6299
|
-
new Uint8Array([133, 250, 37, 21, 110, 163, 26, 121])
|
|
6300
|
-
),
|
|
6301
|
-
0
|
|
6302
|
-
)) {
|
|
6303
|
-
return 3 /* SetAuthority */;
|
|
6304
|
-
}
|
|
6305
|
-
throw new kit.SolanaError(
|
|
6306
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
6307
|
-
{ instructionData: data, programName: "dynamicFeeHook" }
|
|
6308
|
-
);
|
|
6309
|
-
}
|
|
6310
|
-
function parseDynamicFeeHookInstruction(instruction) {
|
|
6311
|
-
const instructionType = identifyDynamicFeeHookInstruction(instruction);
|
|
6312
|
-
switch (instructionType) {
|
|
6313
|
-
case 0 /* AddCosigner */: {
|
|
6314
|
-
kit.assertIsInstructionWithAccounts(instruction);
|
|
6315
|
-
return {
|
|
6316
|
-
instructionType: 0 /* AddCosigner */,
|
|
6317
|
-
...parseAddCosignerInstruction2(instruction)
|
|
6318
|
-
};
|
|
6319
|
-
}
|
|
6320
|
-
case 1 /* InitializeConfig */: {
|
|
6321
|
-
kit.assertIsInstructionWithAccounts(instruction);
|
|
6322
|
-
return {
|
|
6323
|
-
instructionType: 1 /* InitializeConfig */,
|
|
6324
|
-
...parseInitializeConfigInstruction4(instruction)
|
|
6325
|
-
};
|
|
6326
|
-
}
|
|
6327
|
-
case 2 /* RemoveCosigner */: {
|
|
6328
|
-
kit.assertIsInstructionWithAccounts(instruction);
|
|
6329
|
-
return {
|
|
6330
|
-
instructionType: 2 /* RemoveCosigner */,
|
|
6331
|
-
...parseRemoveCosignerInstruction2(instruction)
|
|
6332
|
-
};
|
|
6333
|
-
}
|
|
6334
|
-
case 3 /* SetAuthority */: {
|
|
6335
|
-
kit.assertIsInstructionWithAccounts(instruction);
|
|
6336
|
-
return {
|
|
6337
|
-
instructionType: 3 /* SetAuthority */,
|
|
6338
|
-
...parseSetAuthorityInstruction2(instruction)
|
|
6339
|
-
};
|
|
6340
|
-
}
|
|
6341
|
-
default:
|
|
6342
|
-
throw new kit.SolanaError(
|
|
6343
|
-
kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
6344
|
-
{
|
|
6345
|
-
instructionType,
|
|
6346
|
-
programName: "dynamicFeeHook"
|
|
6347
|
-
}
|
|
6348
|
-
);
|
|
6349
|
-
}
|
|
6350
|
-
}
|
|
6351
|
-
function dynamicFeeHookProgram() {
|
|
6352
|
-
return (client) => {
|
|
6353
|
-
return {
|
|
6354
|
-
...client,
|
|
6355
|
-
dynamicFeeHook: {
|
|
6356
|
-
accounts: {
|
|
6357
|
-
cosignerConfig: programClientCore.addSelfFetchFunctions(
|
|
6358
|
-
client,
|
|
6359
|
-
getCosignerConfigCodec2()
|
|
6360
|
-
)
|
|
6361
|
-
},
|
|
6362
|
-
instructions: {
|
|
6363
|
-
addCosigner: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6364
|
-
client,
|
|
6365
|
-
getAddCosignerInstructionAsync2(input)
|
|
6366
|
-
),
|
|
6367
|
-
initializeConfig: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6368
|
-
client,
|
|
6369
|
-
getInitializeConfigInstructionAsync4({
|
|
6370
|
-
...input,
|
|
6371
|
-
payer: input.payer ?? client.payer
|
|
6372
|
-
})
|
|
6373
|
-
),
|
|
6374
|
-
removeCosigner: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6375
|
-
client,
|
|
6376
|
-
getRemoveCosignerInstructionAsync2(input)
|
|
6377
|
-
),
|
|
6378
|
-
setAuthority: (input) => programClientCore.addSelfPlanAndSendFunctions(
|
|
6379
|
-
client,
|
|
6380
|
-
getSetAuthorityInstructionAsync2(input)
|
|
6381
|
-
)
|
|
6382
|
-
}
|
|
6383
|
-
}
|
|
6384
|
-
};
|
|
6385
|
-
};
|
|
6386
|
-
}
|
|
6387
|
-
|
|
6388
|
-
// src/solana/generated/dynamicFeeHook/errors/dynamicFeeHook.ts
|
|
6389
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA = 6e3;
|
|
6390
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA = 6001;
|
|
6391
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE = 6002;
|
|
6392
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION = 6003;
|
|
6393
|
-
var DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW = 6004;
|
|
6394
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY = 6005;
|
|
6395
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG = 6006;
|
|
6396
|
-
var DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER = 6007;
|
|
6397
|
-
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS = 6008;
|
|
6398
|
-
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND = 6009;
|
|
6399
|
-
var DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL = 6010;
|
|
6400
|
-
var dynamicFeeHookErrorMessages;
|
|
6401
|
-
if (process.env.NODE_ENV !== "production") {
|
|
6402
|
-
dynamicFeeHookErrorMessages = {
|
|
6403
|
-
[DYNAMIC_FEE_HOOK_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic overflow`,
|
|
6404
|
-
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_ALREADY_EXISTS]: `Cosigner already exists`,
|
|
6405
|
-
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_LIST_FULL]: `Cosigner list is full`,
|
|
6406
|
-
[DYNAMIC_FEE_HOOK_ERROR__COSIGNER_NOT_FOUND]: `Cosigner not found`,
|
|
6407
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_AUTHORITY]: `Invalid hook authority`,
|
|
6408
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_CONFIG]: `Invalid cosigner hook config`,
|
|
6409
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_COSIGNER]: `Invalid cosigner key`,
|
|
6410
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_DURATION]: `Invalid fee duration`,
|
|
6411
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_FEE]: `Invalid fee`,
|
|
6412
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
|
|
6413
|
-
[DYNAMIC_FEE_HOOK_ERROR__INVALID_SCHEDULE_DATA]: `Invalid schedule payload`
|
|
6414
|
-
};
|
|
6415
|
-
}
|
|
6416
|
-
function getDynamicFeeHookErrorMessage(code) {
|
|
6417
|
-
if (process.env.NODE_ENV !== "production") {
|
|
6418
|
-
return dynamicFeeHookErrorMessages[code];
|
|
6419
|
-
}
|
|
6420
|
-
return "Error message not available in production bundles.";
|
|
6421
|
-
}
|
|
6422
|
-
function isDynamicFeeHookError(error, transactionMessage, code) {
|
|
6423
|
-
return kit.isProgramError(
|
|
6424
|
-
error,
|
|
6425
|
-
transactionMessage,
|
|
6426
|
-
DYNAMIC_FEE_HOOK_PROGRAM_ADDRESS,
|
|
6427
|
-
code
|
|
6428
|
-
);
|
|
6429
|
-
}
|
|
6430
|
-
function getCosignerArgEncoder2() {
|
|
6431
|
-
return kit.getStructEncoder([["cosigner", kit.getAddressEncoder()]]);
|
|
6432
|
-
}
|
|
6433
|
-
function getCosignerArgDecoder2() {
|
|
6434
|
-
return kit.getStructDecoder([["cosigner", kit.getAddressDecoder()]]);
|
|
6435
|
-
}
|
|
6436
|
-
function getCosignerArgCodec2() {
|
|
6437
|
-
return kit.combineCodec(getCosignerArgEncoder2(), getCosignerArgDecoder2());
|
|
6438
|
-
}
|
|
6439
|
-
function getInitializeConfigArgsEncoder3() {
|
|
6440
|
-
return kit.getStructEncoder([
|
|
6441
|
-
["cosigners", kit.getArrayEncoder(kit.getAddressEncoder())]
|
|
6442
|
-
]);
|
|
6443
|
-
}
|
|
6444
|
-
function getInitializeConfigArgsDecoder3() {
|
|
6445
|
-
return kit.getStructDecoder([
|
|
6446
|
-
["cosigners", kit.getArrayDecoder(kit.getAddressDecoder())]
|
|
6447
|
-
]);
|
|
6448
|
-
}
|
|
6449
|
-
function getInitializeConfigArgsCodec3() {
|
|
6450
|
-
return kit.combineCodec(
|
|
6451
|
-
getInitializeConfigArgsEncoder3(),
|
|
6452
|
-
getInitializeConfigArgsDecoder3()
|
|
6453
|
-
);
|
|
6454
|
-
}
|
|
6455
|
-
function getSetAuthorityArgsEncoder2() {
|
|
6456
|
-
return kit.getStructEncoder([["adminAuthority", kit.getAddressEncoder()]]);
|
|
6457
|
-
}
|
|
6458
|
-
function getSetAuthorityArgsDecoder2() {
|
|
6459
|
-
return kit.getStructDecoder([["adminAuthority", kit.getAddressDecoder()]]);
|
|
6460
|
-
}
|
|
6461
|
-
function getSetAuthorityArgsCodec2() {
|
|
6462
|
-
return kit.combineCodec(
|
|
6463
|
-
getSetAuthorityArgsEncoder2(),
|
|
6464
|
-
getSetAuthorityArgsDecoder2()
|
|
6465
|
-
);
|
|
6466
|
-
}
|
|
6467
|
-
var DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID = kit.address(
|
|
6468
|
-
"HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i"
|
|
6469
|
-
);
|
|
6470
|
-
var DYNAMIC_FEE_HOOK_PROGRAM_ID = DEVNET_DYNAMIC_FEE_HOOK_PROGRAM_ID;
|
|
6471
|
-
var SEED_DYNAMIC_FEE_HOOK_CONFIG = "cosigner_hook_config";
|
|
6472
|
-
var MAX_COSIGNERS2 = 32;
|
|
6473
|
-
var DYNAMIC_FEE_SCHEDULE_MAGIC = new Uint8Array([
|
|
6474
|
-
68,
|
|
6475
|
-
70,
|
|
6476
|
-
69,
|
|
6477
|
-
69,
|
|
6478
|
-
86,
|
|
6479
|
-
49,
|
|
6480
|
-
95,
|
|
6481
|
-
95
|
|
6482
|
-
]);
|
|
6483
|
-
var DYNAMIC_FEE_SCHEDULE_VERSION = 1;
|
|
6484
|
-
var DYNAMIC_FEE_SCHEDULE_LEN = 32;
|
|
6485
|
-
var DYNAMIC_FEE_SCHEDULE_HEADER_LEN = 16;
|
|
6486
|
-
var DYNAMIC_FEE_SCHEDULE_MAX_BPS = 1e4;
|
|
6487
|
-
|
|
6488
|
-
// src/solana/dynamicFeeHook/payload.ts
|
|
6489
|
-
var MAX_I64 = (1n << 63n) - 1n;
|
|
6490
|
-
var MAX_U32 = (1n << 32n) - 1n;
|
|
6491
|
-
function toBigInt2(value) {
|
|
6492
|
-
return typeof value === "bigint" ? value : BigInt(value);
|
|
6493
|
-
}
|
|
6494
|
-
function assertU16Bps(label, value) {
|
|
6495
|
-
if (!Number.isInteger(value) || value < 0 || value > DYNAMIC_FEE_SCHEDULE_MAX_BPS) {
|
|
6496
|
-
throw new Error(`${label} must be an integer between 0 and 10000`);
|
|
6497
|
-
}
|
|
6498
|
-
}
|
|
6499
|
-
function writeI64Le(bytes, offset, value) {
|
|
6500
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6501
|
-
view.setBigInt64(offset, value, true);
|
|
6502
|
-
}
|
|
6503
|
-
function writeU16Le(bytes, offset, value) {
|
|
6504
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6505
|
-
view.setUint16(offset, value, true);
|
|
6506
|
-
}
|
|
6507
|
-
function writeU32Le(bytes, offset, value) {
|
|
6508
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
6509
|
-
view.setUint32(offset, Number(value), true);
|
|
6510
|
-
}
|
|
6511
|
-
function validateDynamicFeeScheduleArgs(schedule) {
|
|
6512
|
-
const startingTime = toBigInt2(schedule.startingTime);
|
|
6513
|
-
if (startingTime < 0n || startingTime > MAX_I64) {
|
|
6514
|
-
throw new Error("startingTime must be between 0 and i64::MAX");
|
|
6515
|
-
}
|
|
6516
|
-
assertU16Bps("startFeeBps", schedule.startFeeBps);
|
|
6517
|
-
assertU16Bps("endFeeBps", schedule.endFeeBps);
|
|
6518
|
-
if (schedule.endFeeBps > schedule.startFeeBps) {
|
|
6519
|
-
throw new Error("endFeeBps must be less than or equal to startFeeBps");
|
|
6520
|
-
}
|
|
6521
|
-
const durationSeconds = toBigInt2(schedule.durationSeconds);
|
|
6522
|
-
if (durationSeconds < 0n || durationSeconds > MAX_U32) {
|
|
6523
|
-
throw new Error("durationSeconds must be between 0 and u32::MAX");
|
|
6524
|
-
}
|
|
6525
|
-
if (schedule.startFeeBps > schedule.endFeeBps && durationSeconds === 0n) {
|
|
6526
|
-
throw new Error("durationSeconds must be nonzero for decaying schedules");
|
|
6527
|
-
}
|
|
6528
|
-
return { startingTime, durationSeconds };
|
|
6529
|
-
}
|
|
6530
|
-
function encodeDynamicFeeSchedule(schedule) {
|
|
6531
|
-
const { startingTime, durationSeconds } = validateDynamicFeeScheduleArgs(schedule);
|
|
6532
|
-
const payload = new Uint8Array(DYNAMIC_FEE_SCHEDULE_LEN);
|
|
6533
|
-
payload.set(DYNAMIC_FEE_SCHEDULE_MAGIC, 0);
|
|
6534
|
-
payload[8] = DYNAMIC_FEE_SCHEDULE_VERSION;
|
|
6535
|
-
writeI64Le(payload, DYNAMIC_FEE_SCHEDULE_HEADER_LEN, startingTime);
|
|
6536
|
-
writeU16Le(payload, 24, schedule.startFeeBps);
|
|
6537
|
-
writeU16Le(payload, 26, schedule.endFeeBps);
|
|
6538
|
-
writeU32Le(payload, 28, durationSeconds);
|
|
6539
|
-
return payload;
|
|
6540
|
-
}
|
|
6541
|
-
function encodeDynamicFeeHookPayload(args = {}) {
|
|
6542
|
-
const schedulePayload = args.schedule ? encodeDynamicFeeSchedule(args.schedule) : new Uint8Array();
|
|
6543
|
-
const gatePayload = args.gateExpiry ? encodeCosignerGateExpiryPayload(args.gateExpiry) : new Uint8Array();
|
|
6544
|
-
const payload = new Uint8Array(schedulePayload.length + gatePayload.length);
|
|
6545
|
-
payload.set(schedulePayload, 0);
|
|
6546
|
-
payload.set(gatePayload, schedulePayload.length);
|
|
6547
|
-
return payload;
|
|
6548
|
-
}
|
|
6549
|
-
function encodeDynamicFeeCosignerGatePayload(args) {
|
|
6550
|
-
return encodeCosignerGateExpiryPayload(args);
|
|
6551
|
-
}
|
|
6552
|
-
function getDynamicFeeHookRemainingAccounts({
|
|
6553
|
-
namespace,
|
|
6554
|
-
config,
|
|
6555
|
-
cosigner
|
|
6556
|
-
}) {
|
|
6557
|
-
const signedHookRemainingAccounts = [namespace];
|
|
6558
|
-
if (config && config !== namespace) {
|
|
6559
|
-
signedHookRemainingAccounts.push(config);
|
|
6560
|
-
}
|
|
6561
|
-
if (cosigner) {
|
|
6562
|
-
signedHookRemainingAccounts.push(cosigner);
|
|
6563
|
-
}
|
|
6564
|
-
const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
|
|
6565
|
-
chunk4WY5GNZD_cjs.getAddressFromRemainingAccount
|
|
6566
|
-
);
|
|
6567
|
-
return {
|
|
6568
|
-
signedHookRemainingAccounts,
|
|
6569
|
-
unsignedHookRemainingAccounts,
|
|
6570
|
-
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
6571
|
-
unsignedHookRemainingAccounts
|
|
6572
|
-
)
|
|
6573
|
-
};
|
|
6574
|
-
}
|
|
6575
|
-
function getDynamicFeeHookRemainingAccountAddresses({
|
|
6576
|
-
namespace,
|
|
6577
|
-
config,
|
|
6578
|
-
cosigner
|
|
6579
|
-
}) {
|
|
6580
|
-
return getDynamicFeeHookRemainingAccounts({
|
|
6581
|
-
namespace,
|
|
6582
|
-
config,
|
|
6583
|
-
cosigner
|
|
6584
|
-
}).unsignedHookRemainingAccounts;
|
|
6585
|
-
}
|
|
6586
|
-
function isDynamicFeeSchedulePayload(payload) {
|
|
6587
|
-
return payload.length >= DYNAMIC_FEE_SCHEDULE_LEN && DYNAMIC_FEE_SCHEDULE_MAGIC.every((byte, index) => payload[index] === byte);
|
|
6588
|
-
}
|
|
6589
|
-
var textEncoder6 = new TextEncoder();
|
|
6590
|
-
async function getDynamicFeeHookConfigAddress(programId = DYNAMIC_FEE_HOOK_PROGRAM_ID) {
|
|
6591
|
-
return kit.getProgramDerivedAddress({
|
|
6592
|
-
programAddress: programId,
|
|
6593
|
-
seeds: [textEncoder6.encode(SEED_DYNAMIC_FEE_HOOK_CONFIG)]
|
|
6594
|
-
});
|
|
6595
|
-
}
|
|
6596
|
-
|
|
6597
|
-
// src/solana/migrators/cpmmMigrator/index.ts
|
|
6598
|
-
var cpmmMigrator_exports = {};
|
|
6599
|
-
chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
6600
|
-
CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: () => CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS,
|
|
6601
|
-
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: () => CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS,
|
|
6602
|
-
CPMM_MIGRATOR_PROGRAM_ID: () => CPMM_MIGRATOR_PROGRAM_ID,
|
|
6603
|
-
MAX_RECIPIENTS: () => MAX_RECIPIENTS,
|
|
6604
|
-
SEED_MIGRATION_AUTHORITY: () => SEED_MIGRATION_AUTHORITY,
|
|
6605
|
-
SEED_STATE: () => SEED_STATE,
|
|
6606
|
-
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
6607
|
-
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
6608
|
-
encodeMigratePayload: () => encodeMigratePayload,
|
|
6609
|
-
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
6610
|
-
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
6611
|
-
getCpmmMigrationAuthorityAddress: () => getCpmmMigrationAuthorityAddress,
|
|
6612
|
-
getCpmmMigratorStateAddress: () => getCpmmMigratorStateAddress,
|
|
6613
|
-
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
6614
|
-
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
6615
|
-
getCpmmMigratorStateEncoder: () => getCpmmMigratorStateEncoder,
|
|
6616
|
-
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
6617
|
-
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
6618
|
-
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
6619
|
-
getRecipientCodec: () => getRecipientCodec,
|
|
6620
|
-
getRecipientDecoder: () => getRecipientDecoder,
|
|
6621
|
-
getRecipientEncoder: () => getRecipientEncoder,
|
|
6622
|
-
getRegisterLaunchArgsCodec: () => getRegisterLaunchArgsCodec,
|
|
6623
|
-
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
6624
|
-
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
6625
|
-
});
|
|
6626
|
-
function getMigrateArgsEncoder() {
|
|
6627
|
-
return kit.getStructEncoder([
|
|
6628
|
-
["baseForDistribution", kit.getU64Encoder()],
|
|
6629
|
-
["baseForLiquidity", kit.getU64Encoder()]
|
|
6630
|
-
]);
|
|
6631
|
-
}
|
|
6632
|
-
function getMigrateArgsDecoder() {
|
|
6633
|
-
return kit.getStructDecoder([
|
|
6634
|
-
["baseForDistribution", kit.getU64Decoder()],
|
|
6635
|
-
["baseForLiquidity", kit.getU64Decoder()]
|
|
6636
|
-
]);
|
|
6637
|
-
}
|
|
6638
|
-
function getMigrateArgsCodec() {
|
|
6639
|
-
return kit.combineCodec(getMigrateArgsEncoder(), getMigrateArgsDecoder());
|
|
6640
|
-
}
|
|
6641
|
-
function getMigratedPoolHookConfigEncoder() {
|
|
6642
|
-
return kit.getStructEncoder([
|
|
6643
|
-
["hookProgram", kit.getAddressEncoder()],
|
|
6644
|
-
["hookFlags", kit.getU32Encoder()]
|
|
6645
|
-
]);
|
|
6646
|
-
}
|
|
6647
|
-
function getMigratedPoolHookConfigDecoder() {
|
|
6648
|
-
return kit.getStructDecoder([
|
|
6649
|
-
["hookProgram", kit.getAddressDecoder()],
|
|
6650
|
-
["hookFlags", kit.getU32Decoder()]
|
|
6651
|
-
]);
|
|
6652
|
-
}
|
|
6653
|
-
function getRecipientEncoder() {
|
|
6654
|
-
return kit.getStructEncoder([
|
|
6655
|
-
["wallet", kit.getAddressEncoder()],
|
|
6656
|
-
["amount", kit.getU64Encoder()]
|
|
6657
|
-
]);
|
|
6658
|
-
}
|
|
6659
|
-
function getRecipientDecoder() {
|
|
6660
|
-
return kit.getStructDecoder([
|
|
6661
|
-
["wallet", kit.getAddressDecoder()],
|
|
6662
|
-
["amount", kit.getU64Decoder()]
|
|
6663
|
-
]);
|
|
6664
|
-
}
|
|
6665
|
-
function getRecipientCodec() {
|
|
6666
|
-
return kit.combineCodec(getRecipientEncoder(), getRecipientDecoder());
|
|
6667
|
-
}
|
|
6668
|
-
function getRegisterLaunchArgsEncoder() {
|
|
6669
|
-
return kit.getStructEncoder([
|
|
6670
|
-
["cpmmConfig", kit.getAddressEncoder()],
|
|
6671
|
-
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
6672
|
-
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
6673
|
-
["recipients", kit.getArrayEncoder(getRecipientEncoder())],
|
|
6674
|
-
["minRaiseQuote", kit.getU64Encoder()],
|
|
6675
|
-
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
6676
|
-
[
|
|
6677
|
-
"migratedPoolHookConfig",
|
|
6678
|
-
kit.getOptionEncoder(getMigratedPoolHookConfigEncoder())
|
|
6679
|
-
]
|
|
6680
|
-
]);
|
|
6681
|
-
}
|
|
6682
|
-
function getRegisterLaunchArgsDecoder() {
|
|
6683
|
-
return kit.getStructDecoder([
|
|
6684
|
-
["cpmmConfig", kit.getAddressDecoder()],
|
|
6685
|
-
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
6686
|
-
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
6687
|
-
["recipients", kit.getArrayDecoder(getRecipientDecoder())],
|
|
6688
|
-
["minRaiseQuote", kit.getU64Decoder()],
|
|
6689
|
-
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
6690
|
-
[
|
|
6691
|
-
"migratedPoolHookConfig",
|
|
6692
|
-
kit.getOptionDecoder(getMigratedPoolHookConfigDecoder())
|
|
6693
|
-
]
|
|
6694
|
-
]);
|
|
6695
|
-
}
|
|
6696
|
-
function getRegisterLaunchArgsCodec() {
|
|
6697
|
-
return kit.combineCodec(
|
|
6698
|
-
getRegisterLaunchArgsEncoder(),
|
|
6699
|
-
getRegisterLaunchArgsDecoder()
|
|
5803
|
+
getRegisterLaunchArgsEncoder(),
|
|
5804
|
+
getRegisterLaunchArgsDecoder()
|
|
6700
5805
|
);
|
|
6701
5806
|
}
|
|
6702
5807
|
|
|
@@ -6758,14 +5863,409 @@ function getCpmmMigratorStateCodec() {
|
|
|
6758
5863
|
getCpmmMigratorStateDecoder()
|
|
6759
5864
|
);
|
|
6760
5865
|
}
|
|
5866
|
+
var CREATE_SPOT_POOL_DISCRIMINATOR = new Uint8Array([
|
|
5867
|
+
13,
|
|
5868
|
+
137,
|
|
5869
|
+
16,
|
|
5870
|
+
26,
|
|
5871
|
+
40,
|
|
5872
|
+
36,
|
|
5873
|
+
110,
|
|
5874
|
+
26
|
|
5875
|
+
]);
|
|
5876
|
+
function getCreateSpotPoolInstructionDataEncoder() {
|
|
5877
|
+
return kit.transformEncoder(
|
|
5878
|
+
kit.getStructEncoder([
|
|
5879
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5880
|
+
["swapFeeBps", kit.getU16Encoder()],
|
|
5881
|
+
["positionId", kit.getU64Encoder()],
|
|
5882
|
+
["amount0Max", kit.getU64Encoder()],
|
|
5883
|
+
["amount1Max", kit.getU64Encoder()],
|
|
5884
|
+
["minSharesOut", kit.getU128Encoder()]
|
|
5885
|
+
]),
|
|
5886
|
+
(value) => ({ ...value, discriminator: CREATE_SPOT_POOL_DISCRIMINATOR })
|
|
5887
|
+
);
|
|
5888
|
+
}
|
|
5889
|
+
function getCreateSpotPoolInstructionDataDecoder() {
|
|
5890
|
+
return kit.getStructDecoder([
|
|
5891
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5892
|
+
["swapFeeBps", kit.getU16Decoder()],
|
|
5893
|
+
["positionId", kit.getU64Decoder()],
|
|
5894
|
+
["amount0Max", kit.getU64Decoder()],
|
|
5895
|
+
["amount1Max", kit.getU64Decoder()],
|
|
5896
|
+
["minSharesOut", kit.getU128Decoder()]
|
|
5897
|
+
]);
|
|
5898
|
+
}
|
|
5899
|
+
function getCreateSpotPoolInstructionDataCodec() {
|
|
5900
|
+
return kit.combineCodec(
|
|
5901
|
+
getCreateSpotPoolInstructionDataEncoder(),
|
|
5902
|
+
getCreateSpotPoolInstructionDataDecoder()
|
|
5903
|
+
);
|
|
5904
|
+
}
|
|
5905
|
+
async function getCreateSpotPoolInstructionAsync(input, config) {
|
|
5906
|
+
const programAddress = config?.programAddress ?? CPMM_MIGRATOR_PROGRAM_ADDRESS;
|
|
5907
|
+
const originalAccounts = {
|
|
5908
|
+
cpmmConfig: { value: input.cpmmConfig ?? null, isWritable: false },
|
|
5909
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
5910
|
+
liquidityOwner: { value: input.liquidityOwner ?? null, isWritable: false },
|
|
5911
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
5912
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
5913
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
5914
|
+
poolAuthority: { value: input.poolAuthority ?? null, isWritable: false },
|
|
5915
|
+
poolVault0: { value: input.poolVault0 ?? null, isWritable: true },
|
|
5916
|
+
poolVault1: { value: input.poolVault1 ?? null, isWritable: true },
|
|
5917
|
+
protocolFeeOwner: {
|
|
5918
|
+
value: input.protocolFeeOwner ?? null,
|
|
5919
|
+
isWritable: false
|
|
5920
|
+
},
|
|
5921
|
+
protocolFeePosition: {
|
|
5922
|
+
value: input.protocolFeePosition ?? null,
|
|
5923
|
+
isWritable: true
|
|
5924
|
+
},
|
|
5925
|
+
position: { value: input.position ?? null, isWritable: true },
|
|
5926
|
+
user0: { value: input.user0 ?? null, isWritable: true },
|
|
5927
|
+
user1: { value: input.user1 ?? null, isWritable: true },
|
|
5928
|
+
cpmmProgram: { value: input.cpmmProgram ?? null, isWritable: false },
|
|
5929
|
+
migrationAuthority: {
|
|
5930
|
+
value: input.migrationAuthority ?? null,
|
|
5931
|
+
isWritable: false
|
|
5932
|
+
},
|
|
5933
|
+
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
5934
|
+
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
5935
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
5936
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
5937
|
+
};
|
|
5938
|
+
const accounts = originalAccounts;
|
|
5939
|
+
const args = { ...input };
|
|
5940
|
+
if (!accounts.cpmmProgram.value) {
|
|
5941
|
+
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
5942
|
+
}
|
|
5943
|
+
if (!accounts.migrationAuthority.value) {
|
|
5944
|
+
accounts.migrationAuthority.value = await kit.getProgramDerivedAddress({
|
|
5945
|
+
programAddress,
|
|
5946
|
+
seeds: [
|
|
5947
|
+
kit.getBytesEncoder().encode(
|
|
5948
|
+
new Uint8Array([
|
|
5949
|
+
109,
|
|
5950
|
+
105,
|
|
5951
|
+
103,
|
|
5952
|
+
114,
|
|
5953
|
+
97,
|
|
5954
|
+
116,
|
|
5955
|
+
105,
|
|
5956
|
+
111,
|
|
5957
|
+
110,
|
|
5958
|
+
95,
|
|
5959
|
+
97,
|
|
5960
|
+
117,
|
|
5961
|
+
116,
|
|
5962
|
+
104,
|
|
5963
|
+
111,
|
|
5964
|
+
114,
|
|
5965
|
+
105,
|
|
5966
|
+
116,
|
|
5967
|
+
121
|
|
5968
|
+
])
|
|
5969
|
+
)
|
|
5970
|
+
]
|
|
5971
|
+
});
|
|
5972
|
+
}
|
|
5973
|
+
if (!accounts.systemProgram.value) {
|
|
5974
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
5975
|
+
}
|
|
5976
|
+
if (!accounts.rent.value) {
|
|
5977
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
5978
|
+
}
|
|
5979
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
5980
|
+
return Object.freeze({
|
|
5981
|
+
accounts: [
|
|
5982
|
+
getAccountMeta("cpmmConfig", accounts.cpmmConfig),
|
|
5983
|
+
getAccountMeta("payer", accounts.payer),
|
|
5984
|
+
getAccountMeta("liquidityOwner", accounts.liquidityOwner),
|
|
5985
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
5986
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
5987
|
+
getAccountMeta("pool", accounts.pool),
|
|
5988
|
+
getAccountMeta("poolAuthority", accounts.poolAuthority),
|
|
5989
|
+
getAccountMeta("poolVault0", accounts.poolVault0),
|
|
5990
|
+
getAccountMeta("poolVault1", accounts.poolVault1),
|
|
5991
|
+
getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
|
|
5992
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
5993
|
+
getAccountMeta("position", accounts.position),
|
|
5994
|
+
getAccountMeta("user0", accounts.user0),
|
|
5995
|
+
getAccountMeta("user1", accounts.user1),
|
|
5996
|
+
getAccountMeta("cpmmProgram", accounts.cpmmProgram),
|
|
5997
|
+
getAccountMeta("migrationAuthority", accounts.migrationAuthority),
|
|
5998
|
+
getAccountMeta("token0Program", accounts.token0Program),
|
|
5999
|
+
getAccountMeta("token1Program", accounts.token1Program),
|
|
6000
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
6001
|
+
getAccountMeta("rent", accounts.rent)
|
|
6002
|
+
],
|
|
6003
|
+
data: getCreateSpotPoolInstructionDataEncoder().encode(
|
|
6004
|
+
args
|
|
6005
|
+
),
|
|
6006
|
+
programAddress
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
function getCreateSpotPoolInstruction(input, config) {
|
|
6010
|
+
const programAddress = config?.programAddress ?? CPMM_MIGRATOR_PROGRAM_ADDRESS;
|
|
6011
|
+
const originalAccounts = {
|
|
6012
|
+
cpmmConfig: { value: input.cpmmConfig ?? null, isWritable: false },
|
|
6013
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
6014
|
+
liquidityOwner: { value: input.liquidityOwner ?? null, isWritable: false },
|
|
6015
|
+
token0Mint: { value: input.token0Mint ?? null, isWritable: false },
|
|
6016
|
+
token1Mint: { value: input.token1Mint ?? null, isWritable: false },
|
|
6017
|
+
pool: { value: input.pool ?? null, isWritable: true },
|
|
6018
|
+
poolAuthority: { value: input.poolAuthority ?? null, isWritable: false },
|
|
6019
|
+
poolVault0: { value: input.poolVault0 ?? null, isWritable: true },
|
|
6020
|
+
poolVault1: { value: input.poolVault1 ?? null, isWritable: true },
|
|
6021
|
+
protocolFeeOwner: {
|
|
6022
|
+
value: input.protocolFeeOwner ?? null,
|
|
6023
|
+
isWritable: false
|
|
6024
|
+
},
|
|
6025
|
+
protocolFeePosition: {
|
|
6026
|
+
value: input.protocolFeePosition ?? null,
|
|
6027
|
+
isWritable: true
|
|
6028
|
+
},
|
|
6029
|
+
position: { value: input.position ?? null, isWritable: true },
|
|
6030
|
+
user0: { value: input.user0 ?? null, isWritable: true },
|
|
6031
|
+
user1: { value: input.user1 ?? null, isWritable: true },
|
|
6032
|
+
cpmmProgram: { value: input.cpmmProgram ?? null, isWritable: false },
|
|
6033
|
+
migrationAuthority: {
|
|
6034
|
+
value: input.migrationAuthority ?? null,
|
|
6035
|
+
isWritable: false
|
|
6036
|
+
},
|
|
6037
|
+
token0Program: { value: input.token0Program ?? null, isWritable: false },
|
|
6038
|
+
token1Program: { value: input.token1Program ?? null, isWritable: false },
|
|
6039
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
6040
|
+
rent: { value: input.rent ?? null, isWritable: false }
|
|
6041
|
+
};
|
|
6042
|
+
const accounts = originalAccounts;
|
|
6043
|
+
const args = { ...input };
|
|
6044
|
+
if (!accounts.cpmmProgram.value) {
|
|
6045
|
+
accounts.cpmmProgram.value = "9PSxVPoPfnbZ8Q1uQhgS6ZxvBjFboZtebNsu34umxkgQ";
|
|
6046
|
+
}
|
|
6047
|
+
if (!accounts.systemProgram.value) {
|
|
6048
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
6049
|
+
}
|
|
6050
|
+
if (!accounts.rent.value) {
|
|
6051
|
+
accounts.rent.value = "SysvarRent111111111111111111111111111111111";
|
|
6052
|
+
}
|
|
6053
|
+
const getAccountMeta = programClientCore.getAccountMetaFactory(programAddress, "programId");
|
|
6054
|
+
return Object.freeze({
|
|
6055
|
+
accounts: [
|
|
6056
|
+
getAccountMeta("cpmmConfig", accounts.cpmmConfig),
|
|
6057
|
+
getAccountMeta("payer", accounts.payer),
|
|
6058
|
+
getAccountMeta("liquidityOwner", accounts.liquidityOwner),
|
|
6059
|
+
getAccountMeta("token0Mint", accounts.token0Mint),
|
|
6060
|
+
getAccountMeta("token1Mint", accounts.token1Mint),
|
|
6061
|
+
getAccountMeta("pool", accounts.pool),
|
|
6062
|
+
getAccountMeta("poolAuthority", accounts.poolAuthority),
|
|
6063
|
+
getAccountMeta("poolVault0", accounts.poolVault0),
|
|
6064
|
+
getAccountMeta("poolVault1", accounts.poolVault1),
|
|
6065
|
+
getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
|
|
6066
|
+
getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
|
|
6067
|
+
getAccountMeta("position", accounts.position),
|
|
6068
|
+
getAccountMeta("user0", accounts.user0),
|
|
6069
|
+
getAccountMeta("user1", accounts.user1),
|
|
6070
|
+
getAccountMeta("cpmmProgram", accounts.cpmmProgram),
|
|
6071
|
+
getAccountMeta("migrationAuthority", accounts.migrationAuthority),
|
|
6072
|
+
getAccountMeta("token0Program", accounts.token0Program),
|
|
6073
|
+
getAccountMeta("token1Program", accounts.token1Program),
|
|
6074
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
6075
|
+
getAccountMeta("rent", accounts.rent)
|
|
6076
|
+
],
|
|
6077
|
+
data: getCreateSpotPoolInstructionDataEncoder().encode(
|
|
6078
|
+
args
|
|
6079
|
+
),
|
|
6080
|
+
programAddress
|
|
6081
|
+
});
|
|
6082
|
+
}
|
|
6083
|
+
|
|
6084
|
+
// src/solana/generated/cpmmMigrator/programs/cpmmMigrator.ts
|
|
6085
|
+
var CPMM_MIGRATOR_PROGRAM_ADDRESS = "7WMUTNC41eMCo6eGH5Sy2xbgE3AycvLbFPo95AU9CSUd";
|
|
6761
6086
|
if (process.env.NODE_ENV !== "production") ;
|
|
6087
|
+
var addressCodec5 = kit.getAddressCodec();
|
|
6088
|
+
var textEncoder6 = new TextEncoder();
|
|
6089
|
+
var U64_MAX = (1n << 64n) - 1n;
|
|
6090
|
+
var PROTOCOL_FEE_POSITION_ID = 0n;
|
|
6091
|
+
async function pda(programAddress, seeds) {
|
|
6092
|
+
const [derived] = await kit.getProgramDerivedAddress({
|
|
6093
|
+
programAddress,
|
|
6094
|
+
seeds
|
|
6095
|
+
});
|
|
6096
|
+
return derived;
|
|
6097
|
+
}
|
|
6098
|
+
function seed(value) {
|
|
6099
|
+
return textEncoder6.encode(value);
|
|
6100
|
+
}
|
|
6101
|
+
function addressSeed(value) {
|
|
6102
|
+
return addressCodec5.encode(value);
|
|
6103
|
+
}
|
|
6104
|
+
function assertSafeInteger(name, value) {
|
|
6105
|
+
if (typeof value === "number" && !Number.isSafeInteger(value)) {
|
|
6106
|
+
throw new RangeError(
|
|
6107
|
+
`${name} must be a safe integer when provided as a number; use bigint for values above Number.MAX_SAFE_INTEGER`
|
|
6108
|
+
);
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
function u64Seed(value) {
|
|
6112
|
+
assertSafeInteger("positionId", value);
|
|
6113
|
+
const bigintValue = BigInt(value);
|
|
6114
|
+
if (bigintValue < 0n || bigintValue > U64_MAX) {
|
|
6115
|
+
throw new RangeError("u64 position ID must be between 0 and 2^64 - 1");
|
|
6116
|
+
}
|
|
6117
|
+
const bytes = new Uint8Array(8);
|
|
6118
|
+
new DataView(bytes.buffer).setBigUint64(0, bigintValue, true);
|
|
6119
|
+
return bytes;
|
|
6120
|
+
}
|
|
6121
|
+
function addressOf(value) {
|
|
6122
|
+
return typeof value === "string" ? value : value.address;
|
|
6123
|
+
}
|
|
6124
|
+
function accountMeta(value, role) {
|
|
6125
|
+
if (typeof value === "string") {
|
|
6126
|
+
return { address: value, role };
|
|
6127
|
+
}
|
|
6128
|
+
return { address: value.address, role, signer: value };
|
|
6129
|
+
}
|
|
6130
|
+
async function deriveSpotPoolAccounts({
|
|
6131
|
+
tokenAMint,
|
|
6132
|
+
tokenBMint,
|
|
6133
|
+
swapFeeBps,
|
|
6134
|
+
liquidityOwner,
|
|
6135
|
+
tokenAProgram = token.TOKEN_PROGRAM_ADDRESS,
|
|
6136
|
+
tokenBProgram = token.TOKEN_PROGRAM_ADDRESS,
|
|
6137
|
+
tokenAAccount,
|
|
6138
|
+
tokenBAccount,
|
|
6139
|
+
token0Account,
|
|
6140
|
+
token1Account,
|
|
6141
|
+
positionId = 0n,
|
|
6142
|
+
cpmmProgram = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
6143
|
+
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
6144
|
+
}) {
|
|
6145
|
+
const [token0Mint, token1Mint] = chunk4CI2M2F6_cjs.sortMints(tokenAMint, tokenBMint);
|
|
6146
|
+
const token0IsA = token0Mint === tokenAMint;
|
|
6147
|
+
const token0Program = token0IsA ? tokenAProgram : tokenBProgram;
|
|
6148
|
+
const token1Program = token0IsA ? tokenBProgram : tokenAProgram;
|
|
6149
|
+
const [userA] = await token.findAssociatedTokenPda({
|
|
6150
|
+
owner: liquidityOwner,
|
|
6151
|
+
mint: tokenAMint,
|
|
6152
|
+
tokenProgram: tokenAProgram
|
|
6153
|
+
});
|
|
6154
|
+
const [userB] = await token.findAssociatedTokenPda({
|
|
6155
|
+
owner: liquidityOwner,
|
|
6156
|
+
mint: tokenBMint,
|
|
6157
|
+
tokenProgram: tokenBProgram
|
|
6158
|
+
});
|
|
6159
|
+
const user0 = token0Account ?? (token0IsA ? tokenAAccount ?? userA : tokenBAccount ?? userB);
|
|
6160
|
+
const user1 = token1Account ?? (token0IsA ? tokenBAccount ?? userB : tokenAAccount ?? userA);
|
|
6161
|
+
const [pool] = await chunk4CI2M2F6_cjs.getSpotPoolAddress(
|
|
6162
|
+
token0Mint,
|
|
6163
|
+
token1Mint,
|
|
6164
|
+
swapFeeBps,
|
|
6165
|
+
cpmmProgram
|
|
6166
|
+
);
|
|
6167
|
+
const protocolFeeOwner = await pda(cpmmProgram, [
|
|
6168
|
+
seed(chunk4CI2M2F6_cjs.SEED_PROTOCOL_FEE_OWNER),
|
|
6169
|
+
addressSeed(pool)
|
|
6170
|
+
]);
|
|
6171
|
+
return {
|
|
6172
|
+
cpmmConfig: await pda(cpmmProgram, [seed(chunk4CI2M2F6_cjs.SEED_CONFIG)]),
|
|
6173
|
+
token0Mint,
|
|
6174
|
+
token1Mint,
|
|
6175
|
+
token0Program,
|
|
6176
|
+
token1Program,
|
|
6177
|
+
pool,
|
|
6178
|
+
poolAuthority: await pda(cpmmProgram, [
|
|
6179
|
+
seed(chunk4CI2M2F6_cjs.SEED_AUTHORITY),
|
|
6180
|
+
addressSeed(pool)
|
|
6181
|
+
]),
|
|
6182
|
+
poolVault0: await pda(cpmmProgram, [seed(chunk4CI2M2F6_cjs.SEED_VAULT0), addressSeed(pool)]),
|
|
6183
|
+
poolVault1: await pda(cpmmProgram, [seed(chunk4CI2M2F6_cjs.SEED_VAULT1), addressSeed(pool)]),
|
|
6184
|
+
protocolFeeOwner,
|
|
6185
|
+
protocolFeePosition: await pda(cpmmProgram, [
|
|
6186
|
+
seed(chunk4CI2M2F6_cjs.SEED_POSITION),
|
|
6187
|
+
addressSeed(pool),
|
|
6188
|
+
addressSeed(protocolFeeOwner),
|
|
6189
|
+
u64Seed(PROTOCOL_FEE_POSITION_ID)
|
|
6190
|
+
]),
|
|
6191
|
+
position: await pda(cpmmProgram, [
|
|
6192
|
+
seed(chunk4CI2M2F6_cjs.SEED_POSITION),
|
|
6193
|
+
addressSeed(pool),
|
|
6194
|
+
addressSeed(liquidityOwner),
|
|
6195
|
+
u64Seed(positionId)
|
|
6196
|
+
]),
|
|
6197
|
+
user0,
|
|
6198
|
+
user1,
|
|
6199
|
+
migrationAuthority: await pda(cpmmMigratorProgram, [
|
|
6200
|
+
seed(SEED_MIGRATION_AUTHORITY)
|
|
6201
|
+
])
|
|
6202
|
+
};
|
|
6203
|
+
}
|
|
6204
|
+
async function createSpotPoolInstruction(input) {
|
|
6205
|
+
const payer = input.payer;
|
|
6206
|
+
const liquidityOwner = input.liquidityOwner ?? payer;
|
|
6207
|
+
const positionId = input.positionId ?? 0n;
|
|
6208
|
+
const minSharesOut = input.minSharesOut ?? 1n;
|
|
6209
|
+
assertSafeInteger("positionId", positionId);
|
|
6210
|
+
assertSafeInteger("tokenAAmount", input.tokenAAmount);
|
|
6211
|
+
assertSafeInteger("tokenBAmount", input.tokenBAmount);
|
|
6212
|
+
assertSafeInteger("minSharesOut", minSharesOut);
|
|
6213
|
+
const cpmmProgram = input.cpmmProgram ?? chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID;
|
|
6214
|
+
const cpmmMigratorProgram = input.cpmmMigratorProgram ?? CPMM_MIGRATOR_PROGRAM_ID;
|
|
6215
|
+
const accounts = await deriveSpotPoolAccounts({
|
|
6216
|
+
...input,
|
|
6217
|
+
liquidityOwner: addressOf(liquidityOwner),
|
|
6218
|
+
cpmmProgram,
|
|
6219
|
+
cpmmMigratorProgram,
|
|
6220
|
+
positionId
|
|
6221
|
+
});
|
|
6222
|
+
const token0IsA = accounts.token0Mint === input.tokenAMint;
|
|
6223
|
+
return {
|
|
6224
|
+
programAddress: cpmmMigratorProgram,
|
|
6225
|
+
accounts: [
|
|
6226
|
+
{ address: accounts.cpmmConfig, role: kit.AccountRole.READONLY },
|
|
6227
|
+
accountMeta(payer, kit.AccountRole.WRITABLE_SIGNER),
|
|
6228
|
+
accountMeta(liquidityOwner, kit.AccountRole.READONLY_SIGNER),
|
|
6229
|
+
{ address: accounts.token0Mint, role: kit.AccountRole.READONLY },
|
|
6230
|
+
{ address: accounts.token1Mint, role: kit.AccountRole.READONLY },
|
|
6231
|
+
{ address: accounts.pool, role: kit.AccountRole.WRITABLE },
|
|
6232
|
+
{ address: accounts.poolAuthority, role: kit.AccountRole.READONLY },
|
|
6233
|
+
{ address: accounts.poolVault0, role: kit.AccountRole.WRITABLE },
|
|
6234
|
+
{ address: accounts.poolVault1, role: kit.AccountRole.WRITABLE },
|
|
6235
|
+
{ address: accounts.protocolFeeOwner, role: kit.AccountRole.READONLY },
|
|
6236
|
+
{ address: accounts.protocolFeePosition, role: kit.AccountRole.WRITABLE },
|
|
6237
|
+
{ address: accounts.position, role: kit.AccountRole.WRITABLE },
|
|
6238
|
+
{ address: accounts.user0, role: kit.AccountRole.WRITABLE },
|
|
6239
|
+
{ address: accounts.user1, role: kit.AccountRole.WRITABLE },
|
|
6240
|
+
{ address: cpmmProgram, role: kit.AccountRole.READONLY },
|
|
6241
|
+
{ address: accounts.migrationAuthority, role: kit.AccountRole.READONLY },
|
|
6242
|
+
{ address: accounts.token0Program, role: kit.AccountRole.READONLY },
|
|
6243
|
+
{ address: accounts.token1Program, role: kit.AccountRole.READONLY },
|
|
6244
|
+
{
|
|
6245
|
+
address: input.systemProgram ?? system.SYSTEM_PROGRAM_ADDRESS,
|
|
6246
|
+
role: kit.AccountRole.READONLY
|
|
6247
|
+
},
|
|
6248
|
+
{
|
|
6249
|
+
address: input.rent ?? sysvars.SYSVAR_RENT_ADDRESS,
|
|
6250
|
+
role: kit.AccountRole.READONLY
|
|
6251
|
+
}
|
|
6252
|
+
],
|
|
6253
|
+
data: getCreateSpotPoolInstructionDataEncoder().encode({
|
|
6254
|
+
swapFeeBps: input.swapFeeBps,
|
|
6255
|
+
positionId,
|
|
6256
|
+
amount0Max: token0IsA ? input.tokenAAmount : input.tokenBAmount,
|
|
6257
|
+
amount1Max: token0IsA ? input.tokenBAmount : input.tokenAAmount,
|
|
6258
|
+
minSharesOut
|
|
6259
|
+
})
|
|
6260
|
+
};
|
|
6261
|
+
}
|
|
6762
6262
|
|
|
6763
6263
|
// src/solana/migrators/cpmmMigrator/client.ts
|
|
6764
|
-
async function fetchCpmmMigratorState(rpc,
|
|
6765
|
-
const response = await rpc.getAccountInfo(
|
|
6264
|
+
async function fetchCpmmMigratorState(rpc, address6) {
|
|
6265
|
+
const response = await rpc.getAccountInfo(address6, { encoding: "base64" }).send();
|
|
6766
6266
|
if (!response.value) return null;
|
|
6767
6267
|
return getCpmmMigratorStateDecoder().decode(
|
|
6768
|
-
|
|
6268
|
+
chunk7PXLEMBJ_cjs.base64ToBytes(response.value.data[0])
|
|
6769
6269
|
);
|
|
6770
6270
|
}
|
|
6771
6271
|
async function buildCpmmMigrationRemainingAccounts({
|
|
@@ -6776,7 +6276,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
6776
6276
|
adminBaseAta,
|
|
6777
6277
|
adminQuoteAta,
|
|
6778
6278
|
recipientAtas,
|
|
6779
|
-
cpmmProgram =
|
|
6279
|
+
cpmmProgram = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
6780
6280
|
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
6781
6281
|
}) {
|
|
6782
6282
|
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
|
|
@@ -6784,9 +6284,9 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
6784
6284
|
cpmmMigratorProgram
|
|
6785
6285
|
);
|
|
6786
6286
|
const [migrationAuthority] = await getCpmmMigrationAuthorityAddress(cpmmMigratorProgram);
|
|
6787
|
-
const poolInit = await
|
|
6287
|
+
const poolInit = await chunk4CI2M2F6_cjs.getPoolInitAddresses(baseMint, quoteMint, cpmmProgram);
|
|
6788
6288
|
const pool = poolInit.pool[0];
|
|
6789
|
-
const [launchLpPosition] = await
|
|
6289
|
+
const [launchLpPosition] = await chunk4CI2M2F6_cjs.getPositionAddress(
|
|
6790
6290
|
pool,
|
|
6791
6291
|
launchAuthority,
|
|
6792
6292
|
0n,
|
|
@@ -6825,8 +6325,8 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
6825
6325
|
{ address: migrationAuthority, role: kit.AccountRole.READONLY },
|
|
6826
6326
|
{ address: adminBaseAta, role: kit.AccountRole.WRITABLE },
|
|
6827
6327
|
{ address: adminQuoteAta, role: kit.AccountRole.WRITABLE },
|
|
6828
|
-
...recipientAtas.map((
|
|
6829
|
-
address:
|
|
6328
|
+
...recipientAtas.map((address6) => ({
|
|
6329
|
+
address: address6,
|
|
6830
6330
|
role: kit.AccountRole.WRITABLE
|
|
6831
6331
|
}))
|
|
6832
6332
|
],
|
|
@@ -6850,8 +6350,24 @@ async function buildCpmmMigrationRemainingAccountsHash(input) {
|
|
|
6850
6350
|
}
|
|
6851
6351
|
|
|
6852
6352
|
// src/solana/migrators/cpmmMigrator/index.ts
|
|
6353
|
+
function encodeCreateSpotPoolPayload(args) {
|
|
6354
|
+
assertSafeInteger("positionId", args.positionId);
|
|
6355
|
+
assertSafeInteger("amount0Max", args.amount0Max);
|
|
6356
|
+
assertSafeInteger("amount1Max", args.amount1Max);
|
|
6357
|
+
assertSafeInteger("minSharesOut", args.minSharesOut);
|
|
6358
|
+
const encoded = new Uint8Array(getCreateSpotPoolArgsEncoder().encode(args));
|
|
6359
|
+
return kit.mergeBytes([
|
|
6360
|
+
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.createSpotPool,
|
|
6361
|
+
encoded
|
|
6362
|
+
]);
|
|
6363
|
+
}
|
|
6853
6364
|
function encodeRegisterLaunchPayload(args) {
|
|
6854
|
-
const encoded = new Uint8Array(
|
|
6365
|
+
const encoded = new Uint8Array(
|
|
6366
|
+
getRegisterLaunchArgsEncoder().encode({
|
|
6367
|
+
...args,
|
|
6368
|
+
migratedPoolHookConfig: args.migratedPoolHookConfig ?? null
|
|
6369
|
+
})
|
|
6370
|
+
);
|
|
6855
6371
|
return kit.mergeBytes([
|
|
6856
6372
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.registerLaunch,
|
|
6857
6373
|
encoded
|
|
@@ -6871,14 +6387,14 @@ var launchIdCounter = 0n;
|
|
|
6871
6387
|
var launchTokenPrograms = {
|
|
6872
6388
|
splToken() {
|
|
6873
6389
|
return {
|
|
6874
|
-
baseTokenProgram:
|
|
6875
|
-
quoteTokenProgram:
|
|
6390
|
+
baseTokenProgram: chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6391
|
+
quoteTokenProgram: chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS
|
|
6876
6392
|
};
|
|
6877
6393
|
},
|
|
6878
6394
|
token2022Base() {
|
|
6879
6395
|
return {
|
|
6880
|
-
baseTokenProgram:
|
|
6881
|
-
quoteTokenProgram:
|
|
6396
|
+
baseTokenProgram: chunk4CI2M2F6_cjs.TOKEN_2022_PROGRAM_ADDRESS,
|
|
6397
|
+
quoteTokenProgram: chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS
|
|
6882
6398
|
};
|
|
6883
6399
|
}
|
|
6884
6400
|
};
|
|
@@ -6892,7 +6408,7 @@ function createLaunchId() {
|
|
|
6892
6408
|
return bytes;
|
|
6893
6409
|
}
|
|
6894
6410
|
function getSignerAddress(value) {
|
|
6895
|
-
return
|
|
6411
|
+
return chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner(value);
|
|
6896
6412
|
}
|
|
6897
6413
|
function hasMetadata(metadata) {
|
|
6898
6414
|
return Boolean(metadata?.metadataName);
|
|
@@ -6908,73 +6424,24 @@ function hashRemainingAccounts(accounts) {
|
|
|
6908
6424
|
return void 0;
|
|
6909
6425
|
}
|
|
6910
6426
|
return computeRemainingAccountsHash(
|
|
6911
|
-
accounts.map(
|
|
6427
|
+
accounts.map(chunk7PXLEMBJ_cjs.getAddressFromRemainingAccount)
|
|
6912
6428
|
);
|
|
6913
6429
|
}
|
|
6914
6430
|
function isCustomMigrationConfig(migration) {
|
|
6915
6431
|
return migration.kind === "custom";
|
|
6916
6432
|
}
|
|
6917
|
-
function getCreateLaunchHookMode(input) {
|
|
6918
|
-
if (input.hook !== void 0 && input.hook !== null) {
|
|
6919
|
-
return input.hook;
|
|
6920
|
-
}
|
|
6921
|
-
if (input.dynamicFee) {
|
|
6922
|
-
return "dynamicFee";
|
|
6923
|
-
}
|
|
6924
|
-
return input.cosigner ? "cosigner" : "cpmm";
|
|
6925
|
-
}
|
|
6926
6433
|
async function getCreateLaunchHookContext(input) {
|
|
6927
|
-
const
|
|
6928
|
-
if (input.
|
|
6929
|
-
throw new Error(
|
|
6930
|
-
'dynamicFee requires hook to be unset or set to "dynamicFee"'
|
|
6931
|
-
);
|
|
6932
|
-
}
|
|
6933
|
-
if (mode !== "cosigner" && mode !== "dynamicFee") {
|
|
6934
|
-
return { mode };
|
|
6935
|
-
}
|
|
6936
|
-
if (mode === "dynamicFee") {
|
|
6937
|
-
if (!input.dynamicFee && !input.cosigner) {
|
|
6938
|
-
throw new Error(
|
|
6939
|
-
"dynamicFee hook mode requires dynamicFee or cosigner input"
|
|
6940
|
-
);
|
|
6941
|
-
}
|
|
6942
|
-
if (!input.cosigner) {
|
|
6943
|
-
return { mode };
|
|
6944
|
-
}
|
|
6945
|
-
const [dynamicFeeConfig] = await getDynamicFeeHookConfigAddress(
|
|
6946
|
-
input.deployment?.dynamicFeeHookProgram ?? DYNAMIC_FEE_HOOK_PROGRAM_ID
|
|
6947
|
-
);
|
|
6948
|
-
return { mode, dynamicFeeConfig };
|
|
6949
|
-
}
|
|
6950
|
-
const [cosignerConfig] = await getCosignerHookConfigAddress(
|
|
6951
|
-
input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
6952
|
-
);
|
|
6953
|
-
return { mode, cosignerConfig };
|
|
6954
|
-
}
|
|
6955
|
-
function getCosignerHookRemainingAccounts2({
|
|
6956
|
-
namespace,
|
|
6957
|
-
cosigner,
|
|
6958
|
-
cosignerConfig
|
|
6959
|
-
}) {
|
|
6960
|
-
const accounts = namespace === cosignerConfig ? [cosignerConfig] : [namespace, cosignerConfig];
|
|
6961
|
-
accounts.push(cosigner);
|
|
6962
|
-
return accounts;
|
|
6963
|
-
}
|
|
6964
|
-
function resolveCosignerHookPayload(input) {
|
|
6965
|
-
if (input.cosignGateExpiresAt === void 0 || input.cosignGateExpiresAt === null) {
|
|
6966
|
-
return new Uint8Array();
|
|
6434
|
+
const program = input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID;
|
|
6435
|
+
if (input.cosignGateExpiresAt != null && !input.cosigner) {
|
|
6436
|
+
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
6967
6437
|
}
|
|
6968
6438
|
if (!input.cosigner) {
|
|
6969
|
-
|
|
6439
|
+
return { program };
|
|
6970
6440
|
}
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
value: input.cosignGateExpiresAt,
|
|
6974
|
-
cosigner: getSignerAddress(input.cosigner)
|
|
6975
|
-
});
|
|
6441
|
+
const [config] = await getCpmmHookConfigAddress(program);
|
|
6442
|
+
return { program, config };
|
|
6976
6443
|
}
|
|
6977
|
-
function
|
|
6444
|
+
function resolveCpmmHookPayload(input) {
|
|
6978
6445
|
let gateExpiry = null;
|
|
6979
6446
|
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null) {
|
|
6980
6447
|
if (!input.cosigner) {
|
|
@@ -6986,7 +6453,7 @@ function resolveDynamicFeeHookPayload(input) {
|
|
|
6986
6453
|
cosigner: getSignerAddress(input.cosigner)
|
|
6987
6454
|
};
|
|
6988
6455
|
}
|
|
6989
|
-
return
|
|
6456
|
+
return encodeCpmmHookPayload({
|
|
6990
6457
|
schedule: input.dynamicFee ?? null,
|
|
6991
6458
|
gateExpiry
|
|
6992
6459
|
});
|
|
@@ -6996,59 +6463,18 @@ function resolveCreateLaunchHook({
|
|
|
6996
6463
|
namespace,
|
|
6997
6464
|
hookContext
|
|
6998
6465
|
}) {
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
if (!input.cosigner) {
|
|
7007
|
-
throw new Error('cosigner is required when hook is "cosigner"');
|
|
7008
|
-
}
|
|
7009
|
-
if (!hookContext.cosignerConfig) {
|
|
7010
|
-
throw new Error("cosigner hook config could not be derived");
|
|
7011
|
-
}
|
|
7012
|
-
const remainingAccounts = getCosignerHookRemainingAccounts2({
|
|
7013
|
-
namespace,
|
|
7014
|
-
cosigner: input.cosigner,
|
|
7015
|
-
cosignerConfig: hookContext.cosignerConfig
|
|
7016
|
-
});
|
|
7017
|
-
return {
|
|
7018
|
-
program: input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
7019
|
-
flags: HF_BEFORE_SWAP2 | HF_FORWARD_READONLY_SIGNERS2,
|
|
7020
|
-
payload: resolveCosignerHookPayload(input),
|
|
7021
|
-
remainingAccounts,
|
|
7022
|
-
remainingAccountsHash: hashRemainingAccounts(remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH
|
|
7023
|
-
};
|
|
7024
|
-
}
|
|
7025
|
-
if (hookContext.mode === "dynamicFee") {
|
|
7026
|
-
const hasCosigner = Boolean(input.cosigner);
|
|
7027
|
-
const hasSchedule = Boolean(input.dynamicFee);
|
|
7028
|
-
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null && !input.cosigner) {
|
|
7029
|
-
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
7030
|
-
}
|
|
7031
|
-
if (hasCosigner && !hookContext.dynamicFeeConfig) {
|
|
7032
|
-
throw new Error("dynamic fee hook config could not be derived");
|
|
7033
|
-
}
|
|
7034
|
-
const remainingAccounts = getDynamicFeeHookRemainingAccounts({
|
|
7035
|
-
namespace,
|
|
7036
|
-
config: hookContext.dynamicFeeConfig,
|
|
7037
|
-
cosigner: input.cosigner
|
|
7038
|
-
});
|
|
7039
|
-
return {
|
|
7040
|
-
program: input.deployment?.dynamicFeeHookProgram ?? DYNAMIC_FEE_HOOK_PROGRAM_ID,
|
|
7041
|
-
flags: HF_BEFORE_SWAP2 | (hasSchedule ? HF_BEFORE_CREATE : 0) | (hasCosigner ? HF_FORWARD_READONLY_SIGNERS2 : 0),
|
|
7042
|
-
payload: resolveDynamicFeeHookPayload(input),
|
|
7043
|
-
remainingAccounts: remainingAccounts.signedHookRemainingAccounts,
|
|
7044
|
-
remainingAccountsHash: remainingAccounts.hookRemainingAccountsHash
|
|
7045
|
-
};
|
|
7046
|
-
}
|
|
6466
|
+
const hasCosigner = Boolean(input.cosigner);
|
|
6467
|
+
const hasSchedule = Boolean(input.dynamicFee);
|
|
6468
|
+
const remainingAccounts = getCpmmHookRemainingAccounts({
|
|
6469
|
+
namespace,
|
|
6470
|
+
config: hookContext.config,
|
|
6471
|
+
cosigner: input.cosigner
|
|
6472
|
+
});
|
|
7047
6473
|
return {
|
|
7048
|
-
program:
|
|
7049
|
-
flags: HF_BEFORE_SWAP2,
|
|
7050
|
-
payload:
|
|
7051
|
-
remainingAccountsHash:
|
|
6474
|
+
program: hookContext.program,
|
|
6475
|
+
flags: HF_BEFORE_SWAP2 | (hasSchedule ? HF_BEFORE_CREATE : 0) | (hasCosigner ? HF_FORWARD_READONLY_SIGNERS2 : 0),
|
|
6476
|
+
payload: resolveCpmmHookPayload(input),
|
|
6477
|
+
remainingAccountsHash: remainingAccounts.hookRemainingAccountsHash
|
|
7052
6478
|
};
|
|
7053
6479
|
}
|
|
7054
6480
|
async function getAssociatedTokenAddress({
|
|
@@ -7186,7 +6612,7 @@ async function createLaunch(input) {
|
|
|
7186
6612
|
const programId = getInitializerProgramId(input);
|
|
7187
6613
|
const launchId = input.launchId ?? createLaunchId();
|
|
7188
6614
|
const hookContext = await getCreateLaunchHookContext(input);
|
|
7189
|
-
const namespace = input.namespace ??
|
|
6615
|
+
const namespace = input.namespace ?? chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS;
|
|
7190
6616
|
const tokenPrograms = {
|
|
7191
6617
|
...launchTokenPrograms.splToken(),
|
|
7192
6618
|
...input.tokenPrograms
|
|
@@ -7232,10 +6658,10 @@ async function createLaunch(input) {
|
|
|
7232
6658
|
cpmmConfig: migration?.cpmmConfig,
|
|
7233
6659
|
baseTokenProgram: tokenPrograms.baseTokenProgram,
|
|
7234
6660
|
quoteTokenProgram: tokenPrograms.quoteTokenProgram,
|
|
7235
|
-
systemProgram: input.systemProgram ??
|
|
7236
|
-
rent: input.rent ??
|
|
6661
|
+
systemProgram: input.systemProgram ?? chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6662
|
+
rent: input.rent ?? chunk4CI2M2F6_cjs.SYSVAR_RENT_ADDRESS,
|
|
7237
6663
|
metadataAccount: addresses.metadataAccount,
|
|
7238
|
-
metadataProgram: input.metadataProgram ??
|
|
6664
|
+
metadataProgram: input.metadataProgram ?? chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID
|
|
7239
6665
|
},
|
|
7240
6666
|
{
|
|
7241
6667
|
namespace,
|
|
@@ -7252,7 +6678,7 @@ async function createLaunch(input) {
|
|
|
7252
6678
|
allowBuy: input.allowBuy ?? true,
|
|
7253
6679
|
allowSell: input.allowSell ?? true,
|
|
7254
6680
|
hookFlags: hook.flags,
|
|
7255
|
-
hookPayload: hook.payload
|
|
6681
|
+
hookPayload: hook.payload,
|
|
7256
6682
|
migratorInitPayload: migration?.initPayload ?? new Uint8Array(),
|
|
7257
6683
|
migratorMigratePayload: migration?.migratePayload ?? new Uint8Array(),
|
|
7258
6684
|
hookRemainingAccountsHash: hook.remainingAccountsHash,
|
|
@@ -7270,7 +6696,7 @@ async function createLaunch(input) {
|
|
|
7270
6696
|
accounts: [
|
|
7271
6697
|
...instruction.accounts ?? [],
|
|
7272
6698
|
...(migration?.initRemainingAccounts ?? []).map(
|
|
7273
|
-
|
|
6699
|
+
chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta
|
|
7274
6700
|
)
|
|
7275
6701
|
]
|
|
7276
6702
|
} : instruction;
|
|
@@ -7386,23 +6812,23 @@ function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupT
|
|
|
7386
6812
|
);
|
|
7387
6813
|
return assertTransactionMessageFits(compressedMessage, options);
|
|
7388
6814
|
}
|
|
7389
|
-
var
|
|
7390
|
-
async function fetchLaunch2(rpc,
|
|
7391
|
-
const response = await rpc.getAccountInfo(
|
|
6815
|
+
var addressCodec6 = kit.getAddressCodec();
|
|
6816
|
+
async function fetchLaunch2(rpc, address6, config) {
|
|
6817
|
+
const response = await rpc.getAccountInfo(address6, {
|
|
7392
6818
|
encoding: "base64",
|
|
7393
6819
|
commitment: config?.commitment
|
|
7394
6820
|
}).send();
|
|
7395
6821
|
if (!response.value) {
|
|
7396
6822
|
return null;
|
|
7397
6823
|
}
|
|
7398
|
-
return getLaunchDecoder().decode(
|
|
6824
|
+
return getLaunchDecoder().decode(chunk7PXLEMBJ_cjs.base64ToBytes(response.value.data[0]));
|
|
7399
6825
|
}
|
|
7400
6826
|
async function fetchAllLaunches(rpc, config) {
|
|
7401
6827
|
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
7402
6828
|
const discriminatorFilter = {
|
|
7403
6829
|
memcmp: {
|
|
7404
6830
|
offset: 0n,
|
|
7405
|
-
bytes:
|
|
6831
|
+
bytes: chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes(
|
|
7406
6832
|
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
7407
6833
|
),
|
|
7408
6834
|
encoding: "base64"
|
|
@@ -7413,15 +6839,15 @@ async function fetchAllLaunches(rpc, config) {
|
|
|
7413
6839
|
commitment: config?.commitment,
|
|
7414
6840
|
filters: [discriminatorFilter]
|
|
7415
6841
|
}).send();
|
|
7416
|
-
const accounts =
|
|
6842
|
+
const accounts = chunk7PXLEMBJ_cjs.normalizeProgramAccountsResponse(response);
|
|
7417
6843
|
const launches = [];
|
|
7418
6844
|
const decoder = getLaunchDecoder();
|
|
7419
6845
|
for (const account of accounts) {
|
|
7420
6846
|
try {
|
|
7421
|
-
const launch = decoder.decode(
|
|
6847
|
+
const launch = decoder.decode(chunk7PXLEMBJ_cjs.base64ToBytes(account.account.data[0]));
|
|
7422
6848
|
launches.push({ address: account.pubkey, account: launch });
|
|
7423
6849
|
} catch {
|
|
7424
|
-
|
|
6850
|
+
chunk7PXLEMBJ_cjs.warnAccountDecodeFailure("launch", account.pubkey);
|
|
7425
6851
|
}
|
|
7426
6852
|
}
|
|
7427
6853
|
return launches;
|
|
@@ -7431,7 +6857,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
7431
6857
|
const discriminatorFilter = {
|
|
7432
6858
|
memcmp: {
|
|
7433
6859
|
offset: 0n,
|
|
7434
|
-
bytes:
|
|
6860
|
+
bytes: chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes(
|
|
7435
6861
|
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
7436
6862
|
),
|
|
7437
6863
|
encoding: "base64"
|
|
@@ -7440,7 +6866,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
7440
6866
|
const authorityFilter = {
|
|
7441
6867
|
memcmp: {
|
|
7442
6868
|
offset: 8n,
|
|
7443
|
-
bytes:
|
|
6869
|
+
bytes: chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes(addressCodec6.encode(authority)),
|
|
7444
6870
|
encoding: "base64"
|
|
7445
6871
|
}
|
|
7446
6872
|
};
|
|
@@ -7449,15 +6875,15 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
7449
6875
|
commitment: config?.commitment,
|
|
7450
6876
|
filters: [discriminatorFilter, authorityFilter]
|
|
7451
6877
|
}).send();
|
|
7452
|
-
const accounts =
|
|
6878
|
+
const accounts = chunk7PXLEMBJ_cjs.normalizeProgramAccountsResponse(response);
|
|
7453
6879
|
const launches = [];
|
|
7454
6880
|
const decoder = getLaunchDecoder();
|
|
7455
6881
|
for (const account of accounts) {
|
|
7456
6882
|
try {
|
|
7457
|
-
const launch = decoder.decode(
|
|
6883
|
+
const launch = decoder.decode(chunk7PXLEMBJ_cjs.base64ToBytes(account.account.data[0]));
|
|
7458
6884
|
launches.push({ address: account.pubkey, account: launch });
|
|
7459
6885
|
} catch {
|
|
7460
|
-
|
|
6886
|
+
chunk7PXLEMBJ_cjs.warnAccountDecodeFailure("launch", account.pubkey);
|
|
7461
6887
|
}
|
|
7462
6888
|
}
|
|
7463
6889
|
return launches;
|
|
@@ -7793,13 +7219,13 @@ function decodeOracleState3(encodedAccount) {
|
|
|
7793
7219
|
getOracleStateDecoder2()
|
|
7794
7220
|
);
|
|
7795
7221
|
}
|
|
7796
|
-
async function fetchOracleState2(rpc,
|
|
7797
|
-
const maybeAccount = await fetchMaybeOracleState2(rpc,
|
|
7222
|
+
async function fetchOracleState2(rpc, address6, config) {
|
|
7223
|
+
const maybeAccount = await fetchMaybeOracleState2(rpc, address6, config);
|
|
7798
7224
|
kit.assertAccountExists(maybeAccount);
|
|
7799
7225
|
return maybeAccount;
|
|
7800
7226
|
}
|
|
7801
|
-
async function fetchMaybeOracleState2(rpc,
|
|
7802
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
7227
|
+
async function fetchMaybeOracleState2(rpc, address6, config) {
|
|
7228
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
7803
7229
|
return decodeOracleState3(maybeAccount);
|
|
7804
7230
|
}
|
|
7805
7231
|
async function fetchAllOracleState2(rpc, addresses, config) {
|
|
@@ -7883,9 +7309,9 @@ function parseFinalizeInstruction(instruction) {
|
|
|
7883
7309
|
}
|
|
7884
7310
|
let accountIndex = 0;
|
|
7885
7311
|
const getNextAccount = () => {
|
|
7886
|
-
const
|
|
7312
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
7887
7313
|
accountIndex += 1;
|
|
7888
|
-
return
|
|
7314
|
+
return accountMeta2;
|
|
7889
7315
|
};
|
|
7890
7316
|
return {
|
|
7891
7317
|
programAddress: instruction.programAddress,
|
|
@@ -7971,9 +7397,9 @@ function parseInitializeOracleInstruction2(instruction) {
|
|
|
7971
7397
|
}
|
|
7972
7398
|
let accountIndex = 0;
|
|
7973
7399
|
const getNextAccount = () => {
|
|
7974
|
-
const
|
|
7400
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
7975
7401
|
accountIndex += 1;
|
|
7976
|
-
return
|
|
7402
|
+
return accountMeta2;
|
|
7977
7403
|
};
|
|
7978
7404
|
return {
|
|
7979
7405
|
programAddress: instruction.programAddress,
|
|
@@ -8183,8 +7609,8 @@ async function curveSwapExactIn(input) {
|
|
|
8183
7609
|
const programId = input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
|
|
8184
7610
|
const user = input.user ?? input.payer;
|
|
8185
7611
|
const userAddress = getAddress(user);
|
|
8186
|
-
const baseTokenProgram = input.baseTokenProgram ??
|
|
8187
|
-
const quoteTokenProgram = input.quoteTokenProgram ??
|
|
7612
|
+
const baseTokenProgram = input.baseTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7613
|
+
const quoteTokenProgram = input.quoteTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8188
7614
|
const userBaseAccount = await getAssociatedTokenAddress2({
|
|
8189
7615
|
owner: userAddress,
|
|
8190
7616
|
mint: input.baseMint,
|
|
@@ -8233,7 +7659,7 @@ async function curveSwapExactIn(input) {
|
|
|
8233
7659
|
baseMint: input.baseMint,
|
|
8234
7660
|
quoteMint: input.quoteMint,
|
|
8235
7661
|
user,
|
|
8236
|
-
hookProgram: input.
|
|
7662
|
+
hookProgram: input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID,
|
|
8237
7663
|
baseTokenProgram,
|
|
8238
7664
|
quoteTokenProgram,
|
|
8239
7665
|
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0
|
|
@@ -8261,7 +7687,7 @@ async function curveSwapExactIn(input) {
|
|
|
8261
7687
|
}
|
|
8262
7688
|
async function swapExactIn(input) {
|
|
8263
7689
|
const programId = input.programId ?? input.deployment?.cpmmProgram ?? void 0;
|
|
8264
|
-
const pool = "pool" in input ? input.pool : await
|
|
7690
|
+
const pool = "pool" in input ? input.pool : await chunk7PXLEMBJ_cjs.getPoolByMints(input.rpc, input.mintA, input.mintB, {
|
|
8265
7691
|
programId
|
|
8266
7692
|
});
|
|
8267
7693
|
if (!pool) {
|
|
@@ -8269,9 +7695,9 @@ async function swapExactIn(input) {
|
|
|
8269
7695
|
}
|
|
8270
7696
|
const user = input.user ?? input.payer;
|
|
8271
7697
|
const userAddress = getAddress(user);
|
|
8272
|
-
const token0Program = input.token0Program ?? input.tokenProgram ??
|
|
8273
|
-
const token1Program = input.token1Program ?? input.tokenProgram ??
|
|
8274
|
-
const quote =
|
|
7698
|
+
const token0Program = input.token0Program ?? input.tokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7699
|
+
const token1Program = input.token1Program ?? input.tokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7700
|
+
const quote = chunk7PXLEMBJ_cjs.getSwapQuote(
|
|
8275
7701
|
pool.account,
|
|
8276
7702
|
input.amountIn,
|
|
8277
7703
|
input.tradeDirection
|
|
@@ -8360,8 +7786,8 @@ function getDefaultComputeUnitLimit(cpmmMigration) {
|
|
|
8360
7786
|
return cpmmMigration.recipientAtas.length > 0 ? 8e5 : 4e5;
|
|
8361
7787
|
}
|
|
8362
7788
|
function migrateLaunch(input) {
|
|
8363
|
-
const baseTokenProgram = input.baseTokenProgram ??
|
|
8364
|
-
const quoteTokenProgram = input.quoteTokenProgram ??
|
|
7789
|
+
const baseTokenProgram = input.baseTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7790
|
+
const quoteTokenProgram = input.quoteTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
8365
7791
|
const recipients = input.recipients ? [...input.recipients] : [];
|
|
8366
7792
|
if (recipients.length > 0 && recipients.length !== input.cpmmMigration.recipientAtas.length) {
|
|
8367
7793
|
throw new Error(
|
|
@@ -8395,8 +7821,8 @@ function migrateLaunch(input) {
|
|
|
8395
7821
|
payer: input.payer,
|
|
8396
7822
|
baseTokenProgram,
|
|
8397
7823
|
quoteTokenProgram,
|
|
8398
|
-
systemProgram: input.systemProgram ??
|
|
8399
|
-
rent: input.rent ??
|
|
7824
|
+
systemProgram: input.systemProgram ?? chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
7825
|
+
rent: input.rent ?? chunk4CI2M2F6_cjs.SYSVAR_RENT_ADDRESS
|
|
8400
7826
|
},
|
|
8401
7827
|
input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID
|
|
8402
7828
|
);
|
|
@@ -8463,15 +7889,13 @@ async function assertMigrationQuoteThreshold({
|
|
|
8463
7889
|
|
|
8464
7890
|
// src/solana/deployment.ts
|
|
8465
7891
|
var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
8466
|
-
cpmmProgram:
|
|
7892
|
+
cpmmProgram: chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
8467
7893
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
8468
7894
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
8469
|
-
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
8470
|
-
cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
8471
|
-
dynamicFeeHookProgram: DYNAMIC_FEE_HOOK_PROGRAM_ID
|
|
7895
|
+
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
8472
7896
|
};
|
|
8473
7897
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
8474
|
-
const [cpmmConfig] = await
|
|
7898
|
+
const [cpmmConfig] = await chunk4CI2M2F6_cjs.getConfigAddress(programs.cpmmProgram);
|
|
8475
7899
|
const [initializerConfig] = await getConfigAddress2(
|
|
8476
7900
|
programs.initializerProgram
|
|
8477
7901
|
);
|
|
@@ -8484,13 +7908,12 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
8484
7908
|
|
|
8485
7909
|
exports.DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES;
|
|
8486
7910
|
exports.assertMigrationQuoteThreshold = assertMigrationQuoteThreshold;
|
|
8487
|
-
exports.cosignerHook = cosignerHook_exports;
|
|
8488
7911
|
exports.cpmm = cpmm_exports;
|
|
7912
|
+
exports.cpmmHook = cpmmHook_exports;
|
|
8489
7913
|
exports.cpmmMigrator = cpmmMigrator_exports;
|
|
8490
7914
|
exports.createLaunch = createLaunch;
|
|
8491
7915
|
exports.curveSwapExactIn = curveSwapExactIn;
|
|
8492
7916
|
exports.deriveSolanaCpmmDeployment = deriveSolanaCpmmDeployment;
|
|
8493
|
-
exports.dynamicFeeHook = dynamicFeeHook_exports;
|
|
8494
7917
|
exports.getMigrationQuoteProgress = getMigrationQuoteProgress;
|
|
8495
7918
|
exports.initializer = initializer_exports;
|
|
8496
7919
|
exports.migrateLaunch = migrateLaunch;
|