@defillama/sdk 2.3.22 → 2.3.26
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 -353
- 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 +90 -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
package/build/erc20/index.js
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.balanceOf = exports.totalSupply = exports.decimals = exports.symbol = exports.info = void 0;
|
|
40
|
-
var ethers_1 = require("ethers");
|
|
41
|
-
var general_1 = require("../general");
|
|
42
|
-
var abi = [
|
|
43
|
-
"function balanceOf(address owner) view returns (uint256)",
|
|
44
|
-
"function totalSupply() view returns (uint256)",
|
|
45
|
-
"function decimals() view returns (uint8)",
|
|
46
|
-
"function symbol() view returns (string)",
|
|
47
|
-
];
|
|
48
|
-
function getContract(address, chain) {
|
|
49
|
-
return new ethers_1.ethers.Contract(address, abi, general_1.getProvider(chain));
|
|
50
|
-
}
|
|
51
|
-
function info(tokenAddress, chain) {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var contract, tokenSymbol, tokenDecimals;
|
|
54
|
-
var _a, _b;
|
|
55
|
-
return __generator(this, function (_c) {
|
|
56
|
-
switch (_c.label) {
|
|
57
|
-
case 0:
|
|
58
|
-
contract = getContract(tokenAddress, chain);
|
|
59
|
-
tokenSymbol = contract.symbol();
|
|
60
|
-
tokenDecimals = contract.decimals();
|
|
61
|
-
_a = {};
|
|
62
|
-
_b = {};
|
|
63
|
-
return [4 /*yield*/, tokenSymbol];
|
|
64
|
-
case 1:
|
|
65
|
-
_b.symbol = _c.sent();
|
|
66
|
-
return [4 /*yield*/, tokenDecimals];
|
|
67
|
-
case 2: return [2 /*return*/, (_a.output = (_b.decimals = _c.sent(),
|
|
68
|
-
_b),
|
|
69
|
-
_a)];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
exports.info = info;
|
|
75
|
-
function symbol(tokenAddress, chain) {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
-
var _a;
|
|
78
|
-
return __generator(this, function (_b) {
|
|
79
|
-
switch (_b.label) {
|
|
80
|
-
case 0:
|
|
81
|
-
_a = {};
|
|
82
|
-
return [4 /*yield*/, getContract(tokenAddress, chain).symbol()];
|
|
83
|
-
case 1: return [2 /*return*/, (_a.output = _b.sent(),
|
|
84
|
-
_a)];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
exports.symbol = symbol;
|
|
90
|
-
function decimals(tokenAddress, chain) {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
var _a;
|
|
93
|
-
return __generator(this, function (_b) {
|
|
94
|
-
switch (_b.label) {
|
|
95
|
-
case 0:
|
|
96
|
-
_a = {};
|
|
97
|
-
return [4 /*yield*/, getContract(tokenAddress, chain).decimals()];
|
|
98
|
-
case 1: return [2 /*return*/, (_a.output = _b.sent(),
|
|
99
|
-
_a)];
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
exports.decimals = decimals;
|
|
105
|
-
function totalSupply(params) {
|
|
106
|
-
var _a;
|
|
107
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
-
var contract, supply;
|
|
109
|
-
return __generator(this, function (_b) {
|
|
110
|
-
switch (_b.label) {
|
|
111
|
-
case 0:
|
|
112
|
-
contract = getContract(params.target, params.chain);
|
|
113
|
-
return [4 /*yield*/, contract.totalSupply({
|
|
114
|
-
blockTag: (_a = params.block) !== null && _a !== void 0 ? _a : "latest",
|
|
115
|
-
})];
|
|
116
|
-
case 1:
|
|
117
|
-
supply = _b.sent();
|
|
118
|
-
return [2 /*return*/, {
|
|
119
|
-
output: general_1.handleDecimals(supply, params.decimals),
|
|
120
|
-
}];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
exports.totalSupply = totalSupply;
|
|
126
|
-
function balanceOf(params) {
|
|
127
|
-
var _a;
|
|
128
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
var balance;
|
|
130
|
-
return __generator(this, function (_b) {
|
|
131
|
-
switch (_b.label) {
|
|
132
|
-
case 0: return [4 /*yield*/, getContract(params.target, params.chain).balanceOf(params.owner, {
|
|
133
|
-
blockTag: (_a = params.block) !== null && _a !== void 0 ? _a : "latest",
|
|
134
|
-
})];
|
|
135
|
-
case 1:
|
|
136
|
-
balance = _b.sent();
|
|
137
|
-
return [2 /*return*/, {
|
|
138
|
-
output: general_1.handleDecimals(balance, params.decimals),
|
|
139
|
-
}];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
exports.balanceOf = balanceOf;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.balanceOf = exports.totalSupply = exports.decimals = exports.symbol = exports.info = void 0;
|
|
40
|
+
var ethers_1 = require("ethers");
|
|
41
|
+
var general_1 = require("../general");
|
|
42
|
+
var abi = [
|
|
43
|
+
"function balanceOf(address owner) view returns (uint256)",
|
|
44
|
+
"function totalSupply() view returns (uint256)",
|
|
45
|
+
"function decimals() view returns (uint8)",
|
|
46
|
+
"function symbol() view returns (string)",
|
|
47
|
+
];
|
|
48
|
+
function getContract(address, chain) {
|
|
49
|
+
return new ethers_1.ethers.Contract(address, abi, general_1.getProvider(chain));
|
|
50
|
+
}
|
|
51
|
+
function info(tokenAddress, chain) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
+
var contract, tokenSymbol, tokenDecimals;
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return __generator(this, function (_c) {
|
|
56
|
+
switch (_c.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
contract = getContract(tokenAddress, chain);
|
|
59
|
+
tokenSymbol = contract.symbol();
|
|
60
|
+
tokenDecimals = contract.decimals();
|
|
61
|
+
_a = {};
|
|
62
|
+
_b = {};
|
|
63
|
+
return [4 /*yield*/, tokenSymbol];
|
|
64
|
+
case 1:
|
|
65
|
+
_b.symbol = _c.sent();
|
|
66
|
+
return [4 /*yield*/, tokenDecimals];
|
|
67
|
+
case 2: return [2 /*return*/, (_a.output = (_b.decimals = _c.sent(),
|
|
68
|
+
_b),
|
|
69
|
+
_a)];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.info = info;
|
|
75
|
+
function symbol(tokenAddress, chain) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
77
|
+
var _a;
|
|
78
|
+
return __generator(this, function (_b) {
|
|
79
|
+
switch (_b.label) {
|
|
80
|
+
case 0:
|
|
81
|
+
_a = {};
|
|
82
|
+
return [4 /*yield*/, getContract(tokenAddress, chain).symbol()];
|
|
83
|
+
case 1: return [2 /*return*/, (_a.output = _b.sent(),
|
|
84
|
+
_a)];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
exports.symbol = symbol;
|
|
90
|
+
function decimals(tokenAddress, chain) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var _a;
|
|
93
|
+
return __generator(this, function (_b) {
|
|
94
|
+
switch (_b.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
_a = {};
|
|
97
|
+
return [4 /*yield*/, getContract(tokenAddress, chain).decimals()];
|
|
98
|
+
case 1: return [2 /*return*/, (_a.output = _b.sent(),
|
|
99
|
+
_a)];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
exports.decimals = decimals;
|
|
105
|
+
function totalSupply(params) {
|
|
106
|
+
var _a;
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
var contract, supply;
|
|
109
|
+
return __generator(this, function (_b) {
|
|
110
|
+
switch (_b.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
contract = getContract(params.target, params.chain);
|
|
113
|
+
return [4 /*yield*/, contract.totalSupply({
|
|
114
|
+
blockTag: (_a = params.block) !== null && _a !== void 0 ? _a : "latest",
|
|
115
|
+
})];
|
|
116
|
+
case 1:
|
|
117
|
+
supply = _b.sent();
|
|
118
|
+
return [2 /*return*/, {
|
|
119
|
+
output: general_1.handleDecimals(supply, params.decimals),
|
|
120
|
+
}];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
exports.totalSupply = totalSupply;
|
|
126
|
+
function balanceOf(params) {
|
|
127
|
+
var _a;
|
|
128
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
+
var balance;
|
|
130
|
+
return __generator(this, function (_b) {
|
|
131
|
+
switch (_b.label) {
|
|
132
|
+
case 0: return [4 /*yield*/, getContract(params.target, params.chain).balanceOf(params.owner, {
|
|
133
|
+
blockTag: (_a = params.block) !== null && _a !== void 0 ? _a : "latest",
|
|
134
|
+
})];
|
|
135
|
+
case 1:
|
|
136
|
+
balance = _b.sent();
|
|
137
|
+
return [2 /*return*/, {
|
|
138
|
+
output: general_1.handleDecimals(balance, params.decimals),
|
|
139
|
+
}];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
exports.balanceOf = balanceOf;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var index_1 = require("./index");
|
|
40
|
-
test("symbol", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
-
var _a;
|
|
42
|
-
return __generator(this, function (_b) {
|
|
43
|
-
switch (_b.label) {
|
|
44
|
-
case 0:
|
|
45
|
-
_a = expect;
|
|
46
|
-
return [4 /*yield*/, index_1.symbol("0x6B175474E89094C44Da98b954EedeAC495271d0F")];
|
|
47
|
-
case 1:
|
|
48
|
-
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
49
|
-
output: "DAI",
|
|
50
|
-
});
|
|
51
|
-
return [2 /*return*/];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}); });
|
|
55
|
-
test("decimals", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var _a;
|
|
57
|
-
return __generator(this, function (_b) {
|
|
58
|
-
switch (_b.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
_a = expect;
|
|
61
|
-
return [4 /*yield*/, index_1.decimals("0x6B175474E89094C44Da98b954EedeAC495271d0F")];
|
|
62
|
-
case 1:
|
|
63
|
-
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
64
|
-
output: 18,
|
|
65
|
-
});
|
|
66
|
-
return [2 /*return*/];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}); });
|
|
70
|
-
test("info", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
-
var _a;
|
|
72
|
-
return __generator(this, function (_b) {
|
|
73
|
-
switch (_b.label) {
|
|
74
|
-
case 0:
|
|
75
|
-
_a = expect;
|
|
76
|
-
return [4 /*yield*/, index_1.info("0x6B175474E89094C44Da98b954EedeAC495271d0F")];
|
|
77
|
-
case 1:
|
|
78
|
-
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
79
|
-
output: {
|
|
80
|
-
symbol: "DAI",
|
|
81
|
-
decimals: 18,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
return [2 /*return*/];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}); });
|
|
88
|
-
test("totalSupply", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
-
var _a;
|
|
90
|
-
return __generator(this, function (_b) {
|
|
91
|
-
switch (_b.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
_a = expect;
|
|
94
|
-
return [4 /*yield*/, index_1.totalSupply({
|
|
95
|
-
target: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
96
|
-
block: 9424366,
|
|
97
|
-
})];
|
|
98
|
-
case 1:
|
|
99
|
-
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
100
|
-
output: "62681748267",
|
|
101
|
-
});
|
|
102
|
-
return [2 /*return*/];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}); });
|
|
106
|
-
test("balanceOf", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
|
-
var _a;
|
|
108
|
-
return __generator(this, function (_b) {
|
|
109
|
-
switch (_b.label) {
|
|
110
|
-
case 0:
|
|
111
|
-
_a = expect;
|
|
112
|
-
return [4 /*yield*/, index_1.balanceOf({
|
|
113
|
-
target: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
|
|
114
|
-
owner: "0x3FfBa143f5e69Aa671C9f8e3843C88742b1FA2D9",
|
|
115
|
-
block: 9424627,
|
|
116
|
-
})];
|
|
117
|
-
case 1:
|
|
118
|
-
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
119
|
-
output: "3914724000000000000",
|
|
120
|
-
});
|
|
121
|
-
return [2 /*return*/];
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}); });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var index_1 = require("./index");
|
|
40
|
+
test("symbol", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
+
var _a;
|
|
42
|
+
return __generator(this, function (_b) {
|
|
43
|
+
switch (_b.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
_a = expect;
|
|
46
|
+
return [4 /*yield*/, index_1.symbol("0x6B175474E89094C44Da98b954EedeAC495271d0F")];
|
|
47
|
+
case 1:
|
|
48
|
+
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
49
|
+
output: "DAI",
|
|
50
|
+
});
|
|
51
|
+
return [2 /*return*/];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}); });
|
|
55
|
+
test("decimals", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
+
var _a;
|
|
57
|
+
return __generator(this, function (_b) {
|
|
58
|
+
switch (_b.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
_a = expect;
|
|
61
|
+
return [4 /*yield*/, index_1.decimals("0x6B175474E89094C44Da98b954EedeAC495271d0F")];
|
|
62
|
+
case 1:
|
|
63
|
+
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
64
|
+
output: 18,
|
|
65
|
+
});
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); });
|
|
70
|
+
test("info", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
71
|
+
var _a;
|
|
72
|
+
return __generator(this, function (_b) {
|
|
73
|
+
switch (_b.label) {
|
|
74
|
+
case 0:
|
|
75
|
+
_a = expect;
|
|
76
|
+
return [4 /*yield*/, index_1.info("0x6B175474E89094C44Da98b954EedeAC495271d0F")];
|
|
77
|
+
case 1:
|
|
78
|
+
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
79
|
+
output: {
|
|
80
|
+
symbol: "DAI",
|
|
81
|
+
decimals: 18,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); });
|
|
88
|
+
test("totalSupply", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var _a;
|
|
90
|
+
return __generator(this, function (_b) {
|
|
91
|
+
switch (_b.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
_a = expect;
|
|
94
|
+
return [4 /*yield*/, index_1.totalSupply({
|
|
95
|
+
target: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
|
|
96
|
+
block: 9424366,
|
|
97
|
+
})];
|
|
98
|
+
case 1:
|
|
99
|
+
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
100
|
+
output: "62681748267",
|
|
101
|
+
});
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); });
|
|
106
|
+
test("balanceOf", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
|
+
var _a;
|
|
108
|
+
return __generator(this, function (_b) {
|
|
109
|
+
switch (_b.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
_a = expect;
|
|
112
|
+
return [4 /*yield*/, index_1.balanceOf({
|
|
113
|
+
target: "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359",
|
|
114
|
+
owner: "0x3FfBa143f5e69Aa671C9f8e3843C88742b1FA2D9",
|
|
115
|
+
block: 9424627,
|
|
116
|
+
})];
|
|
117
|
+
case 1:
|
|
118
|
+
_a.apply(void 0, [_b.sent()]).toEqual({
|
|
119
|
+
output: "3914724000000000000",
|
|
120
|
+
});
|
|
121
|
+
return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}); });
|
package/build/eth/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Address } from "../types";
|
|
2
|
-
import { Chain } from "../general";
|
|
3
|
-
export declare function getBalance(params: {
|
|
4
|
-
target: Address;
|
|
5
|
-
block?: number;
|
|
6
|
-
decimals?: number;
|
|
7
|
-
chain?: Chain;
|
|
8
|
-
}): Promise<{
|
|
9
|
-
output: string;
|
|
10
|
-
}>;
|
|
11
|
-
export declare function getBalances(params: {
|
|
12
|
-
targets: Address[];
|
|
13
|
-
block?: number;
|
|
14
|
-
decimals?: number;
|
|
15
|
-
chain?: Chain;
|
|
16
|
-
}): Promise<{
|
|
17
|
-
output: {
|
|
18
|
-
target: string;
|
|
19
|
-
balance: string;
|
|
20
|
-
}[];
|
|
21
|
-
}>;
|
|
1
|
+
import { Address } from "../types";
|
|
2
|
+
import { Chain } from "../general";
|
|
3
|
+
export declare function getBalance(params: {
|
|
4
|
+
target: Address;
|
|
5
|
+
block?: number;
|
|
6
|
+
decimals?: number;
|
|
7
|
+
chain?: Chain;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
output: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function getBalances(params: {
|
|
12
|
+
targets: Address[];
|
|
13
|
+
block?: number;
|
|
14
|
+
decimals?: number;
|
|
15
|
+
chain?: Chain;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
output: {
|
|
18
|
+
target: string;
|
|
19
|
+
balance: string;
|
|
20
|
+
}[];
|
|
21
|
+
}>;
|