@defillama/sdk 3.0.11 → 3.0.14
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/abi2.d.ts +6 -6
- package/build/abi/index.d.ts +4 -4
- package/build/abi/index.js +30 -1
- package/build/abi/multicall.d.ts +2 -1
- package/build/abi/multicall.js +4 -0
- package/build/general.d.ts +1 -1
- package/build/general.js +3 -0
- package/package.json +1 -1
package/build/abi/abi2.d.ts
CHANGED
|
@@ -8,27 +8,27 @@ type CallsParams = {
|
|
|
8
8
|
export declare function call(params: {
|
|
9
9
|
target: Address;
|
|
10
10
|
abi: string | any;
|
|
11
|
-
block?: number;
|
|
11
|
+
block?: number | string;
|
|
12
12
|
params?: CallParams;
|
|
13
|
-
chain?: Chain;
|
|
13
|
+
chain?: Chain | string;
|
|
14
14
|
withMetadata?: boolean;
|
|
15
15
|
}): Promise<any>;
|
|
16
16
|
export declare function multiCall(params: {
|
|
17
17
|
abi: string | any;
|
|
18
18
|
calls: CallsParams[] | (string | number)[];
|
|
19
|
-
block?: number;
|
|
19
|
+
block?: number | string;
|
|
20
20
|
target?: Address;
|
|
21
|
-
chain?: Chain;
|
|
21
|
+
chain?: Chain | string;
|
|
22
22
|
requery?: boolean;
|
|
23
23
|
withMetadata?: boolean;
|
|
24
24
|
}): Promise<any[]>;
|
|
25
25
|
export declare function fetchList(params: {
|
|
26
26
|
lengthAbi: string | any;
|
|
27
27
|
itemAbi: string | any;
|
|
28
|
-
block?: number;
|
|
28
|
+
block?: number | string;
|
|
29
29
|
startFrom?: number;
|
|
30
30
|
target: Address;
|
|
31
|
-
chain?: Chain;
|
|
31
|
+
chain?: Chain | string;
|
|
32
32
|
withMetadata?: boolean;
|
|
33
33
|
}): Promise<any[]>;
|
|
34
34
|
export {};
|
package/build/abi/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ type CallParams = string | number | (string | number)[] | undefined;
|
|
|
4
4
|
export declare function call(params: {
|
|
5
5
|
target: Address;
|
|
6
6
|
abi: string | any;
|
|
7
|
-
block?: number;
|
|
7
|
+
block?: number | string;
|
|
8
8
|
params?: CallParams;
|
|
9
|
-
chain?: Chain;
|
|
9
|
+
chain?: Chain | string;
|
|
10
10
|
}): Promise<{
|
|
11
11
|
output: any;
|
|
12
12
|
}>;
|
|
@@ -16,9 +16,9 @@ export declare function multiCall(params: {
|
|
|
16
16
|
target?: Address;
|
|
17
17
|
params?: CallParams;
|
|
18
18
|
}[];
|
|
19
|
-
block?: number;
|
|
19
|
+
block?: number | string;
|
|
20
20
|
target?: Address;
|
|
21
|
-
chain?: Chain;
|
|
21
|
+
chain?: Chain | string;
|
|
22
22
|
chunkSize?: number;
|
|
23
23
|
}): Promise<{
|
|
24
24
|
output: any[];
|
package/build/abi/index.js
CHANGED
|
@@ -58,13 +58,31 @@ var multicall_1 = __importDefault(require("./multicall"));
|
|
|
58
58
|
var convertResults_1 = __importDefault(require("./convertResults"));
|
|
59
59
|
var debugLog_1 = require("../util/debugLog");
|
|
60
60
|
var util_1 = require("../util");
|
|
61
|
+
var knownTypes = ['string', 'uint8', 'uint256', 'address',];
|
|
61
62
|
var defaultChunkSize = !!process.env.SDK_MULTICALL_CHUNK_SIZE ? +process.env.SDK_MULTICALL_CHUNK_SIZE : 500;
|
|
62
63
|
function resolveABI(providedAbi) {
|
|
63
64
|
var abi = providedAbi;
|
|
64
65
|
if (typeof abi === "string") {
|
|
65
66
|
abi = cachedABIs_1.default[abi];
|
|
66
67
|
if (abi === undefined) {
|
|
67
|
-
|
|
68
|
+
var _a = providedAbi.split(':'), outputType = _a[0], name_1 = _a[1];
|
|
69
|
+
if (!knownTypes.includes(outputType) || !name_1)
|
|
70
|
+
throw new Error("ABI method undefined");
|
|
71
|
+
abi = {
|
|
72
|
+
constant: true,
|
|
73
|
+
inputs: [],
|
|
74
|
+
name: name_1,
|
|
75
|
+
outputs: [
|
|
76
|
+
{
|
|
77
|
+
internalType: outputType,
|
|
78
|
+
name: "",
|
|
79
|
+
type: outputType,
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
payable: false,
|
|
83
|
+
stateMutability: "view",
|
|
84
|
+
type: "function",
|
|
85
|
+
};
|
|
68
86
|
}
|
|
69
87
|
}
|
|
70
88
|
// If type is omitted DP's sdk processes it fine but we don't, so we need to add it
|
|
@@ -81,6 +99,15 @@ function normalizeParams(params) {
|
|
|
81
99
|
return [params];
|
|
82
100
|
}
|
|
83
101
|
}
|
|
102
|
+
function fixBlockTag(params) {
|
|
103
|
+
var block = params.block;
|
|
104
|
+
if (typeof block !== 'string' || block === 'latest')
|
|
105
|
+
return;
|
|
106
|
+
block = +block;
|
|
107
|
+
if (isNaN(block))
|
|
108
|
+
throw new Error('Invalid block: ' + params.block);
|
|
109
|
+
params.block = block;
|
|
110
|
+
}
|
|
84
111
|
function call(params) {
|
|
85
112
|
var _a;
|
|
86
113
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -88,6 +115,7 @@ function call(params) {
|
|
|
88
115
|
return __generator(this, function (_b) {
|
|
89
116
|
switch (_b.label) {
|
|
90
117
|
case 0:
|
|
118
|
+
fixBlockTag(params);
|
|
91
119
|
abi = resolveABI(params.abi);
|
|
92
120
|
callParams = normalizeParams(params.params);
|
|
93
121
|
contractInterface = new ethers_1.ethers.utils.Interface([abi]);
|
|
@@ -115,6 +143,7 @@ function multiCall(params) {
|
|
|
115
143
|
return __generator(this, function (_c) {
|
|
116
144
|
switch (_c.label) {
|
|
117
145
|
case 0:
|
|
146
|
+
fixBlockTag(params);
|
|
118
147
|
chain = (_a = params.chain) !== null && _a !== void 0 ? _a : 'ethereum';
|
|
119
148
|
if (!params.calls)
|
|
120
149
|
throw new Error('Missing calls parameter');
|
package/build/abi/multicall.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Chain } from "../general";
|
|
2
|
+
import { BlockTag } from "@ethersproject/providers";
|
|
2
3
|
export declare const MULTICALL_ADDRESS_MAINNET = "0xeefba1e63905ef1d7acba5a8513c70307c1ce441";
|
|
3
4
|
export declare const MULTICALL_ADDRESS_KOVAN = "0x2cc8688c5f75e365aaeeb4ea8d6a480405a48d2a";
|
|
4
5
|
export declare const MULTICALL_ADDRESS_RINKEBY = "0x42ad527de7d4e9d9d011ac45b31d8551f8fe9821";
|
|
@@ -18,5 +19,5 @@ export declare const AGGREGATE_SELECTOR = "0x252dba42";
|
|
|
18
19
|
export default function makeMultiCall(functionABI: any, calls: {
|
|
19
20
|
contract: string;
|
|
20
21
|
params: any[];
|
|
21
|
-
}[], chain: Chain, block?:
|
|
22
|
+
}[], chain: Chain, block?: BlockTag): Promise<any>;
|
|
22
23
|
export declare function networkSupportsMulticall(chain: Chain): boolean;
|
package/build/abi/multicall.js
CHANGED
|
@@ -248,6 +248,10 @@ function multicallAddress(chainId) {
|
|
|
248
248
|
return "0x5e954f5972EC6BFc7dECd75779F10d848230345F"; // cronos
|
|
249
249
|
case 288:
|
|
250
250
|
return "0x80Ae459D058436ecB4e043ac48cfd209B578CBF0"; // boba
|
|
251
|
+
case 43288:
|
|
252
|
+
return "0x92C5b5B66988E6B8931a8CD3faa418b42003DF2F"; // boba
|
|
253
|
+
case 56288:
|
|
254
|
+
return "0x31cCe73DA4365342bd081F6a748AAdb7c7a49b7E"; // boba
|
|
251
255
|
case 4689:
|
|
252
256
|
return "0x5a6787fc349665c5b0c4b93126a0b62f14935731"; // iotex
|
|
253
257
|
case 82:
|
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 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" | "milkomeda_a1" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clv" | "echelon" | "multivac" | "sx" | "karura_evm" | "nova" | "ontology_evm" | "jfin" | "bitkub" | "bitgert" | "canto" | "dogechain" | "posi" | "arbitrum_nova" | "ultron" | "tombchain" | "vision" | "ethpow" | "functionx" | "cube" | "xdc" | "step" | "kekchain" | "muuchain" | "dexit";
|
|
5
|
+
export 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" | "boba_avax" | "boba_bnb" | "cronos" | "polis" | "zyx" | "telos" | "metis" | "ubiq" | "velas" | "callisto" | "csc" | "nahmii" | "liquidchain" | "meter" | "theta" | "oasis" | "syscoin" | "moonbeam" | "curio" | "astar" | "godwoken" | "evmos" | "conflux" | "milkomeda" | "milkomeda_a1" | "dfk" | "bittorrent" | "findora" | "candle" | "lachain" | "reichain" | "rei" | "clv" | "echelon" | "multivac" | "sx" | "karura_evm" | "nova" | "ontology_evm" | "jfin" | "bitkub" | "bitgert" | "canto" | "dogechain" | "posi" | "arbitrum_nova" | "ultron" | "tombchain" | "vision" | "ethpow" | "functionx" | "cube" | "xdc" | "step" | "kekchain" | "muuchain" | "dexit" | "empire";
|
|
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
|
@@ -62,6 +62,8 @@ exports.providers = {
|
|
|
62
62
|
aurora: createProvider("aurora", "https://mainnet.aurora.dev", 1313161554),
|
|
63
63
|
ronin: createProvider("ronin", "https://api.roninchain.com/rpc", 2020),
|
|
64
64
|
boba: createProvider("boba", "https://mainnet.boba.network/", 288),
|
|
65
|
+
boba_avax: createProvider("boba_avax", "https://avax.boba.network/", 43288),
|
|
66
|
+
boba_bnb: createProvider("boba_bnb", "https://bnb.boba.network/", 56288),
|
|
65
67
|
cronos: createProvider("cronos", "https://cronosrpc-1.xstaking.sg,https://evm.cronos.org,https://rpc.vvs.finance,https://evm-cronos.crypto.org", 25),
|
|
66
68
|
polis: createProvider("polis", "https://rpc.polis.tech", 333999),
|
|
67
69
|
zyx: createProvider("zyx", "https://rpc-6.zyx.network,https://rpc-4.zyx.network,https://rpc-1.zyx.network/,https://rpc-2.zyx.network/,https://rpc-3.zyx.network/,https://rpc-5.zyx.network/", 55),
|
|
@@ -134,6 +136,7 @@ exports.providers = {
|
|
|
134
136
|
step: createProvider("step", "https://rpc.step.network/", 1234),
|
|
135
137
|
muuchain: createProvider("muu", "https://mainnet-rpc.muuchain.com", 20402),
|
|
136
138
|
dexit: createProvider("dexit", "https://dxt.dexit.network", 877),
|
|
139
|
+
empire: createProvider("empire", "https://rpc.empirenetwork.io", 3693),
|
|
137
140
|
};
|
|
138
141
|
function getProvider(chain) {
|
|
139
142
|
if (chain === void 0) { chain = "ethereum"; }
|