@defillama/sdk 3.0.22 → 3.0.24

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.
@@ -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 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" | "boba_avax" | "boba_bnb" | "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" | "dexit" | "empire" | "flare";
5
+ export 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" | "boba_avax" | "boba_bnb" | "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" | "dexit" | "empire" | "flare" | "tlchain";
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
@@ -138,6 +138,7 @@ exports.providers = {
138
138
  dexit: createProvider("dexit", "https://dxt.dexit.network", 877),
139
139
  empire: createProvider("empire", "https://rpc.empirenetwork.io", 3693),
140
140
  flare: createProvider("flare", "https://flare-api.flare.network/ext/C/rpc", 14),
141
+ tlchain: createProvider("tlchain", "https://mainnet-rpc.tlchain.live", 5177),
141
142
  };
142
143
  function getProvider(chain) {
143
144
  if (chain === void 0) { chain = "ethereum"; }
@@ -15,6 +15,7 @@ export declare function sumMultiBalanceOf(balances: Balances, results: {
15
15
  }, allCallsMustBeSuccessful?: boolean, transformAddress?: (addr: string) => string): void;
16
16
  export declare function sumSingleBalance(balances: Balances, token: string, balance: string | number | BigNumber, chain?: string): void;
17
17
  export declare function mergeBalances(balances: Balances, balancesToMerge: Balances): void;
18
+ export declare function removeTokenBalance(balances: Balances, token: string, isCaseSensitive?: boolean): Balances;
18
19
  type ChainBlocks = {
19
20
  [chain: string]: number;
20
21
  };
@@ -59,7 +59,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
59
59
  }
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.humanizeNumber = exports.blocks = exports.sumChainTvls = exports.mergeBalances = exports.sumSingleBalance = exports.sumMultiBalanceOf = void 0;
62
+ exports.humanizeNumber = exports.blocks = exports.sumChainTvls = exports.removeTokenBalance = exports.mergeBalances = exports.sumSingleBalance = exports.sumMultiBalanceOf = void 0;
63
63
  var ethers_1 = require("ethers");
64
64
  var blocks = __importStar(require("./computeTVL/blocks"));
65
65
  exports.blocks = blocks;
@@ -126,6 +126,16 @@ function mergeBalances(balances, balancesToMerge) {
126
126
  });
127
127
  }
128
128
  exports.mergeBalances = mergeBalances;
129
+ function removeTokenBalance(balances, token, isCaseSensitive) {
130
+ if (isCaseSensitive === void 0) { isCaseSensitive = false; }
131
+ var re = new RegExp(token, isCaseSensitive ? undefined : 'i');
132
+ Object.keys(balances).forEach(function (key) {
133
+ if (re.test(key))
134
+ delete balances[key];
135
+ });
136
+ return balances;
137
+ }
138
+ exports.removeTokenBalance = removeTokenBalance;
129
139
  function sumChainTvls(chainTvls) {
130
140
  var _this = this;
131
141
  return function (timestamp, ethBlock, chainBlocks, params) { return __awaiter(_this, void 0, void 0, function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "3.0.22",
3
+ "version": "3.0.24",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {