@1delta/margin-fetcher 0.0.239 → 0.0.240

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/dist/index.js CHANGED
@@ -29010,6 +29010,7 @@ async function getListsMulti(chainIds) {
29010
29010
 
29011
29011
  // src/yields/intrinsic/fetchers/lido.ts
29012
29012
  var WSTETH_URL = "https://eth-api.lido.fi/v1/protocol/steth/apr/sma";
29013
+ var DEFILLAMA_LIDO_URL = "https://yields.llama.fi/chart/747c1d2a-c668-4682-b9f9-296708a3dd90";
29013
29014
  var tETH = "Treehouse ETH::TETH";
29014
29015
  var robustFetchJson = async (url, { timeoutMs = 5e3, attempts = 3 } = {}) => {
29015
29016
  let lastErr;
@@ -29033,11 +29034,20 @@ var robustFetchJson = async (url, { timeoutMs = 5e3, attempts = 3 } = {}) => {
29033
29034
  }
29034
29035
  throw lastErr;
29035
29036
  };
29037
+ async function fetchLidoApr() {
29038
+ try {
29039
+ const res = await robustFetchJson(WSTETH_URL);
29040
+ return Number(res.data.aprs.at(-1).apr) * 0.9;
29041
+ } catch {
29042
+ const res = await robustFetchJson(DEFILLAMA_LIDO_URL);
29043
+ const latest = res.data.at(-1);
29044
+ return Number(latest.apyBase) * 0.9;
29045
+ }
29046
+ }
29036
29047
  var wstethFetcher = {
29037
29048
  label: "WSTETH",
29038
29049
  fetch: async () => {
29039
- const res = await robustFetchJson(WSTETH_URL);
29040
- const apr = Number(res.data.aprs.at(-1).apr) * 0.9;
29050
+ const apr = await fetchLidoApr();
29041
29051
  return {
29042
29052
  WSTETH: apr,
29043
29053
  [tETH]: apr