@1delta/data-sdk 0.0.29 → 0.0.31
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/README.md +35 -0
- package/dist/index.js +14 -0
- package/dist/index.mjs +12 -1
- package/dist/lending.d.ts +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -519,6 +519,39 @@ const providers = listaNativeProvider()
|
|
|
519
519
|
|
|
520
520
|
---
|
|
521
521
|
|
|
522
|
+
### Morpho Midnight
|
|
523
|
+
|
|
524
|
+
Morpho Midnight is a Base-only, fixed-rate / fixed-maturity **order-book** protocol (offers are fetched from an HTTP API rather than read from a pool). It is a distinct `'midnight'` provider — **not** a Morpho Blue fork — so it has its own registry slots. Each maturity is its own isolated market, keyed by a bytes32 `marketId`.
|
|
525
|
+
|
|
526
|
+
#### `midnightConfig()`
|
|
527
|
+
|
|
528
|
+
Per-chain Midnight deployment (core/bundles/mempool/ratifier addresses + optional `apiBaseUrl`).
|
|
529
|
+
|
|
530
|
+
```ts
|
|
531
|
+
import { midnightConfig } from '@1delta/data-sdk'
|
|
532
|
+
|
|
533
|
+
const cfg = midnightConfig()
|
|
534
|
+
// { '8453': { midnight: '0x...', midnightBundles: '0x...', apiBaseUrl: '...' } }
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
#### `midnightMarkets()` / `midnightMarketsByChain(chainId)` / `midnightMarketById(chainId, marketId)`
|
|
538
|
+
|
|
539
|
+
The market set (one entry per maturity), plus convenience lookups.
|
|
540
|
+
|
|
541
|
+
```ts
|
|
542
|
+
import { midnightMarkets, midnightMarketsByChain, midnightMarketById } from '@1delta/data-sdk'
|
|
543
|
+
|
|
544
|
+
const all = midnightMarkets() // { [chainId]: MidnightMarketConfig[] }
|
|
545
|
+
const base = midnightMarketsByChain('8453') // MidnightMarketConfig[]
|
|
546
|
+
const market = midnightMarketById('8453', '0x...') // MidnightMarketConfig | undefined
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
#### `setMidnightApiBase(url)` / `midnightApiBaseOverride()` / `resolveMidnightApiBase(chainId)`
|
|
550
|
+
|
|
551
|
+
Runtime override for the Midnight HTTP API base (override → config `apiBaseUrl` → hosted default `https://api.morpho.org/v0/midnight`). A worker sets this per request (e.g. from an env var) so it survives the per-request metadata re-init that would otherwise clobber the config value — used for pointing at a local/dev offer API.
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
522
555
|
## Chain Data
|
|
523
556
|
|
|
524
557
|
#### `chains()`
|
|
@@ -656,3 +689,5 @@ All deployment data originates from the `1delta-DAO/lender-metadata` GitHub repo
|
|
|
656
689
|
| `data/compound-v3-base-data.json` | `compoundV3BaseData()` |
|
|
657
690
|
| `data/compound-v3-reserves.json` | `compoundV3Reserves()` |
|
|
658
691
|
| `data/euler-vaults.json` | `eulerVaults()` |
|
|
692
|
+
| `config/midnight.json` | `midnightConfig()` |
|
|
693
|
+
| `data/midnight-markets.json` | `midnightMarkets()` |
|
package/dist/index.js
CHANGED
|
@@ -203,6 +203,17 @@ var aaveWethGateway = () => getGlobalData2()?.aaveWethGateway;
|
|
|
203
203
|
var morphoBundler3 = () => getGlobalData2()?.morphoBundler3;
|
|
204
204
|
var listaNativeProvider = () => getGlobalData2()?.listaNativeProvider;
|
|
205
205
|
var midnightConfig = () => getGlobalData2()?.midnightConfig;
|
|
206
|
+
var MIDNIGHT_API_OVERRIDE_KEY = "__1delta_midnight_api_base__";
|
|
207
|
+
var setMidnightApiBase = (url) => {
|
|
208
|
+
globalThis[MIDNIGHT_API_OVERRIDE_KEY] = url && url.length > 0 ? url : void 0;
|
|
209
|
+
};
|
|
210
|
+
var midnightApiBaseOverride = () => globalThis[MIDNIGHT_API_OVERRIDE_KEY];
|
|
211
|
+
var resolveMidnightApiBase = (chainId) => {
|
|
212
|
+
const override = midnightApiBaseOverride();
|
|
213
|
+
if (override) return override.replace(/\/+$/, "");
|
|
214
|
+
const cfg = midnightConfig()?.[chainId]?.apiBaseUrl;
|
|
215
|
+
return (cfg && cfg.length > 0 ? cfg : "https://api.morpho.org/v0/midnight").replace(/\/+$/, "");
|
|
216
|
+
};
|
|
206
217
|
var midnightMarkets = () => getGlobalData2()?.midnightMarkets;
|
|
207
218
|
var midnightMarketsByChain = (chainId) => getGlobalData2()?.midnightMarkets?.[String(chainId)] ?? [];
|
|
208
219
|
var midnightMarketById = (chainId, marketId) => {
|
|
@@ -418,6 +429,7 @@ exports.initConfig = initConfig;
|
|
|
418
429
|
exports.initializeChainData = initializeChainData;
|
|
419
430
|
exports.initializeLenderData = initializeLenderData;
|
|
420
431
|
exports.listaNativeProvider = listaNativeProvider;
|
|
432
|
+
exports.midnightApiBaseOverride = midnightApiBaseOverride;
|
|
421
433
|
exports.midnightConfig = midnightConfig;
|
|
422
434
|
exports.midnightMarketById = midnightMarketById;
|
|
423
435
|
exports.midnightMarkets = midnightMarkets;
|
|
@@ -432,6 +444,8 @@ exports.parseAaveV4SpokeLenderKey = parseAaveV4SpokeLenderKey;
|
|
|
432
444
|
exports.parseGearboxV3LenderKey = parseGearboxV3LenderKey;
|
|
433
445
|
exports.parseSiloV2LenderKey = parseSiloV2LenderKey;
|
|
434
446
|
exports.parseSiloV3LenderKey = parseSiloV3LenderKey;
|
|
447
|
+
exports.resolveMidnightApiBase = resolveMidnightApiBase;
|
|
448
|
+
exports.setMidnightApiBase = setMidnightApiBase;
|
|
435
449
|
exports.siloMarkets = siloMarkets;
|
|
436
450
|
exports.siloMarketsV3 = siloMarketsV3;
|
|
437
451
|
exports.siloPeripherals = siloPeripherals;
|
package/dist/index.mjs
CHANGED
|
@@ -201,6 +201,17 @@ var aaveWethGateway = () => getGlobalData2()?.aaveWethGateway;
|
|
|
201
201
|
var morphoBundler3 = () => getGlobalData2()?.morphoBundler3;
|
|
202
202
|
var listaNativeProvider = () => getGlobalData2()?.listaNativeProvider;
|
|
203
203
|
var midnightConfig = () => getGlobalData2()?.midnightConfig;
|
|
204
|
+
var MIDNIGHT_API_OVERRIDE_KEY = "__1delta_midnight_api_base__";
|
|
205
|
+
var setMidnightApiBase = (url) => {
|
|
206
|
+
globalThis[MIDNIGHT_API_OVERRIDE_KEY] = url && url.length > 0 ? url : void 0;
|
|
207
|
+
};
|
|
208
|
+
var midnightApiBaseOverride = () => globalThis[MIDNIGHT_API_OVERRIDE_KEY];
|
|
209
|
+
var resolveMidnightApiBase = (chainId) => {
|
|
210
|
+
const override = midnightApiBaseOverride();
|
|
211
|
+
if (override) return override.replace(/\/+$/, "");
|
|
212
|
+
const cfg = midnightConfig()?.[chainId]?.apiBaseUrl;
|
|
213
|
+
return (cfg && cfg.length > 0 ? cfg : "https://api.morpho.org/v0/midnight").replace(/\/+$/, "");
|
|
214
|
+
};
|
|
204
215
|
var midnightMarkets = () => getGlobalData2()?.midnightMarkets;
|
|
205
216
|
var midnightMarketsByChain = (chainId) => getGlobalData2()?.midnightMarkets?.[String(chainId)] ?? [];
|
|
206
217
|
var midnightMarketById = (chainId, marketId) => {
|
|
@@ -360,4 +371,4 @@ async function fetchTokenLists(chainIds) {
|
|
|
360
371
|
return Object.fromEntries(results);
|
|
361
372
|
}
|
|
362
373
|
|
|
363
|
-
export { GEARBOX_ACCOUNT_COMPRESSOR_V310, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chainLogoURI, chains, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, eulerConfigs, eulerVaults, fetchTokenList, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, gearboxAccountCompressor, gearboxAddressProviderV310, gearboxBotListV3, gearboxChains, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxResolvers, gearboxV3LenderKey, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, listaNativeProvider, midnightConfig, midnightMarketById, midnightMarkets, midnightMarketsByChain, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseGearboxV3LenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey };
|
|
374
|
+
export { GEARBOX_ACCOUNT_COMPRESSOR_V310, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chainLogoURI, chains, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, eulerConfigs, eulerVaults, fetchTokenList, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, gearboxAccountCompressor, gearboxAddressProviderV310, gearboxBotListV3, gearboxChains, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxResolvers, gearboxV3LenderKey, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, listaNativeProvider, midnightApiBaseOverride, midnightConfig, midnightMarketById, midnightMarkets, midnightMarketsByChain, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseGearboxV3LenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, resolveMidnightApiBase, setMidnightApiBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey };
|
package/dist/lending.d.ts
CHANGED
|
@@ -107,6 +107,21 @@ export type MidnightMarketConfig = {
|
|
|
107
107
|
rcfThreshold: string;
|
|
108
108
|
enterGate: string;
|
|
109
109
|
liquidatorGate: string;
|
|
110
|
+
/**
|
|
111
|
+
* Mutable per-market settlement fees, one per TTM breakpoint index
|
|
112
|
+
* [0d,1d,7d,30d,90d,180d,360d], in cbp (centi-basis-points; fraction =
|
|
113
|
+
* cbp·1e-6). Governance-settable (`feeSetter`), so it is NOT part of the
|
|
114
|
+
* immutable market id and is snapshotted on-chain each metadata refresh.
|
|
115
|
+
* Absent when the on-chain read was unavailable.
|
|
116
|
+
*/
|
|
117
|
+
settlementFeeCbp?: number[];
|
|
118
|
+
/**
|
|
119
|
+
* Mutable per-market continuous fee (uint32), a per-second WAD rate borne by
|
|
120
|
+
* lenders (annual fraction = continuousFee·secondsPerYear/1e18, capped 1%/yr).
|
|
121
|
+
* Governance-settable; snapshotted on-chain like `settlementFeeCbp`. Stored
|
|
122
|
+
* as a decimal string. Absent when the on-chain read was unavailable.
|
|
123
|
+
*/
|
|
124
|
+
continuousFee?: string;
|
|
110
125
|
/** Optional display label, e.g. "USDC / WETH — 2026-09-18". */
|
|
111
126
|
name?: string;
|
|
112
127
|
};
|
|
@@ -595,6 +610,10 @@ export declare const aaveWethGateway: () => AaveWethGatewayType;
|
|
|
595
610
|
export declare const morphoBundler3: () => MorphoBundler3Type;
|
|
596
611
|
export declare const listaNativeProvider: () => ListaNativeProviderType;
|
|
597
612
|
export declare const midnightConfig: () => MidnightConfigType;
|
|
613
|
+
export declare const setMidnightApiBase: (url: string | undefined | null) => void;
|
|
614
|
+
export declare const midnightApiBaseOverride: () => string | undefined;
|
|
615
|
+
/** Resolve the Midnight API base for a chain: override → config → hosted default. */
|
|
616
|
+
export declare const resolveMidnightApiBase: (chainId: string) => string;
|
|
598
617
|
export declare const midnightMarkets: () => MidnightMarketsType;
|
|
599
618
|
/** All Midnight market configs on a chain (empty array if none/unloaded). */
|
|
600
619
|
export declare const midnightMarketsByChain: (chainId: string | number) => MidnightMarketConfig[];
|