@clonegod/ttd-bsc-common 1.0.2 → 1.0.3

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.
@@ -16,15 +16,4 @@ export declare abstract class BaseTxParser implements ITxParser {
16
16
  priority_fee: number;
17
17
  total_fee: number;
18
18
  };
19
- protected parseClmmSwapEvent(logs: any[], poolAddress: string): {
20
- amount0: ethers.BigNumber;
21
- amount1: ethers.BigNumber;
22
- sqrtPriceX96: ethers.BigNumber;
23
- liquidity: ethers.BigNumber;
24
- tick: number;
25
- protocolFeesToken0: ethers.BigNumber;
26
- protocolFeesToken1: ethers.BigNumber;
27
- sender?: string;
28
- recipient?: string;
29
- };
30
19
  }
@@ -62,47 +62,5 @@ class BaseTxParser {
62
62
  };
63
63
  }
64
64
  }
65
- parseClmmSwapEvent(logs, poolAddress) {
66
- const swapEventTopic = '0x19b47279256b2a23a1665c810c8d55a1758940ee09377d4f8d26497a3577dc83';
67
- const swapLog = logs.find(log => log.address.toLowerCase() === poolAddress.toLowerCase() &&
68
- log.topics[0].toLowerCase() === swapEventTopic.toLowerCase());
69
- if (!swapLog) {
70
- console.error('找不到Swap事件,所有日志:', logs.map(l => ({
71
- address: l.address,
72
- topics: l.topics
73
- })));
74
- throw new Error(`找不到池子 ${poolAddress} 的Swap事件`);
75
- }
76
- try {
77
- const decodedData = ethers_1.ethers.utils.defaultAbiCoder.decode(['int256', 'int256', 'uint160', 'uint128', 'int24', 'uint128', 'uint128'], swapLog.data);
78
- let sender = undefined;
79
- let recipient = undefined;
80
- if (swapLog.topics.length > 1) {
81
- sender = ethers_1.ethers.utils.defaultAbiCoder.decode(['address'], ethers_1.ethers.utils.hexZeroPad(swapLog.topics[1], 32))[0];
82
- }
83
- if (swapLog.topics.length > 2) {
84
- recipient = ethers_1.ethers.utils.defaultAbiCoder.decode(['address'], ethers_1.ethers.utils.hexZeroPad(swapLog.topics[2], 32))[0];
85
- }
86
- const [amount0, amount1, sqrtPriceX96, liquidity, tick, protocolFeesToken0, protocolFeesToken1] = decodedData;
87
- return {
88
- amount0,
89
- amount1,
90
- sqrtPriceX96,
91
- liquidity,
92
- tick,
93
- protocolFeesToken0,
94
- protocolFeesToken1,
95
- sender,
96
- recipient
97
- };
98
- }
99
- catch (error) {
100
- console.error('解析Swap事件失败:', error, {
101
- logData: swapLog ? swapLog.data : 'No log',
102
- logTopics: swapLog ? swapLog.topics : 'No log'
103
- });
104
- throw new Error(`解析Swap事件失败: ${error.message}`);
105
- }
106
- }
107
65
  }
108
66
  exports.BaseTxParser = BaseTxParser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",