@defillama/sdk 5.0.209 → 5.0.212
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/build/Balances.d.ts +21 -0
- package/build/Balances.js +116 -23
- package/build/ChainApi.d.ts +3 -0
- package/build/abi/multicall.js +1 -0
- package/build/abi/multicall3.js +1 -1
- package/build/generalUtil.d.ts +2 -1
- package/build/generalUtil.js +3 -1
- package/build/providers.json +1 -1
- package/build/util/cache.js +4 -1
- package/build/util/chainUtils/data.json +37 -2
- package/build/util/discord.d.ts +1 -0
- package/build/util/discord.js +33 -0
- package/build/util/elastic.js +2 -1
- package/build/util/indexer.js +4 -0
- package/package.json +1 -1
package/build/util/cache.js
CHANGED
|
@@ -82,7 +82,8 @@ async function readCache(file, options = {}) {
|
|
|
82
82
|
return;
|
|
83
83
|
const r2Data = await (0, r2_1.getR2JSONString)(exports.currentVersion + '/' + file);
|
|
84
84
|
if (r2Data) {
|
|
85
|
-
|
|
85
|
+
// `file` already carries the `-uncompressed` suffix (added above), so omit skipCompression here to avoid writeCache appending it again
|
|
86
|
+
await writeCache(file, r2Data, { alreadyCompressed: true, skipR2CacheWrite: true });
|
|
86
87
|
return r2Data;
|
|
87
88
|
}
|
|
88
89
|
}
|
|
@@ -108,6 +109,8 @@ async function writeCache(file, data, options = {}) {
|
|
|
108
109
|
return fileData;
|
|
109
110
|
}
|
|
110
111
|
catch (error) {
|
|
112
|
+
if (typeof data === 'object' && data !== null && Object.keys(data).length === 0)
|
|
113
|
+
return;
|
|
111
114
|
(0, debugLog_1.debugLog)('Error writing cache:', error);
|
|
112
115
|
}
|
|
113
116
|
}
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
"arbitrum": "Arbitrum",
|
|
29
29
|
"arbitrum_nova": "Arbitrum Nova",
|
|
30
30
|
"archway": "Archway",
|
|
31
|
-
"area": "
|
|
31
|
+
"area": "Areum Network",
|
|
32
32
|
"artela": "Artela",
|
|
33
|
+
"arweave": "Arweave",
|
|
33
34
|
"assetchain": "Asset Chain",
|
|
34
35
|
"astar": "Astar",
|
|
35
36
|
"astrzk": "Astar zkEVM",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"band": "BandChain",
|
|
41
42
|
"base": "Base",
|
|
42
43
|
"basecamp": "Basecamp",
|
|
44
|
+
"bcypher": "BCHyper",
|
|
43
45
|
"beam": "Beam",
|
|
44
46
|
"berachain": "Berachain",
|
|
45
47
|
"besc": "BESC Hyperchain",
|
|
@@ -58,6 +60,7 @@
|
|
|
58
60
|
"bittensor_evm": "Bittensor EVM",
|
|
59
61
|
"bittorrent": "Bittorrent",
|
|
60
62
|
"blast": "Blast",
|
|
63
|
+
"blockdag": "BlockDAG",
|
|
61
64
|
"bob": "BOB",
|
|
62
65
|
"boba": "Boba",
|
|
63
66
|
"boba_avax": "Boba_Avax",
|
|
@@ -71,6 +74,7 @@
|
|
|
71
74
|
"btnx": "Botanix",
|
|
72
75
|
"btr": "Bitlayer",
|
|
73
76
|
"bytomsidechain": "Bytomsidechain",
|
|
77
|
+
"cabal": "Cabal",
|
|
74
78
|
"callisto": "Callisto",
|
|
75
79
|
"camp": "Camp Network",
|
|
76
80
|
"candle": "Candle",
|
|
@@ -83,6 +87,7 @@
|
|
|
83
87
|
"celo": "Celo",
|
|
84
88
|
"chainflip": "Chainflip",
|
|
85
89
|
"chainx": "BEVM",
|
|
90
|
+
"chia": "Chia",
|
|
86
91
|
"chihuahua": "Chihuahua",
|
|
87
92
|
"chromia": "Chromia",
|
|
88
93
|
"chz": "Chiliz",
|
|
@@ -108,6 +113,7 @@
|
|
|
108
113
|
"cube": "Cube",
|
|
109
114
|
"curio": "Curio",
|
|
110
115
|
"cyeth": "Cyber",
|
|
116
|
+
"dango": "Dango Mainnet",
|
|
111
117
|
"darwinia": "Darwinia",
|
|
112
118
|
"dash": "Dash",
|
|
113
119
|
"dchainmainnet": "DChain",
|
|
@@ -131,7 +137,7 @@
|
|
|
131
137
|
"echelon": "Echelon",
|
|
132
138
|
"echelon_initia": "Echelon Initia",
|
|
133
139
|
"eclipse": "Eclipse",
|
|
134
|
-
"edgex": "edgeX",
|
|
140
|
+
"edgex": "edgeX L1",
|
|
135
141
|
"elastos": "Elastos",
|
|
136
142
|
"elrond": "MultiversX",
|
|
137
143
|
"elsm": "Elysium",
|
|
@@ -170,6 +176,7 @@
|
|
|
170
176
|
"flare": "Flare",
|
|
171
177
|
"flow": "Flow",
|
|
172
178
|
"fluence": "Fluence",
|
|
179
|
+
"fluent": "Fluent",
|
|
173
180
|
"flynet": "Flynet",
|
|
174
181
|
"fogo": "Fogo",
|
|
175
182
|
"formnetwork": "Form Network",
|
|
@@ -201,11 +208,13 @@
|
|
|
201
208
|
"heco": "Heco",
|
|
202
209
|
"hedera": "Hedera",
|
|
203
210
|
"heiko": "Heiko",
|
|
211
|
+
"heima": "Heima",
|
|
204
212
|
"hela": "HeLa",
|
|
205
213
|
"hemi": "Hemi",
|
|
206
214
|
"hibachi": "Hibachi",
|
|
207
215
|
"hoo": "Hoo",
|
|
208
216
|
"horizen eon": "Horizen EON",
|
|
217
|
+
"hotstuff": "Hotstuff",
|
|
209
218
|
"hpb": "HPB",
|
|
210
219
|
"hpp": "HPP",
|
|
211
220
|
"hsk": "HashKey Chain",
|
|
@@ -217,6 +226,7 @@
|
|
|
217
226
|
"icon": "Icon",
|
|
218
227
|
"icp": "ICP",
|
|
219
228
|
"idex": "XCHAIN",
|
|
229
|
+
"igra": "Igra",
|
|
220
230
|
"immutablex": "Immutable X",
|
|
221
231
|
"imx": "Immutable zkEVM",
|
|
222
232
|
"inertia": "Inertia",
|
|
@@ -302,6 +312,7 @@
|
|
|
302
312
|
"muuchain": "MUUCHAIN",
|
|
303
313
|
"mvc": "MVC",
|
|
304
314
|
"mxczkevm": "Moonchain",
|
|
315
|
+
"mythos": "Mythos",
|
|
305
316
|
"n1": "N1",
|
|
306
317
|
"nahmii": "Nahmii",
|
|
307
318
|
"naka": "Naka",
|
|
@@ -312,6 +323,7 @@
|
|
|
312
323
|
"neon_evm": "Neon",
|
|
313
324
|
"neony": "Neony",
|
|
314
325
|
"neox": "Neo X Mainnet",
|
|
326
|
+
"neuroweb": "NeuroWeb",
|
|
315
327
|
"neutron": "Neutron",
|
|
316
328
|
"new": "AB",
|
|
317
329
|
"nibiru": "Nibiru",
|
|
@@ -348,6 +360,7 @@
|
|
|
348
360
|
"parallel": "Parallel",
|
|
349
361
|
"parex": "Parex",
|
|
350
362
|
"peaq": "Peaq",
|
|
363
|
+
"pendulum": "Pendulum",
|
|
351
364
|
"penumbra": "Penumbra",
|
|
352
365
|
"pepu": "Pepu",
|
|
353
366
|
"perennial": "Perennial",
|
|
@@ -355,6 +368,7 @@
|
|
|
355
368
|
"pg": "Pego",
|
|
356
369
|
"pgn": "PGN",
|
|
357
370
|
"phantasma": "Phantasma",
|
|
371
|
+
"pharos": "Pharos",
|
|
358
372
|
"planq": "Planq",
|
|
359
373
|
"plasma": "Plasma",
|
|
360
374
|
"plume": "Plume (Deprecated)",
|
|
@@ -393,6 +407,7 @@
|
|
|
393
407
|
"renec": "RENEC",
|
|
394
408
|
"reya": "ReyaChain",
|
|
395
409
|
"ripple": "XRPL",
|
|
410
|
+
"robonomics": "Robonomics",
|
|
396
411
|
"rollux": "Rollux",
|
|
397
412
|
"ronin": "Ronin",
|
|
398
413
|
"rpg": "Rangers",
|
|
@@ -472,6 +487,7 @@
|
|
|
472
487
|
"tomochain": "Viction",
|
|
473
488
|
"ton": "TON",
|
|
474
489
|
"tron": "Tron",
|
|
490
|
+
"txflow": "TxFlow",
|
|
475
491
|
"ubiq": "Ubiq",
|
|
476
492
|
"ultra": "Ultra",
|
|
477
493
|
"ultron": "Ultron",
|
|
@@ -555,13 +571,16 @@
|
|
|
555
571
|
"Arbitrum Nova": "arbitrum_nova",
|
|
556
572
|
"Archway": "archway",
|
|
557
573
|
"Areon Network": "area",
|
|
574
|
+
"Areum Network": "area",
|
|
558
575
|
"Artela": "artela",
|
|
576
|
+
"Arweave": "arweave",
|
|
559
577
|
"Asset Chain": "assetchain",
|
|
560
578
|
"Astar": "astar",
|
|
561
579
|
"Astar zkEVM": "astrzk",
|
|
562
580
|
"Aura Network": "aura",
|
|
563
581
|
"Aurora": "aurora",
|
|
564
582
|
"Avalanche": "avax",
|
|
583
|
+
"BCHyper": "bcypher",
|
|
565
584
|
"BESC Hyperchain": "besc",
|
|
566
585
|
"BEVM": "chainx",
|
|
567
586
|
"BOB": "bob",
|
|
@@ -590,6 +609,7 @@
|
|
|
590
609
|
"Bittensor EVM": "bittensor_evm",
|
|
591
610
|
"Bittorrent": "bittorrent",
|
|
592
611
|
"Blast": "blast",
|
|
612
|
+
"BlockDAG": "blockdag",
|
|
593
613
|
"Boba": "boba",
|
|
594
614
|
"Boba_Avax": "boba_avax",
|
|
595
615
|
"Boba_Bnb": "boba_bnb",
|
|
@@ -603,6 +623,7 @@
|
|
|
603
623
|
"CORE": "core",
|
|
604
624
|
"CROSS": "cross",
|
|
605
625
|
"CSC": "csc",
|
|
626
|
+
"Cabal": "cabal",
|
|
606
627
|
"Callisto": "callisto",
|
|
607
628
|
"Camp": "camp",
|
|
608
629
|
"Camp Network": "camp",
|
|
@@ -615,6 +636,7 @@
|
|
|
615
636
|
"Celestia": "celestia",
|
|
616
637
|
"Celo": "celo",
|
|
617
638
|
"Chainflip": "chainflip",
|
|
639
|
+
"Chia": "chia",
|
|
618
640
|
"Chihuahua": "chihuahua",
|
|
619
641
|
"Chiliz": "chz",
|
|
620
642
|
"Chromia": "chromia",
|
|
@@ -640,6 +662,8 @@
|
|
|
640
662
|
"DFK": "dfk",
|
|
641
663
|
"DFS Network": "dfs",
|
|
642
664
|
"DSC": "dsc",
|
|
665
|
+
"Dango": "dango",
|
|
666
|
+
"Dango Mainnet": "dango",
|
|
643
667
|
"Darwinia": "darwinia",
|
|
644
668
|
"Dash": "dash",
|
|
645
669
|
"DeFiChain EVM": "defichain_evm",
|
|
@@ -698,6 +722,7 @@
|
|
|
698
722
|
"Flare": "flare",
|
|
699
723
|
"Flow": "flow",
|
|
700
724
|
"Fluence": "fluence",
|
|
725
|
+
"Fluent": "fluent",
|
|
701
726
|
"Flynet": "flynet",
|
|
702
727
|
"Fogo": "fogo",
|
|
703
728
|
"Form Network": "formnetwork",
|
|
@@ -736,10 +761,12 @@
|
|
|
736
761
|
"Heco": "heco",
|
|
737
762
|
"Hedera": "hedera",
|
|
738
763
|
"Heiko": "heiko",
|
|
764
|
+
"Heima": "heima",
|
|
739
765
|
"Hemi": "hemi",
|
|
740
766
|
"Hibachi": "hibachi",
|
|
741
767
|
"Hoo": "hoo",
|
|
742
768
|
"Horizen EON": "eon",
|
|
769
|
+
"Hotstuff": "hotstuff",
|
|
743
770
|
"Hydra": "hydra",
|
|
744
771
|
"Hydra Chain": "hydragon",
|
|
745
772
|
"HydraDX": "hydradx",
|
|
@@ -751,6 +778,7 @@
|
|
|
751
778
|
"IOTA": "iota",
|
|
752
779
|
"IOTA EVM": "iotaevm",
|
|
753
780
|
"Icon": "icon",
|
|
781
|
+
"Igra": "igra",
|
|
754
782
|
"Immutable X": "immutablex",
|
|
755
783
|
"Immutable zkEVM": "imx",
|
|
756
784
|
"Inertia": "inertia",
|
|
@@ -841,6 +869,7 @@
|
|
|
841
869
|
"Movement": "move",
|
|
842
870
|
"MultiVAC": "multivac",
|
|
843
871
|
"MultiversX": "elrond",
|
|
872
|
+
"Mythos": "mythos",
|
|
844
873
|
"N1": "n1",
|
|
845
874
|
"NEO": "neo",
|
|
846
875
|
"NOS": "nos",
|
|
@@ -852,6 +881,7 @@
|
|
|
852
881
|
"Neo3": "neo3",
|
|
853
882
|
"Neon": "neon_evm",
|
|
854
883
|
"Neony": "neony",
|
|
884
|
+
"NeuroWeb": "neuroweb",
|
|
855
885
|
"Neutron": "neutron",
|
|
856
886
|
"Newton": "new",
|
|
857
887
|
"Nibiru": "nibiru",
|
|
@@ -895,12 +925,14 @@
|
|
|
895
925
|
"Parex": "parex",
|
|
896
926
|
"Peaq": "peaq",
|
|
897
927
|
"Pego": "pg",
|
|
928
|
+
"Pendulum": "pendulum",
|
|
898
929
|
"Penumbra": "penumbra",
|
|
899
930
|
"Pepu": "pepu",
|
|
900
931
|
"Perennial": "perennial",
|
|
901
932
|
"Persistence": "persistence",
|
|
902
933
|
"Persistence One": "persistence",
|
|
903
934
|
"Phantasma": "phantasma",
|
|
935
|
+
"Pharos": "pharos",
|
|
904
936
|
"Planq": "planq",
|
|
905
937
|
"Plasma": "plasma",
|
|
906
938
|
"Plume (Deprecated)": "plume",
|
|
@@ -944,6 +976,7 @@
|
|
|
944
976
|
"Reya Network": "reya",
|
|
945
977
|
"ReyaChain": "reya",
|
|
946
978
|
"Ripple": "ripple",
|
|
979
|
+
"Robonomics": "robonomics",
|
|
947
980
|
"Rollux": "rollux",
|
|
948
981
|
"Ronin": "ronin",
|
|
949
982
|
"Rootstock": "rsk",
|
|
@@ -1020,6 +1053,7 @@
|
|
|
1020
1053
|
"Tombchain": "tombchain",
|
|
1021
1054
|
"TomoChain": "tomochain",
|
|
1022
1055
|
"Tron": "tron",
|
|
1056
|
+
"TxFlow": "txflow",
|
|
1023
1057
|
"UNIT0": "unit0",
|
|
1024
1058
|
"UX": "umee",
|
|
1025
1059
|
"Ubiq": "ubiq",
|
|
@@ -1082,6 +1116,7 @@
|
|
|
1082
1116
|
"chain-breakdown": "chain-breakdown",
|
|
1083
1117
|
"dYdX": "dydx",
|
|
1084
1118
|
"edgeX": "edgex",
|
|
1119
|
+
"edgeX L1": "edgex",
|
|
1085
1120
|
"exSat": "xsat",
|
|
1086
1121
|
"inEVM": "inevm",
|
|
1087
1122
|
"opBNB": "op_bnb",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sendMessage(message: string, webhookUrl: string | undefined, formatted?: boolean): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.sendMessage = sendMessage;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
async function sendMessage(message, webhookUrl, formatted = true) {
|
|
9
|
+
if (webhookUrl === undefined) {
|
|
10
|
+
throw new Error(`You are missing an env variable for discord hooks (eg TEAM_WEBHOOK, OUTDATED_WEBHOOK, SPIKE_WEBHOOK...) and this makes it impossible to send the following error message: "${message}"`);
|
|
11
|
+
}
|
|
12
|
+
const formattedMessage = formatted ? "```\n" + message + "\n```" : message; // Put it into a code block to prevent the format from getting messed up
|
|
13
|
+
if (formattedMessage.length >= 2000) {
|
|
14
|
+
const lines = message.split('\n');
|
|
15
|
+
if (lines.length <= 2) {
|
|
16
|
+
throw new Error("Lines are too long, reaching infinite recursivity");
|
|
17
|
+
}
|
|
18
|
+
const mid = Math.round(lines.length / 2);
|
|
19
|
+
await sendMessage(lines.slice(0, mid).join('\n'), webhookUrl);
|
|
20
|
+
await sendMessage(lines.slice(mid).join('\n'), webhookUrl);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Example: https://gist.github.com/dragonwocky/ea61c8d21db17913a43da92efe0de634
|
|
24
|
+
// Docs: https://gist.github.com/dragonwocky/ea61c8d21db17913a43da92efe0de634
|
|
25
|
+
await axios_1.default.post(`${webhookUrl}?wait=true`, {
|
|
26
|
+
content: formattedMessage
|
|
27
|
+
}, {
|
|
28
|
+
headers: {
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
}
|
|
31
|
+
}).then((body) => body.data);
|
|
32
|
+
// console.log("discord", response)
|
|
33
|
+
}
|
package/build/util/elastic.js
CHANGED
|
@@ -42,7 +42,8 @@ async function writeLog(index, log) {
|
|
|
42
42
|
if (!client)
|
|
43
43
|
return;
|
|
44
44
|
index = addYearAndMonth(index);
|
|
45
|
-
log.timestamp
|
|
45
|
+
if (!log.hasOwnProperty('timestamp'))
|
|
46
|
+
log.timestamp = +Date.now();
|
|
46
47
|
try {
|
|
47
48
|
await client.index({ index, body: log });
|
|
48
49
|
}
|
package/build/util/indexer.js
CHANGED
|
@@ -211,6 +211,10 @@ async function getLogs(options) {
|
|
|
211
211
|
const breakBlock = lastIndexedBlock - 50; // small buffer
|
|
212
212
|
const indexerLogs = await getLogs({ ...options, fromBlock, toBlock: breakBlock });
|
|
213
213
|
const rpcLogs = await (0, logs_1.getLogs)({ ...options, fromBlock: breakBlock + 1, toBlock, skipIndexer: true });
|
|
214
|
+
// When flatten=false, preserve per-target buckets: merge RPC logs into their corresponding indexer bucket so the result still maintains one element per target.
|
|
215
|
+
if (!flatten) {
|
|
216
|
+
return indexerLogs.map((bucket, i) => bucket.concat(rpcLogs[i]));
|
|
217
|
+
}
|
|
214
218
|
return indexerLogs.concat(rpcLogs);
|
|
215
219
|
}
|
|
216
220
|
// Re-curse if the requested range is too large
|