@1delta/data-sdk 0.0.29 → 0.0.30

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 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
@@ -595,6 +595,10 @@ export declare const aaveWethGateway: () => AaveWethGatewayType;
595
595
  export declare const morphoBundler3: () => MorphoBundler3Type;
596
596
  export declare const listaNativeProvider: () => ListaNativeProviderType;
597
597
  export declare const midnightConfig: () => MidnightConfigType;
598
+ export declare const setMidnightApiBase: (url: string | undefined | null) => void;
599
+ export declare const midnightApiBaseOverride: () => string | undefined;
600
+ /** Resolve the Midnight API base for a chain: override → config → hosted default. */
601
+ export declare const resolveMidnightApiBase: (chainId: string) => string;
598
602
  export declare const midnightMarkets: () => MidnightMarketsType;
599
603
  /** All Midnight market configs on a chain (empty array if none/unloaded). */
600
604
  export declare const midnightMarketsByChain: (chainId: string | number) => MidnightMarketConfig[];
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.29",
7
+ "version": "0.0.30",
8
8
  "description": "Hold and initialize lending protocol data across a stack",
9
9
  "files": [
10
10
  "dist"