@clonegod/ttd-bsc-common 1.0.33 → 1.0.35
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.
- package/dist/config/bsc_env_args.d.ts +1 -1
- package/dist/config/bsc_env_args.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ws/subscribe_v2_events.d.ts +1 -1
- package/dist/ws/subscribe_v2_events.js +5 -5
- package/dist/ws/subscribe_v3_events.d.ts +3 -1
- package/dist/ws/subscribe_v3_events.js +9 -6
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BscEnvArgs = void 0;
|
|
4
|
-
const
|
|
4
|
+
const dist_1 = require("@clonegod/ttd-core/dist");
|
|
5
5
|
const decimal_js_1 = require("decimal.js");
|
|
6
|
-
class BscEnvArgs extends
|
|
6
|
+
class BscEnvArgs extends dist_1.EnvArgs {
|
|
7
7
|
constructor() {
|
|
8
8
|
super();
|
|
9
9
|
this.large_trade_threshold_usd = parseInt(process.env.LARGE_TRADE_THRESHOLD_USD || '500');
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -9,15 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.PancakeV2AmmPoolEventsSubscriber = void 0;
|
|
13
13
|
const ethers_1 = require("ethers");
|
|
14
14
|
const event_filter_1 = require("./event_filter");
|
|
15
|
-
const
|
|
15
|
+
const PANCAKE_V2_POOL_ABI = [
|
|
16
16
|
'event Sync(uint112 reserve0, uint112 reserve1)',
|
|
17
17
|
'event Mint(address indexed sender, uint amount0, uint amount1)',
|
|
18
18
|
'event Burn(address indexed sender, uint amount0, uint amount1, address indexed to)'
|
|
19
19
|
];
|
|
20
|
-
class
|
|
20
|
+
class PancakeV2AmmPoolEventsSubscriber {
|
|
21
21
|
constructor(wsUrl, poolAddress) {
|
|
22
22
|
this.wsUrl = wsUrl;
|
|
23
23
|
this.poolAddress = poolAddress;
|
|
@@ -37,7 +37,7 @@ class UniswapV2AmmPoolEventsSubscriber {
|
|
|
37
37
|
throw new Error(`wsUrl and poolAddress are required! wsUrl=${this.wsUrl} poolAddress=${this.poolAddress}`);
|
|
38
38
|
}
|
|
39
39
|
this.provider = new ethers_1.ethers.providers.WebSocketProvider(this.wsUrl);
|
|
40
|
-
this.poolContract = new ethers_1.ethers.Contract(this.poolAddress,
|
|
40
|
+
this.poolContract = new ethers_1.ethers.Contract(this.poolAddress, PANCAKE_V2_POOL_ABI, this.provider);
|
|
41
41
|
this.isConnected = true;
|
|
42
42
|
console.log(`Connected to WebSocket: ${this.wsUrl} for pool: ${this.poolAddress}`);
|
|
43
43
|
this.provider._websocket.on('error', (error) => {
|
|
@@ -171,4 +171,4 @@ class UniswapV2AmmPoolEventsSubscriber {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
exports.
|
|
174
|
+
exports.PancakeV2AmmPoolEventsSubscriber = PancakeV2AmmPoolEventsSubscriber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class
|
|
1
|
+
export declare class PancakeV3PoolEventsSubscriber {
|
|
2
2
|
private wsUrl;
|
|
3
3
|
private poolAddress;
|
|
4
4
|
private provider;
|
|
@@ -12,3 +12,5 @@ export declare class UniswapV3PoolEventsSubscriber {
|
|
|
12
12
|
disconnect(): Promise<void>;
|
|
13
13
|
_reconnect(): void;
|
|
14
14
|
}
|
|
15
|
+
export declare class UniswapV3PoolEventsSubscriber extends PancakeV3PoolEventsSubscriber {
|
|
16
|
+
}
|
|
@@ -9,15 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UniswapV3PoolEventsSubscriber = void 0;
|
|
12
|
+
exports.UniswapV3PoolEventsSubscriber = exports.PancakeV3PoolEventsSubscriber = void 0;
|
|
13
13
|
const ethers_1 = require("ethers");
|
|
14
14
|
const event_filter_1 = require("./event_filter");
|
|
15
|
-
const
|
|
16
|
-
'event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick)',
|
|
15
|
+
const PANCAKE_V3_POOL_ABI = [
|
|
16
|
+
'event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick, uint128 protocolFeesToken0, uint128 protocolFeesToken1)',
|
|
17
17
|
'event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1)',
|
|
18
18
|
'event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1)'
|
|
19
19
|
];
|
|
20
|
-
class
|
|
20
|
+
class PancakeV3PoolEventsSubscriber {
|
|
21
21
|
constructor(wsUrl, poolAddress) {
|
|
22
22
|
this.wsUrl = wsUrl;
|
|
23
23
|
this.poolAddress = poolAddress;
|
|
@@ -37,7 +37,7 @@ class UniswapV3PoolEventsSubscriber {
|
|
|
37
37
|
throw new Error(`wsUrl and poolAddress are required! wsUrl=${this.wsUrl} poolAddress=${this.poolAddress}`);
|
|
38
38
|
}
|
|
39
39
|
this.provider = new ethers_1.ethers.providers.WebSocketProvider(this.wsUrl);
|
|
40
|
-
this.poolContract = new ethers_1.ethers.Contract(this.poolAddress,
|
|
40
|
+
this.poolContract = new ethers_1.ethers.Contract(this.poolAddress, PANCAKE_V3_POOL_ABI, this.provider);
|
|
41
41
|
this.isConnected = true;
|
|
42
42
|
console.log(`Connected to WebSocket: ${this.wsUrl} for pool: ${this.poolAddress}`);
|
|
43
43
|
this.provider._websocket.on('error', (error) => {
|
|
@@ -67,7 +67,7 @@ class UniswapV3PoolEventsSubscriber {
|
|
|
67
67
|
}
|
|
68
68
|
this.eventCallbacks[eventType.toLowerCase()] = callback;
|
|
69
69
|
if (eventType.toLowerCase() === 'swap') {
|
|
70
|
-
this.poolContract.on('Swap', (sender, recipient, amount0, amount1, sqrtPriceX96, liquidity, tick, event) => {
|
|
70
|
+
this.poolContract.on('Swap', (sender, recipient, amount0, amount1, sqrtPriceX96, liquidity, tick, protocolFeesToken0, protocolFeesToken1, event) => {
|
|
71
71
|
const data = {
|
|
72
72
|
pool_address: this.poolAddress,
|
|
73
73
|
type: 'swap',
|
|
@@ -171,4 +171,7 @@ class UniswapV3PoolEventsSubscriber {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
exports.PancakeV3PoolEventsSubscriber = PancakeV3PoolEventsSubscriber;
|
|
175
|
+
class UniswapV3PoolEventsSubscriber extends PancakeV3PoolEventsSubscriber {
|
|
176
|
+
}
|
|
174
177
|
exports.UniswapV3PoolEventsSubscriber = UniswapV3PoolEventsSubscriber;
|