four-flap-meme-sdk 1.4.89 → 1.4.90

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.
Files changed (142) hide show
  1. package/README.zh-CN.pdf +0 -0
  2. package/dist/flap/portal-bundle-merkle/encryption.d.ts +16 -0
  3. package/dist/flap/portal-bundle-merkle/encryption.js +146 -0
  4. package/dist/utils/holders-maker.d.ts +19 -0
  5. package/dist/utils/holders-maker.js +4 -1
  6. package/package.json +3 -38
  7. package/dist/sol/constants.d.ts +0 -126
  8. package/dist/sol/constants.js +0 -145
  9. package/dist/sol/dex/blockrazor/client.d.ts +0 -51
  10. package/dist/sol/dex/blockrazor/client.js +0 -96
  11. package/dist/sol/dex/blockrazor/constants.d.ts +0 -34
  12. package/dist/sol/dex/blockrazor/constants.js +0 -55
  13. package/dist/sol/dex/blockrazor/geyser.d.ts +0 -128
  14. package/dist/sol/dex/blockrazor/geyser.js +0 -530
  15. package/dist/sol/dex/blockrazor/index.d.ts +0 -18
  16. package/dist/sol/dex/blockrazor/index.js +0 -23
  17. package/dist/sol/dex/blockrazor/send.d.ts +0 -135
  18. package/dist/sol/dex/blockrazor/send.js +0 -254
  19. package/dist/sol/dex/blockrazor/types.d.ts +0 -191
  20. package/dist/sol/dex/blockrazor/types.js +0 -5
  21. package/dist/sol/dex/index.d.ts +0 -10
  22. package/dist/sol/dex/index.js +0 -16
  23. package/dist/sol/dex/jup/client.d.ts +0 -33
  24. package/dist/sol/dex/jup/client.js +0 -110
  25. package/dist/sol/dex/jup/index.d.ts +0 -16
  26. package/dist/sol/dex/jup/index.js +0 -148
  27. package/dist/sol/dex/jup/legacy.d.ts +0 -623
  28. package/dist/sol/dex/jup/legacy.js +0 -416
  29. package/dist/sol/dex/jup/lend.d.ts +0 -640
  30. package/dist/sol/dex/jup/lend.js +0 -603
  31. package/dist/sol/dex/jup/portfolio.d.ts +0 -362
  32. package/dist/sol/dex/jup/portfolio.js +0 -367
  33. package/dist/sol/dex/jup/price.d.ts +0 -173
  34. package/dist/sol/dex/jup/price.js +0 -220
  35. package/dist/sol/dex/jup/recurring.d.ts +0 -437
  36. package/dist/sol/dex/jup/recurring.js +0 -320
  37. package/dist/sol/dex/jup/send.d.ts +0 -282
  38. package/dist/sol/dex/jup/send.js +0 -295
  39. package/dist/sol/dex/jup/studio.d.ts +0 -457
  40. package/dist/sol/dex/jup/studio.js +0 -488
  41. package/dist/sol/dex/jup/tokens.d.ts +0 -767
  42. package/dist/sol/dex/jup/tokens.js +0 -697
  43. package/dist/sol/dex/jup/trigger.d.ts +0 -511
  44. package/dist/sol/dex/jup/trigger.js +0 -397
  45. package/dist/sol/dex/jup/types.d.ts +0 -433
  46. package/dist/sol/dex/jup/types.js +0 -5
  47. package/dist/sol/dex/jup/ultra.d.ts +0 -646
  48. package/dist/sol/dex/jup/ultra.js +0 -853
  49. package/dist/sol/dex/meteora/client.d.ts +0 -76
  50. package/dist/sol/dex/meteora/client.js +0 -219
  51. package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +0 -61
  52. package/dist/sol/dex/meteora/damm-v1-bundle.js +0 -112
  53. package/dist/sol/dex/meteora/damm-v1.d.ts +0 -118
  54. package/dist/sol/dex/meteora/damm-v1.js +0 -315
  55. package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +0 -82
  56. package/dist/sol/dex/meteora/damm-v2-bundle.js +0 -242
  57. package/dist/sol/dex/meteora/damm-v2.d.ts +0 -172
  58. package/dist/sol/dex/meteora/damm-v2.js +0 -632
  59. package/dist/sol/dex/meteora/dbc-bundle.d.ts +0 -123
  60. package/dist/sol/dex/meteora/dbc-bundle.js +0 -304
  61. package/dist/sol/dex/meteora/dbc.d.ts +0 -192
  62. package/dist/sol/dex/meteora/dbc.js +0 -619
  63. package/dist/sol/dex/meteora/dlmm-bundle.d.ts +0 -39
  64. package/dist/sol/dex/meteora/dlmm-bundle.js +0 -189
  65. package/dist/sol/dex/meteora/dlmm.d.ts +0 -157
  66. package/dist/sol/dex/meteora/dlmm.js +0 -671
  67. package/dist/sol/dex/meteora/index.d.ts +0 -25
  68. package/dist/sol/dex/meteora/index.js +0 -65
  69. package/dist/sol/dex/meteora/types.d.ts +0 -787
  70. package/dist/sol/dex/meteora/types.js +0 -110
  71. package/dist/sol/dex/orca/index.d.ts +0 -10
  72. package/dist/sol/dex/orca/index.js +0 -16
  73. package/dist/sol/dex/orca/orca-bundle.d.ts +0 -41
  74. package/dist/sol/dex/orca/orca-bundle.js +0 -173
  75. package/dist/sol/dex/orca/orca.d.ts +0 -65
  76. package/dist/sol/dex/orca/orca.js +0 -474
  77. package/dist/sol/dex/orca/types.d.ts +0 -263
  78. package/dist/sol/dex/orca/types.js +0 -38
  79. package/dist/sol/dex/orca/wavebreak-bundle.d.ts +0 -34
  80. package/dist/sol/dex/orca/wavebreak-bundle.js +0 -198
  81. package/dist/sol/dex/orca/wavebreak-types.d.ts +0 -227
  82. package/dist/sol/dex/orca/wavebreak-types.js +0 -23
  83. package/dist/sol/dex/orca/wavebreak.d.ts +0 -78
  84. package/dist/sol/dex/orca/wavebreak.js +0 -497
  85. package/dist/sol/dex/pump/index.d.ts +0 -9
  86. package/dist/sol/dex/pump/index.js +0 -14
  87. package/dist/sol/dex/pump/pump-bundle.d.ts +0 -92
  88. package/dist/sol/dex/pump/pump-bundle.js +0 -383
  89. package/dist/sol/dex/pump/pump-swap-bundle.d.ts +0 -103
  90. package/dist/sol/dex/pump/pump-swap-bundle.js +0 -380
  91. package/dist/sol/dex/pump/pump-swap.d.ts +0 -46
  92. package/dist/sol/dex/pump/pump-swap.js +0 -199
  93. package/dist/sol/dex/pump/pump.d.ts +0 -35
  94. package/dist/sol/dex/pump/pump.js +0 -352
  95. package/dist/sol/dex/pump/types.d.ts +0 -215
  96. package/dist/sol/dex/pump/types.js +0 -5
  97. package/dist/sol/dex/raydium/index.d.ts +0 -8
  98. package/dist/sol/dex/raydium/index.js +0 -12
  99. package/dist/sol/dex/raydium/launchlab.d.ts +0 -68
  100. package/dist/sol/dex/raydium/launchlab.js +0 -210
  101. package/dist/sol/dex/raydium/raydium-bundle.d.ts +0 -64
  102. package/dist/sol/dex/raydium/raydium-bundle.js +0 -324
  103. package/dist/sol/dex/raydium/raydium.d.ts +0 -40
  104. package/dist/sol/dex/raydium/raydium.js +0 -366
  105. package/dist/sol/dex/raydium/types.d.ts +0 -240
  106. package/dist/sol/dex/raydium/types.js +0 -5
  107. package/dist/sol/index.d.ts +0 -10
  108. package/dist/sol/index.js +0 -16
  109. package/dist/sol/jito/bundle.d.ts +0 -90
  110. package/dist/sol/jito/bundle.js +0 -263
  111. package/dist/sol/jito/index.d.ts +0 -7
  112. package/dist/sol/jito/index.js +0 -7
  113. package/dist/sol/jito/tip.d.ts +0 -51
  114. package/dist/sol/jito/tip.js +0 -83
  115. package/dist/sol/jito/types.d.ts +0 -100
  116. package/dist/sol/jito/types.js +0 -5
  117. package/dist/sol/token/create-complete.d.ts +0 -115
  118. package/dist/sol/token/create-complete.js +0 -235
  119. package/dist/sol/token/create-token.d.ts +0 -57
  120. package/dist/sol/token/create-token.js +0 -230
  121. package/dist/sol/token/index.d.ts +0 -9
  122. package/dist/sol/token/index.js +0 -14
  123. package/dist/sol/token/metadata-upload.d.ts +0 -86
  124. package/dist/sol/token/metadata-upload.js +0 -173
  125. package/dist/sol/token/metadata.d.ts +0 -92
  126. package/dist/sol/token/metadata.js +0 -274
  127. package/dist/sol/token/types.d.ts +0 -153
  128. package/dist/sol/token/types.js +0 -5
  129. package/dist/sol/types.d.ts +0 -176
  130. package/dist/sol/types.js +0 -7
  131. package/dist/sol/utils/balance.d.ts +0 -160
  132. package/dist/sol/utils/balance.js +0 -638
  133. package/dist/sol/utils/connection.d.ts +0 -78
  134. package/dist/sol/utils/connection.js +0 -168
  135. package/dist/sol/utils/index.d.ts +0 -9
  136. package/dist/sol/utils/index.js +0 -9
  137. package/dist/sol/utils/lp-inspect.d.ts +0 -129
  138. package/dist/sol/utils/lp-inspect.js +0 -900
  139. package/dist/sol/utils/transfer.d.ts +0 -125
  140. package/dist/sol/utils/transfer.js +0 -220
  141. package/dist/sol/utils/wallet.d.ts +0 -107
  142. package/dist/sol/utils/wallet.js +0 -210
@@ -1,366 +0,0 @@
1
- /**
2
- * Raydium DEX 集成
3
- * 支持 AMM V4/V5、CPMM、CLMM 池子的交易和 LP 管理
4
- * @module sol/dex/raydium/raydium
5
- */
6
- import { PublicKey, } from '@solana/web3.js';
7
- import { Raydium, TxVersion, Percent, CurveCalculator } from '@raydium-io/raydium-sdk-v2';
8
- import BN from 'bn.js';
9
- /**
10
- * 初始化 Raydium SDK
11
- */
12
- export async function initRaydium(connection, owner) {
13
- const raydium = await Raydium.load({
14
- connection,
15
- owner: owner?.publicKey,
16
- cluster: 'mainnet',
17
- disableFeatureCheck: true,
18
- disableLoadToken: true,
19
- });
20
- if (owner) {
21
- raydium.setOwner(owner.publicKey);
22
- }
23
- return raydium;
24
- }
25
- /**
26
- * 获取池子信息
27
- */
28
- export async function getRaydiumPoolInfo(connection, poolId) {
29
- try {
30
- const raydium = await initRaydium(connection);
31
- // 尝试从 API 获取池子信息
32
- const poolData = await raydium.api.fetchPoolById({ ids: poolId });
33
- if (!poolData || poolData.length === 0) {
34
- return null;
35
- }
36
- const pool = poolData[0];
37
- // 根据池子类型返回不同的信息结构
38
- if (pool.type === 'Standard') {
39
- const mintAmountA = parseFloat(String(pool.mintAmountA));
40
- const mintAmountB = parseFloat(String(pool.mintAmountB));
41
- const lpAmount = parseFloat(String(pool.lpAmount));
42
- return {
43
- id: pool.id,
44
- type: pool.programId.includes('CPMMoo8L') ? 'cpmm' : 'amm',
45
- mintA: {
46
- address: pool.mintA.address,
47
- symbol: pool.mintA.symbol,
48
- decimals: pool.mintA.decimals,
49
- },
50
- mintB: {
51
- address: pool.mintB.address,
52
- symbol: pool.mintB.symbol,
53
- decimals: pool.mintB.decimals,
54
- },
55
- lpMint: {
56
- address: pool.lpMint.address,
57
- decimals: pool.lpMint.decimals,
58
- },
59
- reserveA: BigInt(Math.floor(mintAmountA * (10 ** pool.mintA.decimals))),
60
- reserveB: BigInt(Math.floor(mintAmountB * (10 ** pool.mintB.decimals))),
61
- lpSupply: BigInt(Math.floor(lpAmount * (10 ** pool.lpMint.decimals))),
62
- price: pool.price,
63
- feeRate: pool.feeRate,
64
- };
65
- }
66
- else if (pool.type === 'Concentrated') {
67
- const mintAmountA = parseFloat(String(pool.mintAmountA));
68
- const mintAmountB = parseFloat(String(pool.mintAmountB));
69
- return {
70
- id: pool.id,
71
- type: 'clmm',
72
- mintA: {
73
- address: pool.mintA.address,
74
- symbol: pool.mintA.symbol,
75
- decimals: pool.mintA.decimals,
76
- },
77
- mintB: {
78
- address: pool.mintB.address,
79
- symbol: pool.mintB.symbol,
80
- decimals: pool.mintB.decimals,
81
- },
82
- lpMint: {
83
- address: '',
84
- decimals: 0,
85
- },
86
- reserveA: BigInt(Math.floor(mintAmountA * (10 ** pool.mintA.decimals))),
87
- reserveB: BigInt(Math.floor(mintAmountB * (10 ** pool.mintB.decimals))),
88
- lpSupply: BigInt(0),
89
- price: pool.price,
90
- feeRate: pool.feeRate,
91
- };
92
- }
93
- return null;
94
- }
95
- catch (error) {
96
- console.error('Failed to get Raydium pool info:', error);
97
- return null;
98
- }
99
- }
100
- /**
101
- * 构建并签名 Raydium CPMM 交换交易
102
- */
103
- export async function signRaydiumCpmmSwap(connection, params) {
104
- try {
105
- const { poolId, inputMint, amountIn, slippageBps = 100, wallet, } = params;
106
- const raydium = await initRaydium(connection, wallet);
107
- // 获取池子信息
108
- const poolData = await raydium.api.fetchPoolById({ ids: poolId });
109
- if (!poolData || poolData.length === 0) {
110
- return { success: false, error: 'Pool not found' };
111
- }
112
- const pool = poolData[0];
113
- if (pool.type !== 'Standard') {
114
- return { success: false, error: 'Not a standard pool' };
115
- }
116
- // 获取池子 keys
117
- const poolKeys = await raydium.cpmm.getCpmmPoolKeys(poolId);
118
- const rpcData = await raydium.cpmm.getRpcPoolInfo(poolId);
119
- const baseIn = inputMint === pool.mintA.address;
120
- const amountInBN = new BN(amountIn.toString());
121
- // 计算输出
122
- const swapResult = CurveCalculator.swapBaseInput(amountInBN, baseIn ? rpcData.baseReserve : rpcData.quoteReserve, baseIn ? rpcData.quoteReserve : rpcData.baseReserve, rpcData.configInfo?.tradeFeeRate || new BN(25), new BN(0), // creatorFeeRate
123
- new BN(0), // protocolFeeRate
124
- new BN(0), // fundFeeRate
125
- false);
126
- // 构建交换
127
- const txData = await raydium.cpmm.swap({
128
- poolInfo: pool,
129
- poolKeys,
130
- baseIn,
131
- inputAmount: amountInBN,
132
- swapResult: {
133
- inputAmount: swapResult.inputAmount,
134
- outputAmount: swapResult.outputAmount,
135
- },
136
- slippage: slippageBps / 10000,
137
- txVersion: TxVersion.LEGACY,
138
- });
139
- // 签名交易
140
- const { blockhash } = await connection.getLatestBlockhash('finalized');
141
- if (txData.transaction) {
142
- const tx = txData.transaction;
143
- tx.recentBlockhash = blockhash;
144
- tx.feePayer = wallet.publicKey;
145
- tx.sign(wallet);
146
- return {
147
- success: true,
148
- signedTransaction: Buffer.from(tx.serialize()).toString('base64'),
149
- signature: tx.signature ? Buffer.from(tx.signature).toString('base64') : undefined,
150
- estimatedAmountOut: BigInt(swapResult.outputAmount.toString()),
151
- };
152
- }
153
- return { success: false, error: 'Failed to build transaction' };
154
- }
155
- catch (error) {
156
- return {
157
- success: false,
158
- error: error.message,
159
- };
160
- }
161
- }
162
- /**
163
- * 构建并签名 Raydium AMM 交换交易
164
- */
165
- export async function signRaydiumAmmSwap(connection, params) {
166
- try {
167
- const { poolId, inputMint, outputMint, amountIn, slippageBps = 100, wallet, } = params;
168
- const raydium = await initRaydium(connection, wallet);
169
- // 获取池子信息
170
- const poolData = await raydium.api.fetchPoolById({ ids: poolId });
171
- if (!poolData || poolData.length === 0) {
172
- return { success: false, error: 'Pool not found' };
173
- }
174
- const pool = poolData[0];
175
- const poolKeys = await raydium.liquidity.getAmmPoolKeys(poolId);
176
- const amountInBN = new BN(amountIn.toString());
177
- const slippage = slippageBps / 10000;
178
- // 计算输出
179
- const computeResult = raydium.liquidity.computeAmountOut({
180
- poolInfo: pool,
181
- amountIn: amountInBN,
182
- mintIn: new PublicKey(inputMint),
183
- mintOut: new PublicKey(outputMint),
184
- slippage,
185
- });
186
- // 构建交换
187
- const txData = await raydium.liquidity.swap({
188
- poolInfo: pool,
189
- poolKeys: poolKeys,
190
- amountIn: amountInBN,
191
- amountOut: computeResult.minAmountOut,
192
- fixedSide: 'in',
193
- inputMint,
194
- txVersion: TxVersion.LEGACY,
195
- });
196
- // 签名交易
197
- const { blockhash } = await connection.getLatestBlockhash('finalized');
198
- if (txData.transaction) {
199
- const tx = txData.transaction;
200
- tx.recentBlockhash = blockhash;
201
- tx.feePayer = wallet.publicKey;
202
- tx.sign(wallet);
203
- return {
204
- success: true,
205
- signedTransaction: Buffer.from(tx.serialize()).toString('base64'),
206
- signature: tx.signature ? Buffer.from(tx.signature).toString('base64') : undefined,
207
- estimatedAmountOut: BigInt(computeResult.amountOut.toString()),
208
- };
209
- }
210
- return { success: false, error: 'Failed to build transaction' };
211
- }
212
- catch (error) {
213
- return {
214
- success: false,
215
- error: error.message,
216
- };
217
- }
218
- }
219
- /**
220
- * 构建并签名 Raydium 交换交易(自动检测池子类型)
221
- */
222
- export async function signRaydiumSwap(connection, params) {
223
- try {
224
- const raydium = await initRaydium(connection);
225
- const poolData = await raydium.api.fetchPoolById({ ids: params.poolId });
226
- if (!poolData || poolData.length === 0) {
227
- return { success: false, error: 'Pool not found' };
228
- }
229
- const pool = poolData[0];
230
- const isCpmm = pool.programId.includes('CPMMoo8L');
231
- if (isCpmm) {
232
- return signRaydiumCpmmSwap(connection, params);
233
- }
234
- else {
235
- return signRaydiumAmmSwap(connection, params);
236
- }
237
- }
238
- catch (error) {
239
- return { success: false, error: error.message };
240
- }
241
- }
242
- /**
243
- * 构建并签名添加 LP 交易(CPMM)
244
- */
245
- export async function signRaydiumCpmmAddLp(connection, params) {
246
- try {
247
- const { poolId, amountA, slippageBps = 100, fixedSide = 'a', wallet, } = params;
248
- const raydium = await initRaydium(connection, wallet);
249
- const poolData = await raydium.api.fetchPoolById({ ids: poolId });
250
- if (!poolData || poolData.length === 0) {
251
- return { success: false, error: 'Pool not found' };
252
- }
253
- const pool = poolData[0];
254
- const poolKeys = await raydium.cpmm.getCpmmPoolKeys(poolId);
255
- const txData = await raydium.cpmm.addLiquidity({
256
- poolInfo: pool,
257
- poolKeys,
258
- inputAmount: new BN(amountA.toString()),
259
- slippage: new Percent(slippageBps, 10000),
260
- baseIn: fixedSide === 'a',
261
- txVersion: TxVersion.LEGACY,
262
- });
263
- const { blockhash } = await connection.getLatestBlockhash('finalized');
264
- if (txData.transaction) {
265
- const tx = txData.transaction;
266
- tx.recentBlockhash = blockhash;
267
- tx.feePayer = wallet.publicKey;
268
- tx.sign(wallet);
269
- return {
270
- success: true,
271
- signedTransaction: Buffer.from(tx.serialize()).toString('base64'),
272
- signature: tx.signature ? Buffer.from(tx.signature).toString('base64') : undefined,
273
- };
274
- }
275
- return { success: false, error: 'Failed to build transaction' };
276
- }
277
- catch (error) {
278
- return { success: false, error: error.message };
279
- }
280
- }
281
- /**
282
- * 构建并签名移除 LP 交易(CPMM)
283
- */
284
- export async function signRaydiumCpmmRemoveLp(connection, params) {
285
- try {
286
- const { poolId, lpAmount, slippageBps = 100, wallet, } = params;
287
- const raydium = await initRaydium(connection, wallet);
288
- const poolData = await raydium.api.fetchPoolById({ ids: poolId });
289
- if (!poolData || poolData.length === 0) {
290
- return { success: false, error: 'Pool not found' };
291
- }
292
- const pool = poolData[0];
293
- const poolKeys = await raydium.cpmm.getCpmmPoolKeys(poolId);
294
- const txData = await raydium.cpmm.withdrawLiquidity({
295
- poolInfo: pool,
296
- poolKeys,
297
- lpAmount: new BN(lpAmount.toString()),
298
- slippage: new Percent(slippageBps, 10000),
299
- txVersion: TxVersion.LEGACY,
300
- });
301
- const { blockhash } = await connection.getLatestBlockhash('finalized');
302
- if (txData.transaction) {
303
- const tx = txData.transaction;
304
- tx.recentBlockhash = blockhash;
305
- tx.feePayer = wallet.publicKey;
306
- tx.sign(wallet);
307
- return {
308
- success: true,
309
- signedTransaction: Buffer.from(tx.serialize()).toString('base64'),
310
- signature: tx.signature ? Buffer.from(tx.signature).toString('base64') : undefined,
311
- };
312
- }
313
- return { success: false, error: 'Failed to build transaction' };
314
- }
315
- catch (error) {
316
- return { success: false, error: error.message };
317
- }
318
- }
319
- /**
320
- * 通过代币对查找池子
321
- */
322
- export async function findRaydiumPool(connection, mintA, mintB) {
323
- try {
324
- const raydium = await initRaydium(connection);
325
- // 搜索池子
326
- const pools = await raydium.api.fetchPoolByMints({
327
- mint1: mintA,
328
- mint2: mintB,
329
- });
330
- if (!pools || pools.data.length === 0) {
331
- return [];
332
- }
333
- return pools.data.map((pool) => {
334
- const mintAmountA = parseFloat(String(pool.mintAmountA));
335
- const mintAmountB = parseFloat(String(pool.mintAmountB));
336
- const lpAmount = parseFloat(String(pool.lpAmount || 0));
337
- return {
338
- id: pool.id,
339
- type: pool.type === 'Concentrated' ? 'clmm' : (pool.programId.includes('CPMMoo8L') ? 'cpmm' : 'amm'),
340
- mintA: {
341
- address: pool.mintA.address,
342
- symbol: pool.mintA.symbol,
343
- decimals: pool.mintA.decimals,
344
- },
345
- mintB: {
346
- address: pool.mintB.address,
347
- symbol: pool.mintB.symbol,
348
- decimals: pool.mintB.decimals,
349
- },
350
- lpMint: {
351
- address: pool.lpMint?.address || '',
352
- decimals: pool.lpMint?.decimals || 0,
353
- },
354
- reserveA: BigInt(Math.floor(mintAmountA * (10 ** pool.mintA.decimals))),
355
- reserveB: BigInt(Math.floor(mintAmountB * (10 ** pool.mintB.decimals))),
356
- lpSupply: BigInt(Math.floor(lpAmount * (10 ** (pool.lpMint?.decimals || 0)))),
357
- price: pool.price,
358
- feeRate: pool.feeRate,
359
- };
360
- });
361
- }
362
- catch (error) {
363
- console.error('Failed to find Raydium pool:', error);
364
- return [];
365
- }
366
- }
@@ -1,240 +0,0 @@
1
- /**
2
- * Raydium 类型定义
3
- * @module sol/dex/raydium/types
4
- */
5
- import { Keypair } from '@solana/web3.js';
6
- /**
7
- * Raydium 池子类型
8
- */
9
- export type RaydiumPoolType = 'amm' | 'cpmm' | 'clmm';
10
- /**
11
- * Raydium 交换参数
12
- */
13
- export interface RaydiumSwapParams {
14
- /** 池子 ID */
15
- poolId: string;
16
- /** 输入代币 Mint */
17
- inputMint: string;
18
- /** 输出代币 Mint */
19
- outputMint: string;
20
- /** 输入数量 */
21
- amountIn: bigint;
22
- /** 最小输出数量(滑点保护) */
23
- minAmountOut?: bigint;
24
- /** 滑点(基点,100 = 1%) */
25
- slippageBps?: number;
26
- /** 签名者 */
27
- wallet: Keypair;
28
- }
29
- /**
30
- * Raydium 添加 LP 参数
31
- */
32
- export interface RaydiumAddLpParams {
33
- /** 池子 ID */
34
- poolId: string;
35
- /** 代币 A 数量 */
36
- amountA: bigint;
37
- /** 代币 B 数量(可选,自动计算) */
38
- amountB?: bigint;
39
- /** 滑点(基点) */
40
- slippageBps?: number;
41
- /** 固定侧('a' 或 'b') */
42
- fixedSide?: 'a' | 'b';
43
- /** 签名者 */
44
- wallet: Keypair;
45
- }
46
- /**
47
- * Raydium 移除 LP 参数
48
- */
49
- export interface RaydiumRemoveLpParams {
50
- /** 池子 ID */
51
- poolId: string;
52
- /** LP 代币数量 */
53
- lpAmount: bigint;
54
- /** 滑点(基点) */
55
- slippageBps?: number;
56
- /** 签名者 */
57
- wallet: Keypair;
58
- }
59
- /**
60
- * Raydium LaunchLab 创建代币参数
61
- */
62
- export interface RaydiumLaunchLabParams {
63
- /** 代币名称 */
64
- name: string;
65
- /** 代币符号 */
66
- symbol: string;
67
- /** 元数据 URI */
68
- uri: string;
69
- /** 精度(默认 6) */
70
- decimals?: number;
71
- /** 总供应量 */
72
- supply?: bigint;
73
- /** 总售卖数量 */
74
- totalSellA?: bigint;
75
- /** 总募资数量(以 Quote 代币计) */
76
- totalFundRaisingB?: bigint;
77
- /** 迁移类型 */
78
- migrateType?: 'amm' | 'cpmm';
79
- /** 配置 ID */
80
- configId?: string;
81
- /** 平台 ID */
82
- platformId?: string;
83
- /** 创建者同时购买数量(可选) */
84
- buyAmount?: bigint;
85
- /** 最小获得代币数量 */
86
- minMintAAmount?: bigint;
87
- /** 滑点(基点) */
88
- slippageBps?: number;
89
- /** 是否使用 Token-2022 */
90
- token2022?: boolean;
91
- /** 签名者 */
92
- wallet: Keypair;
93
- }
94
- /**
95
- * Raydium 交换结果
96
- */
97
- export interface RaydiumSwapResult {
98
- success: boolean;
99
- /** 签名后的交易(Base64) */
100
- signedTransaction?: string;
101
- /** 交易签名 */
102
- signature?: string;
103
- /** 预估输出数量 */
104
- estimatedAmountOut?: bigint;
105
- /** 错误信息 */
106
- error?: string;
107
- }
108
- /**
109
- * Raydium LP 操作结果
110
- */
111
- export interface RaydiumLpResult {
112
- success: boolean;
113
- signedTransaction?: string;
114
- signature?: string;
115
- /** LP 代币数量(添加时) */
116
- lpAmount?: bigint;
117
- /** 代币 A 数量(移除时) */
118
- amountA?: bigint;
119
- /** 代币 B 数量(移除时) */
120
- amountB?: bigint;
121
- error?: string;
122
- }
123
- /**
124
- * Raydium LaunchLab 创建结果
125
- */
126
- export interface RaydiumLaunchLabResult {
127
- success: boolean;
128
- /** 代币 Mint 地址 */
129
- mintAddress?: string;
130
- /** 池子 ID */
131
- poolId?: string;
132
- /** 签名后的交易(可能多笔) */
133
- signedTransactions?: string[];
134
- error?: string;
135
- }
136
- /**
137
- * Raydium 池子信息
138
- */
139
- export interface RaydiumPoolInfo {
140
- /** 池子 ID */
141
- id: string;
142
- /** 池子类型 */
143
- type: RaydiumPoolType;
144
- /** 代币 A */
145
- mintA: {
146
- address: string;
147
- symbol?: string;
148
- decimals: number;
149
- };
150
- /** 代币 B */
151
- mintB: {
152
- address: string;
153
- symbol?: string;
154
- decimals: number;
155
- };
156
- /** LP Mint */
157
- lpMint: {
158
- address: string;
159
- decimals: number;
160
- };
161
- /** 代币 A 储备 */
162
- reserveA: bigint;
163
- /** 代币 B 储备 */
164
- reserveB: bigint;
165
- /** LP 总供应 */
166
- lpSupply: bigint;
167
- /** 价格 */
168
- price: number;
169
- /** 手续费率(基点) */
170
- feeRate: number;
171
- }
172
- /**
173
- * Raydium Bundle 买入项
174
- */
175
- export interface RaydiumBundleBuyItem {
176
- wallet: Keypair;
177
- /** SOL/Quote 数量 */
178
- amountIn: bigint;
179
- }
180
- /**
181
- * Raydium Bundle 卖出项
182
- */
183
- export interface RaydiumBundleSellItem {
184
- wallet: Keypair;
185
- /** 代币数量 */
186
- tokenAmount: bigint;
187
- }
188
- /**
189
- * Raydium Bundle 签名结果
190
- */
191
- export interface RaydiumBundleSignResult {
192
- success: boolean;
193
- bundleData?: {
194
- transactions: Array<{
195
- data: string;
196
- isVersioned: boolean;
197
- signature?: string;
198
- }>;
199
- signatures: string[];
200
- tip: {
201
- account: string;
202
- lamports: bigint;
203
- };
204
- recentBlockhash: string;
205
- lastValidBlockHeight: number;
206
- createdAt: number;
207
- };
208
- error?: string;
209
- }
210
- /**
211
- * CPMM 池子创建参数
212
- */
213
- export interface RaydiumCreateCpmmPoolParams {
214
- /** 代币 A Mint */
215
- mintA: string;
216
- /** 代币 B Mint */
217
- mintB: string;
218
- /** 代币 A 初始数量 */
219
- amountA: bigint;
220
- /** 代币 B 初始数量 */
221
- amountB: bigint;
222
- /** 开放时间(Unix 时间戳,可选) */
223
- openTime?: number;
224
- /** 配置 ID(可选) */
225
- configId?: string;
226
- /** 签名者 */
227
- wallet: Keypair;
228
- }
229
- /**
230
- * CPMM 池子创建结果
231
- */
232
- export interface RaydiumCreateCpmmPoolResult {
233
- success: boolean;
234
- /** 池子 ID */
235
- poolId?: string;
236
- /** LP Mint */
237
- lpMint?: string;
238
- signedTransaction?: string;
239
- error?: string;
240
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Raydium 类型定义
3
- * @module sol/dex/raydium/types
4
- */
5
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * Solana SDK 入口
3
- * @module sol
4
- */
5
- export * from './types.js';
6
- export * from './constants.js';
7
- export * from './utils/index.js';
8
- export * from './jito/index.js';
9
- export * from './token/index.js';
10
- export * from './dex/index.js';
package/dist/sol/index.js DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * Solana SDK 入口
3
- * @module sol
4
- */
5
- // 类型导出
6
- export * from './types.js';
7
- // 常量导出
8
- export * from './constants.js';
9
- // 工具函数导出
10
- export * from './utils/index.js';
11
- // Jito Bundle 导出
12
- export * from './jito/index.js';
13
- // Token 创建导出
14
- export * from './token/index.js';
15
- // DEX 导出(Pump, Raydium, Orca, Meteora)
16
- export * from './dex/index.js';