@1delta/margin-fetcher 0.0.325 → 0.0.327

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.
@@ -1,4 +1,4 @@
1
- import type { MidnightBookSource, MidnightBookTop } from './types';
1
+ import type { MidnightBook, MidnightBookSource, MidnightBookTop } from './types';
2
2
  /** Default hosted Midnight API (see @morpho-org/midnight-sdk MidnightApi). */
3
3
  export declare const DEFAULT_MIDNIGHT_API = "https://api.morpho.org/v0/midnight";
4
4
  type FetchLike = typeof fetch;
@@ -14,6 +14,15 @@ export declare class ApiBookSource implements MidnightBookSource {
14
14
  private readonly fetchImpl;
15
15
  constructor(baseUrl: string, fetchImpl?: FetchLike);
16
16
  getBookTop(marketId: string): Promise<MidnightBookTop | null>;
17
+ /**
18
+ * Full ladder for a market — every level per side, best-first (unlike
19
+ * `getBookTop`, which collapses to the best level + aggregate depth). Same
20
+ * `GET {base}/books/{marketId}` fetch; empty levels are dropped and each side
21
+ * is sorted so the best executable offer is first (bids by tick ↓ = cheapest
22
+ * borrow, asks by tick ↑ = highest lend yield). The caller derives per-level
23
+ * APR (from tick + TTM) and applies count/size filters.
24
+ */
25
+ getBook(marketId: string): Promise<MidnightBook | null>;
17
26
  }
18
27
  /** Build the default (hosted-API) book source for a chain. */
19
28
  export declare function createMidnightBookSource(chainId: string, fetchImpl?: FetchLike): MidnightBookSource;
@@ -1 +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,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;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"}
1
+ {"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/apiClient.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAEhB,MAAM,SAAS,CAAA;AAEhB,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAOxE,KAAK,SAAS,GAAG,OAAO,KAAK,CAAA;AAE7B,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;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;IAmBnE;;;;;;;OAOG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CA0B9D;AAED,8DAA8D;AAC9D,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAAiB,GAC3B,kBAAkB,CAEpB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=apiClient.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiClient.test.d.ts","sourceRoot":"","sources":["../../../../src/lending/public-data/midnight/apiClient.test.ts"],"names":[],"mappings":""}
@@ -32,10 +32,27 @@ export interface MidnightBookTop {
32
32
  supplyDepthUnits: bigint;
33
33
  supplyDepthAssets: bigint;
34
34
  }
35
+ /**
36
+ * Full order-book ladder for a market — every executable price level per side,
37
+ * pre-sorted BEST-FIRST (unlike {@link MidnightBookTop}, which collapses to the
38
+ * single best level + aggregate depth). Empty levels are dropped.
39
+ */
40
+ export interface MidnightBook {
41
+ /** Bid levels — maker BUYs / lends, a taker consumes them to BORROW. Best borrow first (tick ↓). */
42
+ bids: MidnightBookLevel[];
43
+ /** Ask levels — maker SELLs / borrows, a taker consumes them to LEND. Best supply first (tick ↑). */
44
+ asks: MidnightBookLevel[];
45
+ }
35
46
  /** Pluggable Midnight order-book source — hosted API today, self-indexed mempool later. */
36
47
  export interface MidnightBookSource {
37
48
  /** Best-rate + depth snapshot for a market, or null when unavailable. */
38
49
  getBookTop(marketId: string): Promise<MidnightBookTop | null>;
50
+ /**
51
+ * Full best-first ladder for a market, or null when unavailable. Optional so
52
+ * lightweight stubs need only implement `getBookTop`; the hosted API source
53
+ * provides it for the live "all offers" endpoint.
54
+ */
55
+ getBook?(marketId: string): Promise<MidnightBook | null>;
39
56
  }
40
57
  /** A Midnight market paired with its current top-of-book (null when the book fetch failed). */
41
58
  export interface MidnightMarketRaw {
@@ -1 +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
+ {"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;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,oGAAoG;IACpG,IAAI,EAAE,iBAAiB,EAAE,CAAA;IACzB,qGAAqG;IACrG,IAAI,EAAE,iBAAiB,EAAE,CAAA;CAC1B;AAED,2FAA2F;AAC3F,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAA;IAC7D;;;;OAIG;IACH,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;CACzD;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,GAAG,EAAE,eAAe,GAAG,IAAI,CAAA;CAC5B"}
@@ -1,3 +1,10 @@
1
1
  import { YieldFetcher } from '../../types';
2
+ /**
3
+ * Angle savings (stUSD/USDA, stEUR/EURA) are deprecated. The APR exporter
4
+ * (`exporter.angle.money/v2/savingsApr`) now 404s, so there is no live
5
+ * source — the intrinsic yield is pinned to 0 rather than repeatedly
6
+ * fetching a dead endpoint (which previously returned an HTML 404 that the
7
+ * JSON parse choked on, leaving the value stale).
8
+ */
2
9
  export declare const angleFetcher: YieldFetcher;
3
10
  //# sourceMappingURL=angle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/angle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,eAAO,MAAM,YAAY,EAAE,YAa1B,CAAA"}
1
+ {"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/angle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK1C;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,YAM1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"etherfi.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/etherfi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAgBvD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,KAC9C,YAcD,CAAA;AAEF,eAAO,MAAM,aAAa,EAAE,YAM3B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,YAMzB,CAAA"}
1
+ {"version":3,"file":"etherfi.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/etherfi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAgBvD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,eAAe,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,KAC9C,YAcD,CAAA;AAEF,eAAO,MAAM,aAAa,EAAE,YAM3B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,YAUzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"solv.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/solv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAU1C,eAAO,MAAM,kBAAkB,EAAE,YAahC,CAAA"}
1
+ {"version":3,"file":"solv.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/solv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAU1C,eAAO,MAAM,kBAAkB,EAAE,YAchC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"stcelo.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/stcelo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAuG1C,eAAO,MAAM,aAAa,EAAE,YAM3B,CAAA"}
1
+ {"version":3,"file":"stcelo.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/stcelo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAuG1C,eAAO,MAAM,aAAa,EAAE,YAS3B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"stella.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/stella.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAwH1C,eAAO,MAAM,YAAY,EAAE,YAM1B,CAAA"}
1
+ {"version":3,"file":"stella.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/stella.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAwH1C,eAAO,MAAM,YAAY,EAAE,YAO1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"swBTC.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/swBTC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAoG1C,eAAO,MAAM,YAAY,EAAE,YAS1B,CAAA"}
1
+ {"version":3,"file":"swBTC.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/swBTC.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAoG1C,eAAO,MAAM,YAAY,EAAE,YAU1B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"theo.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/theo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAK1C,eAAO,MAAM,aAAa,EAAE,YAa3B,CAAA"}
1
+ {"version":3,"file":"theo.d.ts","sourceRoot":"","sources":["../../../../src/yields/intrinsic/fetchers/theo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAkB1C,eAAO,MAAM,aAAa,EAAE,YAM3B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1delta/margin-fetcher",
3
- "version": "0.0.325",
3
+ "version": "0.0.327",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -22,11 +22,11 @@
22
22
  "dependencies": {
23
23
  "async-retry": "^1.3.3",
24
24
  "lodash": "^4.17.23",
25
+ "@1delta/data-sdk": "0.0.31",
25
26
  "@1delta/abis": "0.0.23",
26
27
  "@1delta/dex-registry": "0.0.103",
27
- "@1delta/data-sdk": "0.0.31",
28
- "@1delta/lender-registry": "0.0.34",
29
28
  "@1delta/calldata-sdk": "0.0.157",
29
+ "@1delta/lender-registry": "0.0.34",
30
30
  "@1delta/providers": "0.0.62",
31
31
  "@1delta/proxy-fetch": "0.0.1"
32
32
  },