@clonegod/ttd-core 3.1.72 → 3.1.74
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/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/trade/evm_gas_args.d.ts +30 -0
- package/dist/trade/evm_gas_args.js +42 -0
- package/dist/trade/index.d.ts +1 -0
- package/dist/trade/index.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -65,8 +65,9 @@ export declare enum DEX_ID {
|
|
|
65
65
|
PANCAKE_CLAMM = "PANCAKE-CLAMM",
|
|
66
66
|
PANCAKE_BIN = "PANCAKE-BIN",
|
|
67
67
|
AERODROME_AMM = "AERODROME-AMM",
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
AERODROME_SLIPSTREAMV1 = "AERODROME-SLIPSTREAMV1",
|
|
69
|
+
AERODROME_SLIPSTREAMV2 = "AERODROME-SLIPSTREAMV2",
|
|
70
|
+
AERODROME_SLIPSTREAMV3 = "AERODROME-SLIPSTREAMV3",
|
|
70
71
|
UNISWAP_AMM = "UNISWAP-AMM",
|
|
71
72
|
UNISWAP_CLMM = "UNISWAP-CLMM",
|
|
72
73
|
UNISWAP_V4 = "UNISWAP-V4",
|
package/dist/index.js
CHANGED
|
@@ -150,8 +150,9 @@ var DEX_ID;
|
|
|
150
150
|
DEX_ID["PANCAKE_CLAMM"] = "PANCAKE-CLAMM";
|
|
151
151
|
DEX_ID["PANCAKE_BIN"] = "PANCAKE-BIN";
|
|
152
152
|
DEX_ID["AERODROME_AMM"] = "AERODROME-AMM";
|
|
153
|
-
DEX_ID["
|
|
154
|
-
DEX_ID["
|
|
153
|
+
DEX_ID["AERODROME_SLIPSTREAMV1"] = "AERODROME-SLIPSTREAMV1";
|
|
154
|
+
DEX_ID["AERODROME_SLIPSTREAMV2"] = "AERODROME-SLIPSTREAMV2";
|
|
155
|
+
DEX_ID["AERODROME_SLIPSTREAMV3"] = "AERODROME-SLIPSTREAMV3";
|
|
155
156
|
DEX_ID["UNISWAP_AMM"] = "UNISWAP-AMM";
|
|
156
157
|
DEX_ID["UNISWAP_CLMM"] = "UNISWAP-CLMM";
|
|
157
158
|
DEX_ID["UNISWAP_V4"] = "UNISWAP-V4";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface EvmGasStrategy {
|
|
2
|
+
evm_tx_type?: 0 | 2;
|
|
3
|
+
evm_gas_limit?: number;
|
|
4
|
+
evm_gas_price_gwei?: number;
|
|
5
|
+
evm_max_fee_per_gas_gwei?: number;
|
|
6
|
+
evm_max_priority_fee_per_gas_gwei?: number;
|
|
7
|
+
evm_tip_amount_gwei?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface EvmGasDefaults {
|
|
10
|
+
gasLimit: number;
|
|
11
|
+
gasPriceGwei: number;
|
|
12
|
+
tipAmountGwei: number;
|
|
13
|
+
}
|
|
14
|
+
export interface EvmGasCaps {
|
|
15
|
+
gasLimit: number;
|
|
16
|
+
gasPriceGwei: number;
|
|
17
|
+
maxFeePerGasGwei: number;
|
|
18
|
+
maxPriorityFeePerGasGwei: number;
|
|
19
|
+
tipAmountGwei: number;
|
|
20
|
+
}
|
|
21
|
+
export interface EvmGasArgs {
|
|
22
|
+
gasLimit: number;
|
|
23
|
+
txType: 0 | 2;
|
|
24
|
+
gasPriceGwei?: number;
|
|
25
|
+
maxFeePerGasGwei?: number;
|
|
26
|
+
maxPriorityFeePerGasGwei?: number;
|
|
27
|
+
tipGasPriceGwei: number;
|
|
28
|
+
tipAmountGwei: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function buildEvmGasArgs(strategy: EvmGasStrategy, defaults: EvmGasDefaults, caps: EvmGasCaps): EvmGasArgs;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildEvmGasArgs = buildEvmGasArgs;
|
|
4
|
+
function buildEvmGasArgs(strategy, defaults, caps) {
|
|
5
|
+
var _a;
|
|
6
|
+
const rawGasLimit = strategy.evm_gas_limit && strategy.evm_gas_limit > 0
|
|
7
|
+
? strategy.evm_gas_limit
|
|
8
|
+
: defaults.gasLimit;
|
|
9
|
+
const gasLimit = Math.min(rawGasLimit, caps.gasLimit);
|
|
10
|
+
const rawLegacyGasPrice = strategy.evm_gas_price_gwei && strategy.evm_gas_price_gwei > 0
|
|
11
|
+
? strategy.evm_gas_price_gwei
|
|
12
|
+
: defaults.gasPriceGwei;
|
|
13
|
+
const legacyGasPrice = Math.min(rawLegacyGasPrice, caps.gasPriceGwei);
|
|
14
|
+
const rawTipAmount = strategy.evm_tip_amount_gwei && strategy.evm_tip_amount_gwei > 0
|
|
15
|
+
? strategy.evm_tip_amount_gwei
|
|
16
|
+
: defaults.tipAmountGwei;
|
|
17
|
+
const tipAmountGwei = Math.min(rawTipAmount, caps.tipAmountGwei);
|
|
18
|
+
const tipGasPriceGwei = legacyGasPrice;
|
|
19
|
+
if (strategy.evm_tx_type === 2) {
|
|
20
|
+
const rawMaxFee = strategy.evm_max_fee_per_gas_gwei && strategy.evm_max_fee_per_gas_gwei > 0
|
|
21
|
+
? strategy.evm_max_fee_per_gas_gwei
|
|
22
|
+
: caps.maxFeePerGasGwei;
|
|
23
|
+
const maxFeePerGasGwei = Math.min(rawMaxFee, caps.maxFeePerGasGwei);
|
|
24
|
+
const rawMaxPriority = (_a = strategy.evm_max_priority_fee_per_gas_gwei) !== null && _a !== void 0 ? _a : 0;
|
|
25
|
+
const maxPriorityFeePerGasGwei = Math.min(rawMaxPriority, caps.maxPriorityFeePerGasGwei);
|
|
26
|
+
return {
|
|
27
|
+
gasLimit,
|
|
28
|
+
txType: 2,
|
|
29
|
+
maxFeePerGasGwei,
|
|
30
|
+
maxPriorityFeePerGasGwei,
|
|
31
|
+
tipGasPriceGwei,
|
|
32
|
+
tipAmountGwei,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
gasLimit,
|
|
37
|
+
txType: 0,
|
|
38
|
+
gasPriceGwei: legacyGasPrice,
|
|
39
|
+
tipGasPriceGwei,
|
|
40
|
+
tipAmountGwei,
|
|
41
|
+
};
|
|
42
|
+
}
|
package/dist/trade/index.d.ts
CHANGED
package/dist/trade/index.js
CHANGED
|
@@ -18,3 +18,4 @@ __exportStar(require("./abstract_trade"), exports);
|
|
|
18
18
|
__exportStar(require("./abstract_tx_check"), exports);
|
|
19
19
|
__exportStar(require("./trade_context"), exports);
|
|
20
20
|
__exportStar(require("./handle_order_message"), exports);
|
|
21
|
+
__exportStar(require("./evm_gas_args"), exports);
|