@whetstone-research/doppler-sdk 1.0.27 → 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-XTL2GBZ4.cjs → chunk-7PXLEMBJ.cjs} +439 -91
- 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-RVDRWCJN.js → chunk-PSLY7M7C.js} +392 -63
- package/dist/chunk-PSLY7M7C.js.map +1 -0
- package/dist/evm/index.cjs +243 -175
- package/dist/evm/index.cjs.map +1 -1
- package/dist/evm/index.d.cts +36 -60
- package/dist/evm/index.d.ts +36 -60
- package/dist/evm/index.js +244 -176
- package/dist/evm/index.js.map +1 -1
- 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 +1664 -925
- package/dist/solana/index.cjs.map +1 -1
- package/dist/solana/index.d.cts +748 -159
- package/dist/solana/index.d.ts +748 -159
- package/dist/solana/index.js +1311 -577
- 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-RVDRWCJN.js.map +0 -1
- package/dist/chunk-U6B52TBT.cjs.map +0 -1
- package/dist/chunk-WD5VOZGI.js.map +0 -1
- package/dist/chunk-XTL2GBZ4.cjs.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,345 +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 system = require('@solana-program/system');
|
|
11
|
+
var sysvars = require('@solana/sysvars');
|
|
10
12
|
var addressLookupTable = require('@solana-program/address-lookup-table');
|
|
11
13
|
|
|
12
14
|
// src/solana/cpmm/index.ts
|
|
13
15
|
var cpmm_exports = {};
|
|
14
16
|
chunkQ7SFCCGT_cjs.__export(cpmm_exports, {
|
|
15
|
-
ACCOUNT_DISCRIMINATORS: () =>
|
|
16
|
-
ACCOUNT_VERSION: () =>
|
|
17
|
-
ADD_LIQUIDITY_DISCRIMINATOR: () =>
|
|
18
|
-
BPS_DENOM: () =>
|
|
19
|
-
CLOSE_POSITION_DISCRIMINATOR: () =>
|
|
20
|
-
COLLECT_FEES_DISCRIMINATOR: () =>
|
|
21
|
-
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,
|
|
22
24
|
CPMM_ERROR_MESSAGES: () => CPMM_ERROR_MESSAGES,
|
|
23
|
-
CPMM_PROGRAM_ID: () =>
|
|
24
|
-
CREATE_POSITION_DISCRIMINATOR: () =>
|
|
25
|
+
CPMM_PROGRAM_ID: () => chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
26
|
+
CREATE_POSITION_DISCRIMINATOR: () => chunk7PXLEMBJ_cjs.CREATE_POSITION_DISCRIMINATOR,
|
|
25
27
|
CpmmError: () => CpmmError,
|
|
26
28
|
CpmmErrorCode: () => CpmmErrorCode,
|
|
27
|
-
HF_AFTER_ADD_LIQ: () =>
|
|
28
|
-
HF_AFTER_REMOVE_LIQ: () =>
|
|
29
|
-
HF_AFTER_SWAP: () =>
|
|
30
|
-
HF_BEFORE_ADD_LIQ: () =>
|
|
31
|
-
HF_BEFORE_REMOVE_LIQ: () =>
|
|
32
|
-
HF_BEFORE_SWAP: () =>
|
|
33
|
-
HF_FORWARD_READONLY_SIGNERS: () =>
|
|
34
|
-
HF_REQUIRE_ORACLE: () =>
|
|
35
|
-
HOOK_NO_CHANGE: () =>
|
|
36
|
-
INITIALIZE_CONFIG_DISCRIMINATOR: () =>
|
|
37
|
-
INITIALIZE_ORACLE_DISCRIMINATOR: () =>
|
|
38
|
-
INITIALIZE_POOL_DISCRIMINATOR: () =>
|
|
39
|
-
|
|
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,
|
|
40
43
|
MAX_FEE_AMOUNT: () => MAX_FEE_AMOUNT,
|
|
41
|
-
MAX_HOOK_ALLOWLIST: () =>
|
|
42
|
-
MAX_ORACLE_OBSERVATIONS: () =>
|
|
43
|
-
ORACLE_CONSULT_DISCRIMINATOR: () =>
|
|
44
|
-
ORACLE_UPDATE_DISCRIMINATOR: () =>
|
|
45
|
-
PAUSE_DISCRIMINATOR: () =>
|
|
46
|
-
PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR: () =>
|
|
47
|
-
Q64_ONE: () =>
|
|
48
|
-
REDEEM_PROTOCOL_SHARES_DISCRIMINATOR: () =>
|
|
49
|
-
REMOVE_LIQUIDITY_DISCRIMINATOR: () =>
|
|
50
|
-
SEED_AUTHORITY: () =>
|
|
51
|
-
SEED_CONFIG: () =>
|
|
52
|
-
SEED_ORACLE: () =>
|
|
53
|
-
SEED_POOL: () =>
|
|
54
|
-
SEED_POSITION: () =>
|
|
55
|
-
SEED_PROTOCOL_FEE_OWNER: () =>
|
|
56
|
-
|
|
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
|
-
|
|
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,
|
|
93
103
|
createSwapInstruction: () => createSwapInstruction,
|
|
94
|
-
createTransferAdminInstruction: () =>
|
|
95
|
-
createUnpauseInstruction: () =>
|
|
96
|
-
createWithdrawVaultExcessInstruction: () =>
|
|
104
|
+
createTransferAdminInstruction: () => chunk7PXLEMBJ_cjs.getTransferAdminInstruction,
|
|
105
|
+
createUnpauseInstruction: () => chunk7PXLEMBJ_cjs.getUnpauseInstruction,
|
|
106
|
+
createWithdrawVaultExcessInstruction: () => chunk7PXLEMBJ_cjs.getWithdrawVaultExcessInstruction,
|
|
97
107
|
curveParamsToMarketCap: () => curveParamsToMarketCap,
|
|
98
|
-
decodeAmmConfig: () =>
|
|
99
|
-
decodeOracleState: () =>
|
|
100
|
-
decodePool: () =>
|
|
101
|
-
decodePosition: () =>
|
|
102
|
-
encodeAddLiquidityArgs: () =>
|
|
103
|
-
encodeCollectFeesArgs: () =>
|
|
104
|
-
encodeCollectProtocolFeesArgs: () =>
|
|
105
|
-
encodeCreatePositionArgs: () =>
|
|
106
|
-
encodeInitializeConfigArgs: () =>
|
|
107
|
-
encodeInitializeOracleArgs: () =>
|
|
108
|
-
encodeInitializePoolArgs: () =>
|
|
109
|
-
encodeInstructionData: () =>
|
|
110
|
-
encodeOracleConsultArgs: () =>
|
|
111
|
-
encodeRemoveLiquidityArgs: () =>
|
|
112
|
-
encodeSetFeesArgs: () =>
|
|
113
|
-
encodeSetHookArgs: () =>
|
|
114
|
-
encodeSwapExactInArgs: () =>
|
|
115
|
-
encodeTransferAdminArgs: () =>
|
|
116
|
-
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,
|
|
117
127
|
fetchConfig: () => fetchConfig,
|
|
118
128
|
fetchConfigWithAddress: () => fetchConfigWithAddress,
|
|
119
|
-
fetchOracle: () =>
|
|
120
|
-
fetchOraclesBatch: () =>
|
|
121
|
-
fetchPool: () =>
|
|
122
|
-
fetchPoolPositions: () =>
|
|
123
|
-
fetchPoolsBatch: () =>
|
|
124
|
-
fetchPosition: () =>
|
|
125
|
-
fetchPositionByParams: () =>
|
|
126
|
-
fetchPositionsBatch: () =>
|
|
127
|
-
fetchUserPositions: () =>
|
|
128
|
-
filterActivePositions: () =>
|
|
129
|
-
filterPoolsByMint: () =>
|
|
130
|
-
getAddLiquidityDiscriminatorBytes: () =>
|
|
131
|
-
getAddLiquidityInstruction: () =>
|
|
132
|
-
getAddLiquidityInstructionAsync: () =>
|
|
133
|
-
getAddLiquidityInstructionDataCodec: () =>
|
|
134
|
-
getAddLiquidityInstructionDataDecoder: () =>
|
|
135
|
-
getAddLiquidityInstructionDataEncoder: () =>
|
|
136
|
-
getAddLiquidityQuote: () =>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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,
|
|
161
173
|
getErrorMessage: () => getErrorMessage,
|
|
162
|
-
getInitializeConfigDiscriminatorBytes: () =>
|
|
163
|
-
getInitializeConfigInstruction: () =>
|
|
164
|
-
getInitializeConfigInstructionAsync: () =>
|
|
165
|
-
getInitializeConfigInstructionDataCodec: () =>
|
|
166
|
-
getInitializeConfigInstructionDataDecoder: () =>
|
|
167
|
-
getInitializeConfigInstructionDataEncoder: () =>
|
|
168
|
-
getInitializeOracleDiscriminatorBytes: () =>
|
|
169
|
-
getInitializeOracleInstruction: () =>
|
|
170
|
-
getInitializeOracleInstructionAsync: () =>
|
|
171
|
-
getInitializeOracleInstructionDataCodec: () =>
|
|
172
|
-
getInitializeOracleInstructionDataDecoder: () =>
|
|
173
|
-
getInitializeOracleInstructionDataEncoder: () =>
|
|
174
|
-
getInitializePoolDiscriminatorBytes: () =>
|
|
175
|
-
getInitializePoolInstruction: () =>
|
|
176
|
-
getInitializePoolInstructionAsync: () =>
|
|
177
|
-
getInitializePoolInstructionDataCodec: () =>
|
|
178
|
-
getInitializePoolInstructionDataDecoder: () =>
|
|
179
|
-
getInitializePoolInstructionDataEncoder: () =>
|
|
180
|
-
|
|
181
|
-
|
|
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,
|
|
182
200
|
getMetadataAddress: () => getMetadataAddress,
|
|
183
|
-
getOracleAddress: () =>
|
|
184
|
-
getOracleAddressFromPool: () =>
|
|
185
|
-
getOracleAge: () =>
|
|
186
|
-
getOracleBufferStats: () =>
|
|
187
|
-
getOracleConsultDiscriminatorBytes: () =>
|
|
188
|
-
getOracleConsultInstruction: () =>
|
|
189
|
-
getOracleConsultInstructionAsync: () =>
|
|
190
|
-
getOracleConsultInstructionDataCodec: () =>
|
|
191
|
-
getOracleConsultInstructionDataDecoder: () =>
|
|
192
|
-
getOracleConsultInstructionDataEncoder: () =>
|
|
193
|
-
getOracleDeviation: () =>
|
|
194
|
-
getOracleForPool: () =>
|
|
195
|
-
getOracleSpotPrices: () =>
|
|
196
|
-
getOracleUpdateDiscriminatorBytes: () =>
|
|
197
|
-
getOracleUpdateInstruction: () =>
|
|
198
|
-
getOracleUpdateInstructionAsync: () =>
|
|
199
|
-
getOracleUpdateInstructionDataCodec: () =>
|
|
200
|
-
getOracleUpdateInstructionDataDecoder: () =>
|
|
201
|
-
getOracleUpdateInstructionDataEncoder: () =>
|
|
202
|
-
getPauseDiscriminatorBytes: () =>
|
|
203
|
-
getPauseInstruction: () =>
|
|
204
|
-
getPauseInstructionDataCodec: () =>
|
|
205
|
-
getPauseInstructionDataDecoder: () =>
|
|
206
|
-
getPauseInstructionDataEncoder: () =>
|
|
207
|
-
getPendingFees: () =>
|
|
208
|
-
getPoolAddress: () =>
|
|
209
|
-
getPoolAddressFromMints: () =>
|
|
210
|
-
getPoolAuthorityAddress: () =>
|
|
211
|
-
getPoolByMints: () =>
|
|
212
|
-
getPoolInitAddresses: () =>
|
|
213
|
-
getPoolVault0Address: () =>
|
|
214
|
-
getPoolVault1Address: () =>
|
|
215
|
-
getPositionAddress: () =>
|
|
216
|
-
getPositionAddressFromParams: () =>
|
|
217
|
-
getPositionValue: () =>
|
|
218
|
-
getPreviewSwapExactInDiscriminatorBytes: () =>
|
|
219
|
-
getPreviewSwapExactInInstruction: () =>
|
|
220
|
-
getPreviewSwapExactInInstructionDataCodec: () =>
|
|
221
|
-
getPreviewSwapExactInInstructionDataDecoder: () =>
|
|
222
|
-
getPreviewSwapExactInInstructionDataEncoder: () =>
|
|
223
|
-
getProtocolFeeOwnerAddress: () =>
|
|
224
|
-
getProtocolFeePositionAddress: () =>
|
|
225
|
-
getRedeemProtocolSharesDiscriminatorBytes: () =>
|
|
226
|
-
getRedeemProtocolSharesInstruction: () =>
|
|
227
|
-
getRedeemProtocolSharesInstructionAsync: () =>
|
|
228
|
-
getRedeemProtocolSharesInstructionDataCodec: () =>
|
|
229
|
-
getRedeemProtocolSharesInstructionDataDecoder: () =>
|
|
230
|
-
getRedeemProtocolSharesInstructionDataEncoder: () =>
|
|
231
|
-
getRemoveLiquidityDiscriminatorBytes: () =>
|
|
232
|
-
getRemoveLiquidityInstruction: () =>
|
|
233
|
-
getRemoveLiquidityInstructionAsync: () =>
|
|
234
|
-
getRemoveLiquidityInstructionDataCodec: () =>
|
|
235
|
-
getRemoveLiquidityInstructionDataDecoder: () =>
|
|
236
|
-
getRemoveLiquidityInstructionDataEncoder: () =>
|
|
237
|
-
getRemoveLiquidityQuote: () =>
|
|
238
|
-
getSetFeesDiscriminatorBytes: () =>
|
|
239
|
-
getSetFeesInstruction: () =>
|
|
240
|
-
getSetFeesInstructionDataCodec: () =>
|
|
241
|
-
getSetFeesInstructionDataDecoder: () =>
|
|
242
|
-
getSetFeesInstructionDataEncoder: () =>
|
|
243
|
-
getSetHookDiscriminatorBytes: () =>
|
|
244
|
-
getSetHookInstruction: () =>
|
|
245
|
-
getSetHookInstructionDataCodec: () =>
|
|
246
|
-
getSetHookInstructionDataDecoder: () =>
|
|
247
|
-
getSetHookInstructionDataEncoder: () =>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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,
|
|
284
303
|
isCpmmError: () => isCpmmError,
|
|
285
|
-
isOracleStale: () =>
|
|
286
|
-
|
|
304
|
+
isOracleStale: () => chunk7PXLEMBJ_cjs.isOracleStale,
|
|
305
|
+
isTransactionSigner: () => chunk7PXLEMBJ_cjs.isTransactionSigner,
|
|
306
|
+
isqrt: () => chunk7PXLEMBJ_cjs.isqrt,
|
|
287
307
|
marketCapToCurveParams: () => marketCapToCurveParams,
|
|
288
308
|
marketCapToSingleCurveParams: () => marketCapToSingleCurveParams,
|
|
289
309
|
marketCapToTokenPrice: () => marketCapToTokenPrice,
|
|
290
|
-
maxBigInt: () =>
|
|
291
|
-
minBigInt: () =>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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,
|
|
301
322
|
parseErrorFromLogs: () => parseErrorFromLogs,
|
|
302
|
-
parseInitializeConfigInstruction: () =>
|
|
303
|
-
parseInitializeOracleInstruction: () =>
|
|
304
|
-
parseInitializePoolInstruction: () =>
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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,
|
|
355
|
+
validateMarketCapParameters: () => validateMarketCapParameters,
|
|
356
|
+
warnAccountDecodeFailure: () => chunk7PXLEMBJ_cjs.warnAccountDecodeFailure
|
|
334
357
|
});
|
|
335
358
|
var addressCodec = kit.getAddressCodec();
|
|
336
359
|
var textEncoder = new TextEncoder();
|
|
337
360
|
async function getMetadataAddress(mint) {
|
|
338
361
|
return kit.getProgramDerivedAddress({
|
|
339
|
-
programAddress:
|
|
362
|
+
programAddress: chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
340
363
|
seeds: [
|
|
341
364
|
textEncoder.encode("metadata"),
|
|
342
|
-
addressCodec.encode(
|
|
365
|
+
addressCodec.encode(chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
343
366
|
addressCodec.encode(mint)
|
|
344
367
|
]
|
|
345
368
|
});
|
|
@@ -631,22 +654,6 @@ function getErrorMessage(code) {
|
|
|
631
654
|
}
|
|
632
655
|
return `Unknown error code: ${code}`;
|
|
633
656
|
}
|
|
634
|
-
function isTransactionSigner(value) {
|
|
635
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
636
|
-
}
|
|
637
|
-
function toRemainingAccountMeta(account) {
|
|
638
|
-
if (typeof account === "string") {
|
|
639
|
-
return { address: account, role: kit.AccountRole.READONLY };
|
|
640
|
-
}
|
|
641
|
-
if (isTransactionSigner(account)) {
|
|
642
|
-
return {
|
|
643
|
-
address: account.address,
|
|
644
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
645
|
-
signer: account
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
return account;
|
|
649
|
-
}
|
|
650
657
|
function createSwapInstruction(params) {
|
|
651
658
|
const {
|
|
652
659
|
config,
|
|
@@ -668,12 +675,12 @@ function createSwapInstruction(params) {
|
|
|
668
675
|
token0Program,
|
|
669
676
|
token1Program,
|
|
670
677
|
tokenProgram,
|
|
671
|
-
programId =
|
|
678
|
+
programId = chunk7PXLEMBJ_cjs.CPMM_PROGRAM_ADDRESS
|
|
672
679
|
} = params;
|
|
673
680
|
const trader = typeof user === "string" ? kit.createNoopSigner(user) : user;
|
|
674
681
|
const [vaultIn, vaultOut] = tradeDirection === 0 ? [vault0, vault1] : [vault1, vault0];
|
|
675
682
|
const [userIn, userOut] = tradeDirection === 0 ? [userToken0, userToken1] : [userToken1, userToken0];
|
|
676
|
-
const instruction =
|
|
683
|
+
const instruction = chunk7PXLEMBJ_cjs.getSwapExactInInstruction(
|
|
677
684
|
{
|
|
678
685
|
config,
|
|
679
686
|
pool,
|
|
@@ -685,8 +692,8 @@ function createSwapInstruction(params) {
|
|
|
685
692
|
userIn,
|
|
686
693
|
userOut,
|
|
687
694
|
trader,
|
|
688
|
-
token0Program: token0Program ?? tokenProgram ??
|
|
689
|
-
token1Program: token1Program ?? tokenProgram ??
|
|
695
|
+
token0Program: token0Program ?? tokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
696
|
+
token1Program: token1Program ?? tokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
690
697
|
oracle,
|
|
691
698
|
amountIn,
|
|
692
699
|
minAmountOut,
|
|
@@ -699,23 +706,15 @@ function createSwapInstruction(params) {
|
|
|
699
706
|
...instruction,
|
|
700
707
|
accounts: [
|
|
701
708
|
...instruction.accounts ?? [],
|
|
702
|
-
...remainingAccounts.map(
|
|
709
|
+
...remainingAccounts.map(chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta)
|
|
703
710
|
]
|
|
704
711
|
};
|
|
705
712
|
}
|
|
706
713
|
var MAX_FEE_AMOUNT = BigInt("18446744073709551615");
|
|
707
714
|
|
|
708
715
|
// src/solana/client/config.ts
|
|
709
|
-
function
|
|
710
|
-
const
|
|
711
|
-
const bytes = new Uint8Array(binary.length);
|
|
712
|
-
for (let i = 0; i < binary.length; i++) {
|
|
713
|
-
bytes[i] = binary.charCodeAt(i);
|
|
714
|
-
}
|
|
715
|
-
return bytes;
|
|
716
|
-
}
|
|
717
|
-
async function fetchConfig(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
718
|
-
const [configAddress] = await chunkU6B52TBT_cjs.getConfigAddress(programId);
|
|
716
|
+
async function fetchConfig(rpc, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
717
|
+
const [configAddress] = await chunk4CI2M2F6_cjs.getConfigAddress(programId);
|
|
719
718
|
const response = await rpc.getAccountInfo(configAddress, {
|
|
720
719
|
encoding: "base64",
|
|
721
720
|
commitment
|
|
@@ -723,10 +722,10 @@ async function fetchConfig(rpc, programId = chunkU6B52TBT_cjs.CPMM_PROGRAM_ID, c
|
|
|
723
722
|
if (!response.value) {
|
|
724
723
|
return null;
|
|
725
724
|
}
|
|
726
|
-
return
|
|
725
|
+
return chunk7PXLEMBJ_cjs.decodeAmmConfig(chunk7PXLEMBJ_cjs.base64ToBytes(response.value.data[0]));
|
|
727
726
|
}
|
|
728
|
-
async function fetchConfigWithAddress(rpc, programId =
|
|
729
|
-
const [configAddress] = await
|
|
727
|
+
async function fetchConfigWithAddress(rpc, programId = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID, commitment) {
|
|
728
|
+
const [configAddress] = await chunk4CI2M2F6_cjs.getConfigAddress(programId);
|
|
730
729
|
const account = await fetchConfig(rpc, programId, commitment);
|
|
731
730
|
if (!account) {
|
|
732
731
|
return null;
|
|
@@ -734,22 +733,32 @@ async function fetchConfigWithAddress(rpc, programId = chunkU6B52TBT_cjs.CPMM_PR
|
|
|
734
733
|
return { address: configAddress, account };
|
|
735
734
|
}
|
|
736
735
|
|
|
737
|
-
// src/solana/
|
|
738
|
-
var
|
|
739
|
-
chunkQ7SFCCGT_cjs.__export(
|
|
736
|
+
// src/solana/cpmmHook/index.ts
|
|
737
|
+
var cpmmHook_exports = {};
|
|
738
|
+
chunkQ7SFCCGT_cjs.__export(cpmmHook_exports, {
|
|
740
739
|
ADD_COSIGNER_DISCRIMINATOR: () => ADD_COSIGNER_DISCRIMINATOR,
|
|
741
740
|
COSIGNER_CONFIG_DISCRIMINATOR: () => COSIGNER_CONFIG_DISCRIMINATOR,
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
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,
|
|
753
762
|
GATE_EXPIRY_DISABLED: () => GATE_EXPIRY_DISABLED,
|
|
754
763
|
GATE_EXPIRY_HEADER_LEN: () => GATE_EXPIRY_HEADER_LEN,
|
|
755
764
|
GATE_EXPIRY_PAYLOAD_LEN: () => GATE_EXPIRY_PAYLOAD_LEN,
|
|
@@ -759,12 +768,15 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
759
768
|
INITIALIZE_CONFIG_DISCRIMINATOR: () => INITIALIZE_CONFIG_DISCRIMINATOR2,
|
|
760
769
|
MAX_COSIGNERS: () => MAX_COSIGNERS,
|
|
761
770
|
REMOVE_COSIGNER_DISCRIMINATOR: () => REMOVE_COSIGNER_DISCRIMINATOR,
|
|
762
|
-
|
|
771
|
+
SEED_CPMM_HOOK_CONFIG: () => SEED_CPMM_HOOK_CONFIG,
|
|
763
772
|
SET_AUTHORITY_DISCRIMINATOR: () => SET_AUTHORITY_DISCRIMINATOR,
|
|
764
|
-
|
|
773
|
+
cpmmHookProgram: () => cpmmHookProgram,
|
|
765
774
|
decodeCosignerConfig: () => decodeCosignerConfig,
|
|
766
775
|
decodeCosignerGateExpiryPayload: () => decodeCosignerGateExpiryPayload,
|
|
767
776
|
encodeCosignerGateExpiryPayload: () => encodeCosignerGateExpiryPayload,
|
|
777
|
+
encodeCpmmHookPayload: () => encodeCpmmHookPayload,
|
|
778
|
+
encodeDynamicFeeCosignerGatePayload: () => encodeDynamicFeeCosignerGatePayload,
|
|
779
|
+
encodeDynamicFeeSchedule: () => encodeDynamicFeeSchedule,
|
|
768
780
|
fetchAllCosignerConfig: () => fetchAllCosignerConfig,
|
|
769
781
|
fetchAllMaybeCosignerConfig: () => fetchAllMaybeCosignerConfig,
|
|
770
782
|
fetchCosignerConfig: () => fetchCosignerConfig,
|
|
@@ -784,9 +796,10 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
784
796
|
getCosignerConfigEncoder: () => getCosignerConfigEncoder,
|
|
785
797
|
getCosignerConfigSize: () => getCosignerConfigSize,
|
|
786
798
|
getCosignerGateStatus: () => getCosignerGateStatus,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
799
|
+
getCpmmHookConfigAddress: () => getCpmmHookConfigAddress,
|
|
800
|
+
getCpmmHookErrorMessage: () => getCpmmHookErrorMessage,
|
|
801
|
+
getCpmmHookRemainingAccountAddresses: () => getCpmmHookRemainingAccountAddresses,
|
|
802
|
+
getCpmmHookRemainingAccounts: () => getCpmmHookRemainingAccounts,
|
|
790
803
|
getInitializeConfigArgsCodec: () => getInitializeConfigArgsCodec,
|
|
791
804
|
getInitializeConfigArgsDecoder: () => getInitializeConfigArgsDecoder,
|
|
792
805
|
getInitializeConfigArgsEncoder: () => getInitializeConfigArgsEncoder,
|
|
@@ -811,15 +824,17 @@ chunkQ7SFCCGT_cjs.__export(cosignerHook_exports, {
|
|
|
811
824
|
getSetAuthorityInstructionDataCodec: () => getSetAuthorityInstructionDataCodec,
|
|
812
825
|
getSetAuthorityInstructionDataDecoder: () => getSetAuthorityInstructionDataDecoder,
|
|
813
826
|
getSetAuthorityInstructionDataEncoder: () => getSetAuthorityInstructionDataEncoder,
|
|
814
|
-
|
|
815
|
-
|
|
827
|
+
identifyCpmmHookAccount: () => identifyCpmmHookAccount,
|
|
828
|
+
identifyCpmmHookInstruction: () => identifyCpmmHookInstruction,
|
|
816
829
|
isCosignerGateEnforced: () => isCosignerGateEnforced,
|
|
817
|
-
|
|
830
|
+
isCpmmHookError: () => isCpmmHookError,
|
|
831
|
+
isDynamicFeeSchedulePayload: () => isDynamicFeeSchedulePayload,
|
|
818
832
|
parseAddCosignerInstruction: () => parseAddCosignerInstruction,
|
|
819
|
-
|
|
833
|
+
parseCpmmHookInstruction: () => parseCpmmHookInstruction,
|
|
820
834
|
parseInitializeConfigInstruction: () => parseInitializeConfigInstruction2,
|
|
821
835
|
parseRemoveCosignerInstruction: () => parseRemoveCosignerInstruction,
|
|
822
|
-
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction
|
|
836
|
+
parseSetAuthorityInstruction: () => parseSetAuthorityInstruction,
|
|
837
|
+
validateDynamicFeeScheduleArgs: () => validateDynamicFeeScheduleArgs
|
|
823
838
|
});
|
|
824
839
|
var COSIGNER_CONFIG_DISCRIMINATOR = new Uint8Array([
|
|
825
840
|
133,
|
|
@@ -870,13 +885,13 @@ function decodeCosignerConfig(encodedAccount) {
|
|
|
870
885
|
getCosignerConfigDecoder()
|
|
871
886
|
);
|
|
872
887
|
}
|
|
873
|
-
async function fetchCosignerConfig(rpc,
|
|
874
|
-
const maybeAccount = await fetchMaybeCosignerConfig(rpc,
|
|
888
|
+
async function fetchCosignerConfig(rpc, address6, config) {
|
|
889
|
+
const maybeAccount = await fetchMaybeCosignerConfig(rpc, address6, config);
|
|
875
890
|
kit.assertAccountExists(maybeAccount);
|
|
876
891
|
return maybeAccount;
|
|
877
892
|
}
|
|
878
|
-
async function fetchMaybeCosignerConfig(rpc,
|
|
879
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
893
|
+
async function fetchMaybeCosignerConfig(rpc, address6, config) {
|
|
894
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
880
895
|
return decodeCosignerConfig(maybeAccount);
|
|
881
896
|
}
|
|
882
897
|
async function fetchAllCosignerConfig(rpc, addresses, config) {
|
|
@@ -934,7 +949,7 @@ function getAddCosignerInstructionDataCodec() {
|
|
|
934
949
|
);
|
|
935
950
|
}
|
|
936
951
|
async function getAddCosignerInstructionAsync(input, config) {
|
|
937
|
-
const programAddress = config?.programAddress ??
|
|
952
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
938
953
|
const originalAccounts = {
|
|
939
954
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
940
955
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -985,7 +1000,7 @@ async function getAddCosignerInstructionAsync(input, config) {
|
|
|
985
1000
|
});
|
|
986
1001
|
}
|
|
987
1002
|
function getAddCosignerInstruction(input, config) {
|
|
988
|
-
const programAddress = config?.programAddress ??
|
|
1003
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
989
1004
|
const originalAccounts = {
|
|
990
1005
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
991
1006
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1016,9 +1031,9 @@ function parseAddCosignerInstruction(instruction) {
|
|
|
1016
1031
|
}
|
|
1017
1032
|
let accountIndex = 0;
|
|
1018
1033
|
const getNextAccount = () => {
|
|
1019
|
-
const
|
|
1034
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1020
1035
|
accountIndex += 1;
|
|
1021
|
-
return
|
|
1036
|
+
return accountMeta2;
|
|
1022
1037
|
};
|
|
1023
1038
|
return {
|
|
1024
1039
|
programAddress: instruction.programAddress,
|
|
@@ -1063,7 +1078,7 @@ function getInitializeConfigInstructionDataCodec2() {
|
|
|
1063
1078
|
);
|
|
1064
1079
|
}
|
|
1065
1080
|
async function getInitializeConfigInstructionAsync2(input, config) {
|
|
1066
|
-
const programAddress = config?.programAddress ??
|
|
1081
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1067
1082
|
const originalAccounts = {
|
|
1068
1083
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1069
1084
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1123,7 +1138,7 @@ async function getInitializeConfigInstructionAsync2(input, config) {
|
|
|
1123
1138
|
});
|
|
1124
1139
|
}
|
|
1125
1140
|
function getInitializeConfigInstruction2(input, config) {
|
|
1126
|
-
const programAddress = config?.programAddress ??
|
|
1141
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1127
1142
|
const originalAccounts = {
|
|
1128
1143
|
payer: { value: input.payer ?? null, isWritable: true },
|
|
1129
1144
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
@@ -1163,9 +1178,9 @@ function parseInitializeConfigInstruction2(instruction) {
|
|
|
1163
1178
|
}
|
|
1164
1179
|
let accountIndex = 0;
|
|
1165
1180
|
const getNextAccount = () => {
|
|
1166
|
-
const
|
|
1181
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1167
1182
|
accountIndex += 1;
|
|
1168
|
-
return
|
|
1183
|
+
return accountMeta2;
|
|
1169
1184
|
};
|
|
1170
1185
|
return {
|
|
1171
1186
|
programAddress: instruction.programAddress,
|
|
@@ -1216,7 +1231,7 @@ function getRemoveCosignerInstructionDataCodec() {
|
|
|
1216
1231
|
);
|
|
1217
1232
|
}
|
|
1218
1233
|
async function getRemoveCosignerInstructionAsync(input, config) {
|
|
1219
|
-
const programAddress = config?.programAddress ??
|
|
1234
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1220
1235
|
const originalAccounts = {
|
|
1221
1236
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1222
1237
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1267,7 +1282,7 @@ async function getRemoveCosignerInstructionAsync(input, config) {
|
|
|
1267
1282
|
});
|
|
1268
1283
|
}
|
|
1269
1284
|
function getRemoveCosignerInstruction(input, config) {
|
|
1270
|
-
const programAddress = config?.programAddress ??
|
|
1285
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1271
1286
|
const originalAccounts = {
|
|
1272
1287
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1273
1288
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1298,9 +1313,9 @@ function parseRemoveCosignerInstruction(instruction) {
|
|
|
1298
1313
|
}
|
|
1299
1314
|
let accountIndex = 0;
|
|
1300
1315
|
const getNextAccount = () => {
|
|
1301
|
-
const
|
|
1316
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1302
1317
|
accountIndex += 1;
|
|
1303
|
-
return
|
|
1318
|
+
return accountMeta2;
|
|
1304
1319
|
};
|
|
1305
1320
|
return {
|
|
1306
1321
|
programAddress: instruction.programAddress,
|
|
@@ -1345,7 +1360,7 @@ function getSetAuthorityInstructionDataCodec() {
|
|
|
1345
1360
|
);
|
|
1346
1361
|
}
|
|
1347
1362
|
async function getSetAuthorityInstructionAsync(input, config) {
|
|
1348
|
-
const programAddress = config?.programAddress ??
|
|
1363
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1349
1364
|
const originalAccounts = {
|
|
1350
1365
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1351
1366
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1396,7 +1411,7 @@ async function getSetAuthorityInstructionAsync(input, config) {
|
|
|
1396
1411
|
});
|
|
1397
1412
|
}
|
|
1398
1413
|
function getSetAuthorityInstruction(input, config) {
|
|
1399
|
-
const programAddress = config?.programAddress ??
|
|
1414
|
+
const programAddress = config?.programAddress ?? CPMM_HOOK_PROGRAM_ADDRESS;
|
|
1400
1415
|
const originalAccounts = {
|
|
1401
1416
|
adminAuthority: { value: input.adminAuthority ?? null, isWritable: false },
|
|
1402
1417
|
config: { value: input.config ?? null, isWritable: true }
|
|
@@ -1427,9 +1442,9 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1427
1442
|
}
|
|
1428
1443
|
let accountIndex = 0;
|
|
1429
1444
|
const getNextAccount = () => {
|
|
1430
|
-
const
|
|
1445
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
1431
1446
|
accountIndex += 1;
|
|
1432
|
-
return
|
|
1447
|
+
return accountMeta2;
|
|
1433
1448
|
};
|
|
1434
1449
|
return {
|
|
1435
1450
|
programAddress: instruction.programAddress,
|
|
@@ -1438,13 +1453,13 @@ function parseSetAuthorityInstruction(instruction) {
|
|
|
1438
1453
|
};
|
|
1439
1454
|
}
|
|
1440
1455
|
|
|
1441
|
-
// src/solana/generated/
|
|
1442
|
-
var
|
|
1443
|
-
var
|
|
1444
|
-
|
|
1445
|
-
return
|
|
1446
|
-
})(
|
|
1447
|
-
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) {
|
|
1448
1463
|
const data = "data" in account ? account.data : account;
|
|
1449
1464
|
if (kit.containsBytes(
|
|
1450
1465
|
data,
|
|
@@ -1457,17 +1472,17 @@ function identifyCosignerHookAccount(account) {
|
|
|
1457
1472
|
}
|
|
1458
1473
|
throw new kit.SolanaError(
|
|
1459
1474
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT,
|
|
1460
|
-
{ accountData: data, programName: "
|
|
1475
|
+
{ accountData: data, programName: "cpmmHook" }
|
|
1461
1476
|
);
|
|
1462
1477
|
}
|
|
1463
|
-
var
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
return
|
|
1469
|
-
})(
|
|
1470
|
-
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) {
|
|
1471
1486
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
1472
1487
|
if (kit.containsBytes(
|
|
1473
1488
|
data,
|
|
@@ -1507,11 +1522,11 @@ function identifyCosignerHookInstruction(instruction) {
|
|
|
1507
1522
|
}
|
|
1508
1523
|
throw new kit.SolanaError(
|
|
1509
1524
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
1510
|
-
{ instructionData: data, programName: "
|
|
1525
|
+
{ instructionData: data, programName: "cpmmHook" }
|
|
1511
1526
|
);
|
|
1512
1527
|
}
|
|
1513
|
-
function
|
|
1514
|
-
const instructionType =
|
|
1528
|
+
function parseCpmmHookInstruction(instruction) {
|
|
1529
|
+
const instructionType = identifyCpmmHookInstruction(instruction);
|
|
1515
1530
|
switch (instructionType) {
|
|
1516
1531
|
case 0 /* AddCosigner */: {
|
|
1517
1532
|
kit.assertIsInstructionWithAccounts(instruction);
|
|
@@ -1544,18 +1559,15 @@ function parseCosignerHookInstruction(instruction) {
|
|
|
1544
1559
|
default:
|
|
1545
1560
|
throw new kit.SolanaError(
|
|
1546
1561
|
kit.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
1547
|
-
{
|
|
1548
|
-
instructionType,
|
|
1549
|
-
programName: "cosignerHook"
|
|
1550
|
-
}
|
|
1562
|
+
{ instructionType, programName: "cpmmHook" }
|
|
1551
1563
|
);
|
|
1552
1564
|
}
|
|
1553
1565
|
}
|
|
1554
|
-
function
|
|
1566
|
+
function cpmmHookProgram() {
|
|
1555
1567
|
return (client) => {
|
|
1556
1568
|
return {
|
|
1557
1569
|
...client,
|
|
1558
|
-
|
|
1570
|
+
cpmmHook: {
|
|
1559
1571
|
accounts: {
|
|
1560
1572
|
cosignerConfig: programClientCore.addSelfFetchFunctions(
|
|
1561
1573
|
client,
|
|
@@ -1588,35 +1600,45 @@ function cosignerHookProgram() {
|
|
|
1588
1600
|
};
|
|
1589
1601
|
}
|
|
1590
1602
|
|
|
1591
|
-
// src/solana/generated/
|
|
1592
|
-
var
|
|
1593
|
-
var
|
|
1594
|
-
var
|
|
1595
|
-
var
|
|
1596
|
-
var
|
|
1597
|
-
var
|
|
1598
|
-
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;
|
|
1599
1616
|
if (process.env.NODE_ENV !== "production") {
|
|
1600
|
-
|
|
1601
|
-
[
|
|
1602
|
-
[
|
|
1603
|
-
[
|
|
1604
|
-
[
|
|
1605
|
-
[
|
|
1606
|
-
[
|
|
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`
|
|
1607
1629
|
};
|
|
1608
1630
|
}
|
|
1609
|
-
function
|
|
1631
|
+
function getCpmmHookErrorMessage(code) {
|
|
1610
1632
|
if (process.env.NODE_ENV !== "production") {
|
|
1611
|
-
return
|
|
1633
|
+
return cpmmHookErrorMessages[code];
|
|
1612
1634
|
}
|
|
1613
1635
|
return "Error message not available in production bundles.";
|
|
1614
1636
|
}
|
|
1615
|
-
function
|
|
1637
|
+
function isCpmmHookError(error, transactionMessage, code) {
|
|
1616
1638
|
return kit.isProgramError(
|
|
1617
1639
|
error,
|
|
1618
1640
|
transactionMessage,
|
|
1619
|
-
|
|
1641
|
+
CPMM_HOOK_PROGRAM_ADDRESS,
|
|
1620
1642
|
code
|
|
1621
1643
|
);
|
|
1622
1644
|
}
|
|
@@ -1657,11 +1679,11 @@ function getSetAuthorityArgsCodec() {
|
|
|
1657
1679
|
getSetAuthorityArgsDecoder()
|
|
1658
1680
|
);
|
|
1659
1681
|
}
|
|
1660
|
-
var
|
|
1661
|
-
"
|
|
1682
|
+
var DEVNET_CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
1683
|
+
"HVsPNZh98TgChUXHwKrUG47SUqvGQHxUy5wZwcQLFD4i"
|
|
1662
1684
|
);
|
|
1663
|
-
var
|
|
1664
|
-
var
|
|
1685
|
+
var CPMM_HOOK_PROGRAM_ID = DEVNET_CPMM_HOOK_PROGRAM_ID;
|
|
1686
|
+
var SEED_CPMM_HOOK_CONFIG = "cosigner_hook_config";
|
|
1665
1687
|
var MAX_COSIGNERS = 32;
|
|
1666
1688
|
var GATE_EXPIRY_DISABLED = 0;
|
|
1667
1689
|
var GATE_EXPIRY_UNIX_TIMESTAMP = 1;
|
|
@@ -1669,15 +1691,146 @@ var GATE_EXPIRY_SLOT = 2;
|
|
|
1669
1691
|
var GATE_EXPIRY_PAYLOAD_VERSION = 1;
|
|
1670
1692
|
var GATE_EXPIRY_HEADER_LEN = 10;
|
|
1671
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
|
+
}
|
|
1672
1828
|
var INITIALIZER_PROGRAM_ID = kit.address(
|
|
1673
1829
|
"4h3Dqyo5qmteJoMxXt3tdtfXELDB6pdRTPU9mWruiKp1"
|
|
1674
1830
|
);
|
|
1675
1831
|
var BPF_LOADER_UPGRADEABLE_PROGRAM_ID = kit.address(
|
|
1676
1832
|
"BPFLoaderUpgradeab1e11111111111111111111111"
|
|
1677
1833
|
);
|
|
1678
|
-
var CPMM_HOOK_PROGRAM_ID = kit.address(
|
|
1679
|
-
"2vJ1c62knEwZbxp3XdHB4RSmCfz55pA6tRkCho63gW7u"
|
|
1680
|
-
);
|
|
1681
1834
|
var PREDICTION_HOOK_PROGRAM_ID = kit.address(
|
|
1682
1835
|
"7QcQDANJVC17Jgc6KjjeagSkm2zAphgHVPK5agJzyihB"
|
|
1683
1836
|
);
|
|
@@ -1859,10 +2012,10 @@ function getCurveSwapFeeAmount(amountIn, swapFeeBps) {
|
|
|
1859
2012
|
if (amountIn < 0n) {
|
|
1860
2013
|
throw new Error("amountIn must be non-negative");
|
|
1861
2014
|
}
|
|
1862
|
-
if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(
|
|
2015
|
+
if (!Number.isInteger(swapFeeBps) || swapFeeBps < 0 || swapFeeBps > Number(chunk4CI2M2F6_cjs.BPS_DENOM)) {
|
|
1863
2016
|
throw new Error("swapFeeBps must be an integer from 0 to 10000");
|
|
1864
2017
|
}
|
|
1865
|
-
return
|
|
2018
|
+
return chunk7PXLEMBJ_cjs.ceilDiv(amountIn * BigInt(swapFeeBps), chunk4CI2M2F6_cjs.BPS_DENOM);
|
|
1866
2019
|
}
|
|
1867
2020
|
function phaseLabel(phase) {
|
|
1868
2021
|
switch (phase) {
|
|
@@ -1877,148 +2030,112 @@ function phaseLabel(phase) {
|
|
|
1877
2030
|
}
|
|
1878
2031
|
}
|
|
1879
2032
|
|
|
1880
|
-
// src/solana/
|
|
1881
|
-
var
|
|
1882
|
-
|
|
2033
|
+
// src/solana/cpmmHook/payload.ts
|
|
2034
|
+
var MAX_I64 = (1n << 63n) - 1n;
|
|
2035
|
+
var MAX_U32 = (1n << 32n) - 1n;
|
|
2036
|
+
function toBigInt2(value) {
|
|
1883
2037
|
return typeof value === "bigint" ? value : BigInt(value);
|
|
1884
2038
|
}
|
|
1885
|
-
function
|
|
1886
|
-
|
|
1887
|
-
}
|
|
1888
|
-
function readU64Le(bytes, offset) {
|
|
1889
|
-
let value = 0n;
|
|
1890
|
-
for (let i = 0; i < 8; i++) {
|
|
1891
|
-
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`);
|
|
1892
2042
|
}
|
|
1893
|
-
return value;
|
|
1894
2043
|
}
|
|
1895
|
-
function
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
}
|
|
2044
|
+
function writeI64Le(bytes, offset, value) {
|
|
2045
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2046
|
+
view.setBigInt64(offset, value, true);
|
|
1899
2047
|
}
|
|
1900
|
-
function
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
throw new Error("Cosigner hint cannot be encoded for disabled gates");
|
|
1904
|
-
}
|
|
1905
|
-
return new Uint8Array();
|
|
1906
|
-
}
|
|
1907
|
-
if (!isValidExpiryMode(expiry.mode)) {
|
|
1908
|
-
throw new Error(`Invalid cosigner gate expiry mode: ${expiry.mode}`);
|
|
1909
|
-
}
|
|
1910
|
-
const value = toBigInt(expiry.value);
|
|
1911
|
-
if (value < 0n || value > MAX_U64) {
|
|
1912
|
-
throw new Error(`Invalid cosigner gate expiry value: ${expiry.value}`);
|
|
1913
|
-
}
|
|
1914
|
-
if (expiry.cosigner === void 0) {
|
|
1915
|
-
throw new Error("Cosigner hint is required for expiring gates");
|
|
1916
|
-
}
|
|
1917
|
-
const payload = new Uint8Array(GATE_EXPIRY_PAYLOAD_LEN);
|
|
1918
|
-
payload[0] = GATE_EXPIRY_PAYLOAD_VERSION;
|
|
1919
|
-
payload[1] = expiry.mode;
|
|
1920
|
-
writeU64Le(payload, 2, value);
|
|
1921
|
-
payload.set(
|
|
1922
|
-
kit.getAddressEncoder().encode(expiry.cosigner),
|
|
1923
|
-
GATE_EXPIRY_HEADER_LEN
|
|
1924
|
-
);
|
|
1925
|
-
return payload;
|
|
2048
|
+
function writeU16Le(bytes, offset, value) {
|
|
2049
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2050
|
+
view.setUint16(offset, value, true);
|
|
1926
2051
|
}
|
|
1927
|
-
function
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
}
|
|
1931
|
-
if (payload.length !== GATE_EXPIRY_PAYLOAD_LEN || payload[0] !== GATE_EXPIRY_PAYLOAD_VERSION) {
|
|
1932
|
-
return null;
|
|
1933
|
-
}
|
|
1934
|
-
const mode = payload[1] ?? GATE_EXPIRY_DISABLED;
|
|
1935
|
-
if (!isValidExpiryMode(mode)) {
|
|
1936
|
-
return null;
|
|
1937
|
-
}
|
|
1938
|
-
return {
|
|
1939
|
-
mode,
|
|
1940
|
-
value: readU64Le(payload, 2),
|
|
1941
|
-
cosigner: kit.getAddressDecoder().decode(
|
|
1942
|
-
payload.slice(GATE_EXPIRY_HEADER_LEN, GATE_EXPIRY_PAYLOAD_LEN)
|
|
1943
|
-
)
|
|
1944
|
-
};
|
|
2052
|
+
function writeU32Le(bytes, offset, value) {
|
|
2053
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
2054
|
+
view.setUint32(offset, Number(value), true);
|
|
1945
2055
|
}
|
|
1946
|
-
function
|
|
1947
|
-
const
|
|
1948
|
-
if (
|
|
1949
|
-
|
|
1950
|
-
gateEnforced: true,
|
|
1951
|
-
expiryMode: GATE_EXPIRY_DISABLED,
|
|
1952
|
-
expiryValue: 0n,
|
|
1953
|
-
reason: "invalid_expiry_payload"
|
|
1954
|
-
};
|
|
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");
|
|
1955
2060
|
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
expiryValue: expiry.value,
|
|
1961
|
-
reason: "expiry_disabled"
|
|
1962
|
-
};
|
|
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");
|
|
1963
2065
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
return {
|
|
1968
|
-
gateEnforced: !expired,
|
|
1969
|
-
expiryMode: expiry.mode,
|
|
1970
|
-
expiryValue: expiry.value,
|
|
1971
|
-
reason: expired ? "timestamp_expired" : "timestamp_pending"
|
|
1972
|
-
};
|
|
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");
|
|
1973
2069
|
}
|
|
1974
|
-
if (
|
|
1975
|
-
|
|
1976
|
-
return {
|
|
1977
|
-
gateEnforced: true,
|
|
1978
|
-
expiryMode: expiry.mode,
|
|
1979
|
-
expiryValue: expiry.value,
|
|
1980
|
-
reason: "slot_unavailable"
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
const expired = toBigInt(clock.slot) >= expiry.value;
|
|
1984
|
-
return {
|
|
1985
|
-
gateEnforced: !expired,
|
|
1986
|
-
expiryMode: expiry.mode,
|
|
1987
|
-
expiryValue: expiry.value,
|
|
1988
|
-
reason: expired ? "slot_expired" : "slot_pending"
|
|
1989
|
-
};
|
|
2070
|
+
if (schedule.startFeeBps > schedule.endFeeBps && durationSeconds === 0n) {
|
|
2071
|
+
throw new Error("durationSeconds must be nonzero for decaying schedules");
|
|
1990
2072
|
}
|
|
1991
|
-
return {
|
|
1992
|
-
gateEnforced: true,
|
|
1993
|
-
expiryMode: expiry.mode,
|
|
1994
|
-
expiryValue: expiry.value,
|
|
1995
|
-
reason: "invalid_expiry_mode"
|
|
1996
|
-
};
|
|
2073
|
+
return { startingTime, durationSeconds };
|
|
1997
2074
|
}
|
|
1998
|
-
function
|
|
1999
|
-
|
|
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);
|
|
2084
|
+
return payload;
|
|
2000
2085
|
}
|
|
2001
|
-
function
|
|
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({
|
|
2002
2098
|
namespace,
|
|
2099
|
+
config,
|
|
2003
2100
|
cosigner
|
|
2004
2101
|
}) {
|
|
2005
|
-
const
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2102
|
+
const signedHookRemainingAccounts = [namespace];
|
|
2103
|
+
if (config && config !== namespace) {
|
|
2104
|
+
signedHookRemainingAccounts.push(config);
|
|
2105
|
+
}
|
|
2106
|
+
if (cosigner) {
|
|
2107
|
+
signedHookRemainingAccounts.push(cosigner);
|
|
2108
|
+
}
|
|
2109
|
+
const unsignedHookRemainingAccounts = signedHookRemainingAccounts.map(
|
|
2110
|
+
chunk7PXLEMBJ_cjs.getAddressFromRemainingAccount
|
|
2111
|
+
);
|
|
2009
2112
|
return {
|
|
2010
|
-
signedHookRemainingAccounts
|
|
2113
|
+
signedHookRemainingAccounts,
|
|
2011
2114
|
unsignedHookRemainingAccounts,
|
|
2012
2115
|
hookRemainingAccountsHash: computeRemainingAccountsHash(
|
|
2013
2116
|
unsignedHookRemainingAccounts
|
|
2014
2117
|
)
|
|
2015
2118
|
};
|
|
2016
2119
|
}
|
|
2120
|
+
function getCpmmHookRemainingAccountAddresses({
|
|
2121
|
+
namespace,
|
|
2122
|
+
config,
|
|
2123
|
+
cosigner
|
|
2124
|
+
}) {
|
|
2125
|
+
return getCpmmHookRemainingAccounts({
|
|
2126
|
+
namespace,
|
|
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);
|
|
2133
|
+
}
|
|
2017
2134
|
var textEncoder2 = new TextEncoder();
|
|
2018
|
-
async function
|
|
2135
|
+
async function getCpmmHookConfigAddress(programId = CPMM_HOOK_PROGRAM_ID) {
|
|
2019
2136
|
return kit.getProgramDerivedAddress({
|
|
2020
2137
|
programAddress: programId,
|
|
2021
|
-
seeds: [textEncoder2.encode(
|
|
2138
|
+
seeds: [textEncoder2.encode(SEED_CPMM_HOOK_CONFIG)]
|
|
2022
2139
|
});
|
|
2023
2140
|
}
|
|
2024
2141
|
|
|
@@ -2026,7 +2143,6 @@ async function getCosignerHookConfigAddress(programId = COSIGNER_HOOK_PROGRAM_ID
|
|
|
2026
2143
|
var initializer_exports = {};
|
|
2027
2144
|
chunkQ7SFCCGT_cjs.__export(initializer_exports, {
|
|
2028
2145
|
BPF_LOADER_UPGRADEABLE_PROGRAM_ID: () => BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
|
|
2029
|
-
CPMM_HOOK_PROGRAM_ID: () => CPMM_HOOK_PROGRAM_ID,
|
|
2030
2146
|
CURVE_KIND_XYK: () => CURVE_KIND_XYK,
|
|
2031
2147
|
CURVE_PARAMS_FORMAT_XYK_V0: () => CURVE_PARAMS_FORMAT_XYK_V0,
|
|
2032
2148
|
DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND: () => DEFAULT_LOOKUP_TABLE_ADDRESSES_PER_EXTEND,
|
|
@@ -3143,24 +3259,15 @@ function launchIdFromU64(launchId) {
|
|
|
3143
3259
|
out.set(encodeU64LE(launchId), 0);
|
|
3144
3260
|
return out;
|
|
3145
3261
|
}
|
|
3146
|
-
function isTransactionSigner2(value) {
|
|
3147
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3148
|
-
}
|
|
3149
|
-
function createSignerAccountMeta(value, role) {
|
|
3150
|
-
if (isTransactionSigner2(value)) {
|
|
3151
|
-
return { address: value.address, role, signer: value };
|
|
3152
|
-
}
|
|
3153
|
-
return { address: value, role };
|
|
3154
|
-
}
|
|
3155
3262
|
function createInitializeConfigInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
3156
3263
|
const {
|
|
3157
3264
|
admin,
|
|
3158
3265
|
config,
|
|
3159
3266
|
programData,
|
|
3160
|
-
systemProgram =
|
|
3267
|
+
systemProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS
|
|
3161
3268
|
} = accounts;
|
|
3162
3269
|
const keys = [
|
|
3163
|
-
|
|
3270
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3164
3271
|
{ address: config, role: kit.AccountRole.WRITABLE },
|
|
3165
3272
|
{ address: programData, role: kit.AccountRole.READONLY },
|
|
3166
3273
|
{ address: systemProgram, role: kit.AccountRole.READONLY }
|
|
@@ -3170,19 +3277,10 @@ function createInitializeConfigInstruction(accounts, args, programId = INITIALIZ
|
|
|
3170
3277
|
);
|
|
3171
3278
|
return { programAddress: programId, accounts: keys, data };
|
|
3172
3279
|
}
|
|
3173
|
-
function isTransactionSigner3(value) {
|
|
3174
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3175
|
-
}
|
|
3176
|
-
function createSignerAccountMeta2(value, role) {
|
|
3177
|
-
if (isTransactionSigner3(value)) {
|
|
3178
|
-
return { address: value.address, role, signer: value };
|
|
3179
|
-
}
|
|
3180
|
-
return { address: value, role };
|
|
3181
|
-
}
|
|
3182
3280
|
function createSetMigratorAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
3183
3281
|
const { admin, config } = accounts;
|
|
3184
3282
|
const keys = [
|
|
3185
|
-
|
|
3283
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3186
3284
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
3187
3285
|
];
|
|
3188
3286
|
const data = new Uint8Array(
|
|
@@ -3190,19 +3288,10 @@ function createSetMigratorAllowlistInstruction(accounts, allowlist, programId =
|
|
|
3190
3288
|
);
|
|
3191
3289
|
return { programAddress: programId, accounts: keys, data };
|
|
3192
3290
|
}
|
|
3193
|
-
function isTransactionSigner4(value) {
|
|
3194
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
3195
|
-
}
|
|
3196
|
-
function createSignerAccountMeta3(value, role) {
|
|
3197
|
-
if (isTransactionSigner4(value)) {
|
|
3198
|
-
return { address: value.address, role, signer: value };
|
|
3199
|
-
}
|
|
3200
|
-
return { address: value, role };
|
|
3201
|
-
}
|
|
3202
3291
|
function createSetHookAllowlistInstruction(accounts, allowlist, programId = INITIALIZER_PROGRAM_ID) {
|
|
3203
3292
|
const { admin, config } = accounts;
|
|
3204
3293
|
const keys = [
|
|
3205
|
-
|
|
3294
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(admin, kit.AccountRole.WRITABLE_SIGNER),
|
|
3206
3295
|
{ address: config, role: kit.AccountRole.WRITABLE }
|
|
3207
3296
|
];
|
|
3208
3297
|
const data = new Uint8Array(
|
|
@@ -3217,6 +3306,17 @@ var SEED_STATE = "state";
|
|
|
3217
3306
|
var SEED_MIGRATION_AUTHORITY = "migration_authority";
|
|
3218
3307
|
var MAX_RECIPIENTS = 2;
|
|
3219
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
|
+
]),
|
|
3220
3320
|
// SHA256("global:register_launch")[0:8]
|
|
3221
3321
|
registerLaunch: new Uint8Array([
|
|
3222
3322
|
114,
|
|
@@ -3307,13 +3407,13 @@ function decodeClaimReceipt(encodedAccount) {
|
|
|
3307
3407
|
getClaimReceiptDecoder()
|
|
3308
3408
|
);
|
|
3309
3409
|
}
|
|
3310
|
-
async function fetchClaimReceipt(rpc,
|
|
3311
|
-
const maybeAccount = await fetchMaybeClaimReceipt(rpc,
|
|
3410
|
+
async function fetchClaimReceipt(rpc, address6, config) {
|
|
3411
|
+
const maybeAccount = await fetchMaybeClaimReceipt(rpc, address6, config);
|
|
3312
3412
|
kit.assertAccountExists(maybeAccount);
|
|
3313
3413
|
return maybeAccount;
|
|
3314
3414
|
}
|
|
3315
|
-
async function fetchMaybeClaimReceipt(rpc,
|
|
3316
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3415
|
+
async function fetchMaybeClaimReceipt(rpc, address6, config) {
|
|
3416
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3317
3417
|
return decodeClaimReceipt(maybeAccount);
|
|
3318
3418
|
}
|
|
3319
3419
|
async function fetchAllClaimReceipt(rpc, addresses, config) {
|
|
@@ -3377,13 +3477,13 @@ function decodeEntry(encodedAccount) {
|
|
|
3377
3477
|
getEntryDecoder()
|
|
3378
3478
|
);
|
|
3379
3479
|
}
|
|
3380
|
-
async function fetchEntry(rpc,
|
|
3381
|
-
const maybeAccount = await fetchMaybeEntry(rpc,
|
|
3480
|
+
async function fetchEntry(rpc, address6, config) {
|
|
3481
|
+
const maybeAccount = await fetchMaybeEntry(rpc, address6, config);
|
|
3382
3482
|
kit.assertAccountExists(maybeAccount);
|
|
3383
3483
|
return maybeAccount;
|
|
3384
3484
|
}
|
|
3385
|
-
async function fetchMaybeEntry(rpc,
|
|
3386
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3485
|
+
async function fetchMaybeEntry(rpc, address6, config) {
|
|
3486
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3387
3487
|
return decodeEntry(maybeAccount);
|
|
3388
3488
|
}
|
|
3389
3489
|
async function fetchAllEntry(rpc, addresses, config) {
|
|
@@ -3445,13 +3545,13 @@ function decodeEntryByMint(encodedAccount) {
|
|
|
3445
3545
|
getEntryByMintDecoder()
|
|
3446
3546
|
);
|
|
3447
3547
|
}
|
|
3448
|
-
async function fetchEntryByMint(rpc,
|
|
3449
|
-
const maybeAccount = await fetchMaybeEntryByMint(rpc,
|
|
3548
|
+
async function fetchEntryByMint(rpc, address6, config) {
|
|
3549
|
+
const maybeAccount = await fetchMaybeEntryByMint(rpc, address6, config);
|
|
3450
3550
|
kit.assertAccountExists(maybeAccount);
|
|
3451
3551
|
return maybeAccount;
|
|
3452
3552
|
}
|
|
3453
|
-
async function fetchMaybeEntryByMint(rpc,
|
|
3454
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3553
|
+
async function fetchMaybeEntryByMint(rpc, address6, config) {
|
|
3554
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3455
3555
|
return decodeEntryByMint(maybeAccount);
|
|
3456
3556
|
}
|
|
3457
3557
|
async function fetchAllEntryByMint(rpc, addresses, config) {
|
|
@@ -3523,13 +3623,13 @@ function decodeInitConfig(encodedAccount) {
|
|
|
3523
3623
|
getInitConfigDecoder2()
|
|
3524
3624
|
);
|
|
3525
3625
|
}
|
|
3526
|
-
async function fetchInitConfig(rpc,
|
|
3527
|
-
const maybeAccount = await fetchMaybeInitConfig(rpc,
|
|
3626
|
+
async function fetchInitConfig(rpc, address6, config) {
|
|
3627
|
+
const maybeAccount = await fetchMaybeInitConfig(rpc, address6, config);
|
|
3528
3628
|
kit.assertAccountExists(maybeAccount);
|
|
3529
3629
|
return maybeAccount;
|
|
3530
3630
|
}
|
|
3531
|
-
async function fetchMaybeInitConfig(rpc,
|
|
3532
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3631
|
+
async function fetchMaybeInitConfig(rpc, address6, config) {
|
|
3632
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3533
3633
|
return decodeInitConfig(maybeAccount);
|
|
3534
3634
|
}
|
|
3535
3635
|
async function fetchAllInitConfig(rpc, addresses, config) {
|
|
@@ -3829,13 +3929,13 @@ function decodeLaunch(encodedAccount) {
|
|
|
3829
3929
|
getLaunchDecoder2()
|
|
3830
3930
|
);
|
|
3831
3931
|
}
|
|
3832
|
-
async function fetchLaunch(rpc,
|
|
3833
|
-
const maybeAccount = await fetchMaybeLaunch(rpc,
|
|
3932
|
+
async function fetchLaunch(rpc, address6, config) {
|
|
3933
|
+
const maybeAccount = await fetchMaybeLaunch(rpc, address6, config);
|
|
3834
3934
|
kit.assertAccountExists(maybeAccount);
|
|
3835
3935
|
return maybeAccount;
|
|
3836
3936
|
}
|
|
3837
|
-
async function fetchMaybeLaunch(rpc,
|
|
3838
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
3937
|
+
async function fetchMaybeLaunch(rpc, address6, config) {
|
|
3938
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3839
3939
|
return decodeLaunch(maybeAccount);
|
|
3840
3940
|
}
|
|
3841
3941
|
async function fetchAllLaunch(rpc, addresses, config) {
|
|
@@ -3909,13 +4009,13 @@ function decodeMarket(encodedAccount) {
|
|
|
3909
4009
|
getMarketDecoder()
|
|
3910
4010
|
);
|
|
3911
4011
|
}
|
|
3912
|
-
async function fetchMarket(rpc,
|
|
3913
|
-
const maybeAccount = await fetchMaybeMarket(rpc,
|
|
4012
|
+
async function fetchMarket(rpc, address6, config) {
|
|
4013
|
+
const maybeAccount = await fetchMaybeMarket(rpc, address6, config);
|
|
3914
4014
|
kit.assertAccountExists(maybeAccount);
|
|
3915
4015
|
return maybeAccount;
|
|
3916
4016
|
}
|
|
3917
|
-
async function fetchMaybeMarket(rpc,
|
|
3918
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
4017
|
+
async function fetchMaybeMarket(rpc, address6, config) {
|
|
4018
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3919
4019
|
return decodeMarket(maybeAccount);
|
|
3920
4020
|
}
|
|
3921
4021
|
async function fetchAllMarket(rpc, addresses, config) {
|
|
@@ -3981,13 +4081,13 @@ function decodeOracleState2(encodedAccount) {
|
|
|
3981
4081
|
getOracleStateDecoder()
|
|
3982
4082
|
);
|
|
3983
4083
|
}
|
|
3984
|
-
async function fetchOracleState(rpc,
|
|
3985
|
-
const maybeAccount = await fetchMaybeOracleState(rpc,
|
|
4084
|
+
async function fetchOracleState(rpc, address6, config) {
|
|
4085
|
+
const maybeAccount = await fetchMaybeOracleState(rpc, address6, config);
|
|
3986
4086
|
kit.assertAccountExists(maybeAccount);
|
|
3987
4087
|
return maybeAccount;
|
|
3988
4088
|
}
|
|
3989
|
-
async function fetchMaybeOracleState(rpc,
|
|
3990
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
4089
|
+
async function fetchMaybeOracleState(rpc, address6, config) {
|
|
4090
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
3991
4091
|
return decodeOracleState2(maybeAccount);
|
|
3992
4092
|
}
|
|
3993
4093
|
async function fetchAllOracleState(rpc, addresses, config) {
|
|
@@ -4257,9 +4357,9 @@ function parseClaimInstruction(instruction) {
|
|
|
4257
4357
|
}
|
|
4258
4358
|
let accountIndex = 0;
|
|
4259
4359
|
const getNextAccount = () => {
|
|
4260
|
-
const
|
|
4360
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4261
4361
|
accountIndex += 1;
|
|
4262
|
-
return
|
|
4362
|
+
return accountMeta2;
|
|
4263
4363
|
};
|
|
4264
4364
|
return {
|
|
4265
4365
|
programAddress: instruction.programAddress,
|
|
@@ -4565,9 +4665,9 @@ function parseMigrateEntryInstruction(instruction) {
|
|
|
4565
4665
|
}
|
|
4566
4666
|
let accountIndex = 0;
|
|
4567
4667
|
const getNextAccount = () => {
|
|
4568
|
-
const
|
|
4668
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4569
4669
|
accountIndex += 1;
|
|
4570
|
-
return
|
|
4670
|
+
return accountMeta2;
|
|
4571
4671
|
};
|
|
4572
4672
|
return {
|
|
4573
4673
|
programAddress: instruction.programAddress,
|
|
@@ -4667,9 +4767,9 @@ function parsePreviewPayoutIfWinnerInstruction(instruction) {
|
|
|
4667
4767
|
}
|
|
4668
4768
|
let accountIndex = 0;
|
|
4669
4769
|
const getNextAccount = () => {
|
|
4670
|
-
const
|
|
4770
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4671
4771
|
accountIndex += 1;
|
|
4672
|
-
return
|
|
4772
|
+
return accountMeta2;
|
|
4673
4773
|
};
|
|
4674
4774
|
return {
|
|
4675
4775
|
programAddress: instruction.programAddress,
|
|
@@ -4978,9 +5078,9 @@ function parseRegisterEntryInstruction(instruction) {
|
|
|
4978
5078
|
}
|
|
4979
5079
|
let accountIndex = 0;
|
|
4980
5080
|
const getNextAccount = () => {
|
|
4981
|
-
const
|
|
5081
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
4982
5082
|
accountIndex += 1;
|
|
4983
|
-
return
|
|
5083
|
+
return accountMeta2;
|
|
4984
5084
|
};
|
|
4985
5085
|
return {
|
|
4986
5086
|
programAddress: instruction.programAddress,
|
|
@@ -5271,22 +5371,13 @@ async function getPredictionEntryByMintAddress(market, mint, programId = PREDICT
|
|
|
5271
5371
|
}
|
|
5272
5372
|
|
|
5273
5373
|
// src/solana/initializer/instructions/initializeLaunch.ts
|
|
5274
|
-
function isTransactionSigner5(value) {
|
|
5275
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5276
|
-
}
|
|
5277
|
-
function createAccountMeta(value, role) {
|
|
5278
|
-
if (isTransactionSigner5(value)) {
|
|
5279
|
-
return { address: value.address, role, signer: value };
|
|
5280
|
-
}
|
|
5281
|
-
return { address: value, role };
|
|
5282
|
-
}
|
|
5283
5374
|
async function getTokenMetadataAddress(mint) {
|
|
5284
5375
|
const encoder = kit.getAddressEncoder();
|
|
5285
5376
|
const [metadataAddress] = await kit.getProgramDerivedAddress({
|
|
5286
|
-
programAddress:
|
|
5377
|
+
programAddress: chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
5287
5378
|
seeds: [
|
|
5288
5379
|
new TextEncoder().encode("metadata"),
|
|
5289
|
-
encoder.encode(
|
|
5380
|
+
encoder.encode(chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID),
|
|
5290
5381
|
encoder.encode(mint)
|
|
5291
5382
|
]
|
|
5292
5383
|
});
|
|
@@ -5317,18 +5408,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5317
5408
|
authority,
|
|
5318
5409
|
hookProgram,
|
|
5319
5410
|
migratorProgram,
|
|
5320
|
-
baseTokenProgram =
|
|
5321
|
-
quoteTokenProgram =
|
|
5322
|
-
systemProgram =
|
|
5411
|
+
baseTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5412
|
+
quoteTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5413
|
+
systemProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5323
5414
|
rent,
|
|
5324
5415
|
metadataAccount,
|
|
5325
|
-
metadataProgram =
|
|
5416
|
+
metadataProgram = chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID,
|
|
5326
5417
|
hookCreateRemainingAccounts = []
|
|
5327
5418
|
} = accounts;
|
|
5328
5419
|
const withMetadata = Boolean(
|
|
5329
5420
|
args.metadataName && args.metadataName.length > 0
|
|
5330
5421
|
);
|
|
5331
|
-
const withToken2022Metadata = withMetadata && baseTokenProgram ===
|
|
5422
|
+
const withToken2022Metadata = withMetadata && baseTokenProgram === chunk4CI2M2F6_cjs.TOKEN_2022_PROGRAM_ADDRESS;
|
|
5332
5423
|
if (withMetadata && !metadataAccount) {
|
|
5333
5424
|
throw new Error(
|
|
5334
5425
|
"metadataName is set but metadataAccount was not provided. Derive it with await initializer.getTokenMetadataAddress(baseMintAddress)."
|
|
@@ -5336,7 +5427,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5336
5427
|
}
|
|
5337
5428
|
const createHooksEnabled = (args.hookFlags & (HF_BEFORE_CREATE | HF_AFTER_CREATE)) !== 0;
|
|
5338
5429
|
const hookCreateRemainingAccountAddresses = hookCreateRemainingAccounts.map(
|
|
5339
|
-
|
|
5430
|
+
chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner
|
|
5340
5431
|
);
|
|
5341
5432
|
const swapFeeBps = args.swapFeeBps ?? args.curveFeeBps;
|
|
5342
5433
|
if (swapFeeBps === void 0) {
|
|
@@ -5346,18 +5437,18 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5346
5437
|
{ address: config, role: kit.AccountRole.READONLY },
|
|
5347
5438
|
{ address: launch, role: kit.AccountRole.WRITABLE },
|
|
5348
5439
|
{ address: launchAuthority, role: kit.AccountRole.READONLY },
|
|
5349
|
-
createAccountMeta(baseMint, kit.AccountRole.WRITABLE_SIGNER),
|
|
5440
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(baseMint, kit.AccountRole.WRITABLE_SIGNER),
|
|
5350
5441
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
5351
|
-
createAccountMeta(baseVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5352
|
-
createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5442
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(baseVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5443
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(quoteVault, kit.AccountRole.WRITABLE_SIGNER),
|
|
5353
5444
|
{
|
|
5354
5445
|
address: launchFeeState ?? (await getLaunchFeeStateAddress(launch, programId))[0],
|
|
5355
5446
|
role: kit.AccountRole.WRITABLE
|
|
5356
5447
|
},
|
|
5357
|
-
createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
5448
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER)
|
|
5358
5449
|
];
|
|
5359
5450
|
keys.push(
|
|
5360
|
-
authority ? createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : { address: programId, role: kit.AccountRole.READONLY }
|
|
5451
|
+
authority ? chunk7PXLEMBJ_cjs.createAccountMeta(authority, kit.AccountRole.READONLY_SIGNER) : { address: programId, role: kit.AccountRole.READONLY }
|
|
5361
5452
|
);
|
|
5362
5453
|
keys.push(
|
|
5363
5454
|
hookProgram ? { address: hookProgram, role: kit.AccountRole.READONLY } : { address: programId, role: kit.AccountRole.READONLY }
|
|
@@ -5390,15 +5481,15 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5390
5481
|
);
|
|
5391
5482
|
if (withToken2022Metadata) {
|
|
5392
5483
|
keys.push({
|
|
5393
|
-
address:
|
|
5484
|
+
address: chunk4CI2M2F6_cjs.SYSVAR_INSTRUCTIONS_ADDRESS,
|
|
5394
5485
|
role: kit.AccountRole.READONLY
|
|
5395
5486
|
});
|
|
5396
5487
|
}
|
|
5397
5488
|
keys.push(
|
|
5398
5489
|
...hookCreateRemainingAccounts.map(
|
|
5399
|
-
(account) => createAccountMeta(
|
|
5490
|
+
(account) => chunk7PXLEMBJ_cjs.createAccountMeta(
|
|
5400
5491
|
account,
|
|
5401
|
-
|
|
5492
|
+
chunk7PXLEMBJ_cjs.isTransactionSigner(account) ? kit.AccountRole.READONLY_SIGNER : kit.AccountRole.READONLY
|
|
5402
5493
|
)
|
|
5403
5494
|
)
|
|
5404
5495
|
);
|
|
@@ -5422,7 +5513,7 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5422
5513
|
if (migratorProgram === PREDICTION_MIGRATOR_PROGRAM_ADDRESS) {
|
|
5423
5514
|
const oracleState = args.namespace;
|
|
5424
5515
|
const entryId = args.launchId;
|
|
5425
|
-
const baseMintAddress =
|
|
5516
|
+
const baseMintAddress = chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner(baseMint);
|
|
5426
5517
|
const [market] = await getPredictionMarketAddress(oracleState, quoteMint);
|
|
5427
5518
|
const [potVault] = await getPredictionPotVaultAddress(market);
|
|
5428
5519
|
const [marketAuthority] = await getPredictionMarketAuthorityAddress(market);
|
|
@@ -5440,28 +5531,6 @@ async function createInitializeLaunchInstruction(accounts, args, programId = INI
|
|
|
5440
5531
|
}
|
|
5441
5532
|
return { programAddress: programId, accounts: keys, data };
|
|
5442
5533
|
}
|
|
5443
|
-
function isTransactionSigner6(value) {
|
|
5444
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5445
|
-
}
|
|
5446
|
-
function createAccountMeta2(value, role) {
|
|
5447
|
-
if (isTransactionSigner6(value)) {
|
|
5448
|
-
return { address: value.address, role, signer: value };
|
|
5449
|
-
}
|
|
5450
|
-
return { address: value, role };
|
|
5451
|
-
}
|
|
5452
|
-
function createRemainingAccountMeta(value) {
|
|
5453
|
-
if (typeof value === "string") {
|
|
5454
|
-
return { address: value, role: kit.AccountRole.READONLY };
|
|
5455
|
-
}
|
|
5456
|
-
if (isTransactionSigner6(value)) {
|
|
5457
|
-
return {
|
|
5458
|
-
address: value.address,
|
|
5459
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
5460
|
-
signer: value
|
|
5461
|
-
};
|
|
5462
|
-
}
|
|
5463
|
-
return value;
|
|
5464
|
-
}
|
|
5465
5534
|
function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZER_PROGRAM_ID) {
|
|
5466
5535
|
const {
|
|
5467
5536
|
launch,
|
|
@@ -5473,10 +5542,10 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5473
5542
|
baseMint,
|
|
5474
5543
|
quoteMint,
|
|
5475
5544
|
user,
|
|
5476
|
-
hookProgram =
|
|
5545
|
+
hookProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5477
5546
|
launchFeeState,
|
|
5478
|
-
baseTokenProgram =
|
|
5479
|
-
quoteTokenProgram =
|
|
5547
|
+
baseTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5548
|
+
quoteTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5480
5549
|
remainingAccounts = []
|
|
5481
5550
|
} = accounts;
|
|
5482
5551
|
const keys = [
|
|
@@ -5488,7 +5557,7 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5488
5557
|
{ address: userQuoteAccount, role: kit.AccountRole.WRITABLE },
|
|
5489
5558
|
{ address: baseMint, role: kit.AccountRole.READONLY },
|
|
5490
5559
|
{ address: quoteMint, role: kit.AccountRole.READONLY },
|
|
5491
|
-
|
|
5560
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(user, kit.AccountRole.READONLY_SIGNER),
|
|
5492
5561
|
// hook_program is Optional in the on-chain struct but still occupies a fixed
|
|
5493
5562
|
// slot (token_program follows it). Always emit it — use SYSTEM_PROGRAM_ADDRESS as the
|
|
5494
5563
|
// no-op placeholder when no real hook is configured.
|
|
@@ -5496,22 +5565,13 @@ function createCurveSwapExactInInstruction(accounts, args, programId = INITIALIZ
|
|
|
5496
5565
|
{ address: launchFeeState, role: kit.AccountRole.WRITABLE },
|
|
5497
5566
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
5498
5567
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
5499
|
-
...remainingAccounts.map(
|
|
5568
|
+
...remainingAccounts.map(chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta)
|
|
5500
5569
|
];
|
|
5501
5570
|
const data = new Uint8Array(
|
|
5502
5571
|
getCurveSwapExactInInstructionDataEncoder().encode(args)
|
|
5503
5572
|
);
|
|
5504
5573
|
return { programAddress: programId, accounts: keys, data };
|
|
5505
5574
|
}
|
|
5506
|
-
function isTransactionSigner7(value) {
|
|
5507
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5508
|
-
}
|
|
5509
|
-
function createSignerAccountMeta4(value, role) {
|
|
5510
|
-
if (isTransactionSigner7(value)) {
|
|
5511
|
-
return { address: value.address, role, signer: value };
|
|
5512
|
-
}
|
|
5513
|
-
return { address: value, role };
|
|
5514
|
-
}
|
|
5515
5575
|
function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRAM_ID) {
|
|
5516
5576
|
const {
|
|
5517
5577
|
config,
|
|
@@ -5524,9 +5584,9 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5524
5584
|
launchFeeState,
|
|
5525
5585
|
migratorProgram,
|
|
5526
5586
|
payer,
|
|
5527
|
-
baseTokenProgram =
|
|
5528
|
-
quoteTokenProgram =
|
|
5529
|
-
systemProgram =
|
|
5587
|
+
baseTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5588
|
+
quoteTokenProgram = chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
5589
|
+
systemProgram = chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
5530
5590
|
rent
|
|
5531
5591
|
} = accounts;
|
|
5532
5592
|
const keys = [
|
|
@@ -5539,33 +5599,17 @@ function createMigrateLaunchInstruction(accounts, programId = INITIALIZER_PROGRA
|
|
|
5539
5599
|
{ address: quoteVault, role: kit.AccountRole.WRITABLE },
|
|
5540
5600
|
{ address: launchFeeState, role: kit.AccountRole.READONLY },
|
|
5541
5601
|
{ address: migratorProgram, role: kit.AccountRole.READONLY },
|
|
5542
|
-
|
|
5602
|
+
chunk7PXLEMBJ_cjs.createAccountMeta(payer, kit.AccountRole.WRITABLE_SIGNER),
|
|
5543
5603
|
{ address: baseTokenProgram, role: kit.AccountRole.READONLY },
|
|
5544
5604
|
{ address: quoteTokenProgram, role: kit.AccountRole.READONLY },
|
|
5545
5605
|
{ address: systemProgram, role: kit.AccountRole.READONLY },
|
|
5546
5606
|
{ address: rent, role: kit.AccountRole.READONLY }
|
|
5547
5607
|
];
|
|
5548
|
-
const data =
|
|
5608
|
+
const data = chunk7PXLEMBJ_cjs.encodeInstructionData(
|
|
5549
5609
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.migrateLaunch
|
|
5550
5610
|
);
|
|
5551
5611
|
return { programAddress: programId, accounts: keys, data };
|
|
5552
5612
|
}
|
|
5553
|
-
function isTransactionSigner8(value) {
|
|
5554
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5555
|
-
}
|
|
5556
|
-
function createRemainingAccountMeta2(value) {
|
|
5557
|
-
if (typeof value === "string") {
|
|
5558
|
-
return { address: value, role: kit.AccountRole.READONLY };
|
|
5559
|
-
}
|
|
5560
|
-
if (isTransactionSigner8(value)) {
|
|
5561
|
-
return {
|
|
5562
|
-
address: value.address,
|
|
5563
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
5564
|
-
signer: value
|
|
5565
|
-
};
|
|
5566
|
-
}
|
|
5567
|
-
return value;
|
|
5568
|
-
}
|
|
5569
5613
|
var previewSwapExactInResultCodec = kit.getStructCodec([
|
|
5570
5614
|
["amountOut", kit.getU64Codec()],
|
|
5571
5615
|
["feePaid", kit.getU64Codec()]
|
|
@@ -5588,7 +5632,7 @@ function createPreviewSwapExactInInstruction(accounts, args, programId = INITIAL
|
|
|
5588
5632
|
const accountsList = hookProgram ? [...keys, { address: hookProgram, role: kit.AccountRole.READONLY }] : keys;
|
|
5589
5633
|
const accountsWithRemaining = [
|
|
5590
5634
|
...accountsList,
|
|
5591
|
-
...remainingAccounts.map(
|
|
5635
|
+
...remainingAccounts.map(chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta)
|
|
5592
5636
|
];
|
|
5593
5637
|
const data = new Uint8Array(
|
|
5594
5638
|
getPreviewSwapExactInInstructionDataEncoder2().encode(args)
|
|
@@ -5611,7 +5655,7 @@ function createPreviewMigrationInstruction(accounts, programId = INITIALIZER_PRO
|
|
|
5611
5655
|
{ address: baseVault, role: kit.AccountRole.READONLY },
|
|
5612
5656
|
{ address: quoteVault, role: kit.AccountRole.READONLY }
|
|
5613
5657
|
];
|
|
5614
|
-
const data =
|
|
5658
|
+
const data = chunk7PXLEMBJ_cjs.encodeInstructionData(
|
|
5615
5659
|
INITIALIZER_INSTRUCTION_DISCRIMINATORS.previewMigration
|
|
5616
5660
|
);
|
|
5617
5661
|
return { programAddress: programId, accounts: keys, data };
|
|
@@ -5631,6 +5675,9 @@ chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
|
5631
5675
|
SEED_STATE: () => SEED_STATE,
|
|
5632
5676
|
buildCpmmMigrationRemainingAccounts: () => buildCpmmMigrationRemainingAccounts,
|
|
5633
5677
|
buildCpmmMigrationRemainingAccountsHash: () => buildCpmmMigrationRemainingAccountsHash,
|
|
5678
|
+
createSpotPoolInstruction: () => createSpotPoolInstruction,
|
|
5679
|
+
deriveSpotPoolAccounts: () => deriveSpotPoolAccounts,
|
|
5680
|
+
encodeCreateSpotPoolPayload: () => encodeCreateSpotPoolPayload,
|
|
5634
5681
|
encodeMigratePayload: () => encodeMigratePayload,
|
|
5635
5682
|
encodeRegisterLaunchPayload: () => encodeRegisterLaunchPayload,
|
|
5636
5683
|
fetchCpmmMigratorState: () => fetchCpmmMigratorState,
|
|
@@ -5639,6 +5686,14 @@ chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
|
5639
5686
|
getCpmmMigratorStateCodec: () => getCpmmMigratorStateCodec,
|
|
5640
5687
|
getCpmmMigratorStateDecoder: () => getCpmmMigratorStateDecoder,
|
|
5641
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,
|
|
5642
5697
|
getMigrateArgsCodec: () => getMigrateArgsCodec,
|
|
5643
5698
|
getMigrateArgsDecoder: () => getMigrateArgsDecoder,
|
|
5644
5699
|
getMigrateArgsEncoder: () => getMigrateArgsEncoder,
|
|
@@ -5649,6 +5704,30 @@ chunkQ7SFCCGT_cjs.__export(cpmmMigrator_exports, {
|
|
|
5649
5704
|
getRegisterLaunchArgsDecoder: () => getRegisterLaunchArgsDecoder,
|
|
5650
5705
|
getRegisterLaunchArgsEncoder: () => getRegisterLaunchArgsEncoder
|
|
5651
5706
|
});
|
|
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
|
+
]);
|
|
5715
|
+
}
|
|
5716
|
+
function getCreateSpotPoolArgsDecoder() {
|
|
5717
|
+
return kit.getStructDecoder([
|
|
5718
|
+
["swapFeeBps", kit.getU16Decoder()],
|
|
5719
|
+
["positionId", kit.getU64Decoder()],
|
|
5720
|
+
["amount0Max", kit.getU64Decoder()],
|
|
5721
|
+
["amount1Max", kit.getU64Decoder()],
|
|
5722
|
+
["minSharesOut", kit.getU128Decoder()]
|
|
5723
|
+
]);
|
|
5724
|
+
}
|
|
5725
|
+
function getCreateSpotPoolArgsCodec() {
|
|
5726
|
+
return kit.combineCodec(
|
|
5727
|
+
getCreateSpotPoolArgsEncoder(),
|
|
5728
|
+
getCreateSpotPoolArgsDecoder()
|
|
5729
|
+
);
|
|
5730
|
+
}
|
|
5652
5731
|
function getMigrateArgsEncoder() {
|
|
5653
5732
|
return kit.getStructEncoder([
|
|
5654
5733
|
["baseForDistribution", kit.getU64Encoder()],
|
|
@@ -5719,87 +5798,474 @@ function getRegisterLaunchArgsDecoder() {
|
|
|
5719
5798
|
]
|
|
5720
5799
|
]);
|
|
5721
5800
|
}
|
|
5722
|
-
function getRegisterLaunchArgsCodec() {
|
|
5723
|
-
return kit.combineCodec(
|
|
5724
|
-
getRegisterLaunchArgsEncoder(),
|
|
5725
|
-
getRegisterLaunchArgsDecoder()
|
|
5726
|
-
);
|
|
5801
|
+
function getRegisterLaunchArgsCodec() {
|
|
5802
|
+
return kit.combineCodec(
|
|
5803
|
+
getRegisterLaunchArgsEncoder(),
|
|
5804
|
+
getRegisterLaunchArgsDecoder()
|
|
5805
|
+
);
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5808
|
+
// src/solana/generated/cpmmMigrator/accounts/cpmmMigratorState.ts
|
|
5809
|
+
var CPMM_MIGRATOR_STATE_DISCRIMINATOR = new Uint8Array([
|
|
5810
|
+
169,
|
|
5811
|
+
86,
|
|
5812
|
+
255,
|
|
5813
|
+
187,
|
|
5814
|
+
37,
|
|
5815
|
+
248,
|
|
5816
|
+
11,
|
|
5817
|
+
176
|
|
5818
|
+
]);
|
|
5819
|
+
function getCpmmMigratorStateEncoder() {
|
|
5820
|
+
return kit.transformEncoder(
|
|
5821
|
+
kit.getStructEncoder([
|
|
5822
|
+
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5823
|
+
["launch", kit.getAddressEncoder()],
|
|
5824
|
+
["admin", kit.getAddressEncoder()],
|
|
5825
|
+
["cpmmConfig", kit.getAddressEncoder()],
|
|
5826
|
+
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
5827
|
+
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
5828
|
+
["pad0", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
5829
|
+
["migratedPoolHookProgram", kit.getAddressEncoder()],
|
|
5830
|
+
["migratedPoolHookFlags", kit.getU32Encoder()],
|
|
5831
|
+
["recipients", kit.getArrayEncoder(getRecipientEncoder(), { size: 2 })],
|
|
5832
|
+
["minRaiseQuote", kit.getU64Encoder()],
|
|
5833
|
+
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
5834
|
+
["isMigrated", kit.getBooleanEncoder()],
|
|
5835
|
+
["bump", kit.getU8Encoder()],
|
|
5836
|
+
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 14)]
|
|
5837
|
+
]),
|
|
5838
|
+
(value) => ({ ...value, discriminator: CPMM_MIGRATOR_STATE_DISCRIMINATOR })
|
|
5839
|
+
);
|
|
5840
|
+
}
|
|
5841
|
+
function getCpmmMigratorStateDecoder() {
|
|
5842
|
+
return kit.getStructDecoder([
|
|
5843
|
+
["discriminator", kit.fixDecoderSize(kit.getBytesDecoder(), 8)],
|
|
5844
|
+
["launch", kit.getAddressDecoder()],
|
|
5845
|
+
["admin", kit.getAddressDecoder()],
|
|
5846
|
+
["cpmmConfig", kit.getAddressDecoder()],
|
|
5847
|
+
["initialSwapFeeBps", kit.getU16Decoder()],
|
|
5848
|
+
["initialFeeSplitBps", kit.getU16Decoder()],
|
|
5849
|
+
["pad0", kit.fixDecoderSize(kit.getBytesDecoder(), 4)],
|
|
5850
|
+
["migratedPoolHookProgram", kit.getAddressDecoder()],
|
|
5851
|
+
["migratedPoolHookFlags", kit.getU32Decoder()],
|
|
5852
|
+
["recipients", kit.getArrayDecoder(getRecipientDecoder(), { size: 2 })],
|
|
5853
|
+
["minRaiseQuote", kit.getU64Decoder()],
|
|
5854
|
+
["minMigrationPriceQ64Opt", kit.getOptionDecoder(kit.getU128Decoder())],
|
|
5855
|
+
["isMigrated", kit.getBooleanDecoder()],
|
|
5856
|
+
["bump", kit.getU8Decoder()],
|
|
5857
|
+
["reserved", kit.fixDecoderSize(kit.getBytesDecoder(), 14)]
|
|
5858
|
+
]);
|
|
5859
|
+
}
|
|
5860
|
+
function getCpmmMigratorStateCodec() {
|
|
5861
|
+
return kit.combineCodec(
|
|
5862
|
+
getCpmmMigratorStateEncoder(),
|
|
5863
|
+
getCpmmMigratorStateDecoder()
|
|
5864
|
+
);
|
|
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";
|
|
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;
|
|
5727
6120
|
}
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
var CPMM_MIGRATOR_STATE_DISCRIMINATOR = new Uint8Array([
|
|
5731
|
-
169,
|
|
5732
|
-
86,
|
|
5733
|
-
255,
|
|
5734
|
-
187,
|
|
5735
|
-
37,
|
|
5736
|
-
248,
|
|
5737
|
-
11,
|
|
5738
|
-
176
|
|
5739
|
-
]);
|
|
5740
|
-
function getCpmmMigratorStateEncoder() {
|
|
5741
|
-
return kit.transformEncoder(
|
|
5742
|
-
kit.getStructEncoder([
|
|
5743
|
-
["discriminator", kit.fixEncoderSize(kit.getBytesEncoder(), 8)],
|
|
5744
|
-
["launch", kit.getAddressEncoder()],
|
|
5745
|
-
["admin", kit.getAddressEncoder()],
|
|
5746
|
-
["cpmmConfig", kit.getAddressEncoder()],
|
|
5747
|
-
["initialSwapFeeBps", kit.getU16Encoder()],
|
|
5748
|
-
["initialFeeSplitBps", kit.getU16Encoder()],
|
|
5749
|
-
["pad0", kit.fixEncoderSize(kit.getBytesEncoder(), 4)],
|
|
5750
|
-
["migratedPoolHookProgram", kit.getAddressEncoder()],
|
|
5751
|
-
["migratedPoolHookFlags", kit.getU32Encoder()],
|
|
5752
|
-
["recipients", kit.getArrayEncoder(getRecipientEncoder(), { size: 2 })],
|
|
5753
|
-
["minRaiseQuote", kit.getU64Encoder()],
|
|
5754
|
-
["minMigrationPriceQ64Opt", kit.getOptionEncoder(kit.getU128Encoder())],
|
|
5755
|
-
["isMigrated", kit.getBooleanEncoder()],
|
|
5756
|
-
["bump", kit.getU8Encoder()],
|
|
5757
|
-
["reserved", kit.fixEncoderSize(kit.getBytesEncoder(), 14)]
|
|
5758
|
-
]),
|
|
5759
|
-
(value) => ({ ...value, discriminator: CPMM_MIGRATOR_STATE_DISCRIMINATOR })
|
|
5760
|
-
);
|
|
6121
|
+
function addressOf(value) {
|
|
6122
|
+
return typeof value === "string" ? value : value.address;
|
|
5761
6123
|
}
|
|
5762
|
-
function
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
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)
|
|
5779
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
|
+
};
|
|
5780
6203
|
}
|
|
5781
|
-
function
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
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
|
+
};
|
|
5786
6261
|
}
|
|
5787
|
-
if (process.env.NODE_ENV !== "production") ;
|
|
5788
6262
|
|
|
5789
6263
|
// src/solana/migrators/cpmmMigrator/client.ts
|
|
5790
|
-
function
|
|
5791
|
-
const
|
|
5792
|
-
const bytes = new Uint8Array(binary.length);
|
|
5793
|
-
for (let i = 0; i < binary.length; i++) {
|
|
5794
|
-
bytes[i] = binary.charCodeAt(i);
|
|
5795
|
-
}
|
|
5796
|
-
return bytes;
|
|
5797
|
-
}
|
|
5798
|
-
async function fetchCpmmMigratorState(rpc, address4) {
|
|
5799
|
-
const response = await rpc.getAccountInfo(address4, { encoding: "base64" }).send();
|
|
6264
|
+
async function fetchCpmmMigratorState(rpc, address6) {
|
|
6265
|
+
const response = await rpc.getAccountInfo(address6, { encoding: "base64" }).send();
|
|
5800
6266
|
if (!response.value) return null;
|
|
5801
6267
|
return getCpmmMigratorStateDecoder().decode(
|
|
5802
|
-
|
|
6268
|
+
chunk7PXLEMBJ_cjs.base64ToBytes(response.value.data[0])
|
|
5803
6269
|
);
|
|
5804
6270
|
}
|
|
5805
6271
|
async function buildCpmmMigrationRemainingAccounts({
|
|
@@ -5810,7 +6276,7 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
5810
6276
|
adminBaseAta,
|
|
5811
6277
|
adminQuoteAta,
|
|
5812
6278
|
recipientAtas,
|
|
5813
|
-
cpmmProgram =
|
|
6279
|
+
cpmmProgram = chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
5814
6280
|
cpmmMigratorProgram = CPMM_MIGRATOR_PROGRAM_ID
|
|
5815
6281
|
}) {
|
|
5816
6282
|
const [cpmmMigrationState] = await getCpmmMigratorStateAddress(
|
|
@@ -5818,9 +6284,9 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
5818
6284
|
cpmmMigratorProgram
|
|
5819
6285
|
);
|
|
5820
6286
|
const [migrationAuthority] = await getCpmmMigrationAuthorityAddress(cpmmMigratorProgram);
|
|
5821
|
-
const poolInit = await
|
|
6287
|
+
const poolInit = await chunk4CI2M2F6_cjs.getPoolInitAddresses(baseMint, quoteMint, cpmmProgram);
|
|
5822
6288
|
const pool = poolInit.pool[0];
|
|
5823
|
-
const [launchLpPosition] = await
|
|
6289
|
+
const [launchLpPosition] = await chunk4CI2M2F6_cjs.getPositionAddress(
|
|
5824
6290
|
pool,
|
|
5825
6291
|
launchAuthority,
|
|
5826
6292
|
0n,
|
|
@@ -5859,8 +6325,8 @@ async function buildCpmmMigrationRemainingAccounts({
|
|
|
5859
6325
|
{ address: migrationAuthority, role: kit.AccountRole.READONLY },
|
|
5860
6326
|
{ address: adminBaseAta, role: kit.AccountRole.WRITABLE },
|
|
5861
6327
|
{ address: adminQuoteAta, role: kit.AccountRole.WRITABLE },
|
|
5862
|
-
...recipientAtas.map((
|
|
5863
|
-
address:
|
|
6328
|
+
...recipientAtas.map((address6) => ({
|
|
6329
|
+
address: address6,
|
|
5864
6330
|
role: kit.AccountRole.WRITABLE
|
|
5865
6331
|
}))
|
|
5866
6332
|
],
|
|
@@ -5884,8 +6350,24 @@ async function buildCpmmMigrationRemainingAccountsHash(input) {
|
|
|
5884
6350
|
}
|
|
5885
6351
|
|
|
5886
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
|
+
}
|
|
5887
6364
|
function encodeRegisterLaunchPayload(args) {
|
|
5888
|
-
const encoded = new Uint8Array(
|
|
6365
|
+
const encoded = new Uint8Array(
|
|
6366
|
+
getRegisterLaunchArgsEncoder().encode({
|
|
6367
|
+
...args,
|
|
6368
|
+
migratedPoolHookConfig: args.migratedPoolHookConfig ?? null
|
|
6369
|
+
})
|
|
6370
|
+
);
|
|
5889
6371
|
return kit.mergeBytes([
|
|
5890
6372
|
CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS.registerLaunch,
|
|
5891
6373
|
encoded
|
|
@@ -5905,14 +6387,14 @@ var launchIdCounter = 0n;
|
|
|
5905
6387
|
var launchTokenPrograms = {
|
|
5906
6388
|
splToken() {
|
|
5907
6389
|
return {
|
|
5908
|
-
baseTokenProgram:
|
|
5909
|
-
quoteTokenProgram:
|
|
6390
|
+
baseTokenProgram: chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS,
|
|
6391
|
+
quoteTokenProgram: chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS
|
|
5910
6392
|
};
|
|
5911
6393
|
},
|
|
5912
6394
|
token2022Base() {
|
|
5913
6395
|
return {
|
|
5914
|
-
baseTokenProgram:
|
|
5915
|
-
quoteTokenProgram:
|
|
6396
|
+
baseTokenProgram: chunk4CI2M2F6_cjs.TOKEN_2022_PROGRAM_ADDRESS,
|
|
6397
|
+
quoteTokenProgram: chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS
|
|
5916
6398
|
};
|
|
5917
6399
|
}
|
|
5918
6400
|
};
|
|
@@ -5925,30 +6407,8 @@ function createLaunchId() {
|
|
|
5925
6407
|
bytes.set([68, 79, 80, 76], 28);
|
|
5926
6408
|
return bytes;
|
|
5927
6409
|
}
|
|
5928
|
-
function isTransactionSigner9(value) {
|
|
5929
|
-
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
5930
|
-
}
|
|
5931
|
-
function getAccountAddress(account) {
|
|
5932
|
-
if (typeof account === "string") {
|
|
5933
|
-
return account;
|
|
5934
|
-
}
|
|
5935
|
-
return account.address;
|
|
5936
|
-
}
|
|
5937
6410
|
function getSignerAddress(value) {
|
|
5938
|
-
return
|
|
5939
|
-
}
|
|
5940
|
-
function getRemainingAccountMeta(account) {
|
|
5941
|
-
if (typeof account === "string") {
|
|
5942
|
-
return { address: account, role: kit.AccountRole.READONLY };
|
|
5943
|
-
}
|
|
5944
|
-
if (isTransactionSigner9(account)) {
|
|
5945
|
-
return {
|
|
5946
|
-
address: account.address,
|
|
5947
|
-
role: kit.AccountRole.READONLY_SIGNER,
|
|
5948
|
-
signer: account
|
|
5949
|
-
};
|
|
5950
|
-
}
|
|
5951
|
-
return account;
|
|
6411
|
+
return chunk7PXLEMBJ_cjs.getAddressFromAddressOrSigner(value);
|
|
5952
6412
|
}
|
|
5953
6413
|
function hasMetadata(metadata) {
|
|
5954
6414
|
return Boolean(metadata?.metadataName);
|
|
@@ -5963,47 +6423,39 @@ function hashRemainingAccounts(accounts) {
|
|
|
5963
6423
|
if (!accounts) {
|
|
5964
6424
|
return void 0;
|
|
5965
6425
|
}
|
|
5966
|
-
return computeRemainingAccountsHash(
|
|
6426
|
+
return computeRemainingAccountsHash(
|
|
6427
|
+
accounts.map(chunk7PXLEMBJ_cjs.getAddressFromRemainingAccount)
|
|
6428
|
+
);
|
|
5967
6429
|
}
|
|
5968
6430
|
function isCustomMigrationConfig(migration) {
|
|
5969
6431
|
return migration.kind === "custom";
|
|
5970
6432
|
}
|
|
5971
|
-
function getCreateLaunchHookMode(input) {
|
|
5972
|
-
if (input.hook !== void 0 && input.hook !== null) {
|
|
5973
|
-
return input.hook;
|
|
5974
|
-
}
|
|
5975
|
-
return input.cosigner ? "cosigner" : "cpmm";
|
|
5976
|
-
}
|
|
5977
6433
|
async function getCreateLaunchHookContext(input) {
|
|
5978
|
-
const
|
|
5979
|
-
if (
|
|
5980
|
-
|
|
5981
|
-
}
|
|
5982
|
-
const [cosignerConfig] = await getCosignerHookConfigAddress(
|
|
5983
|
-
input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
5984
|
-
);
|
|
5985
|
-
return { mode, cosignerConfig };
|
|
5986
|
-
}
|
|
5987
|
-
function getCosignerHookRemainingAccounts2({
|
|
5988
|
-
namespace,
|
|
5989
|
-
cosigner,
|
|
5990
|
-
cosignerConfig
|
|
5991
|
-
}) {
|
|
5992
|
-
const accounts = namespace === cosignerConfig ? [cosignerConfig] : [namespace, cosignerConfig];
|
|
5993
|
-
accounts.push(cosigner);
|
|
5994
|
-
return accounts;
|
|
5995
|
-
}
|
|
5996
|
-
function resolveCosignerHookPayload(input) {
|
|
5997
|
-
if (input.cosignGateExpiresAt === void 0 || input.cosignGateExpiresAt === null) {
|
|
5998
|
-
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");
|
|
5999
6437
|
}
|
|
6000
6438
|
if (!input.cosigner) {
|
|
6001
|
-
|
|
6439
|
+
return { program };
|
|
6440
|
+
}
|
|
6441
|
+
const [config] = await getCpmmHookConfigAddress(program);
|
|
6442
|
+
return { program, config };
|
|
6443
|
+
}
|
|
6444
|
+
function resolveCpmmHookPayload(input) {
|
|
6445
|
+
let gateExpiry = null;
|
|
6446
|
+
if (input.cosignGateExpiresAt !== void 0 && input.cosignGateExpiresAt !== null) {
|
|
6447
|
+
if (!input.cosigner) {
|
|
6448
|
+
throw new Error("cosigner is required when cosignGateExpiresAt is set");
|
|
6449
|
+
}
|
|
6450
|
+
gateExpiry = {
|
|
6451
|
+
mode: GATE_EXPIRY_UNIX_TIMESTAMP,
|
|
6452
|
+
value: input.cosignGateExpiresAt,
|
|
6453
|
+
cosigner: getSignerAddress(input.cosigner)
|
|
6454
|
+
};
|
|
6002
6455
|
}
|
|
6003
|
-
return
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
cosigner: getSignerAddress(input.cosigner)
|
|
6456
|
+
return encodeCpmmHookPayload({
|
|
6457
|
+
schedule: input.dynamicFee ?? null,
|
|
6458
|
+
gateExpiry
|
|
6007
6459
|
});
|
|
6008
6460
|
}
|
|
6009
6461
|
function resolveCreateLaunchHook({
|
|
@@ -6011,37 +6463,18 @@ function resolveCreateLaunchHook({
|
|
|
6011
6463
|
namespace,
|
|
6012
6464
|
hookContext
|
|
6013
6465
|
}) {
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
if (!input.cosigner) {
|
|
6022
|
-
throw new Error('cosigner is required when hook is "cosigner"');
|
|
6023
|
-
}
|
|
6024
|
-
if (!hookContext.cosignerConfig) {
|
|
6025
|
-
throw new Error("cosigner hook config could not be derived");
|
|
6026
|
-
}
|
|
6027
|
-
const remainingAccounts = getCosignerHookRemainingAccounts2({
|
|
6028
|
-
namespace,
|
|
6029
|
-
cosigner: input.cosigner,
|
|
6030
|
-
cosignerConfig: hookContext.cosignerConfig
|
|
6031
|
-
});
|
|
6032
|
-
return {
|
|
6033
|
-
program: input.deployment?.cosignerHookProgram ?? DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID,
|
|
6034
|
-
flags: HF_BEFORE_SWAP2 | HF_FORWARD_READONLY_SIGNERS2,
|
|
6035
|
-
payload: resolveCosignerHookPayload(input),
|
|
6036
|
-
remainingAccounts,
|
|
6037
|
-
remainingAccountsHash: hashRemainingAccounts(remainingAccounts) ?? EMPTY_REMAINING_ACCOUNTS_HASH
|
|
6038
|
-
};
|
|
6039
|
-
}
|
|
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
|
+
});
|
|
6040
6473
|
return {
|
|
6041
|
-
program:
|
|
6042
|
-
flags: HF_BEFORE_SWAP2,
|
|
6043
|
-
payload:
|
|
6044
|
-
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
|
|
6045
6478
|
};
|
|
6046
6479
|
}
|
|
6047
6480
|
async function getAssociatedTokenAddress({
|
|
@@ -6179,7 +6612,7 @@ async function createLaunch(input) {
|
|
|
6179
6612
|
const programId = getInitializerProgramId(input);
|
|
6180
6613
|
const launchId = input.launchId ?? createLaunchId();
|
|
6181
6614
|
const hookContext = await getCreateLaunchHookContext(input);
|
|
6182
|
-
const namespace = input.namespace ??
|
|
6615
|
+
const namespace = input.namespace ?? chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS;
|
|
6183
6616
|
const tokenPrograms = {
|
|
6184
6617
|
...launchTokenPrograms.splToken(),
|
|
6185
6618
|
...input.tokenPrograms
|
|
@@ -6225,10 +6658,10 @@ async function createLaunch(input) {
|
|
|
6225
6658
|
cpmmConfig: migration?.cpmmConfig,
|
|
6226
6659
|
baseTokenProgram: tokenPrograms.baseTokenProgram,
|
|
6227
6660
|
quoteTokenProgram: tokenPrograms.quoteTokenProgram,
|
|
6228
|
-
systemProgram: input.systemProgram ??
|
|
6229
|
-
rent: input.rent ??
|
|
6661
|
+
systemProgram: input.systemProgram ?? chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
6662
|
+
rent: input.rent ?? chunk4CI2M2F6_cjs.SYSVAR_RENT_ADDRESS,
|
|
6230
6663
|
metadataAccount: addresses.metadataAccount,
|
|
6231
|
-
metadataProgram: input.metadataProgram ??
|
|
6664
|
+
metadataProgram: input.metadataProgram ?? chunk4CI2M2F6_cjs.TOKEN_METADATA_PROGRAM_ID
|
|
6232
6665
|
},
|
|
6233
6666
|
{
|
|
6234
6667
|
namespace,
|
|
@@ -6245,7 +6678,7 @@ async function createLaunch(input) {
|
|
|
6245
6678
|
allowBuy: input.allowBuy ?? true,
|
|
6246
6679
|
allowSell: input.allowSell ?? true,
|
|
6247
6680
|
hookFlags: hook.flags,
|
|
6248
|
-
hookPayload: hook.payload
|
|
6681
|
+
hookPayload: hook.payload,
|
|
6249
6682
|
migratorInitPayload: migration?.initPayload ?? new Uint8Array(),
|
|
6250
6683
|
migratorMigratePayload: migration?.migratePayload ?? new Uint8Array(),
|
|
6251
6684
|
hookRemainingAccountsHash: hook.remainingAccountsHash,
|
|
@@ -6263,7 +6696,7 @@ async function createLaunch(input) {
|
|
|
6263
6696
|
accounts: [
|
|
6264
6697
|
...instruction.accounts ?? [],
|
|
6265
6698
|
...(migration?.initRemainingAccounts ?? []).map(
|
|
6266
|
-
|
|
6699
|
+
chunk7PXLEMBJ_cjs.createReadonlyRemainingAccountMeta
|
|
6267
6700
|
)
|
|
6268
6701
|
]
|
|
6269
6702
|
} : instruction;
|
|
@@ -6379,38 +6812,23 @@ function assertTransactionMessageFitsWithLookupTable(transactionMessage, lookupT
|
|
|
6379
6812
|
);
|
|
6380
6813
|
return assertTransactionMessageFits(compressedMessage, options);
|
|
6381
6814
|
}
|
|
6382
|
-
var
|
|
6383
|
-
function
|
|
6384
|
-
|
|
6385
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
6386
|
-
binary += String.fromCharCode(bytes[i]);
|
|
6387
|
-
}
|
|
6388
|
-
return btoa(binary);
|
|
6389
|
-
}
|
|
6390
|
-
function base64ToBytes3(base64) {
|
|
6391
|
-
const binary = atob(base64);
|
|
6392
|
-
const bytes = new Uint8Array(binary.length);
|
|
6393
|
-
for (let i = 0; i < binary.length; i++) {
|
|
6394
|
-
bytes[i] = binary.charCodeAt(i);
|
|
6395
|
-
}
|
|
6396
|
-
return bytes;
|
|
6397
|
-
}
|
|
6398
|
-
async function fetchLaunch2(rpc, address4, config) {
|
|
6399
|
-
const response = await rpc.getAccountInfo(address4, {
|
|
6815
|
+
var addressCodec6 = kit.getAddressCodec();
|
|
6816
|
+
async function fetchLaunch2(rpc, address6, config) {
|
|
6817
|
+
const response = await rpc.getAccountInfo(address6, {
|
|
6400
6818
|
encoding: "base64",
|
|
6401
6819
|
commitment: config?.commitment
|
|
6402
6820
|
}).send();
|
|
6403
6821
|
if (!response.value) {
|
|
6404
6822
|
return null;
|
|
6405
6823
|
}
|
|
6406
|
-
return getLaunchDecoder().decode(
|
|
6824
|
+
return getLaunchDecoder().decode(chunk7PXLEMBJ_cjs.base64ToBytes(response.value.data[0]));
|
|
6407
6825
|
}
|
|
6408
6826
|
async function fetchAllLaunches(rpc, config) {
|
|
6409
6827
|
const programId = config?.programId ?? INITIALIZER_PROGRAM_ID;
|
|
6410
6828
|
const discriminatorFilter = {
|
|
6411
6829
|
memcmp: {
|
|
6412
6830
|
offset: 0n,
|
|
6413
|
-
bytes:
|
|
6831
|
+
bytes: chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes(
|
|
6414
6832
|
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
6415
6833
|
),
|
|
6416
6834
|
encoding: "base64"
|
|
@@ -6421,15 +6839,15 @@ async function fetchAllLaunches(rpc, config) {
|
|
|
6421
6839
|
commitment: config?.commitment,
|
|
6422
6840
|
filters: [discriminatorFilter]
|
|
6423
6841
|
}).send();
|
|
6424
|
-
const accounts =
|
|
6842
|
+
const accounts = chunk7PXLEMBJ_cjs.normalizeProgramAccountsResponse(response);
|
|
6425
6843
|
const launches = [];
|
|
6426
6844
|
const decoder = getLaunchDecoder();
|
|
6427
6845
|
for (const account of accounts) {
|
|
6428
6846
|
try {
|
|
6429
|
-
const launch = decoder.decode(
|
|
6847
|
+
const launch = decoder.decode(chunk7PXLEMBJ_cjs.base64ToBytes(account.account.data[0]));
|
|
6430
6848
|
launches.push({ address: account.pubkey, account: launch });
|
|
6431
6849
|
} catch {
|
|
6432
|
-
|
|
6850
|
+
chunk7PXLEMBJ_cjs.warnAccountDecodeFailure("launch", account.pubkey);
|
|
6433
6851
|
}
|
|
6434
6852
|
}
|
|
6435
6853
|
return launches;
|
|
@@ -6439,7 +6857,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
6439
6857
|
const discriminatorFilter = {
|
|
6440
6858
|
memcmp: {
|
|
6441
6859
|
offset: 0n,
|
|
6442
|
-
bytes:
|
|
6860
|
+
bytes: chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes(
|
|
6443
6861
|
INITIALIZER_ACCOUNT_DISCRIMINATORS.Launch
|
|
6444
6862
|
),
|
|
6445
6863
|
encoding: "base64"
|
|
@@ -6448,9 +6866,7 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
6448
6866
|
const authorityFilter = {
|
|
6449
6867
|
memcmp: {
|
|
6450
6868
|
offset: 8n,
|
|
6451
|
-
bytes:
|
|
6452
|
-
addressCodec5.encode(authority)
|
|
6453
|
-
),
|
|
6869
|
+
bytes: chunk7PXLEMBJ_cjs.bytesToBase64EncodedBytes(addressCodec6.encode(authority)),
|
|
6454
6870
|
encoding: "base64"
|
|
6455
6871
|
}
|
|
6456
6872
|
};
|
|
@@ -6459,15 +6875,15 @@ async function fetchLaunchesByAuthority(rpc, authority, config) {
|
|
|
6459
6875
|
commitment: config?.commitment,
|
|
6460
6876
|
filters: [discriminatorFilter, authorityFilter]
|
|
6461
6877
|
}).send();
|
|
6462
|
-
const accounts =
|
|
6878
|
+
const accounts = chunk7PXLEMBJ_cjs.normalizeProgramAccountsResponse(response);
|
|
6463
6879
|
const launches = [];
|
|
6464
6880
|
const decoder = getLaunchDecoder();
|
|
6465
6881
|
for (const account of accounts) {
|
|
6466
6882
|
try {
|
|
6467
|
-
const launch = decoder.decode(
|
|
6883
|
+
const launch = decoder.decode(chunk7PXLEMBJ_cjs.base64ToBytes(account.account.data[0]));
|
|
6468
6884
|
launches.push({ address: account.pubkey, account: launch });
|
|
6469
6885
|
} catch {
|
|
6470
|
-
|
|
6886
|
+
chunk7PXLEMBJ_cjs.warnAccountDecodeFailure("launch", account.pubkey);
|
|
6471
6887
|
}
|
|
6472
6888
|
}
|
|
6473
6889
|
return launches;
|
|
@@ -6803,13 +7219,13 @@ function decodeOracleState3(encodedAccount) {
|
|
|
6803
7219
|
getOracleStateDecoder2()
|
|
6804
7220
|
);
|
|
6805
7221
|
}
|
|
6806
|
-
async function fetchOracleState2(rpc,
|
|
6807
|
-
const maybeAccount = await fetchMaybeOracleState2(rpc,
|
|
7222
|
+
async function fetchOracleState2(rpc, address6, config) {
|
|
7223
|
+
const maybeAccount = await fetchMaybeOracleState2(rpc, address6, config);
|
|
6808
7224
|
kit.assertAccountExists(maybeAccount);
|
|
6809
7225
|
return maybeAccount;
|
|
6810
7226
|
}
|
|
6811
|
-
async function fetchMaybeOracleState2(rpc,
|
|
6812
|
-
const maybeAccount = await kit.fetchEncodedAccount(rpc,
|
|
7227
|
+
async function fetchMaybeOracleState2(rpc, address6, config) {
|
|
7228
|
+
const maybeAccount = await kit.fetchEncodedAccount(rpc, address6, config);
|
|
6813
7229
|
return decodeOracleState3(maybeAccount);
|
|
6814
7230
|
}
|
|
6815
7231
|
async function fetchAllOracleState2(rpc, addresses, config) {
|
|
@@ -6893,9 +7309,9 @@ function parseFinalizeInstruction(instruction) {
|
|
|
6893
7309
|
}
|
|
6894
7310
|
let accountIndex = 0;
|
|
6895
7311
|
const getNextAccount = () => {
|
|
6896
|
-
const
|
|
7312
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
6897
7313
|
accountIndex += 1;
|
|
6898
|
-
return
|
|
7314
|
+
return accountMeta2;
|
|
6899
7315
|
};
|
|
6900
7316
|
return {
|
|
6901
7317
|
programAddress: instruction.programAddress,
|
|
@@ -6981,9 +7397,9 @@ function parseInitializeOracleInstruction2(instruction) {
|
|
|
6981
7397
|
}
|
|
6982
7398
|
let accountIndex = 0;
|
|
6983
7399
|
const getNextAccount = () => {
|
|
6984
|
-
const
|
|
7400
|
+
const accountMeta2 = instruction.accounts[accountIndex];
|
|
6985
7401
|
accountIndex += 1;
|
|
6986
|
-
return
|
|
7402
|
+
return accountMeta2;
|
|
6987
7403
|
};
|
|
6988
7404
|
return {
|
|
6989
7405
|
programAddress: instruction.programAddress,
|
|
@@ -7151,17 +7567,335 @@ async function getOracleStateAddress(oracleAuthority, nonce) {
|
|
|
7151
7567
|
]
|
|
7152
7568
|
});
|
|
7153
7569
|
}
|
|
7570
|
+
var WRAPPED_SOL_MINT = kit.address("So11111111111111111111111111111111111111112");
|
|
7571
|
+
var BPS_DENOMINATOR = 10000n;
|
|
7572
|
+
function isTransactionSigner2(value) {
|
|
7573
|
+
return typeof value === "object" && value !== null && "address" in value && "signTransactions" in value;
|
|
7574
|
+
}
|
|
7575
|
+
function getAddress(value) {
|
|
7576
|
+
return isTransactionSigner2(value) ? value.address : value;
|
|
7577
|
+
}
|
|
7578
|
+
async function getAssociatedTokenAddress2({
|
|
7579
|
+
owner,
|
|
7580
|
+
mint,
|
|
7581
|
+
tokenProgram
|
|
7582
|
+
}) {
|
|
7583
|
+
const [ata] = await token.findAssociatedTokenPda({
|
|
7584
|
+
owner,
|
|
7585
|
+
mint,
|
|
7586
|
+
tokenProgram
|
|
7587
|
+
});
|
|
7588
|
+
return ata;
|
|
7589
|
+
}
|
|
7590
|
+
function resolveSlippageBps(slippageBps) {
|
|
7591
|
+
const resolved = slippageBps === void 0 ? 50n : BigInt(slippageBps);
|
|
7592
|
+
if (resolved < 0n || resolved > BPS_DENOMINATOR) {
|
|
7593
|
+
throw new Error("slippageBps must be between 0 and 10000");
|
|
7594
|
+
}
|
|
7595
|
+
return resolved;
|
|
7596
|
+
}
|
|
7597
|
+
function getMinAmountOut({
|
|
7598
|
+
quotedAmountOut,
|
|
7599
|
+
minAmountOut,
|
|
7600
|
+
slippageBps
|
|
7601
|
+
}) {
|
|
7602
|
+
if (minAmountOut !== void 0) {
|
|
7603
|
+
return minAmountOut;
|
|
7604
|
+
}
|
|
7605
|
+
const slippage = resolveSlippageBps(slippageBps);
|
|
7606
|
+
return quotedAmountOut * (BPS_DENOMINATOR - slippage) / BPS_DENOMINATOR;
|
|
7607
|
+
}
|
|
7608
|
+
async function curveSwapExactIn(input) {
|
|
7609
|
+
const programId = input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID;
|
|
7610
|
+
const user = input.user ?? input.payer;
|
|
7611
|
+
const userAddress = getAddress(user);
|
|
7612
|
+
const baseTokenProgram = input.baseTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7613
|
+
const quoteTokenProgram = input.quoteTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7614
|
+
const userBaseAccount = await getAssociatedTokenAddress2({
|
|
7615
|
+
owner: userAddress,
|
|
7616
|
+
mint: input.baseMint,
|
|
7617
|
+
tokenProgram: baseTokenProgram
|
|
7618
|
+
});
|
|
7619
|
+
const userQuoteAccount = await getAssociatedTokenAddress2({
|
|
7620
|
+
owner: userAddress,
|
|
7621
|
+
mint: input.quoteMint,
|
|
7622
|
+
tokenProgram: quoteTokenProgram
|
|
7623
|
+
});
|
|
7624
|
+
const setupInstructions = [
|
|
7625
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
7626
|
+
payer: input.payer,
|
|
7627
|
+
ata: userBaseAccount,
|
|
7628
|
+
owner: userAddress,
|
|
7629
|
+
mint: input.baseMint,
|
|
7630
|
+
tokenProgram: baseTokenProgram
|
|
7631
|
+
}),
|
|
7632
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
7633
|
+
payer: input.payer,
|
|
7634
|
+
ata: userQuoteAccount,
|
|
7635
|
+
owner: userAddress,
|
|
7636
|
+
mint: input.quoteMint,
|
|
7637
|
+
tokenProgram: quoteTokenProgram
|
|
7638
|
+
})
|
|
7639
|
+
];
|
|
7640
|
+
const shouldWrapSol = input.wrapSol ?? (input.quoteMint === WRAPPED_SOL_MINT && input.tradeDirection === TRADE_DIRECTION_BUY);
|
|
7641
|
+
if (shouldWrapSol) {
|
|
7642
|
+
setupInstructions.push(
|
|
7643
|
+
system.getTransferSolInstruction({
|
|
7644
|
+
source: input.payer,
|
|
7645
|
+
destination: userQuoteAccount,
|
|
7646
|
+
amount: input.amountIn
|
|
7647
|
+
}),
|
|
7648
|
+
token.getSyncNativeInstruction({ account: userQuoteAccount })
|
|
7649
|
+
);
|
|
7650
|
+
}
|
|
7651
|
+
const swapAccounts = {
|
|
7652
|
+
launch: input.launch,
|
|
7653
|
+
launchAuthority: input.launchAuthority,
|
|
7654
|
+
baseVault: input.baseVault,
|
|
7655
|
+
quoteVault: input.quoteVault,
|
|
7656
|
+
launchFeeState: input.launchFeeState,
|
|
7657
|
+
userBaseAccount,
|
|
7658
|
+
userQuoteAccount,
|
|
7659
|
+
baseMint: input.baseMint,
|
|
7660
|
+
quoteMint: input.quoteMint,
|
|
7661
|
+
user,
|
|
7662
|
+
hookProgram: input.deployment?.cpmmHookProgram ?? CPMM_HOOK_PROGRAM_ID,
|
|
7663
|
+
baseTokenProgram,
|
|
7664
|
+
quoteTokenProgram,
|
|
7665
|
+
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0
|
|
7666
|
+
};
|
|
7667
|
+
const swapInstruction = createCurveSwapExactInInstruction(
|
|
7668
|
+
swapAccounts,
|
|
7669
|
+
{
|
|
7670
|
+
amountIn: input.amountIn,
|
|
7671
|
+
minAmountOut: input.minAmountOut,
|
|
7672
|
+
tradeDirection: input.tradeDirection
|
|
7673
|
+
},
|
|
7674
|
+
programId
|
|
7675
|
+
);
|
|
7676
|
+
const userIn = input.tradeDirection === TRADE_DIRECTION_BUY ? userQuoteAccount : userBaseAccount;
|
|
7677
|
+
const userOut = input.tradeDirection === TRADE_DIRECTION_BUY ? userBaseAccount : userQuoteAccount;
|
|
7678
|
+
return {
|
|
7679
|
+
userBaseAccount,
|
|
7680
|
+
userQuoteAccount,
|
|
7681
|
+
userIn,
|
|
7682
|
+
userOut,
|
|
7683
|
+
setupInstructions,
|
|
7684
|
+
swapInstruction,
|
|
7685
|
+
instructions: [...setupInstructions, swapInstruction]
|
|
7686
|
+
};
|
|
7687
|
+
}
|
|
7688
|
+
async function swapExactIn(input) {
|
|
7689
|
+
const programId = input.programId ?? input.deployment?.cpmmProgram ?? void 0;
|
|
7690
|
+
const pool = "pool" in input ? input.pool : await chunk7PXLEMBJ_cjs.getPoolByMints(input.rpc, input.mintA, input.mintB, {
|
|
7691
|
+
programId
|
|
7692
|
+
});
|
|
7693
|
+
if (!pool) {
|
|
7694
|
+
throw new Error(`No pool found for ${input.mintA} / ${input.mintB}`);
|
|
7695
|
+
}
|
|
7696
|
+
const user = input.user ?? input.payer;
|
|
7697
|
+
const userAddress = getAddress(user);
|
|
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(
|
|
7701
|
+
pool.account,
|
|
7702
|
+
input.amountIn,
|
|
7703
|
+
input.tradeDirection
|
|
7704
|
+
);
|
|
7705
|
+
const minAmountOut = getMinAmountOut({
|
|
7706
|
+
quotedAmountOut: quote.amountOut,
|
|
7707
|
+
minAmountOut: input.minAmountOut,
|
|
7708
|
+
slippageBps: input.slippageBps
|
|
7709
|
+
});
|
|
7710
|
+
const userToken0 = await getAssociatedTokenAddress2({
|
|
7711
|
+
owner: userAddress,
|
|
7712
|
+
mint: pool.account.token0Mint,
|
|
7713
|
+
tokenProgram: token0Program
|
|
7714
|
+
});
|
|
7715
|
+
const userToken1 = await getAssociatedTokenAddress2({
|
|
7716
|
+
owner: userAddress,
|
|
7717
|
+
mint: pool.account.token1Mint,
|
|
7718
|
+
tokenProgram: token1Program
|
|
7719
|
+
});
|
|
7720
|
+
const setupInstructions = [
|
|
7721
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
7722
|
+
payer: input.payer,
|
|
7723
|
+
ata: userToken0,
|
|
7724
|
+
owner: userAddress,
|
|
7725
|
+
mint: pool.account.token0Mint,
|
|
7726
|
+
tokenProgram: token0Program
|
|
7727
|
+
}),
|
|
7728
|
+
token.getCreateAssociatedTokenIdempotentInstruction({
|
|
7729
|
+
payer: input.payer,
|
|
7730
|
+
ata: userToken1,
|
|
7731
|
+
owner: userAddress,
|
|
7732
|
+
mint: pool.account.token1Mint,
|
|
7733
|
+
tokenProgram: token1Program
|
|
7734
|
+
})
|
|
7735
|
+
];
|
|
7736
|
+
const swapInstruction = createSwapInstruction({
|
|
7737
|
+
config: input.config ?? input.deployment?.cpmmConfig ?? pool.account.config,
|
|
7738
|
+
pool: pool.address,
|
|
7739
|
+
authority: pool.account.authority,
|
|
7740
|
+
vault0: pool.account.vault0,
|
|
7741
|
+
vault1: pool.account.vault1,
|
|
7742
|
+
token0Mint: pool.account.token0Mint,
|
|
7743
|
+
token1Mint: pool.account.token1Mint,
|
|
7744
|
+
userToken0,
|
|
7745
|
+
userToken1,
|
|
7746
|
+
user,
|
|
7747
|
+
amountIn: input.amountIn,
|
|
7748
|
+
minAmountOut,
|
|
7749
|
+
tradeDirection: input.tradeDirection,
|
|
7750
|
+
oracle: input.oracle,
|
|
7751
|
+
remainingAccounts: input.remainingAccounts ? [...input.remainingAccounts] : void 0,
|
|
7752
|
+
updateOracle: input.updateOracle,
|
|
7753
|
+
token0Program,
|
|
7754
|
+
token1Program,
|
|
7755
|
+
programId: programId ?? input.deployment?.cpmmProgram
|
|
7756
|
+
});
|
|
7757
|
+
const userIn = input.tradeDirection === 0 ? userToken0 : userToken1;
|
|
7758
|
+
const userOut = input.tradeDirection === 0 ? userToken1 : userToken0;
|
|
7759
|
+
return {
|
|
7760
|
+
pool,
|
|
7761
|
+
quote,
|
|
7762
|
+
minAmountOut,
|
|
7763
|
+
userToken0,
|
|
7764
|
+
userToken1,
|
|
7765
|
+
userIn,
|
|
7766
|
+
userOut,
|
|
7767
|
+
setupInstructions,
|
|
7768
|
+
swapInstruction,
|
|
7769
|
+
instructions: [...setupInstructions, swapInstruction]
|
|
7770
|
+
};
|
|
7771
|
+
}
|
|
7772
|
+
var COMPUTE_BUDGET_PROGRAM_ID = kit.address(
|
|
7773
|
+
"ComputeBudget111111111111111111111111111111"
|
|
7774
|
+
);
|
|
7775
|
+
function createSetComputeUnitLimitInstruction(units) {
|
|
7776
|
+
const data = new Uint8Array(5);
|
|
7777
|
+
data[0] = 2;
|
|
7778
|
+
new DataView(data.buffer).setUint32(1, units, true);
|
|
7779
|
+
return {
|
|
7780
|
+
programAddress: COMPUTE_BUDGET_PROGRAM_ID,
|
|
7781
|
+
accounts: [],
|
|
7782
|
+
data
|
|
7783
|
+
};
|
|
7784
|
+
}
|
|
7785
|
+
function getDefaultComputeUnitLimit(cpmmMigration) {
|
|
7786
|
+
return cpmmMigration.recipientAtas.length > 0 ? 8e5 : 4e5;
|
|
7787
|
+
}
|
|
7788
|
+
function migrateLaunch(input) {
|
|
7789
|
+
const baseTokenProgram = input.baseTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7790
|
+
const quoteTokenProgram = input.quoteTokenProgram ?? chunk4CI2M2F6_cjs.TOKEN_PROGRAM_ADDRESS;
|
|
7791
|
+
const recipients = input.recipients ? [...input.recipients] : [];
|
|
7792
|
+
if (recipients.length > 0 && recipients.length !== input.cpmmMigration.recipientAtas.length) {
|
|
7793
|
+
throw new Error(
|
|
7794
|
+
"recipients length must match cpmmMigration.recipientAtas length"
|
|
7795
|
+
);
|
|
7796
|
+
}
|
|
7797
|
+
const initializerConfig = input.config ?? input.deployment?.initializerConfig;
|
|
7798
|
+
if (!initializerConfig) {
|
|
7799
|
+
throw new Error("config or deployment.initializerConfig is required");
|
|
7800
|
+
}
|
|
7801
|
+
const recipientAtaInstructions = recipients.map(
|
|
7802
|
+
(recipient, index) => token.getCreateAssociatedTokenIdempotentInstruction({
|
|
7803
|
+
payer: input.payer,
|
|
7804
|
+
ata: input.cpmmMigration.recipientAtas[index],
|
|
7805
|
+
owner: recipient.wallet,
|
|
7806
|
+
mint: input.baseMint,
|
|
7807
|
+
tokenProgram: baseTokenProgram
|
|
7808
|
+
})
|
|
7809
|
+
);
|
|
7810
|
+
const migrateLaunchInstruction = createMigrateLaunchInstruction(
|
|
7811
|
+
{
|
|
7812
|
+
config: initializerConfig,
|
|
7813
|
+
launch: input.launch,
|
|
7814
|
+
launchAuthority: input.launchAuthority,
|
|
7815
|
+
baseMint: input.baseMint,
|
|
7816
|
+
quoteMint: input.quoteMint,
|
|
7817
|
+
baseVault: input.baseVault,
|
|
7818
|
+
quoteVault: input.quoteVault,
|
|
7819
|
+
launchFeeState: input.launchFeeState,
|
|
7820
|
+
migratorProgram: input.deployment?.cpmmMigratorProgram ?? CPMM_MIGRATOR_PROGRAM_ID,
|
|
7821
|
+
payer: input.payer,
|
|
7822
|
+
baseTokenProgram,
|
|
7823
|
+
quoteTokenProgram,
|
|
7824
|
+
systemProgram: input.systemProgram ?? chunk4CI2M2F6_cjs.SYSTEM_PROGRAM_ADDRESS,
|
|
7825
|
+
rent: input.rent ?? chunk4CI2M2F6_cjs.SYSVAR_RENT_ADDRESS
|
|
7826
|
+
},
|
|
7827
|
+
input.programId ?? input.deployment?.initializerProgram ?? INITIALIZER_PROGRAM_ID
|
|
7828
|
+
);
|
|
7829
|
+
const migrateInstruction = {
|
|
7830
|
+
...migrateLaunchInstruction,
|
|
7831
|
+
accounts: [
|
|
7832
|
+
...migrateLaunchInstruction.accounts ?? [],
|
|
7833
|
+
...input.cpmmMigration.metas
|
|
7834
|
+
]
|
|
7835
|
+
};
|
|
7836
|
+
const computeUnitLimit = input.computeUnitLimit === void 0 ? getDefaultComputeUnitLimit(input.cpmmMigration) : input.computeUnitLimit;
|
|
7837
|
+
const computeUnitLimitInstruction = computeUnitLimit === false ? void 0 : createSetComputeUnitLimitInstruction(computeUnitLimit);
|
|
7838
|
+
const instructions = [
|
|
7839
|
+
...computeUnitLimitInstruction ? [computeUnitLimitInstruction] : [],
|
|
7840
|
+
...recipientAtaInstructions,
|
|
7841
|
+
migrateInstruction
|
|
7842
|
+
];
|
|
7843
|
+
return {
|
|
7844
|
+
recipientAtaInstructions,
|
|
7845
|
+
computeUnitLimitInstruction,
|
|
7846
|
+
migrateInstruction,
|
|
7847
|
+
instructions
|
|
7848
|
+
};
|
|
7849
|
+
}
|
|
7850
|
+
async function getMigrationQuoteProgress({
|
|
7851
|
+
rpc,
|
|
7852
|
+
quoteVault,
|
|
7853
|
+
pendingQuoteFees,
|
|
7854
|
+
commitment = "confirmed"
|
|
7855
|
+
}) {
|
|
7856
|
+
const vaultBalance = await rpc.getTokenAccountBalance(quoteVault, { commitment }).send();
|
|
7857
|
+
const quoteVaultAmount = BigInt(vaultBalance.value.amount);
|
|
7858
|
+
if (pendingQuoteFees > quoteVaultAmount) {
|
|
7859
|
+
throw new Error(
|
|
7860
|
+
"pendingQuoteFees cannot exceed the quote vault token balance"
|
|
7861
|
+
);
|
|
7862
|
+
}
|
|
7863
|
+
return {
|
|
7864
|
+
quoteVaultAmount,
|
|
7865
|
+
pendingQuoteFees,
|
|
7866
|
+
migrationQuoteAmount: quoteVaultAmount - pendingQuoteFees
|
|
7867
|
+
};
|
|
7868
|
+
}
|
|
7869
|
+
async function assertMigrationQuoteThreshold({
|
|
7870
|
+
rpc,
|
|
7871
|
+
quoteVault,
|
|
7872
|
+
pendingQuoteFees,
|
|
7873
|
+
minRaiseQuote,
|
|
7874
|
+
commitment = "confirmed"
|
|
7875
|
+
}) {
|
|
7876
|
+
const progress = await getMigrationQuoteProgress({
|
|
7877
|
+
rpc,
|
|
7878
|
+
quoteVault,
|
|
7879
|
+
pendingQuoteFees,
|
|
7880
|
+
commitment
|
|
7881
|
+
});
|
|
7882
|
+
if (progress.migrationQuoteAmount < minRaiseQuote) {
|
|
7883
|
+
throw new Error(
|
|
7884
|
+
`Quote available for migration ${progress.migrationQuoteAmount} is below minRaiseQuote ${minRaiseQuote}`
|
|
7885
|
+
);
|
|
7886
|
+
}
|
|
7887
|
+
return progress;
|
|
7888
|
+
}
|
|
7154
7889
|
|
|
7155
7890
|
// src/solana/deployment.ts
|
|
7156
7891
|
var DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = {
|
|
7157
|
-
cpmmProgram:
|
|
7892
|
+
cpmmProgram: chunk4CI2M2F6_cjs.CPMM_PROGRAM_ID,
|
|
7158
7893
|
initializerProgram: INITIALIZER_PROGRAM_ID,
|
|
7159
7894
|
cpmmMigratorProgram: CPMM_MIGRATOR_PROGRAM_ID,
|
|
7160
|
-
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
7161
|
-
cosignerHookProgram: DOPPLER_NATIVE_COSIGNER_HOOK_PROGRAM_ID
|
|
7895
|
+
cpmmHookProgram: CPMM_HOOK_PROGRAM_ID
|
|
7162
7896
|
};
|
|
7163
7897
|
async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES) {
|
|
7164
|
-
const [cpmmConfig] = await
|
|
7898
|
+
const [cpmmConfig] = await chunk4CI2M2F6_cjs.getConfigAddress(programs.cpmmProgram);
|
|
7165
7899
|
const [initializerConfig] = await getConfigAddress2(
|
|
7166
7900
|
programs.initializerProgram
|
|
7167
7901
|
);
|
|
@@ -7173,13 +7907,18 @@ async function deriveSolanaCpmmDeployment(programs = DOPPLER_SOLANA_DEVNET_PROGR
|
|
|
7173
7907
|
}
|
|
7174
7908
|
|
|
7175
7909
|
exports.DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES = DOPPLER_SOLANA_DEVNET_PROGRAM_ADDRESSES;
|
|
7176
|
-
exports.
|
|
7910
|
+
exports.assertMigrationQuoteThreshold = assertMigrationQuoteThreshold;
|
|
7177
7911
|
exports.cpmm = cpmm_exports;
|
|
7912
|
+
exports.cpmmHook = cpmmHook_exports;
|
|
7178
7913
|
exports.cpmmMigrator = cpmmMigrator_exports;
|
|
7179
7914
|
exports.createLaunch = createLaunch;
|
|
7915
|
+
exports.curveSwapExactIn = curveSwapExactIn;
|
|
7180
7916
|
exports.deriveSolanaCpmmDeployment = deriveSolanaCpmmDeployment;
|
|
7917
|
+
exports.getMigrationQuoteProgress = getMigrationQuoteProgress;
|
|
7181
7918
|
exports.initializer = initializer_exports;
|
|
7919
|
+
exports.migrateLaunch = migrateLaunch;
|
|
7182
7920
|
exports.predictionMigrator = predictionMigrator_exports;
|
|
7921
|
+
exports.swapExactIn = swapExactIn;
|
|
7183
7922
|
exports.trustedOracle = trustedOracle_exports;
|
|
7184
7923
|
//# sourceMappingURL=index.cjs.map
|
|
7185
7924
|
//# sourceMappingURL=index.cjs.map
|