@defillama/sdk 5.0.227 → 5.0.229
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.
|
@@ -203,6 +203,7 @@
|
|
|
203
203
|
"fsc": "FSC",
|
|
204
204
|
"ftn": "Bahamut",
|
|
205
205
|
"fuel": "Fuel Ignition",
|
|
206
|
+
"fuel-ignition": "Fuel-ignition",
|
|
206
207
|
"functionx": "FunctionX",
|
|
207
208
|
"fuse": "Fuse",
|
|
208
209
|
"fusion": "Fusion",
|
|
@@ -212,6 +213,7 @@
|
|
|
212
213
|
"genesys": "Genesys",
|
|
213
214
|
"genshiro": "Genshiro",
|
|
214
215
|
"gensyn": "Gensyn",
|
|
216
|
+
"ggchain": "GGCHAIN",
|
|
215
217
|
"goat": "GOAT",
|
|
216
218
|
"gochain": "GoChain",
|
|
217
219
|
"godwoken": "Godwoken",
|
|
@@ -461,6 +463,7 @@
|
|
|
461
463
|
"secret": "Secret",
|
|
462
464
|
"seda": "Seda",
|
|
463
465
|
"sei": "Sei",
|
|
466
|
+
"seleman": "SELEMAN",
|
|
464
467
|
"shape": "Shape",
|
|
465
468
|
"shibarium": "Shibarium",
|
|
466
469
|
"shiden": "Shiden",
|
|
@@ -797,6 +800,7 @@
|
|
|
797
800
|
"Fuse": "fuse",
|
|
798
801
|
"Fusion": "fusion",
|
|
799
802
|
"GANchain": "gan",
|
|
803
|
+
"GGCHAIN": "ggchain",
|
|
800
804
|
"GOAT": "goat",
|
|
801
805
|
"GRVT": "grvt",
|
|
802
806
|
"GRX Chain": "grx",
|
|
@@ -1064,6 +1068,7 @@
|
|
|
1064
1068
|
"Ronin": "ronin",
|
|
1065
1069
|
"Rootstock": "rsk",
|
|
1066
1070
|
"Rubin": "rubin",
|
|
1071
|
+
"SELEMAN": "seleman",
|
|
1067
1072
|
"SKALE": "skale",
|
|
1068
1073
|
"SKALE Europa": "europa",
|
|
1069
1074
|
"SX Network": "sx",
|
|
@@ -1226,39 +1231,61 @@
|
|
|
1226
1231
|
},
|
|
1227
1232
|
"deadChains": {
|
|
1228
1233
|
"airdao": "2026-01-20",
|
|
1234
|
+
"ancient8": "2026-06-19",
|
|
1229
1235
|
"artela": "2026-06-05",
|
|
1230
1236
|
"astrzk": "2026-02-12",
|
|
1231
1237
|
"bitrock": "2026-02-12",
|
|
1232
1238
|
"boba_bnb": "2026-01-20",
|
|
1239
|
+
"bouncebit": "2026-08-24",
|
|
1233
1240
|
"btnx": "2026-07-09",
|
|
1241
|
+
"callisto": "2026-07-01",
|
|
1242
|
+
"capx": "2026-09-03",
|
|
1234
1243
|
"chainx": "2026-01-20",
|
|
1235
1244
|
"corn": "2026-06-30",
|
|
1236
1245
|
"crab": "2026-01-01",
|
|
1246
|
+
"crossfi": "2026-09-09",
|
|
1237
1247
|
"cube": "2026-06-24",
|
|
1238
1248
|
"curio": "2026-06-24",
|
|
1239
1249
|
"dchainmainnet": "2026-06-24",
|
|
1250
|
+
"degen": "2026-08-31",
|
|
1240
1251
|
"dfs": "2026-06-24",
|
|
1252
|
+
"dogechain": "2026-08-08",
|
|
1253
|
+
"duckchain": "2026-07-20",
|
|
1241
1254
|
"echelon": "2023-10-20",
|
|
1255
|
+
"elys": "2025-12-29",
|
|
1242
1256
|
"enuls": "2026-03-25",
|
|
1243
1257
|
"eon": "2026-02-12",
|
|
1244
1258
|
"eos_evm": "2026-02-12",
|
|
1259
|
+
"eteria": "2026-08-03",
|
|
1245
1260
|
"eventum": "2026-07-01",
|
|
1246
1261
|
"evmos": "2026-05-18",
|
|
1247
1262
|
"fhe": "2026-06-01",
|
|
1263
|
+
"findora": "2026-09-03",
|
|
1248
1264
|
"fluence": "2026-04-08",
|
|
1265
|
+
"formnetwork": "2025-07-31",
|
|
1266
|
+
"ftn": "2026-09-02",
|
|
1249
1267
|
"functionx": "2026-06-24",
|
|
1250
1268
|
"genesys": "2026-03-01",
|
|
1251
1269
|
"godwoken": "2026-01-06",
|
|
1252
1270
|
"godwoken_v1": "2026-01-06",
|
|
1253
1271
|
"grove": "2025-07-28",
|
|
1254
1272
|
"ham": "2026-06-05",
|
|
1273
|
+
"harmony": "2026-09-09",
|
|
1274
|
+
"haven1": "2025-11-05",
|
|
1255
1275
|
"heco": "2026-02-12",
|
|
1276
|
+
"hoo": "2025-01-01",
|
|
1277
|
+
"hpb": "2026-08-01",
|
|
1256
1278
|
"inevm": "2026-04-08",
|
|
1279
|
+
"inri": "2026-08-03",
|
|
1280
|
+
"interlay": "2026-07-22",
|
|
1257
1281
|
"kadena": "2026-02-12",
|
|
1258
1282
|
"kardia": "2026-01-20",
|
|
1259
1283
|
"kinto": "2026-03-06",
|
|
1284
|
+
"kintsugi": "2026-07-22",
|
|
1260
1285
|
"kroma": "2026-01-20",
|
|
1261
1286
|
"kujira": "2026-08-03",
|
|
1287
|
+
"loop": "2026-08-03",
|
|
1288
|
+
"manta_atlantic": "2026-08-01",
|
|
1262
1289
|
"migaloo": "2026-02-12",
|
|
1263
1290
|
"milkomeda": "2026-02-12",
|
|
1264
1291
|
"milkomeda_a1": "2026-02-12",
|
|
@@ -1267,30 +1294,48 @@
|
|
|
1267
1294
|
"mint": "2026-04-17",
|
|
1268
1295
|
"moonbeam": "2026-07-31",
|
|
1269
1296
|
"moonriver": "2026-07-31",
|
|
1297
|
+
"mxczkevm": "2026-09-01",
|
|
1298
|
+
"nahmii": "2026-06-30",
|
|
1299
|
+
"neutron": "2026-07-01",
|
|
1270
1300
|
"nos": "2026-06-24",
|
|
1301
|
+
"nova": "2026-08-03",
|
|
1271
1302
|
"nuls": "2026-03-25",
|
|
1303
|
+
"odyssey": "2026-09-02",
|
|
1272
1304
|
"onus": "2026-06-05",
|
|
1305
|
+
"parex": "2026-08-12",
|
|
1273
1306
|
"planq": "2026-06-05",
|
|
1274
1307
|
"plume": "2026-02-12",
|
|
1275
1308
|
"polygon_zkevm": "2026-07-01",
|
|
1309
|
+
"polynomial": "2026-02-13",
|
|
1276
1310
|
"pryzm": "2026-02-09",
|
|
1277
1311
|
"qom": "2026-01-20",
|
|
1278
1312
|
"rari": "2026-06-14",
|
|
1279
1313
|
"real": "2026-02-12",
|
|
1280
1314
|
"redstone": "2026-05-18",
|
|
1315
|
+
"rei": "2026-09-01",
|
|
1316
|
+
"reichain": "2026-09-01",
|
|
1281
1317
|
"rpg": "2026-02-12",
|
|
1318
|
+
"rss3_vsl": "2026-09-03",
|
|
1319
|
+
"saakuru": "2026-03-16",
|
|
1282
1320
|
"saga": "2026-02-16",
|
|
1321
|
+
"sifchain": "2026-09-01",
|
|
1283
1322
|
"soon_base": "2026-05-25",
|
|
1323
|
+
"spn": "2026-09-08",
|
|
1324
|
+
"srx": "2026-08-03",
|
|
1284
1325
|
"stargaze": "2026-06-01",
|
|
1285
1326
|
"swellchain": "2026-06-23",
|
|
1286
1327
|
"sx": "2026-04-23",
|
|
1287
1328
|
"tara": "2026-03-09",
|
|
1288
1329
|
"tenet": "2026-04-22",
|
|
1330
|
+
"thundercore": "2026-09-01",
|
|
1289
1331
|
"titan": "2026-05-05",
|
|
1332
|
+
"ubiq": "2023-01-01",
|
|
1290
1333
|
"umee": "2026-07-10",
|
|
1291
1334
|
"vision": "2026-02-20",
|
|
1292
1335
|
"winr": "2026-05-01",
|
|
1293
1336
|
"winr_chain": "2026-05-01",
|
|
1337
|
+
"xone": "2026-03-16",
|
|
1338
|
+
"zero_network": "2026-08-12",
|
|
1294
1339
|
"zksync": "2026-05-15"
|
|
1295
1340
|
}
|
|
1296
1341
|
}
|
package/build/util/indexer.js
CHANGED
|
@@ -124,6 +124,42 @@ function getSupportedChains() {
|
|
|
124
124
|
return new Set(Object.values(allChainIdChainMapping));
|
|
125
125
|
}
|
|
126
126
|
exports.supportedChainSet2 = getSupportedChains();
|
|
127
|
+
function supportsCursorPagination(version) {
|
|
128
|
+
return version === "v4";
|
|
129
|
+
}
|
|
130
|
+
function getLogCursor(log) {
|
|
131
|
+
var _a, _b, _c;
|
|
132
|
+
if (!log)
|
|
133
|
+
return undefined;
|
|
134
|
+
const afterBlock = (_a = log.block_number) !== null && _a !== void 0 ? _a : log.blockNumber;
|
|
135
|
+
const afterIndex = (_c = (_b = log.log_index) !== null && _b !== void 0 ? _b : log.logIndex) !== null && _c !== void 0 ? _c : log.index;
|
|
136
|
+
if (afterBlock === undefined || afterIndex === undefined)
|
|
137
|
+
return undefined;
|
|
138
|
+
return { after_block: +afterBlock, after_index: +afterIndex };
|
|
139
|
+
}
|
|
140
|
+
function getTransferCursor(transfer) {
|
|
141
|
+
const cursor = getLogCursor(transfer);
|
|
142
|
+
if (!cursor)
|
|
143
|
+
return undefined;
|
|
144
|
+
if (transfer.id !== undefined && transfer.id !== null)
|
|
145
|
+
cursor.after_id = String(transfer.id);
|
|
146
|
+
return cursor;
|
|
147
|
+
}
|
|
148
|
+
function applyCursorParams(params, cursor) {
|
|
149
|
+
if (!cursor)
|
|
150
|
+
return;
|
|
151
|
+
params.after_block = cursor.after_block;
|
|
152
|
+
params.after_index = cursor.after_index;
|
|
153
|
+
if (cursor.after_id !== undefined)
|
|
154
|
+
params.after_id = cursor.after_id;
|
|
155
|
+
}
|
|
156
|
+
function applyLocalOffset(rows, remainingOffset) {
|
|
157
|
+
if (remainingOffset <= 0)
|
|
158
|
+
return { rows, remainingOffset };
|
|
159
|
+
if (remainingOffset >= rows.length)
|
|
160
|
+
return { rows: [], remainingOffset: remainingOffset - rows.length };
|
|
161
|
+
return { rows: rows.slice(remainingOffset), remainingOffset: 0 };
|
|
162
|
+
}
|
|
127
163
|
const syncStates = {
|
|
128
164
|
v2: { chainIndexStatus: {} },
|
|
129
165
|
v4: { chainIndexStatus: {} },
|
|
@@ -470,12 +506,15 @@ async function getLogs(options) {
|
|
|
470
506
|
(0, debugLog_1.debugLog)("[Indexer] Pulling logs " + debugTimeKey);
|
|
471
507
|
console.time(debugTimeKey);
|
|
472
508
|
}
|
|
509
|
+
const useCursorPagination = supportsCursorPagination(indexerVersion) && all;
|
|
473
510
|
for (const chunk of addressChunks) {
|
|
474
511
|
if (Array.isArray(chunk) && chunk.length === 0)
|
|
475
512
|
throw new Error("Address chunk cannot be empty");
|
|
476
|
-
let chunkOffset = initialOffset;
|
|
513
|
+
let chunkOffset = useCursorPagination ? 0 : initialOffset;
|
|
514
|
+
let remainingOffset = useCursorPagination ? initialOffset : 0;
|
|
477
515
|
let logCount = 0;
|
|
478
516
|
let hasMore = true;
|
|
517
|
+
let cursor;
|
|
479
518
|
do {
|
|
480
519
|
const params = {
|
|
481
520
|
addresses: hasAddressFilter ? chunk === null || chunk === void 0 ? void 0 : chunk.join(",") : undefined,
|
|
@@ -490,8 +529,15 @@ async function getLogs(options) {
|
|
|
490
529
|
offset: chunkOffset,
|
|
491
530
|
noTarget,
|
|
492
531
|
};
|
|
532
|
+
if (useCursorPagination) {
|
|
533
|
+
params.includeTotal = false;
|
|
534
|
+
applyCursorParams(params, cursor);
|
|
535
|
+
}
|
|
493
536
|
const { data: { logs: _logs, totalCount }, } = await axiosInstances[indexerVersion](`/logs`, { params }).catch((e) => { throw (0, common_1.formError)(e); });
|
|
494
|
-
const
|
|
537
|
+
const nextCursor = useCursorPagination ? getLogCursor(_logs[_logs.length - 1]) : undefined;
|
|
538
|
+
const offsetResult = useCursorPagination ? applyLocalOffset(_logs, remainingOffset) : { rows: _logs, remainingOffset };
|
|
539
|
+
remainingOffset = offsetResult.remainingOffset;
|
|
540
|
+
const filtered = offsetResult.rows.filter((l) => {
|
|
495
541
|
var _a, _b, _c;
|
|
496
542
|
const isWhitelisted = !addressSet.size || addressSet.has((_c = (_b = ((_a = l.source) !== null && _a !== void 0 ? _a : l.address)) === null || _b === void 0 ? void 0 : _b.toLowerCase) === null || _c === void 0 ? void 0 : _c.call(_b));
|
|
497
543
|
return !!isWhitelisted;
|
|
@@ -517,7 +563,13 @@ async function getLogs(options) {
|
|
|
517
563
|
safePush(allLogsPairs, transformedPair);
|
|
518
564
|
}
|
|
519
565
|
logCount += _logs.length;
|
|
520
|
-
|
|
566
|
+
if (useCursorPagination && nextCursor) {
|
|
567
|
+
cursor = nextCursor;
|
|
568
|
+
chunkOffset = 0;
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
chunkOffset += limit;
|
|
572
|
+
}
|
|
521
573
|
if (_logs.length === 0) {
|
|
522
574
|
hasMore = false;
|
|
523
575
|
}
|
|
@@ -602,8 +654,11 @@ async function getTokenTransfers({ chain = "ethereum", fromAddressFilter, fromBl
|
|
|
602
654
|
(0, debugLog_1.debugLog)("[Indexer] Pulling token transfers " + debugTimeKey);
|
|
603
655
|
console.time(debugTimeKey);
|
|
604
656
|
}
|
|
605
|
-
|
|
657
|
+
const useCursorPagination = supportsCursorPagination(indexerVersion) && all;
|
|
658
|
+
let currentOffset = useCursorPagination ? 0 : offset;
|
|
659
|
+
let remainingOffset = useCursorPagination ? offset : 0;
|
|
606
660
|
let hasMore = true;
|
|
661
|
+
let cursor;
|
|
607
662
|
do {
|
|
608
663
|
const params = {
|
|
609
664
|
addresses,
|
|
@@ -616,6 +671,10 @@ async function getTokenTransfers({ chain = "ethereum", fromAddressFilter, fromBl
|
|
|
616
671
|
from_address: false,
|
|
617
672
|
to_address: false,
|
|
618
673
|
};
|
|
674
|
+
if (useCursorPagination) {
|
|
675
|
+
params.includeTotal = false;
|
|
676
|
+
applyCursorParams(params, cursor);
|
|
677
|
+
}
|
|
619
678
|
switch (transferType) {
|
|
620
679
|
case "in":
|
|
621
680
|
params.to_address = true;
|
|
@@ -631,8 +690,17 @@ async function getTokenTransfers({ chain = "ethereum", fromAddressFilter, fromBl
|
|
|
631
690
|
throw new Error("Invalid transferType");
|
|
632
691
|
}
|
|
633
692
|
const { data: { transfers: _logs }, } = await axiosInstances[indexerVersion](`/token-transfers`, { params }).catch((e) => { throw (0, common_1.formError)(e); });
|
|
634
|
-
|
|
635
|
-
|
|
693
|
+
const nextCursor = useCursorPagination ? getTransferCursor(_logs[_logs.length - 1]) : undefined;
|
|
694
|
+
const offsetResult = useCursorPagination ? applyLocalOffset(_logs, remainingOffset) : { rows: _logs, remainingOffset };
|
|
695
|
+
remainingOffset = offsetResult.remainingOffset;
|
|
696
|
+
rawTransfers.push(...offsetResult.rows);
|
|
697
|
+
if (useCursorPagination && nextCursor) {
|
|
698
|
+
cursor = nextCursor;
|
|
699
|
+
currentOffset = 0;
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
currentOffset += limit;
|
|
703
|
+
}
|
|
636
704
|
hasMore = _logs.length === limit;
|
|
637
705
|
} while (all && hasMore);
|
|
638
706
|
const filteredTransfers = rawTransfers.filter((l) => {
|