@defillama/sdk 5.0.250 → 5.0.251

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.
@@ -108,7 +108,7 @@
108
108
  "celestia": "Celestia",
109
109
  "celo": "Celo",
110
110
  "chainflip": "Chainflip",
111
- "chainx": "BEVM",
111
+ "chainx": "BEVM Canary",
112
112
  "cheqd": "Cheqd",
113
113
  "chia": "Chia",
114
114
  "chihuahua": "Chihuahua",
@@ -175,8 +175,9 @@
175
175
  "edgex": "edgeX L1",
176
176
  "elastos": "Elastos",
177
177
  "elrond": "MultiversX",
178
- "elsm": "Elysium",
178
+ "elsm": "Elysium Blockchain",
179
179
  "elys": "Elys",
180
+ "elysium": "Elysium",
180
181
  "embr": "Embr",
181
182
  "empire": "Empire",
182
183
  "energi": "Energi",
@@ -697,7 +698,8 @@
697
698
  "B3": "b3",
698
699
  "BCHyper": "bcypher",
699
700
  "BESC Hyperchain": "besc",
700
- "BEVM": "chainx",
701
+ "BEVM": "bevm",
702
+ "BEVM Canary": "chainx",
701
703
  "BOB": "bob",
702
704
  "BOT Chain": "bot",
703
705
  "BSC": "bsc",
@@ -829,7 +831,9 @@
829
831
  "Electroneum": "etn",
830
832
  "Elrond": "elrond",
831
833
  "Elys": "elys",
832
- "Elysium": "elsm",
834
+ "Elysium": "elysium",
835
+ "Elysium Blockchain": "elsm",
836
+ "Elysium Kinetiq": "elysium",
833
837
  "Embr": "embr",
834
838
  "Empire": "empire",
835
839
  "Endurance": "ace",
@@ -1342,6 +1346,7 @@
1342
1346
  "ancient8": "2026-06-19",
1343
1347
  "artela": "2026-06-05",
1344
1348
  "astrzk": "2026-02-12",
1349
+ "bevm_canary": "2026-01-20",
1345
1350
  "bitrock": "2026-02-12",
1346
1351
  "blast": "2026-10-26",
1347
1352
  "boba_bnb": "2026-01-20",
@@ -17,6 +17,7 @@ export type IndexerGetLogsOptions = {
17
17
  toTimestamp?: number;
18
18
  entireLog?: boolean;
19
19
  cacheInCloud?: boolean;
20
+ skipCache?: boolean;
20
21
  onlyArgs?: boolean;
21
22
  targets?: Address[];
22
23
  flatten?: boolean;
@@ -39,7 +39,8 @@ async function getLogs(options) {
39
39
  // If the caller demands indexer only but it is disabled, fail fast
40
40
  if (onlyIndexer && !(0, indexer_1.isIndexerEnabled)(chain))
41
41
  throw new Error("onlyIndexer is true, but indexer is not enabled");
42
- if (!skipIndexer && (0, indexer_1.isIndexerEnabled)(chain)) {
42
+ const indexerFillsCache = cacheInCloud && !skipIndexer && (0, indexer_1.isIndexerEnabled)(chain);
43
+ if (!skipIndexer && (0, indexer_1.isIndexerEnabled)(chain) && !indexerFillsCache) {
43
44
  try {
44
45
  const response = await (0, indexer_1.getLogs)({
45
46
  ...options,
@@ -74,7 +75,7 @@ async function getLogs(options) {
74
75
  }
75
76
  /* ------------------------ Multi-target parallel ------------------------- */
76
77
  if (targets === null || targets === void 0 ? void 0 : targets.length) {
77
- const baseOpts = { ...options, fromBlock, toBlock, skipIndexer: true };
78
+ const baseOpts = { ...options, fromBlock, toBlock, skipIndexer: !indexerFillsCache };
78
79
  delete baseOpts.targets;
79
80
  const jobs = targets.map((address, idx) => ({ idx, address }));
80
81
  const proc = async (job) => {
@@ -157,15 +158,7 @@ async function getLogs(options) {
157
158
  toBlock = getBufferedToBlock(toBlock, head);
158
159
  if (debugMode)
159
160
  console.time(dbgKey);
160
- const { output: newLogs } = await (0, _1.getLogs)({
161
- chain,
162
- target: target,
163
- topic: topic,
164
- keys,
165
- topics,
166
- fromBlock,
167
- toBlock,
168
- });
161
+ const newLogs = await fetchLogs(fromBlock, toBlock);
169
162
  if (debugMode) {
170
163
  console.timeEnd(dbgKey);
171
164
  (0, debugLog_1.debugLog)("Logs pulled", chain, target, newLogs.length);
@@ -202,6 +195,26 @@ async function getLogs(options) {
202
195
  await (0, cache_1.writeCache)(getFile(), { caches: storeCaches, version: currentVersion }, { skipR2CacheWrite: !cacheInCloud, skipCompression: !cacheInCloud });
203
196
  }
204
197
  }
198
+ async function fetchLogs(fromBlock, toBlock) {
199
+ if (indexerFillsCache) {
200
+ try {
201
+ return await (0, indexer_1.getLogs)({
202
+ ...options, chain, target, topics, fromBlock, toBlock,
203
+ targets: undefined, fromTimestamp: undefined, toTimestamp: undefined,
204
+ all: true, flatten: true, processor: undefined, collect: undefined, offset: 0, limit: undefined,
205
+ eventAbi: undefined, entireLog: true, parseLog: false, onlyArgs: false,
206
+ cacheInCloud: false, skipCache: true,
207
+ });
208
+ }
209
+ catch (e) {
210
+ (0, debugLog_1.debugLog)("Error in indexer getLogs", e.message);
211
+ if (onlyIndexer)
212
+ throw e;
213
+ }
214
+ }
215
+ const { output } = await (0, _1.getLogs)({ chain, target: target, topic: topic, keys, topics, fromBlock, toBlock });
216
+ return output;
217
+ }
205
218
  function dedupLogs(...arr) {
206
219
  const seen = new Set();
207
220
  return arr.flat().filter((i) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "5.0.250",
3
+ "version": "5.0.251",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -15,6 +15,7 @@
15
15
  "test-indexer-unit": "jest --runInBand --runTestsByPath src/util/indexer.test.ts src/util/indexer.partialSync.test.ts src/util/indexerSql.test.ts",
16
16
  "update-providers": "ts-node src/util/updateProviderList.ts",
17
17
  "update-chain-labels": "ts-node src/util/updateChainLabels.ts",
18
+ "update-repos": "bash ./scripts/updateRepos.sh",
18
19
  "remove-rpcs": "ts-node src/util/removeRedundantRPCs.ts",
19
20
  "verify-package": "node scripts/verifyPackage.js",
20
21
  "prepublishOnly": "npm run build && npm run verify-package"