@merkl/api 0.13.1 → 0.13.3

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.
@@ -29,10 +29,12 @@ new Elysia({
29
29
  .use(healthCheck) // /v3/health
30
30
  .use(sync) // GET /jobs/api/sync-with-engine
31
31
  .get("/eulerUpdate", async () => {
32
- await Redis.safeSet("EulerV2Vaults", getEulerV2Vaults);
32
+ log.info("🔃 updating Euler vaults...");
33
+ await Redis.safeSet("EulerV2Vaults", await getEulerV2Vaults());
33
34
  })
34
35
  .get("/uniswapv4Update", async () => {
35
- await Redis.safeSet("UniswapV4Pools", getUniswapV4Pools);
36
+ log.info("🔃 updating UniswapV4 pools...");
37
+ await Redis.safeSet("UniswapV4Pools", await getUniswapV4Pools());
36
38
  })
37
39
  .group("/v4", app => {
38
40
  return app.use(DungeonKeeperController);
@@ -20,7 +20,7 @@ export async function getUniswapV4Pools() {
20
20
  try {
21
21
  // 1_ Get latest euler vaults from chain
22
22
  const storedPoolsPerChain = storedPools.filter(pool => pool.chainId === chainId);
23
- log.info(`found ${storedPoolsPerChain.length} already stored vaults on ${NETWORK_LABELS[chainId]}`);
23
+ log.info(`found ${storedPoolsPerChain.length} already stored pools on ${NETWORK_LABELS[chainId]}`);
24
24
  let fromBlock;
25
25
  if (storedPoolsPerChain.length > 0) {
26
26
  fromBlock = Math.max(...storedPools.map(x => x.fetchAtBlock)) + 1;
@@ -1,11 +1,18 @@
1
1
  import { ChainId, MULTICALL_ADDRESS, Multicall__factory } from "@sdk";
2
2
  import { providers as p } from "ethers";
3
- export const providers = Object.keys(ChainId).reduce((prev, chainId) => {
4
- const url = process.env?.[`PROVIDER_${chainId}`];
5
- if (!!url)
6
- prev[chainId] = new p.StaticJsonRpcProvider(url);
7
- return prev;
8
- }, {});
3
+ const getProviders = () => {
4
+ let parsedProviders = undefined;
5
+ if (!!process.env.PROVIDERS)
6
+ parsedProviders = JSON.parse(process.env.PROVIDERS);
7
+ const providers = Object.keys(ChainId).reduce((prev, chainId) => {
8
+ const url = !!parsedProviders ? parsedProviders[chainId] : process.env?.[`PROVIDER_${chainId}`];
9
+ if (!!url)
10
+ prev[chainId] = new p.StaticJsonRpcProvider(url);
11
+ return prev;
12
+ }, {});
13
+ return providers;
14
+ };
15
+ export const providers = getProviders();
9
16
  export const archiveProviders = Object.keys(ChainId).reduce((prev, chainId) => {
10
17
  const url = !!process.env?.[`PROVIDER_ARCHIVE_${chainId}`]
11
18
  ? process.env?.[`PROVIDER_ARCHIVE_${chainId}`]