@1delta/margin-fetcher 0.0.302 → 0.0.304

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
@@ -38408,7 +38408,9 @@ function mapApiDetail(d, chainId, prices, tokenList) {
38408
38408
  const totalAssetsRaw = String(d.totalAssets ?? "0");
38409
38409
  const totalSupplyRaw = String(d.totalShares ?? "0");
38410
38410
  const convertToAssets = d.exchangeRate != null ? rescaleExchangeRate(d.exchangeRate, decimals) : deriveConvertToAssets(totalAssetsRaw, totalSupplyRaw, decimals);
38411
- const supplyRate = Number(d.supplyApy ?? d.apyCurrent ?? 0) || 0;
38411
+ const supplyRate = apyToAprPercent(
38412
+ Number(d.supplyApy ?? d.apyCurrent ?? 0) || 0
38413
+ );
38412
38414
  const availableRaw = safeBigInt2(d.availableAssets) || safeBigInt2(totalAssetsRaw);
38413
38415
  const totalAssetsBig = safeBigInt2(totalAssetsRaw);
38414
38416
  const liquidityRaw = (availableRaw > totalAssetsBig ? totalAssetsBig : availableRaw).toString();
@@ -38436,11 +38438,15 @@ function mapApiDetail(d, chainId, prices, tokenList) {
38436
38438
  // The API doesn't surface the performance fee on this endpoint; the
38437
38439
  // headline APY is already net, so 0 here only affects fee display.
38438
38440
  fee: 0,
38439
- owner: d.owner?.toLowerCase(),
38440
- curator: d.curator?.toLowerCase(),
38441
+ // owner/curator/guardian/feeRecipient + timelock live under
38442
+ // `governance`/`management` in the current API; fall back to the legacy
38443
+ // flat fields for older snapshots.
38444
+ timelock: Number(d.governance?.timelock ?? d.management?.timelockSeconds ?? 0) || void 0,
38445
+ owner: (d.governance?.owner ?? d.management?.owner ?? d.owner)?.toLowerCase(),
38446
+ curator: (d.governance?.curator ?? d.management?.curator ?? d.curator)?.toLowerCase(),
38441
38447
  curatorName: curatorNameFromVaultName(d.name, assetMeta?.symbol),
38442
- guardian: d.guardian?.toLowerCase(),
38443
- feeRecipient: d.feeReceiver?.toLowerCase() || void 0,
38448
+ guardian: (d.governance?.guardian ?? d.management?.guardian ?? d.guardian)?.toLowerCase(),
38449
+ feeRecipient: (d.governance?.feeReceiver ?? d.management?.feeRecipient ?? d.feeReceiver)?.toLowerCase() || void 0,
38444
38450
  asset: assetMeta,
38445
38451
  priceUsd: priceUsd || void 0,
38446
38452
  totalAssetsFormatted,
@@ -46106,6 +46112,25 @@ var fetchHypercoreVaults = async (options) => {
46106
46112
 
46107
46113
  // src/vaults/classification.ts
46108
46114
  var VOLATILE_PROVIDERS = /* @__PURE__ */ new Set(["hypercore", "gmx"]);
46115
+ var SYNC_REDEMPTION_PROVIDERS = /* @__PURE__ */ new Set([
46116
+ "morpho",
46117
+ "lista",
46118
+ "euler-earn",
46119
+ "fluid",
46120
+ "gearbox",
46121
+ "silo",
46122
+ "yearn"
46123
+ ]);
46124
+ var ASYNC_REDEMPTION_PROVIDERS = /* @__PURE__ */ new Set(["lagoon", "upshift"]);
46125
+ var classifyRedemption = (provider, v) => {
46126
+ if (ASYNC_REDEMPTION_PROVIDERS.has(provider)) return "async";
46127
+ if (SYNC_REDEMPTION_PROVIDERS.has(provider)) return "sync";
46128
+ if (provider === "lst") return "async";
46129
+ if (provider === "savings") {
46130
+ return v.withdrawalMode === "instant" && !v.withdrawalCooldownSeconds ? "sync" : "async";
46131
+ }
46132
+ return "sync";
46133
+ };
46109
46134
  var VOLATILE_VAULT_OVERRIDES = /* @__PURE__ */ new Set([
46110
46135
  // '1-0x…', // <chain>-<address> of a known volatile strategy vault
46111
46136
  ]);
@@ -46223,6 +46248,7 @@ var stampVaultClassification = (data, chainId, tokenList = {}) => {
46223
46248
  });
46224
46249
  v.yieldProfile = c.yieldProfile;
46225
46250
  v.denomination = c.denomination;
46251
+ v.redemptionType = classifyRedemption(provider, v);
46226
46252
  const raw = v.convertToAssets ?? v.pricePerShare;
46227
46253
  if (raw != null) {
46228
46254
  v.sharePriceRaw = raw;