@1delta/data-sdk 0.0.50 → 0.0.52

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
@@ -77,6 +77,8 @@ var LENDER_DATA_DEFAULTS = () => ({
77
77
  termMaxConfig: {},
78
78
  exactlyConfig: {},
79
79
  exactlyMarkets: {},
80
+ flyingTulipConfig: {},
81
+ flyingTulipAssets: {},
80
82
  tellerConfig: {},
81
83
  tellerPools: {},
82
84
  liquityConfig: {},
@@ -340,6 +342,24 @@ var isListaSmartLpAsset = (entry, asset) => {
340
342
  );
341
343
  };
342
344
 
345
+ // src/lending/flyingTulip.ts
346
+ var flyingTulipConfig = () => getGlobalData2()?.flyingTulipConfig;
347
+ var flyingTulipAssets = () => getGlobalData2()?.flyingTulipAssets;
348
+ var flyingTulipConfigFor = (lender, chainId) => getGlobalData2()?.flyingTulipConfig?.[lender]?.[String(chainId)];
349
+ var flyingTulipAssetsFor = (lender, chainId) => getGlobalData2()?.flyingTulipAssets?.[lender]?.[String(chainId)];
350
+ var flyingTulipLendersByChain = (chainId) => {
351
+ const chain = String(chainId);
352
+ const cfg = getGlobalData2()?.flyingTulipConfig ?? {};
353
+ const rosters = getGlobalData2()?.flyingTulipAssets ?? {};
354
+ const keys = [];
355
+ for (const lender of Object.keys(cfg)) {
356
+ if (cfg[lender]?.[chain]?.lendingLens && (rosters[lender]?.[chain]?.assets?.length ?? 0) > 0) {
357
+ keys.push(lender);
358
+ }
359
+ }
360
+ return keys;
361
+ };
362
+
343
363
  // src/lending/midnight.ts
344
364
  var midnightConfig = () => getGlobalData2()?.midnightConfig;
345
365
  var MIDNIGHT_API_OVERRIDE_KEY = "__1delta_midnight_api_base__";
@@ -373,6 +393,17 @@ var resolveTermApiBase = (chainId) => {
373
393
  const cfg = termConfig()?.[chainId]?.apiBaseUrl;
374
394
  return (cfg && cfg.length > 0 ? cfg : "").replace(/\/+$/, "");
375
395
  };
396
+ var TERM_ORDER_STORE_OVERRIDE_KEY = "__1delta_term_order_store_base__";
397
+ var setTermOrderStoreBase = (url) => {
398
+ globalThis[TERM_ORDER_STORE_OVERRIDE_KEY] = url && url.length > 0 ? url : void 0;
399
+ };
400
+ var termOrderStoreBaseOverride = () => globalThis[TERM_ORDER_STORE_OVERRIDE_KEY];
401
+ var resolveTermOrderStoreBase = (chainId) => {
402
+ const override = termOrderStoreBaseOverride();
403
+ if (override) return override.replace(/\/+$/, "");
404
+ const cfg = termConfig()?.[chainId]?.orderStoreUrl;
405
+ return (cfg && cfg.length > 0 ? cfg : "").replace(/\/+$/, "");
406
+ };
376
407
  var termMarkets = () => getGlobalData2()?.termMarkets;
377
408
  var termMarketsByChain = (chainId) => getGlobalData2()?.termMarkets?.[String(chainId)] ?? [];
378
409
  var termMarketById = (chainId, termRepoId) => {
@@ -955,12 +986,15 @@ var parseFraxlendPairKey = (lender) => {
955
986
 
956
987
  // src/remoteCache.ts
957
988
  var FRESH_TTL_MS = 5 * 60 * 1e3;
989
+ var STALE_WHILE_REVALIDATE_MS = 12 * 60 * 60 * 1e3;
958
990
  var REMOTE_CACHE_STORE_TTL_S = 7 * 24 * 60 * 60;
959
991
  var STATE_KEY = "__1delta_remote_cache__";
960
992
  function getState() {
961
993
  const g = globalThis;
962
- if (!g[STATE_KEY]) g[STATE_KEY] = { memo: /* @__PURE__ */ new Map(), inflight: /* @__PURE__ */ new Map() };
963
- return g[STATE_KEY];
994
+ if (!g[STATE_KEY]) g[STATE_KEY] = { memo: /* @__PURE__ */ new Map(), inflight: /* @__PURE__ */ new Map(), revalidating: /* @__PURE__ */ new Set() };
995
+ const state = g[STATE_KEY];
996
+ if (!state.revalidating) state.revalidating = /* @__PURE__ */ new Set();
997
+ return state;
964
998
  }
965
999
  function setRemoteCacheStore(next) {
966
1000
  getState().store = next;
@@ -1038,7 +1072,7 @@ async function writeStore(key, entry) {
1038
1072
  }
1039
1073
  }
1040
1074
  async function loadCached(key, load, isValid) {
1041
- const { memo, inflight } = getState();
1075
+ const { memo, inflight, revalidating } = getState();
1042
1076
  const cached = memo.get(key);
1043
1077
  if (cached && Date.now() - cached.at < FRESH_TTL_MS) return cached.value;
1044
1078
  const pending = inflight.get(key);
@@ -1049,6 +1083,24 @@ async function loadCached(key, load, isValid) {
1049
1083
  memo.set(key, stored);
1050
1084
  return stored.value;
1051
1085
  }
1086
+ if (stored && Date.now() - stored.at < STALE_WHILE_REVALIDATE_MS) {
1087
+ memo.set(key, stored);
1088
+ if (revalidating.has(key)) return stored.value;
1089
+ revalidating.add(key);
1090
+ void (async () => {
1091
+ try {
1092
+ const value = await load();
1093
+ const entry = { at: Date.now(), value };
1094
+ const current = memo.get(key);
1095
+ if (!current || current.at <= entry.at) memo.set(key, entry);
1096
+ await writeStore(key, entry);
1097
+ } catch {
1098
+ } finally {
1099
+ revalidating.delete(key);
1100
+ }
1101
+ })();
1102
+ return stored.value;
1103
+ }
1052
1104
  try {
1053
1105
  const value = await load();
1054
1106
  const entry = { at: Date.now(), value };
@@ -1181,6 +1233,11 @@ exports.fluidChains = fluidChains;
1181
1233
  exports.fluidResolvers = fluidResolvers;
1182
1234
  exports.fluidVaultEntries = fluidVaultEntries;
1183
1235
  exports.fluidVaults = fluidVaults;
1236
+ exports.flyingTulipAssets = flyingTulipAssets;
1237
+ exports.flyingTulipAssetsFor = flyingTulipAssetsFor;
1238
+ exports.flyingTulipConfig = flyingTulipConfig;
1239
+ exports.flyingTulipConfigFor = flyingTulipConfigFor;
1240
+ exports.flyingTulipLendersByChain = flyingTulipLendersByChain;
1184
1241
  exports.frankencoinChainData = frankencoinChainData;
1185
1242
  exports.frankencoinConfig = frankencoinConfig;
1186
1243
  exports.frankencoinConfigFor = frankencoinConfigFor;
@@ -1264,6 +1321,7 @@ exports.parseSiloV3LenderKey = parseSiloV3LenderKey;
1264
1321
  exports.parseTermMaxLenderKey = parseTermMaxLenderKey;
1265
1322
  exports.resolveMidnightApiBase = resolveMidnightApiBase;
1266
1323
  exports.resolveTermApiBase = resolveTermApiBase;
1324
+ exports.resolveTermOrderStoreBase = resolveTermOrderStoreBase;
1267
1325
  exports.resupplyConfig = resupplyConfig;
1268
1326
  exports.resupplyConfigFor = resupplyConfigFor;
1269
1327
  exports.resupplyLendersByChain = resupplyLendersByChain;
@@ -1277,6 +1335,7 @@ exports.setMidnightApiBase = setMidnightApiBase;
1277
1335
  exports.setRemoteCacheGithubToken = setRemoteCacheGithubToken;
1278
1336
  exports.setRemoteCacheStore = setRemoteCacheStore;
1279
1337
  exports.setTermApiBase = setTermApiBase;
1338
+ exports.setTermOrderStoreBase = setTermOrderStoreBase;
1280
1339
  exports.siloMarkets = siloMarkets;
1281
1340
  exports.siloMarketsV3 = siloMarketsV3;
1282
1341
  exports.siloPeripherals = siloPeripherals;
@@ -1303,6 +1362,7 @@ exports.termMaxChainIds = termMaxChainIds;
1303
1362
  exports.termMaxConfig = termMaxConfig;
1304
1363
  exports.termMaxConfigByChain = termMaxConfigByChain;
1305
1364
  exports.termMaxLenderKey = termMaxLenderKey;
1365
+ exports.termOrderStoreBaseOverride = termOrderStoreBaseOverride;
1306
1366
  exports.twyneBaseKey = twyneBaseKey;
1307
1367
  exports.twyneBeaconFor = twyneBeaconFor;
1308
1368
  exports.twyneChainData = twyneChainData;
package/dist/index.mjs CHANGED
@@ -75,6 +75,8 @@ var LENDER_DATA_DEFAULTS = () => ({
75
75
  termMaxConfig: {},
76
76
  exactlyConfig: {},
77
77
  exactlyMarkets: {},
78
+ flyingTulipConfig: {},
79
+ flyingTulipAssets: {},
78
80
  tellerConfig: {},
79
81
  tellerPools: {},
80
82
  liquityConfig: {},
@@ -338,6 +340,24 @@ var isListaSmartLpAsset = (entry, asset) => {
338
340
  );
339
341
  };
340
342
 
343
+ // src/lending/flyingTulip.ts
344
+ var flyingTulipConfig = () => getGlobalData2()?.flyingTulipConfig;
345
+ var flyingTulipAssets = () => getGlobalData2()?.flyingTulipAssets;
346
+ var flyingTulipConfigFor = (lender, chainId) => getGlobalData2()?.flyingTulipConfig?.[lender]?.[String(chainId)];
347
+ var flyingTulipAssetsFor = (lender, chainId) => getGlobalData2()?.flyingTulipAssets?.[lender]?.[String(chainId)];
348
+ var flyingTulipLendersByChain = (chainId) => {
349
+ const chain = String(chainId);
350
+ const cfg = getGlobalData2()?.flyingTulipConfig ?? {};
351
+ const rosters = getGlobalData2()?.flyingTulipAssets ?? {};
352
+ const keys = [];
353
+ for (const lender of Object.keys(cfg)) {
354
+ if (cfg[lender]?.[chain]?.lendingLens && (rosters[lender]?.[chain]?.assets?.length ?? 0) > 0) {
355
+ keys.push(lender);
356
+ }
357
+ }
358
+ return keys;
359
+ };
360
+
341
361
  // src/lending/midnight.ts
342
362
  var midnightConfig = () => getGlobalData2()?.midnightConfig;
343
363
  var MIDNIGHT_API_OVERRIDE_KEY = "__1delta_midnight_api_base__";
@@ -371,6 +391,17 @@ var resolveTermApiBase = (chainId) => {
371
391
  const cfg = termConfig()?.[chainId]?.apiBaseUrl;
372
392
  return (cfg && cfg.length > 0 ? cfg : "").replace(/\/+$/, "");
373
393
  };
394
+ var TERM_ORDER_STORE_OVERRIDE_KEY = "__1delta_term_order_store_base__";
395
+ var setTermOrderStoreBase = (url) => {
396
+ globalThis[TERM_ORDER_STORE_OVERRIDE_KEY] = url && url.length > 0 ? url : void 0;
397
+ };
398
+ var termOrderStoreBaseOverride = () => globalThis[TERM_ORDER_STORE_OVERRIDE_KEY];
399
+ var resolveTermOrderStoreBase = (chainId) => {
400
+ const override = termOrderStoreBaseOverride();
401
+ if (override) return override.replace(/\/+$/, "");
402
+ const cfg = termConfig()?.[chainId]?.orderStoreUrl;
403
+ return (cfg && cfg.length > 0 ? cfg : "").replace(/\/+$/, "");
404
+ };
374
405
  var termMarkets = () => getGlobalData2()?.termMarkets;
375
406
  var termMarketsByChain = (chainId) => getGlobalData2()?.termMarkets?.[String(chainId)] ?? [];
376
407
  var termMarketById = (chainId, termRepoId) => {
@@ -953,12 +984,15 @@ var parseFraxlendPairKey = (lender) => {
953
984
 
954
985
  // src/remoteCache.ts
955
986
  var FRESH_TTL_MS = 5 * 60 * 1e3;
987
+ var STALE_WHILE_REVALIDATE_MS = 12 * 60 * 60 * 1e3;
956
988
  var REMOTE_CACHE_STORE_TTL_S = 7 * 24 * 60 * 60;
957
989
  var STATE_KEY = "__1delta_remote_cache__";
958
990
  function getState() {
959
991
  const g = globalThis;
960
- if (!g[STATE_KEY]) g[STATE_KEY] = { memo: /* @__PURE__ */ new Map(), inflight: /* @__PURE__ */ new Map() };
961
- return g[STATE_KEY];
992
+ if (!g[STATE_KEY]) g[STATE_KEY] = { memo: /* @__PURE__ */ new Map(), inflight: /* @__PURE__ */ new Map(), revalidating: /* @__PURE__ */ new Set() };
993
+ const state = g[STATE_KEY];
994
+ if (!state.revalidating) state.revalidating = /* @__PURE__ */ new Set();
995
+ return state;
962
996
  }
963
997
  function setRemoteCacheStore(next) {
964
998
  getState().store = next;
@@ -1036,7 +1070,7 @@ async function writeStore(key, entry) {
1036
1070
  }
1037
1071
  }
1038
1072
  async function loadCached(key, load, isValid) {
1039
- const { memo, inflight } = getState();
1073
+ const { memo, inflight, revalidating } = getState();
1040
1074
  const cached = memo.get(key);
1041
1075
  if (cached && Date.now() - cached.at < FRESH_TTL_MS) return cached.value;
1042
1076
  const pending = inflight.get(key);
@@ -1047,6 +1081,24 @@ async function loadCached(key, load, isValid) {
1047
1081
  memo.set(key, stored);
1048
1082
  return stored.value;
1049
1083
  }
1084
+ if (stored && Date.now() - stored.at < STALE_WHILE_REVALIDATE_MS) {
1085
+ memo.set(key, stored);
1086
+ if (revalidating.has(key)) return stored.value;
1087
+ revalidating.add(key);
1088
+ void (async () => {
1089
+ try {
1090
+ const value = await load();
1091
+ const entry = { at: Date.now(), value };
1092
+ const current = memo.get(key);
1093
+ if (!current || current.at <= entry.at) memo.set(key, entry);
1094
+ await writeStore(key, entry);
1095
+ } catch {
1096
+ } finally {
1097
+ revalidating.delete(key);
1098
+ }
1099
+ })();
1100
+ return stored.value;
1101
+ }
1050
1102
  try {
1051
1103
  const value = await load();
1052
1104
  const entry = { at: Date.now(), value };
@@ -1113,4 +1165,4 @@ async function fetchMainTokensMap() {
1113
1165
  }
1114
1166
  }
1115
1167
 
1116
- export { COOLER_ETHEREUM_CONFIG, CURVANCE_MONAD_CONFIG, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, REMOTE_CACHE_STORE_TTL_S, RESUPPLY_ETHEREUM_CONFIG, RemoteFetchError, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, assertTwyneKeysUnique, chainLogoURI, chains, clearRemoteCache, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, coolerConfig, coolerConfigFor, coolerLendersByChain, curvanceConfig, curvanceConfigFor, curvanceLendersByChain, curvancePositionManager, curvancePositionManagersFor, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, dssChainData, dssConfigFor, dssDebtJoin, dssDebtToken, dssMarketByIlk, eulerConfigs, eulerVaults, exactlyConfig, exactlyMarketByAddress, exactlyMarketByAsset, exactlyMarkets, exactlyMarketsByChain, fetchMainTokensMap, fetchRemoteJson, fetchTokenList, fetchTokenListFile, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, frankencoinChainData, frankencoinConfig, frankencoinConfigFor, frankencoinLendersByChain, frankencoinMarketByPosition, frankencoinMarkets, fraxlendConfig, fraxlendConfigFor, fraxlendLendersByChain, fraxlendPairKey, fraxlendPairsFor, gearboxAccountCompressor, gearboxAddressProviderV310, gearboxBotListV3, gearboxChains, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxResolvers, gearboxV3LenderKey, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeAccess, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, inverseChainData, inverseConfig, inverseConfigFor, inverseLendersByChain, inverseMarketByAddress, inverseMarkets, isAaveV4OperationRestricted, isListaSmartLpAsset, liquityBranchByIndex, liquityBranchByTroveManager, liquityBranchesByChain, liquityConfig, liquityConfigFor, liquityLendersByChain, liquityMarkets, listaCollateralProvider, listaCollateralProviders, listaNativeProvider, listaSmartLpByCollateral, llamaLendApiBaseUrl, llamaLendChainData, llamaLendConfig, llamaLendConfigFor, llamaLendLenderKey, llamaLendLendersByChain, llamaLendLeverageZap, llamaLendMarketByController, llamaLendMarketByVault, llamaLendMarkets, llamaLendSupportsDelegation, llamaLendSupportsLeverage, loadCached, loadCachedJson, midnightApiBaseOverride, midnightConfig, midnightMarketById, midnightMarkets, midnightMarketsByChain, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, resolveMidnightApiBase, resolveTermApiBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setRemoteCacheGithubToken, setRemoteCacheStore, setTermApiBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey, skyChainData, skyConfig, skyConfigFor, skyLendersByChain, skyMarkets, tellerConfig, tellerConfigByChain, tellerPoolByAddress, tellerPools, tellerPoolsByChain, termApiBaseOverride, termConfig, termMarketById, termMarkets, termMarketsByChain, termMaxApiBaseUrl, termMaxChainIds, termMaxConfig, termMaxConfigByChain, termMaxLenderKey, twyneBaseKey, twyneBeaconFor, twyneChainData, twyneConfig, twyneConfigFor, twyneLendersByChain, twyneMarketByKey, twyneMarketFor, twyneMarketKey, twyneMarkets, twyneMarketsForIntermediateVault, twyneOperator, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
1168
+ export { COOLER_ETHEREUM_CONFIG, CURVANCE_MONAD_CONFIG, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, REMOTE_CACHE_STORE_TTL_S, RESUPPLY_ETHEREUM_CONFIG, RemoteFetchError, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, assertTwyneKeysUnique, chainLogoURI, chains, clearRemoteCache, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, coolerConfig, coolerConfigFor, coolerLendersByChain, curvanceConfig, curvanceConfigFor, curvanceLendersByChain, curvancePositionManager, curvancePositionManagersFor, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, dssChainData, dssConfigFor, dssDebtJoin, dssDebtToken, dssMarketByIlk, eulerConfigs, eulerVaults, exactlyConfig, exactlyMarketByAddress, exactlyMarketByAsset, exactlyMarkets, exactlyMarketsByChain, fetchMainTokensMap, fetchRemoteJson, fetchTokenList, fetchTokenListFile, fetchTokenLists, findAaveV4PositionManager, fluidChains, fluidResolvers, fluidVaultEntries, fluidVaults, flyingTulipAssets, flyingTulipAssetsFor, flyingTulipConfig, flyingTulipConfigFor, flyingTulipLendersByChain, frankencoinChainData, frankencoinConfig, frankencoinConfigFor, frankencoinLendersByChain, frankencoinMarketByPosition, frankencoinMarkets, fraxlendConfig, fraxlendConfigFor, fraxlendLendersByChain, fraxlendPairKey, fraxlendPairsFor, gearboxAccountCompressor, gearboxAddressProviderV310, gearboxBotListV3, gearboxChains, gearboxMarketCompressor, gearboxMarketConfigurators, gearboxResolvers, gearboxV3LenderKey, getAaveV4GatewayAddresses, getAaveV4PositionManagers, getAaveV4SpokeAccess, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, inverseChainData, inverseConfig, inverseConfigFor, inverseLendersByChain, inverseMarketByAddress, inverseMarkets, isAaveV4OperationRestricted, isListaSmartLpAsset, liquityBranchByIndex, liquityBranchByTroveManager, liquityBranchesByChain, liquityConfig, liquityConfigFor, liquityLendersByChain, liquityMarkets, listaCollateralProvider, listaCollateralProviders, listaNativeProvider, listaSmartLpByCollateral, llamaLendApiBaseUrl, llamaLendChainData, llamaLendConfig, llamaLendConfigFor, llamaLendLenderKey, llamaLendLendersByChain, llamaLendLeverageZap, llamaLendMarketByController, llamaLendMarketByVault, llamaLendMarkets, llamaLendSupportsDelegation, llamaLendSupportsLeverage, loadCached, loadCachedJson, midnightApiBaseOverride, midnightConfig, midnightMarketById, midnightMarkets, midnightMarketsByChain, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, resolveMidnightApiBase, resolveTermApiBase, resolveTermOrderStoreBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setRemoteCacheGithubToken, setRemoteCacheStore, setTermApiBase, setTermOrderStoreBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey, skyChainData, skyConfig, skyConfigFor, skyLendersByChain, skyMarkets, tellerConfig, tellerConfigByChain, tellerPoolByAddress, tellerPools, tellerPoolsByChain, termApiBaseOverride, termConfig, termMarketById, termMarkets, termMarketsByChain, termMaxApiBaseUrl, termMaxChainIds, termMaxConfig, termMaxConfigByChain, termMaxLenderKey, termOrderStoreBaseOverride, twyneBaseKey, twyneBeaconFor, twyneChainData, twyneConfig, twyneConfigFor, twyneLendersByChain, twyneMarketByKey, twyneMarketFor, twyneMarketKey, twyneMarkets, twyneMarketsForIntermediateVault, twyneOperator, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Flying Tulip — Andre Cronje's CEX-style CROSS-MARGIN lender on Ethereum (1)
3
+ * and Sonic (146). One `PositionsManager` per chain holds every asset and
4
+ * health is one global check, so `FLYING_TULIP` is both the dispatch key and
5
+ * the market key (the collapsed Exactly shape — see FLYING_TULIP.md).
6
+ *
7
+ * Two published files, both prerequisites (no built-in seed — the risk knobs
8
+ * are one ungated Safe call from moving and the two chains already disagree,
9
+ * so pinning them here is how a stale number outlives a live change):
10
+ * - `config/flying-tulip.json` — per-chain protocol addresses (CREATE2, so
11
+ * address-identical across chains — but NEVER config-identical).
12
+ * - `data/flying-tulip-assets.json` — the `AssetSet`-log-discovered roster
13
+ * plus the per-chain margin knobs, regenerated by lender-metadata's
14
+ * `update:flying-tulip`.
15
+ */
16
+ export interface FlyingTulipConfigChain {
17
+ /** The one position book per chain — every deposit/borrow write target. */
18
+ positionsManager: string;
19
+ /** LendingLens — the whole public read surface (state, cfg, caps, prices). */
20
+ lendingLens: string;
21
+ /** ConfigRegistry (UNVERIFIED impl) — mmBps, caps, pauses, both HF gates. */
22
+ configRegistry: string;
23
+ /** AccountValuesLens — equity/maint/HF incl. `enginePnLUSDWad`. */
24
+ accountValuesLens: string;
25
+ /** OracleRouter behind the lens's `priceAndDecimals`. */
26
+ oracleRouter: string;
27
+ /** FT token — `collateral: false, mmBps: 0`, unpriceable on-protocol. */
28
+ ft: string;
29
+ /** ftUSD. */
30
+ ftUSD: string;
31
+ /** Registered engines (RFQ / meta-tx); informational for public data. */
32
+ engines?: {
33
+ [name: string]: string;
34
+ };
35
+ }
36
+ export type FlyingTulipConfigType = {
37
+ [lender: string]: {
38
+ [chainId: string]: FlyingTulipConfigChain;
39
+ };
40
+ };
41
+ /** One roster row: the log-discovered listing + a config snapshot. Values are
42
+ * a SNAPSHOT for display/fallback — fetchers read the live `assetCfg`. */
43
+ export interface FlyingTulipAssetRow {
44
+ address: string;
45
+ symbol: string;
46
+ name: string;
47
+ decimals: number;
48
+ irm: string;
49
+ mmBps: number;
50
+ enabled: boolean;
51
+ borrowable: boolean;
52
+ collateral: boolean;
53
+ supplyCap: string;
54
+ borrowCap: string;
55
+ depositPaused: boolean;
56
+ withdrawPaused: boolean;
57
+ borrowPaused: boolean;
58
+ /** false ⇒ the protocol oracle reverts for it (FT itself). NEVER batch an
59
+ * unpriceable asset into `pricesUSD` — the lens loops without a per-item
60
+ * catch, so one bad asset poisons the whole call. */
61
+ priceable: boolean;
62
+ }
63
+ export interface FlyingTulipAssetsChain {
64
+ /** Open gate: new borrows/withdrawals must leave HF ≥ this (1e4). */
65
+ marginHfSafeBps: number;
66
+ /** Liquidation trigger: HF < this (1e4) — 12500, NOT 10000. */
67
+ marginHfTargetBps: number;
68
+ /** Minimum account equity while any debt exists — PER CHAIN (wad). */
69
+ marginMinEquityUSDWad: string;
70
+ oracleRouter: string;
71
+ assets: FlyingTulipAssetRow[];
72
+ }
73
+ export type FlyingTulipAssetsType = {
74
+ [lender: string]: {
75
+ [chainId: string]: FlyingTulipAssetsChain;
76
+ };
77
+ };
78
+ export declare const flyingTulipConfig: () => FlyingTulipConfigType;
79
+ export declare const flyingTulipAssets: () => FlyingTulipAssetsType;
80
+ /** Deployment config for a Flying Tulip lender key on a chain. */
81
+ export declare const flyingTulipConfigFor: (lender: string, chainId: string | number) => FlyingTulipConfigChain | undefined;
82
+ /** Roster + margin knobs for a Flying Tulip lender key on a chain. */
83
+ export declare const flyingTulipAssetsFor: (lender: string, chainId: string | number) => FlyingTulipAssetsChain | undefined;
84
+ /**
85
+ * All Flying Tulip lender keys with a working deployment on a chain (drives
86
+ * `getLendersForChain`). Gated on BOTH published files: the lens address is
87
+ * what every read bootstraps from, and an empty roster means nothing to fetch
88
+ * — either absent must mean the lender is dark on that chain, never a key
89
+ * that fans out into zero-asset entries.
90
+ */
91
+ export declare const flyingTulipLendersByChain: (chainId: string | number) => string[];
@@ -24,6 +24,7 @@ export * from './gearbox';
24
24
  export * from './dolomite';
25
25
  export * from './initProtocol';
26
26
  export * from './lista';
27
+ export * from './flyingTulip';
27
28
  export * from './midnight';
28
29
  export * from './term';
29
30
  export * from './termMax';
@@ -31,6 +31,7 @@ import type { UsddConfigType, UsddMarketsType } from './dss';
31
31
  import type { EulerConfigsType, EulerVaultsType } from './euler';
32
32
  import type { ExactlyConfigType, ExactlyMarketsType } from './exactly';
33
33
  import type { FluidResolversType, FluidVaultsType } from './fluid';
34
+ import type { FlyingTulipAssetsType, FlyingTulipConfigType } from './flyingTulip';
34
35
  import type { FrankencoinConfigType, FrankencoinMarketsType } from './frankencoin';
35
36
  import type { GearboxResolversType } from './gearbox';
36
37
  import type { InitConfigType } from './initProtocol';
@@ -89,6 +90,8 @@ export interface GlobalLenderDataRegistry {
89
90
  termMaxConfig: TermMaxConfigType;
90
91
  exactlyConfig: ExactlyConfigType;
91
92
  exactlyMarkets: ExactlyMarketsType;
93
+ flyingTulipConfig: FlyingTulipConfigType;
94
+ flyingTulipAssets: FlyingTulipAssetsType;
92
95
  tellerConfig: TellerConfigType;
93
96
  tellerPools: TellerPoolsType;
94
97
  liquityConfig: LiquityConfigType;
@@ -14,6 +14,14 @@ export type TermConfigChain = {
14
14
  priceOracle?: string | null;
15
15
  /** Term data endpoint base (subgraph/HTTP) for listings + auction state. */
16
16
  apiBaseUrl?: string | null;
17
+ /** Terminal 1 order-store REST base (fill-now limit orders). */
18
+ orderStoreUrl?: string | null;
19
+ /** Terminal 1 intent diamond override. Normally resolved LIVE from the
20
+ * subgraph (`termDiamonds`) — the diamond is upgradeable and per-chain, so a
21
+ * pin can go stale; this field exists for tests/emergencies only. */
22
+ intentDiamond?: string | null;
23
+ /** EIP-712 domain version of the Terminal 1 diamond (order signing). */
24
+ eip712DomainVersion?: string | null;
17
25
  };
18
26
  export type TermConfigType = {
19
27
  [chainId: string]: TermConfigChain;
@@ -75,6 +83,15 @@ export declare const termApiBaseOverride: () => string | undefined;
75
83
  * source configured" and callers fall back to static config / on-chain reads.
76
84
  */
77
85
  export declare const resolveTermApiBase: (chainId: string) => string;
86
+ export declare const setTermOrderStoreBase: (url: string | undefined | null) => void;
87
+ export declare const termOrderStoreBaseOverride: () => string | undefined;
88
+ /**
89
+ * Resolve the Terminal 1 order-store base for a chain: override → config → ''.
90
+ * Unlike the subgraph base, consumers fall back to the public hosted store
91
+ * (`https://api.global.termfinance.io/protocol`) when this is empty — the
92
+ * constant lives with the fetcher (margin-fetcher / worker-api), not here.
93
+ */
94
+ export declare const resolveTermOrderStoreBase: (chainId: string) => string;
78
95
  export declare const termMarkets: () => TermMarketsType;
79
96
  /** All Term Finance market configs on a chain (empty array if none/unloaded). */
80
97
  export declare const termMarketsByChain: (chainId: string | number) => TermMarketConfig[];
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.50",
7
+ "version": "0.0.52",
8
8
  "description": "Hold and initialize lending protocol data across a stack",
9
9
  "files": [
10
10
  "dist"