@clonegod/ttd-core 2.0.40 → 2.0.41
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.
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const EvmChainConfig: {
|
|
2
|
+
ETH: {
|
|
3
|
+
chain_id: number;
|
|
4
|
+
chain_short_name: string;
|
|
5
|
+
chain_full_name: string;
|
|
6
|
+
weth_addr: string;
|
|
7
|
+
};
|
|
8
|
+
BASE: {
|
|
9
|
+
chain_id: number;
|
|
10
|
+
chain_short_name: string;
|
|
11
|
+
chain_full_name: string;
|
|
12
|
+
weth_addr: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export type EvmChainInfoType = {
|
|
16
|
+
chain_id: number;
|
|
17
|
+
chain_short_name: string;
|
|
18
|
+
chain_full_name: string;
|
|
19
|
+
weth_addr: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EvmChainConfig = void 0;
|
|
4
|
+
exports.EvmChainConfig = {
|
|
5
|
+
ETH: {
|
|
6
|
+
chain_id: 1,
|
|
7
|
+
chain_short_name: 'ETH',
|
|
8
|
+
chain_full_name: 'ETHEREUM',
|
|
9
|
+
weth_addr: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2".toLowerCase(),
|
|
10
|
+
},
|
|
11
|
+
BASE: {
|
|
12
|
+
chain_id: 8453,
|
|
13
|
+
chain_short_name: 'BASE',
|
|
14
|
+
chain_full_name: 'BASE',
|
|
15
|
+
weth_addr: "0x4200000000000000000000000000000000000006".toLowerCase(),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { FormattedTokenPrice } from "../types";
|
|
2
|
-
|
|
2
|
+
import { EvmChainInfoType } from '../../chains';
|
|
3
|
+
export declare function get_eth_token_price_info(evm_chain_info: EvmChainInfoType, addresses: string[]): Promise<Map<string, FormattedTokenPrice>>;
|
|
@@ -18,7 +18,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
18
18
|
const index_1 = require("../../index");
|
|
19
19
|
const gecko_terminal_1 = require("./gecko_terminal");
|
|
20
20
|
const price_cache_1 = require("./price_cache");
|
|
21
|
-
function get_eth_token_price_info(addresses) {
|
|
21
|
+
function get_eth_token_price_info(evm_chain_info, addresses) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
addresses = addresses.map(addr => addr.toLowerCase());
|
|
24
24
|
const result = new Map();
|
|
@@ -31,13 +31,13 @@ function get_eth_token_price_info(addresses) {
|
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
name: 'Uniswap',
|
|
34
|
-
fetchFn: fetchPriceFromUniSwap,
|
|
34
|
+
fetchFn: (address_list) => fetchPriceFromUniSwap(evm_chain_info.chain_full_name, address_list),
|
|
35
35
|
batchSize: 10,
|
|
36
36
|
batchDelay: 1000,
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
name: 'GeckoTerminal',
|
|
40
|
-
fetchFn: (address_list) => (0, gecko_terminal_1.fetchPriceFromGeckoTerminal)(
|
|
40
|
+
fetchFn: (address_list) => (0, gecko_terminal_1.fetchPriceFromGeckoTerminal)(evm_chain_info.chain_short_name, address_list),
|
|
41
41
|
batchSize: 10,
|
|
42
42
|
batchDelay: 2000,
|
|
43
43
|
},
|
|
@@ -92,7 +92,7 @@ function get_eth_token_price_info(addresses) {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
function fetchPriceFromUniSwap(addresses) {
|
|
95
|
+
function fetchPriceFromUniSwap(chain_name, addresses) {
|
|
96
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
97
|
var _a, _b, _c, _d;
|
|
98
98
|
const result = new Map();
|
|
@@ -114,7 +114,7 @@ function fetchPriceFromUniSwap(addresses) {
|
|
|
114
114
|
const variables = {
|
|
115
115
|
contracts: addresses.map(address => ({
|
|
116
116
|
address: address,
|
|
117
|
-
chain:
|
|
117
|
+
chain: chain_name
|
|
118
118
|
}))
|
|
119
119
|
};
|
|
120
120
|
const headers = {
|
|
@@ -155,14 +155,4 @@ function fetchPriceFromUniSwap(addresses) {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
if (require.main === module) {
|
|
158
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
159
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
160
|
-
let addresses = [
|
|
161
|
-
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
162
|
-
"0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
163
|
-
"0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
|
|
164
|
-
];
|
|
165
|
-
console.log(yield get_eth_token_price_info(addresses));
|
|
166
|
-
}))();
|
|
167
|
-
}))();
|
|
168
158
|
}
|