@defillama/sdk 5.0.211 → 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.
@@ -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",
@@ -172,6 +176,7 @@
172
176
  "flare": "Flare",
173
177
  "flow": "Flow",
174
178
  "fluence": "Fluence",
179
+ "fluent": "Fluent",
175
180
  "flynet": "Flynet",
176
181
  "fogo": "Fogo",
177
182
  "formnetwork": "Form Network",
@@ -203,6 +208,7 @@
203
208
  "heco": "Heco",
204
209
  "hedera": "Hedera",
205
210
  "heiko": "Heiko",
211
+ "heima": "Heima",
206
212
  "hela": "HeLa",
207
213
  "hemi": "Hemi",
208
214
  "hibachi": "Hibachi",
@@ -306,6 +312,7 @@
306
312
  "muuchain": "MUUCHAIN",
307
313
  "mvc": "MVC",
308
314
  "mxczkevm": "Moonchain",
315
+ "mythos": "Mythos",
309
316
  "n1": "N1",
310
317
  "nahmii": "Nahmii",
311
318
  "naka": "Naka",
@@ -316,6 +323,7 @@
316
323
  "neon_evm": "Neon",
317
324
  "neony": "Neony",
318
325
  "neox": "Neo X Mainnet",
326
+ "neuroweb": "NeuroWeb",
319
327
  "neutron": "Neutron",
320
328
  "new": "AB",
321
329
  "nibiru": "Nibiru",
@@ -352,6 +360,7 @@
352
360
  "parallel": "Parallel",
353
361
  "parex": "Parex",
354
362
  "peaq": "Peaq",
363
+ "pendulum": "Pendulum",
355
364
  "penumbra": "Penumbra",
356
365
  "pepu": "Pepu",
357
366
  "perennial": "Perennial",
@@ -359,6 +368,7 @@
359
368
  "pg": "Pego",
360
369
  "pgn": "PGN",
361
370
  "phantasma": "Phantasma",
371
+ "pharos": "Pharos",
362
372
  "planq": "Planq",
363
373
  "plasma": "Plasma",
364
374
  "plume": "Plume (Deprecated)",
@@ -397,6 +407,7 @@
397
407
  "renec": "RENEC",
398
408
  "reya": "ReyaChain",
399
409
  "ripple": "XRPL",
410
+ "robonomics": "Robonomics",
400
411
  "rollux": "Rollux",
401
412
  "ronin": "Ronin",
402
413
  "rpg": "Rangers",
@@ -476,6 +487,7 @@
476
487
  "tomochain": "Viction",
477
488
  "ton": "TON",
478
489
  "tron": "Tron",
490
+ "txflow": "TxFlow",
479
491
  "ubiq": "Ubiq",
480
492
  "ultra": "Ultra",
481
493
  "ultron": "Ultron",
@@ -559,13 +571,16 @@
559
571
  "Arbitrum Nova": "arbitrum_nova",
560
572
  "Archway": "archway",
561
573
  "Areon Network": "area",
574
+ "Areum Network": "area",
562
575
  "Artela": "artela",
576
+ "Arweave": "arweave",
563
577
  "Asset Chain": "assetchain",
564
578
  "Astar": "astar",
565
579
  "Astar zkEVM": "astrzk",
566
580
  "Aura Network": "aura",
567
581
  "Aurora": "aurora",
568
582
  "Avalanche": "avax",
583
+ "BCHyper": "bcypher",
569
584
  "BESC Hyperchain": "besc",
570
585
  "BEVM": "chainx",
571
586
  "BOB": "bob",
@@ -608,6 +623,7 @@
608
623
  "CORE": "core",
609
624
  "CROSS": "cross",
610
625
  "CSC": "csc",
626
+ "Cabal": "cabal",
611
627
  "Callisto": "callisto",
612
628
  "Camp": "camp",
613
629
  "Camp Network": "camp",
@@ -646,6 +662,8 @@
646
662
  "DFK": "dfk",
647
663
  "DFS Network": "dfs",
648
664
  "DSC": "dsc",
665
+ "Dango": "dango",
666
+ "Dango Mainnet": "dango",
649
667
  "Darwinia": "darwinia",
650
668
  "Dash": "dash",
651
669
  "DeFiChain EVM": "defichain_evm",
@@ -704,6 +722,7 @@
704
722
  "Flare": "flare",
705
723
  "Flow": "flow",
706
724
  "Fluence": "fluence",
725
+ "Fluent": "fluent",
707
726
  "Flynet": "flynet",
708
727
  "Fogo": "fogo",
709
728
  "Form Network": "formnetwork",
@@ -742,6 +761,7 @@
742
761
  "Heco": "heco",
743
762
  "Hedera": "hedera",
744
763
  "Heiko": "heiko",
764
+ "Heima": "heima",
745
765
  "Hemi": "hemi",
746
766
  "Hibachi": "hibachi",
747
767
  "Hoo": "hoo",
@@ -849,6 +869,7 @@
849
869
  "Movement": "move",
850
870
  "MultiVAC": "multivac",
851
871
  "MultiversX": "elrond",
872
+ "Mythos": "mythos",
852
873
  "N1": "n1",
853
874
  "NEO": "neo",
854
875
  "NOS": "nos",
@@ -860,6 +881,7 @@
860
881
  "Neo3": "neo3",
861
882
  "Neon": "neon_evm",
862
883
  "Neony": "neony",
884
+ "NeuroWeb": "neuroweb",
863
885
  "Neutron": "neutron",
864
886
  "Newton": "new",
865
887
  "Nibiru": "nibiru",
@@ -903,12 +925,14 @@
903
925
  "Parex": "parex",
904
926
  "Peaq": "peaq",
905
927
  "Pego": "pg",
928
+ "Pendulum": "pendulum",
906
929
  "Penumbra": "penumbra",
907
930
  "Pepu": "pepu",
908
931
  "Perennial": "perennial",
909
932
  "Persistence": "persistence",
910
933
  "Persistence One": "persistence",
911
934
  "Phantasma": "phantasma",
935
+ "Pharos": "pharos",
912
936
  "Planq": "planq",
913
937
  "Plasma": "plasma",
914
938
  "Plume (Deprecated)": "plume",
@@ -952,6 +976,7 @@
952
976
  "Reya Network": "reya",
953
977
  "ReyaChain": "reya",
954
978
  "Ripple": "ripple",
979
+ "Robonomics": "robonomics",
955
980
  "Rollux": "rollux",
956
981
  "Ronin": "ronin",
957
982
  "Rootstock": "rsk",
@@ -1028,6 +1053,7 @@
1028
1053
  "Tombchain": "tombchain",
1029
1054
  "TomoChain": "tomochain",
1030
1055
  "Tron": "tron",
1056
+ "TxFlow": "txflow",
1031
1057
  "UNIT0": "unit0",
1032
1058
  "UX": "umee",
1033
1059
  "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.212",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {