@defillama/sdk 5.0.10 → 5.0.12

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.
Files changed (40) hide show
  1. package/build/Balances.d.ts +10 -0
  2. package/build/Balances.js +51 -107
  3. package/build/ChainApi.d.ts +1 -0
  4. package/build/ChainApi.js +152 -253
  5. package/build/abi/abi2.js +47 -144
  6. package/build/abi/convertResults.js +9 -29
  7. package/build/abi/index.js +220 -326
  8. package/build/abi/multicall.js +115 -217
  9. package/build/abi/multicall3.js +59 -123
  10. package/build/abi/rpcCall.js +43 -106
  11. package/build/abi/tron.js +153 -283
  12. package/build/api.js +3 -4
  13. package/build/computeTVL/blocks.d.ts +1 -1
  14. package/build/computeTVL/blocks.js +2 -1
  15. package/build/computeTVL/humanizeNumber.js +6 -7
  16. package/build/computeTVL/prices.js +55 -145
  17. package/build/erc20/index.js +34 -122
  18. package/build/eth/index.js +37 -107
  19. package/build/general.js +22 -23
  20. package/build/generalUtil.js +68 -127
  21. package/build/index.js +2 -2
  22. package/build/providers.json +1 -1
  23. package/build/util/blocks.d.ts +5 -2
  24. package/build/util/blocks.js +234 -373
  25. package/build/util/blockscout.js +13 -58
  26. package/build/util/cache.js +112 -274
  27. package/build/util/computeTVL.js +72 -150
  28. package/build/util/cosmos.js +21 -75
  29. package/build/util/debugLog.js +5 -13
  30. package/build/util/env.d.ts +3 -2
  31. package/build/util/env.js +30 -35
  32. package/build/util/index.d.ts +5 -3
  33. package/build/util/index.js +105 -134
  34. package/build/util/internal-cache.js +7 -8
  35. package/build/util/logs.d.ts +1 -2
  36. package/build/util/logs.js +148 -236
  37. package/build/util/promisePool.js +11 -62
  38. package/build/util/r2.js +36 -95
  39. package/build/util/updateProviderList.js +23 -83
  40. package/package.json +2 -3
@@ -1,33 +1,13 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
- if (ar || !(i in from)) {
16
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
- ar[i] = from[i];
18
- }
19
- }
20
- return to.concat(ar || Array.prototype.slice.call(from));
21
- };
22
2
  Object.defineProperty(exports, "__esModule", { value: true });
23
3
  function isNumberOrBigNumber(value) {
24
4
  return typeof value === 'bigint' || typeof value === "number";
25
5
  }
26
6
  function stringifyBigNumbers(result) {
27
- var final = __assign({}, result);
7
+ let final = { ...result };
28
8
  if (Array.isArray(result))
29
- final = __spreadArray([], result, true);
30
- Object.keys(result).forEach(function (key) {
9
+ final = [...result];
10
+ Object.keys(result).forEach((key) => {
31
11
  if (isNumberOrBigNumber(result[key]))
32
12
  final[key] = result[key].toString();
33
13
  else if (typeof result[key] === "object")
@@ -38,15 +18,15 @@ function stringifyBigNumbers(result) {
38
18
  return final;
39
19
  }
40
20
  function default_1(results, functionABI) {
41
- var response;
21
+ let response;
42
22
  if (typeof results === "string" || typeof results === "boolean")
43
23
  return results;
44
24
  if (isNumberOrBigNumber(results))
45
25
  return results.toString();
46
26
  response = stringifyBigNumbers(results);
47
27
  if (functionABI && functionABI.outputs) {
48
- var outputNames = functionABI.outputs.map(function (i) { return i.name; });
49
- outputNames.map(function (name, i) {
28
+ const outputNames = functionABI.outputs.map((i) => i.name);
29
+ outputNames.map((name, i) => {
50
30
  setComponentDetails(response[i], functionABI.outputs[i]);
51
31
  if (name)
52
32
  response[name] = response[i];
@@ -64,10 +44,10 @@ function setComponentDetails(component, componentDefinition) {
64
44
  if (componentDefinition.type === "tuple")
65
45
  return setDetails(component);
66
46
  function setDetails(value) {
67
- var definitions = componentDefinition.components || componentDefinition.arrayChildren.components;
68
- definitions.map(function (def, i) {
47
+ const definitions = componentDefinition.components || componentDefinition.arrayChildren.components;
48
+ definitions.map((def, i) => {
69
49
  setComponentDetails(value[i], def);
70
- var name = def.name;
50
+ const name = def.name;
71
51
  if (name)
72
52
  value[name] = value[i];
73
53
  });