@defillama/sdk 2.3.73 → 2.3.77

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.
@@ -238,12 +238,20 @@ function multicallAddress(chainId) {
238
238
  return "0x80Ae459D058436ecB4e043ac48cfd209B578CBF0"; // boba
239
239
  case 4689:
240
240
  return "0x5a6787fc349665c5b0c4b93126a0b62f14935731"; // iotex
241
- case 246: // energy web chain
241
+ case 82:
242
+ return "0x59177c9e5d0488e21355816094a047bdf8f14ebe"; // meter
243
+ case 11297108109:
244
+ return "0xfFE2FF36c5b8D948f788a34f867784828aa7415D"; // palm
245
+ case 416:
246
+ return "0x834a005DDCF990Ba1a79f259e840e58F2D14F49a"; // sx
247
+ case 246: // energy web chain
242
248
  case 336: // shiden
243
249
  case 592: // astar
244
250
  case 269: // High performance blockchain
245
251
  case 321: // KCC
246
- case 8217: // Klaytn
252
+ case 20: // elastos
253
+ case 8217: // Klaytn - multicall doesnt work for some reason
254
+ // case 88: // tomochain - multicall doesnt work for some reason
247
255
  case 122: // Fuse
248
256
  case 42220: // Celo
249
257
  case 42262: // ROSE
@@ -255,6 +263,17 @@ function multicallAddress(chainId) {
255
263
  case 2001: // Milkomeda C1
256
264
  case 9001: // evmos
257
265
  case 106: // velas
266
+ case 888: // wanchain
267
+ case 24: // kardia
268
+ case 108: // thundercore
269
+ case 361: // Theta
270
+ case 57: // Syscoin
271
+ case 61: // etc
272
+ case 70: // hoo
273
+ case 61: // etc
274
+ case 60: // go
275
+ case 66: // okxchain
276
+ case 19: // songbird
258
277
  return "0x18fA376d92511Dd04090566AB6144847c03557d8";
259
278
  case 2222:
260
279
  return "0x30A62aA52Fa099C4B227869EB6aeaDEda054d121"; // kava
@@ -46,6 +46,8 @@ export declare const chainToCoingeckoId: {
46
46
  metis: string;
47
47
  telos: string;
48
48
  moonbeam: string;
49
+ meter: string;
50
+ sx: string;
49
51
  velas: string;
50
52
  milkomeda: string;
51
53
  };
@@ -108,6 +108,8 @@ exports.chainToCoingeckoId = {
108
108
  metis: "metis-andromeda",
109
109
  telos: "telos",
110
110
  moonbeam: "moonbeam",
111
+ meter: "meter",
112
+ sx: "sx-network",
111
113
  velas: "velas",
112
114
  milkomeda: "milkomeda-cardano",
113
115
  };
@@ -2,7 +2,7 @@ import { ethers, BigNumber } from "ethers";
2
2
  export declare const providers: {
3
3
  [chain: string]: ethers.providers.BaseProvider;
4
4
  };
5
- export declare type Chain = "ethereum" | "bsc" | "polygon" | "heco" | "fantom" | "rsk" | "tomochain" | "xdai" | "avax" | "wan" | "iotex" | "harmony" | "thundercore" | "okexchain" | "optimism" | "arbitrum" | "kcc" | "celo" | "moonriver" | "shiden" | "palm" | "energyweb" | "energi" | "songbird" | "hpb" | "gochain" | "ethereumclassic" | "xdaiarb" | "kardia" | "fuse" | "smartbch" | "elastos" | "hoo" | "fusion" | "aurora" | "ronin" | "boba" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto" | "csc" | "nahmii" | "liquidchain" | "meter" | "theta" | "oasis" | "syscoin" | "moonbeam" | "curio" | "astar" | "godwoken" | "evmos" | "conflux" | "milkomeda" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clover" | "echelon" | "multivac";
5
+ export declare type Chain = "ethereum" | "bsc" | "polygon" | "heco" | "fantom" | "rsk" | "tomochain" | "xdai" | "avax" | "wan" | "iotex" | "harmony" | "thundercore" | "okexchain" | "optimism" | "arbitrum" | "kcc" | "celo" | "moonriver" | "shiden" | "palm" | "energyweb" | "energi" | "songbird" | "hpb" | "gochain" | "ethereumclassic" | "xdaiarb" | "kardia" | "fuse" | "smartbch" | "elastos" | "hoo" | "fusion" | "aurora" | "ronin" | "boba" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto" | "csc" | "nahmii" | "liquidchain" | "meter" | "theta" | "oasis" | "syscoin" | "moonbeam" | "curio" | "astar" | "godwoken" | "evmos" | "conflux" | "milkomeda" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clover" | "echelon" | "multivac" | "sx";
6
6
  export declare function getProvider(chain?: Chain): ethers.providers.BaseProvider;
7
7
  export declare const TEN: ethers.BigNumber;
8
8
  export declare function handleDecimals(num: BigNumber, decimals?: number): string;
package/build/general.js CHANGED
@@ -53,7 +53,7 @@ exports.providers = {
53
53
  gochain: createProvider("gochain", "https://rpc.gochain.io", 60),
54
54
  ethereumclassic: createProvider("ethereumclassic", "https://www.ethercluster.com/etc,https://blockscout.com/etc/mainnet/api/eth-rpc", 61),
55
55
  xdaiarb: createProvider("xdaiarb", "https://arbitrum.xdaichain.com", 200),
56
- kardia: createProvider("kardia", "https://rpc.kardiachain.io/", 0),
56
+ kardia: createProvider("kardia", "https://rpc.kardiachain.io/", 24),
57
57
  fuse: createProvider("fuse", "https://rpc.fuse.io", 122),
58
58
  smartbch: createProvider("smartbch", "https://smartbch.fountainhead.cash/mainnet", 10000),
59
59
  elastos: createProvider("elastos", "https://api.elastos.io/eth,https://api.trinity-tech.cn/eth", 20),
@@ -62,7 +62,7 @@ exports.providers = {
62
62
  aurora: createProvider("aurora", "https://mainnet.aurora.dev", 1313161554),
63
63
  ronin: createProvider("ronin", "https://api.roninchain.com/rpc", 2020),
64
64
  boba: createProvider("boba", "https://mainnet.boba.network/", 288),
65
- cronos: createProvider("cronos", "https://evm.cronos.org,https://evm-cronos.crypto.org", 25),
65
+ cronos: createProvider("cronos", "https://rpc.vvs.finance,https://evm-cronos.crypto.org,https://evm.cronos.org", 25),
66
66
  polis: createProvider("polis", "https://rpc.polis.tech", 333999),
67
67
  zyx: createProvider("zyx", "https://rpc-1.zyx.network/,https://rpc-2.zyx.network/,https://rpc-3.zyx.network/,https://rpc-5.zyx.network/", 55),
68
68
  telos: createProvider("telos", "https://mainnet.telos.net/evm,https://rpc1.eu.telos.net/evm,https://rpc1.us.telos.net/evm", 40),
@@ -70,7 +70,7 @@ exports.providers = {
70
70
  ubiq: createProvider("ubiq", "https://rpc.octano.dev", 8),
71
71
  velas: createProvider("velas", "https://evmexplorer.velas.com/rpc", 106),
72
72
  callisto: createProvider("callisto", "https://clo-geth.0xinfra.com/", 820),
73
- klaytn: createProvider("klaytn", "https://public-node-api.klaytnapi.com/v1/cypress,http://175.209.78.135:8551", 8217),
73
+ klaytn: createProvider("klaytn", "https://public-node-api.klaytnapi.com/v1/cypress", 8217),
74
74
  csc: createProvider("csc", "https://rpc.coinex.net/,https://rpc1.coinex.net/,https://rpc2.coinex.net/,https://rpc3.coinex.net/,https://rpc4.coinex.net/", 52),
75
75
  nahmii: createProvider("nahmii", "https://l2.nahmii.io/", 5551),
76
76
  liquidchain: createProvider("xlc", "https://rpc.liquidchain.net/,https://rpc.xlcscan.com/", 5050),
@@ -97,6 +97,7 @@ exports.providers = {
97
97
  echelon: createProvider("echelon", "https://rpc.ech.network,https://evm.ech.network,https://draco.ech.network", 3000),
98
98
  multivac: createProvider("multivac", "https://rpc.mtv.ac,https://rpc-eu.mtv.ac", 62621),
99
99
  kava: createProvider("kava", "https://evm.kava.io", 2222),
100
+ sx: createProvider("sx", "https://rpc.sx.technology", 416),
100
101
  };
101
102
  function getProvider(chain) {
102
103
  if (chain === void 0) { chain = "ethereum"; }
@@ -11,19 +11,6 @@ export declare function lookupBlock(timestamp: number, extraParams?: {
11
11
  block: number;
12
12
  timestamp: number;
13
13
  }>;
14
- export declare function tokenList(): Promise<({
15
- symbol: string;
16
- contract: string;
17
- decimals: number;
18
- } | {
19
- symbol: string;
20
- contract: string;
21
- decimals?: undefined;
22
- } | {
23
- symbol: string;
24
- contract: string;
25
- decimals: string;
26
- })[]>;
27
14
  export declare function kyberTokens(): Promise<{
28
15
  output: {
29
16
  [address: string]: {
@@ -33,15 +20,6 @@ export declare function kyberTokens(): Promise<{
33
20
  };
34
21
  };
35
22
  }>;
36
- export declare function toSymbols(tokenBalances: {
37
- [address: string]: string;
38
- }): Promise<{
39
- output: {
40
- symbol: string;
41
- address: string;
42
- balance: string;
43
- }[];
44
- }>;
45
23
  export declare function getLogs(params: {
46
24
  target: Address;
47
25
  topic: string;
@@ -50,12 +50,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.getLogs = exports.toSymbols = exports.kyberTokens = exports.tokenList = exports.lookupBlock = exports.getLatestBlock = void 0;
53
+ exports.getLogs = exports.kyberTokens = exports.lookupBlock = exports.getLatestBlock = void 0;
54
54
  var general_1 = require("../general");
55
55
  var node_fetch_1 = __importDefault(require("node-fetch"));
56
- var tokenList_1 = __importDefault(require("./tokenList"));
57
56
  var ethers_1 = require("ethers");
58
- var erc20_1 = require("../erc20");
59
57
  var kavaBlockProvider = {
60
58
  getBlock: function (height) { return __awaiter(void 0, void 0, void 0, function () {
61
59
  return __generator(this, function (_a) {
@@ -179,15 +177,6 @@ function lookupBlock(timestamp, extraParams) {
179
177
  });
180
178
  }
181
179
  exports.lookupBlock = lookupBlock;
182
- // TODO: Pull the data from somewhere like coingecko
183
- function tokenList() {
184
- return __awaiter(this, void 0, void 0, function () {
185
- return __generator(this, function (_a) {
186
- return [2 /*return*/, tokenList_1.default];
187
- });
188
- });
189
- }
190
- exports.tokenList = tokenList;
191
180
  function kyberTokens() {
192
181
  return __awaiter(this, void 0, void 0, function () {
193
182
  var pairs, tokens;
@@ -213,92 +202,11 @@ function kyberTokens() {
213
202
  });
214
203
  }
215
204
  exports.kyberTokens = kyberTokens;
216
- function toSymbols(tokenBalances) {
217
- return __awaiter(this, void 0, void 0, function () {
218
- var tokens, output;
219
- var _a;
220
- var _this = this;
221
- return __generator(this, function (_b) {
222
- switch (_b.label) {
223
- case 0: return [4 /*yield*/, tokenList()];
224
- case 1:
225
- tokens = _b.sent();
226
- output = Object.entries(tokenBalances).map(function (_a) {
227
- var token = _a[0], balance = _a[1];
228
- return __awaiter(_this, void 0, void 0, function () {
229
- var tokenData, tokenSymbol, tokenDecimals, e_2, decimalBalance, _b, _c, _d, _e, _f, _g;
230
- var _h;
231
- var _j;
232
- return __generator(this, function (_k) {
233
- switch (_k.label) {
234
- case 0:
235
- tokenData = tokens.find(function (possibleToken) {
236
- return possibleToken.contract.toLowerCase() === token.toLowerCase();
237
- });
238
- if (token.toLowerCase() === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") {
239
- tokenData = {
240
- symbol: "ETH",
241
- contract: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
242
- decimals: "18",
243
- };
244
- }
245
- if (!(tokenData === undefined)) return [3 /*break*/, 5];
246
- _k.label = 1;
247
- case 1:
248
- _k.trys.push([1, 4, , 5]);
249
- tokenSymbol = erc20_1.symbol(token);
250
- tokenDecimals = erc20_1.decimals(token);
251
- _h = {};
252
- return [4 /*yield*/, tokenDecimals];
253
- case 2:
254
- _h.decimals = (_k.sent()).output,
255
- _h.contract = token.toLowerCase();
256
- return [4 /*yield*/, tokenSymbol];
257
- case 3:
258
- tokenData = (_h.symbol = (_k.sent()).output,
259
- _h);
260
- return [3 /*break*/, 5];
261
- case 4:
262
- e_2 = _k.sent();
263
- throw new Error("Failed to get token data for token at " + token);
264
- case 5:
265
- _b = Number(balance);
266
- _d = (_c = Math).pow;
267
- _e = [10];
268
- _f = Number;
269
- if (!((_j = tokenData === null || tokenData === void 0 ? void 0 : tokenData.decimals) !== null && _j !== void 0)) return [3 /*break*/, 6];
270
- _g = _j;
271
- return [3 /*break*/, 8];
272
- case 6: return [4 /*yield*/, erc20_1.decimals(token)];
273
- case 7:
274
- _g = (_k.sent()).output;
275
- _k.label = 8;
276
- case 8:
277
- decimalBalance = (_b /
278
- _d.apply(_c, _e.concat([_f.apply(void 0, [_g])]))).toFixed(6);
279
- return [2 /*return*/, {
280
- symbol: tokenData.symbol,
281
- address: tokenData.contract,
282
- balance: decimalBalance,
283
- }];
284
- }
285
- });
286
- });
287
- });
288
- _a = {};
289
- return [4 /*yield*/, Promise.all(output)];
290
- case 2: return [2 /*return*/, (_a.output = _b.sent(),
291
- _a)];
292
- }
293
- });
294
- });
295
- }
296
- exports.toSymbols = toSymbols;
297
205
  // SMALL INCOMPATIBILITY: On the old API we don't return ids but we should
298
206
  function getLogs(params) {
299
207
  var _a;
300
208
  return __awaiter(this, void 0, void 0, function () {
301
- var filter, logs, blockSpread, currentBlock, nextBlock, partLogs, e_3;
209
+ var filter, logs, blockSpread, currentBlock, nextBlock, partLogs, e_2;
302
210
  return __generator(this, function (_b) {
303
211
  switch (_b.label) {
304
212
  case 0:
@@ -328,14 +236,14 @@ function getLogs(params) {
328
236
  currentBlock = nextBlock;
329
237
  return [3 /*break*/, 5];
330
238
  case 4:
331
- e_3 = _b.sent();
239
+ e_2 = _b.sent();
332
240
  if (blockSpread >= 2e3) {
333
241
  // We got too many results
334
242
  // We could chop it up into 2K block spreads as that is guaranteed to always return but then we'll have to make a lot of queries (easily >1000), so instead we'll keep dividing the block spread by two until we make it
335
243
  blockSpread = Math.floor(blockSpread / 2);
336
244
  }
337
245
  else {
338
- throw e_3;
246
+ throw e_2;
339
247
  }
340
248
  return [3 /*break*/, 5];
341
249
  case 5: return [3 /*break*/, 1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "2.3.73",
3
+ "version": "2.3.77",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -1 +0,0 @@
1
- export {};