@defillama/sdk 2.3.30 → 2.3.34

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.
@@ -19,6 +19,7 @@ export declare function multiCall(params: {
19
19
  block?: number;
20
20
  target?: Address;
21
21
  chain?: Chain;
22
+ requery?: boolean;
22
23
  }): Promise<{
23
24
  output: any[];
24
25
  }>;
@@ -108,7 +108,7 @@ exports.call = call;
108
108
  function multiCall(params) {
109
109
  var _a;
110
110
  return __awaiter(this, void 0, void 0, function () {
111
- var abi, contractCalls, multicallCalls, result, _loop_1, i;
111
+ var abi, contractCalls, multicallCalls, result, _loop_1, i, flatResults, failed, newResults_1;
112
112
  return __generator(this, function (_b) {
113
113
  switch (_b.label) {
114
114
  case 0:
@@ -156,9 +156,28 @@ function multiCall(params) {
156
156
  case 4: return [4 /*yield*/, Promise.all(multicallCalls)];
157
157
  case 5:
158
158
  _b.sent();
159
- return [2 /*return*/, {
160
- output: [].concat.apply([], result), // flatten array
161
- }];
159
+ flatResults = [].concat.apply([], result);
160
+ if (!(params.requery === true && flatResults.some(function (r) { return !r.success; }))) return [3 /*break*/, 7];
161
+ failed = flatResults.map(function (r, i) { return [r, i]; }).filter(function (r) { return !r[0].success; });
162
+ return [4 /*yield*/, multiCall({
163
+ abi: params.abi,
164
+ chain: params.chain,
165
+ calls: failed.map(function (f) { return f[0].input; }),
166
+ block: params.block,
167
+ requery: params.requery,
168
+ }).then(function (_a) {
169
+ var output = _a.output;
170
+ return output;
171
+ })];
172
+ case 6:
173
+ newResults_1 = _b.sent();
174
+ failed.forEach(function (f, i) {
175
+ flatResults[f[1]] = newResults_1[i];
176
+ });
177
+ _b.label = 7;
178
+ case 7: return [2 /*return*/, {
179
+ output: flatResults, // flatten array
180
+ }];
162
181
  }
163
182
  });
164
183
  });
@@ -41,6 +41,8 @@ export declare const chainToCoingeckoId: {
41
41
  zilliqa: string;
42
42
  kardia: string;
43
43
  cronos: string;
44
+ aurora: string;
45
+ boba: string;
44
46
  };
45
47
  export default function (rawBalances: Balances, timestamp: number | "now", verbose?: boolean, knownTokenPrices?: TokenPrices, getCoingeckoLock?: GetCoingeckoLog, coingeckoMaxRetries?: number): Promise<{
46
48
  usdTvl: number;
@@ -103,6 +103,8 @@ exports.chainToCoingeckoId = {
103
103
  zilliqa: "zilliqa",
104
104
  kardia: "kardiachain",
105
105
  cronos: "cronos",
106
+ aurora: "aurora",
107
+ boba: "boba",
106
108
  };
107
109
  function currentCoingeckoUrls(chain) {
108
110
  if (chain === 'coingecko') {
@@ -1,5 +1,5 @@
1
1
  import { ethers, BigNumber } from "ethers";
2
- export declare type Chain = "ethereum" | "bsc" | "polygon" | "heco" | "fantom" | "rsk" | "tomochain" | "xdai" | "avax" | "wan" | "iotex" | "harmony" | "thundercore" | "okexchain" | "optimism" | "arbitrum" | "energyweb" | "songbird" | "hpb" | "gochain" | "ethclassic" | "xdaiarb" | "kardia" | "fuse" | "smartbch" | "elastos" | "hoo" | "fusion" | "aurora" | "ronin" | "boba" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto";
2
+ export declare type Chain = "ethereum" | "bsc" | "polygon" | "heco" | "fantom" | "rsk" | "tomochain" | "xdai" | "avax" | "wan" | "iotex" | "harmony" | "thundercore" | "okexchain" | "optimism" | "arbitrum" | "energyweb" | "songbird" | "hpb" | "gochain" | "ethclassic" | "xdaiarb" | "kardia" | "fuse" | "smartbch" | "elastos" | "hoo" | "fusion" | "aurora" | "ronin" | "boba" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto" | "csc";
3
3
  export declare function getProvider(chain?: Chain): ethers.providers.BaseProvider;
4
4
  export declare const TEN: ethers.BigNumber;
5
5
  export declare function handleDecimals(num: BigNumber, decimals?: number): string;
package/build/general.js CHANGED
@@ -70,6 +70,7 @@ var providers = {
70
70
  velas: createProvider("velas", "https://evmexplorer.velas.com/rpc", 106),
71
71
  callisto: createProvider("callisto", "https://clo-geth.0xinfra.com/", 820),
72
72
  klaytn: createProvider("klaytn", "http://175.209.78.135:8551", 8217),
73
+ csc: createProvider("csc", "https://rpc.coinex.net/,https://rpc1.coinex.net/,https://rpc2.coinex.net/,https://rpc3.coinex.net/,https://rpc4.coinex.net/", 52),
73
74
  };
74
75
  function getProvider(chain) {
75
76
  if (chain === void 0) { chain = "ethereum"; }
@@ -70,9 +70,8 @@ var kavaBlockProvider = {
70
70
  };
71
71
  var terraBlockProvider = {
72
72
  getBlock: function (height) { return __awaiter(void 0, void 0, void 0, function () {
73
- var _a;
74
- return __generator(this, function (_b) {
75
- return [2 /*return*/, node_fetch_1.default(((_a = process.env["TERRA_RPC"]) !== null && _a !== void 0 ? _a : "https://lcd.terra.dev") + "/blocks/" + height)
73
+ return __generator(this, function (_a) {
74
+ return [2 /*return*/, node_fetch_1.default("https://lcd.terra.dev/blocks/" + height)
76
75
  .then(function (res) { return res.json(); })
77
76
  .then(function (block) { return ({
78
77
  number: Number(block.block.header.height),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "2.3.30",
3
+ "version": "2.3.34",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {