100x-sdk 1.0.3 → 1.0.5

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.
@@ -39,10 +39,10 @@ class FastModule {
39
39
  }
40
40
 
41
41
  /**
42
- * Get token list (获取代币列表)
42
+ * Get token list
43
43
  * @param {Object} options - Query parameters
44
- * @param {number} options.limit - Items per page, default 10 (每页数量,默认 10)
45
- * @param {number} options.before_timestamp - Cursor for pagination (分页游标,Unix 时间戳)
44
+ * @param {number} options.limit - Items per page, default 10
45
+ * @param {number} options.before_timestamp - Cursor for pagination (Unix timestamp)
46
46
  * @returns {Promise<Object>} Token list data
47
47
  *
48
48
  * @example
@@ -88,8 +88,8 @@ class FastModule {
88
88
  * const page2 = await sdk.fast.mints({ limit: 5, before_timestamp: page1.data.next_cursor });
89
89
  *
90
90
  * // Access token data:
91
- * const tokens = result.data.tokens; // 完整代币对象数组
92
- * const mintAddresses = tokens.map(t => t.mint_account); // 提取代币地址
91
+ * const tokens = result.data.tokens; // Full array of token objects
92
+ * const mintAddresses = tokens.map(t => t.mint_account); // Extract token addresses
93
93
  */
94
94
  async mints(options = {}) {
95
95
  const params = {
@@ -108,8 +108,8 @@ class FastModule {
108
108
  }
109
109
 
110
110
  /**
111
- * Get token details (获取代币详情信息)
112
- * @param {string} mint - Token mint address (代币地址)
111
+ * Get token details
112
+ * @param {string} mint - Token mint address
113
113
  * @returns {Promise<Object>} Token details data
114
114
  *
115
115
  * @example
@@ -163,11 +163,11 @@ class FastModule {
163
163
  }
164
164
 
165
165
  /**
166
- * 直接API调用方法
166
+ * Direct API call method
167
167
  * @private
168
- * @param {Object} config - 数据配置
169
- * @param {Object} params - 请求参数
170
- * @returns {Promise<Object>} API响应数据
168
+ * @param {Object} config - Data configuration
169
+ * @param {Object} params - Request parameters
170
+ * @returns {Promise<Object>} API response data
171
171
  */
172
172
  async _directApiCall(config, params = {}) {
173
173
  // Ensure FastModule is properly configured before making API calls
@@ -188,33 +188,33 @@ class FastModule {
188
188
  url: url
189
189
  };
190
190
 
191
- // 根据请求方法设置参数
191
+ // Set parameters based on request method
192
192
  if (config.method === 'POST') {
193
- requestConfig.data = queryParams; // POST 请求使用 data
193
+ requestConfig.data = queryParams; // POST request uses data
194
194
  } else {
195
- requestConfig.params = queryParams; // GET 请求使用 params
195
+ requestConfig.params = queryParams; // GET request uses params
196
196
  }
197
197
 
198
198
  const response = await this.httpClient.request(requestConfig);
199
199
 
200
- // 检查新旧API响应格式
201
- // 新格式: { code: 200, msg: "success", data: {...} }
202
- // 旧格式: { success: true, data: {...}, message: "..." }
200
+ // Check new and old API response formats
201
+ // New format: { code: 200, msg: "success", data: {...} }
202
+ // Old format: { success: true, data: {...}, message: "..." }
203
203
  const isNewFormat = response.data && typeof response.data.code === 'number';
204
204
  const isOldFormat = response.data && typeof response.data.success === 'boolean';
205
205
 
206
206
  if (isNewFormat) {
207
- // 新 API 格式
207
+ // New API format
208
208
  if (response.data.code !== 200) {
209
209
  throw new Error(`API请求失败: ${response.data.msg || '未知错误'}`);
210
210
  }
211
211
  } else if (isOldFormat) {
212
- // 旧 API 格式(向后兼容)
212
+ // Old API format (backward compatible)
213
213
  if (!response.data.success) {
214
214
  throw new Error(`API请求失败: ${response.data.message || '未知错误'}`);
215
215
  }
216
216
  } else {
217
- // 未知格式
217
+ // Unknown format
218
218
  throw new Error('API返回格式无法识别');
219
219
  }
220
220
 
@@ -222,14 +222,14 @@ class FastModule {
222
222
 
223
223
  } catch (error) {
224
224
  if (error.response) {
225
- // API返回错误
225
+ // API returned error
226
226
  const errorMsg = error.response.data?.msg || error.response.data?.message || error.message;
227
227
  throw new Error(`API请求失败 [${error.response.status}]: ${errorMsg}`);
228
228
  } else if (error.request) {
229
- // 网络错误
229
+ // Network error
230
230
  throw new Error(`网络请求失败: 无法连接到 ${this.baseUrl}`);
231
231
  } else {
232
- // 其他错误
232
+ // Other errors
233
233
  throw new Error(`请求处理失败: ${error.message}`);
234
234
  }
235
235
  }
@@ -238,71 +238,71 @@ class FastModule {
238
238
 
239
239
 
240
240
  /**
241
- * 获取订单数据 Get Orders Data (查询活跃订单 Active Orders)
242
- * @param {string} mint - 代币地址 Token mint address
243
- * @param {Object} options - 查询参数 Query parameters
244
- * @param {string} options.type - 订单类型 Order type: "up_orders" (做空/short) 或 "down_orders" (做多/long)
245
- * @param {number} options.page - 页码,默认1 Page number, default 1
246
- * @param {number} options.limit - 每页数量,默认500 Items per page, default 500
247
- * @returns {Promise<Object>} 订单数据,包含订单列表及分页信息 Order data with order list and pagination info
241
+ * Get Orders Data (Active Orders)
242
+ * @param {string} mint - Token mint address
243
+ * @param {Object} options - Query parameters
244
+ * @param {string} options.type - Order type: "up_orders" (short) or "down_orders" (long)
245
+ * @param {number} options.page - Page number, default 1
246
+ * @param {number} options.limit - Items per page, default 500
247
+ * @returns {Promise<Object>} Order data with order list and pagination info
248
248
  *
249
249
  * @example
250
- * // 获取做多订单 Get long orders
250
+ * // Get long orders
251
251
  * const ordersData = await sdk.fast.orders('T3NFPvYvpULCTgrhHb4b4Sj5J1qtSNvyKZfE8hCvuKM', { type: 'down_orders' });
252
252
  *
253
- * // 返回值示例 Return value example (compatible with chain.js format):
253
+ * // Return value example (compatible with chain.js format):
254
254
  * // {
255
255
  * // "success": true,
256
256
  * // "data": {
257
257
  * // "orders": [
258
258
  * // {
259
- * // "index": 0, // 订单在 OrderBook 中的索引位置
260
- * // "user": "7621yjkZJ1jxBHw3oCPoazFfMx82NWBSARk2AGV7EBig", // 用户地址
261
- * // "lock_lp_start_price": "2656104380242311276", // LP 开始价格(字符串)
262
- * // "lock_lp_end_price": "2325402748045870207", // LP 结束价格(字符串)
263
- * // "open_price": "2795899347623485554", // 开仓价格(字符串)
264
- * // "order_id": "0", // 订单 ID(字符串)
265
- * // "lock_lp_sol_amount": 1880793407, // LP 锁定 SOL 数量(lamports)
266
- * // "lock_lp_token_amount": 75677963031921, // LP 锁定代币数量(最小单位)
267
- * // "next_lp_sol_amount": 0, // Next LP SOL 数量
268
- * // "next_lp_token_amount": 0, // Next LP Token 数量
269
- * // "margin_init_sol_amount": 418211213, // 初始保证金
270
- * // "margin_sol_amount": 418211213, // 保证金 SOL 数量(lamports)
271
- * // "borrow_amount": 2276435100, // 借款数量(lamports)
272
- * // "position_asset_amount": 75677963031921, // 持仓资产数量(最小单位)
273
- * // "realized_sol_amount": 0, // 已实现收益
274
- * // "version": 2, // 版本号
275
- * // "start_time": 1764047379, // 开始时间(Unix 时间戳)
276
- * // "end_time": 1764652179, // 结束时间(Unix 时间戳)
277
- * // "next_order": 1, // 链表中下一个订单索引 (65535=none)
278
- * // "prev_order": 65535, // 链表中上一个订单索引 (65535=none)
279
- * // "borrow_fee": 1200, // 借款费用(基点,1200 = 12%)
280
- * // "order_type": "down_orders" // 订单类型(字符串)
259
+ * // "index": 0, // Order index position in the OrderBook
260
+ * // "user": "7621yjkZJ1jxBHw3oCPoazFfMx82NWBSARk2AGV7EBig", // User address
261
+ * // "lock_lp_start_price": "2656104380242311276", // LP start price (string)
262
+ * // "lock_lp_end_price": "2325402748045870207", // LP end price (string)
263
+ * // "open_price": "2795899347623485554", // Open price (string)
264
+ * // "order_id": "0", // Order ID (string)
265
+ * // "lock_lp_sol_amount": 1880793407, // LP locked SOL amount (lamports)
266
+ * // "lock_lp_token_amount": 75677963031921, // LP locked token amount (min unit)
267
+ * // "next_lp_sol_amount": 0, // Next LP SOL amount
268
+ * // "next_lp_token_amount": 0, // Next LP Token amount
269
+ * // "margin_init_sol_amount": 418211213, // Initial margin
270
+ * // "margin_sol_amount": 418211213, // Margin SOL amount (lamports)
271
+ * // "borrow_amount": 2276435100, // Borrow amount (lamports)
272
+ * // "position_asset_amount": 75677963031921, // Position asset amount (min unit)
273
+ * // "realized_sol_amount": 0, // Realized profit
274
+ * // "version": 2, // Version number
275
+ * // "start_time": 1764047379, // Start time (Unix timestamp)
276
+ * // "end_time": 1764652179, // End time (Unix timestamp)
277
+ * // "next_order": 1, // Next order index in linked list (65535=none)
278
+ * // "prev_order": 65535, // Previous order index in linked list (65535=none)
279
+ * // "borrow_fee": 1200, // Borrow fee (basis points, 1200 = 12%)
280
+ * // "order_type": "down_orders" // Order type (string)
281
281
  * // }
282
282
  * // ],
283
- * // "total": 10, // 总订单数量 (total_count)
284
- * // "order_type": "down_orders", // 订单类型(字符串)
285
- * // "mint_account": "T3NFPvYvpULCTgrhHb4b4Sj5J1qtSNvyKZfE8hCvuKM", // 查询的代币地址
286
- * // "page": 1, // 当前页码
287
- * // "limit": 3, // 每页限制
288
- * // "has_next": true, // 是否有下一页
289
- * // "has_prev": false // 是否有上一页
283
+ * // "total": 10, // Total order count (total_count)
284
+ * // "order_type": "down_orders", // Order type (string)
285
+ * // "mint_account": "T3NFPvYvpULCTgrhHb4b4Sj5J1qtSNvyKZfE8hCvuKM", // Queried token address
286
+ * // "page": 1, // Current page number
287
+ * // "limit": 3, // Items per page
288
+ * // "has_next": true, // Whether there is a next page
289
+ * // "has_prev": false // Whether there is a previous page
290
290
  * // },
291
- * // "message": "Operation successful" // 操作结果消息
291
+ * // "message": "Operation successful" // Operation result message
292
292
  * // }
293
293
  *
294
- * // 访问订单数据 Access order data:
295
- * const orders = ordersData.data.orders; // 订单数组
296
- * const totalOrders = ordersData.data.total; // 总订单数量
297
- * const firstOrder = orders[0]; // 第一个订单
298
- * const userAddress = firstOrder.user; // 用户地址
299
- * const marginAmount = firstOrder.margin_sol_amount; // 保证金数量(lamports)
300
- * const borrowFee = firstOrder.borrow_fee; // 借款费用(基点)
294
+ * // Access order data:
295
+ * const orders = ordersData.data.orders; // Order array
296
+ * const totalOrders = ordersData.data.total; // Total order count
297
+ * const firstOrder = orders[0]; // First order
298
+ * const userAddress = firstOrder.user; // User address
299
+ * const marginAmount = firstOrder.margin_sol_amount; // Margin amount (lamports)
300
+ * const borrowFee = firstOrder.borrow_fee; // Borrow fee (basis points)
301
301
  *
302
- * // 获取做空订单 Get short orders:
302
+ * // Get short orders:
303
303
  * const shortOrders = await sdk.fast.orders(mint, { type: 'up_orders' });
304
304
  *
305
- * // 分页获取订单 Get paginated orders:
305
+ * // Get paginated orders:
306
306
  * const pageTwo = await sdk.fast.orders(mint, { type: 'down_orders', page: 2, limit: 100 });
307
307
  */
308
308
  async orders(mint, options = {}) {
@@ -416,17 +416,17 @@ class FastModule {
416
416
  }));
417
417
 
418
418
  // Sort orders by lock_lp_start_price
419
- // down_orders (做多): descending order (从大到小)
420
- // up_orders (做空): ascending order (从小到大)
419
+ // down_orders (long): descending order
420
+ // up_orders (short): ascending order
421
421
  processedOrders.sort((a, b) => {
422
422
  const priceA = BigInt(a.lock_lp_start_price);
423
423
  const priceB = BigInt(b.lock_lp_start_price);
424
424
 
425
425
  if (type === 'down_orders') {
426
- // 做多订单:从大到小排列
426
+ // Long orders: sort in descending order
427
427
  return priceB > priceA ? 1 : (priceB < priceA ? -1 : 0);
428
428
  } else {
429
- // 做空订单:从小到大排列
429
+ // Short orders: sort in ascending order
430
430
  return priceA > priceB ? 1 : (priceA < priceB ? -1 : 0);
431
431
  }
432
432
  });
@@ -463,9 +463,9 @@ class FastModule {
463
463
  }
464
464
 
465
465
  /**
466
- * Get token price (获取代币价格)
467
- * @param {string} mint - Token mint address (代币地址)
468
- * @returns {Promise<string>} Latest price string (最新价格字符串)
466
+ * Get token price
467
+ * @param {string} mint - Token mint address
468
+ * @returns {Promise<string>} Latest price string
469
469
  *
470
470
  * @example
471
471
  * // Get token latest price
@@ -481,12 +481,12 @@ class FastModule {
481
481
  // Call mint_info API
482
482
  const result = await this.mint_info(mint);
483
483
 
484
- // Check return data (新格式: { code: 200, msg: "success", data: {...} })
484
+ // Check return data (new format: { code: 200, msg: "success", data: {...} })
485
485
  if (!result || !result.data) {
486
486
  throw new Error('price: 无法获取代币信息 Unable to fetch token information');
487
487
  }
488
488
 
489
- // Extract latest price (新格式直接返回对象,不是数组)
489
+ // Extract latest price (new format returns object directly, not array)
490
490
  let latestPrice = result.data.latest_price;
491
491
 
492
492
  if (!latestPrice) {
@@ -502,16 +502,16 @@ class FastModule {
502
502
  }
503
503
 
504
504
  /**
505
- * Get User Active Orders (获取用户活跃订单)
505
+ * Get User Active Orders
506
506
  * Compatible with chain.js user_orders() method
507
507
  *
508
- * @param {string} user - User wallet address (用户钱包地址)
509
- * @param {string} mint - Token mint address (optional, null/undefined for all tokens) (代币地址,可选)
510
- * @param {Object} options - Query parameters (查询参数)
511
- * @param {string} options.direction - Order direction (optional: 'up'=short, 'dn'=long, omit=all) (订单方向)
512
- * @param {number} options.page - Page number, default 1 (页码,默认1)
513
- * @param {number} options.limit - Items per page, default 20 (每页数量,默认20)
514
- * @param {string} options.order_by - Sort order: 'start_time_desc' or 'start_time_asc', default 'start_time_desc' (排序方式)
508
+ * @param {string} user - User wallet address
509
+ * @param {string} mint - Token mint address (optional, null/undefined for all tokens)
510
+ * @param {Object} options - Query parameters
511
+ * @param {string} options.direction - Order direction (optional: 'up'=short, 'dn'=long, omit=all)
512
+ * @param {number} options.page - Page number, default 1
513
+ * @param {number} options.limit - Items per page, default 20
514
+ * @param {string} options.order_by - Sort order: 'start_time_desc' or 'start_time_asc', default 'start_time_desc'
515
515
  * @returns {Promise<Object>} User orders data compatible with chain.js format
516
516
  *
517
517
  * @example
@@ -1,6 +1,6 @@
1
1
  const { PublicKey, Transaction, SystemProgram } = require('@solana/web3.js');
2
2
  const anchor = require('@coral-xyz/anchor');
3
- // 统一使用 buffer 包,所有平台一致
3
+ // Use the buffer package consistently across all platforms
4
4
  const { Buffer } = require('buffer');
5
5
 
6
6
  /**
@@ -73,7 +73,7 @@ class ParamModule {
73
73
  * @returns {Promise<Object>} Parameters account data
74
74
  */
75
75
  async getParams(partner) {
76
- // 计算合作伙伴参数账户地址
76
+ // Calculate partner parameters account address
77
77
  const [paramsAccount] = PublicKey.findProgramAddressSync(
78
78
  [Buffer.from("params"), partner.toBuffer()],
79
79
  this.sdk.programId
@@ -117,13 +117,13 @@ class ParamModule {
117
117
  );
118
118
 
119
119
  try {
120
- // 检查账户是否存在
120
+ // Check if account exists
121
121
  const accountInfo = await this.sdk.connection.getAccountInfo(adminAccount);
122
122
  if (!accountInfo) {
123
123
  throw new Error('Admin account does not exist');
124
124
  }
125
-
126
- // 尝试使用 Anchor 解析数据
125
+
126
+ // Try to parse data using Anchor
127
127
  if (this.sdk.program.account.admin) {
128
128
  const adminData = await this.sdk.program.account.admin.fetch(adminAccount);
129
129
  return {
@@ -131,7 +131,7 @@ class ParamModule {
131
131
  data: adminData
132
132
  };
133
133
  } else {
134
- // 如果 Anchor 不可用,返回基本信息
134
+ // If Anchor is not available, return basic info
135
135
  return {
136
136
  address: adminAccount,
137
137
  accountInfo: accountInfo
@@ -4,10 +4,9 @@ const { calcLiqTokenBuy, calcLiqTokenSell } = require('./calcLiq');
4
4
 
5
5
  /**
6
6
  * Simulate token buy transaction - calculate if target token amount can be purchased
7
- * 模拟以 Token 数量为目标的买入交易 - 计算是否能买到指定数量的 Token
8
- * @param {string} mint - Token address 代币地址
9
- * @param {bigint|string|number} buyTokenAmount - Target token amount to buy 目标购买的 Token 数量
10
- * @param {string} passOrder - Optional order address to skip (won't be liquidated) 可选的跳过订单地址
7
+ * @param {string} mint - Token address
8
+ * @param {bigint|string|number} buyTokenAmount - Target token amount to buy
9
+ * @param {string} passOrder - Optional order address to skip (won't be liquidated)
11
10
  * @param {Object|null} lastPrice - Token price info, default null
12
11
  * @param {Object|null} ordersData - Orders response object, default null
13
12
  * @returns {Promise<Object>} Token buy simulation result with the following structure:
@@ -27,7 +26,7 @@ const { calcLiqTokenBuy, calcLiqTokenSell } = require('./calcLiq');
27
26
  * - suggestedSolAmount: {string} Required SOL amount for suggested token purchase
28
27
  */
29
28
  async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPrice = null, ordersData = null, curveData = null) {
30
- // 获取价格和订单数据
29
+ // Get price and orders data
31
30
 
32
31
  //console.log('simulateTokenBuy', mint, buyTokenAmount, passOrder, lastPrice, ordersData);
33
32
 
@@ -42,14 +41,14 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
42
41
  type: 'up_orders',
43
42
  limit: this.sdk.MAX_ORDERS_COUNT + 1
44
43
  });
45
- // 提取实际的订单数组
44
+ // Extract the actual orders array
46
45
  orders = ordersResponse.data.orders;
47
46
  } else {
48
- // 如果传入了 ordersData,从响应对象中提取订单数组并限制长度
47
+ // If ordersData is provided, extract the orders array from the response object and limit its length
49
48
  orders = ordersData.data.orders.slice(0, this.sdk.MAX_ORDERS_COUNT + 1);
50
49
  }
51
50
 
52
- // 获取动态流动池参数(支持外部传入,避免重复请求)
51
+ // Get dynamic liquidity pool parameters (supports external input to avoid duplicate requests)
53
52
  if (!curveData) {
54
53
  try {
55
54
  curveData = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
@@ -58,7 +57,7 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
58
57
  }
59
58
  }
60
59
 
61
- // 调用 calcLiqTokenBuy 进行流动性计算(传入动态流动池参数)
60
+ // Call calcLiqTokenBuy to perform liquidity calculation (passing dynamic liquidity pool parameters)
62
61
  try {
63
62
  const liqResult = calcLiqTokenBuy(
64
63
  price,
@@ -73,16 +72,16 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
73
72
  // console.log("liqResult:",liqResult);
74
73
 
75
74
 
76
- // console.log('\n=== calcLiqTokenBuy 返回结果 ===');
77
- // console.log('自由流动性 SOL 总量:', liqResult.free_lp_sol_amount_sum.toString());
78
- // console.log('自由流动性 Token 总量:', liqResult.free_lp_token_amount_sum.toString());
79
- // console.log('锁定流动性 SOL 总量:', liqResult.lock_lp_sol_amount_sum.toString());
80
- // console.log('锁定流动性 Token 总量:', liqResult.lock_lp_token_amount_sum.toString());
81
- // console.log('是否包含无限流动性:', liqResult.has_infinite_lp);
82
- // console.log('跳过的订单索引:', liqResult.pass_order_id);
83
- // console.log('需要强平的订单数量:', liqResult.force_close_num);
84
- // console.log('理想 SOL 使用量:', liqResult.ideal_lp_sol_amount.toString());
85
- // console.log('实际 SOL 使用量:', liqResult.real_lp_sol_amount.toString());
75
+ // console.log('\n=== calcLiqTokenBuy return result ===');
76
+ // console.log('Free liquidity SOL total:', liqResult.free_lp_sol_amount_sum.toString());
77
+ // console.log('Free liquidity Token total:', liqResult.free_lp_token_amount_sum.toString());
78
+ // console.log('Locked liquidity SOL total:', liqResult.lock_lp_sol_amount_sum.toString());
79
+ // console.log('Locked liquidity Token total:', liqResult.lock_lp_token_amount_sum.toString());
80
+ // console.log('Whether includes infinite liquidity:', liqResult.has_infinite_lp);
81
+ // console.log('Skipped order index:', liqResult.pass_order_id);
82
+ // console.log('Number of orders needing force close:', liqResult.force_close_num);
83
+ // console.log('Ideal SOL usage:', liqResult.ideal_lp_sol_amount.toString());
84
+ // console.log('Actual SOL usage:', liqResult.real_lp_sol_amount.toString());
86
85
  // console.log('===============================\n');
87
86
 
88
87
  // Convert to BigInt for calculations
@@ -164,7 +163,7 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
164
163
  * Simulate token sell transaction analysis
165
164
  * @param {string} mint - Token address
166
165
  * @param {bigint|string|number} sellTokenAmount - Token amount to sell (u64 format, precision 10^9)
167
- * @param {string} passOrder - Optional order address to skip (won't be liquidated) 可选的跳过订单地址
166
+ * @param {string} passOrder - Optional order address to skip (won't be liquidated)
168
167
  * @param {Object|null} lastPrice - Token price info, default null
169
168
  * @param {Object|null} ordersData - Orders response object, default null
170
169
  * @returns {Promise<Object>} Token sell simulation result with the following structure:
@@ -184,7 +183,7 @@ async function simulateTokenBuy(mint, buyTokenAmount, passOrder = null, lastPric
184
183
  * - suggestedSolAmount: {string} Expected SOL amount from suggested token sale
185
184
  */
186
185
  async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPrice = null, ordersData = null, curveData = null) {
187
- // 获取价格和订单数据
186
+ // Get price and orders data
188
187
  let price = lastPrice;
189
188
  if (!price) {
190
189
  price = await this.sdk.data.price(mint);
@@ -198,14 +197,14 @@ async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPr
198
197
  type: 'down_orders',
199
198
  limit: this.sdk.MAX_ORDERS_COUNT + 1
200
199
  });
201
- // 提取实际的订单数组
200
+ // Extract the actual orders array
202
201
  orders = ordersResponse.data.orders;
203
202
  } else {
204
- // 如果传入了 ordersData,从响应对象中提取订单数组并限制长度
203
+ // If ordersData is provided, extract the orders array from the response object and limit its length
205
204
  orders = ordersData.data.orders.slice(0, this.sdk.MAX_ORDERS_COUNT + 1);
206
205
  }
207
206
 
208
- // 获取动态流动池参数(支持外部传入,避免重复请求)
207
+ // Get dynamic liquidity pool parameters (supports external input to avoid duplicate requests)
209
208
  if (!curveData) {
210
209
  try {
211
210
  curveData = await this.sdk.chain.getCurveAccount(mint, { skipBalances: true });
@@ -214,12 +213,12 @@ async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPr
214
213
  }
215
214
  }
216
215
 
217
- // console.log('simulateTokenSell 获取的数据:');
218
- // console.log('价格:', price);
219
- // console.log('订单数量:', orders.length);
220
- // orders.forEach((order, i) => console.log(`订单${i}: start=${order.lock_lp_start_price}, end=${order.lock_lp_end_price}, sol=${order.lock_lp_sol_amount}, token=${order.lock_lp_token_amount}`));
216
+ // console.log('Data obtained by simulateTokenSell:');
217
+ // console.log('Price:', price);
218
+ // console.log('Number of orders:', orders.length);
219
+ // orders.forEach((order, i) => console.log(`Order ${i}: start=${order.lock_lp_start_price}, end=${order.lock_lp_end_price}, sol=${order.lock_lp_sol_amount}, token=${order.lock_lp_token_amount}`));
221
220
 
222
- // 调用 calcLiqTokenSell 进行流动性计算(传入动态流动池参数)
221
+ // Call calcLiqTokenSell to perform liquidity calculation (passing dynamic liquidity pool parameters)
223
222
  try {
224
223
  const liqResult = calcLiqTokenSell(
225
224
  price,
@@ -231,16 +230,16 @@ async function simulateTokenSell(mint, sellTokenAmount, passOrder = null, lastPr
231
230
  curveData.initialVirtualToken
232
231
  );
233
232
 
234
- // console.log('\n=== calcLiqTokenSell 返回结果 ===');
235
- // console.log('自由流动性 SOL 总量:', liqResult.free_lp_sol_amount_sum.toString());
236
- // console.log('自由流动性 Token 总量:', liqResult.free_lp_token_amount_sum.toString());
237
- // console.log('锁定流动性 SOL 总量:', liqResult.lock_lp_sol_amount_sum.toString());
238
- // console.log('锁定流动性 Token 总量:', liqResult.lock_lp_token_amount_sum.toString());
239
- // console.log('是否包含无限流动性:', liqResult.has_infinite_lp);
240
- // console.log('跳过的订单索引:', liqResult.pass_order_id);
241
- // console.log('需要强平的订单数量:', liqResult.force_close_num);
242
- // console.log('理想 SOL 获得量:', liqResult.ideal_lp_sol_amount.toString());
243
- // console.log('实际 SOL 获得量:', liqResult.real_lp_sol_amount.toString());
233
+ // console.log('\n=== calcLiqTokenSell return result ===');
234
+ // console.log('Free liquidity SOL total:', liqResult.free_lp_sol_amount_sum.toString());
235
+ // console.log('Free liquidity Token total:', liqResult.free_lp_token_amount_sum.toString());
236
+ // console.log('Locked liquidity SOL total:', liqResult.lock_lp_sol_amount_sum.toString());
237
+ // console.log('Locked liquidity Token total:', liqResult.lock_lp_token_amount_sum.toString());
238
+ // console.log('Whether includes infinite liquidity:', liqResult.has_infinite_lp);
239
+ // console.log('Skipped order index:', liqResult.pass_order_id);
240
+ // console.log('Number of orders needing force close:', liqResult.force_close_num);
241
+ // console.log('Ideal SOL obtained:', liqResult.ideal_lp_sol_amount.toString());
242
+ // console.log('Actual SOL obtained:', liqResult.real_lp_sol_amount.toString());
244
243
  // console.log('===============================\n');
245
244
 
246
245
  // Convert to BigInt for calculations