@1delta/margin-fetcher 5.0.36 → 5.0.37
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 +32 -2
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -11840,7 +11840,21 @@ interface EarnMarketLabelInput {
|
|
|
11840
11840
|
* otherwise indistinguishable. See {@link withMaturityLabel}.
|
|
11841
11841
|
*/
|
|
11842
11842
|
maturity?: MaturityTerms;
|
|
11843
|
-
/**
|
|
11843
|
+
/**
|
|
11844
|
+
* The name the PUBLIC-DATA FETCHER produced for this row.
|
|
11845
|
+
*
|
|
11846
|
+
* Quality varies by lender and that is the whole point of treating it as a
|
|
11847
|
+
* candidate rather than a fallback: most emit a per-LEG label
|
|
11848
|
+
* (`'Loan ' + symbol`, `'Collateral ' + symbol` — Compound V3, Fluid, Lista,
|
|
11849
|
+
* Term, TermMax, Midnight all do), which says nothing about WHICH market it
|
|
11850
|
+
* is. Euler's parser instead sets the eVault's own on-chain `vaultName`, so
|
|
11851
|
+
* `Prime USDC` was sitting on the row while the label fell through to plain
|
|
11852
|
+
* `USDC` and 530 Euler markets rendered as their asset.
|
|
11853
|
+
*
|
|
11854
|
+
* Leg names are rejected; anything else is used.
|
|
11855
|
+
*/
|
|
11856
|
+
fetcherName?: string;
|
|
11857
|
+
/** Used only when there is no asset symbol at all. */
|
|
11844
11858
|
fallbackName?: string;
|
|
11845
11859
|
}
|
|
11846
11860
|
/**
|
|
@@ -12000,7 +12014,17 @@ interface EarnProtocolAndCurator {
|
|
|
12000
12014
|
* publishes a curator today; the parameter is still honoured so that when
|
|
12001
12015
|
* one does (a curated Morpho Blue market list, say) it needs no new branch.
|
|
12002
12016
|
*/
|
|
12003
|
-
declare function resolveEarnIdentity(venue: string, brand: string | undefined
|
|
12017
|
+
declare function resolveEarnIdentity(venue: string, brand: string | undefined,
|
|
12018
|
+
/**
|
|
12019
|
+
* The protocol as PUBLISHED, from `lender-labels.json`'s `protocols` map by
|
|
12020
|
+
* way of `lenderInfo.protocol`.
|
|
12021
|
+
*
|
|
12022
|
+
* Authoritative when present. `PROTOCOL_ALIASES` below is the fallback for
|
|
12023
|
+
* the window before that map reaches the public-data fetchers — deriving a
|
|
12024
|
+
* name in this module and correcting it downstream is the shape this whole
|
|
12025
|
+
* section exists to end.
|
|
12026
|
+
*/
|
|
12027
|
+
publishedProtocol?: string): EarnProtocolAndCurator;
|
|
12004
12028
|
|
|
12005
12029
|
/**
|
|
12006
12030
|
* Multiply a formatted (human-unit) amount by a USD price.
|
|
@@ -12276,6 +12300,12 @@ interface PoolSourceRow {
|
|
|
12276
12300
|
key?: string;
|
|
12277
12301
|
name?: string;
|
|
12278
12302
|
logoURI?: string;
|
|
12303
|
+
/**
|
|
12304
|
+
* The protocol this market belongs to, from `lender-labels.json`'s
|
|
12305
|
+
* `protocols` map. Absent until that reaches the public-data fetchers, at
|
|
12306
|
+
* which point it supersedes the SDK's fallback table.
|
|
12307
|
+
*/
|
|
12308
|
+
protocol?: string;
|
|
12279
12309
|
};
|
|
12280
12310
|
supplyCap?: number | string;
|
|
12281
12311
|
caps?: {
|
package/dist/index.js
CHANGED
|
@@ -66698,6 +66698,10 @@ function earnLabel(dimension, key3) {
|
|
|
66698
66698
|
function earnDescription(dimension, key3) {
|
|
66699
66699
|
return EARN_DESCRIPTIONS[dimension][key3];
|
|
66700
66700
|
}
|
|
66701
|
+
function isLegName(name, asset) {
|
|
66702
|
+
const m = name.trim().match(/^(?:loan|collateral)\s+(.+)$/i);
|
|
66703
|
+
return !!m && m[1].trim().toLowerCase() === asset.toLowerCase();
|
|
66704
|
+
}
|
|
66701
66705
|
function stripBrandWords(name, venue) {
|
|
66702
66706
|
const brandWords = new Set(
|
|
66703
66707
|
(venue ? `${venueBrand(venue)} ${venueBrandKey(venue)}` : "").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)
|
|
@@ -66728,6 +66732,10 @@ function baseMarketLabel(input) {
|
|
|
66728
66732
|
if (detail && detail.toLowerCase() !== asset.toLowerCase()) {
|
|
66729
66733
|
return namesToken(detail, asset) ? detail : `${asset} \xB7 ${detail}`;
|
|
66730
66734
|
}
|
|
66735
|
+
const own = stripBrandWords(input.fetcherName?.trim() ?? "", input.venue);
|
|
66736
|
+
if (own && !isLegName(own, asset) && own.toLowerCase() !== asset.toLowerCase()) {
|
|
66737
|
+
return namesToken(own, asset) ? own : `${asset} \xB7 ${own}`;
|
|
66738
|
+
}
|
|
66731
66739
|
const collaterals = (input.collateralSymbols ?? []).map((c) => c?.trim()).filter((c) => !!c && c !== asset);
|
|
66732
66740
|
const distinct = [...new Set(collaterals)];
|
|
66733
66741
|
if (distinct.length === 1) return `${asset} \xB7 vs ${distinct[0]}`;
|
|
@@ -66794,20 +66802,33 @@ function isIlliquid(input) {
|
|
|
66794
66802
|
if (input.liquidityUsd === void 0) return false;
|
|
66795
66803
|
return input.liquidityUsd <= 0;
|
|
66796
66804
|
}
|
|
66805
|
+
var PROTOCOL_ALIASES = {
|
|
66806
|
+
MORPHO_BLUE: "Morpho",
|
|
66807
|
+
EULER_V2: "Euler",
|
|
66808
|
+
SILO_V2: "Silo",
|
|
66809
|
+
SILO_V3: "Silo",
|
|
66810
|
+
GEARBOX_V3: "Gearbox",
|
|
66811
|
+
AAVE_V2: "Aave",
|
|
66812
|
+
AAVE_V3: "Aave",
|
|
66813
|
+
AAVE_V4: "Aave",
|
|
66814
|
+
COMPOUND_V2: "Compound",
|
|
66815
|
+
COMPOUND_V3: "Compound"
|
|
66816
|
+
};
|
|
66797
66817
|
var CATEGORY_PROVIDERS = /* @__PURE__ */ new Set(["savings", "lst"]);
|
|
66798
|
-
function resolveEarnIdentity(venue, brand) {
|
|
66818
|
+
function resolveEarnIdentity(venue, brand, publishedProtocol) {
|
|
66799
66819
|
const isVault = venue.startsWith(VAULT_VENUE_PREFIX);
|
|
66800
66820
|
const provider = isVault ? venue.slice(VAULT_VENUE_PREFIX.length) : venue;
|
|
66801
66821
|
const providerBrand = venueBrand(venue);
|
|
66802
66822
|
const key3 = venueBrandKey(venue);
|
|
66823
|
+
const protocolName = publishedProtocol?.trim() || PROTOCOL_ALIASES[key3] || providerBrand;
|
|
66803
66824
|
if (isVault && CATEGORY_PROVIDERS.has(provider)) {
|
|
66804
|
-
return { protocol: { key: key3, name: brand?.trim() ||
|
|
66825
|
+
return { protocol: { key: key3, name: brand?.trim() || protocolName } };
|
|
66805
66826
|
}
|
|
66806
66827
|
const name = brand?.trim();
|
|
66807
66828
|
if (!name || name.toLowerCase() === providerBrand.toLowerCase()) {
|
|
66808
|
-
return { protocol: { key: key3, name:
|
|
66829
|
+
return { protocol: { key: key3, name: protocolName } };
|
|
66809
66830
|
}
|
|
66810
|
-
return { protocol: { key: key3, name:
|
|
66831
|
+
return { protocol: { key: key3, name: protocolName }, curator: { name } };
|
|
66811
66832
|
}
|
|
66812
66833
|
|
|
66813
66834
|
// src/earn/normalize.ts
|
|
@@ -70258,7 +70279,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
70258
70279
|
// Same resolver as the vault half, so `protocol.key` means one thing
|
|
70259
70280
|
// across the listing: the STABLE family key, never the per-market venue.
|
|
70260
70281
|
// No lender publishes a curator today, hence the undefined.
|
|
70261
|
-
...resolveEarnIdentity(venue, void 0),
|
|
70282
|
+
...resolveEarnIdentity(venue, void 0, str5(row.lenderInfo?.protocol)),
|
|
70262
70283
|
// Pair-aware: "USDT · vs wstETH" for an isolated market, plain "USDC" for
|
|
70263
70284
|
// a shared pool. The fetcher's own name is only the fallback — it is the
|
|
70264
70285
|
// leg-local "Loan USDC", which a chain repeats across 300 markets and
|
|
@@ -70267,6 +70288,7 @@ function earnMarketFromPool(row, fallbackChainId, venueCollaterals) {
|
|
|
70267
70288
|
name: earnMarketLabel({
|
|
70268
70289
|
assetSymbol: str5(assetInfo.symbol),
|
|
70269
70290
|
lenderMarketName: str5(row.lenderInfo?.name),
|
|
70291
|
+
fetcherName: str5(row.name),
|
|
70270
70292
|
venue,
|
|
70271
70293
|
// The venue's collaterals, UNFILTERED — the label removes this row's own
|
|
70272
70294
|
// leg itself. Filtering here made the collateral row of a 1-collateral
|