@1delta/margin-fetcher 5.0.5 → 5.0.6
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 +22 -2
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -8416,7 +8416,28 @@ interface TermAssetRef {
|
|
|
8416
8416
|
* `tags.ts` — never hand-written per lender, so they cannot drift from the
|
|
8417
8417
|
* numbers they summarize.
|
|
8418
8418
|
*/
|
|
8419
|
-
type TermTag = Open<'fixed-rate' | 'variable-rate' | 'user-set-rate' | 'zero-interest' | 'prepaid-interest' | 'nav-accrual' | 'has-maturity' | 'perpetual' | 'rolling-duration' | 'static-debt' | 'accruing-debt' | 'time-liquidation' | 'price-liquidation' | 'redeemable' | 'no-liquidation' | 'full-collateral-seizure' | 'early-exit-free' | 'early-exit-penalty' | 'early-exit-discount' | 'exit-instant' | 'exit-capped' | 'exit-cooldown' | 'exit-queued' | 'exit-market-sale' | 'exit-may-be-impossible' | 'permissioned' | 'capped' | 'cap-full' | 'first-loss' | 'socialized-loss' | 'physical-delivery' | 'undercollateralized' | 'nav-attested' | 'immutable' | 'no-timelock' | 'eoa-controlled' | 'points-rewards'
|
|
8419
|
+
type TermTag = Open<'fixed-rate' | 'variable-rate' | 'user-set-rate' | 'zero-interest' | 'prepaid-interest' | 'nav-accrual' | 'has-maturity' | 'perpetual' | 'rolling-duration' | 'static-debt' | 'accruing-debt' | 'time-liquidation' | 'price-liquidation' | 'redeemable' | 'no-liquidation' | 'full-collateral-seizure' | 'early-exit-free' | 'early-exit-penalty' | 'early-exit-discount' | 'exit-instant' | 'exit-capped' | 'exit-cooldown' | 'exit-queued' | 'exit-market-sale' | 'exit-may-be-impossible' | 'permissioned' | 'capped' | 'cap-full' | 'first-loss' | 'socialized-loss' | 'physical-delivery' | 'undercollateralized' | 'nav-attested' | 'immutable' | 'no-timelock' | 'eoa-controlled' | 'points-rewards'
|
|
8420
|
+
/**
|
|
8421
|
+
* The headline yield is MOSTLY the asset's own (staking / RWA / savings)
|
|
8422
|
+
* yield, not interest this market pays. Set at >= 50 % of `aprTotal`.
|
|
8423
|
+
*
|
|
8424
|
+
* Worth a tag rather than only a detail row, because the two are not
|
|
8425
|
+
* interchangeable and the difference is invisible in a single percentage: a
|
|
8426
|
+
* market rate is paid by borrowers and moves with utilization, while
|
|
8427
|
+
* intrinsic yield you would earn holding the asset in your wallet — you are
|
|
8428
|
+
* taking this market's risk for the DIFFERENCE, not for the headline.
|
|
8429
|
+
* Decisive when looping: a loop only carries if the collateral out-earns the
|
|
8430
|
+
* debt, and intrinsic yield does not scale with leverage the way a lending
|
|
8431
|
+
* spread does.
|
|
8432
|
+
*/
|
|
8433
|
+
| 'intrinsic-yield'
|
|
8434
|
+
/**
|
|
8435
|
+
* This market pays NO interest of its own — the entire headline is intrinsic
|
|
8436
|
+
* yield and/or rewards. Curvance's collateral-only legs are the canonical
|
|
8437
|
+
* case (`debtCap == 0` ⇒ 0 % supply APR by construction), but any market
|
|
8438
|
+
* with no borrowers reads the same way.
|
|
8439
|
+
*/
|
|
8440
|
+
| 'no-market-interest' | 'oracle-flagged' | 'no-oracle'>;
|
|
8420
8441
|
/** Human-facing copy for one side of a term sheet. */
|
|
8421
8442
|
interface TermInfo {
|
|
8422
8443
|
/**
|
|
@@ -9445,7 +9466,6 @@ declare function duration(secs: number | undefined): string;
|
|
|
9445
9466
|
declare function shortDate(unixSecs: number | undefined): string;
|
|
9446
9467
|
/** One fee → a self-contained phrase, correct even for an unrecognised `id`. */
|
|
9447
9468
|
declare function feePhrase(fee: FeeTerm): string;
|
|
9448
|
-
/** Supply-side headline: ≤ ~100 chars, always populated. */
|
|
9449
9469
|
declare function supplyHeadline(s: SupplyTermSheet): string;
|
|
9450
9470
|
/** Borrow-side headline. */
|
|
9451
9471
|
declare function borrowHeadline(b: BorrowTermSheet): string;
|
package/dist/index.js
CHANGED
|
@@ -62207,6 +62207,13 @@ function rateTags(rate) {
|
|
|
62207
62207
|
}
|
|
62208
62208
|
if (rate.rewards?.some((r) => r.indicative || r.kind === "points"))
|
|
62209
62209
|
push(out, "points-rewards");
|
|
62210
|
+
const total = rate.aprTotal;
|
|
62211
|
+
const base = rate.components?.base ?? 0;
|
|
62212
|
+
const intrinsic = rate.components?.intrinsic ?? 0;
|
|
62213
|
+
if (total > 0) {
|
|
62214
|
+
if (intrinsic > 0 && intrinsic >= total / 2) push(out, "intrinsic-yield");
|
|
62215
|
+
if (base <= 1e-4 && intrinsic > 0) push(out, "no-market-interest");
|
|
62216
|
+
}
|
|
62210
62217
|
return [...out];
|
|
62211
62218
|
}
|
|
62212
62219
|
function maturityTags(maturity) {
|
|
@@ -62414,11 +62421,22 @@ var exitPhrase = {
|
|
|
62414
62421
|
"off-chain": "exit off-chain",
|
|
62415
62422
|
"dex-only": "exit only via a DEX"
|
|
62416
62423
|
};
|
|
62424
|
+
function provenance(rate) {
|
|
62425
|
+
const total = rate.aprTotal;
|
|
62426
|
+
const base = rate.components?.base ?? 0;
|
|
62427
|
+
const intrinsic = rate.components?.intrinsic ?? 0;
|
|
62428
|
+
if (!(intrinsic > 0) || !(total > 0)) return "";
|
|
62429
|
+
if (base <= 1e-4) return " (all from the asset itself)";
|
|
62430
|
+
if (intrinsic >= total / 2) {
|
|
62431
|
+
return ` (${pct(intrinsic)} from the asset, ${pct(base)} from the market)`;
|
|
62432
|
+
}
|
|
62433
|
+
return ` (incl. ${pct(intrinsic)} from the asset)`;
|
|
62434
|
+
}
|
|
62417
62435
|
function supplyHeadline(s) {
|
|
62418
62436
|
if (s.role === "collateral") {
|
|
62419
62437
|
return `Collateral only \xB7 ${maturityPhrase(s.maturity)}`;
|
|
62420
62438
|
}
|
|
62421
|
-
const rate = `${rateLabel(s)} ${pct(s.rate.aprTotal)}`;
|
|
62439
|
+
const rate = `${rateLabel(s)} ${pct(s.rate.aprTotal)}${provenance(s.rate)}`;
|
|
62422
62440
|
const exit = exitPhrase[String(s.exit.mode)] ?? (s.exit.settlement === "sync" ? "withdraw any time" : "delayed withdrawal");
|
|
62423
62441
|
const cooldown = s.exit.cooldownSecs ? ` (${duration(s.exit.cooldownSecs)})` : "";
|
|
62424
62442
|
const mat = s.maturity.kind === "perpetual" ? "" : ` ${maturityPhrase(s.maturity)}`;
|