@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.
- package/build/Balances.d.ts +10 -0
- package/build/Balances.js +51 -107
- package/build/ChainApi.d.ts +1 -0
- package/build/ChainApi.js +152 -253
- package/build/abi/abi2.js +47 -144
- package/build/abi/convertResults.js +9 -29
- package/build/abi/index.js +220 -326
- package/build/abi/multicall.js +115 -217
- package/build/abi/multicall3.js +59 -123
- package/build/abi/rpcCall.js +43 -106
- package/build/abi/tron.js +153 -283
- package/build/api.js +3 -4
- package/build/computeTVL/blocks.d.ts +1 -1
- package/build/computeTVL/blocks.js +2 -1
- package/build/computeTVL/humanizeNumber.js +6 -7
- package/build/computeTVL/prices.js +55 -145
- package/build/erc20/index.js +34 -122
- package/build/eth/index.js +37 -107
- package/build/general.js +22 -23
- package/build/generalUtil.js +68 -127
- package/build/index.js +2 -2
- package/build/providers.json +1 -1
- package/build/util/blocks.d.ts +5 -2
- package/build/util/blocks.js +234 -373
- package/build/util/blockscout.js +13 -58
- package/build/util/cache.js +112 -274
- package/build/util/computeTVL.js +72 -150
- package/build/util/cosmos.js +21 -75
- package/build/util/debugLog.js +5 -13
- package/build/util/env.d.ts +3 -2
- package/build/util/env.js +30 -35
- package/build/util/index.d.ts +5 -3
- package/build/util/index.js +105 -134
- package/build/util/internal-cache.js +7 -8
- package/build/util/logs.d.ts +1 -2
- package/build/util/logs.js +148 -236
- package/build/util/promisePool.js +11 -62
- package/build/util/r2.js +36 -95
- package/build/util/updateProviderList.js +23 -83
- 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
|
-
|
|
7
|
+
let final = { ...result };
|
|
28
8
|
if (Array.isArray(result))
|
|
29
|
-
final =
|
|
30
|
-
Object.keys(result).forEach(
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
outputNames.map(
|
|
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
|
-
|
|
68
|
-
definitions.map(
|
|
47
|
+
const definitions = componentDefinition.components || componentDefinition.arrayChildren.components;
|
|
48
|
+
definitions.map((def, i) => {
|
|
69
49
|
setComponentDetails(value[i], def);
|
|
70
|
-
|
|
50
|
+
const name = def.name;
|
|
71
51
|
if (name)
|
|
72
52
|
value[name] = value[i];
|
|
73
53
|
});
|