@1delta/margin-fetcher 0.0.327 → 0.0.329

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.
Files changed (91) hide show
  1. package/dist/index.d.ts +14 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2398 -258
  4. package/dist/index.js.map +1 -1
  5. package/dist/lending/public-data/exactly/convertPublic.d.ts +30 -0
  6. package/dist/lending/public-data/exactly/convertPublic.d.ts.map +1 -0
  7. package/dist/lending/public-data/exactly/convertPublic.test.d.ts +2 -0
  8. package/dist/lending/public-data/exactly/convertPublic.test.d.ts.map +1 -0
  9. package/dist/lending/public-data/exactly/fetchPublic.d.ts +13 -0
  10. package/dist/lending/public-data/exactly/fetchPublic.d.ts.map +1 -0
  11. package/dist/lending/public-data/exactly/index.d.ts +5 -0
  12. package/dist/lending/public-data/exactly/index.d.ts.map +1 -0
  13. package/dist/lending/public-data/exactly/math.d.ts +30 -0
  14. package/dist/lending/public-data/exactly/math.d.ts.map +1 -0
  15. package/dist/lending/public-data/exactly/types.d.ts +80 -0
  16. package/dist/lending/public-data/exactly/types.d.ts.map +1 -0
  17. package/dist/lending/public-data/fetchLenderAll.d.ts.map +1 -1
  18. package/dist/lending/public-data/fetchLenderExt.d.ts.map +1 -1
  19. package/dist/lending/public-data/liquity/convertPublic.d.ts +42 -0
  20. package/dist/lending/public-data/liquity/convertPublic.d.ts.map +1 -0
  21. package/dist/lending/public-data/liquity/convertPublic.test.d.ts +2 -0
  22. package/dist/lending/public-data/liquity/convertPublic.test.d.ts.map +1 -0
  23. package/dist/lending/public-data/liquity/fetchPublic.d.ts +15 -0
  24. package/dist/lending/public-data/liquity/fetchPublic.d.ts.map +1 -0
  25. package/dist/lending/public-data/liquity/index.d.ts +4 -0
  26. package/dist/lending/public-data/liquity/index.d.ts.map +1 -0
  27. package/dist/lending/public-data/liquity/types.d.ts +33 -0
  28. package/dist/lending/public-data/liquity/types.d.ts.map +1 -0
  29. package/dist/lending/public-data/midnight/apiClient.d.ts +18 -0
  30. package/dist/lending/public-data/midnight/apiClient.d.ts.map +1 -1
  31. package/dist/lending/public-data/midnight/convertPublic.d.ts.map +1 -1
  32. package/dist/lending/public-data/midnight/fetchPublic.d.ts +6 -4
  33. package/dist/lending/public-data/midnight/fetchPublic.d.ts.map +1 -1
  34. package/dist/lending/public-data/midnight/types.d.ts +12 -0
  35. package/dist/lending/public-data/midnight/types.d.ts.map +1 -1
  36. package/dist/lending/public-data/river/convertPublic.d.ts +36 -0
  37. package/dist/lending/public-data/river/convertPublic.d.ts.map +1 -0
  38. package/dist/lending/public-data/river/convertPublic.test.d.ts +2 -0
  39. package/dist/lending/public-data/river/convertPublic.test.d.ts.map +1 -0
  40. package/dist/lending/public-data/river/fetchPublic.d.ts +11 -0
  41. package/dist/lending/public-data/river/fetchPublic.d.ts.map +1 -0
  42. package/dist/lending/public-data/river/index.d.ts +4 -0
  43. package/dist/lending/public-data/river/index.d.ts.map +1 -0
  44. package/dist/lending/public-data/river/types.d.ts +30 -0
  45. package/dist/lending/public-data/river/types.d.ts.map +1 -0
  46. package/dist/lending/public-data/term/apiClient.d.ts +36 -0
  47. package/dist/lending/public-data/term/apiClient.d.ts.map +1 -0
  48. package/dist/lending/public-data/term/convertPublic.d.ts +21 -0
  49. package/dist/lending/public-data/term/convertPublic.d.ts.map +1 -0
  50. package/dist/lending/public-data/term/convertPublic.test.d.ts +2 -0
  51. package/dist/lending/public-data/term/convertPublic.test.d.ts.map +1 -0
  52. package/dist/lending/public-data/term/fetchPublic.d.ts +14 -0
  53. package/dist/lending/public-data/term/fetchPublic.d.ts.map +1 -0
  54. package/dist/lending/public-data/term/index.d.ts +6 -0
  55. package/dist/lending/public-data/term/index.d.ts.map +1 -0
  56. package/dist/lending/public-data/term/math.d.ts +24 -0
  57. package/dist/lending/public-data/term/math.d.ts.map +1 -0
  58. package/dist/lending/public-data/term/types.d.ts +77 -0
  59. package/dist/lending/public-data/term/types.d.ts.map +1 -0
  60. package/dist/lending/user-data/abis.d.ts.map +1 -1
  61. package/dist/lending/user-data/exactly/userCallBuild.d.ts +10 -0
  62. package/dist/lending/user-data/exactly/userCallBuild.d.ts.map +1 -0
  63. package/dist/lending/user-data/exactly/userCallParse.d.ts +43 -0
  64. package/dist/lending/user-data/exactly/userCallParse.d.ts.map +1 -0
  65. package/dist/lending/user-data/fetch-balances/parse.d.ts.map +1 -1
  66. package/dist/lending/user-data/fetch-balances/prepare.d.ts.map +1 -1
  67. package/dist/lending/user-data/liquity/userCall.test.d.ts +2 -0
  68. package/dist/lending/user-data/liquity/userCall.test.d.ts.map +1 -0
  69. package/dist/lending/user-data/liquity/userCallBuild.d.ts +30 -0
  70. package/dist/lending/user-data/liquity/userCallBuild.d.ts.map +1 -0
  71. package/dist/lending/user-data/liquity/userCallParse.d.ts +54 -0
  72. package/dist/lending/user-data/liquity/userCallParse.d.ts.map +1 -0
  73. package/dist/lending/user-data/river/userCall.test.d.ts +2 -0
  74. package/dist/lending/user-data/river/userCall.test.d.ts.map +1 -0
  75. package/dist/lending/user-data/river/userCallBuild.d.ts +16 -0
  76. package/dist/lending/user-data/river/userCallBuild.d.ts.map +1 -0
  77. package/dist/lending/user-data/river/userCallParse.d.ts +24 -0
  78. package/dist/lending/user-data/river/userCallParse.d.ts.map +1 -0
  79. package/dist/lending/user-data/term/userCall.test.d.ts +2 -0
  80. package/dist/lending/user-data/term/userCall.test.d.ts.map +1 -0
  81. package/dist/lending/user-data/term/userCallBuild.d.ts +21 -0
  82. package/dist/lending/user-data/term/userCallBuild.d.ts.map +1 -0
  83. package/dist/lending/user-data/term/userCallParse.d.ts +18 -0
  84. package/dist/lending/user-data/term/userCallParse.d.ts.map +1 -0
  85. package/dist/types/lender/morpho-types.d.ts +38 -1
  86. package/dist/types/lender/morpho-types.d.ts.map +1 -1
  87. package/dist/types/lenderTypes.d.ts +26 -6
  88. package/dist/types/lenderTypes.d.ts.map +1 -1
  89. package/dist/utils/index.d.ts +1 -1
  90. package/dist/utils/index.d.ts.map +1 -1
  91. package/package.json +8 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertPublic.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/term/convertPublic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAMnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAI5C,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGxD;AAOD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,aAAa,EAAE,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAO,EACxC,iBAAiB,GAAE,gBAA2E,EAC9F,MAAM,GAAE,gBAAqB,GAC5B;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAAA;CAAE,CAyL9C;AAED,YAAY,EAAE,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=convertPublic.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convertPublic.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/term/convertPublic.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { TermBookSource, TermMarketRaw } from './types';
2
+ /**
3
+ * Fetch the current top-of-book + a bounded book chunk for every configured
4
+ * Term repo on a chain.
5
+ *
6
+ * Public data = static repo config (from the `termMarkets` registry) + live
7
+ * secondary-listing / auction rates + depth (from the subgraph source). The
8
+ * aggregate best rate + FULL depth live on `top`; `book` carries the best
9
+ * `TERM_BOOK_LEVELS` open orders per side for downstream filtering. Both are
10
+ * null when the fetch failed and no recent snapshot is cached, and when no data
11
+ * endpoint is configured (rates fall back to 0).
12
+ */
13
+ export declare function fetchTermMarkets(chainId: string, source?: TermBookSource): Promise<TermMarketRaw[]>;
14
+ //# sourceMappingURL=fetchPublic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchPublic.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/term/fetchPublic.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAY,cAAc,EAAe,aAAa,EAAE,MAAM,SAAS,CAAA;AA6CnF;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,cAA8C,GACrD,OAAO,CAAC,aAAa,EAAE,CAAC,CAmB1B"}
@@ -0,0 +1,6 @@
1
+ export { fetchTermMarkets } from './fetchPublic';
2
+ export { convertTermMarketsToResponse, termLenderKey } from './convertPublic';
3
+ export { TermSubgraphSource, createTermBookSource, termApiBaseUrl, } from './apiClient';
4
+ export { termMaintenanceRatioToLtv, termLiquidatedDamagesToPenalty, termDiscountRateToAprPct, } from './math';
5
+ export type { TermBook, TermBookLevel, TermBookSource, TermBookTop, TermListing, TermMarketRaw, } from './types';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/term/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC7E,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,wBAAwB,GACzB,MAAM,QAAQ,CAAA;AACf,YAAY,EACV,QAAQ,EACR,aAAa,EACb,cAAc,EACd,WAAW,EACX,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Term Finance rate/ratio helpers. Term is fixed-rate, so most rates arrive
3
+ * pre-computed from the subgraph; these cover the on-chain-derived cases.
4
+ */
5
+ declare const WAD = 1000000000000000000;
6
+ declare const SECONDS_PER_YEAR: number;
7
+ /**
8
+ * Convert a WAD-scaled maintenance collateral ratio into a loan-to-value
9
+ * fraction. Term over-collateralizes: `maintenanceRatio` is collateral/loan
10
+ * (e.g. 1.25e18 = 125%), so LTV = 1 / (ratio/1e18). Returns 0 for bad input.
11
+ */
12
+ export declare function termMaintenanceRatioToLtv(maintenanceRatio: string | undefined): number;
13
+ /** Convert a WAD-scaled liquidated-damages factor into a penalty fraction (0.05 = 5%). */
14
+ export declare function termLiquidatedDamagesToPenalty(liquidatedDamages: string | undefined): number;
15
+ /**
16
+ * Convert a per-annum discount rate (percent) into the implied fixed lend APR
17
+ * for a repo maturing in `ttmSecs`. For a zero-coupon repo token bought at a
18
+ * discount, the realized annualized yield ≈ the discount rate itself, so this
19
+ * is mostly a pass-through with a floor at 0; kept as a seam for a more precise
20
+ * present-value calc if needed.
21
+ */
22
+ export declare function termDiscountRateToAprPct(discountRatePct: number, _ttmSecs: number): number;
23
+ export { WAD as TERM_WAD, SECONDS_PER_YEAR as TERM_SECONDS_PER_YEAR };
24
+ //# sourceMappingURL=math.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/term/math.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,QAAA,MAAM,GAAG,sBAAO,CAAA;AAChB,QAAA,MAAM,gBAAgB,QAAc,CAAA;AAEpC;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAWtF;AAED,0FAA0F;AAC1F,wBAAgB,8BAA8B,CAAC,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAO5F;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1F;AAED,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,CAAA"}
@@ -0,0 +1,77 @@
1
+ import type { TermMarketConfig } from '@1delta/data-sdk';
2
+ /**
3
+ * Top-of-book snapshot for a single Term repo, already reduced to best
4
+ * executable APR per side + aggregate depth. Unlike Midnight (tick math), the
5
+ * Term subgraph is expected to return APRs directly (secondary-listing discount
6
+ * rates and auction-clearing rates), so these are plain percents.
7
+ *
8
+ * Side semantics: SUPPLY = lend (buy repo tokens on the secondary book / submit
9
+ * auction offers); BORROW = auction bids.
10
+ */
11
+ export interface TermBookTop {
12
+ /** Best lend APR in percent (secondary listings / auction offers), if any. */
13
+ supplyAprPct?: number;
14
+ /** Best borrow APR in percent (auction bids), if any. */
15
+ borrowAprPct?: number;
16
+ /** Lendable depth in loan-token units (human, already decimal-scaled). */
17
+ supplyLiquidity: number;
18
+ /** Borrowable depth in loan-token units (human, already decimal-scaled). */
19
+ borrowLiquidity: number;
20
+ }
21
+ /** One aggregated book level (already rate+size normalized). */
22
+ export interface TermBookLevel {
23
+ /** annualised rate at this level, percent. */
24
+ apr: number;
25
+ /** aggregate size, loan-token base units (raw string). */
26
+ units: string;
27
+ /** aggregate size, loan-token assets (human number). */
28
+ assets: number;
29
+ }
30
+ /**
31
+ * Bounded book slice. `asks` = the secondary repo-token orders (RepoTokenLinkedList,
32
+ * the continuous LEND book, analogous to Midnight asks); `bids` = the BORROW
33
+ * side (typically empty — Term borrow origination is sealed-bid auction, not a
34
+ * continuous book).
35
+ */
36
+ export interface TermBook {
37
+ bids: TermBookLevel[];
38
+ asks: TermBookLevel[];
39
+ }
40
+ /** One secondary-market repo-token listing (RepoTokenLinkedList), from the subgraph. */
41
+ export interface TermListing {
42
+ listingId: string;
43
+ seller: string;
44
+ repoToken: string;
45
+ /** Listed amount in repo-token units (raw string). */
46
+ amount: string;
47
+ /** Effective discount rate in percent, if the source provides it. */
48
+ discountRatePct?: number;
49
+ }
50
+ /**
51
+ * Pluggable Term public-data source. The hosted subgraph is the source today;
52
+ * an on-chain reader could implement the same interface later. All methods
53
+ * return null/[] when no endpoint is configured (see `resolveTermApiBase`).
54
+ */
55
+ export interface TermBookSource {
56
+ /** Best-APR + depth snapshot for a repo, or null when unavailable. */
57
+ getBookTop(config: TermMarketConfig): Promise<TermBookTop | null>;
58
+ /** Active secondary listings for a repo, or null when unavailable. */
59
+ getListings?(config: TermMarketConfig): Promise<TermListing[] | null>;
60
+ /**
61
+ * ONE query → the aggregate top PLUS a bounded book slice (top `maxLevels`
62
+ * per side). The public batch uses this so it captures a chunk of the order
63
+ * book without a second request. Optional (stubs may omit).
64
+ */
65
+ getTopAndBook?(config: TermMarketConfig, maxLevels?: number): Promise<{
66
+ top: TermBookTop;
67
+ book: TermBook;
68
+ } | null>;
69
+ }
70
+ /** A Term repo paired with its current top-of-book (null when the fetch failed). */
71
+ export interface TermMarketRaw {
72
+ config: TermMarketConfig;
73
+ top: TermBookTop | null;
74
+ /** Bounded book slice (top-N levels/side); null/absent when unavailable. */
75
+ book?: TermBook | null;
76
+ }
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/term/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAA;IACvB,4EAA4E;IAC5E,eAAe,EAAE,MA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sources":["../../../src/lending/user-data/abis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAgDhD,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,QAqCpC,CAAA"}
1
+ {"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../../src/lending/user-data/abis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AA8DhD,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,QA+DpC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { Call } from '../../../utils/multicall';
2
+ /**
3
+ * Build the user-data call set for Exactly: a SINGLE
4
+ * `Previewer.exactly(account)` call returns every market's floating position,
5
+ * all fixed deposit/borrow positions (with live `previewValue` = withdraw-now /
6
+ * repay-now value incl. early-exit discount and overdue penalty), and the
7
+ * per-market `isCollateral` flag — no per-market fan-out needed.
8
+ */
9
+ export declare const buildExactlyUserCall: (chainId: string, _lender: string, account: string) => Call[];
10
+ //# sourceMappingURL=userCallBuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/exactly/userCallBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAE/C;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,KACd,IAAI,EAIN,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { LenderToLenderCrossPoolMeta, UserData } from '../utils/types';
2
+ /** Per-position fixed-term detail attached to the position row (strings raw). */
3
+ export interface ExactlyUserFixedPosition {
4
+ /** unix maturity */
5
+ maturity: number;
6
+ /** 'deposit' | 'borrow' */
7
+ kind: 'deposit' | 'borrow';
8
+ /** face principal (raw asset units) */
9
+ principal: string;
10
+ /** face fee locked at trade time (raw asset units) */
11
+ fee: string;
12
+ /** live exit value now: withdraw-now / repay-now incl. discount or overdue
13
+ * penalty (raw asset units) — from the Previewer */
14
+ previewValue: string;
15
+ /** true once maturity passed and the position is still open (borrows accrue
16
+ * the per-second late penalty until repaid) */
17
+ overdue: boolean;
18
+ }
19
+ /**
20
+ * Returns a [converter, expectedCallCount] tuple for Exactly user data.
21
+ *
22
+ * Layout mirrors `buildExactlyUserCall`: ONE `Previewer.exactly(account)`
23
+ * result. Emits one `UserData` per market key `EXACTLY_<MARKET_ADDR>`
24
+ * (multi-market), each with a single sub-account:
25
+ *
26
+ * - the market's OWN asset row: deposits = floating deposit + Σ fixed-deposit
27
+ * `previewValue` (current withdraw-now value); debt = floating borrow +
28
+ * Σ fixed-borrow `previewValue` (current repay-now value, incl. overdue
29
+ * penalties); `fixedPositions` carries the per-maturity detail;
30
+ * - CROSS-MARGIN collateral rows: when the user has DEBT in this market, every
31
+ * other entered market with a deposit is added as a collateral row (the
32
+ * public data defines these sibling entries with pairwise adjust-factor
33
+ * LTVs), so health/borrow-capacity compute correctly downstream.
34
+ *
35
+ * Caveat: with debt open in SEVERAL Exactly markets at once, each market's
36
+ * per-key health sees the full shared collateral (cross-margin) — per-market
37
+ * health is then optimistic; the true account constraint is the Auditor's
38
+ * global check. Single-borrow-market accounts (the norm) are exact.
39
+ */
40
+ export declare const getExactlyUserDataConverter: (_lender: string, chainId: string, account: string, meta?: LenderToLenderCrossPoolMeta) => [(data: any[]) => {
41
+ [lender: string]: UserData;
42
+ } | undefined, number];
43
+ //# sourceMappingURL=userCallParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/exactly/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AASvB,iFAAiF;AACjF,MAAM,WAAW,wBAAwB;IACvC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,2BAA2B;IAC3B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC1B,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAA;IACX;yDACqD;IACrD,YAAY,EAAE,MAAM,CAAA;IACpB;oDACgD;IAChD,OAAO,EAAE,OAAO,CAAA;CACjB;AAqBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,2BAA2B,KACjC,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,SAAS,EAAE,MAAM,CAkItE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/fetch-balances/parse.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,eAAe,EAEhB,MAAM,4BAA4B,CAAA;AAiBnC,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAoHtE;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,MAAM,EACf,YAAY,eAAe,EAAE,EAC7B,YAAY,GAAG,EAAE,EACjB,aAAa,2BAA2B,KACvC;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CA4C9B,CAAA"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/fetch-balances/parse.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,eAAe,EAEhB,MAAM,4BAA4B,CAAA;AAqBnC,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AA4HtE;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,MAAM,EACf,YAAY,eAAe,EAAE,EAC7B,YAAY,GAAG,EAAE,EACjB,aAAa,2BAA2B,KACvC;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CA4C9B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/fetch-balances/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAgC/C,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,GAAG,EACZ,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,GACnD,OAAO,CAAC,IAAI,EAAE,CAAC,CAgCjB"}
1
+ {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/fetch-balances/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAwC/C,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,GAAG,EACZ,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,GAAG,GACnD,OAAO,CAAC,IAAI,EAAE,CAAC,CAwCjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=userCall.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCall.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/liquity/userCall.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { LiquityBranchConfig } from '@1delta/data-sdk';
2
+ import { Call } from '../../../utils/multicall';
3
+ export interface LiquityDiscoveredTrove {
4
+ /** decimal uint256 troveId */
5
+ troveId: string;
6
+ zombie: boolean;
7
+ }
8
+ export interface LiquityDiscovery {
9
+ /** Discovered troves per branch, index-aligned with `liquityBranchesByChain`. */
10
+ perBranch: LiquityDiscoveredTrove[][];
11
+ at: number;
12
+ }
13
+ export declare const getCachedLiquityTroves: (chainId: string, lender: string, account: string) => LiquityDiscovery | undefined;
14
+ /** Candidate trove ids for one user: direct + per-zapper salted, as decimal strings. */
15
+ export declare function liquityCandidateTroveIds(account: string, zappers: string[]): string[];
16
+ /** Multicall slots one branch consumes (keep in sync with the parser). */
17
+ export declare const liquityBranchCallCount: (branch: LiquityBranchConfig, troveCount: number) => number;
18
+ /**
19
+ * Async build: runs the discovery status multicall itself, caches the found
20
+ * per-branch trove ids, then returns the data-phase call set executed by the
21
+ * shared sharded multicall (against the merged Liquity ABI from `getAbi`):
22
+ *
23
+ * per branch (config order):
24
+ * troves × [TroveManager.getLatestTroveData(id), TroveNFT.ownerOf(id)]
25
+ * + StabilityPool.[getCompoundedBoldDeposit, getDepositorYieldGainWithPending,
26
+ * getDepositorCollGain, stashedColl](account)
27
+ * + CollSurplusPool.getCollateral(account) (when configured)
28
+ */
29
+ export declare const buildLiquityUserCall: (chainId: string, lender: string, account: string) => Promise<Call[]>;
30
+ //# sourceMappingURL=userCallBuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/liquity/userCallBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AA4B/C,MAAM,WAAW,sBAAsB;IACrC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,SAAS,EAAE,sBAAsB,EAAE,EAAE,CAAA;IACrC,EAAE,EAAE,MAAM,CAAA;CACX;AAOD,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,SAAS,MAAM,KACd,gBAAgB,GAAG,SAIrB,CAAA;AASD,wFAAwF;AACxF,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EAAE,GAChB,MAAM,EAAE,CAiCV;AAED,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,GACjC,QAAQ,mBAAmB,EAC3B,YAAY,MAAM,KACjB,MAA+D,CAAA;AAElE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,SAAS,MAAM,KACd,OAAO,CAAC,IAAI,EAAE,CAuFhB,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { LenderToLenderCrossPoolMeta, UserData } from '../utils/types';
2
+ /** Per-trove detail attached to the debt position row (raw strings). */
3
+ export interface LiquityTroveInfo {
4
+ /** decimal uint256 troveId — the sub-account id */
5
+ troveId: string;
6
+ collIndex: number;
7
+ /** user-set annual interest rate, WAD string (batch rate when delegated) */
8
+ annualInterestRate: string;
9
+ /** unix seconds of the last rate change (premature-adjust fee window) */
10
+ lastInterestRateAdjTime: number;
11
+ /** redeemed below min debt — adjust via adjustZombieTrove */
12
+ zombie: boolean;
13
+ /** pending redistribution gains (from liquidations shared to the branch) */
14
+ redistCollGain: string;
15
+ redistBoldDebtGain: string;
16
+ /** interest + batch-management fee accrued into entireDebt */
17
+ accruedInterest: string;
18
+ accruedBatchManagementFee: string;
19
+ }
20
+ /** Stability-pool position detail attached to the `sp` sub-account rows. */
21
+ export interface LiquitySpInfo {
22
+ /** compounded stable deposit (raw) */
23
+ deposit: string;
24
+ /** claimable stable yield incl. pending aggregate interest (raw) */
25
+ yieldGain: string;
26
+ /** claimable liquidation collateral gain (raw coll units) */
27
+ collGain: string;
28
+ /** collateral stashed from prior doClaim=false ops (raw coll units) */
29
+ stashedColl: string;
30
+ /** post-liquidation collateral surplus claimable via claimCollateral (raw) */
31
+ collSurplus: string;
32
+ }
33
+ /**
34
+ * Returns a [converter, expectedCallCount] tuple for Liquity-family user data.
35
+ *
36
+ * Layout mirrors `buildLiquityUserCall` (reconstructed from the discovery
37
+ * cache + branch config — both deterministic within the request). Emits one
38
+ * `UserData` per BRANCH key `<LENDER>_<COLL_INDEX>`, each containing:
39
+ *
40
+ * - one sub-account PER TROVE (`accountId` = decimal troveId): collateral
41
+ * row (`entireColl`) + stable debt row (`entireDebt`, incl. accrued
42
+ * interest / batch fee / redistribution) with `troveInfo` detail (user-set
43
+ * rate, zombie flag, rate-adjust cooldown anchor). Troves whose NFT was
44
+ * transferred away (ownerOf ≠ account) are skipped.
45
+ * - an `sp` sub-account when the user has Stability Pool state: stable
46
+ * deposits + yield on the loan row, claimable collateral (liquidation
47
+ * gains + stash + surplus) on the collateral row, with `spInfo` detail.
48
+ * SP deposits never collateralize (public data flags the loan market
49
+ * `collateralDisabled`), so health stays null there.
50
+ */
51
+ export declare const getLiquityUserDataConverter: (lender: string, chainId: string, account: string, meta?: LenderToLenderCrossPoolMeta) => [(data: any[]) => {
52
+ [lender: string]: UserData;
53
+ } | undefined, number];
54
+ //# sourceMappingURL=userCallParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/liquity/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AAIvB,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,4EAA4E;IAC5E,kBAAkB,EAAE,MAAM,CAAA;IAC1B,yEAAyE;IACzE,uBAAuB,EAAE,MAAM,CAAA;IAC/B,6DAA6D;IAC7D,MAAM,EAAE,OAAO,CAAA;IACf,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAA;IACtB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,8DAA8D;IAC9D,eAAe,EAAE,MAAM,CAAA;IACvB,yBAAyB,EAAE,MAAM,CAAA;CAClC;AAED,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAA;IACjB,6DAA6D;IAC7D,QAAQ,EAAE,MAAM,CAAA;IAChB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAA;IACnB,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAA;CACpB;AAcD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,2BAA2B,KACjC,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,SAAS,EAAE,MAAM,CA0OtE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=userCall.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCall.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/river/userCall.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { Call } from '../../../utils/multicall';
2
+ /**
3
+ * User-data call build for River (Satoshi Protocol). Troves are keyed by
4
+ * OWNER ADDRESS — one per user per TroveManager — so there is NO discovery
5
+ * phase and the layout is fully deterministic from config:
6
+ *
7
+ * per market (config order):
8
+ * TroveManager.getEntireDebtAndColl(account) (incl. pending redistribution)
9
+ * TroveManager.getTroveStatus(account)
10
+ * TroveManager.surplusBalances(account) (post-liquidation claimable)
11
+ * then once per chain:
12
+ * XApp.getCompoundedDebtDeposit(account) (single StabilityPool)
13
+ */
14
+ export declare const RIVER_CALLS_PER_MARKET = 3;
15
+ export declare const buildRiverUserCall: (chainId: string, lender: string, account: string) => Call[];
16
+ //# sourceMappingURL=userCallBuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/river/userCallBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAE/C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,eAAO,MAAM,kBAAkB,GAC7B,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,SAAS,MAAM,KACd,IAAI,EAoBN,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { LenderToLenderCrossPoolMeta, UserData } from '../utils/types';
2
+ /** Per-market position detail attached to the debt row (raw strings). */
3
+ export interface RiverPositionInfo {
4
+ /** TroveManager (market) index. */
5
+ index: number;
6
+ /** Post-liquidation/redemption collateral surplus claimable via claimCollateral. */
7
+ collateralSurplus: string;
8
+ }
9
+ /**
10
+ * Returns a [converter, expectedCallCount] tuple for River user data.
11
+ *
12
+ * Layout mirrors `buildRiverUserCall` (deterministic from config — no
13
+ * discovery cache needed). Emits one `UserData` per market key
14
+ * `RIVER_<TM_INDEX>`, each with a single sub-account `'0'` (troves are
15
+ * address-keyed: at most ONE per user per market): collateral row
16
+ * (entire coll incl. pending redistribution) + satUSD debt row (entire debt)
17
+ * with `riverInfo` (collateral surplus). The single per-chain StabilityPool
18
+ * deposit is attached as an `sp` sub-account on market index 0 (matching the
19
+ * public-data convention).
20
+ */
21
+ export declare const getRiverUserDataConverter: (lender: string, chainId: string, account: string, meta?: LenderToLenderCrossPoolMeta) => [(data: any[]) => {
22
+ [lender: string]: UserData;
23
+ } | undefined, number];
24
+ //# sourceMappingURL=userCallParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/river/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AAIvB,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAcD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,GACpC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,2BAA2B,KACjC,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,SAAS,EAAE,MAAM,CA8ItE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=userCall.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCall.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/term/userCall.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { Call } from '../../../utils/multicall';
2
+ /**
3
+ * Number of multicall slots one Term repo consumes: `repoToken.balanceOf(user)`
4
+ * (1) + `repoToken.redemptionValue()` (1) + `servicer.getBorrowerRepurchaseObligation(user)`
5
+ * (1) + one `collateralManager.getCollateralBalance(user, token)` per collateral
6
+ * leg. The parser walks `termMarketsByChain` in the SAME order to slice results.
7
+ */
8
+ export declare const termMarketCallCount: (collateralCount: number) => number;
9
+ /**
10
+ * Build the user-data multicall for every configured Term repo on a chain.
11
+ *
12
+ * Unlike Midnight (one core contract), Term positions live across the repo's
13
+ * serial contracts: lent principal from the TermRepoToken (`balanceOf` scaled by
14
+ * `redemptionValue`), borrow debt from the TermRepoServicer
15
+ * (`getBorrowerRepurchaseObligation`), and collateral from the
16
+ * TermRepoCollateralManager (`getCollateralBalance` per leg). Function names do
17
+ * not collide across the three ABIs, so a single merged ABI (see `getAbi`)
18
+ * resolves each call by name while each call targets its own contract address.
19
+ */
20
+ export declare const buildTermUserCall: (chainId: string, _lender: string, account: string) => Call[];
21
+ //# sourceMappingURL=userCallBuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/term/userCallBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,iBAAiB,MAAM,WAAwB,CAAA;AAEnF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,KACd,IAAI,EAsBN,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { LenderToLenderCrossPoolMeta, UserData } from '../utils/types';
2
+ /**
3
+ * Returns a [converter, expectedCallCount] tuple for Term Finance user data.
4
+ *
5
+ * Layout mirrors `buildTermUserCall`: per configured repo, a `balanceOf` result,
6
+ * a `redemptionValue` result, a `getBorrowerRepurchaseObligation` result, then
7
+ * one `getCollateralBalance` result per collateral leg. Emits one `UserData` per
8
+ * repo key `TERM_FINANCE_<id>` (multi-market), each with a single sub-account.
9
+ *
10
+ * Lender (lent) side = the redeemable face value of the held repo tokens
11
+ * (`balanceOf * redemptionValue / 1e18`, in purchaseToken units). Borrow side =
12
+ * the outstanding repurchase obligation. Both are reported at face value; health
13
+ * / borrow-capacity are computed downstream in `createMultiAccountTypeUserState`.
14
+ */
15
+ export declare const getTermUserDataConverter: (_lender: string, chainId: string, account: string, meta?: LenderToLenderCrossPoolMeta) => [(data: any[]) => {
16
+ [lender: string]: UserData;
17
+ } | undefined, number];
18
+ //# sourceMappingURL=userCallParse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/term/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AAgBvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,EACf,OAAO,2BAA2B,KACjC,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAA;CAAE,GAAG,SAAS,EAAE,MAAM,CAoItE,CAAA"}
@@ -57,6 +57,30 @@ export interface RewardEntry extends BaseYields {
57
57
  asset: string;
58
58
  }
59
59
  export type RewardsList = RewardEntry[];
60
+ /**
61
+ * One aggregated level of an order-book side, provider-agnostic (rate + size).
62
+ * Emitted best-first (best executable offer first). Used by fixed-rate
63
+ * order-book lenders (Morpho Midnight, Term Finance) to carry a bounded slice of
64
+ * the live book so consumers can filter later (rate-at-size, dust removal, …).
65
+ */
66
+ export interface PublicBookLevel {
67
+ /** annualised rate at this level, PERCENT. */
68
+ apr: number;
69
+ /** aggregate size at this level, loan-token base units (raw string). */
70
+ units: string;
71
+ /** aggregate size at this level, loan-token assets (human number). */
72
+ assets: number;
73
+ }
74
+ /**
75
+ * Bounded top-of-book slice (best-first, capped per side). `bids` = the BORROW
76
+ * side (take to borrow), `asks` = the LEND side (take to lend). Either side may
77
+ * be empty (e.g. a one-sided secondary market). Present only on order-book
78
+ * fixed-rate markets.
79
+ */
80
+ export interface MarketBook {
81
+ bids: PublicBookLevel[];
82
+ asks: PublicBookLevel[];
83
+ }
60
84
  export interface MorphoMarket {
61
85
  /** the 1delta lender enum */
62
86
  lender: string;
@@ -86,13 +110,19 @@ export interface MorphoMarket {
86
110
  rateCap?: string;
87
111
  /** IRM rate floor */
88
112
  rateFloor?: string;
89
- /** Lista broker term menu — available term products (brokered markets only) */
113
+ /** Fixed-term rate menu — available term products (Lista brokered markets,
114
+ * Term/Midnight single-maturity markets, Exactly multi-maturity markets —
115
+ * for Exactly `termId` = the pool's unix maturity timestamp). */
90
116
  terms?: {
91
117
  termId: number;
92
118
  durationSecs: number;
93
119
  durationDays: number;
94
120
  /** annualised borrow rate in PERCENT (e.g. 3.857 = 3.857% APR) */
95
121
  apr: number;
122
+ /** annualised fixed LEND rate in PERCENT at this maturity (Exactly only) */
123
+ depositApr?: number;
124
+ /** borrowable liquidity at this maturity, loan-token human units (Exactly only) */
125
+ available?: number;
96
126
  }[];
97
127
  /**
98
128
  * Canonical cross-protocol fixed-term descriptor (Lista brokered + Morpho
@@ -100,6 +130,13 @@ export interface MorphoMarket {
100
130
  * {@link FixedTermInfo}.
101
131
  */
102
132
  fixedTerm?: FixedTermInfo;
133
+ /**
134
+ * Bounded top-of-book slice (best-first, capped per side) for order-book
135
+ * fixed-rate markets (Midnight, Term). Baseline for downstream filtering; the
136
+ * aggregate best rate + full depth stay on the `data[*]` entries. Absent on
137
+ * non-order-book markets.
138
+ */
139
+ book?: MarketBook;
103
140
  }
104
141
  export interface MorphoGeneralPublicResponse {
105
142
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"morpho-types.d.ts","sourceRoot":"","sources":["../../../src/types/lender/morpho-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE;QACP,KAAK,EAAE;YACL,SAAS,EAAE,MAAM,CAAA;YACjB,UAAU,EAAE,MAAM,CAAA;YAClB,aAAa,EAAE,MAAM,CAAA;YACrB,IAAI,EAAE,MAAM,CAAA;YACZ,WAAW,EAAE,OAAO,CAAA;YACpB,SAAS,EAAE;gBACT,OAAO,EAAE,MAAM,CAAA;gBACf,IAAI,EAAE,MAAM,CAAA;gBACZ,MAAM,EAAE,MAAM,CAAA;gBACd,QAAQ,EAAE,MAAM,CAA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AgB,EAAE,MAAM,CAAA;YACxB,kBAAkB,EAAE,CAAC,CAAA;YACrB,YAAY,EAAE,MAAM,CAAA;YACpB,iCAAiC;YACjC,WAAW,EAAE,MAAM,CAAA;YAEnB,WAAW,EAAE,MAAM,CAAA;YACnB,kBAAkB,EAAE,MAAM,CAAA;YAC1B,cAAc,EAAE,MAAM,CAAA;YACtB,yFAAyF;YACzF,gBAAgB,EAAE,MAAM,CAAA;YAGxB,OAAO,CAAC,EAAE,WAAW,CAAA;YAGrB,QAAQ,EAAE,MAAM,CAAA;YAEhB,MAAM,EAAE;gBACN,CAAC,CAAC,CAAC,EAAE;oBACH,QAAQ,EAAE,MAAM,CAAA;oBAEhB,sBAAsB,EAAE,MAAM,CAAA;oBAC9B,gBAAgB,EAAE,MAAM,CAAA;oBACxB,YAAY,EAAE,CAAC,CAAA;oBACf,kBAAkB,EAAE,MAAM,CAAA;oBAC1B,WAAW,EAAE,MAAM,CAAA;oBACnB,kBAAkB,EAAE,OAAO,CAAA;oBAC3B,YAAY,EAAE,OAAO,CAAA;iBACtB,CAAA;aACF,CAAA;YAGD,WAAW,EAAE,MAAM,CAAA;YAGnB,gBAAgB,EAAE,OAAO,CAAA;YACzB,gBAAgB,EAAE,OAAO,CAAA;YACzB,eAAe,EAAE,OAAO,CAAA;YACxB,SAAS,EAAE,OAAO,CAAA;YAClB;4GACgG;YAChG,sBAAsB,CAAC,EAAE,OAAO,CAAA;YAChC,QAAQ,EAAE,IAAI,CAAA;YACd,QAAQ,EAAE,KAAK,CAAA;SAChB,CAAA;KACF,CAAA;IACD,yBAAyB;IACzB,MAAM,EAAE;QACN,MAAM,EAAE,YAAY,CAAA;KACrB,CAAA;IACD,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -127,9 +127,13 @@ export interface BaseLendingPositions {
127
127
  * any time at the current market price with no penalty (Morpho Midnight buys the
128
128
  * debt units back on the order book). `penalty` = a per-loan penalty applies
129
129
  * (Lista); the concrete amount is position-level, on `ListaTermLoan.earlyRepayPenalty`.
130
+ * `discount` = repaying early costs LESS than face value (Exactly: the pool's
131
+ * unassigned earnings are rebated to the early repayer — the exact amount comes
132
+ * from `previewRepayAtMaturity` at repay time). Note that a `discount` lender
133
+ * can still have a LATE-repay penalty (see `fees.latePenaltyApr`).
130
134
  */
131
135
  export type FixedTermEarlyRepay = {
132
- kind: 'none' | 'penalty';
136
+ kind: 'none' | 'penalty' | 'discount';
133
137
  };
134
138
  /**
135
139
  * Who fronts a fixed term — the cross-protocol answer to "who is offering these
@@ -137,12 +141,18 @@ export type FixedTermEarlyRepay = {
137
141
  * - `broker`: a single market broker sets the term (Lista LendingBroker proxy).
138
142
  * `address` is that broker contract — one per market, stable, public.
139
143
  * - `orderbook`: the term is an aggregate of many signed maker offers (Morpho
140
- * Midnight). There is no single provider at the market level, so `address` is
144
+ * Midnight) or continuous repo-token listings (Term Finance secondary
145
+ * market). There is no single provider at the market level, so `address` is
141
146
  * omitted; the concrete maker(s) are per-offer and only known at quote time.
147
+ * - `auction`: the term is discovered by a periodic sealed-bid auction (Term
148
+ * Finance primary market). `address` is the per-repo auction/servicer venue.
149
+ * - `pool`: the term is fronted by a passive liquidity pool with a
150
+ * utilization-curve rate (Exactly fixed pools backed by the floating pool).
151
+ * `address` is the Market contract.
142
152
  */
143
153
  export interface FixedTermProvider {
144
- kind: 'broker' | 'orderbook';
145
- /** The single counterparty/venue contract, when there is one (Lista broker). */
154
+ kind: 'broker' | 'orderbook' | 'auction' | 'pool';
155
+ /** The single counterparty/venue contract, when there is one (Lista broker, Term servicer). */
146
156
  address?: string;
147
157
  }
148
158
  /**
@@ -154,8 +164,12 @@ export interface FixedTermProvider {
154
164
  */
155
165
  export interface FixedTermInfo {
156
166
  /** Underlying fixed-term protocol shape. */
157
- model: 'lista' | 'midnight';
158
- /** Single fixed calendar maturity (unix secs). Undefined for rolling-duration menus (Lista). */
167
+ model: 'lista' | 'midnight' | 'term' | 'exactly';
168
+ /**
169
+ * Single fixed calendar maturity (unix secs). Undefined for rolling-duration
170
+ * menus (Lista) and multi-maturity markets (Exactly — the maturity menu lives
171
+ * on `params.market.terms`, keyed by `termId` = maturity timestamp).
172
+ */
159
173
  maturity?: number;
160
174
  /** Market-level fees. Empty for lenders without them (Lista); values are 0 when genuinely off. */
161
175
  fees: {
@@ -163,6 +177,12 @@ export interface FixedTermInfo {
163
177
  continuousFeeApr?: number;
164
178
  /** Settlement fee as a fraction at the current time-to-maturity (Midnight). */
165
179
  settlementFee?: number;
180
+ /**
181
+ * LATE-repayment penalty, %/yr, accruing per second on overdue debt after
182
+ * maturity until repaid (Exactly `penaltyRate`). Absent for lenders whose
183
+ * overdue handling is liquidation-only (Midnight/Term).
184
+ */
185
+ latePenaltyApr?: number;
166
186
  };
167
187
  /** Early-repayment policy. */
168
188
  earlyRepay: FixedTermEarlyRepay;