@defillama/sdk 4.0.2 → 4.0.4

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.
package/build/ChainApi.js CHANGED
@@ -110,7 +110,16 @@ var ChainApi = /** @class */ (function () {
110
110
  };
111
111
  ChainApi.prototype.add = function (token, balance, _a) {
112
112
  var _b = _a === void 0 ? {} : _a, _c = _b.skipChain, skipChain = _c === void 0 ? false : _c;
113
- var chain = !skipChain ? this.chain : undefined;
113
+ token = token.replace(/\//g, ':');
114
+ var isIBCToken = token.startsWith('ibc:');
115
+ var chain = this.chain;
116
+ if (skipChain || isIBCToken) {
117
+ chain = undefined;
118
+ }
119
+ if (chain === 'injective' && token.startsWith('peggy0x')) {
120
+ chain = 'ethereum';
121
+ token = token.replace('peggy', '');
122
+ }
114
123
  (0, generalUtil_1.sumSingleBalance)(this._balances, token, balance, chain);
115
124
  };
116
125
  ChainApi.prototype.addToken = function (token, balance, _a) {
@@ -204,7 +204,7 @@ function multiCall(params) {
204
204
  flatResults = [].concat.apply([], results);
205
205
  failedQueries = flatResults.filter(function (r) { return !r.success; });
206
206
  if (failedQueries.length) {
207
- (0, debugLog_1.debugLog)("[chain: ".concat((_b = params.chain) !== null && _b !== void 0 ? _b : "ethereum", "] Failed multicalls:"), failedQueries.map(function (r) { return r.input; }));
207
+ (0, debugLog_1.debugLog)("[chain: ".concat((_b = params.chain) !== null && _b !== void 0 ? _b : "ethereum", "] [abi: ").concat(params.abi, "] Failed multicalls:"), failedQueries.map(function (r) { return r.input; }));
208
208
  if (!params.permitFailure)
209
209
  throw new Error('Multicall failed!');
210
210
  }
@@ -268,7 +268,7 @@ function cachedMultiCall(params) {
268
268
  var cachedValue = (0, cache_1.getCache)(cacheObject);
269
269
  if (cachedValue) {
270
270
  response[i] = {
271
- input: value,
271
+ input: { target: value.contract, params: value.params, },
272
272
  output: cachedValue,
273
273
  success: true,
274
274
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {