@defillama/sdk 2.3.75 → 2.3.78
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/abi/multicall.js +9 -2
- package/build/cli.js +0 -0
- package/build/computeTVL/index.d.ts +2 -0
- package/build/computeTVL/index.js +2 -0
- package/build/general.d.ts +1 -1
- package/build/general.js +3 -2
- package/build/util/index.d.ts +0 -22
- package/build/util/index.js +4 -96
- package/package.json +1 -1
- package/build/abi/index.test.d.ts +0 -1
- package/build/abi/index.test.js +0 -669
- package/build/abi/largeMulticall.d.ts +0 -20
- package/build/abi/largeMulticall.js +0 -3
- package/build/cdp/compoundTokens.d.ts +0 -68
- package/build/cdp/compoundTokens.js +0 -69
- package/build/cdp/index.test.d.ts +0 -1
- package/build/cdp/index.test.js +0 -82
- package/build/cdp/makerTokens.d.ts +0 -10
- package/build/cdp/makerTokens.js +0 -244
- package/build/computeTVL/blocks.test.d.ts +0 -1
- package/build/computeTVL/blocks.test.js +0 -56
- package/build/computeTVL/index.test.d.ts +0 -1
- package/build/computeTVL/index.test.js +0 -107
- package/build/erc20/index.test.d.ts +0 -1
- package/build/erc20/index.test.js +0 -124
- package/build/eth/index.test.d.ts +0 -1
- package/build/eth/index.test.js +0 -122
- package/build/general.test.d.ts +0 -1
- package/build/general.test.js +0 -73
- package/build/generalUtil.test.d.ts +0 -1
- package/build/generalUtil.test.js +0 -59
- package/build/index.test.d.ts +0 -0
- package/build/index.test.js +0 -69
- package/build/util/index.test.d.ts +0 -1
- package/build/util/index.test.js +0 -314
- package/build/util/tokenList.d.ts +0 -14
- package/build/util/tokenList.js +0 -3631
package/build/abi/multicall.js
CHANGED
|
@@ -240,12 +240,18 @@ function multicallAddress(chainId) {
|
|
|
240
240
|
return "0x5a6787fc349665c5b0c4b93126a0b62f14935731"; // iotex
|
|
241
241
|
case 82:
|
|
242
242
|
return "0x59177c9e5d0488e21355816094a047bdf8f14ebe"; // meter
|
|
243
|
-
case
|
|
243
|
+
case 11297108109:
|
|
244
|
+
return "0xfFE2FF36c5b8D948f788a34f867784828aa7415D"; // palm
|
|
245
|
+
case 416:
|
|
246
|
+
return "0x834a005DDCF990Ba1a79f259e840e58F2D14F49a"; // sx
|
|
247
|
+
case 246: // energy web chain
|
|
244
248
|
case 336: // shiden
|
|
245
249
|
case 592: // astar
|
|
246
250
|
case 269: // High performance blockchain
|
|
247
251
|
case 321: // KCC
|
|
248
|
-
case
|
|
252
|
+
case 20: // elastos
|
|
253
|
+
case 8217: // Klaytn - multicall doesnt work for some reason
|
|
254
|
+
// case 88: // tomochain - multicall doesnt work for some reason
|
|
249
255
|
case 122: // Fuse
|
|
250
256
|
case 42220: // Celo
|
|
251
257
|
case 42262: // ROSE
|
|
@@ -267,6 +273,7 @@ function multicallAddress(chainId) {
|
|
|
267
273
|
case 61: // etc
|
|
268
274
|
case 60: // go
|
|
269
275
|
case 66: // okxchain
|
|
276
|
+
case 19: // songbird
|
|
270
277
|
return "0x18fA376d92511Dd04090566AB6144847c03557d8";
|
|
271
278
|
case 2222:
|
|
272
279
|
return "0x30A62aA52Fa099C4B227869EB6aeaDEda054d121"; // kava
|
package/build/cli.js
CHANGED
|
File without changes
|
package/build/general.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ethers, BigNumber } from "ethers";
|
|
|
2
2
|
export declare const providers: {
|
|
3
3
|
[chain: string]: ethers.providers.BaseProvider;
|
|
4
4
|
};
|
|
5
|
-
export declare type Chain = "ethereum" | "bsc" | "polygon" | "heco" | "fantom" | "rsk" | "tomochain" | "xdai" | "avax" | "wan" | "iotex" | "harmony" | "thundercore" | "okexchain" | "optimism" | "arbitrum" | "kcc" | "celo" | "moonriver" | "shiden" | "palm" | "energyweb" | "energi" | "songbird" | "hpb" | "gochain" | "ethereumclassic" | "xdaiarb" | "kardia" | "fuse" | "smartbch" | "elastos" | "hoo" | "fusion" | "aurora" | "ronin" | "boba" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto" | "csc" | "nahmii" | "liquidchain" | "meter" | "theta" | "oasis" | "syscoin" | "moonbeam" | "curio" | "astar" | "godwoken" | "evmos" | "conflux" | "milkomeda" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clover" | "echelon" | "multivac";
|
|
5
|
+
export declare type Chain = "ethereum" | "bsc" | "polygon" | "heco" | "fantom" | "rsk" | "tomochain" | "xdai" | "avax" | "wan" | "iotex" | "harmony" | "thundercore" | "okexchain" | "optimism" | "arbitrum" | "kcc" | "celo" | "moonriver" | "shiden" | "palm" | "energyweb" | "energi" | "songbird" | "hpb" | "gochain" | "ethereumclassic" | "xdaiarb" | "kardia" | "fuse" | "smartbch" | "elastos" | "hoo" | "fusion" | "aurora" | "ronin" | "boba" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto" | "csc" | "nahmii" | "liquidchain" | "meter" | "theta" | "oasis" | "syscoin" | "moonbeam" | "curio" | "astar" | "godwoken" | "evmos" | "conflux" | "milkomeda" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clover" | "echelon" | "multivac" | "sx";
|
|
6
6
|
export declare function getProvider(chain?: Chain): ethers.providers.BaseProvider;
|
|
7
7
|
export declare const TEN: ethers.BigNumber;
|
|
8
8
|
export declare function handleDecimals(num: BigNumber, decimals?: number): string;
|
package/build/general.js
CHANGED
|
@@ -28,7 +28,7 @@ exports.providers = {
|
|
|
28
28
|
ethereum: createProvider("ethereum", "https://eth-mainnet.gateway.pokt.network/v1/5f3453978e354ab992c4da79,https://cloudflare-eth.com/,https://main-light.eth.linkpool.io/,https://api.mycryptoapi.com/eth", 1),
|
|
29
29
|
bsc: createProvider("bsc", "https://bsc-dataseed.binance.org/,https://bsc-dataseed1.defibit.io/,https://bsc-dataseed1.ninicoin.io/,https://bsc-dataseed2.defibit.io/,https://bsc-dataseed2.ninicoin.io/", 56),
|
|
30
30
|
polygon: createProvider("polygon", "https://polygon-rpc.com/,https://rpc-mainnet.maticvigil.com/", 137),
|
|
31
|
-
heco: createProvider("heco", "https://http-mainnet.hecochain.com
|
|
31
|
+
heco: createProvider("heco", "https://http-mainnet.hecochain.com", 128),
|
|
32
32
|
fantom: createProvider("fantom", "https://rpc.ankr.com/fantom,https://rpc.ftm.tools/,https://rpcapi.fantom.network", 250),
|
|
33
33
|
rsk: createProvider("rsk", "https://public-node.rsk.co", 30),
|
|
34
34
|
tomochain: createProvider("tomochain", "https://rpc.tomochain.com", 88),
|
|
@@ -70,7 +70,7 @@ exports.providers = {
|
|
|
70
70
|
ubiq: createProvider("ubiq", "https://rpc.octano.dev", 8),
|
|
71
71
|
velas: createProvider("velas", "https://evmexplorer.velas.com/rpc", 106),
|
|
72
72
|
callisto: createProvider("callisto", "https://clo-geth.0xinfra.com/", 820),
|
|
73
|
-
klaytn: createProvider("klaytn", "https://public-node-api.klaytnapi.com/v1/cypress
|
|
73
|
+
klaytn: createProvider("klaytn", "https://public-node-api.klaytnapi.com/v1/cypress", 8217),
|
|
74
74
|
csc: createProvider("csc", "https://rpc.coinex.net/,https://rpc1.coinex.net/,https://rpc2.coinex.net/,https://rpc3.coinex.net/,https://rpc4.coinex.net/", 52),
|
|
75
75
|
nahmii: createProvider("nahmii", "https://l2.nahmii.io/", 5551),
|
|
76
76
|
liquidchain: createProvider("xlc", "https://rpc.liquidchain.net/,https://rpc.xlcscan.com/", 5050),
|
|
@@ -97,6 +97,7 @@ exports.providers = {
|
|
|
97
97
|
echelon: createProvider("echelon", "https://rpc.ech.network,https://evm.ech.network,https://draco.ech.network", 3000),
|
|
98
98
|
multivac: createProvider("multivac", "https://rpc.mtv.ac,https://rpc-eu.mtv.ac", 62621),
|
|
99
99
|
kava: createProvider("kava", "https://evm.kava.io", 2222),
|
|
100
|
+
sx: createProvider("sx", "https://rpc.sx.technology", 416),
|
|
100
101
|
};
|
|
101
102
|
function getProvider(chain) {
|
|
102
103
|
if (chain === void 0) { chain = "ethereum"; }
|
package/build/util/index.d.ts
CHANGED
|
@@ -11,19 +11,6 @@ export declare function lookupBlock(timestamp: number, extraParams?: {
|
|
|
11
11
|
block: number;
|
|
12
12
|
timestamp: number;
|
|
13
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
14
|
export declare function kyberTokens(): Promise<{
|
|
28
15
|
output: {
|
|
29
16
|
[address: string]: {
|
|
@@ -33,15 +20,6 @@ export declare function kyberTokens(): Promise<{
|
|
|
33
20
|
};
|
|
34
21
|
};
|
|
35
22
|
}>;
|
|
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
23
|
export declare function getLogs(params: {
|
|
46
24
|
target: Address;
|
|
47
25
|
topic: string;
|
package/build/util/index.js
CHANGED
|
@@ -50,12 +50,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.getLogs = exports.
|
|
53
|
+
exports.getLogs = exports.kyberTokens = exports.lookupBlock = exports.getLatestBlock = void 0;
|
|
54
54
|
var general_1 = require("../general");
|
|
55
55
|
var node_fetch_1 = __importDefault(require("node-fetch"));
|
|
56
|
-
var tokenList_1 = __importDefault(require("./tokenList"));
|
|
57
56
|
var ethers_1 = require("ethers");
|
|
58
|
-
var erc20_1 = require("../erc20");
|
|
59
57
|
var kavaBlockProvider = {
|
|
60
58
|
getBlock: function (height) { return __awaiter(void 0, void 0, void 0, function () {
|
|
61
59
|
return __generator(this, function (_a) {
|
|
@@ -179,15 +177,6 @@ function lookupBlock(timestamp, extraParams) {
|
|
|
179
177
|
});
|
|
180
178
|
}
|
|
181
179
|
exports.lookupBlock = lookupBlock;
|
|
182
|
-
// TODO: Pull the data from somewhere like coingecko
|
|
183
|
-
function tokenList() {
|
|
184
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
return __generator(this, function (_a) {
|
|
186
|
-
return [2 /*return*/, tokenList_1.default];
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
exports.tokenList = tokenList;
|
|
191
180
|
function kyberTokens() {
|
|
192
181
|
return __awaiter(this, void 0, void 0, function () {
|
|
193
182
|
var pairs, tokens;
|
|
@@ -213,92 +202,11 @@ function kyberTokens() {
|
|
|
213
202
|
});
|
|
214
203
|
}
|
|
215
204
|
exports.kyberTokens = kyberTokens;
|
|
216
|
-
function toSymbols(tokenBalances) {
|
|
217
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
-
var tokens, output;
|
|
219
|
-
var _a;
|
|
220
|
-
var _this = this;
|
|
221
|
-
return __generator(this, function (_b) {
|
|
222
|
-
switch (_b.label) {
|
|
223
|
-
case 0: return [4 /*yield*/, tokenList()];
|
|
224
|
-
case 1:
|
|
225
|
-
tokens = _b.sent();
|
|
226
|
-
output = Object.entries(tokenBalances).map(function (_a) {
|
|
227
|
-
var token = _a[0], balance = _a[1];
|
|
228
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
229
|
-
var tokenData, tokenSymbol, tokenDecimals, e_2, decimalBalance, _b, _c, _d, _e, _f, _g;
|
|
230
|
-
var _h;
|
|
231
|
-
var _j;
|
|
232
|
-
return __generator(this, function (_k) {
|
|
233
|
-
switch (_k.label) {
|
|
234
|
-
case 0:
|
|
235
|
-
tokenData = tokens.find(function (possibleToken) {
|
|
236
|
-
return possibleToken.contract.toLowerCase() === token.toLowerCase();
|
|
237
|
-
});
|
|
238
|
-
if (token.toLowerCase() === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") {
|
|
239
|
-
tokenData = {
|
|
240
|
-
symbol: "ETH",
|
|
241
|
-
contract: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
|
|
242
|
-
decimals: "18",
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
if (!(tokenData === undefined)) return [3 /*break*/, 5];
|
|
246
|
-
_k.label = 1;
|
|
247
|
-
case 1:
|
|
248
|
-
_k.trys.push([1, 4, , 5]);
|
|
249
|
-
tokenSymbol = erc20_1.symbol(token);
|
|
250
|
-
tokenDecimals = erc20_1.decimals(token);
|
|
251
|
-
_h = {};
|
|
252
|
-
return [4 /*yield*/, tokenDecimals];
|
|
253
|
-
case 2:
|
|
254
|
-
_h.decimals = (_k.sent()).output,
|
|
255
|
-
_h.contract = token.toLowerCase();
|
|
256
|
-
return [4 /*yield*/, tokenSymbol];
|
|
257
|
-
case 3:
|
|
258
|
-
tokenData = (_h.symbol = (_k.sent()).output,
|
|
259
|
-
_h);
|
|
260
|
-
return [3 /*break*/, 5];
|
|
261
|
-
case 4:
|
|
262
|
-
e_2 = _k.sent();
|
|
263
|
-
throw new Error("Failed to get token data for token at " + token);
|
|
264
|
-
case 5:
|
|
265
|
-
_b = Number(balance);
|
|
266
|
-
_d = (_c = Math).pow;
|
|
267
|
-
_e = [10];
|
|
268
|
-
_f = Number;
|
|
269
|
-
if (!((_j = tokenData === null || tokenData === void 0 ? void 0 : tokenData.decimals) !== null && _j !== void 0)) return [3 /*break*/, 6];
|
|
270
|
-
_g = _j;
|
|
271
|
-
return [3 /*break*/, 8];
|
|
272
|
-
case 6: return [4 /*yield*/, erc20_1.decimals(token)];
|
|
273
|
-
case 7:
|
|
274
|
-
_g = (_k.sent()).output;
|
|
275
|
-
_k.label = 8;
|
|
276
|
-
case 8:
|
|
277
|
-
decimalBalance = (_b /
|
|
278
|
-
_d.apply(_c, _e.concat([_f.apply(void 0, [_g])]))).toFixed(6);
|
|
279
|
-
return [2 /*return*/, {
|
|
280
|
-
symbol: tokenData.symbol,
|
|
281
|
-
address: tokenData.contract,
|
|
282
|
-
balance: decimalBalance,
|
|
283
|
-
}];
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
_a = {};
|
|
289
|
-
return [4 /*yield*/, Promise.all(output)];
|
|
290
|
-
case 2: return [2 /*return*/, (_a.output = _b.sent(),
|
|
291
|
-
_a)];
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
exports.toSymbols = toSymbols;
|
|
297
205
|
// SMALL INCOMPATIBILITY: On the old API we don't return ids but we should
|
|
298
206
|
function getLogs(params) {
|
|
299
207
|
var _a;
|
|
300
208
|
return __awaiter(this, void 0, void 0, function () {
|
|
301
|
-
var filter, logs, blockSpread, currentBlock, nextBlock, partLogs,
|
|
209
|
+
var filter, logs, blockSpread, currentBlock, nextBlock, partLogs, e_2;
|
|
302
210
|
return __generator(this, function (_b) {
|
|
303
211
|
switch (_b.label) {
|
|
304
212
|
case 0:
|
|
@@ -328,14 +236,14 @@ function getLogs(params) {
|
|
|
328
236
|
currentBlock = nextBlock;
|
|
329
237
|
return [3 /*break*/, 5];
|
|
330
238
|
case 4:
|
|
331
|
-
|
|
239
|
+
e_2 = _b.sent();
|
|
332
240
|
if (blockSpread >= 2e3) {
|
|
333
241
|
// We got too many results
|
|
334
242
|
// We could chop it up into 2K block spreads as that is guaranteed to always return but then we'll have to make a lot of queries (easily >1000), so instead we'll keep dividing the block spread by two until we make it
|
|
335
243
|
blockSpread = Math.floor(blockSpread / 2);
|
|
336
244
|
}
|
|
337
245
|
else {
|
|
338
|
-
throw
|
|
246
|
+
throw e_2;
|
|
339
247
|
}
|
|
340
248
|
return [3 /*break*/, 5];
|
|
341
249
|
case 5: return [3 /*break*/, 1];
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|