@defillama/sdk 5.0.218 → 5.0.220

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.
@@ -43,6 +43,7 @@
43
43
  "aura": "Aura Network",
44
44
  "aurora": "Aurora",
45
45
  "avax": "Avalanche",
46
+ "axiome": "Axiome",
46
47
  "b3": "B3",
47
48
  "babylon": "Babylon Genesis",
48
49
  "band": "BandChain",
@@ -146,6 +147,7 @@
146
147
  "echelon": "Echelon",
147
148
  "echelon_initia": "Echelon Initia",
148
149
  "eclipse": "Eclipse",
150
+ "eden": "Eden",
149
151
  "edgex": "edgeX L1",
150
152
  "elastos": "Elastos",
151
153
  "elrond": "MultiversX",
@@ -247,6 +249,7 @@
247
249
  "ink": "Ink",
248
250
  "inri": "INRI",
249
251
  "interlay": "Interlay",
252
+ "intuition": "Intuition",
250
253
  "iota": "IOTA",
251
254
  "iotaevm": "IOTA EVM",
252
255
  "iotex": "IoTeX",
@@ -307,7 +310,7 @@
307
310
  "metis": "Metis",
308
311
  "mezo": "Mezo",
309
312
  "migaloo": "Migaloo",
310
- "milkomeda": "Milkomeda C1 (Deprecated)",
313
+ "milkomeda": "Milkomeda C1",
311
314
  "milkomeda_a1": "Milkomeda A1",
312
315
  "milkyway": "Milkyway",
313
316
  "milkyway_rollup": "MilkyWay Rollup",
@@ -388,7 +391,7 @@
388
391
  "pharos": "Pharos",
389
392
  "planq": "Planq",
390
393
  "plasma": "Plasma",
391
- "plume": "Plume (Deprecated)",
394
+ "plume": "Plume",
392
395
  "plume_mainnet": "Plume Mainnet",
393
396
  "pokt": "Pokt",
394
397
  "polis": "Polis",
@@ -610,6 +613,7 @@
610
613
  "Aura Network": "aura",
611
614
  "Aurora": "aurora",
612
615
  "Avalanche": "avax",
616
+ "Axiome": "axiome",
613
617
  "B3": "b3",
614
618
  "BCHyper": "bcypher",
615
619
  "BESC Hyperchain": "besc",
@@ -724,6 +728,7 @@
724
728
  "Echelon Chain": "echelon_initia",
725
729
  "Echelon Initia": "echelon_initia",
726
730
  "Eclipse": "eclipse",
731
+ "Eden": "eden",
727
732
  "Elastos": "elastos",
728
733
  "Electroneum": "etn",
729
734
  "Elrond": "elrond",
@@ -823,6 +828,7 @@
823
828
  "Injective": "injective",
824
829
  "Ink": "ink",
825
830
  "Interlay": "interlay",
831
+ "Intuition": "intuition",
826
832
  "IoTeX": "iotex",
827
833
  "JBC": "jbc",
828
834
  "JOC": "joc",
@@ -977,6 +983,7 @@
977
983
  "Pharos": "pharos",
978
984
  "Planq": "planq",
979
985
  "Plasma": "plasma",
986
+ "Plume": "plume",
980
987
  "Plume (Deprecated)": "plume",
981
988
  "Plume Mainnet": "plume_mainnet",
982
989
  "Pokt": "pokt",
@@ -1180,5 +1187,69 @@
1180
1187
  "zkLink Nova": "zklink",
1181
1188
  "zkSync": "zksync",
1182
1189
  "zkSync Era": "era"
1190
+ },
1191
+ "deadChains": {
1192
+ "airdao": "2026-01-20",
1193
+ "artela": "2026-06-05",
1194
+ "astrzk": "2026-02-12",
1195
+ "bitrock": "2026-02-12",
1196
+ "boba_bnb": "2026-01-20",
1197
+ "btnx": "2026-07-09",
1198
+ "chainx": "2026-01-20",
1199
+ "corn": "2026-06-30",
1200
+ "crab": "2026-01-01",
1201
+ "cube": "2026-06-24",
1202
+ "curio": "2026-06-24",
1203
+ "dchainmainnet": "2026-06-24",
1204
+ "dfs": "2026-06-24",
1205
+ "echelon": "2023-10-20",
1206
+ "enuls": "2026-03-25",
1207
+ "eon": "2026-02-12",
1208
+ "eos_evm": "2026-02-12",
1209
+ "eventum": "2026-07-01",
1210
+ "evmos": "2026-05-18",
1211
+ "fhe": "2026-06-01",
1212
+ "fluence": "2026-04-08",
1213
+ "functionx": "2026-06-24",
1214
+ "genesys": "2026-03-01",
1215
+ "godwoken": "2026-01-06",
1216
+ "godwoken_v1": "2026-01-06",
1217
+ "grove": "2025-07-28",
1218
+ "ham": "2026-06-05",
1219
+ "heco": "2026-02-12",
1220
+ "inevm": "2026-04-08",
1221
+ "kadena": "2026-02-12",
1222
+ "kardia": "2026-01-20",
1223
+ "kinto": "2026-03-06",
1224
+ "kroma": "2026-01-20",
1225
+ "migaloo": "2026-02-12",
1226
+ "milkomeda": "2026-02-12",
1227
+ "milkomeda_a1": "2026-02-12",
1228
+ "milkyway": "2026-01-20",
1229
+ "milkyway_rollup": "2026-01-20",
1230
+ "mint": "2026-04-17",
1231
+ "nos": "2026-06-24",
1232
+ "nuls": "2026-03-25",
1233
+ "onus": "2026-06-05",
1234
+ "planq": "2026-06-05",
1235
+ "plume": "2026-02-12",
1236
+ "polygon_zkevm": "2026-07-01",
1237
+ "pryzm": "2026-02-09",
1238
+ "qom": "2026-01-20",
1239
+ "real": "2026-02-12",
1240
+ "redstone": "2026-05-18",
1241
+ "rpg": "2026-02-12",
1242
+ "saga": "2026-02-16",
1243
+ "soon_base": "2026-05-25",
1244
+ "stargaze": "2026-06-01",
1245
+ "swellchain": "2026-06-23",
1246
+ "sx": "2026-04-23",
1247
+ "tara": "2026-03-09",
1248
+ "tenet": "2026-04-22",
1249
+ "titan": "2026-05-05",
1250
+ "umee": "2026-07-10",
1251
+ "vision": "2026-02-20",
1252
+ "winr": "2026-05-01",
1253
+ "zksync": "2026-05-15"
1183
1254
  }
1184
1255
  }
@@ -2,5 +2,9 @@ import { chainKeyToChainLabelMap, chainLabelsToKeyMap } from './data.json';
2
2
  export { chainKeyToChainLabelMap, chainLabelsToKeyMap, };
3
3
  export declare function updateData(): Promise<void>;
4
4
  export declare const sluggifyString: (name: string) => string;
5
+ export declare function getSluggifiedChainLabel(label: string): string;
5
6
  export declare function getChainKeyFromLabel(label: string): string;
6
7
  export declare function getChainLabelFromKey(id: string): string;
8
+ export declare function getDeadChains(): string[];
9
+ export declare function getDeadChainsSet(): Set<string>;
10
+ export declare function isDeadChain(chainKeyOrLabel: string): boolean;
@@ -5,14 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.sluggifyString = exports.chainLabelsToKeyMap = exports.chainKeyToChainLabelMap = void 0;
7
7
  exports.updateData = updateData;
8
+ exports.getSluggifiedChainLabel = getSluggifiedChainLabel;
8
9
  exports.getChainKeyFromLabel = getChainKeyFromLabel;
9
10
  exports.getChainLabelFromKey = getChainLabelFromKey;
11
+ exports.getDeadChains = getDeadChains;
12
+ exports.getDeadChainsSet = getDeadChainsSet;
13
+ exports.isDeadChain = isDeadChain;
10
14
  const data_json_1 = require("./data.json");
11
15
  Object.defineProperty(exports, "chainKeyToChainLabelMap", { enumerable: true, get: function () { return data_json_1.chainKeyToChainLabelMap; } });
12
16
  Object.defineProperty(exports, "chainLabelsToKeyMap", { enumerable: true, get: function () { return data_json_1.chainLabelsToKeyMap; } });
13
17
  const fs_1 = __importDefault(require("fs"));
14
18
  const path_1 = __importDefault(require("path"));
19
+ const deadChainsArray = Object.keys(data_json_1.deadChains);
20
+ const deadChainsSet = new Set(deadChainsArray);
15
21
  async function updateData() {
22
+ var _a;
16
23
  try {
17
24
  // mapping pulled from https://github.com/DefiLlama/defillama-server/blob/master/defi/src/utils/normalizeChain.ts
18
25
  const response = await fetch('https://api.llama.fi/overview/_internal/chain-name-id-map-v2');
@@ -23,11 +30,22 @@ async function updateData() {
23
30
  for (const [key, value] of Object.entries(remoteData.chainLabelsToKeyMap)) {
24
31
  data_json_1.chainLabelsToKeyMap[key] = value;
25
32
  }
33
+ // dead chains are pulled from the `deadFrom` field on chainCoingeckoIds entries in https://api.llama.fi/config
34
+ const configResponse = await fetch('https://api.llama.fi/config');
35
+ const config = await configResponse.json();
36
+ for (const [label, value] of Object.entries((_a = config.chainCoingeckoIds) !== null && _a !== void 0 ? _a : {})) {
37
+ const deadFrom = value === null || value === void 0 ? void 0 : value.deadFrom;
38
+ if (!deadFrom)
39
+ continue;
40
+ const key = getChainKeyFromLabel(label);
41
+ data_json_1.deadChains[key] = deadFrom;
42
+ }
26
43
  // Save to data.json file
27
44
  const dataFilePath = path_1.default.join(__dirname, 'data.json');
28
45
  fs_1.default.writeFileSync(dataFilePath, JSON.stringify({
29
46
  chainKeyToChainLabelMap: sortJSONData(data_json_1.chainKeyToChainLabelMap),
30
47
  chainLabelsToKeyMap: sortJSONData(data_json_1.chainLabelsToKeyMap),
48
+ deadChains: sortJSONData(data_json_1.deadChains),
31
49
  }, null, 2));
32
50
  }
33
51
  catch (error) {
@@ -49,6 +67,13 @@ Object.entries(data_json_1.chainLabelsToKeyMap).forEach(([label, id]) => {
49
67
  _chainLabelToChainIdCache[label] = id;
50
68
  _chainLabelToChainIdCache[(0, exports.sluggifyString)(label)] = id;
51
69
  });
70
+ // this is needed because multiple labels can point to the same chain key, so we need to ensure that while writing/reading from the cache, we always use the same label irrespective what is passed in
71
+ // now, Avalance, Avax, avalanche -> avalanche
72
+ function getSluggifiedChainLabel(label) {
73
+ const chainKey = getChainKeyFromLabel(label);
74
+ label = getChainLabelFromKey(chainKey);
75
+ return (0, exports.sluggifyString)(label);
76
+ }
52
77
  // to be used if we are unsure if a label exists in our system, if it is known, use chainLabelsToKeyMap instead
53
78
  function getChainKeyFromLabel(label) {
54
79
  let value = _chainLabelToChainIdCache[label];
@@ -72,3 +97,17 @@ function getChainLabelFromKey(id) {
72
97
  data_json_1.chainKeyToChainLabelMap[id] = value;
73
98
  return value;
74
99
  }
100
+ // returns the map of dead chains keyed by chain key, with the date (YYYY-MM-DD) the chain was marked dead as the value
101
+ function getDeadChains() {
102
+ return deadChainsArray;
103
+ }
104
+ // returns a Set of dead chain keys (cached)
105
+ function getDeadChainsSet() {
106
+ return deadChainsSet;
107
+ }
108
+ // returns true if the given chain (by key or label) is dead
109
+ function isDeadChain(chainKeyOrLabel) {
110
+ if (deadChainsSet.has(chainKeyOrLabel))
111
+ return true;
112
+ return deadChainsSet.has(getChainKeyFromLabel(chainKeyOrLabel));
113
+ }
@@ -136,8 +136,8 @@ function sumSingleBalance(balances, token, balance, chain) {
136
136
  else {
137
137
  const prevBalance = convertToBigInt(balances[token]);
138
138
  const value = (prevBalance + convertToBigInt(balance));
139
- isValidNumber(Number(value));
140
- balances[token] = Number(value).toString();
139
+ isValidNumber(value);
140
+ balances[token] = value.toString();
141
141
  }
142
142
  function isValidNumber(value) {
143
143
  if (typeof value === 'bigint')
@@ -212,6 +212,7 @@ const chainShortNameMapping = {
212
212
  camp: 'campmainnet',
213
213
  mantra: 'mantrachain',
214
214
  saga: 'sagaevm',
215
+ robinhood: 'robinhoodchain',
215
216
  };
216
217
  async function filterForWorkingRPCs(rpc, chain, chainId) {
217
218
  if (rpc.length < 4)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "5.0.218",
3
+ "version": "5.0.220",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {