@defillama/sdk 3.0.12 → 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.
@@ -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 {};
@@ -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[];
@@ -99,6 +99,15 @@ function normalizeParams(params) {
99
99
  return [params];
100
100
  }
101
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
+ }
102
111
  function call(params) {
103
112
  var _a;
104
113
  return __awaiter(this, void 0, void 0, function () {
@@ -106,6 +115,7 @@ function call(params) {
106
115
  return __generator(this, function (_b) {
107
116
  switch (_b.label) {
108
117
  case 0:
118
+ fixBlockTag(params);
109
119
  abi = resolveABI(params.abi);
110
120
  callParams = normalizeParams(params.params);
111
121
  contractInterface = new ethers_1.ethers.utils.Interface([abi]);
@@ -133,6 +143,7 @@ function multiCall(params) {
133
143
  return __generator(this, function (_c) {
134
144
  switch (_c.label) {
135
145
  case 0:
146
+ fixBlockTag(params);
136
147
  chain = (_a = params.chain) !== null && _a !== void 0 ? _a : 'ethereum';
137
148
  if (!params.calls)
138
149
  throw new Error('Missing calls parameter');
@@ -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?: number): Promise<any>;
22
+ }[], chain: Chain, block?: BlockTag): Promise<any>;
22
23
  export declare function networkSupportsMulticall(chain: Chain): boolean;
@@ -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:
@@ -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"; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defillama/sdk",
3
- "version": "3.0.12",
3
+ "version": "3.0.14",
4
4
  "description": "SDK for calculating TVL",
5
5
  "main": "build/index.js",
6
6
  "scripts": {