four-flap-meme-sdk 1.5.55 → 1.5.56

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 (150) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -1
  3. package/dist/sol/constants.d.ts +150 -0
  4. package/dist/sol/constants.js +188 -0
  5. package/dist/sol/dex/blockrazor/client.d.ts +51 -0
  6. package/dist/sol/dex/blockrazor/client.js +96 -0
  7. package/dist/sol/dex/blockrazor/constants.d.ts +34 -0
  8. package/dist/sol/dex/blockrazor/constants.js +55 -0
  9. package/dist/sol/dex/blockrazor/geyser.d.ts +128 -0
  10. package/dist/sol/dex/blockrazor/geyser.js +530 -0
  11. package/dist/sol/dex/blockrazor/index.d.ts +18 -0
  12. package/dist/sol/dex/blockrazor/index.js +23 -0
  13. package/dist/sol/dex/blockrazor/send.d.ts +135 -0
  14. package/dist/sol/dex/blockrazor/send.js +254 -0
  15. package/dist/sol/dex/blockrazor/types.d.ts +191 -0
  16. package/dist/sol/dex/blockrazor/types.js +5 -0
  17. package/dist/sol/dex/index.d.ts +10 -0
  18. package/dist/sol/dex/index.js +16 -0
  19. package/dist/sol/dex/jup/client.d.ts +33 -0
  20. package/dist/sol/dex/jup/client.js +110 -0
  21. package/dist/sol/dex/jup/index.d.ts +16 -0
  22. package/dist/sol/dex/jup/index.js +148 -0
  23. package/dist/sol/dex/jup/legacy.d.ts +623 -0
  24. package/dist/sol/dex/jup/legacy.js +416 -0
  25. package/dist/sol/dex/jup/lend.d.ts +640 -0
  26. package/dist/sol/dex/jup/lend.js +603 -0
  27. package/dist/sol/dex/jup/portfolio.d.ts +362 -0
  28. package/dist/sol/dex/jup/portfolio.js +367 -0
  29. package/dist/sol/dex/jup/price.d.ts +173 -0
  30. package/dist/sol/dex/jup/price.js +220 -0
  31. package/dist/sol/dex/jup/recurring.d.ts +437 -0
  32. package/dist/sol/dex/jup/recurring.js +320 -0
  33. package/dist/sol/dex/jup/send.d.ts +282 -0
  34. package/dist/sol/dex/jup/send.js +295 -0
  35. package/dist/sol/dex/jup/studio.d.ts +457 -0
  36. package/dist/sol/dex/jup/studio.js +488 -0
  37. package/dist/sol/dex/jup/tokens.d.ts +767 -0
  38. package/dist/sol/dex/jup/tokens.js +697 -0
  39. package/dist/sol/dex/jup/trigger.d.ts +511 -0
  40. package/dist/sol/dex/jup/trigger.js +397 -0
  41. package/dist/sol/dex/jup/types.d.ts +433 -0
  42. package/dist/sol/dex/jup/types.js +5 -0
  43. package/dist/sol/dex/jup/ultra.d.ts +646 -0
  44. package/dist/sol/dex/jup/ultra.js +853 -0
  45. package/dist/sol/dex/meteora/client.d.ts +76 -0
  46. package/dist/sol/dex/meteora/client.js +219 -0
  47. package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +61 -0
  48. package/dist/sol/dex/meteora/damm-v1-bundle.js +112 -0
  49. package/dist/sol/dex/meteora/damm-v1.d.ts +118 -0
  50. package/dist/sol/dex/meteora/damm-v1.js +315 -0
  51. package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +82 -0
  52. package/dist/sol/dex/meteora/damm-v2-bundle.js +242 -0
  53. package/dist/sol/dex/meteora/damm-v2.d.ts +172 -0
  54. package/dist/sol/dex/meteora/damm-v2.js +632 -0
  55. package/dist/sol/dex/meteora/dbc-bundle.d.ts +123 -0
  56. package/dist/sol/dex/meteora/dbc-bundle.js +304 -0
  57. package/dist/sol/dex/meteora/dbc.d.ts +192 -0
  58. package/dist/sol/dex/meteora/dbc.js +619 -0
  59. package/dist/sol/dex/meteora/dlmm-bundle.d.ts +39 -0
  60. package/dist/sol/dex/meteora/dlmm-bundle.js +189 -0
  61. package/dist/sol/dex/meteora/dlmm.d.ts +157 -0
  62. package/dist/sol/dex/meteora/dlmm.js +671 -0
  63. package/dist/sol/dex/meteora/index.d.ts +25 -0
  64. package/dist/sol/dex/meteora/index.js +65 -0
  65. package/dist/sol/dex/meteora/types.d.ts +787 -0
  66. package/dist/sol/dex/meteora/types.js +110 -0
  67. package/dist/sol/dex/orca/index.d.ts +10 -0
  68. package/dist/sol/dex/orca/index.js +16 -0
  69. package/dist/sol/dex/orca/orca-bundle.d.ts +41 -0
  70. package/dist/sol/dex/orca/orca-bundle.js +173 -0
  71. package/dist/sol/dex/orca/orca.d.ts +65 -0
  72. package/dist/sol/dex/orca/orca.js +474 -0
  73. package/dist/sol/dex/orca/types.d.ts +263 -0
  74. package/dist/sol/dex/orca/types.js +38 -0
  75. package/dist/sol/dex/orca/wavebreak-bundle.d.ts +34 -0
  76. package/dist/sol/dex/orca/wavebreak-bundle.js +198 -0
  77. package/dist/sol/dex/orca/wavebreak-types.d.ts +227 -0
  78. package/dist/sol/dex/orca/wavebreak-types.js +23 -0
  79. package/dist/sol/dex/orca/wavebreak.d.ts +78 -0
  80. package/dist/sol/dex/orca/wavebreak.js +497 -0
  81. package/dist/sol/dex/pump/index.d.ts +9 -0
  82. package/dist/sol/dex/pump/index.js +14 -0
  83. package/dist/sol/dex/pump/pump-bundle.d.ts +92 -0
  84. package/dist/sol/dex/pump/pump-bundle.js +383 -0
  85. package/dist/sol/dex/pump/pump-swap-bundle.d.ts +103 -0
  86. package/dist/sol/dex/pump/pump-swap-bundle.js +380 -0
  87. package/dist/sol/dex/pump/pump-swap.d.ts +46 -0
  88. package/dist/sol/dex/pump/pump-swap.js +199 -0
  89. package/dist/sol/dex/pump/pump.d.ts +35 -0
  90. package/dist/sol/dex/pump/pump.js +352 -0
  91. package/dist/sol/dex/pump/types.d.ts +215 -0
  92. package/dist/sol/dex/pump/types.js +5 -0
  93. package/dist/sol/dex/raydium/index.d.ts +8 -0
  94. package/dist/sol/dex/raydium/index.js +12 -0
  95. package/dist/sol/dex/raydium/launchlab.d.ts +68 -0
  96. package/dist/sol/dex/raydium/launchlab.js +210 -0
  97. package/dist/sol/dex/raydium/raydium-bundle.d.ts +64 -0
  98. package/dist/sol/dex/raydium/raydium-bundle.js +324 -0
  99. package/dist/sol/dex/raydium/raydium.d.ts +40 -0
  100. package/dist/sol/dex/raydium/raydium.js +366 -0
  101. package/dist/sol/dex/raydium/types.d.ts +240 -0
  102. package/dist/sol/dex/raydium/types.js +5 -0
  103. package/dist/sol/index.d.ts +11 -0
  104. package/dist/sol/index.js +18 -0
  105. package/dist/sol/jito/bundle.d.ts +90 -0
  106. package/dist/sol/jito/bundle.js +263 -0
  107. package/dist/sol/jito/index.d.ts +7 -0
  108. package/dist/sol/jito/index.js +7 -0
  109. package/dist/sol/jito/tip.d.ts +51 -0
  110. package/dist/sol/jito/tip.js +83 -0
  111. package/dist/sol/jito/types.d.ts +100 -0
  112. package/dist/sol/jito/types.js +5 -0
  113. package/dist/sol/nozomi/client.d.ts +63 -0
  114. package/dist/sol/nozomi/client.js +222 -0
  115. package/dist/sol/nozomi/index.d.ts +8 -0
  116. package/dist/sol/nozomi/index.js +8 -0
  117. package/dist/sol/nozomi/tip.d.ts +50 -0
  118. package/dist/sol/nozomi/tip.js +80 -0
  119. package/dist/sol/nozomi/types.d.ts +96 -0
  120. package/dist/sol/nozomi/types.js +5 -0
  121. package/dist/sol/token/create-complete.d.ts +115 -0
  122. package/dist/sol/token/create-complete.js +235 -0
  123. package/dist/sol/token/create-token.d.ts +57 -0
  124. package/dist/sol/token/create-token.js +230 -0
  125. package/dist/sol/token/index.d.ts +9 -0
  126. package/dist/sol/token/index.js +14 -0
  127. package/dist/sol/token/metadata-upload.d.ts +86 -0
  128. package/dist/sol/token/metadata-upload.js +173 -0
  129. package/dist/sol/token/metadata.d.ts +92 -0
  130. package/dist/sol/token/metadata.js +274 -0
  131. package/dist/sol/token/types.d.ts +153 -0
  132. package/dist/sol/token/types.js +5 -0
  133. package/dist/sol/types.d.ts +176 -0
  134. package/dist/sol/types.js +7 -0
  135. package/dist/sol/utils/balance.d.ts +160 -0
  136. package/dist/sol/utils/balance.js +638 -0
  137. package/dist/sol/utils/connection.d.ts +78 -0
  138. package/dist/sol/utils/connection.js +168 -0
  139. package/dist/sol/utils/index.d.ts +9 -0
  140. package/dist/sol/utils/index.js +9 -0
  141. package/dist/sol/utils/lp-inspect.d.ts +75 -0
  142. package/dist/sol/utils/lp-inspect.js +235 -0
  143. package/dist/sol/utils/transfer.d.ts +196 -0
  144. package/dist/sol/utils/transfer.js +307 -0
  145. package/dist/sol/utils/wallet.d.ts +107 -0
  146. package/dist/sol/utils/wallet.js +210 -0
  147. package/package.json +44 -5
  148. package/README.zh-CN.pdf +0 -0
  149. package/dist/flap/portal-bundle-merkle/encryption.d.ts +0 -16
  150. package/dist/flap/portal-bundle-merkle/encryption.js +0 -146
@@ -0,0 +1,697 @@
1
+ /**
2
+ * Jupiter Tokens API V2 (Beta)
3
+ * @module sol/dex/jup/tokens
4
+ *
5
+ * Tokens API V2 提供更详细的代币信息查询
6
+ * 包括市场数据、统计数据、审计信息等
7
+ */
8
+ import { jupGet } from './client.js';
9
+ // ============================================================================
10
+ // Search API - 搜索代币
11
+ // ============================================================================
12
+ /**
13
+ * 搜索代币 (V2)
14
+ *
15
+ * 通过符号、名称或 Mint 地址搜索代币,返回详细信息。
16
+ *
17
+ * @param query 搜索查询(符号/名称/Mint地址,多个用逗号分隔)
18
+ * @param config Jupiter 配置
19
+ * @returns 代币信息列表
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import { Sol } from 'four-flap-meme-sdk'
24
+ *
25
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
26
+ *
27
+ * // 按符号搜索
28
+ * const results = await Sol.searchTokensV2('USDC')
29
+ *
30
+ * // 按 Mint 地址搜索
31
+ * const usdcInfo = await Sol.searchTokensV2(
32
+ * 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
33
+ * )
34
+ *
35
+ * // 批量搜索多个 Mint
36
+ * const tokens = await Sol.searchTokensV2(
37
+ * 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,So11111111111111111111111111111111111111112'
38
+ * )
39
+ *
40
+ * tokens.forEach(token => {
41
+ * console.log(`${token.symbol}: $${token.usdPrice}`)
42
+ * console.log(` 市值: $${token.mcap?.toLocaleString()}`)
43
+ * console.log(` 流动性: $${token.liquidity?.toLocaleString()}`)
44
+ * console.log(` 24h变化: ${token.stats24h?.priceChange}%`)
45
+ * })
46
+ * ```
47
+ */
48
+ export async function searchTokensV2(query, config) {
49
+ return jupGet('/tokens/v2/search', { query }, config);
50
+ }
51
+ /**
52
+ * 获取单个代币信息 (V2)
53
+ *
54
+ * @param mint 代币 Mint 地址
55
+ * @param config Jupiter 配置
56
+ * @returns 代币信息或 null
57
+ */
58
+ export async function getTokenInfoV2(mint, config) {
59
+ const results = await searchTokensV2(mint, config);
60
+ return results.length > 0 ? results[0] : null;
61
+ }
62
+ /**
63
+ * 批量获取代币信息 (V2)
64
+ *
65
+ * @param mints 代币 Mint 地址数组(最多100个)
66
+ * @param config Jupiter 配置
67
+ * @returns 代币信息列表
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const tokens = await Sol.batchGetTokenInfoV2([
72
+ * 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
73
+ * 'So11111111111111111111111111111111111111112', // SOL
74
+ * 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', // USDT
75
+ * ])
76
+ * ```
77
+ */
78
+ export async function batchGetTokenInfoV2(mints, config) {
79
+ if (mints.length === 0)
80
+ return [];
81
+ if (mints.length > 100) {
82
+ throw new Error('最多支持查询100个代币');
83
+ }
84
+ return searchTokensV2(mints.join(','), config);
85
+ }
86
+ // ============================================================================
87
+ // Tag API - 按标签获取代币
88
+ // ============================================================================
89
+ /**
90
+ * 按标签获取代币列表 (V2)
91
+ *
92
+ * 获取特定标签的所有代币,返回详细信息。
93
+ *
94
+ * @param tag 标签类型 ('lst' | 'verified')
95
+ * @param config Jupiter 配置
96
+ * @returns 代币信息列表
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * import { Sol } from 'four-flap-meme-sdk'
101
+ *
102
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
103
+ *
104
+ * // 获取所有已验证代币
105
+ * const verifiedTokens = await Sol.getTokensByTag('verified')
106
+ * console.log(`共 ${verifiedTokens.length} 个已验证代币`)
107
+ *
108
+ * // 获取所有 LST (流动性质押代币)
109
+ * const lstTokens = await Sol.getTokensByTag('lst')
110
+ * lstTokens.forEach(token => {
111
+ * console.log(`${token.symbol}: $${token.usdPrice}`)
112
+ * })
113
+ * ```
114
+ */
115
+ export async function getTokensByTag(tag, config) {
116
+ return jupGet('/tokens/v2/tag', { query: tag }, config);
117
+ }
118
+ /**
119
+ * 获取所有已验证代币 (V2)
120
+ *
121
+ * @param config Jupiter 配置
122
+ * @returns 已验证代币列表
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * const verifiedTokens = await Sol.getVerifiedTokensV2()
127
+ * verifiedTokens.forEach(token => {
128
+ * console.log(`${token.symbol}: $${token.usdPrice}`)
129
+ * })
130
+ * ```
131
+ */
132
+ export async function getVerifiedTokensV2(config) {
133
+ return getTokensByTag('verified', config);
134
+ }
135
+ /**
136
+ * 获取所有 LST (流动性质押代币) (V2)
137
+ *
138
+ * LST = Liquid Staking Tokens (如 mSOL, jitoSOL, bSOL 等)
139
+ *
140
+ * @param config Jupiter 配置
141
+ * @returns LST 代币列表
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * const lstTokens = await Sol.getLstTokensV2()
146
+ * lstTokens.forEach(token => {
147
+ * console.log(`${token.symbol}: $${token.usdPrice}`)
148
+ * console.log(` 流动性: $${token.liquidity?.toLocaleString()}`)
149
+ * })
150
+ * ```
151
+ */
152
+ export async function getLstTokensV2(config) {
153
+ return getTokensByTag('lst', config);
154
+ }
155
+ // ============================================================================
156
+ // Category API - 按分类获取热门代币
157
+ // ============================================================================
158
+ /**
159
+ * 按分类获取热门代币 (V2)
160
+ *
161
+ * 获取不同交易分类的热门代币,结果会过滤掉 SOL、USDC 等通用代币。
162
+ *
163
+ * @param category 分类类型
164
+ * @param interval 时间间隔
165
+ * @param limit 返回数量(默认50,最多100)
166
+ * @param config Jupiter 配置
167
+ * @returns 代币信息列表
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * import { Sol } from 'four-flap-meme-sdk'
172
+ *
173
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
174
+ *
175
+ * // 获取24小时内交易量最高的代币
176
+ * const topTraded = await Sol.getTopTokensV2('toptraded', '24h')
177
+ *
178
+ * // 获取1小时内最热门的代币
179
+ * const trending = await Sol.getTopTokensV2('toptrending', '1h', 20)
180
+ *
181
+ * // 获取有机分数最高的代币
182
+ * const topOrganic = await Sol.getTopTokensV2('toporganicscore', '6h')
183
+ *
184
+ * topTraded.forEach(token => {
185
+ * console.log(`${token.symbol}: $${token.usdPrice}`)
186
+ * console.log(` 24h交易量: $${(token.stats24h?.buyVolume ?? 0) + (token.stats24h?.sellVolume ?? 0)}`)
187
+ * })
188
+ * ```
189
+ */
190
+ export async function getTopTokensV2(category, interval, limit, config) {
191
+ const params = {};
192
+ if (limit) {
193
+ if (limit < 1 || limit > 100) {
194
+ throw new Error('limit 必须在 1-100 之间');
195
+ }
196
+ params.limit = limit;
197
+ }
198
+ return jupGet(`/tokens/v2/${category}/${interval}`, params, config);
199
+ }
200
+ /**
201
+ * 获取交易量最高的代币 (V2)
202
+ *
203
+ * @param interval 时间间隔
204
+ * @param limit 返回数量
205
+ * @param config Jupiter 配置
206
+ * @returns 代币列表
207
+ */
208
+ export async function getTopTradedTokensV2(interval = '24h', limit, config) {
209
+ return getTopTokensV2('toptraded', interval, limit, config);
210
+ }
211
+ /**
212
+ * 获取最热门的代币 (V2)
213
+ *
214
+ * @param interval 时间间隔
215
+ * @param limit 返回数量
216
+ * @param config Jupiter 配置
217
+ * @returns 代币列表
218
+ */
219
+ export async function getTrendingTokensV2(interval = '1h', limit, config) {
220
+ return getTopTokensV2('toptrending', interval, limit, config);
221
+ }
222
+ /**
223
+ * 获取有机分数最高的代币 (V2)
224
+ *
225
+ * @param interval 时间间隔
226
+ * @param limit 返回数量
227
+ * @param config Jupiter 配置
228
+ * @returns 代币列表
229
+ */
230
+ export async function getTopOrganicTokensV2(interval = '24h', limit, config) {
231
+ return getTopTokensV2('toporganicscore', interval, limit, config);
232
+ }
233
+ // ============================================================================
234
+ // Recent API - 获取最近的代币
235
+ // ============================================================================
236
+ /**
237
+ * 获取最近的代币 (V2)
238
+ *
239
+ * 获取最近创建或上市的代币列表。
240
+ *
241
+ * @param config Jupiter 配置
242
+ * @returns 代币信息列表
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * import { Sol } from 'four-flap-meme-sdk'
247
+ *
248
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
249
+ *
250
+ * // 获取最近的代币
251
+ * const recentTokens = await Sol.getRecentTokensV2()
252
+ *
253
+ * recentTokens.forEach(token => {
254
+ * console.log(`${token.symbol}: $${token.usdPrice}`)
255
+ * console.log(` 创建于: ${token.firstPool?.createdAt}`)
256
+ * console.log(` 发射台: ${token.launchpad || '无'}`)
257
+ * })
258
+ * ```
259
+ */
260
+ export async function getRecentTokensV2(config) {
261
+ return jupGet('/tokens/v2/recent', {}, config);
262
+ }
263
+ /**
264
+ * 获取代币内容 (V2)
265
+ *
266
+ * 获取代币的相关内容,包括文章、推文、摘要等。
267
+ *
268
+ * @param mints 代币 Mint 地址数组(最多50个)
269
+ * @param config Jupiter 配置
270
+ * @returns 代币内容响应
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * import { Sol } from 'four-flap-meme-sdk'
275
+ *
276
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
277
+ *
278
+ * // 获取代币内容
279
+ * const response = await Sol.getTokenContentV2([
280
+ * 'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN',
281
+ * 'So11111111111111111111111111111111111111112',
282
+ * ])
283
+ *
284
+ * response.data.forEach(item => {
285
+ * console.log(`代币: ${item.mint}`)
286
+ *
287
+ * // 代币摘要
288
+ * if (item.tokenSummary.summaryShort) {
289
+ * console.log(`摘要: ${item.tokenSummary.summaryShort}`)
290
+ * }
291
+ *
292
+ * // 新闻摘要
293
+ * if (item.newsSummary.summaryShort) {
294
+ * console.log(`新闻: ${item.newsSummary.summaryShort}`)
295
+ * }
296
+ *
297
+ * // 内容列表
298
+ * item.contents.forEach(content => {
299
+ * console.log(`[${content.contentType}] ${content.content.slice(0, 100)}...`)
300
+ * })
301
+ * })
302
+ * ```
303
+ */
304
+ export async function getTokenContentV2(mints, config) {
305
+ if (mints.length === 0) {
306
+ return { data: [] };
307
+ }
308
+ if (mints.length > 50) {
309
+ throw new Error('最多支持查询50个代币');
310
+ }
311
+ return jupGet('/tokens/v2/content', { mints: mints.join(',') }, config);
312
+ }
313
+ /**
314
+ * 获取单个代币内容 (V2)
315
+ *
316
+ * @param mint 代币 Mint 地址
317
+ * @param config Jupiter 配置
318
+ * @returns 代币内容数据或 null
319
+ */
320
+ export async function getSingleTokenContentV2(mint, config) {
321
+ const response = await getTokenContentV2([mint], config);
322
+ return response.data.length > 0 ? response.data[0] : null;
323
+ }
324
+ /**
325
+ * 获取代币摘要 (V2)
326
+ *
327
+ * @param mint 代币 Mint 地址
328
+ * @param config Jupiter 配置
329
+ * @returns 代币摘要或 null
330
+ */
331
+ export async function getTokenSummaryV2(mint, config) {
332
+ const content = await getSingleTokenContentV2(mint, config);
333
+ if (!content)
334
+ return null;
335
+ return {
336
+ token: content.tokenSummary,
337
+ news: content.newsSummary,
338
+ };
339
+ }
340
+ /**
341
+ * 获取代币推文内容 (V2)
342
+ *
343
+ * @param mint 代币 Mint 地址
344
+ * @param config Jupiter 配置
345
+ * @returns 推文内容列表
346
+ */
347
+ export async function getTokenTweetsV2(mint, config) {
348
+ const content = await getSingleTokenContentV2(mint, config);
349
+ if (!content)
350
+ return [];
351
+ return content.contents.filter(c => c.contentType === 'tweet');
352
+ }
353
+ /**
354
+ * 获取代币文章内容 (V2)
355
+ *
356
+ * @param mint 代币 Mint 地址
357
+ * @param config Jupiter 配置
358
+ * @returns 文章内容列表
359
+ */
360
+ export async function getTokenArticlesV2(mint, config) {
361
+ const content = await getSingleTokenContentV2(mint, config);
362
+ if (!content)
363
+ return [];
364
+ return content.contents.filter(c => c.contentType === 'text');
365
+ }
366
+ /**
367
+ * 获取 Cooking 代币内容 (V2)
368
+ *
369
+ * 获取正在 "cooking"(酝酿中/热门)的代币内容列表。
370
+ *
371
+ * @param config Jupiter 配置
372
+ * @returns 代币内容响应
373
+ *
374
+ * @example
375
+ * ```typescript
376
+ * import { Sol } from 'four-flap-meme-sdk'
377
+ *
378
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
379
+ *
380
+ * // 获取 cooking 代币内容
381
+ * const response = await Sol.getCookingTokenContentV2()
382
+ *
383
+ * response.data.forEach(item => {
384
+ * console.log(`代币: ${item.mint}`)
385
+ *
386
+ * // 代币摘要
387
+ * if (item.tokenSummary?.summaryShort) {
388
+ * console.log(`摘要: ${item.tokenSummary.summaryShort}`)
389
+ * }
390
+ *
391
+ * // 新闻摘要
392
+ * if (item.newsSummary?.summaryShort) {
393
+ * console.log(`新闻: ${item.newsSummary.summaryShort}`)
394
+ * }
395
+ *
396
+ * // 内容列表
397
+ * item.contents.forEach(content => {
398
+ * console.log(`[${content.contentType}] ${content.content}`)
399
+ * })
400
+ * })
401
+ * ```
402
+ */
403
+ export async function getCookingTokenContentV2(config) {
404
+ return jupGet('/tokens/v2/content/cooking', {}, config);
405
+ }
406
+ /**
407
+ * 获取代币内容 Feed (V2) - 带分页
408
+ *
409
+ * 获取单个代币的内容 feed,支持分页。
410
+ *
411
+ * @param params 请求参数
412
+ * @param config Jupiter 配置
413
+ * @returns Feed 响应
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * import { Sol } from 'four-flap-meme-sdk'
418
+ *
419
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
420
+ *
421
+ * // 获取代币内容 feed
422
+ * const response = await Sol.getTokenContentFeedV2({
423
+ * mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
424
+ * page: 1,
425
+ * limit: 50,
426
+ * })
427
+ *
428
+ * const { data } = response
429
+ *
430
+ * // 分页信息
431
+ * console.log(`第 ${data.pagination.page}/${data.pagination.totalPages} 页`)
432
+ * console.log(`共 ${data.pagination.total} 条内容`)
433
+ *
434
+ * // 代币摘要
435
+ * if (data.tokenSummary?.summaryShort) {
436
+ * console.log(`简介: ${data.tokenSummary.summaryShort}`)
437
+ * }
438
+ *
439
+ * // 新闻摘要
440
+ * if (data.newsSummary?.summaryShort) {
441
+ * console.log(`新闻: ${data.newsSummary.summaryShort}`)
442
+ * }
443
+ *
444
+ * // 内容列表
445
+ * data.contents.forEach(content => {
446
+ * console.log(`[${content.contentType}] ${content.content}`)
447
+ * console.log(` 发布于: ${content.postedAt}`)
448
+ * })
449
+ * ```
450
+ */
451
+ export async function getTokenContentFeedV2(params, config) {
452
+ const queryParams = {
453
+ mint: params.mint,
454
+ };
455
+ if (params.page) {
456
+ if (params.page < 1)
457
+ throw new Error('page 必须 >= 1');
458
+ queryParams.page = params.page;
459
+ }
460
+ if (params.limit) {
461
+ if (params.limit < 1 || params.limit > 100) {
462
+ throw new Error('limit 必须在 1-100 之间');
463
+ }
464
+ queryParams.limit = params.limit;
465
+ }
466
+ return jupGet('/tokens/v2/content/feed', queryParams, config);
467
+ }
468
+ /**
469
+ * 获取代币所有内容 (V2) - 自动分页
470
+ *
471
+ * @param mint 代币 Mint 地址
472
+ * @param config Jupiter 配置
473
+ * @returns 所有内容列表
474
+ */
475
+ export async function getAllTokenContentFeedV2(mint, config) {
476
+ const allContents = [];
477
+ let page = 1;
478
+ while (true) {
479
+ const response = await getTokenContentFeedV2({
480
+ mint,
481
+ page,
482
+ limit: 100,
483
+ }, config);
484
+ allContents.push(...response.data.contents);
485
+ if (page >= response.data.pagination.totalPages)
486
+ break;
487
+ page++;
488
+ }
489
+ return allContents;
490
+ }
491
+ /**
492
+ * 获取代币内容 Feed 简化版 (V2)
493
+ *
494
+ * @param mint 代币 Mint 地址
495
+ * @param page 页码
496
+ * @param limit 每页数量
497
+ * @param config Jupiter 配置
498
+ * @returns Feed 响应
499
+ */
500
+ export async function getTokenFeedV2(mint, page = 1, limit = 50, config) {
501
+ return getTokenContentFeedV2({ mint, page, limit }, config);
502
+ }
503
+ /**
504
+ * 检查代币是否有内容/摘要 (V2)
505
+ *
506
+ * @param contentData 代币内容数据
507
+ * @returns 是否有内容
508
+ */
509
+ export function hasTokenContent(contentData) {
510
+ return (contentData.contents.length > 0 ||
511
+ contentData.tokenSummary !== null ||
512
+ contentData.newsSummary !== null);
513
+ }
514
+ /**
515
+ * 获取代币所有引用来源 (V2)
516
+ *
517
+ * @param contentData 代币内容数据
518
+ * @returns 去重后的引用来源列表
519
+ */
520
+ export function getAllCitations(contentData) {
521
+ const citations = new Set();
522
+ contentData.tokenSummary?.citations.forEach(c => citations.add(c));
523
+ contentData.newsSummary?.citations.forEach(c => citations.add(c));
524
+ return Array.from(citations);
525
+ }
526
+ // ============================================================================
527
+ // 便捷方法
528
+ // ============================================================================
529
+ /**
530
+ * 获取代币价格 (V2)
531
+ *
532
+ * @param mint 代币 Mint 地址
533
+ * @param config Jupiter 配置
534
+ * @returns 价格 (USD) 或 null
535
+ */
536
+ export async function getTokenPriceV2(mint, config) {
537
+ const info = await getTokenInfoV2(mint, config);
538
+ return info?.usdPrice ?? null;
539
+ }
540
+ /**
541
+ * 批量获取代币价格 (V2)
542
+ *
543
+ * @param mints 代币 Mint 地址数组
544
+ * @param config Jupiter 配置
545
+ * @returns Mint -> 价格 映射
546
+ */
547
+ export async function batchGetTokenPricesV2(mints, config) {
548
+ const tokens = await batchGetTokenInfoV2(mints, config);
549
+ const priceMap = new Map();
550
+ tokens.forEach(token => {
551
+ priceMap.set(token.id, token.usdPrice ?? null);
552
+ });
553
+ // 设置未找到的代币为 null
554
+ mints.forEach(mint => {
555
+ if (!priceMap.has(mint)) {
556
+ priceMap.set(mint, null);
557
+ }
558
+ });
559
+ return priceMap;
560
+ }
561
+ /**
562
+ * 获取代币市场数据 (V2)
563
+ *
564
+ * @param mint 代币 Mint 地址
565
+ * @param config Jupiter 配置
566
+ * @returns 市场数据
567
+ */
568
+ export async function getTokenMarketDataV2(mint, config) {
569
+ const info = await getTokenInfoV2(mint, config);
570
+ if (!info)
571
+ return null;
572
+ const buyVolume = info.stats24h?.buyVolume ?? 0;
573
+ const sellVolume = info.stats24h?.sellVolume ?? 0;
574
+ return {
575
+ price: info.usdPrice ?? null,
576
+ fdv: info.fdv ?? null,
577
+ mcap: info.mcap ?? null,
578
+ liquidity: info.liquidity ?? null,
579
+ volume24h: buyVolume + sellVolume || null,
580
+ priceChange24h: info.stats24h?.priceChange ?? null,
581
+ };
582
+ }
583
+ /**
584
+ * 检查代币是否安全 (V2)
585
+ *
586
+ * @param mint 代币 Mint 地址
587
+ * @param config Jupiter 配置
588
+ * @returns 安全检查结果
589
+ */
590
+ export async function checkTokenSafetyV2(mint, config) {
591
+ const info = await getTokenInfoV2(mint, config);
592
+ if (!info)
593
+ return null;
594
+ const warnings = [];
595
+ const audit = info.audit ?? {};
596
+ // 检查风险项
597
+ if (audit.isSus)
598
+ warnings.push('代币被标记为可疑');
599
+ if (audit.mintAuthorityDisabled === false)
600
+ warnings.push('Mint权限未禁用');
601
+ if (audit.freezeAuthorityDisabled === false)
602
+ warnings.push('冻结权限未禁用');
603
+ if ((audit.topHoldersPercentage ?? 0) > 50)
604
+ warnings.push(`前几大持有者占比过高: ${audit.topHoldersPercentage}%`);
605
+ if ((audit.devBalancePercentage ?? 0) > 20)
606
+ warnings.push(`开发者持仓过高: ${audit.devBalancePercentage}%`);
607
+ if ((info.organicScore ?? 0) < 30)
608
+ warnings.push(`有机分数过低: ${info.organicScore}`);
609
+ const isSafe = warnings.length === 0 &&
610
+ (info.isVerified ?? false) &&
611
+ (info.organicScoreLabel === 'high');
612
+ return {
613
+ isSafe,
614
+ isVerified: info.isVerified ?? false,
615
+ isSus: audit.isSus ?? false,
616
+ mintAuthorityDisabled: audit.mintAuthorityDisabled ?? false,
617
+ freezeAuthorityDisabled: audit.freezeAuthorityDisabled ?? false,
618
+ topHoldersPercentage: audit.topHoldersPercentage ?? null,
619
+ devBalancePercentage: audit.devBalancePercentage ?? null,
620
+ organicScore: info.organicScore ?? 0,
621
+ organicScoreLabel: info.organicScoreLabel ?? 'low',
622
+ warnings,
623
+ };
624
+ }
625
+ /**
626
+ * 获取代币统计摘要 (V2)
627
+ *
628
+ * @param mint 代币 Mint 地址
629
+ * @param config Jupiter 配置
630
+ * @returns 统计摘要
631
+ */
632
+ export async function getTokenStatsSummaryV2(mint, config) {
633
+ const info = await getTokenInfoV2(mint, config);
634
+ if (!info)
635
+ return null;
636
+ const buyVolume = info.stats24h?.buyVolume ?? 0;
637
+ const sellVolume = info.stats24h?.sellVolume ?? 0;
638
+ return {
639
+ symbol: info.symbol,
640
+ price: info.usdPrice ?? null,
641
+ priceChange: {
642
+ '5m': info.stats5m?.priceChange ?? null,
643
+ '1h': info.stats1h?.priceChange ?? null,
644
+ '6h': info.stats6h?.priceChange ?? null,
645
+ '24h': info.stats24h?.priceChange ?? null,
646
+ '7d': info.stats7d?.priceChange ?? null,
647
+ '30d': info.stats30d?.priceChange ?? null,
648
+ },
649
+ volume24h: buyVolume + sellVolume || null,
650
+ liquidity: info.liquidity ?? null,
651
+ mcap: info.mcap ?? null,
652
+ holderCount: info.holderCount ?? null,
653
+ numTraders24h: info.stats24h?.numTraders ?? null,
654
+ };
655
+ }
656
+ /**
657
+ * 搜索热门代币 (按有机分数)
658
+ *
659
+ * @param query 搜索查询
660
+ * @param config Jupiter 配置
661
+ * @returns 按有机分数排序的代币列表
662
+ */
663
+ export async function searchTrendingTokensV2(query, config) {
664
+ const tokens = await searchTokensV2(query, config);
665
+ return tokens.sort((a, b) => (b.organicScore ?? 0) - (a.organicScore ?? 0));
666
+ }
667
+ /**
668
+ * 筛选已验证代币
669
+ *
670
+ * @param tokens 代币列表
671
+ * @returns 已验证的代币
672
+ */
673
+ export function filterVerifiedTokens(tokens) {
674
+ return tokens.filter(t => t.isVerified === true);
675
+ }
676
+ /**
677
+ * 筛选高有机分数代币
678
+ *
679
+ * @param tokens 代币列表
680
+ * @returns 高有机分数代币
681
+ */
682
+ export function filterHighOrganicTokens(tokens) {
683
+ return tokens.filter(t => t.organicScoreLabel === 'high');
684
+ }
685
+ /**
686
+ * 计算代币买卖比
687
+ *
688
+ * @param stats 统计数据
689
+ * @returns 买卖比 (买入量/卖出量)
690
+ */
691
+ export function calculateBuySellRatio(stats) {
692
+ const buyVol = stats.buyVolume;
693
+ const sellVol = stats.sellVolume;
694
+ if (buyVol == null || sellVol == null || sellVol === 0)
695
+ return null;
696
+ return buyVol / sellVol;
697
+ }