@stake-dao/reader 0.4.62 → 0.4.64

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.
@@ -17,6 +17,7 @@ export declare const GAUGES_CHUNK_SIZE: {
17
17
  42161: number;
18
18
  };
19
19
  export declare const TOKENS_CHUNK_SIZE = 100;
20
+ export declare const GAUGES_ADDRESS_CHUNK_SIZE = 300;
20
21
  export declare const GAUGES_WEIGHTS_CHUNK_SIZE = 60;
21
22
  export declare const GAUGES_REGISTRY_CHUNK_SIZE = 30;
22
23
  export declare const BROKEN_VAULTS: {
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../src/strategies/curve/fetch/curveApiData/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;CAqBvD,CAAA;AAED,eAAO,MAAM,iBAAiB;;;CAG7B,CAAA;AAED,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,eAAO,MAAM,iBAAiB;;;CAAuB,CAAA;AACrD,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAE5C,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;CAWzB,CAAA"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../../src/strategies/curve/fetch/curveApiData/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;CAqBvD,CAAA;AAED,eAAO,MAAM,iBAAiB;;;CAG7B,CAAA;AAED,eAAO,MAAM,UAAU,KAAK,CAAA;AAC5B,eAAO,MAAM,iBAAiB;;;CAAuB,CAAA;AACrD,eAAO,MAAM,iBAAiB,MAAM,CAAA;AACpC,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAC5C,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAC3C,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAE5C,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,aAAa;;;CAGzB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;CAWzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"getGaugesWeights.d.ts","sourceRoot":"","sources":["../../../../../../src/strategies/curve/fetch/curveApiData/getGaugesWeights.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA;AAE9E,eAAO,MAAM,gBAAgB,aAAoB,GAAG,OAAO,MAAM,KAAG,OAAO,CAAC,iBAAiB,CAyF5F,CAAA"}
1
+ {"version":3,"file":"getGaugesWeights.d.ts","sourceRoot":"","sources":["../../../../../../src/strategies/curve/fetch/curveApiData/getGaugesWeights.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA;AAE9E,eAAO,MAAM,gBAAgB,aAAoB,GAAG,OAAO,MAAM,KAAG,OAAO,CAAC,iBAAiB,CAoG5F,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stake-dao/reader",
3
3
  "description": "",
4
- "version": "0.4.62",
4
+ "version": "0.4.64",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "graphql-request": "^6.0.0",
36
36
  "lodash-es": "^4.17.21",
37
37
  "viem": "^2.21.53",
38
- "@stake-dao/constants": "0.4.28"
38
+ "@stake-dao/constants": "0.4.30"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/lodash-es": "^4.17.12",
@@ -36,6 +36,7 @@ export const lendingStartIndex = {
36
36
  export const CHUNK_SIZE = 30
37
37
  export const GAUGES_CHUNK_SIZE = { 1: 60, 42161: 30 }
38
38
  export const TOKENS_CHUNK_SIZE = 100
39
+ export const GAUGES_ADDRESS_CHUNK_SIZE = 300
39
40
  export const GAUGES_WEIGHTS_CHUNK_SIZE = 60
40
41
  export const GAUGES_REGISTRY_CHUNK_SIZE = 30
41
42
 
@@ -22,7 +22,7 @@ export const getCurveApiData = async (rpc: string, chainId: number, gaugesWeight
22
22
  [
23
23
  getPricesFromCurve(chainId),
24
24
  getPoolsFromRegistries(rpc, lendingCallsStartIndex, poolCounts),
25
- ...(chainId === mainnet.id ? [] : [getGaugesFromRegistry(chainId, 'https://eth.public-rpc.com')]),
25
+ ...(chainId === mainnet.id ? [] : [getGaugesFromRegistry(chainId, 'https://ethereum-rpc.publicnode.com')]),
26
26
  ],
27
27
  'getCurveApiData',
28
28
  )
@@ -2,10 +2,11 @@ import { ONE_WEEK, contracts } from '@stake-dao/constants'
2
2
  import { chunk, range } from 'lodash-es'
3
3
  import { decodeAbiParameters, formatUnits, parseAbi } from 'viem'
4
4
  import { multicall, rpcCall } from '../../../../utils.js'
5
+ import { handlePromise } from '../../../utils/promise.js'
5
6
  // import { concatBytecode } from '../../../utils/index.js'
6
7
  // import { getCurveDataGaugesWeightsOutputTypeAbi } from './abi.js'
7
8
  // import { gaugesWeightBytecode } from './bytecode.js'
8
- import { GAUGES_WEIGHTS_CHUNK_SIZE } from './config.js'
9
+ import { GAUGES_ADDRESS_CHUNK_SIZE, GAUGES_WEIGHTS_CHUNK_SIZE } from './config.js'
9
10
 
10
11
  export type GaugeWeight = {
11
12
  gauge: string
@@ -49,8 +50,19 @@ export const getGaugesWeights = async (provider: any, rpc: string): Promise<Gaug
49
50
  params: [i],
50
51
  }))
51
52
 
53
+ const chunkedGaugesCalls = chunk(gaugesCalls, GAUGES_ADDRESS_CHUNK_SIZE)
54
+
52
55
  const gauges = (
53
- await multicall(provider, gaugesCalls, parseAbi(['function gauges(uint256 index) external view returns (address)']))
56
+ await handlePromise(
57
+ chunkedGaugesCalls.map((gaugesCallsChunk) =>
58
+ multicall(
59
+ provider,
60
+ gaugesCallsChunk,
61
+ parseAbi(['function gauges(uint256 index) external view returns (address)']),
62
+ ),
63
+ ),
64
+ 'curveGaugesWeightsCalls',
65
+ ).then((res) => res.flat())
54
66
  ).map((g) => g.result)
55
67
 
56
68
  const gaugesWeightsCalls = range(0, nGauges).flatMap((i) => [