@1delta/margin-fetcher 0.0.80 → 0.0.82

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
@@ -10903,7 +10903,7 @@ function createBaseTypeUserState(payload, lenderData, totalDeposits24h = 0, tota
10903
10903
  for (let i = 0; i < assetKeys.length; i++) {
10904
10904
  const asset = assetKeys[i];
10905
10905
  if (!lenderData?.[asset]) continue;
10906
- const { depositsUSD, debtStableUSD, debtUSD, collateralActive } = payload.lendingPositions["0"][asset];
10906
+ const { depositsUSD, debtStableUSD, debtUSD, collateralEnabled } = payload.lendingPositions["0"][asset];
10907
10907
  const {
10908
10908
  depositRate,
10909
10909
  stakingYield,
@@ -10928,7 +10928,7 @@ function createBaseTypeUserState(payload, lenderData, totalDeposits24h = 0, tota
10928
10928
  );
10929
10929
  stakingDepositAccrual += (stakingYield ?? 0) * depositsUSD;
10930
10930
  stakingBorrowAccrual += (stakingYield ?? 0) * (debtStableUSD + debtUSD);
10931
- if (collateralActive) {
10931
+ if (collateralEnabled) {
10932
10932
  collateral += (lenderData[asset].config[mode]?.collateralFactor ?? 1) * depositsUSD;
10933
10933
  borrowDiscountedCollateral += (lenderData[asset].config[mode]?.borrowCollateralFactor ?? 1) * depositsUSD;
10934
10934
  }
@@ -16826,7 +16826,7 @@ var getInitUserDataConverter = (lender, chainId, account, prices, pricesHist, le
16826
16826
  debtStableUSD: 0,
16827
16827
  depositsUSD: price * Number(deposits),
16828
16828
  debtUSD: price * Number(debt),
16829
- collateralEnaled: true,
16829
+ collateralEnabled: true,
16830
16830
  isAllowed: entry.approved.toLowerCase() === brokerAddress.toLowerCase()
16831
16831
  }
16832
16832
  };
@@ -16917,7 +16917,7 @@ var getCompoundV3UserDataConverter = (lender, chainId, account, prices, pricesHi
16917
16917
  // populate values for totals
16918
16918
  debtStable: "0",
16919
16919
  debtStableUSD: 0,
16920
- collateralEnabled: true,
16920
+ collateralEnabled: false,
16921
16921
  // user depos raw
16922
16922
  depositsRaw
16923
16923
  // flag for allowance
@@ -17224,7 +17224,7 @@ function createMorphoEntryFromMarketWithLens(balanceInfo, chainId, market, lende
17224
17224
  debtStableUSD: 0,
17225
17225
  debtUSD: Number(borrowDec) * priceLoan,
17226
17226
  stableBorrowRate: "0",
17227
- collateralActive: false,
17227
+ collateralEnabled: false,
17228
17228
  claimableRewards: 0
17229
17229
  };
17230
17230
  const key = toOracleKey(collateralAssetMeta?.assetGroup) ?? toGenericPriceKey(collateralAddress, chainId);
@@ -17241,7 +17241,7 @@ function createMorphoEntryFromMarketWithLens(balanceInfo, chainId, market, lende
17241
17241
  debtStableUSD: 0,
17242
17242
  debtUSD: 0,
17243
17243
  stableBorrowRate: "0",
17244
- collateralActive: true,
17244
+ collateralEnabled: true,
17245
17245
  claimableRewards: 0
17246
17246
  };
17247
17247
  return {
@@ -17649,7 +17649,8 @@ function generateLendingPairs(lenderData, prices, histPrices) {
17649
17649
  eMode: long.eMode?.category ?? 0,
17650
17650
  longTotalDepositsUSD: long.totalDepositsUSD,
17651
17651
  longTotalDebtUSD: long.totalDebtUSD,
17652
- longTotalLiquidityUSD: long.totalLiquidityUSD,
17652
+ // if the asset cannot be borrowed, liquidity is not a pparameter for longing
17653
+ longTotalLiquidityUSD: long.borrowingEnabled ? long.totalLiquidityUSD : 1e10,
17653
17654
  shortTotalDepositsUSD: short.totalDepositsUSD,
17654
17655
  shortTotalDebtUSD: short.totalDebtUSD,
17655
17656
  shortTotalLiquidityUSD: short.totalLiquidityUSD,
@@ -17953,6 +17954,7 @@ var jitoSol = "Jito Staked SOL::JitoSOL";
17953
17954
  var thBill = "Theo Short Duration US Treasury Fund::THBILL";
17954
17955
  var ssuperusd = "SuperReturn sSuperUSD::SSUPERUSD";
17955
17956
  var hbhype = "hyperbeat x ether.fi HYPE::beHYPE";
17957
+ var hlp = "Wrapped HLP::WHLP";
17956
17958
  var FeedData = {
17957
17959
  WSTETH: "https://eth-api.lido.fi/v1/protocol/steth/apr/sma",
17958
17960
  STMATIC: "https://polygon.lido.fi/api/stats",
@@ -17987,7 +17989,8 @@ var FeedData = {
17987
17989
  THBILL: "https://thbill-api.theo.xyz/snapshots",
17988
17990
  YEARN_KATANA: "https://katana-apr-service.vercel.app/api/vaults",
17989
17991
  SSUPERUSD: "https://www.superreturn.ai/api/trpc/cmc.getUSDCPrice,rewardBackend.getYield,rewardBackend.getTvlChange?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%221%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%2C%222%22%3A%7B%22json%22%3Anull%2C%22meta%22%3A%7B%22values%22%3A%5B%22undefined%22%5D%7D%7D%7D",
17990
- HBHYPE: "https://api.hyperbeat.org/api/v1/staking?address=0xCeaD893b162D38e714D82d06a7fe0b0dc3c38E0b"
17992
+ HBHYPE: "https://api.hyperbeat.org/api/v1/staking?address=0xCeaD893b162D38e714D82d06a7fe0b0dc3c38E0b",
17993
+ HLP: "https://api-ui.hyperliquid.xyz/info"
17991
17994
  };
17992
17995
  function averageDataLastN(arr, n = 7) {
17993
17996
  const last = arr.slice(-n);
@@ -18259,6 +18262,22 @@ var fetchGeneralYields = async () => {
18259
18262
  const vba = res?.data?.vaultByAddress;
18260
18263
  return apyToAprPercent(vba.state.apy ?? 0) * 100 + (vba?.asset?.yield.apr ?? 0) * 100;
18261
18264
  });
18265
+ const hlpPromise = safeFetch("HLP", async () => {
18266
+ const res = await fetch(FeedData.HLP, {
18267
+ method: "POST",
18268
+ headers: {
18269
+ Accept: "application/json",
18270
+ "Content-Type": "application/json"
18271
+ // <-- required
18272
+ },
18273
+ body: JSON.stringify({
18274
+ type: "vaultDetails",
18275
+ vaultAddress: "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303"
18276
+ })
18277
+ }).then((r) => r.json());
18278
+ const apr = (res?.apr ?? 0) * 100;
18279
+ return apr;
18280
+ });
18262
18281
  const rtokensPromise = safeFetch("RTOKENS", async () => {
18263
18282
  const res = await fetch(FeedData.RTOKENS).then((r) => r.json());
18264
18283
  const data2 = res.rtokens["8453"];
@@ -18355,7 +18374,8 @@ var fetchGeneralYields = async () => {
18355
18374
  yearnKatanaData,
18356
18375
  ssuperusdData,
18357
18376
  hbhypeData,
18358
- pendleData
18377
+ pendleData,
18378
+ hlpData
18359
18379
  ] = await Promise.all([
18360
18380
  wstethPromise,
18361
18381
  ezethPromise,
@@ -18392,7 +18412,8 @@ var fetchGeneralYields = async () => {
18392
18412
  yearnKatanaPromise,
18393
18413
  ssuperusdPromise,
18394
18414
  hbhypePromise,
18395
- pendlePromise
18415
+ pendlePromise,
18416
+ hlpPromise
18396
18417
  ]);
18397
18418
  const data = {
18398
18419
  intrinsicYields: {
@@ -18429,6 +18450,7 @@ var fetchGeneralYields = async () => {
18429
18450
  [thBill]: thBillData,
18430
18451
  [ssuperusd]: ssuperusdData,
18431
18452
  [hbhype]: hbhypeData,
18453
+ [hlp]: hlpData,
18432
18454
  ...rtokensData,
18433
18455
  ...hypeData,
18434
18456
  ...angleData,