@clonegod/ttd-core 2.0.99 → 2.1.1

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 CHANGED
@@ -41,15 +41,13 @@ export declare enum CHAIN_ID {
41
41
  export declare enum DEX_ID {
42
42
  SUNSWAP_AMM = "SUNSWAP-AMM",
43
43
  SUNSWAP_CLMM = "SUNSWAP-CLMM",
44
- SUNSWAP_V2 = "SUNSWAP-V2",
45
- SUNSWAP_V3 = "SUNSWAP-V3",
46
44
  RAYDIUM_AMM = "RAYDIUM-AMM",
47
45
  RAYDIUM_CLMM = "RAYDIUM-CLMM",
48
46
  RAYDIUM_CPMM = "RAYDIUM-CPMM",
49
47
  ORCA_CLMM = "ORCA-CLMM",
50
48
  METEORA_DLMM = "METEORA-DLMM",
51
49
  METEORA_AMM = "METEORA-AMM",
52
- PUMPFUN_AMM = "PUMPFUN-AMM",
50
+ PUMPSWAP_AMM = "PUMPSWAP-AMM",
53
51
  JUPITER_AGGR = "JUPITER-AGGR",
54
52
  BYREAL_CLMM = "BYREAL-CLMM",
55
53
  PANCAKE_AMM = "PANCAKE-AMM",
package/dist/index.js CHANGED
@@ -125,15 +125,13 @@ var DEX_ID;
125
125
  (function (DEX_ID) {
126
126
  DEX_ID["SUNSWAP_AMM"] = "SUNSWAP-AMM";
127
127
  DEX_ID["SUNSWAP_CLMM"] = "SUNSWAP-CLMM";
128
- DEX_ID["SUNSWAP_V2"] = "SUNSWAP-V2";
129
- DEX_ID["SUNSWAP_V3"] = "SUNSWAP-V3";
130
128
  DEX_ID["RAYDIUM_AMM"] = "RAYDIUM-AMM";
131
129
  DEX_ID["RAYDIUM_CLMM"] = "RAYDIUM-CLMM";
132
130
  DEX_ID["RAYDIUM_CPMM"] = "RAYDIUM-CPMM";
133
131
  DEX_ID["ORCA_CLMM"] = "ORCA-CLMM";
134
132
  DEX_ID["METEORA_DLMM"] = "METEORA-DLMM";
135
133
  DEX_ID["METEORA_AMM"] = "METEORA-AMM";
136
- DEX_ID["PUMPFUN_AMM"] = "PUMPFUN-AMM";
134
+ DEX_ID["PUMPSWAP_AMM"] = "PUMPSWAP-AMM";
137
135
  DEX_ID["JUPITER_AGGR"] = "JUPITER-AGGR";
138
136
  DEX_ID["BYREAL_CLMM"] = "BYREAL-CLMM";
139
137
  DEX_ID["PANCAKE_AMM"] = "PANCAKE-AMM";
@@ -109,7 +109,7 @@ function get_cu_limit(dex_id) {
109
109
  case index_1.DEX_ID.METEORA_DLMM:
110
110
  cu_limit = 80000;
111
111
  break;
112
- case index_1.DEX_ID.PUMPFUN_AMM:
112
+ case index_1.DEX_ID.PUMPSWAP_AMM:
113
113
  cu_limit = 200000;
114
114
  break;
115
115
  }
@@ -18,6 +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
+ const defi_llama_1 = require("./defi_llama");
21
22
  function get_solana_token_price_info(addresses) {
22
23
  return __awaiter(this, void 0, void 0, function* () {
23
24
  const result = new Map();
@@ -34,6 +35,12 @@ function get_solana_token_price_info(addresses) {
34
35
  batchSize: 10,
35
36
  batchDelay: 1000,
36
37
  },
38
+ {
39
+ name: 'DefiLlama',
40
+ fetchFn: (address_list) => (0, defi_llama_1.fetchPriceFromDefiLlama)(index_1.CHAIN_ID.SOLANA, address_list),
41
+ batchSize: 10,
42
+ batchDelay: 1000,
43
+ },
37
44
  {
38
45
  name: 'GeckoTerminal',
39
46
  fetchFn: (address_list) => (0, gecko_terminal_1.fetchPriceFromGeckoTerminal)(index_1.CHAIN_ID.SOLANA, address_list),
@@ -99,19 +106,19 @@ function fetchPriceFromJupiter(addresses) {
99
106
  const timeout = 10000;
100
107
  const maxRetries = 2;
101
108
  const retrysleepMs = 500;
102
- const url = `https://api.jup.ag/price/v2?ids=${addresses.join(',')}&showExtraInfo=false`;
109
+ const url = `https://lite-api.jup.ag/price/v3?ids=${addresses.join(',')}`;
103
110
  (0, index_1.log_debug)(`[fetchPriceFromJupiter] Requesting Jupiter API for ${addresses.length} tokens`);
104
111
  let retryCount = 0;
105
112
  while (retryCount <= maxRetries) {
106
113
  try {
107
114
  const response = yield axios_1.default.get(url, { timeout });
108
- if (response.data.data) {
115
+ if (response.data) {
109
116
  for (const address of addresses) {
110
117
  const key = address;
111
- if (response.data.data[key] !== undefined) {
118
+ if (response.data[key] !== undefined) {
112
119
  result.set(address, {
113
120
  address: address,
114
- price: response.data.data[key]['price'].toString(),
121
+ price: response.data[key]['usdPrice'].toString(),
115
122
  symbol: '',
116
123
  name: '',
117
124
  update_time: currentTime
@@ -145,6 +152,5 @@ if (require.main === module) {
145
152
  "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
146
153
  "MEW1gQWJ3nEXg2qgERiKu7FAFj79PHvQVREQUzScPP5",
147
154
  ];
148
- console.log(yield get_solana_token_price_info(addresses));
149
155
  }))();
150
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-core",
3
- "version": "2.0.99",
3
+ "version": "2.1.1",
4
4
  "description": "Common types and utilities for trading systems - use `npm run push` to publish",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",