@defillama/sdk 2.3.121 → 2.3.123

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.
@@ -325,6 +325,8 @@ function multicallAddress(chainId) {
325
325
  return "0x781bB181833986C78238228F9AF0891829AF922B";
326
326
  case 2002: // milkomeda_a1
327
327
  return "0x61EEE5a6c13c358101487f3b7c7Dd9863590C350";
328
+ case 20402: // muuchain
329
+ return "0xF8D7509aD8570b16dAd163A3841684f660fD9242";
328
330
  default:
329
331
  return null;
330
332
  }
@@ -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" | "milkomeda_a1" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clv" | "echelon" | "multivac" | "sx" | "karura_evm" | "nova" | "ontology_evm" | "jfin" | "bitkub" | "bitgert" | "canto" | "dogechain" | "posi" | "arbitrum_nova" | "ultron" | "tombchain" | "vision" | "ethpow" | "functionx" | "cube" | "xdc" | "step" | "kekchain";
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" | "milkomeda_a1" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clv" | "echelon" | "multivac" | "sx" | "karura_evm" | "nova" | "ontology_evm" | "jfin" | "bitkub" | "bitgert" | "canto" | "dogechain" | "posi" | "arbitrum_nova" | "ultron" | "tombchain" | "vision" | "ethpow" | "functionx" | "cube" | "xdc" | "step" | "kekchain" | "muuchain";
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
@@ -118,7 +118,8 @@ exports.providers = {
118
118
  xdc: createProvider("xdc", "https://rpc.xinfin.network,https://rpc1.xinfin.network,https://erpc.xinfin.network", 50),
119
119
  cube: createProvider("cube", "https://http-mainnet.cube.network/", 1818),
120
120
  kekchain: createProvider("kekchain", "https://mainnet.kekchain.com", 420420),
121
- step: createProvider("step", "https://rpc.step.network/", 1234)
121
+ step: createProvider("step", "https://rpc.step.network/", 1234),
122
+ muuchain: createProvider("muu", "https://mainnet-rpc.muuchain.com", 20402),
122
123
  };
123
124
  function getProvider(chain) {
124
125
  if (chain === void 0) { chain = "ethereum"; }
@@ -142,7 +142,7 @@ function lookupBlock(timestamp, extraParams) {
142
142
  var _a, _b, _c, _d;
143
143
  if (extraParams === void 0) { extraParams = {}; }
144
144
  return __awaiter(this, void 0, void 0, function () {
145
- var chain, low, lowBlock, highBlock, provider, _e, lastBlock, firstBlock, block, i, time, allowedTimeRange, imprecision, getPrecision_1, blockDiff, timeDiff, avgBlockTime, closeBlock, midBlock, blocks, e_1;
145
+ var chain, low, lowBlock, highBlock, provider, _e, lastBlock, firstBlock, block, i, time, allowedTimeRange, acceptableBlockImprecision, blockImprecision, imprecision, getPrecision_1, blockDiff, timeDiff, avgBlockTime, closeBlock, midBlock, blocks, e_1;
146
146
  return __generator(this, function (_f) {
147
147
  switch (_f.label) {
148
148
  case 0:
@@ -175,6 +175,8 @@ function lookupBlock(timestamp, extraParams) {
175
175
  time = Date.now();
176
176
  allowedTimeRange = 15 * 60 // how much imprecision is allowed (15 minutes now)
177
177
  ;
178
+ acceptableBlockImprecision = chain === 'ethereum' ? 20 : 200;
179
+ blockImprecision = void 0;
178
180
  imprecision = void 0;
179
181
  getPrecision_1 = function (block) { return block.timestamp - timestamp > 0 ? block.timestamp - timestamp : timestamp - block.timestamp; };
180
182
  _f.label = 3;
@@ -198,9 +200,10 @@ function lookupBlock(timestamp, extraParams) {
198
200
  lowBlock = blocks.filter(function (i) { return i.timestamp < timestamp; }).reduce(function (lowestBlock, block) { return (timestamp - lowestBlock.timestamp) < (timestamp - block.timestamp) ? lowestBlock : block; });
199
201
  highBlock = blocks.filter(function (i) { return i.timestamp > timestamp; }).reduce(function (highestBlock, block) { return (highestBlock.timestamp - timestamp) < (block.timestamp - timestamp) ? highestBlock : block; });
200
202
  imprecision = getPrecision_1(block);
203
+ blockImprecision = highBlock.number - lowBlock.number;
201
204
  _f.label = 5;
202
205
  case 5:
203
- if (imprecision > allowedTimeRange) return [3 /*break*/, 3];
206
+ if (imprecision > allowedTimeRange && blockImprecision > acceptableBlockImprecision) return [3 /*break*/, 3];
204
207
  _f.label = 6;
205
208
  case 6:
206
209
  if (process.env.LLAMA_DEBUG_MODE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "2.3.121",
3
+ "version": "2.3.123",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {