four-flap-meme-sdk 1.4.88 → 1.4.89

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 (140) hide show
  1. package/dist/sol/constants.d.ts +126 -0
  2. package/dist/sol/constants.js +145 -0
  3. package/dist/sol/dex/blockrazor/client.d.ts +51 -0
  4. package/dist/sol/dex/blockrazor/client.js +96 -0
  5. package/dist/sol/dex/blockrazor/constants.d.ts +34 -0
  6. package/dist/sol/dex/blockrazor/constants.js +55 -0
  7. package/dist/sol/dex/blockrazor/geyser.d.ts +128 -0
  8. package/dist/sol/dex/blockrazor/geyser.js +530 -0
  9. package/dist/sol/dex/blockrazor/index.d.ts +18 -0
  10. package/dist/sol/dex/blockrazor/index.js +23 -0
  11. package/dist/sol/dex/blockrazor/send.d.ts +135 -0
  12. package/dist/sol/dex/blockrazor/send.js +254 -0
  13. package/dist/sol/dex/blockrazor/types.d.ts +191 -0
  14. package/dist/sol/dex/blockrazor/types.js +5 -0
  15. package/dist/sol/dex/index.d.ts +10 -0
  16. package/dist/sol/dex/index.js +16 -0
  17. package/dist/sol/dex/jup/client.d.ts +33 -0
  18. package/dist/sol/dex/jup/client.js +110 -0
  19. package/dist/sol/dex/jup/index.d.ts +16 -0
  20. package/dist/sol/dex/jup/index.js +148 -0
  21. package/dist/sol/dex/jup/legacy.d.ts +623 -0
  22. package/dist/sol/dex/jup/legacy.js +416 -0
  23. package/dist/sol/dex/jup/lend.d.ts +640 -0
  24. package/dist/sol/dex/jup/lend.js +603 -0
  25. package/dist/sol/dex/jup/portfolio.d.ts +362 -0
  26. package/dist/sol/dex/jup/portfolio.js +367 -0
  27. package/dist/sol/dex/jup/price.d.ts +173 -0
  28. package/dist/sol/dex/jup/price.js +220 -0
  29. package/dist/sol/dex/jup/recurring.d.ts +437 -0
  30. package/dist/sol/dex/jup/recurring.js +320 -0
  31. package/dist/sol/dex/jup/send.d.ts +282 -0
  32. package/dist/sol/dex/jup/send.js +295 -0
  33. package/dist/sol/dex/jup/studio.d.ts +457 -0
  34. package/dist/sol/dex/jup/studio.js +488 -0
  35. package/dist/sol/dex/jup/tokens.d.ts +767 -0
  36. package/dist/sol/dex/jup/tokens.js +697 -0
  37. package/dist/sol/dex/jup/trigger.d.ts +511 -0
  38. package/dist/sol/dex/jup/trigger.js +397 -0
  39. package/dist/sol/dex/jup/types.d.ts +433 -0
  40. package/dist/sol/dex/jup/types.js +5 -0
  41. package/dist/sol/dex/jup/ultra.d.ts +646 -0
  42. package/dist/sol/dex/jup/ultra.js +853 -0
  43. package/dist/sol/dex/meteora/client.d.ts +76 -0
  44. package/dist/sol/dex/meteora/client.js +219 -0
  45. package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +61 -0
  46. package/dist/sol/dex/meteora/damm-v1-bundle.js +112 -0
  47. package/dist/sol/dex/meteora/damm-v1.d.ts +118 -0
  48. package/dist/sol/dex/meteora/damm-v1.js +315 -0
  49. package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +82 -0
  50. package/dist/sol/dex/meteora/damm-v2-bundle.js +242 -0
  51. package/dist/sol/dex/meteora/damm-v2.d.ts +172 -0
  52. package/dist/sol/dex/meteora/damm-v2.js +632 -0
  53. package/dist/sol/dex/meteora/dbc-bundle.d.ts +123 -0
  54. package/dist/sol/dex/meteora/dbc-bundle.js +304 -0
  55. package/dist/sol/dex/meteora/dbc.d.ts +192 -0
  56. package/dist/sol/dex/meteora/dbc.js +619 -0
  57. package/dist/sol/dex/meteora/dlmm-bundle.d.ts +39 -0
  58. package/dist/sol/dex/meteora/dlmm-bundle.js +189 -0
  59. package/dist/sol/dex/meteora/dlmm.d.ts +157 -0
  60. package/dist/sol/dex/meteora/dlmm.js +671 -0
  61. package/dist/sol/dex/meteora/index.d.ts +25 -0
  62. package/dist/sol/dex/meteora/index.js +65 -0
  63. package/dist/sol/dex/meteora/types.d.ts +787 -0
  64. package/dist/sol/dex/meteora/types.js +110 -0
  65. package/dist/sol/dex/orca/index.d.ts +10 -0
  66. package/dist/sol/dex/orca/index.js +16 -0
  67. package/dist/sol/dex/orca/orca-bundle.d.ts +41 -0
  68. package/dist/sol/dex/orca/orca-bundle.js +173 -0
  69. package/dist/sol/dex/orca/orca.d.ts +65 -0
  70. package/dist/sol/dex/orca/orca.js +474 -0
  71. package/dist/sol/dex/orca/types.d.ts +263 -0
  72. package/dist/sol/dex/orca/types.js +38 -0
  73. package/dist/sol/dex/orca/wavebreak-bundle.d.ts +34 -0
  74. package/dist/sol/dex/orca/wavebreak-bundle.js +198 -0
  75. package/dist/sol/dex/orca/wavebreak-types.d.ts +227 -0
  76. package/dist/sol/dex/orca/wavebreak-types.js +23 -0
  77. package/dist/sol/dex/orca/wavebreak.d.ts +78 -0
  78. package/dist/sol/dex/orca/wavebreak.js +497 -0
  79. package/dist/sol/dex/pump/index.d.ts +9 -0
  80. package/dist/sol/dex/pump/index.js +14 -0
  81. package/dist/sol/dex/pump/pump-bundle.d.ts +92 -0
  82. package/dist/sol/dex/pump/pump-bundle.js +383 -0
  83. package/dist/sol/dex/pump/pump-swap-bundle.d.ts +103 -0
  84. package/dist/sol/dex/pump/pump-swap-bundle.js +380 -0
  85. package/dist/sol/dex/pump/pump-swap.d.ts +46 -0
  86. package/dist/sol/dex/pump/pump-swap.js +199 -0
  87. package/dist/sol/dex/pump/pump.d.ts +35 -0
  88. package/dist/sol/dex/pump/pump.js +352 -0
  89. package/dist/sol/dex/pump/types.d.ts +215 -0
  90. package/dist/sol/dex/pump/types.js +5 -0
  91. package/dist/sol/dex/raydium/index.d.ts +8 -0
  92. package/dist/sol/dex/raydium/index.js +12 -0
  93. package/dist/sol/dex/raydium/launchlab.d.ts +68 -0
  94. package/dist/sol/dex/raydium/launchlab.js +210 -0
  95. package/dist/sol/dex/raydium/raydium-bundle.d.ts +64 -0
  96. package/dist/sol/dex/raydium/raydium-bundle.js +324 -0
  97. package/dist/sol/dex/raydium/raydium.d.ts +40 -0
  98. package/dist/sol/dex/raydium/raydium.js +366 -0
  99. package/dist/sol/dex/raydium/types.d.ts +240 -0
  100. package/dist/sol/dex/raydium/types.js +5 -0
  101. package/dist/sol/index.d.ts +10 -0
  102. package/dist/sol/index.js +16 -0
  103. package/dist/sol/jito/bundle.d.ts +90 -0
  104. package/dist/sol/jito/bundle.js +263 -0
  105. package/dist/sol/jito/index.d.ts +7 -0
  106. package/dist/sol/jito/index.js +7 -0
  107. package/dist/sol/jito/tip.d.ts +51 -0
  108. package/dist/sol/jito/tip.js +83 -0
  109. package/dist/sol/jito/types.d.ts +100 -0
  110. package/dist/sol/jito/types.js +5 -0
  111. package/dist/sol/token/create-complete.d.ts +115 -0
  112. package/dist/sol/token/create-complete.js +235 -0
  113. package/dist/sol/token/create-token.d.ts +57 -0
  114. package/dist/sol/token/create-token.js +230 -0
  115. package/dist/sol/token/index.d.ts +9 -0
  116. package/dist/sol/token/index.js +14 -0
  117. package/dist/sol/token/metadata-upload.d.ts +86 -0
  118. package/dist/sol/token/metadata-upload.js +173 -0
  119. package/dist/sol/token/metadata.d.ts +92 -0
  120. package/dist/sol/token/metadata.js +274 -0
  121. package/dist/sol/token/types.d.ts +153 -0
  122. package/dist/sol/token/types.js +5 -0
  123. package/dist/sol/types.d.ts +176 -0
  124. package/dist/sol/types.js +7 -0
  125. package/dist/sol/utils/balance.d.ts +160 -0
  126. package/dist/sol/utils/balance.js +638 -0
  127. package/dist/sol/utils/connection.d.ts +78 -0
  128. package/dist/sol/utils/connection.js +168 -0
  129. package/dist/sol/utils/index.d.ts +9 -0
  130. package/dist/sol/utils/index.js +9 -0
  131. package/dist/sol/utils/lp-inspect.d.ts +129 -0
  132. package/dist/sol/utils/lp-inspect.js +900 -0
  133. package/dist/sol/utils/transfer.d.ts +125 -0
  134. package/dist/sol/utils/transfer.js +220 -0
  135. package/dist/sol/utils/wallet.d.ts +107 -0
  136. package/dist/sol/utils/wallet.js +210 -0
  137. package/package.json +38 -3
  138. package/README.zh-CN.pdf +0 -0
  139. package/dist/flap/portal-bundle-merkle/encryption.d.ts +0 -16
  140. package/dist/flap/portal-bundle-merkle/encryption.js +0 -146
@@ -0,0 +1,623 @@
1
+ /**
2
+ * Jupiter Legacy Swap API
3
+ * @module sol/dex/jup/legacy
4
+ *
5
+ * Legacy Swap API 提供更多自定义选项的交易路由
6
+ * 文档: https://docs.jup.ag/docs/apis/swap-api
7
+ */
8
+ import type { JupiterConfig } from './types.js';
9
+ /** Swap 模式 */
10
+ export type LegacySwapMode = 'ExactIn' | 'ExactOut';
11
+ /** 指令版本 */
12
+ export type LegacyInstructionVersion = 'V1' | 'V2';
13
+ /** 路由交换信息 */
14
+ export interface LegacySwapInfo {
15
+ /** AMM Key */
16
+ ammKey: string;
17
+ /** AMM 标签 (如 'Raydium CLMM', 'Orca') */
18
+ label?: string;
19
+ /** 输入代币 Mint */
20
+ inputMint: string;
21
+ /** 输出代币 Mint */
22
+ outputMint: string;
23
+ /** 输入数量 */
24
+ inAmount: string;
25
+ /** 输出数量 */
26
+ outAmount: string;
27
+ /** 手续费数量 (已弃用) */
28
+ feeAmount?: string;
29
+ /** 手续费代币 (已弃用) */
30
+ feeMint?: string;
31
+ }
32
+ /** 路由计划 */
33
+ export interface LegacyRoutePlan {
34
+ /** 交换信息 */
35
+ swapInfo: LegacySwapInfo;
36
+ /** 百分比 */
37
+ percent: number | null;
38
+ /** BPS */
39
+ bps?: number | null;
40
+ }
41
+ /** 平台手续费 */
42
+ export interface LegacyPlatformFee {
43
+ /** 手续费数量 */
44
+ amount: string;
45
+ /** 手续费 BPS */
46
+ feeBps: number;
47
+ }
48
+ /** Quote 请求参数 */
49
+ export interface LegacyQuoteParams {
50
+ /** 输入代币 Mint */
51
+ inputMint: string;
52
+ /** 输出代币 Mint */
53
+ outputMint: string;
54
+ /**
55
+ * 原始数量 (最小单位)
56
+ * - ExactIn: 输入数量
57
+ * - ExactOut: 输出数量
58
+ */
59
+ amount: string | number;
60
+ /** 滑点 BPS (默认: 50) */
61
+ slippageBps?: number;
62
+ /**
63
+ * Swap 模式 (默认: ExactIn)
64
+ * - ExactIn: 精确输入
65
+ * - ExactOut: 精确输出 (仅部分 AMM 支持)
66
+ */
67
+ swapMode?: LegacySwapMode;
68
+ /**
69
+ * 指定使用的 DEX 列表
70
+ * 例如: ['Raydium', 'Orca V2', 'Meteora DLMM']
71
+ */
72
+ dexes?: string[];
73
+ /**
74
+ * 排除的 DEX 列表
75
+ * 例如: ['Raydium', 'Orca V2']
76
+ */
77
+ excludeDexes?: string[];
78
+ /** 限制中间代币为稳定币 (默认: true) */
79
+ restrictIntermediateTokens?: boolean;
80
+ /** 仅使用直接路由/单跳 (默认: false) */
81
+ onlyDirectRoutes?: boolean;
82
+ /** 使用 Legacy 交易格式 (默认: false) */
83
+ asLegacyTransaction?: boolean;
84
+ /** 平台手续费 BPS */
85
+ platformFeeBps?: number;
86
+ /** 最大账户数量 (默认: 64) */
87
+ maxAccounts?: number;
88
+ /** 指令版本 (默认: V1) */
89
+ instructionVersion?: LegacyInstructionVersion;
90
+ /** 动态滑点 (默认: false) */
91
+ dynamicSlippage?: boolean;
92
+ }
93
+ /** Quote 响应 */
94
+ export interface LegacyQuoteResponse {
95
+ /** 输入代币 Mint */
96
+ inputMint: string;
97
+ /** 输入数量 */
98
+ inAmount: string;
99
+ /** 输出代币 Mint */
100
+ outputMint: string;
101
+ /**
102
+ * 输出数量
103
+ * 包含平台费和 DEX 费用,不包含滑点
104
+ */
105
+ outAmount: string;
106
+ /**
107
+ * 最小输出阈值
108
+ * 考虑滑点后的最小输出
109
+ */
110
+ otherAmountThreshold: string;
111
+ /** Swap 模式 */
112
+ swapMode: LegacySwapMode;
113
+ /** 滑点 BPS */
114
+ slippageBps: number;
115
+ /** 价格影响百分比 */
116
+ priceImpactPct: string;
117
+ /** 路由计划 */
118
+ routePlan: LegacyRoutePlan[];
119
+ /** 平台手续费 */
120
+ platformFee: LegacyPlatformFee | null;
121
+ /** Context Slot */
122
+ contextSlot?: number;
123
+ /** 耗时 (秒) */
124
+ timeTaken?: number;
125
+ /** Swap USD 价值 */
126
+ swapUsdValue?: string;
127
+ /** 是否使用了简化路由 */
128
+ simplerRouteUsed?: boolean;
129
+ /** 指令版本 */
130
+ instructionVersion?: LegacyInstructionVersion;
131
+ }
132
+ /** 优先级等级 */
133
+ export type PriorityLevel = 'medium' | 'high' | 'veryHigh';
134
+ /** 优先费配置 - priorityLevelWithMaxLamports */
135
+ export interface PriorityLevelWithMaxLamports {
136
+ priorityLevelWithMaxLamports: {
137
+ /** 优先级等级 */
138
+ priorityLevel: PriorityLevel;
139
+ /** 最大 lamports 上限 */
140
+ maxLamports: number;
141
+ /** 是否使用全局费率市场 (默认: false) */
142
+ global?: boolean;
143
+ };
144
+ }
145
+ /** 优先费配置 - jitoTipLamports */
146
+ export interface JitoTipLamports {
147
+ jitoTipLamports: number;
148
+ }
149
+ /** 优先费配置 - jitoTipLamportsWithPayer */
150
+ export interface JitoTipLamportsWithPayer {
151
+ jitoTipLamportsWithPayer: {
152
+ /** Jito tip 数量 */
153
+ lamports: number;
154
+ /** 支付者公钥 */
155
+ payer: string;
156
+ };
157
+ }
158
+ /** 优先费配置类型 */
159
+ export type PrioritizationFeeLamports = number | 'auto' | PriorityLevelWithMaxLamports | JitoTipLamports | JitoTipLamportsWithPayer;
160
+ /** Swap 请求参数 */
161
+ export interface LegacySwapParams {
162
+ /** 用户公钥 */
163
+ userPublicKey: string;
164
+ /** Quote 响应 */
165
+ quoteResponse: LegacyQuoteResponse;
166
+ /**
167
+ * 自定义支付者公钥
168
+ * 支付交易费用和代币账户租金
169
+ */
170
+ payer?: string;
171
+ /**
172
+ * 是否自动包装/解包 SOL (默认: true)
173
+ * - true + 输入为 SOL: 将 SOL 包装为 WSOL
174
+ * - true + 输出为 SOL: 将 WSOL 解包为 SOL
175
+ * - false: 需要已存在的 WSOL 账户
176
+ */
177
+ wrapAndUnwrapSol?: boolean;
178
+ /**
179
+ * 使用共享程序账户 (由路由引擎动态决定)
180
+ * 对于复杂路由需要多个中间代币账户
181
+ */
182
+ useSharedAccounts?: boolean;
183
+ /**
184
+ * 手续费账户 (需要已初始化)
185
+ * 代币账户的 mint 必须是输入或输出代币
186
+ * 如果 /quote 传入了 platformFeeBps,则必须传入此参数
187
+ */
188
+ feeAccount?: string;
189
+ /**
190
+ * 跟踪账户公钥
191
+ * 用于追踪交易,可通过 Solscan/Dune 等查询
192
+ */
193
+ trackingAccount?: string;
194
+ /**
195
+ * 优先费配置
196
+ * - 数字: 固定 lamports
197
+ * - 'auto': 自动估算
198
+ * - priorityLevelWithMaxLamports: 按等级估算并设置上限
199
+ * - jitoTipLamports: Jito tip (需要连接 Jito RPC)
200
+ * - jitoTipLamportsWithPayer: Jito tip 并指定支付者
201
+ */
202
+ prioritizationFeeLamports?: PrioritizationFeeLamports;
203
+ /** 使用 Legacy 交易格式 (默认: false) */
204
+ asLegacyTransaction?: boolean;
205
+ /**
206
+ * 目标代币账户
207
+ * 接收输出代币的账户,需要已初始化
208
+ * 与 nativeDestinationAccount 互斥
209
+ */
210
+ destinationTokenAccount?: string;
211
+ /**
212
+ * 原生 SOL 目标账户
213
+ * 仅当输出为 SOL 时有效
214
+ * 与 destinationTokenAccount 互斥
215
+ */
216
+ nativeDestinationAccount?: string;
217
+ /**
218
+ * 动态计算 CU 限制 (默认: false)
219
+ * 启用后会模拟交易获取实际 CU,但会多一次 RPC 调用
220
+ * 推荐启用以准确估算 CU 和降低优先费
221
+ */
222
+ dynamicComputeUnitLimit?: boolean;
223
+ /**
224
+ * 跳过用户账户 RPC 调用 (默认: false)
225
+ * 启用后不检查必需账户是否存在
226
+ */
227
+ skipUserAccountsRpcCalls?: boolean;
228
+ /**
229
+ * 动态滑点 (默认: false)
230
+ * 已不再维护,推荐使用 Ultra API 的 RTSE
231
+ */
232
+ dynamicSlippage?: boolean;
233
+ /**
234
+ * 精确的 CU 价格 (微 lamports)
235
+ * computeUnitLimit (1400000) * computeUnitPriceMicroLamports
236
+ * 推荐使用 prioritizationFeeLamports + dynamicComputeUnitLimit
237
+ */
238
+ computeUnitPriceMicroLamports?: number;
239
+ /**
240
+ * 交易有效期 slots 数量
241
+ * 例如: 10 slots ≈ 4 秒
242
+ */
243
+ blockhashSlotsToExpiry?: number;
244
+ }
245
+ /** Swap 响应 */
246
+ export interface LegacySwapResponse {
247
+ /** Base64 编码的未签名交易 */
248
+ swapTransaction: string;
249
+ /** 区块高度有效期限 */
250
+ lastValidBlockHeight: number;
251
+ /** 优先费 lamports */
252
+ prioritizationFeeLamports?: number;
253
+ }
254
+ /** 账户信息 */
255
+ export interface InstructionAccount {
256
+ /** 账户公钥 */
257
+ pubkey: string;
258
+ /** 是否是签名者 */
259
+ isSigner: boolean;
260
+ /** 是否可写 */
261
+ isWritable: boolean;
262
+ }
263
+ /** 指令 */
264
+ export interface Instruction {
265
+ /** Program ID */
266
+ programId: string;
267
+ /** 账户列表 */
268
+ accounts: InstructionAccount[];
269
+ /** 指令数据 (Base64) */
270
+ data: string;
271
+ }
272
+ /** Swap Instructions 响应 */
273
+ export interface LegacySwapInstructionsResponse {
274
+ /**
275
+ * 其他指令
276
+ * 如果设置了 Jito tip,会包含 Jito tip 指令
277
+ */
278
+ otherInstructions: Instruction[];
279
+ /**
280
+ * Compute Budget 指令
281
+ * 用于设置交易的计算预算
282
+ */
283
+ computeBudgetInstructions: Instruction[];
284
+ /**
285
+ * Setup 指令
286
+ * 用于创建用户所需的代币账户
287
+ */
288
+ setupInstructions: Instruction[];
289
+ /**
290
+ * Swap 指令
291
+ * 实际的交换指令
292
+ */
293
+ swapInstruction: Instruction;
294
+ /**
295
+ * Address Lookup Table 地址
296
+ * 版本化交易使用
297
+ */
298
+ addressLookupTableAddresses: string[];
299
+ /**
300
+ * Cleanup 指令
301
+ * 用于包装/解包 SOL
302
+ */
303
+ cleanupInstruction?: Instruction;
304
+ }
305
+ /**
306
+ * 获取 Legacy Swap 报价
307
+ *
308
+ * Legacy API 提供更多自定义选项,适合需要精细控制路由的场景。
309
+ *
310
+ * @param params 报价参数
311
+ * @param config Jupiter 配置
312
+ * @returns Quote 响应
313
+ *
314
+ * @example
315
+ * ```typescript
316
+ * import { Sol } from 'four-flap-meme-sdk'
317
+ *
318
+ * Sol.setJupiterConfig({ apiKey: 'your-api-key' })
319
+ *
320
+ * // 基础报价
321
+ * const quote = await Sol.getLegacyQuote({
322
+ * inputMint: 'So11111111111111111111111111111111111111112',
323
+ * outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
324
+ * amount: '100000000', // 0.1 SOL
325
+ * })
326
+ *
327
+ * console.log('输出数量:', quote.outAmount)
328
+ * console.log('最小输出:', quote.otherAmountThreshold)
329
+ * console.log('价格影响:', quote.priceImpactPct)
330
+ * console.log('路由:', quote.routePlan.map(r => r.swapInfo.label).join(' -> '))
331
+ *
332
+ * // 高级选项
333
+ * const advancedQuote = await Sol.getLegacyQuote({
334
+ * inputMint: 'So11111111111111111111111111111111111111112',
335
+ * outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
336
+ * amount: '100000000',
337
+ * slippageBps: 100, // 1% 滑点
338
+ * dexes: ['Raydium', 'Orca V2'], // 只用这些 DEX
339
+ * onlyDirectRoutes: true, // 单跳
340
+ * })
341
+ * ```
342
+ */
343
+ export declare function getLegacyQuote(params: LegacyQuoteParams, config?: JupiterConfig): Promise<LegacyQuoteResponse>;
344
+ /**
345
+ * 简化的 Legacy 报价获取
346
+ *
347
+ * @param inputMint 输入代币 Mint
348
+ * @param outputMint 输出代币 Mint
349
+ * @param amount 数量
350
+ * @param slippageBps 滑点 BPS (默认: 50)
351
+ * @param config Jupiter 配置
352
+ * @returns Quote 响应
353
+ */
354
+ export declare function getLegacyQuoteSimple(inputMint: string, outputMint: string, amount: string | number, slippageBps?: number, config?: JupiterConfig): Promise<LegacyQuoteResponse>;
355
+ /**
356
+ * 构建 Legacy Swap 交易
357
+ *
358
+ * @param params Swap 参数
359
+ * @param config Jupiter 配置
360
+ * @returns Swap 响应(包含未签名交易)
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * // 1. 获取报价
365
+ * const quote = await Sol.getLegacyQuote({
366
+ * inputMint: 'So11111111111111111111111111111111111111112',
367
+ * outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
368
+ * amount: '100000000',
369
+ * })
370
+ *
371
+ * // 2. 构建交易
372
+ * const swap = await Sol.buildLegacySwap({
373
+ * quoteResponse: quote,
374
+ * userPublicKey: wallet.publicKey.toBase58(),
375
+ * })
376
+ *
377
+ * // 3. 签名并发送
378
+ * const tx = VersionedTransaction.deserialize(
379
+ * Buffer.from(swap.swapTransaction, 'base64')
380
+ * )
381
+ * tx.sign([wallet])
382
+ * const signature = await connection.sendTransaction(tx)
383
+ * ```
384
+ */
385
+ export declare function buildLegacySwap(params: LegacySwapParams, config?: JupiterConfig): Promise<LegacySwapResponse>;
386
+ /**
387
+ * 获取 Swap 分解指令
388
+ *
389
+ * 返回分解的指令而非完整交易,允许自定义组装交易。
390
+ * 适用于需要同时添加优先费和 Jito tip 等高级场景。
391
+ *
392
+ * @param params Swap 参数 (与 buildLegacySwap 相同)
393
+ * @param config Jupiter 配置
394
+ * @returns 分解的指令
395
+ *
396
+ * @example
397
+ * ```typescript
398
+ * import {
399
+ * TransactionMessage,
400
+ * VersionedTransaction,
401
+ * AddressLookupTableAccount
402
+ * } from '@solana/web3.js'
403
+ *
404
+ * // 1. 获取报价
405
+ * const quote = await Sol.getLegacyQuote({
406
+ * inputMint: 'So11111111111111111111111111111111111111112',
407
+ * outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
408
+ * amount: '100000000',
409
+ * })
410
+ *
411
+ * // 2. 获取分解指令
412
+ * const instructions = await Sol.getLegacySwapInstructions({
413
+ * userPublicKey: wallet.publicKey.toBase58(),
414
+ * quoteResponse: quote,
415
+ * prioritizationFeeLamports: {
416
+ * jitoTipLamports: 10000, // 添加 Jito tip
417
+ * }
418
+ * })
419
+ *
420
+ * // 3. 获取 Address Lookup Tables
421
+ * const lookupTables = await Promise.all(
422
+ * instructions.addressLookupTableAddresses.map(addr =>
423
+ * connection.getAddressLookupTable(new PublicKey(addr))
424
+ * )
425
+ * )
426
+ *
427
+ * // 4. 反序列化指令
428
+ * const allInstructions = [
429
+ * ...instructions.computeBudgetInstructions,
430
+ * ...instructions.setupInstructions,
431
+ * instructions.swapInstruction,
432
+ * ...(instructions.cleanupInstruction ? [instructions.cleanupInstruction] : []),
433
+ * ...instructions.otherInstructions, // Jito tip 指令在这里
434
+ * ].map(ix => deserializeInstruction(ix))
435
+ *
436
+ * // 5. 构建版本化交易
437
+ * const messageV0 = new TransactionMessage({
438
+ * payerKey: wallet.publicKey,
439
+ * recentBlockhash: blockhash,
440
+ * instructions: allInstructions,
441
+ * }).compileToV0Message(lookupTables)
442
+ *
443
+ * const tx = new VersionedTransaction(messageV0)
444
+ * tx.sign([wallet])
445
+ * ```
446
+ */
447
+ export declare function getLegacySwapInstructions(params: LegacySwapParams, config?: JupiterConfig): Promise<LegacySwapInstructionsResponse>;
448
+ /**
449
+ * 反序列化指令的辅助函数
450
+ *
451
+ * 将 API 返回的指令格式转换为 @solana/web3.js 可用格式
452
+ *
453
+ * @example
454
+ * ```typescript
455
+ * import { PublicKey, TransactionInstruction } from '@solana/web3.js'
456
+ *
457
+ * function deserializeInstruction(instruction: Instruction): TransactionInstruction {
458
+ * return new TransactionInstruction({
459
+ * programId: new PublicKey(instruction.programId),
460
+ * keys: instruction.accounts.map(acc => ({
461
+ * pubkey: new PublicKey(acc.pubkey),
462
+ * isSigner: acc.isSigner,
463
+ * isWritable: acc.isWritable,
464
+ * })),
465
+ * data: Buffer.from(instruction.data, 'base64'),
466
+ * })
467
+ * }
468
+ * ```
469
+ */
470
+ /** Program ID 到标签的映射 */
471
+ export type ProgramIdToLabelMap = Record<string, string>;
472
+ /**
473
+ * 获取所有支持的 DEX 及其 Program ID
474
+ *
475
+ * 返回 Program ID 到 DEX 标签的映射。
476
+ * 可用于 /quote 的 dexes 和 excludeDexes 参数。
477
+ *
478
+ * @param config Jupiter 配置
479
+ * @returns Program ID 到标签的映射
480
+ *
481
+ * @example
482
+ * ```typescript
483
+ * const dexMap = await Sol.getProgramIdToLabel()
484
+ *
485
+ * // 查看所有 DEX
486
+ * Object.entries(dexMap).forEach(([programId, label]) => {
487
+ * console.log(`${label}: ${programId}`)
488
+ * })
489
+ *
490
+ * // 常见 DEX:
491
+ * // Raydium: 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8
492
+ * // Raydium CLMM: CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK
493
+ * // Orca V2: 9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP
494
+ * // Whirlpool: whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc
495
+ * // Meteora: Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB
496
+ * // Meteora DLMM: LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo
497
+ * // Pump.fun: 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
498
+ * ```
499
+ */
500
+ export declare function getProgramIdToLabel(config?: JupiterConfig): Promise<ProgramIdToLabelMap>;
501
+ /**
502
+ * 获取所有支持的 DEX 标签列表
503
+ *
504
+ * @param config Jupiter 配置
505
+ * @returns DEX 标签数组
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * const labels = await Sol.getAllDexLabels()
510
+ * // ['Raydium', 'Raydium CLMM', 'Orca V2', 'Whirlpool', ...]
511
+ * ```
512
+ */
513
+ export declare function getAllDexLabels(config?: JupiterConfig): Promise<string[]>;
514
+ /**
515
+ * 通过标签获取 Program ID
516
+ *
517
+ * @param label DEX 标签
518
+ * @param config Jupiter 配置
519
+ * @returns Program ID 或 null
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * const raydiumId = await Sol.getProgramIdByLabel('Raydium')
524
+ * // '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'
525
+ * ```
526
+ */
527
+ export declare function getProgramIdByLabel(label: string, config?: JupiterConfig): Promise<string | null>;
528
+ /**
529
+ * 通过 Program ID 获取 DEX 标签
530
+ *
531
+ * @param programId Program ID
532
+ * @param config Jupiter 配置
533
+ * @returns DEX 标签或 null
534
+ *
535
+ * @example
536
+ * ```typescript
537
+ * const label = await Sol.getLabelByProgramId(
538
+ * '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'
539
+ * )
540
+ * // 'Raydium'
541
+ * ```
542
+ */
543
+ export declare function getLabelByProgramId(programId: string, config?: JupiterConfig): Promise<string | null>;
544
+ /**
545
+ * 搜索 DEX
546
+ *
547
+ * @param keyword 搜索关键词(不区分大小写)
548
+ * @param config Jupiter 配置
549
+ * @returns 匹配的 { programId, label } 数组
550
+ *
551
+ * @example
552
+ * ```typescript
553
+ * const results = await Sol.searchDex('raydium')
554
+ * // [
555
+ * // { programId: '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8', label: 'Raydium' },
556
+ * // { programId: 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK', label: 'Raydium CLMM' },
557
+ * // { programId: 'CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C', label: 'Raydium CP' },
558
+ * // ]
559
+ * ```
560
+ */
561
+ export declare function searchDex(keyword: string, config?: JupiterConfig): Promise<{
562
+ programId: string;
563
+ label: string;
564
+ }[]>;
565
+ /**
566
+ * 获取路由标签
567
+ *
568
+ * @param quote Quote 响应
569
+ * @returns 路由标签数组
570
+ */
571
+ export declare function getRouteLabels(quote: LegacyQuoteResponse): string[];
572
+ /**
573
+ * 计算路由跳数
574
+ *
575
+ * @param quote Quote 响应
576
+ * @returns 跳数
577
+ */
578
+ export declare function getRouteHops(quote: LegacyQuoteResponse): number;
579
+ /**
580
+ * 获取报价摘要
581
+ *
582
+ * @param quote Quote 响应
583
+ * @returns 报价摘要
584
+ */
585
+ export declare function getQuoteSummary(quote: LegacyQuoteResponse): {
586
+ inputMint: string;
587
+ outputMint: string;
588
+ inAmount: string;
589
+ outAmount: string;
590
+ minOutAmount: string;
591
+ priceImpact: number;
592
+ slippageBps: number;
593
+ route: string;
594
+ hops: number;
595
+ usdValue: number | null;
596
+ };
597
+ /**
598
+ * 比较多个报价
599
+ *
600
+ * @param quotes Quote 响应数组
601
+ * @returns 排序后的报价(输出最多的在前)
602
+ */
603
+ export declare function compareQuotes(quotes: LegacyQuoteResponse[]): LegacyQuoteResponse[];
604
+ /**
605
+ * 获取最佳报价
606
+ *
607
+ * 比较不同 DEX 组合的报价,返回输出最多的
608
+ *
609
+ * @param inputMint 输入代币 Mint
610
+ * @param outputMint 输出代币 Mint
611
+ * @param amount 数量
612
+ * @param options 选项
613
+ * @param config Jupiter 配置
614
+ * @returns 最佳报价
615
+ */
616
+ export declare function getBestLegacyQuote(inputMint: string, outputMint: string, amount: string | number, options?: {
617
+ slippageBps?: number;
618
+ compareDirectRoute?: boolean;
619
+ }, config?: JupiterConfig): Promise<{
620
+ best: LegacyQuoteResponse;
621
+ direct: LegacyQuoteResponse | null;
622
+ directSavings: string | null;
623
+ }>;