@defillama/sdk 2.3.24 → 2.3.28
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/LICENSE +661 -661
- package/README.md +16 -16
- package/build/abi/cachedABIs.d.ts +4 -4
- package/build/abi/cachedABIs.js +70 -70
- package/build/abi/convertResults.d.ts +2 -2
- package/build/abi/convertResults.js +56 -56
- package/build/abi/index.d.ts +25 -25
- package/build/abi/index.js +166 -166
- package/build/abi/index.test.d.ts +1 -1
- package/build/abi/index.test.js +651 -651
- package/build/abi/multicall.d.ts +13 -13
- package/build/abi/multicall.js +210 -210
- package/build/api.d.ts +10 -10
- package/build/api.js +32 -32
- package/build/cdp/compoundTokens.d.ts +68 -68
- package/build/cdp/compoundTokens.js +69 -69
- package/build/cdp/index.d.ts +29 -29
- package/build/cdp/index.js +124 -124
- package/build/cdp/index.test.d.ts +1 -1
- package/build/cdp/index.test.js +82 -82
- package/build/cdp/makerTokens.d.ts +10 -10
- package/build/cdp/makerTokens.js +244 -244
- package/build/cli.d.ts +2 -2
- package/build/cli.js +95 -95
- package/build/computeTVL/blocks.d.ts +15 -15
- package/build/computeTVL/blocks.js +136 -136
- package/build/computeTVL/blocks.test.d.ts +1 -1
- package/build/computeTVL/blocks.test.js +56 -56
- package/build/computeTVL/humanizeNumber.d.ts +1 -1
- package/build/computeTVL/humanizeNumber.js +18 -18
- package/build/computeTVL/index.d.ts +50 -49
- package/build/computeTVL/index.js +371 -370
- package/build/computeTVL/index.test.d.ts +1 -1
- package/build/computeTVL/index.test.js +107 -107
- package/build/computeTVL/prices.d.ts +9 -9
- package/build/computeTVL/prices.js +163 -163
- package/build/erc20/index.d.ts +31 -31
- package/build/erc20/index.js +144 -144
- package/build/erc20/index.test.d.ts +1 -1
- package/build/erc20/index.test.js +124 -124
- package/build/eth/index.d.ts +21 -21
- package/build/eth/index.js +90 -90
- package/build/eth/index.test.d.ts +1 -1
- package/build/eth/index.test.js +122 -122
- package/build/general.d.ts +7 -7
- package/build/general.js +92 -88
- package/build/general.test.d.ts +1 -1
- package/build/general.test.js +73 -73
- package/build/generalUtil.d.ts +19 -19
- package/build/generalUtil.js +117 -117
- package/build/generalUtil.test.d.ts +1 -1
- package/build/generalUtil.test.js +59 -59
- package/build/index.d.ts +2 -2
- package/build/index.js +24 -24
- package/build/index.test.js +69 -69
- package/build/types.d.ts +5 -5
- package/build/types.js +2 -2
- package/build/util/index.d.ts +57 -57
- package/build/util/index.js +351 -351
- package/build/util/index.test.d.ts +1 -1
- package/build/util/index.test.js +314 -314
- package/build/util/tokenList.d.ts +14 -14
- package/build/util/tokenList.js +3631 -3631
- package/package.json +41 -41
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var generalUtil_1 = require("./generalUtil");
|
|
4
|
-
test("sumMultiBalanceOf", function () {
|
|
5
|
-
var balances = {
|
|
6
|
-
"0x0000000000000000000000000000000000000000": "1380309269697565432250",
|
|
7
|
-
};
|
|
8
|
-
generalUtil_1.sumMultiBalanceOf(balances, {
|
|
9
|
-
ethCallCount: 1,
|
|
10
|
-
output: [
|
|
11
|
-
{
|
|
12
|
-
input: {
|
|
13
|
-
target: "0x514910771af9ca656af840dff83e8264ecf986ca",
|
|
14
|
-
params: ["0xa04197e5f7971e7aef78cf5ad2bc65aac1a967aa"],
|
|
15
|
-
},
|
|
16
|
-
success: true,
|
|
17
|
-
output: "121787335350553116046",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
input: {
|
|
21
|
-
target: "0xc00e94cb662c3520282e6f5717214004a7f26888",
|
|
22
|
-
params: ["0xfa203e643d1fddc5d8b91253ea23b3bd826cae9e"],
|
|
23
|
-
},
|
|
24
|
-
success: true,
|
|
25
|
-
output: "196377513373723266",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
input: {
|
|
29
|
-
target: "0x80fb784b7ed66730e8b1dbd9820afd29931aab03",
|
|
30
|
-
params: ["0xd48c88a18bfa81486862c6d1d172a39f1365e8ac"],
|
|
31
|
-
},
|
|
32
|
-
success: true,
|
|
33
|
-
output: "240068223687113307904",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
input: {
|
|
37
|
-
target: "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
|
|
38
|
-
params: ["0x4cc89906db523af7c3bb240a959be21cb812b434"],
|
|
39
|
-
},
|
|
40
|
-
success: true,
|
|
41
|
-
output: "32125191633871661847",
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
expect(balances).toEqual({
|
|
46
|
-
"0x0000000000000000000000000000000000000000": "1380309269697565432250",
|
|
47
|
-
"0x514910771af9ca656af840dff83e8264ecf986ca": "121787335350553116046",
|
|
48
|
-
"0xc00e94cb662c3520282e6f5717214004a7f26888": "196377513373723266",
|
|
49
|
-
"0x80fb784b7ed66730e8b1dbd9820afd29931aab03": "240068223687113307904",
|
|
50
|
-
"0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f": "32125191633871661847",
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
test("sumSingleBalance", function () {
|
|
54
|
-
var balances = {};
|
|
55
|
-
generalUtil_1.sumSingleBalance(balances, "ethereum", "2");
|
|
56
|
-
expect(balances).toMatchInlineSnapshot("\n Object {\n \"ethereum\": \"2\",\n }\n ");
|
|
57
|
-
generalUtil_1.sumSingleBalance(balances, "ethereum", "5");
|
|
58
|
-
expect(balances).toMatchInlineSnapshot("\n Object {\n \"ethereum\": \"7\",\n }\n ");
|
|
59
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var generalUtil_1 = require("./generalUtil");
|
|
4
|
+
test("sumMultiBalanceOf", function () {
|
|
5
|
+
var balances = {
|
|
6
|
+
"0x0000000000000000000000000000000000000000": "1380309269697565432250",
|
|
7
|
+
};
|
|
8
|
+
generalUtil_1.sumMultiBalanceOf(balances, {
|
|
9
|
+
ethCallCount: 1,
|
|
10
|
+
output: [
|
|
11
|
+
{
|
|
12
|
+
input: {
|
|
13
|
+
target: "0x514910771af9ca656af840dff83e8264ecf986ca",
|
|
14
|
+
params: ["0xa04197e5f7971e7aef78cf5ad2bc65aac1a967aa"],
|
|
15
|
+
},
|
|
16
|
+
success: true,
|
|
17
|
+
output: "121787335350553116046",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
input: {
|
|
21
|
+
target: "0xc00e94cb662c3520282e6f5717214004a7f26888",
|
|
22
|
+
params: ["0xfa203e643d1fddc5d8b91253ea23b3bd826cae9e"],
|
|
23
|
+
},
|
|
24
|
+
success: true,
|
|
25
|
+
output: "196377513373723266",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
input: {
|
|
29
|
+
target: "0x80fb784b7ed66730e8b1dbd9820afd29931aab03",
|
|
30
|
+
params: ["0xd48c88a18bfa81486862c6d1d172a39f1365e8ac"],
|
|
31
|
+
},
|
|
32
|
+
success: true,
|
|
33
|
+
output: "240068223687113307904",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
input: {
|
|
37
|
+
target: "0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
|
|
38
|
+
params: ["0x4cc89906db523af7c3bb240a959be21cb812b434"],
|
|
39
|
+
},
|
|
40
|
+
success: true,
|
|
41
|
+
output: "32125191633871661847",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
expect(balances).toEqual({
|
|
46
|
+
"0x0000000000000000000000000000000000000000": "1380309269697565432250",
|
|
47
|
+
"0x514910771af9ca656af840dff83e8264ecf986ca": "121787335350553116046",
|
|
48
|
+
"0xc00e94cb662c3520282e6f5717214004a7f26888": "196377513373723266",
|
|
49
|
+
"0x80fb784b7ed66730e8b1dbd9820afd29931aab03": "240068223687113307904",
|
|
50
|
+
"0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f": "32125191633871661847",
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
test("sumSingleBalance", function () {
|
|
54
|
+
var balances = {};
|
|
55
|
+
generalUtil_1.sumSingleBalance(balances, "ethereum", "2");
|
|
56
|
+
expect(balances).toMatchInlineSnapshot("\n Object {\n \"ethereum\": \"2\",\n }\n ");
|
|
57
|
+
generalUtil_1.sumSingleBalance(balances, "ethereum", "5");
|
|
58
|
+
expect(balances).toMatchInlineSnapshot("\n Object {\n \"ethereum\": \"7\",\n }\n ");
|
|
59
|
+
});
|
package/build/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as util from "./generalUtil";
|
|
2
|
-
export * as api from "./api";
|
|
1
|
+
export * as util from "./generalUtil";
|
|
2
|
+
export * as api from "./api";
|
package/build/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.api = exports.util = void 0;
|
|
23
|
-
exports.util = __importStar(require("./generalUtil"));
|
|
24
|
-
exports.api = __importStar(require("./api"));
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.api = exports.util = void 0;
|
|
23
|
+
exports.util = __importStar(require("./generalUtil"));
|
|
24
|
+
exports.api = __importStar(require("./api"));
|
package/build/index.test.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
-
function step(op) {
|
|
35
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
-
while (_) try {
|
|
37
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
-
switch (op[0]) {
|
|
40
|
-
case 0: case 1: t = op; break;
|
|
41
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
-
default:
|
|
45
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
-
if (t[2]) _.ops.pop();
|
|
50
|
-
_.trys.pop(); continue;
|
|
51
|
-
}
|
|
52
|
-
op = body.call(thisArg, _);
|
|
53
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
test("imports", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var _a;
|
|
59
|
-
return __generator(this, function (_b) {
|
|
60
|
-
switch (_b.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
_a = expect;
|
|
63
|
-
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./index")); })];
|
|
64
|
-
case 1:
|
|
65
|
-
_a.apply(void 0, [_b.sent()]).toMatchInlineSnapshot("\n Object {\n \"api\": Object {\n \"abi\": Object {\n \"call\": [Function],\n \"multiCall\": [Function],\n },\n \"cdp\": Object {\n \"aave\": Object {\n \"getAssetsLocked\": [Function],\n },\n \"compound\": Object {\n \"getAssetsLocked\": [Function],\n },\n \"getAssetsLocked\": [Function],\n \"maker\": Object {\n \"getAssetsLocked\": [Function],\n },\n },\n \"config\": Object {\n \"setProvider\": [Function],\n },\n \"erc20\": Object {\n \"balanceOf\": [Function],\n \"decimals\": [Function],\n \"info\": [Function],\n \"symbol\": [Function],\n \"totalSupply\": [Function],\n },\n \"eth\": Object {\n \"getBalance\": [Function],\n \"getBalances\": [Function],\n },\n \"util\": Object {\n \"getLogs\": [Function],\n \"kyberTokens\": [Function],\n \"lookupBlock\": [Function],\n \"toSymbols\": [Function],\n \"tokenList\": [Function],\n },\n },\n \"util\": Object {\n \"computeTVL\": [Function],\n \"sumMultiBalanceOf\": [Function],\n \"sumSingleBalance\": [Function],\n },\n }\n ");
|
|
66
|
-
return [2 /*return*/];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}); });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
31
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
32
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
33
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
34
|
+
function step(op) {
|
|
35
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
36
|
+
while (_) try {
|
|
37
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
38
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
39
|
+
switch (op[0]) {
|
|
40
|
+
case 0: case 1: t = op; break;
|
|
41
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
42
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
43
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
44
|
+
default:
|
|
45
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
46
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
47
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
48
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
49
|
+
if (t[2]) _.ops.pop();
|
|
50
|
+
_.trys.pop(); continue;
|
|
51
|
+
}
|
|
52
|
+
op = body.call(thisArg, _);
|
|
53
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
54
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
test("imports", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
var _a;
|
|
59
|
+
return __generator(this, function (_b) {
|
|
60
|
+
switch (_b.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
_a = expect;
|
|
63
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("./index")); })];
|
|
64
|
+
case 1:
|
|
65
|
+
_a.apply(void 0, [_b.sent()]).toMatchInlineSnapshot("\n Object {\n \"api\": Object {\n \"abi\": Object {\n \"call\": [Function],\n \"multiCall\": [Function],\n },\n \"cdp\": Object {\n \"aave\": Object {\n \"getAssetsLocked\": [Function],\n },\n \"compound\": Object {\n \"getAssetsLocked\": [Function],\n },\n \"getAssetsLocked\": [Function],\n \"maker\": Object {\n \"getAssetsLocked\": [Function],\n },\n },\n \"config\": Object {\n \"setProvider\": [Function],\n },\n \"erc20\": Object {\n \"balanceOf\": [Function],\n \"decimals\": [Function],\n \"info\": [Function],\n \"symbol\": [Function],\n \"totalSupply\": [Function],\n },\n \"eth\": Object {\n \"getBalance\": [Function],\n \"getBalances\": [Function],\n },\n \"util\": Object {\n \"getLogs\": [Function],\n \"kyberTokens\": [Function],\n \"lookupBlock\": [Function],\n \"toSymbols\": [Function],\n \"tokenList\": [Function],\n },\n },\n \"util\": Object {\n \"computeTVL\": [Function],\n \"sumMultiBalanceOf\": [Function],\n \"sumSingleBalance\": [Function],\n },\n }\n ");
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); });
|
package/build/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare type Address = string;
|
|
2
|
-
export declare type StringNumber = string;
|
|
3
|
-
export declare type Balances = {
|
|
4
|
-
[address: string]: StringNumber | number;
|
|
5
|
-
};
|
|
1
|
+
export declare type Address = string;
|
|
2
|
+
export declare type StringNumber = string;
|
|
3
|
+
export declare type Balances = {
|
|
4
|
+
[address: string]: StringNumber | number;
|
|
5
|
+
};
|
package/build/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/build/util/index.d.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { Chain } from "../general";
|
|
2
|
-
import type { Address } from "../types";
|
|
3
|
-
import type { Log } from "@ethersproject/abstract-provider";
|
|
4
|
-
export declare function getLatestBlock(chain: string): Promise<{
|
|
5
|
-
number: number;
|
|
6
|
-
timestamp: number;
|
|
7
|
-
}>;
|
|
8
|
-
export declare function lookupBlock(timestamp: number, extraParams?: {
|
|
9
|
-
chain?: Chain | "terra" | "kava";
|
|
10
|
-
}): Promise<{
|
|
11
|
-
block: number;
|
|
12
|
-
timestamp: number;
|
|
13
|
-
}>;
|
|
14
|
-
export declare function tokenList(): Promise<({
|
|
15
|
-
symbol: string;
|
|
16
|
-
contract: string;
|
|
17
|
-
decimals: number;
|
|
18
|
-
} | {
|
|
19
|
-
symbol: string;
|
|
20
|
-
contract: string;
|
|
21
|
-
decimals?: undefined;
|
|
22
|
-
} | {
|
|
23
|
-
symbol: string;
|
|
24
|
-
contract: string;
|
|
25
|
-
decimals: string;
|
|
26
|
-
})[]>;
|
|
27
|
-
export declare function kyberTokens(): Promise<{
|
|
28
|
-
output: {
|
|
29
|
-
[address: string]: {
|
|
30
|
-
symbol: string;
|
|
31
|
-
decimals: number;
|
|
32
|
-
ethPrice: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
}>;
|
|
36
|
-
export declare function toSymbols(tokenBalances: {
|
|
37
|
-
[address: string]: string;
|
|
38
|
-
}): Promise<{
|
|
39
|
-
output: {
|
|
40
|
-
symbol: string;
|
|
41
|
-
address: string;
|
|
42
|
-
balance: string;
|
|
43
|
-
}[];
|
|
44
|
-
}>;
|
|
45
|
-
export declare function getLogs(params: {
|
|
46
|
-
target: Address;
|
|
47
|
-
topic: string;
|
|
48
|
-
keys: string[];
|
|
49
|
-
fromBlock: number;
|
|
50
|
-
toBlock: number;
|
|
51
|
-
topics?: string[];
|
|
52
|
-
chain?: Chain;
|
|
53
|
-
}): Promise<{
|
|
54
|
-
output: string[][];
|
|
55
|
-
} | {
|
|
56
|
-
output: Log[];
|
|
57
|
-
}>;
|
|
1
|
+
import { Chain } from "../general";
|
|
2
|
+
import type { Address } from "../types";
|
|
3
|
+
import type { Log } from "@ethersproject/abstract-provider";
|
|
4
|
+
export declare function getLatestBlock(chain: string): Promise<{
|
|
5
|
+
number: number;
|
|
6
|
+
timestamp: number;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function lookupBlock(timestamp: number, extraParams?: {
|
|
9
|
+
chain?: Chain | "terra" | "kava";
|
|
10
|
+
}): Promise<{
|
|
11
|
+
block: number;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function tokenList(): Promise<({
|
|
15
|
+
symbol: string;
|
|
16
|
+
contract: string;
|
|
17
|
+
decimals: number;
|
|
18
|
+
} | {
|
|
19
|
+
symbol: string;
|
|
20
|
+
contract: string;
|
|
21
|
+
decimals?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
symbol: string;
|
|
24
|
+
contract: string;
|
|
25
|
+
decimals: string;
|
|
26
|
+
})[]>;
|
|
27
|
+
export declare function kyberTokens(): Promise<{
|
|
28
|
+
output: {
|
|
29
|
+
[address: string]: {
|
|
30
|
+
symbol: string;
|
|
31
|
+
decimals: number;
|
|
32
|
+
ethPrice: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
export declare function toSymbols(tokenBalances: {
|
|
37
|
+
[address: string]: string;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
output: {
|
|
40
|
+
symbol: string;
|
|
41
|
+
address: string;
|
|
42
|
+
balance: string;
|
|
43
|
+
}[];
|
|
44
|
+
}>;
|
|
45
|
+
export declare function getLogs(params: {
|
|
46
|
+
target: Address;
|
|
47
|
+
topic: string;
|
|
48
|
+
keys: string[];
|
|
49
|
+
fromBlock: number;
|
|
50
|
+
toBlock: number;
|
|
51
|
+
topics?: string[];
|
|
52
|
+
chain?: Chain;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
output: string[][];
|
|
55
|
+
} | {
|
|
56
|
+
output: Log[];
|
|
57
|
+
}>;
|