@merkl/api 0.10.350 → 0.10.351

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.
@@ -127,7 +127,7 @@ export declare const CacheDeclaration: {
127
127
  };
128
128
  UniswapV4Pools: {
129
129
  compressed: false;
130
- redisTTL: TTLType.Minutes30;
130
+ redisTTL: TTLType.Hours3;
131
131
  localCache: false;
132
132
  };
133
133
  };
@@ -115,7 +115,7 @@ export const CacheDeclaration = {
115
115
  },
116
116
  UniswapV4Pools: {
117
117
  compressed: false,
118
- redisTTL: TTLType.Minutes30,
118
+ redisTTL: TTLType.Hours3,
119
119
  localCache: false,
120
120
  },
121
121
  };
@@ -54,7 +54,7 @@ export async function CompoundDynamicData(_chainId, campaigns) {
54
54
  totalSupplyTargetToken = BN2Number(IonicERC20_INTERFACE.decodeFunctionResult("getTotalUnderlyingSupplied", result[i++])[0], campaign.campaignParameters.decimalsUnderlyingToken);
55
55
  }
56
56
  else {
57
- totalSupplyTargetToken = BN2Number(CTokenInterface.decodeFunctionResult("totalSupply", result[i++])[0], campaign.campaignParameters.decimalsUnderlyingToken);
57
+ totalSupplyTargetToken = BN2Number(CTokenInterface.decodeFunctionResult("totalSupply", result[i++])[0], campaign.campaignParameters.decimalsTargetToken);
58
58
  }
59
59
  }
60
60
  catch {
@@ -5,10 +5,10 @@ import { ChainInteractionService, ERC20Interface, NETWORK_LABELS, NULL_ADDRESS,
5
5
  import { safeFetchLogs } from "./fetchLogs";
6
6
  const UNIV4_CHAINIDS = Object.keys(UniswapV4Addresses).map((x) => Number(x));
7
7
  async function getUniswapV4Pools() {
8
- const res = {};
9
- for (let chainId of UNIV4_CHAINIDS) {
8
+ const pools = {};
9
+ const res = await Promise.all(UNIV4_CHAINIDS.map(async (chainId) => {
10
10
  chainId = chainId;
11
- res[chainId] = {};
11
+ const perChainIdRes = {};
12
12
  const poolManagerAddress = UniswapV4Addresses[chainId]?.PoolManager ?? NULL_ADDRESS;
13
13
  const jsonRPCprovider = providers[chainId];
14
14
  try {
@@ -81,7 +81,7 @@ async function getUniswapV4Pools() {
81
81
  index -= 2;
82
82
  }
83
83
  const id = pool.poolId;
84
- res[chainId][id ?? "unknownKey"] = {
84
+ perChainIdRes[id ?? "unknownKey"] = {
85
85
  chainId: pool.chainId,
86
86
  currency0: pool.currency0,
87
87
  currency1: pool.currency1,
@@ -100,10 +100,14 @@ async function getUniswapV4Pools() {
100
100
  }
101
101
  }
102
102
  catch (e) {
103
- log.error(`issue when fetching UniswapV4 pools on ${chainId}`, e);
103
+ log.error(`issue when fetching UniswapV4 pools on ${NETWORK_LABELS[chainId]}`, e);
104
104
  }
105
- }
105
+ return perChainIdRes;
106
+ }));
107
+ UNIV4_CHAINIDS.forEach((chainId, i) => {
108
+ pools[chainId] = res[i];
109
+ });
106
110
  log.info("✅ successfully fetched pools on UniswapV4");
107
- return res;
111
+ return pools;
108
112
  }
109
113
  export const getUniswapV4PoolsWithCache = async () => await Redis.getOrSet("UniswapV4Pools", getUniswapV4Pools);