@defillama/sdk 5.0.211 → 5.0.213

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.
@@ -132,7 +132,7 @@ const intialBlocks = {
132
132
  };
133
133
  let lastBlockCacheSave = Date.now();
134
134
  const blockCacheSaveInterval = 1000 * 60 * 5; // 5 minutes
135
- const { data: blockTimeCache, saveCacheFile: saveBlockCacheFile } = (0, cache_1.getTempLocalCache)({ file: 'BlockCache.json', defaultData: {}, clearAfter: cache_1.ONE_WEEK, returnWithSaveFunction: true });
135
+ const { data: blockTimeCache, saveCacheFile: saveBlockCacheFile } = (0, cache_1.getTempLocalCache)({ file: 'BlockCache-v1.json', defaultData: {}, clearAfter: cache_1.ONE_WEEK, returnWithSaveFunction: true });
136
136
  function validateCurrentBlock(block, chain = 'ethereum') {
137
137
  // sometimes the chain is halted or facing issues, so we skip the validation for those chains
138
138
  if ((0, env_1.shouldSkipBlockValidation)(chain))
@@ -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
- await writeCache(file, r2Data, { alreadyCompressed: true, skipR2CacheWrite: true, skipCompression: options.skipCompression });
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": "Areon Network",
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",
@@ -72,6 +74,7 @@
72
74
  "btnx": "Botanix",
73
75
  "btr": "Bitlayer",
74
76
  "bytomsidechain": "Bytomsidechain",
77
+ "cabal": "Cabal",
75
78
  "callisto": "Callisto",
76
79
  "camp": "Camp Network",
77
80
  "candle": "Candle",
@@ -110,6 +113,7 @@
110
113
  "cube": "Cube",
111
114
  "curio": "Curio",
112
115
  "cyeth": "Cyber",
116
+ "dango": "Dango Mainnet",
113
117
  "darwinia": "Darwinia",
114
118
  "dash": "Dash",
115
119
  "dchainmainnet": "DChain",
@@ -156,6 +160,7 @@
156
160
  "ethereumclassic": "EthereumClassic",
157
161
  "ethf": "ETHF",
158
162
  "ethpow": "EthereumPoW",
163
+ "etica": "Etica",
159
164
  "etlk": "Etherlink",
160
165
  "etn": "Electroneum",
161
166
  "europa": "SKALE Europa",
@@ -172,6 +177,7 @@
172
177
  "flare": "Flare",
173
178
  "flow": "Flow",
174
179
  "fluence": "Fluence",
180
+ "fluent": "Fluent",
175
181
  "flynet": "Flynet",
176
182
  "fogo": "Fogo",
177
183
  "formnetwork": "Form Network",
@@ -203,6 +209,7 @@
203
209
  "heco": "Heco",
204
210
  "hedera": "Hedera",
205
211
  "heiko": "Heiko",
212
+ "heima": "Heima",
206
213
  "hela": "HeLa",
207
214
  "hemi": "Hemi",
208
215
  "hibachi": "Hibachi",
@@ -306,6 +313,7 @@
306
313
  "muuchain": "MUUCHAIN",
307
314
  "mvc": "MVC",
308
315
  "mxczkevm": "Moonchain",
316
+ "mythos": "Mythos",
309
317
  "n1": "N1",
310
318
  "nahmii": "Nahmii",
311
319
  "naka": "Naka",
@@ -316,6 +324,7 @@
316
324
  "neon_evm": "Neon",
317
325
  "neony": "Neony",
318
326
  "neox": "Neo X Mainnet",
327
+ "neuroweb": "NeuroWeb",
319
328
  "neutron": "Neutron",
320
329
  "new": "AB",
321
330
  "nibiru": "Nibiru",
@@ -352,6 +361,7 @@
352
361
  "parallel": "Parallel",
353
362
  "parex": "Parex",
354
363
  "peaq": "Peaq",
364
+ "pendulum": "Pendulum",
355
365
  "penumbra": "Penumbra",
356
366
  "pepu": "Pepu",
357
367
  "perennial": "Perennial",
@@ -359,6 +369,7 @@
359
369
  "pg": "Pego",
360
370
  "pgn": "PGN",
361
371
  "phantasma": "Phantasma",
372
+ "pharos": "Pharos",
362
373
  "planq": "Planq",
363
374
  "plasma": "Plasma",
364
375
  "plume": "Plume (Deprecated)",
@@ -397,6 +408,8 @@
397
408
  "renec": "RENEC",
398
409
  "reya": "ReyaChain",
399
410
  "ripple": "XRPL",
411
+ "rise": "RISE",
412
+ "robonomics": "Robonomics",
400
413
  "rollux": "Rollux",
401
414
  "ronin": "Ronin",
402
415
  "rpg": "Rangers",
@@ -476,6 +489,7 @@
476
489
  "tomochain": "Viction",
477
490
  "ton": "TON",
478
491
  "tron": "Tron",
492
+ "txflow": "TxFlow",
479
493
  "ubiq": "Ubiq",
480
494
  "ultra": "Ultra",
481
495
  "ultron": "Ultron",
@@ -559,13 +573,16 @@
559
573
  "Arbitrum Nova": "arbitrum_nova",
560
574
  "Archway": "archway",
561
575
  "Areon Network": "area",
576
+ "Areum Network": "area",
562
577
  "Artela": "artela",
578
+ "Arweave": "arweave",
563
579
  "Asset Chain": "assetchain",
564
580
  "Astar": "astar",
565
581
  "Astar zkEVM": "astrzk",
566
582
  "Aura Network": "aura",
567
583
  "Aurora": "aurora",
568
584
  "Avalanche": "avax",
585
+ "BCHyper": "bcypher",
569
586
  "BESC Hyperchain": "besc",
570
587
  "BEVM": "chainx",
571
588
  "BOB": "bob",
@@ -608,6 +625,7 @@
608
625
  "CORE": "core",
609
626
  "CROSS": "cross",
610
627
  "CSC": "csc",
628
+ "Cabal": "cabal",
611
629
  "Callisto": "callisto",
612
630
  "Camp": "camp",
613
631
  "Camp Network": "camp",
@@ -646,6 +664,8 @@
646
664
  "DFK": "dfk",
647
665
  "DFS Network": "dfs",
648
666
  "DSC": "dsc",
667
+ "Dango": "dango",
668
+ "Dango Mainnet": "dango",
649
669
  "Darwinia": "darwinia",
650
670
  "Dash": "dash",
651
671
  "DeFiChain EVM": "defichain_evm",
@@ -690,6 +710,7 @@
690
710
  "EthereumClassic": "ethereumclassic",
691
711
  "EthereumPoW": "ethpow",
692
712
  "Etherlink": "etlk",
713
+ "Etica": "etica",
693
714
  "Europa": "europa",
694
715
  "Eventum": "eventum",
695
716
  "Everclear": "everclear",
@@ -704,6 +725,7 @@
704
725
  "Flare": "flare",
705
726
  "Flow": "flow",
706
727
  "Fluence": "fluence",
728
+ "Fluent": "fluent",
707
729
  "Flynet": "flynet",
708
730
  "Fogo": "fogo",
709
731
  "Form Network": "formnetwork",
@@ -742,6 +764,7 @@
742
764
  "Heco": "heco",
743
765
  "Hedera": "hedera",
744
766
  "Heiko": "heiko",
767
+ "Heima": "heima",
745
768
  "Hemi": "hemi",
746
769
  "Hibachi": "hibachi",
747
770
  "Hoo": "hoo",
@@ -849,6 +872,7 @@
849
872
  "Movement": "move",
850
873
  "MultiVAC": "multivac",
851
874
  "MultiversX": "elrond",
875
+ "Mythos": "mythos",
852
876
  "N1": "n1",
853
877
  "NEO": "neo",
854
878
  "NOS": "nos",
@@ -860,6 +884,7 @@
860
884
  "Neo3": "neo3",
861
885
  "Neon": "neon_evm",
862
886
  "Neony": "neony",
887
+ "NeuroWeb": "neuroweb",
863
888
  "Neutron": "neutron",
864
889
  "Newton": "new",
865
890
  "Nibiru": "nibiru",
@@ -903,12 +928,14 @@
903
928
  "Parex": "parex",
904
929
  "Peaq": "peaq",
905
930
  "Pego": "pg",
931
+ "Pendulum": "pendulum",
906
932
  "Penumbra": "penumbra",
907
933
  "Pepu": "pepu",
908
934
  "Perennial": "perennial",
909
935
  "Persistence": "persistence",
910
936
  "Persistence One": "persistence",
911
937
  "Phantasma": "phantasma",
938
+ "Pharos": "pharos",
912
939
  "Planq": "planq",
913
940
  "Plasma": "plasma",
914
941
  "Plume (Deprecated)": "plume",
@@ -939,6 +966,7 @@
939
966
  "REI": "rei",
940
967
  "REIchain": "reichain",
941
968
  "RENEC": "renec",
969
+ "RISE": "rise",
942
970
  "RSK": "rsk",
943
971
  "RSS3": "rss3_vsl",
944
972
  "Radix": "radixdlt",
@@ -952,6 +980,7 @@
952
980
  "Reya Network": "reya",
953
981
  "ReyaChain": "reya",
954
982
  "Ripple": "ripple",
983
+ "Robonomics": "robonomics",
955
984
  "Rollux": "rollux",
956
985
  "Ronin": "ronin",
957
986
  "Rootstock": "rsk",
@@ -1028,6 +1057,7 @@
1028
1057
  "Tombchain": "tombchain",
1029
1058
  "TomoChain": "tomochain",
1030
1059
  "Tron": "tron",
1060
+ "TxFlow": "txflow",
1031
1061
  "UNIT0": "unit0",
1032
1062
  "UX": "umee",
1033
1063
  "Ubiq": "ubiq",
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "5.0.211",
3
+ "version": "5.0.213",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {