@defillama/sdk 2.3.21 → 2.3.25
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 +88 -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/README.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# sdk
|
|
2
|
-
|
|
3
|
-
```
|
|
4
|
-
npm i
|
|
5
|
-
npm run build
|
|
6
|
-
npm t
|
|
7
|
-
npm run format
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### Keys
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
POLYGON_RPC="https://..."
|
|
14
|
-
ETHEREUM_RPC="https://..."
|
|
15
|
-
BSC_RPC="https://..."
|
|
16
|
-
```
|
|
1
|
+
# sdk
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
npm i
|
|
5
|
+
npm run build
|
|
6
|
+
npm t
|
|
7
|
+
npm run format
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### Keys
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
POLYGON_RPC="https://..."
|
|
14
|
+
ETHEREUM_RPC="https://..."
|
|
15
|
+
BSC_RPC="https://..."
|
|
16
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
[method: string]: any;
|
|
3
|
-
};
|
|
4
|
-
export default _default;
|
|
1
|
+
declare const _default: {
|
|
2
|
+
[method: string]: any;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
package/build/abi/cachedABIs.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
"erc20:symbol": {
|
|
5
|
-
constant: true,
|
|
6
|
-
inputs: [],
|
|
7
|
-
name: "symbol",
|
|
8
|
-
outputs: [
|
|
9
|
-
{
|
|
10
|
-
internalType: "string",
|
|
11
|
-
name: "",
|
|
12
|
-
type: "string",
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
payable: false,
|
|
16
|
-
stateMutability: "view",
|
|
17
|
-
type: "function",
|
|
18
|
-
},
|
|
19
|
-
"erc20:decimals": {
|
|
20
|
-
constant: true,
|
|
21
|
-
inputs: [],
|
|
22
|
-
name: "decimals",
|
|
23
|
-
outputs: [
|
|
24
|
-
{
|
|
25
|
-
internalType: "uint8",
|
|
26
|
-
name: "",
|
|
27
|
-
type: "uint8",
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
payable: false,
|
|
31
|
-
stateMutability: "view",
|
|
32
|
-
type: "function",
|
|
33
|
-
},
|
|
34
|
-
"erc20:balanceOf": {
|
|
35
|
-
constant: true,
|
|
36
|
-
inputs: [
|
|
37
|
-
{
|
|
38
|
-
internalType: "address",
|
|
39
|
-
name: "account",
|
|
40
|
-
type: "address",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
name: "balanceOf",
|
|
44
|
-
outputs: [
|
|
45
|
-
{
|
|
46
|
-
internalType: "uint256",
|
|
47
|
-
name: "",
|
|
48
|
-
type: "uint256",
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
payable: false,
|
|
52
|
-
stateMutability: "view",
|
|
53
|
-
type: "function",
|
|
54
|
-
},
|
|
55
|
-
"erc20:totalSupply": {
|
|
56
|
-
constant: true,
|
|
57
|
-
inputs: [],
|
|
58
|
-
name: "totalSupply",
|
|
59
|
-
outputs: [
|
|
60
|
-
{
|
|
61
|
-
internalType: "uint256",
|
|
62
|
-
name: "",
|
|
63
|
-
type: "uint256",
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
payable: false,
|
|
67
|
-
stateMutability: "view",
|
|
68
|
-
type: "function",
|
|
69
|
-
},
|
|
70
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"erc20:symbol": {
|
|
5
|
+
constant: true,
|
|
6
|
+
inputs: [],
|
|
7
|
+
name: "symbol",
|
|
8
|
+
outputs: [
|
|
9
|
+
{
|
|
10
|
+
internalType: "string",
|
|
11
|
+
name: "",
|
|
12
|
+
type: "string",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
payable: false,
|
|
16
|
+
stateMutability: "view",
|
|
17
|
+
type: "function",
|
|
18
|
+
},
|
|
19
|
+
"erc20:decimals": {
|
|
20
|
+
constant: true,
|
|
21
|
+
inputs: [],
|
|
22
|
+
name: "decimals",
|
|
23
|
+
outputs: [
|
|
24
|
+
{
|
|
25
|
+
internalType: "uint8",
|
|
26
|
+
name: "",
|
|
27
|
+
type: "uint8",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
payable: false,
|
|
31
|
+
stateMutability: "view",
|
|
32
|
+
type: "function",
|
|
33
|
+
},
|
|
34
|
+
"erc20:balanceOf": {
|
|
35
|
+
constant: true,
|
|
36
|
+
inputs: [
|
|
37
|
+
{
|
|
38
|
+
internalType: "address",
|
|
39
|
+
name: "account",
|
|
40
|
+
type: "address",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
name: "balanceOf",
|
|
44
|
+
outputs: [
|
|
45
|
+
{
|
|
46
|
+
internalType: "uint256",
|
|
47
|
+
name: "",
|
|
48
|
+
type: "uint256",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
payable: false,
|
|
52
|
+
stateMutability: "view",
|
|
53
|
+
type: "function",
|
|
54
|
+
},
|
|
55
|
+
"erc20:totalSupply": {
|
|
56
|
+
constant: true,
|
|
57
|
+
inputs: [],
|
|
58
|
+
name: "totalSupply",
|
|
59
|
+
outputs: [
|
|
60
|
+
{
|
|
61
|
+
internalType: "uint256",
|
|
62
|
+
name: "",
|
|
63
|
+
type: "uint256",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
payable: false,
|
|
67
|
+
stateMutability: "view",
|
|
68
|
+
type: "function",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ethers } from "ethers";
|
|
2
|
-
export default function (results: ethers.utils.Result): any;
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
export default function (results: ethers.utils.Result): any;
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var bignumber_1 = require("@ethersproject/bignumber");
|
|
7
|
-
var lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
function stringifyBigNumbers(result, final) {
|
|
9
|
-
Object.keys(result).forEach(function (key) {
|
|
10
|
-
try {
|
|
11
|
-
final[key] = lodash_1.default.cloneDeep(result[key]);
|
|
12
|
-
if (bignumber_1.BigNumber.isBigNumber(result[key]) ||
|
|
13
|
-
typeof result[key] === "number") {
|
|
14
|
-
final[key] = result[key].toString();
|
|
15
|
-
}
|
|
16
|
-
if (typeof final[key] === "object") {
|
|
17
|
-
stringifyBigNumbers(result[key], final[key]);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
console.log(e);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
function containsNamedResults(obj) {
|
|
26
|
-
return Object.keys(obj).some(function (key) { return isNaN(Number(key)); }); // Are there any non-numeric keys?
|
|
27
|
-
}
|
|
28
|
-
function default_1(results) {
|
|
29
|
-
if (typeof results === "string" || typeof results === "boolean") {
|
|
30
|
-
return results;
|
|
31
|
-
}
|
|
32
|
-
var convertedResults = {};
|
|
33
|
-
if (results instanceof Array && !containsNamedResults(results)) {
|
|
34
|
-
// Match every idiosynchrasy of the SDK
|
|
35
|
-
convertedResults = [];
|
|
36
|
-
}
|
|
37
|
-
if (bignumber_1.BigNumber.isBigNumber(results) || typeof results === "number") {
|
|
38
|
-
convertedResults = results.toString();
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
stringifyBigNumbers(results, convertedResults);
|
|
42
|
-
}
|
|
43
|
-
if (results instanceof Array) {
|
|
44
|
-
if (results.length === 1) {
|
|
45
|
-
return convertedResults[0];
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Some calls return the extra __length__ parameter (I think when some results are named)
|
|
49
|
-
if (containsNamedResults(convertedResults)) {
|
|
50
|
-
convertedResults["__length__"] = results.length;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return convertedResults;
|
|
55
|
-
}
|
|
56
|
-
exports.default = default_1;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var bignumber_1 = require("@ethersproject/bignumber");
|
|
7
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
function stringifyBigNumbers(result, final) {
|
|
9
|
+
Object.keys(result).forEach(function (key) {
|
|
10
|
+
try {
|
|
11
|
+
final[key] = lodash_1.default.cloneDeep(result[key]);
|
|
12
|
+
if (bignumber_1.BigNumber.isBigNumber(result[key]) ||
|
|
13
|
+
typeof result[key] === "number") {
|
|
14
|
+
final[key] = result[key].toString();
|
|
15
|
+
}
|
|
16
|
+
if (typeof final[key] === "object") {
|
|
17
|
+
stringifyBigNumbers(result[key], final[key]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
console.log(e);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function containsNamedResults(obj) {
|
|
26
|
+
return Object.keys(obj).some(function (key) { return isNaN(Number(key)); }); // Are there any non-numeric keys?
|
|
27
|
+
}
|
|
28
|
+
function default_1(results) {
|
|
29
|
+
if (typeof results === "string" || typeof results === "boolean") {
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
var convertedResults = {};
|
|
33
|
+
if (results instanceof Array && !containsNamedResults(results)) {
|
|
34
|
+
// Match every idiosynchrasy of the SDK
|
|
35
|
+
convertedResults = [];
|
|
36
|
+
}
|
|
37
|
+
if (bignumber_1.BigNumber.isBigNumber(results) || typeof results === "number") {
|
|
38
|
+
convertedResults = results.toString();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
stringifyBigNumbers(results, convertedResults);
|
|
42
|
+
}
|
|
43
|
+
if (results instanceof Array) {
|
|
44
|
+
if (results.length === 1) {
|
|
45
|
+
return convertedResults[0];
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Some calls return the extra __length__ parameter (I think when some results are named)
|
|
49
|
+
if (containsNamedResults(convertedResults)) {
|
|
50
|
+
convertedResults["__length__"] = results.length;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return convertedResults;
|
|
55
|
+
}
|
|
56
|
+
exports.default = default_1;
|
package/build/abi/index.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { Address } from "../types";
|
|
2
|
-
import { Chain } from "../general";
|
|
3
|
-
declare type CallParams = string | number | (string | number)[] | undefined;
|
|
4
|
-
export declare function call(params: {
|
|
5
|
-
target: Address;
|
|
6
|
-
abi: string | any;
|
|
7
|
-
block?: number;
|
|
8
|
-
params?: CallParams;
|
|
9
|
-
chain?: Chain;
|
|
10
|
-
}): Promise<{
|
|
11
|
-
output: any;
|
|
12
|
-
}>;
|
|
13
|
-
export declare function multiCall(params: {
|
|
14
|
-
abi: string | any;
|
|
15
|
-
calls: {
|
|
16
|
-
target: Address;
|
|
17
|
-
params?: CallParams;
|
|
18
|
-
}[];
|
|
19
|
-
block?: number;
|
|
20
|
-
target?: Address;
|
|
21
|
-
chain?: Chain;
|
|
22
|
-
}): Promise<{
|
|
23
|
-
output: any[];
|
|
24
|
-
}>;
|
|
25
|
-
export {};
|
|
1
|
+
import { Address } from "../types";
|
|
2
|
+
import { Chain } from "../general";
|
|
3
|
+
declare type CallParams = string | number | (string | number)[] | undefined;
|
|
4
|
+
export declare function call(params: {
|
|
5
|
+
target: Address;
|
|
6
|
+
abi: string | any;
|
|
7
|
+
block?: number;
|
|
8
|
+
params?: CallParams;
|
|
9
|
+
chain?: Chain;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
output: any;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function multiCall(params: {
|
|
14
|
+
abi: string | any;
|
|
15
|
+
calls: {
|
|
16
|
+
target: Address;
|
|
17
|
+
params?: CallParams;
|
|
18
|
+
}[];
|
|
19
|
+
block?: number;
|
|
20
|
+
target?: Address;
|
|
21
|
+
chain?: Chain;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
output: any[];
|
|
24
|
+
}>;
|
|
25
|
+
export {};
|