@1delta/margin-fetcher 5.0.91 → 5.0.92

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.d.ts CHANGED
@@ -8933,6 +8933,10 @@ interface TermSheetDigest {
8933
8933
  settlement: SupplyExitTerms['settlement'];
8934
8934
  canOpen: boolean;
8935
8935
  headline: string;
8936
+ /** The 1–3 sentence explainer — curated where a vault has hand-written
8937
+ * copy, templated from the structured fields otherwise. Always a string;
8938
+ * `''` only when the sheet itself carries none. */
8939
+ description: string;
8936
8940
  tags: TermTag[];
8937
8941
  backedBy?: Omit<ExposureTerms, 'items'>;
8938
8942
  };
@@ -8946,6 +8950,8 @@ interface TermSheetDigest {
8946
8950
  liquidationTrigger: LiquidationTerms['trigger'];
8947
8951
  canOpen: boolean;
8948
8952
  headline: string;
8953
+ /** See the supply-side note above. */
8954
+ description: string;
8949
8955
  tags: TermTag[];
8950
8956
  acceptedCollateral?: Omit<ExposureTerms, 'items'>;
8951
8957
  };
@@ -14105,10 +14111,22 @@ declare function enrichmentIndexFromRows(rows: Record<string, any>[]): Enrichmen
14105
14111
  /**
14106
14112
  * Collapse a sheet to its digest form (`?terms=digest`).
14107
14113
  *
14108
- * Drops `items[]` from the exposure sets and the long prose — an Aave market
14109
- * with 30 accepted collaterals is several kB on its own, and it is the SAME
14110
- * accepted set repeated on every row of that lender. Every dropped item is
14111
- * still reachable: each carries a `marketUid` for the bulk endpoint.
14114
+ * Drops `items[]` from the exposure sets — an Aave market with 30 accepted
14115
+ * collaterals is several kB on its own, and it is the SAME accepted set
14116
+ * repeated on every row of that lender. Every dropped item is still reachable:
14117
+ * each carries a `marketUid` for the bulk endpoint.
14118
+ *
14119
+ * `description` is NOT dropped, though it was. The digest is what every
14120
+ * listing actually requests — `full` is reserved for a detail view — so
14121
+ * withholding the prose from it meant no surface ever rendered a sentence
14122
+ * explaining what a row is, and the curated per-vault copy might as well not
14123
+ * have been written.
14124
+ *
14125
+ * Measured on a live 500-row `/earn/latest` page (chain 1, 205 vault rows,
14126
+ * mean 199 chars): +43 KB raw, +16.7 KB gzipped on a 378 KB page — +4.4 %,
14127
+ * because the templates repeat across rows and compress accordingly. Unlike
14128
+ * `items[]` it is bounded by construction: a sentence does not grow with the
14129
+ * size of the market.
14112
14130
  */
14113
14131
  declare function toDigest(sheet: TermSheet): TermSheetDigest;
14114
14132
  /** Row shape of `~/risk-data/data/oracles/oracle-risk-flat.json`. */
package/dist/index.js CHANGED
@@ -50765,7 +50765,7 @@ var BITWAY_LEGS2 = [
50765
50765
  "USDT",
50766
50766
  "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
50767
50767
  "0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
50768
- "the Absolute Return strategy (0.5% instant-exit fee)"
50768
+ "Absolute Return strategy (0.5% instant-exit fee)"
50769
50769
  ],
50770
50770
  [
50771
50771
  "bwU",
@@ -50775,7 +50775,7 @@ var BITWAY_LEGS2 = [
50775
50775
  "U",
50776
50776
  "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
50777
50777
  "0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
50778
- "the Absolute Return strategy (0.5% instant-exit fee)"
50778
+ "Absolute Return strategy (0.5% instant-exit fee)"
50779
50779
  ],
50780
50780
  [
50781
50781
  "bwBTW",
@@ -50785,7 +50785,7 @@ var BITWAY_LEGS2 = [
50785
50785
  "BTW",
50786
50786
  "0x5c4a6903732532eeb3ae0803e062d8ae25d52bd1",
50787
50787
  "0x2b8464ffb2b77de64cfefdeb00ad925576f157cb",
50788
- "the Absolute Return strategy (0.5% instant-exit fee). The rate is denominated in BTW, Bitway's own volatile token \u2014 not in dollars"
50788
+ "Absolute Return strategy (0.5% instant-exit fee). The rate is denominated in BTW, Bitway's own volatile token \u2014 not in dollars"
50789
50789
  ],
50790
50790
  [
50791
50791
  "BTWUSDT",
@@ -50795,7 +50795,7 @@ var BITWAY_LEGS2 = [
50795
50795
  "USDT",
50796
50796
  "0xb82e32062c773c7748776c06fdb11b92edae3b63",
50797
50797
  "0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
50798
- "the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
50798
+ "Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
50799
50799
  ],
50800
50800
  [
50801
50801
  "BTWUSD1",
@@ -50805,7 +50805,7 @@ var BITWAY_LEGS2 = [
50805
50805
  "USD1",
50806
50806
  "0xb82e32062c773c7748776c06fdb11b92edae3b63",
50807
50807
  "0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
50808
- "the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
50808
+ "Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
50809
50809
  ],
50810
50810
  [
50811
50811
  "BTWU",
@@ -50815,7 +50815,7 @@ var BITWAY_LEGS2 = [
50815
50815
  "U",
50816
50816
  "0xb82e32062c773c7748776c06fdb11b92edae3b63",
50817
50817
  "0xfc8e6b1ab1a4c37724f8bc797730afa8d01d04ef",
50818
- "the Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
50818
+ "Core Alpha strategy (no instant-exit fee live; ~1M per-user stake cap)"
50819
50819
  ]
50820
50820
  ];
50821
50821
  var BITWAY_ENTRIES = {
@@ -79020,11 +79020,27 @@ function toVaultTermInput(vault, provider, chainId) {
79020
79020
  exposures: Array.isArray(row.exposures) ? row.exposures : void 0
79021
79021
  };
79022
79022
  }
79023
+ function savingsCuration(provider, chainId, address) {
79024
+ if (provider !== "savings") return {};
79025
+ const lc2 = address.toLowerCase();
79026
+ const e = getSavingsRegistry(chainId).find((x) => x.address === lc2);
79027
+ if (!e) return {};
79028
+ return {
79029
+ // `''` is how an entry says "no curated copy"; it must not beat the
79030
+ // template, so it is normalized to absent.
79031
+ description: e.description || void 0,
79032
+ solvency: e.solvency,
79033
+ accrual: e.accrual,
79034
+ yieldWarmupSeconds: e.yieldWarmupSeconds,
79035
+ needsDepositApproval: e.needsDepositApproval
79036
+ };
79037
+ }
79023
79038
  function vaultTermInputFromEarnMarket(m) {
79024
79039
  if (m.venueKind !== "vault") return void 0;
79025
79040
  const provider = m.venue.startsWith(VAULT_VENUE_PREFIX) ? m.venue.slice(VAULT_VENUE_PREFIX.length) : void 0;
79026
79041
  if (!provider) return void 0;
79027
79042
  const meta = m.providerMeta ?? {};
79043
+ const curated = savingsCuration(provider, m.chainId, m.ref);
79028
79044
  return {
79029
79045
  provider,
79030
79046
  chainId: m.chainId,
@@ -79033,7 +79049,7 @@ function vaultTermInputFromEarnMarket(m) {
79033
79049
  name: m.name,
79034
79050
  brand: m.brand,
79035
79051
  curatorName: m.brand,
79036
- description: str7(meta.description),
79052
+ description: str7(meta.description) ?? curated.description,
79037
79053
  asset: {
79038
79054
  chainId: m.chainId,
79039
79055
  address: m.asset.address,
@@ -79063,9 +79079,9 @@ function vaultTermInputFromEarnMarket(m) {
79063
79079
  swapFeeRate: num14(meta.feeRate),
79064
79080
  redemptionDiscountBps: num14(meta.redemptionDiscountBps),
79065
79081
  instantRedeemEnabled: bool2(meta.instantRedeemEnabled),
79066
- yieldWarmupSeconds: num14(meta.yieldWarmupSeconds),
79067
- accrual: str7(meta.accrual),
79068
- needsDepositApproval: bool2(meta.needsDepositApproval),
79082
+ yieldWarmupSeconds: num14(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
79083
+ accrual: str7(meta.accrual) ?? curated.accrual,
79084
+ needsDepositApproval: bool2(meta.needsDepositApproval) ?? curated.needsDepositApproval,
79069
79085
  // `canDeposit` already folds in the cap, the pause and the gate, so it is
79070
79086
  // the authoritative answer — but the REASON is what a disabled CTA renders,
79071
79087
  // and that only survives in the raw fields.
@@ -79083,7 +79099,7 @@ function vaultTermInputFromEarnMarket(m) {
79083
79099
  curator: str7(meta.curator),
79084
79100
  guardian: str7(meta.guardian),
79085
79101
  feeRecipient: str7(meta.feeRecipient),
79086
- solvency: m.risk?.counterparty,
79102
+ solvency: m.risk?.counterparty ?? curated.solvency,
79087
79103
  navOracle: str7(meta.navOracle),
79088
79104
  yieldProfile: m.risk?.yieldProfile,
79089
79105
  exposures: m.refs?.exposures
@@ -79110,6 +79126,7 @@ function vaultTermInputFromSourceRow(row, chainId) {
79110
79126
  const info = row.vaultInfo ?? {};
79111
79127
  const assetInfo = row.underlyingInfo?.asset;
79112
79128
  const assetDecimals = num14(row.assetDecimals) ?? num14(assetInfo?.decimals) ?? num14(row.decimals);
79129
+ const curated = savingsCuration(provider, chainId, address);
79113
79130
  return {
79114
79131
  provider,
79115
79132
  chainId,
@@ -79118,7 +79135,7 @@ function vaultTermInputFromSourceRow(row, chainId) {
79118
79135
  name: str7(info.name) ?? str7(row.displayName) ?? str7(row.name),
79119
79136
  brand: str7(row.curatorName) ?? str7(meta.brand),
79120
79137
  curatorName: str7(row.curatorName),
79121
- description: str7(meta.description),
79138
+ description: str7(meta.description) ?? curated.description,
79122
79139
  asset: {
79123
79140
  chainId,
79124
79141
  address: str7(row.underlying)?.toLowerCase() ?? "",
@@ -79146,9 +79163,9 @@ function vaultTermInputFromSourceRow(row, chainId) {
79146
79163
  swapFeeRate: num14(meta.feeRate),
79147
79164
  redemptionDiscountBps: num14(meta.redemptionDiscountBps),
79148
79165
  instantRedeemEnabled: bool2(meta.instantRedeemEnabled),
79149
- yieldWarmupSeconds: num14(meta.yieldWarmupSeconds),
79150
- accrual: str7(meta.accrual),
79151
- needsDepositApproval: bool2(meta.needsDepositApproval),
79166
+ yieldWarmupSeconds: num14(meta.yieldWarmupSeconds) ?? curated.yieldWarmupSeconds,
79167
+ accrual: str7(meta.accrual) ?? curated.accrual,
79168
+ needsDepositApproval: bool2(meta.needsDepositApproval) ?? curated.needsDepositApproval,
79152
79169
  isMintable: bool2(meta.isMintable),
79153
79170
  depositCapacity: str7(meta.depositCapacity) ?? str7(meta.maxDeposit),
79154
79171
  supplyCap: str7(meta.supplyCap),
@@ -79164,7 +79181,7 @@ function vaultTermInputFromSourceRow(row, chainId) {
79164
79181
  curator: str7(meta.curator),
79165
79182
  guardian: str7(meta.guardian),
79166
79183
  feeRecipient: str7(meta.feeRecipient),
79167
- solvency: str7(meta.solvency),
79184
+ solvency: str7(meta.solvency) ?? curated.solvency,
79168
79185
  navOracle: str7(meta.navOracle),
79169
79186
  yieldProfile: str7(info.yieldProfile),
79170
79187
  exposures: Array.isArray(row.exposures) ? row.exposures : Array.isArray(meta.exposures) ? meta.exposures : void 0
@@ -81955,6 +81972,7 @@ function toDigest(sheet) {
81955
81972
  settlement: sheet.supply.exit.settlement,
81956
81973
  canOpen: sheet.supply.availability.canOpen,
81957
81974
  headline: sheet.supply.info.headline,
81975
+ description: sheet.supply.info.description,
81958
81976
  tags: sheet.supply.info.tags,
81959
81977
  backedBy: strip(sheet.supply.backedBy)
81960
81978
  } : void 0,
@@ -81968,6 +81986,7 @@ function toDigest(sheet) {
81968
81986
  liquidationTrigger: sheet.borrow.liquidation.trigger,
81969
81987
  canOpen: sheet.borrow.availability.canOpen,
81970
81988
  headline: sheet.borrow.info.headline,
81989
+ description: sheet.borrow.info.description,
81971
81990
  tags: sheet.borrow.info.tags,
81972
81991
  acceptedCollateral: strip(sheet.borrow.acceptedCollateral)
81973
81992
  } : void 0,