@defillama/sdk 4.0.81 → 5.0.2
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/ChainApi.d.ts +4 -2
- package/build/ChainApi.js +7 -0
- package/build/abi/convertResults.d.ts +1 -1
- package/build/abi/convertResults.js +25 -3
- package/build/abi/index.js +18 -17
- package/build/abi/multicall.d.ts +3 -3
- package/build/abi/multicall.js +90 -59
- package/build/abi/multicall3.d.ts +3 -4
- package/build/abi/multicall3.js +10 -5
- package/build/abi/rpcCall.d.ts +2 -3
- package/build/abi/rpcCall.js +1 -0
- package/build/abi/tron.js +8 -9
- package/build/erc20/index.d.ts +2 -2
- package/build/erc20/index.js +25 -24
- package/build/general.d.ts +3 -4
- package/build/general.js +58 -15
- package/build/generalUtil.d.ts +2 -2
- package/build/generalUtil.js +58 -20
- package/build/providers.json +1 -1
- package/build/util/blocks.js +1 -2
- package/build/util/index.d.ts +3 -3
- package/build/util/index.js +2 -2
- package/package.json +4 -4
package/build/util/blocks.js
CHANGED
|
@@ -245,13 +245,12 @@ var intialBlocks = {
|
|
|
245
245
|
};
|
|
246
246
|
var blockTimeCache = (0, cache_1.getTempLocalCache)({ file: 'BlockCache.json', defaultData: {} });
|
|
247
247
|
function validateCurrentBlock(block, chain) {
|
|
248
|
-
var _a, _b, _c, _d, _e, _f;
|
|
249
248
|
if (chain === void 0) { chain = 'ethereum'; }
|
|
250
249
|
var provider = getExtraProvider(chain);
|
|
251
250
|
var now = Math.floor(Date.now() / 1000);
|
|
252
251
|
var minutesDiff = Math.floor((now - block.timestamp) / 60);
|
|
253
252
|
if (minutesDiff > 60)
|
|
254
|
-
throw new Error("Last block for ".concat(chain, " is ").concat(minutesDiff, " minutes behind (").concat(new Date(block.timestamp * 1000), "). Provider is \"").concat((
|
|
253
|
+
throw new Error("Last block for ".concat(chain, " is ").concat(minutesDiff, " minutes behind (").concat(new Date(block.timestamp * 1000), "). Provider is \"").concat((0, generalUtil_1.getProviderUrl)(provider), "\""));
|
|
255
254
|
}
|
|
256
255
|
function lookupBlock(timestamp, extraParams) {
|
|
257
256
|
var _a, _b;
|
package/build/util/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Chain } from "../general";
|
|
2
2
|
import type { Address } from "../types";
|
|
3
|
-
import
|
|
3
|
+
import { ethers } from "ethers";
|
|
4
4
|
import runInPromisePoolOrig from "./promisePool";
|
|
5
5
|
export { getLatestBlock, getTimestamp, lookupBlock, } from "./blocks";
|
|
6
6
|
export declare const runInPromisePool: typeof runInPromisePoolOrig;
|
|
@@ -14,9 +14,9 @@ export declare function getLogs(params: {
|
|
|
14
14
|
topics?: string[];
|
|
15
15
|
chain?: Chain;
|
|
16
16
|
}): Promise<{
|
|
17
|
-
output: string[][];
|
|
17
|
+
output: (readonly string[])[];
|
|
18
18
|
} | {
|
|
19
|
-
output: Log[];
|
|
19
|
+
output: ethers.Log[];
|
|
20
20
|
}>;
|
|
21
21
|
export declare function normalizeAddress(address: string): string;
|
|
22
22
|
export declare function normalizePrefixes(address: string): string;
|
package/build/util/index.js
CHANGED
|
@@ -84,7 +84,7 @@ function getLogs(params) {
|
|
|
84
84
|
}
|
|
85
85
|
filter = {
|
|
86
86
|
address: params.target,
|
|
87
|
-
topics: (_a = params.topics) !== null && _a !== void 0 ? _a : [ethers_1.
|
|
87
|
+
topics: (_a = params.topics) !== null && _a !== void 0 ? _a : [ethers_1.ethers.id(params.topic)],
|
|
88
88
|
fromBlock: params.fromBlock,
|
|
89
89
|
toBlock: params.toBlock // We don't replicate Defipulse's bug because the results end up being the same anyway and hopefully they'll eventually fix it
|
|
90
90
|
};
|
|
@@ -173,7 +173,7 @@ function normalizeBalances(balances) {
|
|
|
173
173
|
});
|
|
174
174
|
var eth = balances[ethereumAddress];
|
|
175
175
|
if (eth !== undefined) {
|
|
176
|
-
balances[weth] =
|
|
176
|
+
balances[weth] = (BigInt((_a = balances[weth]) !== null && _a !== void 0 ? _a : 0) + BigInt(eth)).toString();
|
|
177
177
|
delete balances[ethereumAddress];
|
|
178
178
|
}
|
|
179
179
|
return balances;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defillama/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "SDK for calculating TVL",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws-sdk/client-s3": "^3.400.0",
|
|
27
27
|
"@supercharge/promise-pool": "^2.1.0",
|
|
28
|
-
"ethers": "^
|
|
28
|
+
"ethers": "^6.0.0",
|
|
29
29
|
"node-fetch": "^2.6.7",
|
|
30
30
|
"p-limit": "^3.0.0",
|
|
31
31
|
"tron-format-address": "^0.1.11"
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@types/jest": "^29.2.3",
|
|
35
35
|
"@types/node-fetch": "^2.5.8",
|
|
36
36
|
"jest": "^29.3.1",
|
|
37
|
-
"ts-jest": "^29.
|
|
37
|
+
"ts-jest": "^29.1.1",
|
|
38
38
|
"ts-node": "^10.9.1",
|
|
39
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^5.0.0"
|
|
40
40
|
}
|
|
41
41
|
}
|