@1delta/margin-fetcher 0.0.314 → 0.0.317
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 +745 -288
- package/dist/index.js.map +1 -1
- package/dist/lending/public-data/fetchLenderAll.d.ts.map +1 -1
- package/dist/lending/public-data/fetchLenderExt.d.ts.map +1 -1
- package/dist/lending/public-data/midnight/apiClient.d.ts +21 -0
- package/dist/lending/public-data/midnight/apiClient.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/convertPublic.d.ts +25 -0
- package/dist/lending/public-data/midnight/convertPublic.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/fetchPublic.d.ts +12 -0
- package/dist/lending/public-data/midnight/fetchPublic.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/index.d.ts +6 -0
- package/dist/lending/public-data/midnight/index.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/live.test.d.ts +2 -0
- package/dist/lending/public-data/midnight/live.test.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/math.d.ts +22 -0
- package/dist/lending/public-data/midnight/math.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/math.test.d.ts +2 -0
- package/dist/lending/public-data/midnight/math.test.d.ts.map +1 -0
- package/dist/lending/public-data/midnight/types.d.ts +45 -0
- package/dist/lending/public-data/midnight/types.d.ts.map +1 -0
- package/dist/lending/user-data/abis.d.ts.map +1 -1
- package/dist/lending/user-data/fetch-balances/parse.d.ts.map +1 -1
- package/dist/lending/user-data/fetch-balances/prepare.d.ts.map +1 -1
- package/dist/lending/user-data/midnight/index.d.ts +3 -0
- package/dist/lending/user-data/midnight/index.d.ts.map +1 -0
- package/dist/lending/user-data/midnight/userCallBuild.d.ts +16 -0
- package/dist/lending/user-data/midnight/userCallBuild.d.ts.map +1 -0
- package/dist/lending/user-data/midnight/userCallParse.d.ts +17 -0
- package/dist/lending/user-data/midnight/userCallParse.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/yields/intrinsic/index.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchLenderAll.d.ts","sourceRoot":"","sources":["../../../src/lending/public-data/fetchLenderAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAOtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"fetchLenderAll.d.ts","sourceRoot":"","sources":["../../../src/lending/public-data/fetchLenderAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAOtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AA4DtD,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,SAAS,MAAM,EAAE,EACjB,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,gBAAgB,sBAAsB,EACtC,YAAY,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAC3C,sCAAoC,KACnC,OAAO,CAAC;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAgEnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchLenderExt.d.ts","sourceRoot":"","sources":["../../../src/lending/public-data/fetchLenderExt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchLenderExt.d.ts","sourceRoot":"","sources":["../../../src/lending/public-data/fetchLenderExt.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAY9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AA8CtD,eAAO,MAAM,yBAAyB,GACpC,SAAS,MAAM,EACf,SAAS,MAAM,EAAE,EACjB,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,MAAM,OAAO,CAAC,gBAAgB,CAExC,EACD,yBAAuB,KACtB,OAAO,CAAC;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAqMnC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MidnightBookSource, MidnightBookTop } from './types';
|
|
2
|
+
/** Default hosted Midnight API (see @morpho-org/midnight-sdk MidnightApi). */
|
|
3
|
+
export declare const DEFAULT_MIDNIGHT_API = "https://api.morpho.org/v0/midnight";
|
|
4
|
+
type FetchLike = typeof fetch;
|
|
5
|
+
/** Resolve a chain's Midnight API base URL from config, falling back to the hosted default. */
|
|
6
|
+
export declare function midnightApiBaseUrl(chainId: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Hosted-API book source. Reads `GET {base}/books/{marketId}` and reduces the
|
|
9
|
+
* `asks`/`bids` price levels to a {@link MidnightBookTop}. This is the swappable
|
|
10
|
+
* seam: a self-indexed mempool source can implement the same interface later.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ApiBookSource implements MidnightBookSource {
|
|
13
|
+
private readonly baseUrl;
|
|
14
|
+
private readonly fetchImpl;
|
|
15
|
+
constructor(baseUrl: string, fetchImpl?: FetchLike);
|
|
16
|
+
getBookTop(marketId: string): Promise<MidnightBookTop | null>;
|
|
17
|
+
}
|
|
18
|
+
/** Build the default (hosted-API) book source for a chain. */
|
|
19
|
+
export declare function createMidnightBookSource(chainId: string, fetchImpl?: FetchLike): MidnightBookSource;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=apiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/apiClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAA;AAErF,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAOxE,KAAK,SAAS,GAAG,OAAO,KAAK,CAAA;AAE7B,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG1D;AAgED;;;;GAIG;AACH,qBAAa,aAAc,YAAW,kBAAkB;IAEpD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBADT,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAAiB;IAGzC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;CAkBpE;AAED,8DAA8D;AAC9D,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAAiB,GAC3B,kBAAkB,CAEpB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { MidnightMarketConfig } from '@1delta/data-sdk';
|
|
2
|
+
import { MorphoGeneralPublicResponse } from '../../../types/lender/morpho-types';
|
|
3
|
+
import { AdditionalYields, GenericTokenList } from '../../../types';
|
|
4
|
+
import type { MidnightMarketRaw } from './types';
|
|
5
|
+
/** Synthesized per-market lender key, e.g. `MORPHO_MIDNIGHT_<MARKETID_HEX_UPPER>`. */
|
|
6
|
+
export declare function midnightLenderKey(marketId: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Map fetched Midnight markets into the shared `MorphoGeneralPublicResponse`
|
|
9
|
+
* shape used by every collateralized-borrow lender, keyed by the synthesized
|
|
10
|
+
* `MORPHO_MIDNIGHT_<id>` lender key.
|
|
11
|
+
*
|
|
12
|
+
* One LOAN entry per market carries the fixed rates:
|
|
13
|
+
* - `variableBorrowRate` = best fixed BORROW APR (from bids), in percent
|
|
14
|
+
* - `depositRate` = best fixed SUPPLY/lend APR (from asks), in percent
|
|
15
|
+
* plus order-book depth as the "liquidity" proxy. One COLLATERAL entry per
|
|
16
|
+
* collateral leg carries the per-leg LLTV → collateralFactor + liquidation
|
|
17
|
+
* penalty. `params.market` carries the full Midnight market struct + maturity.
|
|
18
|
+
*/
|
|
19
|
+
export declare function convertMidnightMarketsToResponse(raw: MidnightMarketRaw[], chainId: string, prices?: {
|
|
20
|
+
[asset: string]: number;
|
|
21
|
+
}, _additionalYields?: AdditionalYields, tokens?: GenericTokenList): {
|
|
22
|
+
[m: string]: MorphoGeneralPublicResponse;
|
|
23
|
+
};
|
|
24
|
+
export type { MidnightMarketConfig };
|
|
25
|
+
//# sourceMappingURL=convertPublic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertPublic.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/convertPublic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAQnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAIhD,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAkBD;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAC9C,GAAG,EAAE,iBAAiB,EAAE,EACxB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAO,EACxC,iBAAiB,GAAE,gBAIlB,EACD,MAAM,GAAE,gBAAqB,GAC5B;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,2BAA2B,CAAA;CAAE,CAmL9C;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MidnightBookSource, MidnightMarketRaw } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch the current top-of-book for every configured Midnight market on a chain.
|
|
4
|
+
*
|
|
5
|
+
* Public data = static market config (from `midnightMarkets` registry) + live
|
|
6
|
+
* order-book rates/depth (from the book source). No RPC is required for the
|
|
7
|
+
* public view: LLTVs / maturities / decimals come from config, rates from the
|
|
8
|
+
* API. Returns one entry per configured market (with `top: null` when its book
|
|
9
|
+
* fetch failed — the converter still emits the market with zeroed rates).
|
|
10
|
+
*/
|
|
11
|
+
export declare function fetchMidnightMarkets(chainId: string, source?: MidnightBookSource): Promise<MidnightMarketRaw[]>;
|
|
12
|
+
//# sourceMappingURL=fetchPublic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchPublic.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/fetchPublic.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEpE;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,kBAAsD,GAC7D,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAU9B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { fetchMidnightMarkets } from './fetchPublic';
|
|
2
|
+
export { convertMidnightMarketsToResponse, midnightLenderKey, } from './convertPublic';
|
|
3
|
+
export { ApiBookSource, createMidnightBookSource, midnightApiBaseUrl, DEFAULT_MIDNIGHT_API, } from './apiClient';
|
|
4
|
+
export { tickToPrice, tickToRate, tickToApr, tickToAprNumber, } from './math';
|
|
5
|
+
export type { MidnightBookSource, MidnightBookTop, MidnightBookLevel, MidnightMarketRaw, } from './types';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EACL,gCAAgC,EAChC,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,aAAa,EACb,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,GAChB,MAAM,QAAQ,CAAA;AACf,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/live.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const WAD = 1000000000000000000n;
|
|
2
|
+
export declare const LN_ONE_PLUS_DELTA = 4987541511039073n;
|
|
3
|
+
export declare const LN_2 = 693147180559945309n;
|
|
4
|
+
export declare const EXP_OFFSET = 322611214989459870n;
|
|
5
|
+
export declare const MAX_TICK = 6744n;
|
|
6
|
+
export declare const PRICE_ROUNDING_STEP = 100000000000n;
|
|
7
|
+
export declare const SECONDS_PER_YEAR = 31536000n;
|
|
8
|
+
/** WAD-scaled exponential approximation used by the Midnight tick curve. */
|
|
9
|
+
export declare function wExp(x: bigint): bigint;
|
|
10
|
+
/** Convert a Midnight tick into a WAD zero-coupon price (rounded to the step). */
|
|
11
|
+
export declare function tickToPrice(tick: bigint): bigint;
|
|
12
|
+
/** Convert a Midnight tick into a WAD fixed *period* rate (`1/price - 1`). */
|
|
13
|
+
export declare function tickToRate(tick: bigint): bigint;
|
|
14
|
+
/**
|
|
15
|
+
* Convert a Midnight tick into a WAD simple APR, annualizing the period rate
|
|
16
|
+
* over `timeToMaturity` seconds. Returns 0 for non-positive time-to-maturity
|
|
17
|
+
* (matured / mispriced markets) rather than throwing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function tickToApr(tick: bigint, timeToMaturity: bigint): bigint;
|
|
20
|
+
/** APR as a plain fraction (e.g. `0.0512` for 5.12%). Convenience for display. */
|
|
21
|
+
export declare function tickToAprNumber(tick: bigint, timeToMaturity: bigint): number;
|
|
22
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/math.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,GAAG,uBAA6B,CAAA;AAI7C,eAAO,MAAM,iBAAiB,oBAAyB,CAAA;AACvD,eAAO,MAAM,IAAI,sBAA2B,CAAA;AAC5C,eAAO,MAAM,UAAU,sBAA2B,CAAA;AAClD,eAAO,MAAM,QAAQ,QAAQ,CAAA;AAC7B,eAAO,MAAM,mBAAmB,gBAAmB,CAAA;AAGnD,eAAO,MAAM,gBAAgB,YAAc,CAAA;AAM3C,4EAA4E;AAC5E,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAUtC;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAE5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/math.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { MidnightMarketConfig } from '@1delta/data-sdk';
|
|
2
|
+
/** One aggregated price level of a Midnight book side (raw bigints, loan-token units). */
|
|
3
|
+
export interface MidnightBookLevel {
|
|
4
|
+
/** Midnight tick (price point). */
|
|
5
|
+
tick: bigint;
|
|
6
|
+
/** Total credit/debt units available at this level. */
|
|
7
|
+
units: bigint;
|
|
8
|
+
/** Total loan-token assets implied at this level. */
|
|
9
|
+
assets: bigint;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Top-of-book snapshot for a single Midnight market, already reduced to the
|
|
13
|
+
* best executable rate per side plus the aggregate depth.
|
|
14
|
+
*
|
|
15
|
+
* Side semantics (Midnight): `bids` are maker BUY offers (makers lending) — a
|
|
16
|
+
* taker consumes them to BORROW. `asks` are maker SELL offers (makers
|
|
17
|
+
* borrowing) — a taker consumes them to LEND. So:
|
|
18
|
+
* - best BORROW rate = min period-rate over bids (cheapest to borrow)
|
|
19
|
+
* - best SUPPLY yield = max period-rate over asks (highest to lend)
|
|
20
|
+
* Selection is order-agnostic (we scan every level), so it does not depend on
|
|
21
|
+
* the API returning levels best-first.
|
|
22
|
+
*/
|
|
23
|
+
export interface MidnightBookTop {
|
|
24
|
+
/** Tick of the best (lowest-rate) borrow offer, or undefined if the bid side is empty. */
|
|
25
|
+
bestBorrowTick?: bigint;
|
|
26
|
+
/** Tick of the best (highest-yield) supply offer, or undefined if the ask side is empty. */
|
|
27
|
+
bestSupplyTick?: bigint;
|
|
28
|
+
/** Aggregate borrowable units/assets (bid side). */
|
|
29
|
+
borrowDepthUnits: bigint;
|
|
30
|
+
borrowDepthAssets: bigint;
|
|
31
|
+
/** Aggregate lendable units/assets (ask side). */
|
|
32
|
+
supplyDepthUnits: bigint;
|
|
33
|
+
supplyDepthAssets: bigint;
|
|
34
|
+
}
|
|
35
|
+
/** Pluggable Midnight order-book source — hosted API today, self-indexed mempool later. */
|
|
36
|
+
export interface MidnightBookSource {
|
|
37
|
+
/** Best-rate + depth snapshot for a market, or null when unavailable. */
|
|
38
|
+
getBookTop(marketId: string): Promise<MidnightBookTop | null>;
|
|
39
|
+
}
|
|
40
|
+
/** A Midnight market paired with its current top-of-book (null when the book fetch failed). */
|
|
41
|
+
export interface MidnightMarketRaw {
|
|
42
|
+
config: MidnightMarketConfig;
|
|
43
|
+
top: MidnightBookTop | null;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE5D,0FAA0F;AAC1F,MAAM,WAAW,iBAAiB;IAChC,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4FAA4F;IAC5F,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAA;IACxB,iBAAiB,EAAE,MAAM,CAAA;IACzB,kDAAkD;IAClD,gBAAgB,EAAE,MAAM,CAAA;IACxB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED,2FAA2F;AAC3F,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAA;CAC9D;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,GAAG,EAAE,eAAe,GAAG,IAAI,CAAA;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAgDhD,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,QAqCpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/fetch-balances/parse.ts"],"names":[],"mappings":"
|
|
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 +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;
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/midnight/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAChF,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Call } from '../../../utils/multicall';
|
|
2
|
+
/**
|
|
3
|
+
* Number of multicall slots one Midnight market consumes: `position(id,user)`
|
|
4
|
+
* (1) plus one `collateral(id,user,index)` per collateral leg. The parser must
|
|
5
|
+
* walk `midnightMarketsByChain` in the SAME order to slice results correctly.
|
|
6
|
+
*/
|
|
7
|
+
export declare const midnightMarketCallCount: (collateralCount: number) => number;
|
|
8
|
+
/**
|
|
9
|
+
* Build the user-data multicall for every configured Midnight market on a chain.
|
|
10
|
+
*
|
|
11
|
+
* Midnight has no aggregating lens (unlike Morpho): per market we read the
|
|
12
|
+
* packed `position(id,user)` tuple (credit/debt/bitmap) and each collateral leg
|
|
13
|
+
* via `collateral(id,user,index)`. All calls target the core Midnight contract.
|
|
14
|
+
*/
|
|
15
|
+
export declare const buildMidnightUserCall: (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/midnight/userCallBuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAE/C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,MAAM,WAC1C,CAAA;AAErB;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,SAAS,MAAM,KACd,IAAI,EAqBN,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LenderToLenderCrossPoolMeta, UserData } from '../utils/types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a [converter, expectedCallCount] tuple for Midnight user data.
|
|
4
|
+
*
|
|
5
|
+
* Layout mirrors `buildMidnightUserCall`: per configured market, one `position`
|
|
6
|
+
* result followed by one `collateral(index)` result per collateral leg. Emits
|
|
7
|
+
* one `UserData` per market key `MORPHO_MIDNIGHT_<id>` (multi-market), each with
|
|
8
|
+
* a single sub-account holding the debt (loan side) + collateral legs.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: debt is reported at face value (units settle 1:1 at maturity), not the
|
|
11
|
+
* discounted present value. Health / borrow-capacity are computed downstream
|
|
12
|
+
* from LLTVs + oracle prices in `createMultiAccountTypeUserState`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const getMidnightUserDataConverter: (_lender: string, chainId: string, account: string, meta?: LenderToLenderCrossPoolMeta) => [(data: any[]) => {
|
|
15
|
+
[lender: string]: UserData;
|
|
16
|
+
} | undefined, number];
|
|
17
|
+
//# sourceMappingURL=userCallParse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userCallParse.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/midnight/userCallParse.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,2BAA2B,EAC3B,QAAQ,EACT,MAAM,gBAAgB,CAAA;AA+BvB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,4BAA4B,GACvC,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,CAiHtE,CAAA"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createMarketUid } from './marketUid';
|
|
2
2
|
export { lenderShortName } from './marketName';
|
|
3
|
-
export { isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isLista, isAaveV3Type, isAaveV2Type, isYLDR, isAaveV32Type, isAaveType, isCompoundV2Type, isVenusType, isSumerType, isTectonicType, isBenqiType, isKineticType, isMultiMarket, isEulerType, isAaveV4Type, isSiloV2Type, isSiloV3Type, isFluid, isGearboxV3, isDolomite, } from '@1delta/lender-registry';
|
|
3
|
+
export { isCompoundV3, isCompoundV3Type, isInit, isMorphoType, isMidnight, isLista, isAaveV3Type, isAaveV2Type, isYLDR, isAaveV32Type, isAaveType, isCompoundV2Type, isVenusType, isSumerType, isTectonicType, isBenqiType, isKineticType, isMultiMarket, isEulerType, isAaveV4Type, isSiloV2Type, isSiloV3Type, isFluid, isGearboxV3, isDolomite, } from '@1delta/lender-registry';
|
|
4
4
|
export declare const ENABLED_EULER_V2_CHAINS: string[];
|
|
5
5
|
export declare const getLendersForChain: (c: string) => string[];
|
|
6
6
|
/** Filter lenders by protocol list */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAI9C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,WAAW,EACX,UAAU,GACX,MAAM,yBAAyB,CAAA;AAgDhC,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAgB3C,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,MAAM,aAiG3C,CAAA;AAED,sCAAsC;AACtC,eAAO,MAAM,uBAAuB,GAClC,YAAY,MAAM,EAAE,EACpB,eAAe,MAAM,EAAE,KACtB,MAAM,EAqBR,CAAA;AAED,mCAAmC;AACnC,eAAO,MAAM,gBAAgB;;CAS5B,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,GAAG,MAAM,GAAG,SAAS,EACpC,kBAAiB,MAAuB,KACvC,MAAM,EAOR,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/yields/intrinsic/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/yields/intrinsic/index.ts"],"names":[],"mappings":"AAgEA,8DAA8D;AAC9D,wBAAsB,oBAAoB,IAAI,OAAO,CAAC;IACpD,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACpC,CAAC,CA4FD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1delta/margin-fetcher",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.317",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"async-retry": "^1.3.3",
|
|
24
24
|
"lodash": "^4.17.23",
|
|
25
|
-
"@1delta/abis": "0.0.
|
|
26
|
-
"@1delta/
|
|
27
|
-
"@1delta/
|
|
25
|
+
"@1delta/abis": "0.0.22",
|
|
26
|
+
"@1delta/data-sdk": "0.0.29",
|
|
27
|
+
"@1delta/calldata-sdk": "0.0.156",
|
|
28
|
+
"@1delta/dex-registry": "0.0.103",
|
|
28
29
|
"@1delta/proxy-fetch": "0.0.1",
|
|
29
|
-
"@1delta/
|
|
30
|
-
"@1delta/calldata-sdk": "0.0.155",
|
|
30
|
+
"@1delta/lender-registry": "0.0.34",
|
|
31
31
|
"@1delta/providers": "0.0.62"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/lodash": "^4.17.23",
|
|
36
36
|
"tsup": "^8.5.1",
|
|
37
37
|
"typescript": "^5.9.3",
|
|
38
|
-
"@1delta/initializer-sdk": "0.0.
|
|
38
|
+
"@1delta/initializer-sdk": "0.0.18"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsup src/index.ts --format esm --clean && tsc -p tsconfig.dts.json",
|