@1delta/margin-fetcher 0.0.251 → 0.0.252

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
@@ -33928,6 +33928,15 @@ var buildFluidFTokensCall = (chainId) => {
33928
33928
  ];
33929
33929
  };
33930
33930
 
33931
+ // src/vaults/displayName.ts
33932
+ var composeVaultDisplayName = (brand, curatorName, asset, fallbackName) => {
33933
+ const symbol = (asset?.symbol ?? "").trim();
33934
+ const label = (curatorName ?? brand).trim() || brand;
33935
+ if (symbol) return `${label} ${symbol}`;
33936
+ const fallback = (fallbackName ?? "").trim();
33937
+ return fallback || brand;
33938
+ };
33939
+
33931
33940
  // src/vaults/fluid/publicCallParse.ts
33932
33941
  var FLUID_EEE_LOWER4 = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
33933
33942
  var normalizeUnderlying4 = (addr) => addr === FLUID_EEE_LOWER4 ? zeroAddress : addr;
@@ -33964,11 +33973,21 @@ function parseFTokens(fTokens, chainId, prices, tokenList) {
33964
33973
  const rewardsRate = scaleFluidRate2(ft.rewardsRate);
33965
33974
  const liquidityRaw = ft.liquidityUserSupplyData?.withdrawable?.toString() ?? "0";
33966
33975
  const liquidityFormatted = Number(parseRawAmount(liquidityRaw, decimals));
33976
+ const onchainName = (ft.name ?? "").toString().trim();
33977
+ const underlyingSymbol = (assetMeta?.symbol ?? ft.symbol ?? "").toString().replace(/^f/, "").trim();
33978
+ const displayName = onchainName ? onchainName : underlyingSymbol ? `Fluid ${underlyingSymbol}` : "Fluid";
33967
33979
  const entry = {
33968
33980
  address: ft.tokenAddress,
33969
33981
  underlying,
33970
33982
  symbol: ft.symbol ?? "",
33971
- name: ft.name ?? "",
33983
+ name: displayName,
33984
+ displayName: composeVaultDisplayName(
33985
+ "Fluid",
33986
+ void 0,
33987
+ assetMeta,
33988
+ displayName
33989
+ ),
33990
+ curatorName: "Fluid",
33972
33991
  decimals,
33973
33992
  totalAssets: ft.totalAssets?.toString() ?? "0",
33974
33993
  totalSupply: ft.totalSupply?.toString() ?? "0",
@@ -34050,6 +34069,7 @@ var getGearboxV3PoolsConverter = (chainId, prices = {}, tokenList = {}) => {
34050
34069
  };
34051
34070
  function parseMarkets(markets, chainId, prices, tokenList) {
34052
34071
  const out = {};
34072
+ const configuratorNames = gearboxMarketConfigurators(chainId) ?? {};
34053
34073
  for (const m of markets) {
34054
34074
  const pool = m?.pool;
34055
34075
  if (!pool) continue;
@@ -34068,11 +34088,19 @@ function parseMarkets(markets, chainId, prices, tokenList) {
34068
34088
  const priceUsd = prices[oracleKey] ?? prices[underlying] ?? 0;
34069
34089
  const liquidityRaw = pool.availableLiquidity?.toString() ?? "0";
34070
34090
  const liquidityFormatted = Number(parseRawAmount(liquidityRaw, decimals));
34091
+ const configurator = (m?.configurator ?? "").toString().toLowerCase();
34092
+ const curatorName = configurator ? configuratorNames[configurator] : void 0;
34071
34093
  const entry = {
34072
34094
  address: rawAddress,
34073
34095
  underlying,
34074
34096
  symbol: pool.symbol ?? "",
34075
34097
  name: pool.name ?? "",
34098
+ displayName: composeVaultDisplayName(
34099
+ "Gearbox",
34100
+ curatorName,
34101
+ assetMeta,
34102
+ pool.name ?? void 0
34103
+ ),
34076
34104
  decimals,
34077
34105
  totalAssets: totalAssetsRaw,
34078
34106
  totalSupply: pool.totalSupply?.toString() ?? "0",
@@ -34081,6 +34109,8 @@ function parseMarkets(markets, chainId, prices, tokenList) {
34081
34109
  expectedLiquidity: pool.expectedLiquidity?.toString() ?? "0",
34082
34110
  dieselRate: pool.dieselRate?.toString() ?? "0",
34083
34111
  withdrawFeeBps: Number(pool.withdrawFee ?? 0),
34112
+ curator: configurator || void 0,
34113
+ curatorName,
34084
34114
  supplyRate: scaleRate(pool.supplyRate),
34085
34115
  baseInterestRate: scaleRate(pool.baseInterestRate),
34086
34116
  asset: assetMeta,
@@ -34146,6 +34176,12 @@ query GetVaults {
34146
34176
  owner
34147
34177
  curator
34148
34178
  guardian
34179
+ curators {
34180
+ id
34181
+ name
34182
+ image
34183
+ verified
34184
+ }
34149
34185
  rewards {
34150
34186
  supplyApr
34151
34187
  asset {
@@ -34171,6 +34207,21 @@ async function fetchPage(chainId, first, skip) {
34171
34207
  const json = await response.json();
34172
34208
  return json?.data?.vaults?.items ?? [];
34173
34209
  }
34210
+ var parseCurators = (curators) => {
34211
+ if (!curators?.length) return void 0;
34212
+ const out = [];
34213
+ for (const c of curators) {
34214
+ const name = c?.name?.trim();
34215
+ if (!name) continue;
34216
+ out.push({
34217
+ id: c.id ?? "",
34218
+ name,
34219
+ image: c.image ?? void 0,
34220
+ verified: c.verified ?? void 0
34221
+ });
34222
+ }
34223
+ return out.length > 0 ? out : void 0;
34224
+ };
34174
34225
  var sumRewardsApr = (rewards) => {
34175
34226
  if (!rewards) return 0;
34176
34227
  let total = 0;
@@ -34200,11 +34251,19 @@ function parseVault2(v, chainId, prices, tokenList) {
34200
34251
  const rewardsRate = sumRewardsApr(state.rewards);
34201
34252
  const apiTotalAssetsUsd = Number(state.totalAssetsUsd ?? 0);
34202
34253
  const totalAssetsUsd = apiTotalAssetsUsd || totalAssetsFormatted * resolvedPriceUsd;
34254
+ const curators = parseCurators(state.curators);
34255
+ const primaryCurator = curators?.[0];
34203
34256
  return {
34204
34257
  address,
34205
34258
  underlying: assetAddr,
34206
34259
  symbol: v.symbol ?? "",
34207
34260
  name: v.name ?? "",
34261
+ displayName: composeVaultDisplayName(
34262
+ "Morpho",
34263
+ primaryCurator?.name,
34264
+ assetMeta,
34265
+ v.name ?? void 0
34266
+ ),
34208
34267
  decimals,
34209
34268
  totalAssets: totalAssetsRaw,
34210
34269
  totalSupply: state.totalSupply?.toString() ?? "0",
@@ -34217,6 +34276,9 @@ function parseVault2(v, chainId, prices, tokenList) {
34217
34276
  owner: state.owner?.toLowerCase() || void 0,
34218
34277
  curator: state.curator?.toLowerCase() || void 0,
34219
34278
  guardian: state.guardian?.toLowerCase() || void 0,
34279
+ curatorName: primaryCurator?.name,
34280
+ curatorImage: primaryCurator?.image,
34281
+ curators,
34220
34282
  asset: assetMeta,
34221
34283
  priceUsd: resolvedPriceUsd || void 0,
34222
34284
  totalAssetsFormatted,
@@ -34294,6 +34356,12 @@ function parseVault3(v, chainId, prices, tokenList) {
34294
34356
  underlying: assetAddr,
34295
34357
  symbol: v.symbol ?? "",
34296
34358
  name: v.name ?? "",
34359
+ displayName: composeVaultDisplayName(
34360
+ "Morpho",
34361
+ void 0,
34362
+ assetMeta,
34363
+ v.name ?? void 0
34364
+ ),
34297
34365
  decimals,
34298
34366
  totalAssets: totalAssetsRaw,
34299
34367
  totalSupply: v.totalShares?.toString() ?? "0",
@@ -34415,6 +34483,12 @@ function parseVault4(v, chainId, prices, tokenList) {
34415
34483
  underlying: assetAddr,
34416
34484
  symbol: v.symbol ?? "",
34417
34485
  name: v.name ?? "",
34486
+ displayName: composeVaultDisplayName(
34487
+ "Silo",
34488
+ void 0,
34489
+ assetMeta,
34490
+ v.name ?? void 0
34491
+ ),
34418
34492
  decimals,
34419
34493
  protocolVersion: v.protocol?.protocolVersion ?? "",
34420
34494
  protocolId: (v.protocolId ?? v.protocol?.id ?? "").toLowerCase(),