@clonegod/ttd-sui-common 2.0.19 → 2.0.21

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.
@@ -359,12 +359,12 @@ class AbstractSuiDexTrade extends dist_1.AbastrcatTrade {
359
359
  amountIn: BigInt(q.amountIn),
360
360
  minOut: BigInt(q.amountOutMin),
361
361
  sqrtPriceLimit: 0n,
362
+ pair: pool_info.pair,
362
363
  gasPriceMultiplier: gasMult,
363
364
  };
364
- (0, dist_1.log_info)(`[trade] 转发 swap 给集中执行器 gasMult=${gasMult ?? '(无)'}`, {
365
+ (0, dist_1.log_info)(`[trade] 转发 swap 给集中执行器`, {
365
366
  dex_id: req.dexId, pair: pool_info.pair, a2b, amountIn: req.amountIn.toString(), minOut: req.minOut.toString(),
366
- gasPriceMultiplier: gasMult ?? null,
367
- strategy_raw: this.appConfig.trade_runtime.settings?.strategy ?? null,
367
+ ...(gasMult ? { gasPriceMultiplier: gasMult } : {}),
368
368
  });
369
369
  const res = await this.executorClient.requestSwap(req);
370
370
  if (!res.submitted) {
@@ -12,6 +12,7 @@ export interface SwapExecRequest {
12
12
  minOut: bigint;
13
13
  sqrtPriceLimit: bigint;
14
14
  walletAddress?: string;
15
+ pair?: string;
15
16
  gasPriceMultiplier?: number;
16
17
  }
17
18
  export interface SwapExecResult {
@@ -39,16 +39,26 @@ class InProcessCoinCache {
39
39
  version: c.version,
40
40
  balance: this.fmt(coinType, BigInt(c.balance)),
41
41
  }));
42
- const detail = {
43
- reason, wallet, symbol, coinType,
44
- total: this.fmt(coinType, grand),
45
- address_balance: this.fmt(coinType, ab),
46
- objects_total: this.fmt(coinType, objT),
47
- available_count: avail.length, available_total: this.fmt(coinType, availT), available: mapObj(avail),
48
- in_use_count: inUse.length, in_use_total: this.fmt(coinType, useT), in_use: mapObj(inUse),
49
- };
50
42
  const useStr = inUse.length ? ` +${inUse.length}个交易中` : '';
51
- const header = `[coin-cache] ${reason} ${symbol}: 共 ${this.fmt(coinType, grand)} = 对象 ${this.fmt(coinType, objT)}(${avail.length}个${useStr}) + address-balance ${this.fmt(coinType, ab)}`;
43
+ const header = `[coin-cache] ${reason} ${wallet.slice(0, 8)}… ${symbol}: 共 ${this.fmt(coinType, grand)} = 对象 ${this.fmt(coinType, objT)}(${avail.length}个${useStr}) + address-balance ${this.fmt(coinType, ab)}`;
44
+ if (avail.length === 0 && inUse.length === 0) {
45
+ if (quiet)
46
+ (0, dist_1.log_debug)(header);
47
+ else
48
+ (0, dist_1.log_info)(header);
49
+ return;
50
+ }
51
+ const detail = { reason, wallet, symbol, coinType, total: this.fmt(coinType, grand), address_balance: this.fmt(coinType, ab) };
52
+ if (avail.length) {
53
+ detail.available_count = avail.length;
54
+ detail.available_total = this.fmt(coinType, availT);
55
+ detail.available = mapObj(avail);
56
+ }
57
+ if (inUse.length) {
58
+ detail.in_use_count = inUse.length;
59
+ detail.in_use_total = this.fmt(coinType, useT);
60
+ detail.in_use = mapObj(inUse);
61
+ }
52
62
  if (quiet)
53
63
  (0, dist_1.log_debug)(header, detail);
54
64
  else
@@ -10,6 +10,8 @@ export interface SwapExecRequestWire {
10
10
  minOut: string;
11
11
  sqrtPriceLimit: string;
12
12
  walletAddress?: string;
13
+ pair?: string;
14
+ gasPriceMultiplier?: number;
13
15
  }
14
16
  export interface ExecRequestEnvelope {
15
17
  type: 'swap';
@@ -15,6 +15,8 @@ function toWire(req) {
15
15
  minOut: req.minOut.toString(),
16
16
  sqrtPriceLimit: req.sqrtPriceLimit.toString(),
17
17
  walletAddress: req.walletAddress,
18
+ pair: req.pair,
19
+ gasPriceMultiplier: req.gasPriceMultiplier,
18
20
  };
19
21
  }
20
22
  function fromWire(w) {
@@ -28,5 +30,7 @@ function fromWire(w) {
28
30
  minOut: BigInt(w.minOut),
29
31
  sqrtPriceLimit: BigInt(w.sqrtPriceLimit),
30
32
  walletAddress: w.walletAddress,
33
+ pair: w.pair,
34
+ gasPriceMultiplier: w.gasPriceMultiplier,
31
35
  };
32
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sui-common",
3
- "version": "2.0.19",
3
+ "version": "2.0.21",
4
4
  "description": "Sui common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",