@stake-dao/reader 0.2.0 → 0.2.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stake-dao/reader",
3
3
  "description": "",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",
@@ -61,7 +61,7 @@ export const getCurveApiData = async (rpc: string, chainId: number, gaugesWeight
61
61
  calls: gaugesCalls,
62
62
  outputTypeAbi: getCurveDataGaugesOutputTypeAbi,
63
63
  parse: false,
64
- callsKey: 'Fetch Curve Gauges',
64
+ callsKey: `strategies/curve/fetch/curveApiData/getCurveApiData.ts: gauges - chainId ${chainId} - rpc ${rpc}`,
65
65
  })
66
66
 
67
67
  const tokens = uniqBy(
@@ -38,7 +38,7 @@ export const getGaugesFromRegistry = async (chainId: number, rpc: string): Promi
38
38
  calls: gaugesRegistryCalls,
39
39
  outputTypeAbi: [{ type: 'address[]', name: 'returnData' }],
40
40
  parse: false,
41
- callsKey: 'Fetch Curve Gauges Weights',
41
+ callsKey: `strategies/curve/fetch/curveApiData/getGaugesFromRegistry.ts: gaugesFromRegistry - chainId ${chainId} - rpc ${rpc}`,
42
42
  })
43
43
 
44
44
  return gaugesFromRegistry
@@ -40,7 +40,7 @@ export const getGaugesWeights = async (rpc: string): Promise<GaugesWeightsData>
40
40
  calls: gaugesWeightsCalls,
41
41
  outputTypeAbi: getCurveDataGaugesWeightsOutputTypeAbi,
42
42
  parse: false,
43
- callsKey: 'Fetch Curve Gauges Weights',
43
+ callsKey: `strategies/curve/fetch/curveApiData/getGaugesWeights.ts: gaugesWeights - chainId ${1} - rpc ${rpc}`,
44
44
  })
45
45
 
46
46
  return {
@@ -30,7 +30,7 @@ export const getPoolsFromRegistries = async (rpc: string, lendingCallsStartIndex
30
30
  getCurveDataPoolsOutputTypeAbi(index >= lendingCallsStartIndex),
31
31
  ),
32
32
  parse: false,
33
- callsKey: 'Fetch Curve Apis Data',
33
+ callsKey: `strategies/curve/fetch/curveApiData/getPoolsFromRegistries.ts: pools - rpc ${rpc}`,
34
34
  })
35
35
 
36
36
  return pools
@@ -31,6 +31,7 @@ export const getOnChainSdCurveData = async (chainId: number, rpc: string, calls:
31
31
  calls: allContractCreationCodes,
32
32
  outputTypeAbi: batchCurveStrats.outputType ? batchCurveStrats.outputType[chainId] : [],
33
33
  parse: false,
34
+ callsKey: `strategies/curve/onChainCalls.ts: getOnChainSdCurveData - chainId ${chainId} - rpc ${rpc}`,
34
35
  })
35
36
 
36
37
  return decodedPromise
@@ -32,7 +32,7 @@ export const buildPancakeSwapStrategies = async (rpc: string, chainId: number) =
32
32
  rpc,
33
33
  calls: poolsCalls,
34
34
  outputTypeAbi: buildPancakeSwapStrats.outputTypeHr![chainId]!,
35
- callsKey: `Fetch PancakeSwap Pools From Masterchef on chain ${chainId}`,
35
+ callsKey: `strategies/pancakeswap/build.ts: buildPancakeSwapStrategies/pools - chainId ${chainId} - rpc ${rpc}`,
36
36
  })
37
37
 
38
38
  return pools
@@ -23,7 +23,7 @@ export const buildPancakeSwapErc20Strategies = async (stratsList: VaultAndLp[],
23
23
  rpc,
24
24
  calls: poolsCalls,
25
25
  outputTypeAbi: buildPancakeSwapErc20Strats.outputTypeHr[chainId],
26
- callsKey: `Fetch PancakeSwap Erc20 Pools From Masterchef on chain ${chainId}`,
26
+ callsKey: `strategies/pancakeswap/buildErc20.ts: buildPancakeSwapErc20Strategies/pools - chainId ${chainId} - rpc ${rpc}`,
27
27
  })
28
28
 
29
29
  return pools
@@ -52,7 +52,7 @@ export const getPancakeErc20Vaults = async (
52
52
  rpc,
53
53
  calls: [poolsErc20Calls],
54
54
  outputTypeAbi: batchPancakeSwapErc20Strats.outputTypeHr[chainId],
55
- callsKey: `fetchPancakeSwapErc20-poolsInfo chainId ${chainId}`,
55
+ callsKey: `strategies/pancakeswap/fetch/getPancakeErc20Vaults.ts: getPancakeErc20Vaults - chainId ${chainId} - rpc ${rpc}`,
56
56
  })
57
57
 
58
58
  const parsedStratsErc20 = poolsErc20.map((strat, index) => {
@@ -38,7 +38,7 @@ export const getPancakeNotDeployed = async (
38
38
  rpc,
39
39
  calls: notDeployedCalls,
40
40
  outputTypeAbi: buildPancakeswapNotDeployedErc20Strats.outputTypeHr[chainId],
41
- callsKey: `fetchPancakeSwap-notDeployed chainId ${chainId}`,
41
+ callsKey: `strategies/pancakeswap/fetch/getPancakeNotDeployed.ts: notDeployedData - chainId ${chainId} - rpc ${rpc}`,
42
42
  })
43
43
 
44
44
  const pricesToFetch = notDeployedData
@@ -37,7 +37,7 @@ export const getPancakeV3Vaults = async (
37
37
  rpc,
38
38
  calls: poolInfosCalls,
39
39
  outputTypeAbi: batchPancakeSwapStrats.outputTypeHr[chainId]!,
40
- callsKey: `fetchPancakeSwap-poolsInfo chainId ${chainId}`,
40
+ callsKey: `strategies/pancakeswap/fetch/getPancakeV3Vaults.ts: getPancakeV3Vaults - chainId ${chainId} - rpc ${rpc}`,
41
41
  })
42
42
 
43
43
  const positionsInputData = encodeAbiParameters(
@@ -50,7 +50,7 @@ export const getPancakeV3Vaults = async (
50
50
  rpc,
51
51
  calls: [positionsCalls],
52
52
  outputTypeAbi: batchPancakeSwapPositions.outputTypeHr[chainId]!,
53
- callsKey: `fetchPancakeSwap-positions chainId ${chainId}`,
53
+ callsKey: `strategies/pancakeswap/fetch/getPancakeV3Vaults.ts: positionsData - chainId ${chainId} - rpc ${rpc}`,
54
54
  })
55
55
 
56
56
  const pricesToFetch = pools
@@ -73,7 +73,7 @@ export const buildPendleStrategies = async (
73
73
  rpc,
74
74
  calls: pendleCalls,
75
75
  outputTypeAbi: buildPendleStrats.outputTypeHr[chainId],
76
- callsKey: 'Build Pendle Strategies',
76
+ callsKey: `strategies/pendle/build.ts: pendleData - chainId ${chainId} - rpc ${rpc}`,
77
77
  })
78
78
 
79
79
  return strats.map((s) => {
@@ -95,6 +95,7 @@ export const fetchPendle = async ({ prices, provider, rpc, explorerApiKey, explo
95
95
  calls: allContractCreationCodes,
96
96
  outputTypeAbi: batchPendleStrats.outputType![chainId],
97
97
  parse: false,
98
+ callsKey: `strategies/pendle/fetch.ts: fetchPendle - chainId ${chainId} - rpc ${rpc}`,
98
99
  })
99
100
 
100
101
  const multicallRawData = await multicall(
@@ -41,7 +41,7 @@ export const fetchAllYearnGauges = async (
41
41
  outputTypeAbi: fetchYearnGauges.outputType![chainId]!,
42
42
  rpc,
43
43
  parse: false,
44
- callsKey: `Fetch all Yearn gauges chainId : ${chainId}`,
44
+ callsKey: `strategies/yearn/fetch/fetchAllYearnGauges.ts: fetchAllYearnGauges - chainId ${chainId} - rpc ${rpc}`,
45
45
  })
46
46
  const decodedResult = decodedPromises[0]?.yearnStrats || []
47
47
 
package/src/utils.ts CHANGED
@@ -98,11 +98,11 @@ interface BatchJsonRpcArgs {
98
98
  calls: string[]
99
99
  outputTypeAbi: any | any[]
100
100
  parse?: boolean
101
- callsKey?: string
101
+ callsKey: string
102
102
  }
103
103
 
104
104
  export const batchJsonRpc = async (args: BatchJsonRpcArgs) => {
105
- const { rpc, calls, outputTypeAbi, parse = true, callsKey = '' } = args
105
+ const { rpc, calls, outputTypeAbi, parse = true, callsKey } = args
106
106
 
107
107
  const rpcRequests = await (
108
108
  await fetch(rpc, {