@clonegod/ttd-core 3.1.11 → 3.1.12
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/chains/evm_gas_options.d.ts +9 -0
- package/dist/chains/evm_gas_options.js +2 -0
- package/dist/pool/pool_util.js +1 -1
- package/dist/token/fixed_symbol_address.d.ts +1 -1
- package/dist/token/fixed_symbol_address.js +15 -9
- package/dist/token/token_util.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +6 -5
package/dist/pool/pool_util.js
CHANGED
|
@@ -31,7 +31,7 @@ function get_pair_name(native_token, pool_name) {
|
|
|
31
31
|
function check_pool_token_address(pool) {
|
|
32
32
|
let { pool_name, pool_address, tokenA, tokenB } = pool;
|
|
33
33
|
for (let token of [tokenA, tokenB]) {
|
|
34
|
-
let is_fake_token = token_1.
|
|
34
|
+
let is_fake_token = (0, token_1.get_fixed_symbol_address)().some(e => e.symbol === token.symbol && e.address.toLowerCase() !== token.address.toLowerCase());
|
|
35
35
|
if (is_fake_token) {
|
|
36
36
|
throw new Error(`Invalid token address of ${token.symbol}: ${token.address}, ${pool_name}, ${pool_address}`);
|
|
37
37
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TokenFixedSymbolAddress } from './types';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const get_fixed_symbol_address: () => TokenFixedSymbolAddress[];
|
|
@@ -3,25 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.get_fixed_symbol_address = void 0;
|
|
7
7
|
require('dotenv').config();
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const index_1 = require("../index");
|
|
11
|
+
let _first_load_logged = false;
|
|
11
12
|
const get_fixed_symbol_address = () => {
|
|
12
|
-
|
|
13
|
+
const chain_id = process.env.CHAIN_ID;
|
|
13
14
|
if (!chain_id) {
|
|
14
15
|
return [];
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const filepath = process.env.BSC_FIXED_SYMBOL_ADDRESS_FILE ||
|
|
18
|
+
path_1.default.join(os_1.default.homedir(), 'data', 'onchain_data', chain_id.toLowerCase(), 'fixed_symbol_address.json');
|
|
19
|
+
const print_log = process.env.PRINT_FIXED_SYMBOL_ADDRESS === 'true';
|
|
20
|
+
let list = [];
|
|
19
21
|
try {
|
|
20
|
-
|
|
22
|
+
list = (0, index_1.readFile)(filepath, true, true);
|
|
23
|
+
if (print_log && !_first_load_logged) {
|
|
24
|
+
(0, index_1.log_info)(`[fixed_symbol_address] loaded ${list.length} entries from ${filepath}`);
|
|
25
|
+
_first_load_logged = true;
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
catch (error) {
|
|
23
|
-
|
|
29
|
+
(0, index_1.log_error)(`[fixed_symbol_address] load failed from ${filepath}`, error);
|
|
24
30
|
}
|
|
25
|
-
return
|
|
31
|
+
return list;
|
|
26
32
|
};
|
|
27
|
-
exports.
|
|
33
|
+
exports.get_fixed_symbol_address = get_fixed_symbol_address;
|
package/dist/token/token_util.js
CHANGED
|
@@ -21,6 +21,6 @@ const is_valid_symbol = (symbol) => {
|
|
|
21
21
|
};
|
|
22
22
|
exports.is_valid_symbol = is_valid_symbol;
|
|
23
23
|
function get_token_symbol_alias(token_address) {
|
|
24
|
-
let token = __1.
|
|
24
|
+
let token = (0, __1.get_fixed_symbol_address)().find(e => e.address === token_address);
|
|
25
25
|
return (token === null || token === void 0 ? void 0 : token.alias) || '';
|
|
26
26
|
}
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -177,13 +177,14 @@ export interface TradeStrategyType {
|
|
|
177
177
|
max_block_offset: number // Solana特定:限制交易在多少个区块内有效(约等于秒数,1 block ≈ 0.4秒)。使用最新blockhash,设置lastValidBlockHeight = currentBlockHeight + max_block_offset
|
|
178
178
|
|
|
179
179
|
// evm chain
|
|
180
|
+
evm_tx_type: 0 | 2 // 交易类型:0=Legacy, 2=EIP-1559
|
|
180
181
|
evm_gas_limit: number // 300000
|
|
181
|
-
evm_gas_price_gwei: number //
|
|
182
|
-
evm_tip_amount_gwei: number //
|
|
182
|
+
evm_gas_price_gwei: number // Legacy: gasPrice(Gwei)
|
|
183
|
+
evm_tip_amount_gwei: number // Builder tip(Gwei),独立原生代币转账
|
|
183
184
|
|
|
184
|
-
// evm EIP-1559
|
|
185
|
-
|
|
186
|
-
evm_max_priority_fee_per_gas_gwei: number //
|
|
185
|
+
// evm EIP-1559 (Type 2)
|
|
186
|
+
evm_max_fee_per_gas_gwei: number // Type2: maxFeePerGas(Gwei)
|
|
187
|
+
evm_max_priority_fee_per_gas_gwei: number // Type2: maxPriorityFeePerGas(Gwei),允许为 0
|
|
187
188
|
|
|
188
189
|
// sui
|
|
189
190
|
gas_price: number // default
|