four-flap-meme-sdk 1.4.92 → 1.4.94

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 (144) 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/index.d.ts +0 -1
  5. package/dist/index.js +1 -1
  6. package/dist/utils/constants.d.ts +1 -1
  7. package/dist/utils/constants.js +1 -1
  8. package/package.json +3 -38
  9. package/dist/sol/constants.d.ts +0 -126
  10. package/dist/sol/constants.js +0 -145
  11. package/dist/sol/dex/blockrazor/client.d.ts +0 -51
  12. package/dist/sol/dex/blockrazor/client.js +0 -96
  13. package/dist/sol/dex/blockrazor/constants.d.ts +0 -34
  14. package/dist/sol/dex/blockrazor/constants.js +0 -55
  15. package/dist/sol/dex/blockrazor/geyser.d.ts +0 -128
  16. package/dist/sol/dex/blockrazor/geyser.js +0 -530
  17. package/dist/sol/dex/blockrazor/index.d.ts +0 -18
  18. package/dist/sol/dex/blockrazor/index.js +0 -23
  19. package/dist/sol/dex/blockrazor/send.d.ts +0 -135
  20. package/dist/sol/dex/blockrazor/send.js +0 -254
  21. package/dist/sol/dex/blockrazor/types.d.ts +0 -191
  22. package/dist/sol/dex/blockrazor/types.js +0 -5
  23. package/dist/sol/dex/index.d.ts +0 -10
  24. package/dist/sol/dex/index.js +0 -16
  25. package/dist/sol/dex/jup/client.d.ts +0 -33
  26. package/dist/sol/dex/jup/client.js +0 -110
  27. package/dist/sol/dex/jup/index.d.ts +0 -16
  28. package/dist/sol/dex/jup/index.js +0 -148
  29. package/dist/sol/dex/jup/legacy.d.ts +0 -623
  30. package/dist/sol/dex/jup/legacy.js +0 -416
  31. package/dist/sol/dex/jup/lend.d.ts +0 -640
  32. package/dist/sol/dex/jup/lend.js +0 -603
  33. package/dist/sol/dex/jup/portfolio.d.ts +0 -362
  34. package/dist/sol/dex/jup/portfolio.js +0 -367
  35. package/dist/sol/dex/jup/price.d.ts +0 -173
  36. package/dist/sol/dex/jup/price.js +0 -220
  37. package/dist/sol/dex/jup/recurring.d.ts +0 -437
  38. package/dist/sol/dex/jup/recurring.js +0 -320
  39. package/dist/sol/dex/jup/send.d.ts +0 -282
  40. package/dist/sol/dex/jup/send.js +0 -295
  41. package/dist/sol/dex/jup/studio.d.ts +0 -457
  42. package/dist/sol/dex/jup/studio.js +0 -488
  43. package/dist/sol/dex/jup/tokens.d.ts +0 -767
  44. package/dist/sol/dex/jup/tokens.js +0 -697
  45. package/dist/sol/dex/jup/trigger.d.ts +0 -511
  46. package/dist/sol/dex/jup/trigger.js +0 -397
  47. package/dist/sol/dex/jup/types.d.ts +0 -433
  48. package/dist/sol/dex/jup/types.js +0 -5
  49. package/dist/sol/dex/jup/ultra.d.ts +0 -646
  50. package/dist/sol/dex/jup/ultra.js +0 -853
  51. package/dist/sol/dex/meteora/client.d.ts +0 -76
  52. package/dist/sol/dex/meteora/client.js +0 -219
  53. package/dist/sol/dex/meteora/damm-v1-bundle.d.ts +0 -61
  54. package/dist/sol/dex/meteora/damm-v1-bundle.js +0 -112
  55. package/dist/sol/dex/meteora/damm-v1.d.ts +0 -118
  56. package/dist/sol/dex/meteora/damm-v1.js +0 -315
  57. package/dist/sol/dex/meteora/damm-v2-bundle.d.ts +0 -82
  58. package/dist/sol/dex/meteora/damm-v2-bundle.js +0 -242
  59. package/dist/sol/dex/meteora/damm-v2.d.ts +0 -172
  60. package/dist/sol/dex/meteora/damm-v2.js +0 -632
  61. package/dist/sol/dex/meteora/dbc-bundle.d.ts +0 -123
  62. package/dist/sol/dex/meteora/dbc-bundle.js +0 -304
  63. package/dist/sol/dex/meteora/dbc.d.ts +0 -192
  64. package/dist/sol/dex/meteora/dbc.js +0 -619
  65. package/dist/sol/dex/meteora/dlmm-bundle.d.ts +0 -39
  66. package/dist/sol/dex/meteora/dlmm-bundle.js +0 -189
  67. package/dist/sol/dex/meteora/dlmm.d.ts +0 -157
  68. package/dist/sol/dex/meteora/dlmm.js +0 -671
  69. package/dist/sol/dex/meteora/index.d.ts +0 -25
  70. package/dist/sol/dex/meteora/index.js +0 -65
  71. package/dist/sol/dex/meteora/types.d.ts +0 -787
  72. package/dist/sol/dex/meteora/types.js +0 -110
  73. package/dist/sol/dex/orca/index.d.ts +0 -10
  74. package/dist/sol/dex/orca/index.js +0 -16
  75. package/dist/sol/dex/orca/orca-bundle.d.ts +0 -41
  76. package/dist/sol/dex/orca/orca-bundle.js +0 -173
  77. package/dist/sol/dex/orca/orca.d.ts +0 -65
  78. package/dist/sol/dex/orca/orca.js +0 -474
  79. package/dist/sol/dex/orca/types.d.ts +0 -263
  80. package/dist/sol/dex/orca/types.js +0 -38
  81. package/dist/sol/dex/orca/wavebreak-bundle.d.ts +0 -34
  82. package/dist/sol/dex/orca/wavebreak-bundle.js +0 -198
  83. package/dist/sol/dex/orca/wavebreak-types.d.ts +0 -227
  84. package/dist/sol/dex/orca/wavebreak-types.js +0 -23
  85. package/dist/sol/dex/orca/wavebreak.d.ts +0 -78
  86. package/dist/sol/dex/orca/wavebreak.js +0 -497
  87. package/dist/sol/dex/pump/index.d.ts +0 -9
  88. package/dist/sol/dex/pump/index.js +0 -14
  89. package/dist/sol/dex/pump/pump-bundle.d.ts +0 -92
  90. package/dist/sol/dex/pump/pump-bundle.js +0 -383
  91. package/dist/sol/dex/pump/pump-swap-bundle.d.ts +0 -103
  92. package/dist/sol/dex/pump/pump-swap-bundle.js +0 -380
  93. package/dist/sol/dex/pump/pump-swap.d.ts +0 -46
  94. package/dist/sol/dex/pump/pump-swap.js +0 -199
  95. package/dist/sol/dex/pump/pump.d.ts +0 -35
  96. package/dist/sol/dex/pump/pump.js +0 -352
  97. package/dist/sol/dex/pump/types.d.ts +0 -215
  98. package/dist/sol/dex/pump/types.js +0 -5
  99. package/dist/sol/dex/raydium/index.d.ts +0 -8
  100. package/dist/sol/dex/raydium/index.js +0 -12
  101. package/dist/sol/dex/raydium/launchlab.d.ts +0 -68
  102. package/dist/sol/dex/raydium/launchlab.js +0 -210
  103. package/dist/sol/dex/raydium/raydium-bundle.d.ts +0 -64
  104. package/dist/sol/dex/raydium/raydium-bundle.js +0 -324
  105. package/dist/sol/dex/raydium/raydium.d.ts +0 -40
  106. package/dist/sol/dex/raydium/raydium.js +0 -366
  107. package/dist/sol/dex/raydium/types.d.ts +0 -240
  108. package/dist/sol/dex/raydium/types.js +0 -5
  109. package/dist/sol/index.d.ts +0 -10
  110. package/dist/sol/index.js +0 -16
  111. package/dist/sol/jito/bundle.d.ts +0 -90
  112. package/dist/sol/jito/bundle.js +0 -263
  113. package/dist/sol/jito/index.d.ts +0 -7
  114. package/dist/sol/jito/index.js +0 -7
  115. package/dist/sol/jito/tip.d.ts +0 -51
  116. package/dist/sol/jito/tip.js +0 -83
  117. package/dist/sol/jito/types.d.ts +0 -100
  118. package/dist/sol/jito/types.js +0 -5
  119. package/dist/sol/token/create-complete.d.ts +0 -115
  120. package/dist/sol/token/create-complete.js +0 -235
  121. package/dist/sol/token/create-token.d.ts +0 -57
  122. package/dist/sol/token/create-token.js +0 -230
  123. package/dist/sol/token/index.d.ts +0 -9
  124. package/dist/sol/token/index.js +0 -14
  125. package/dist/sol/token/metadata-upload.d.ts +0 -86
  126. package/dist/sol/token/metadata-upload.js +0 -173
  127. package/dist/sol/token/metadata.d.ts +0 -92
  128. package/dist/sol/token/metadata.js +0 -274
  129. package/dist/sol/token/types.d.ts +0 -153
  130. package/dist/sol/token/types.js +0 -5
  131. package/dist/sol/types.d.ts +0 -176
  132. package/dist/sol/types.js +0 -7
  133. package/dist/sol/utils/balance.d.ts +0 -160
  134. package/dist/sol/utils/balance.js +0 -638
  135. package/dist/sol/utils/connection.d.ts +0 -78
  136. package/dist/sol/utils/connection.js +0 -168
  137. package/dist/sol/utils/index.d.ts +0 -9
  138. package/dist/sol/utils/index.js +0 -9
  139. package/dist/sol/utils/lp-inspect.d.ts +0 -129
  140. package/dist/sol/utils/lp-inspect.js +0 -900
  141. package/dist/sol/utils/transfer.d.ts +0 -196
  142. package/dist/sol/utils/transfer.js +0 -307
  143. package/dist/sol/utils/wallet.d.ts +0 -107
  144. package/dist/sol/utils/wallet.js +0 -210
@@ -1,254 +0,0 @@
1
- /**
2
- * BlockRazor 交易发送服务
3
- * @module sol/dex/blockrazor/send
4
- *
5
- * @see https://blockrazor.gitbook.io/blockrazor/solana/send-transaction
6
- */
7
- import { BLOCKRAZOR_DEFAULT_TIMEOUT } from './constants.js';
8
- import { getBlockRazorConfig, getBlockRazorEndpoint } from './client.js';
9
- // ============================================================================
10
- // Send Transaction V1 (HTTP JSON)
11
- // ============================================================================
12
- /**
13
- * 发送交易 (V1 - HTTP JSON)
14
- *
15
- * @param params 发送参数
16
- * @param config BlockRazor 配置
17
- * @returns 发送响应
18
- *
19
- * @example
20
- * ```typescript
21
- * import { Sol } from 'four-flap-meme-sdk'
22
- *
23
- * Sol.setBlockRazorConfig({ apiKey: 'your-auth-token' })
24
- *
25
- * // 快速模式发送
26
- * const result = await Sol.blockRazorSendTransaction({
27
- * transaction: base64SignedTx,
28
- * mode: 'fast',
29
- * })
30
- *
31
- * console.log(`签名: ${result.signature}`)
32
- *
33
- * // 三明治缓解模式
34
- * const result2 = await Sol.blockRazorSendTransaction({
35
- * transaction: base64SignedTx,
36
- * mode: 'sandwichMitigation',
37
- * safeWindow: 5,
38
- * })
39
- * ```
40
- */
41
- export async function blockRazorSendTransaction(params, config) {
42
- const cfg = getBlockRazorConfig(config);
43
- const endpoint = getBlockRazorEndpoint(cfg);
44
- const timeout = cfg.timeout || BLOCKRAZOR_DEFAULT_TIMEOUT;
45
- const url = `${endpoint}/sendTransaction`;
46
- const body = {
47
- transaction: params.transaction,
48
- mode: params.mode || 'fast',
49
- };
50
- if (params.safeWindow !== undefined) {
51
- body.safeWindow = params.safeWindow;
52
- }
53
- if (params.revertProtection !== undefined) {
54
- body.revertProtection = params.revertProtection;
55
- }
56
- const controller = new AbortController();
57
- const timeoutId = setTimeout(() => controller.abort(), timeout);
58
- try {
59
- const response = await fetch(url, {
60
- method: 'POST',
61
- headers: {
62
- 'Content-Type': 'application/json',
63
- 'apikey': cfg.apiKey,
64
- },
65
- body: JSON.stringify(body),
66
- signal: controller.signal,
67
- });
68
- const data = await response.json();
69
- if (data.error) {
70
- throw new Error(`BlockRazor error: ${data.error}`);
71
- }
72
- return data;
73
- }
74
- finally {
75
- clearTimeout(timeoutId);
76
- }
77
- }
78
- // ============================================================================
79
- // Send Transaction V2 (HTTP Plain Text - Faster)
80
- // ============================================================================
81
- /**
82
- * 发送交易 V2 (更快的 HTTP Plain Text)
83
- *
84
- * V2 优势:
85
- * - 绕过 CORS Preflight (节省 50-100ms)
86
- * - 使用 Plain Text 而非 JSON
87
- * - Base64 编码更快
88
- *
89
- * @param transaction Base64 编码的已签名交易
90
- * @param options 可选参数
91
- * @param config BlockRazor 配置
92
- * @returns 交易签名
93
- *
94
- * @example
95
- * ```typescript
96
- * // 快速发送
97
- * const signature = await Sol.blockRazorSendTransactionV2(base64Tx)
98
- *
99
- * // 带参数发送
100
- * const signature = await Sol.blockRazorSendTransactionV2(
101
- * base64Tx,
102
- * {
103
- * mode: 'sandwichMitigation',
104
- * safeWindow: 5,
105
- * revertProtection: true,
106
- * },
107
- * )
108
- * ```
109
- */
110
- export async function blockRazorSendTransactionV2(transaction, options, config) {
111
- const cfg = getBlockRazorConfig(config);
112
- const endpoint = getBlockRazorEndpoint(cfg);
113
- const timeout = cfg.timeout || BLOCKRAZOR_DEFAULT_TIMEOUT;
114
- // 构建 URL 参数
115
- const params = new URLSearchParams();
116
- params.append('auth', cfg.apiKey);
117
- if (options?.mode) {
118
- params.append('mode', options.mode);
119
- }
120
- if (options?.safeWindow !== undefined) {
121
- params.append('safeWindow', options.safeWindow.toString());
122
- }
123
- if (options?.revertProtection !== undefined) {
124
- params.append('revertProtection', options.revertProtection.toString());
125
- }
126
- const url = `${endpoint}/v2/sendTransaction?${params.toString()}`;
127
- const controller = new AbortController();
128
- const timeoutId = setTimeout(() => controller.abort(), timeout);
129
- try {
130
- const response = await fetch(url, {
131
- method: 'POST',
132
- headers: {
133
- 'Content-Type': 'text/plain',
134
- },
135
- body: transaction,
136
- signal: controller.signal,
137
- });
138
- if (!response.ok) {
139
- const errorText = await response.text();
140
- throw new Error(`BlockRazor V2 error (${response.status}): ${errorText}`);
141
- }
142
- // V2 响应直接返回签名
143
- return await response.text();
144
- }
145
- finally {
146
- clearTimeout(timeoutId);
147
- }
148
- }
149
- // ============================================================================
150
- // Health Check
151
- // ============================================================================
152
- /**
153
- * 健康检查 (V1)
154
- *
155
- * 用于保持连接活跃。
156
- *
157
- * @param config BlockRazor 配置
158
- * @returns 健康状态
159
- */
160
- export async function blockRazorHealth(config) {
161
- const cfg = getBlockRazorConfig(config);
162
- const endpoint = getBlockRazorEndpoint(cfg);
163
- const response = await fetch(`${endpoint}/health`, {
164
- method: 'GET',
165
- headers: {
166
- 'apikey': cfg.apiKey,
167
- },
168
- });
169
- return await response.json();
170
- }
171
- /**
172
- * 健康检查 V2
173
- *
174
- * @param config BlockRazor 配置
175
- * @returns 是否健康
176
- */
177
- export async function blockRazorHealthV2(config) {
178
- const cfg = getBlockRazorConfig(config);
179
- const endpoint = getBlockRazorEndpoint(cfg);
180
- const params = new URLSearchParams();
181
- params.append('auth', cfg.apiKey);
182
- const response = await fetch(`${endpoint}/v2/health?${params.toString()}`, {
183
- method: 'POST',
184
- headers: {
185
- 'Content-Type': 'text/plain',
186
- },
187
- body: '',
188
- });
189
- return response.ok;
190
- }
191
- // ============================================================================
192
- // 便捷方法
193
- // ============================================================================
194
- /**
195
- * 快速发送交易
196
- *
197
- * 使用 V2 + fast 模式发送。
198
- *
199
- * @param transaction Base64 编码的已签名交易
200
- * @param config BlockRazor 配置
201
- * @returns 交易签名
202
- */
203
- export async function blockRazorFastSend(transaction, config) {
204
- return blockRazorSendTransactionV2(transaction, { mode: 'fast' }, config);
205
- }
206
- /**
207
- * 安全发送交易(三明治缓解)
208
- *
209
- * 使用 V2 + sandwichMitigation 模式发送。
210
- *
211
- * @param transaction Base64 编码的已签名交易
212
- * @param safeWindow 安全窗口(默认 5)
213
- * @param config BlockRazor 配置
214
- * @returns 交易签名
215
- */
216
- export async function blockRazorSafeSend(transaction, safeWindow = 5, config) {
217
- return blockRazorSendTransactionV2(transaction, { mode: 'sandwichMitigation', safeWindow }, config);
218
- }
219
- /**
220
- * 发送交易带 Revert 保护
221
- *
222
- * @param transaction Base64 编码的已签名交易
223
- * @param config BlockRazor 配置
224
- * @returns 交易签名
225
- */
226
- export async function blockRazorSendWithRevertProtection(transaction, config) {
227
- return blockRazorSendTransactionV2(transaction, { mode: 'fast', revertProtection: true }, config);
228
- }
229
- /**
230
- * 启动 Keep-Alive 定时器
231
- *
232
- * 定期发送健康检查以保持连接活跃。
233
- *
234
- * @param intervalMs 间隔时间(毫秒,默认 30000)
235
- * @param config BlockRazor 配置
236
- * @returns 定时器 ID(用于停止)
237
- *
238
- * @example
239
- * ```typescript
240
- * // 启动 keep-alive
241
- * const timerId = Sol.startBlockRazorKeepAlive(30000)
242
- *
243
- * // 停止
244
- * clearInterval(timerId)
245
- * ```
246
- */
247
- export function startBlockRazorKeepAlive(intervalMs = 30000, config) {
248
- // 立即执行一次
249
- blockRazorHealthV2(config).catch(console.error);
250
- // 定时执行
251
- return setInterval(() => {
252
- blockRazorHealthV2(config).catch(console.error);
253
- }, intervalMs);
254
- }
@@ -1,191 +0,0 @@
1
- /**
2
- * BlockRazor 类型定义
3
- * @module sol/dex/blockrazor/types
4
- */
5
- /** 区域类型 */
6
- export type BlockRazorRegion = 'frankfurt' | 'newyork' | 'tokyo' | 'amsterdam';
7
- /** 发送模式 */
8
- export type BlockRazorMode = 'fast' | 'sandwichMitigation';
9
- /** BlockRazor 配置 */
10
- export interface BlockRazorConfig {
11
- /** API Key (auth token) */
12
- apiKey: string;
13
- /** 区域(默认: frankfurt) */
14
- region?: BlockRazorRegion;
15
- /** 自定义端点 URL */
16
- endpoint?: string;
17
- /** 请求超时 (ms,默认: 10000) */
18
- timeout?: number;
19
- }
20
- /** 发送交易参数 */
21
- export interface BlockRazorSendParams {
22
- /** Base64 编码的已签名交易 */
23
- transaction: string;
24
- /**
25
- * 发送模式
26
- * - fast: 最快落地模式(默认)
27
- * - sandwichMitigation: 三明治攻击缓解模式
28
- */
29
- mode?: BlockRazorMode;
30
- /**
31
- * 安全窗口(仅 sandwichMitigation 模式生效)
32
- * 范围: 3-13,默认: 3
33
- * 值越大防护效果越好,但可能影响落地率
34
- */
35
- safeWindow?: number;
36
- /**
37
- * Revert 保护
38
- * 设为 true 时交易不会在链上失败,但会影响落地速度
39
- */
40
- revertProtection?: boolean;
41
- }
42
- /** 发送交易响应 */
43
- export interface BlockRazorSendResponse {
44
- /** 交易签名 */
45
- signature: string;
46
- /** 错误信息(如有) */
47
- error?: string;
48
- }
49
- /** 健康检查响应 */
50
- export interface BlockRazorHealthResponse {
51
- /** 状态 */
52
- status: string;
53
- }
54
- /** Commitment 级别 */
55
- export type GeyserCommitment = 'PROCESSED' | 'CONFIRMED' | 'FINALIZED';
56
- /** Geyser Stream 区域 */
57
- export type GeyserRegion = 'tokyo' | 'frankfurt' | 'newyork' | 'amsterdam';
58
- /** Geyser 过滤器 */
59
- export interface GeyserFilter {
60
- /** memcmp 过滤器 */
61
- memcmp?: {
62
- offset: number;
63
- bytes: string;
64
- };
65
- /** dataSize 过滤器 */
66
- dataSize?: number;
67
- }
68
- /** 账户订阅参数 */
69
- export interface GeyserAccountParams {
70
- /** 过滤器 Key */
71
- filterKey: string;
72
- /** 拥有者地址列表 */
73
- owners?: string[];
74
- /** 特定账户地址列表 */
75
- accounts?: string[];
76
- /** 额外过滤器(如 memcmp, datasize) */
77
- filters?: GeyserFilter[];
78
- /** 是否只包含有交易签名的更新 */
79
- nonemptyTxnSignature?: boolean;
80
- }
81
- /** 区块订阅参数 */
82
- export interface GeyserBlockParams {
83
- /** 过滤器 Key */
84
- filterKey: string;
85
- /** 包含涉及这些账户的区块(空表示全部) */
86
- accountInclude?: string[];
87
- /** 是否包含交易 */
88
- includeTransactions?: boolean;
89
- /** 是否包含账户更新 */
90
- includeAccounts?: boolean;
91
- /** 是否包含条目 */
92
- includeEntries?: boolean;
93
- }
94
- /** 交易订阅参数 */
95
- export interface GeyserTransactionParams {
96
- /** 过滤器 Key */
97
- filterKey: string;
98
- /** 是否只包含投票交易 */
99
- vote?: boolean;
100
- /** 是否只包含失败交易 */
101
- failed?: boolean;
102
- /** 包含涉及这些账户的交易 */
103
- accountInclude?: string[];
104
- /** 排除涉及这些账户的交易 */
105
- accountExclude?: string[];
106
- /** 交易必须涉及这些账户 */
107
- accountRequired?: string[];
108
- /** 特定交易签名 */
109
- signature?: string | null;
110
- }
111
- /** Geyser 订阅配置 */
112
- export interface GeyserSubscribeConfig {
113
- /** Commitment 级别 */
114
- commitment?: GeyserCommitment;
115
- /** 是否订阅账户 */
116
- subscribeAccounts?: boolean;
117
- /** 账户订阅参数 */
118
- accountParams?: GeyserAccountParams;
119
- /** 是否订阅区块 */
120
- subscribeBlocks?: boolean;
121
- /** 区块订阅参数 */
122
- blockParams?: GeyserBlockParams;
123
- /** 是否订阅交易 */
124
- subscribeTransactions?: boolean;
125
- /** 交易订阅参数 */
126
- transactionParams?: GeyserTransactionParams;
127
- }
128
- /** 账户更新 */
129
- export interface GeyserAccountUpdate {
130
- slot: string;
131
- account: {
132
- pubkey: Uint8Array;
133
- owner: Uint8Array;
134
- lamports: string;
135
- data: Uint8Array;
136
- executable: boolean;
137
- rentEpoch: string;
138
- };
139
- }
140
- /** 区块更新 */
141
- export interface GeyserBlockUpdate {
142
- slot: string;
143
- blockhash: string;
144
- transactions: unknown[];
145
- parentSlot: string;
146
- blockTime?: string;
147
- }
148
- /** 交易更新 */
149
- export interface GeyserTransactionUpdate {
150
- slot: string;
151
- transaction: {
152
- signature: Uint8Array;
153
- isVote: boolean;
154
- transaction: unknown;
155
- meta: unknown;
156
- };
157
- }
158
- /** Geyser 更新 */
159
- export interface GeyserUpdate {
160
- update_oneof: 'account' | 'block' | 'transaction' | 'ping' | 'pong';
161
- account?: GeyserAccountUpdate;
162
- block?: GeyserBlockUpdate;
163
- transaction?: GeyserTransactionUpdate;
164
- }
165
- /** Geyser 客户端配置 */
166
- export interface GeyserClientConfig {
167
- /** gRPC 服务地址 */
168
- host: string;
169
- /** 认证 Token */
170
- token: string;
171
- }
172
- /** Geyser Stream 事件处理器 */
173
- export interface GeyserEventHandlers {
174
- /** 账户更新回调 */
175
- onAccount?: (update: GeyserAccountUpdate, raw: Uint8Array) => void;
176
- /** 区块更新回调 */
177
- onBlock?: (update: GeyserBlockUpdate) => void;
178
- /** 交易更新回调 */
179
- onTransaction?: (update: GeyserTransactionUpdate, raw: Uint8Array) => void;
180
- /** 错误回调 */
181
- onError?: (error: Error) => void;
182
- /** 流结束回调 */
183
- onEnd?: () => void;
184
- }
185
- /** Geyser 订阅流控制 */
186
- export interface GeyserStreamControl {
187
- /** 关闭流 */
188
- close: () => void;
189
- /** 发送数据 */
190
- write: (data: unknown) => void;
191
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * BlockRazor 类型定义
3
- * @module sol/dex/blockrazor/types
4
- */
5
- export {};
@@ -1,10 +0,0 @@
1
- /**
2
- * DEX 模块导出
3
- * @module sol/dex
4
- */
5
- export * from './pump/index.js';
6
- export * from './raydium/index.js';
7
- export * from './orca/index.js';
8
- export * from './meteora/index.js';
9
- export * from './jup/index.js';
10
- export * from './blockrazor/index.js';
@@ -1,16 +0,0 @@
1
- /**
2
- * DEX 模块导出
3
- * @module sol/dex
4
- */
5
- // Pump.fun
6
- export * from './pump/index.js';
7
- // Raydium
8
- export * from './raydium/index.js';
9
- // Orca
10
- export * from './orca/index.js';
11
- // Meteora
12
- export * from './meteora/index.js';
13
- // Jupiter
14
- export * from './jup/index.js';
15
- // BlockRazor
16
- export * from './blockrazor/index.js';
@@ -1,33 +0,0 @@
1
- /**
2
- * Jupiter API 客户端
3
- * @module sol/dex/jup/client
4
- */
5
- import type { JupiterConfig } from './types.js';
6
- /** Jupiter API 基础 URL */
7
- export declare const JUP_API_BASE_URL = "https://api.jup.ag";
8
- /** 默认超时时间 (ms) */
9
- export declare const DEFAULT_TIMEOUT = 30000;
10
- /**
11
- * 设置默认 Jupiter 配置
12
- */
13
- export declare function setJupiterConfig(config: JupiterConfig): void;
14
- /**
15
- * 获取 Jupiter 配置
16
- */
17
- export declare function getJupiterConfig(config?: JupiterConfig): JupiterConfig;
18
- /**
19
- * 获取基础 URL
20
- */
21
- export declare function getBaseUrl(config?: JupiterConfig): string;
22
- /**
23
- * 构建请求头
24
- */
25
- export declare function buildHeaders(config?: JupiterConfig): Record<string, string>;
26
- /**
27
- * 发送 GET 请求
28
- */
29
- export declare function jupGet<T>(path: string, params?: Record<string, string | number | boolean | undefined>, config?: JupiterConfig): Promise<T>;
30
- /**
31
- * 发送 POST 请求
32
- */
33
- export declare function jupPost<T>(path: string, body: Record<string, unknown>, config?: JupiterConfig): Promise<T>;
@@ -1,110 +0,0 @@
1
- /**
2
- * Jupiter API 客户端
3
- * @module sol/dex/jup/client
4
- */
5
- // ============================================================================
6
- // 常量
7
- // ============================================================================
8
- /** Jupiter API 基础 URL */
9
- export const JUP_API_BASE_URL = 'https://api.jup.ag';
10
- /** 默认超时时间 (ms) */
11
- export const DEFAULT_TIMEOUT = 30000;
12
- // ============================================================================
13
- // 客户端管理
14
- // ============================================================================
15
- let defaultConfig = null;
16
- /**
17
- * 设置默认 Jupiter 配置
18
- */
19
- export function setJupiterConfig(config) {
20
- defaultConfig = config;
21
- }
22
- /**
23
- * 获取 Jupiter 配置
24
- */
25
- export function getJupiterConfig(config) {
26
- const cfg = config || defaultConfig;
27
- if (!cfg) {
28
- throw new Error('Jupiter API key not configured. Call setJupiterConfig() first or pass config.');
29
- }
30
- return cfg;
31
- }
32
- /**
33
- * 获取基础 URL
34
- */
35
- export function getBaseUrl(config) {
36
- const cfg = getJupiterConfig(config);
37
- return cfg.baseUrl || JUP_API_BASE_URL;
38
- }
39
- /**
40
- * 构建请求头
41
- */
42
- export function buildHeaders(config) {
43
- const cfg = getJupiterConfig(config);
44
- return {
45
- 'x-api-key': cfg.apiKey,
46
- 'Content-Type': 'application/json',
47
- };
48
- }
49
- /**
50
- * 发送 GET 请求
51
- */
52
- export async function jupGet(path, params, config) {
53
- const baseUrl = getBaseUrl(config);
54
- const headers = buildHeaders(config);
55
- const timeout = config?.timeout || defaultConfig?.timeout || DEFAULT_TIMEOUT;
56
- // 构建查询字符串
57
- const searchParams = new URLSearchParams();
58
- if (params) {
59
- for (const [key, value] of Object.entries(params)) {
60
- if (value !== undefined) {
61
- searchParams.append(key, String(value));
62
- }
63
- }
64
- }
65
- const url = `${baseUrl}${path}${searchParams.toString() ? '?' + searchParams.toString() : ''}`;
66
- const controller = new AbortController();
67
- const timeoutId = setTimeout(() => controller.abort(), timeout);
68
- try {
69
- const response = await fetch(url, {
70
- method: 'GET',
71
- headers,
72
- signal: controller.signal,
73
- });
74
- if (!response.ok) {
75
- const errorText = await response.text();
76
- throw new Error(`Jupiter API error (${response.status}): ${errorText}`);
77
- }
78
- return await response.json();
79
- }
80
- finally {
81
- clearTimeout(timeoutId);
82
- }
83
- }
84
- /**
85
- * 发送 POST 请求
86
- */
87
- export async function jupPost(path, body, config) {
88
- const baseUrl = getBaseUrl(config);
89
- const headers = buildHeaders(config);
90
- const timeout = config?.timeout || defaultConfig?.timeout || DEFAULT_TIMEOUT;
91
- const url = `${baseUrl}${path}`;
92
- const controller = new AbortController();
93
- const timeoutId = setTimeout(() => controller.abort(), timeout);
94
- try {
95
- const response = await fetch(url, {
96
- method: 'POST',
97
- headers,
98
- body: JSON.stringify(body),
99
- signal: controller.signal,
100
- });
101
- if (!response.ok) {
102
- const errorText = await response.text();
103
- throw new Error(`Jupiter API error (${response.status}): ${errorText}`);
104
- }
105
- return await response.json();
106
- }
107
- finally {
108
- clearTimeout(timeoutId);
109
- }
110
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Jupiter API 模块
3
- * @module sol/dex/jup
4
- */
5
- export * from './types.js';
6
- export { JUP_API_BASE_URL, DEFAULT_TIMEOUT, setJupiterConfig, getJupiterConfig, } from './client.js';
7
- export { getJupiterOrder, getJupiterQuote, getJupiterSwapTransaction, executeJupiterOrder, calculateSwapOutput, getTokenUsdPrice, getJupiterHoldings, getJupiterNativeHoldings, getJupiterTokenHolding, getJupiterTokenBalances, getJupiterBalances, getJupiterSolBalance, getJupiterTokenBalance, getJupiterTokenMints, getJupiterBalanceSummary, getJupiterShield, checkTokenSafety, batchCheckTokenSafety, hasTokenCriticalRisk, searchJupiterTokens, batchSearchTokens, getJupiterTokenInfo, getJupiterTokenPriceInfo, checkTokenTrust, getJupiterRouters, getJupiterRouterIds, } from './ultra.js';
8
- export { type LendDepositParams, type LendWithdrawParams, type LendMintParams, type LendBurnParams, type LendRedeemParams, type LendTransactionResponse, type LendInstructionAccount, type LendInstructionResponse, type LendUnderlyingAsset, type LendLiquiditySupplyData, type LendTokenInfo, type LendPosition, type LendEarnings, buildLendDeposit, depositUsdc, depositSol, buildLendWithdraw, withdrawUsdc, withdrawSol, buildLendMint, buildLendBurn, buildLendRedeem, getLendDepositInstruction, getLendWithdrawInstruction, getLendMintInstruction, getLendBurnInstruction, getLendRedeemInstruction, getEarnTokens, getEarnTokenByAsset, getEarnApys, sharesToAssets, assetsToShares, getEarnPositions, getEarnPositionByAsset, getActiveEarnPositions, getEarnTotalValue, getEarnEarnings, getEarnEarningsByToken, getEarnEarningsSummary, LEND_SUPPORTED_ASSETS, } from './lend.js';
9
- export { type TokenImageContentType, type TokenQuoteDecimal, type VestingPeriod, type VestingDuration, type FeeBps, type FeeDuration, type FeeMode, type LockedVestingParam, type BuildCurveByMarketCapParam, type FeeConfig, type CreateDbcPoolParams, type CreateDbcPoolResponse, type SubmitDbcPoolParams, type SubmitDbcPoolResponse, type DbcPoolAddressesResponse, type DbcFeeResponse, type ClaimDbcFeeParams, type ClaimDbcFeeResponse, createDbcPoolTx, createSimpleDbcPool, createDbcPoolWithVesting, submitDbcPool, getDbcPoolAddresses, getDbcPoolAddress, getDammV2PoolAddress, isTokenMigrated, getDbcFee, createClaimDbcFeeTx, claimAllDbcFee, generateTokenMetadata, uploadDbcTokenImage, uploadDbcTokenMetadata, QUOTE_MINTS, VESTING_DURATIONS, } from './studio.js';
10
- export { type CraftSendParams, type CraftSendResponse, type CraftClawbackParams, type CraftClawbackResponse, type SendInvite, type InviteListResponse, craftSend, craftSendSol, craftSendUsdc, craftClawback, getPendingInvites, getAllPendingInvites, getInviteHistory, getAllInviteHistory, getPendingInvitesTotal, getExpiringInvites, isInviteExpired, getInviteTimeRemaining, filterSentInvites, filterReceivedInvites, } from './send.js';
11
- export { type FetcherReport, type PortfolioElement, type PortfolioResponse, type GetPortfolioParams, type UnstakingJup, type StakedJupInfo, type PlatformLinks, type PlatformInfo, getPortfolio, getWalletPortfolio, getPortfolioTotalValue, getPortfolioByPlatform, getPortfolioByType, getPlatformValueSummary, getPortfolioSummary, getStakedJup, getStakedJupAmount, getUnstakingJupAmount, getUpcomingUnlocks, getPlatforms, getPlatformIds, getActivePlatforms, getPlatformsByTag, searchPlatforms, getPlatformById, filterByPlatform, filterByType, filterByMinValue, sortByValue, getTopElements, } from './portfolio.js';
12
- export { type TokenPriceInfo, type PriceResponse, getTokenPricesV3, getSingleTokenPriceV3, getUsdPrice, batchGetUsdPrices, get24hPriceChange, calculateTokenValue, calculatePortfolioValue, COMMON_TOKENS, getSolPrice, getUsdcPrice, getCommonTokenPrices, } from './price.js';
13
- export { type TokenStats, type TokenFirstPool, type TokenAudit, type TokenApy, type OrganicScoreLabel, type TokenInfoV2, type TokenTag, type TokenCategory, type TokenInterval, type TokenContentType, type TokenContentStatus, type TokenContentUser, type TokenContent, type TokenSummary, type TokenContentData, type TokenContentResponse, type TokenContentPagination, type TokenContentFeedData, type TokenContentFeedResponse, type TokenContentFeedParams, searchTokensV2, getTokenInfoV2, batchGetTokenInfoV2, getTokensByTag, getVerifiedTokensV2, getLstTokensV2, getTopTokensV2, getTopTradedTokensV2, getTrendingTokensV2, getTopOrganicTokensV2, getRecentTokensV2, getTokenContentV2, getSingleTokenContentV2, getTokenSummaryV2, getTokenTweetsV2, getTokenArticlesV2, getCookingTokenContentV2, getTokenContentFeedV2, getAllTokenContentFeedV2, getTokenFeedV2, hasTokenContent, getAllCitations, getTokenPriceV2, batchGetTokenPricesV2, getTokenMarketDataV2, checkTokenSafetyV2, getTokenStatsSummaryV2, searchTrendingTokensV2, filterVerifiedTokens, filterHighOrganicTokens, calculateBuySellRatio, } from './tokens.js';
14
- export { type RecurringTimeParams, type RecurringPriceParams, type RecurringParamsTime, type RecurringParamsPrice, type RecurringParams, type RecurringType, type RecurringCreateOrderParams, type RecurringCreateOrderResponse, type RecurringCancelOrderParams, type RecurringCancelOrderResponse, type RecurringExecuteParams, type RecurringExecuteStatus, type RecurringExecuteResponse, type RecurringOrderListStatus, type RecurringTrade, type RecurringTimeOrder, type RecurringGetOrdersParams, type RecurringGetOrdersResponse, createRecurringOrder, createSimpleRecurringOrder, createDailyRecurring, createWeeklyRecurring, cancelRecurringOrder, cancelTimeRecurringOrder, executeRecurringOrder, getRecurringOrders, getActiveTimeRecurringOrders, getHistoryTimeRecurringOrders, getAllActiveTimeRecurringOrders, calculateTotalInvestment, calculateTotalDuration, estimateEndDate, RECURRING_INTERVALS, } from './recurring.js';
15
- export { type TriggerOrderParams, type TriggerCreateOrderParams, type TriggerCreateOrderResponse, type TriggerCancelSingleOrderParams, type TriggerCancelSingleOrderResponse, type TriggerCancelOrdersParams, type TriggerCancelOrdersResponse, type TriggerExecuteParams, type TriggerExecuteStatus, type TriggerExecuteResponse, type TriggerOrderStatus, type TriggerOrderListStatus, type TriggerTrade, type TriggerOrderDetail, type TriggerGetOrdersResponse, type TriggerGetOrdersParams, createTriggerOrder, createSimpleTriggerOrder, cancelTriggerOrder, cancelTriggerOrders, cancelSingleTriggerOrder, executeTriggerOrder, createAndExecuteTriggerOrder, getTriggerOrders, getActiveTriggerOrders, getHistoryTriggerOrders, getAllActiveTriggerOrders, calculateTriggerPrice, calculateTakingAmount, } from './trigger.js';
16
- export { type LegacySwapMode, type LegacyInstructionVersion, type LegacySwapInfo, type LegacyRoutePlan, type LegacyPlatformFee, type LegacyQuoteParams, type LegacyQuoteResponse, type LegacySwapParams, type LegacySwapResponse, type PriorityLevel, type PriorityLevelWithMaxLamports, type JitoTipLamports, type JitoTipLamportsWithPayer, type PrioritizationFeeLamports, type InstructionAccount, type Instruction, type LegacySwapInstructionsResponse, type ProgramIdToLabelMap, getLegacyQuote, getLegacyQuoteSimple, buildLegacySwap, getLegacySwapInstructions, getProgramIdToLabel, getAllDexLabels, getProgramIdByLabel, getLabelByProgramId, searchDex, getRouteLabels, getRouteHops, getQuoteSummary, compareQuotes, getBestLegacyQuote, } from './legacy.js';