@1delta/data-sdk 0.0.61 → 0.0.62
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 +17 -0
- package/dist/index.mjs +16 -1
- package/dist/lending/midnight.d.ts +59 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -403,6 +403,21 @@ var resolveTenorApiUrl = (chainId) => {
|
|
|
403
403
|
const cfg = midnightConfig()?.[chainId]?.tenorApiUrl;
|
|
404
404
|
return (cfg && cfg.length > 0 ? cfg : "https://api.tenor.finance/graphql").replace(/\/+$/, "");
|
|
405
405
|
};
|
|
406
|
+
var midnightTenorVaultPeriphery = (chainId) => {
|
|
407
|
+
const c = midnightConfig()?.[String(chainId)];
|
|
408
|
+
if (!c?.tenorVaultExecutor || !c?.tenorSupplyVaultCallback) return void 0;
|
|
409
|
+
return {
|
|
410
|
+
executor: c.tenorVaultExecutor,
|
|
411
|
+
supplyCallback: c.tenorSupplyVaultCallback,
|
|
412
|
+
...c.tenorWithdrawVaultCallback ? { withdrawCallback: c.tenorWithdrawVaultCallback } : {}
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
var isMidnightCollateralVault = (chainId, token) => {
|
|
416
|
+
const lower = token.toLowerCase();
|
|
417
|
+
return midnightMarketsByChain(chainId).some(
|
|
418
|
+
(m) => m.collateralParams.some((c) => !!c.collateralVault && c.token.toLowerCase() === lower)
|
|
419
|
+
);
|
|
420
|
+
};
|
|
406
421
|
var midnightMarkets = () => getGlobalData2()?.midnightMarkets;
|
|
407
422
|
var midnightMarketsByChain = (chainId) => getGlobalData2()?.midnightMarkets?.[String(chainId)] ?? [];
|
|
408
423
|
var midnightMarketById = (chainId, marketId) => {
|
|
@@ -1656,6 +1671,7 @@ exports.inverseMarkets = inverseMarkets;
|
|
|
1656
1671
|
exports.isAaveV4OperationRestricted = isAaveV4OperationRestricted;
|
|
1657
1672
|
exports.isListaSmartLpAsset = isListaSmartLpAsset;
|
|
1658
1673
|
exports.isMidnightCollateralRef = isMidnightCollateralRef;
|
|
1674
|
+
exports.isMidnightCollateralVault = isMidnightCollateralVault;
|
|
1659
1675
|
exports.liquityBranchByIndex = liquityBranchByIndex;
|
|
1660
1676
|
exports.liquityBranchByTroveManager = liquityBranchByTroveManager;
|
|
1661
1677
|
exports.liquityBranchesByChain = liquityBranchesByChain;
|
|
@@ -1690,6 +1706,7 @@ exports.midnightMarketIsEnterable = midnightMarketIsEnterable;
|
|
|
1690
1706
|
exports.midnightMarkets = midnightMarkets;
|
|
1691
1707
|
exports.midnightMarketsByChain = midnightMarketsByChain;
|
|
1692
1708
|
exports.midnightNotEnterableReason = midnightNotEnterableReason;
|
|
1709
|
+
exports.midnightTenorVaultPeriphery = midnightTenorVaultPeriphery;
|
|
1693
1710
|
exports.morphoBundler3 = morphoBundler3;
|
|
1694
1711
|
exports.morphoOracles = morphoOracles;
|
|
1695
1712
|
exports.morphoPools = morphoPools;
|
package/dist/index.mjs
CHANGED
|
@@ -401,6 +401,21 @@ var resolveTenorApiUrl = (chainId) => {
|
|
|
401
401
|
const cfg = midnightConfig()?.[chainId]?.tenorApiUrl;
|
|
402
402
|
return (cfg && cfg.length > 0 ? cfg : "https://api.tenor.finance/graphql").replace(/\/+$/, "");
|
|
403
403
|
};
|
|
404
|
+
var midnightTenorVaultPeriphery = (chainId) => {
|
|
405
|
+
const c = midnightConfig()?.[String(chainId)];
|
|
406
|
+
if (!c?.tenorVaultExecutor || !c?.tenorSupplyVaultCallback) return void 0;
|
|
407
|
+
return {
|
|
408
|
+
executor: c.tenorVaultExecutor,
|
|
409
|
+
supplyCallback: c.tenorSupplyVaultCallback,
|
|
410
|
+
...c.tenorWithdrawVaultCallback ? { withdrawCallback: c.tenorWithdrawVaultCallback } : {}
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
var isMidnightCollateralVault = (chainId, token) => {
|
|
414
|
+
const lower = token.toLowerCase();
|
|
415
|
+
return midnightMarketsByChain(chainId).some(
|
|
416
|
+
(m) => m.collateralParams.some((c) => !!c.collateralVault && c.token.toLowerCase() === lower)
|
|
417
|
+
);
|
|
418
|
+
};
|
|
404
419
|
var midnightMarkets = () => getGlobalData2()?.midnightMarkets;
|
|
405
420
|
var midnightMarketsByChain = (chainId) => getGlobalData2()?.midnightMarkets?.[String(chainId)] ?? [];
|
|
406
421
|
var midnightMarketById = (chainId, marketId) => {
|
|
@@ -1525,4 +1540,4 @@ async function fetchMainTokensMap() {
|
|
|
1525
1540
|
}
|
|
1526
1541
|
}
|
|
1527
1542
|
|
|
1528
|
-
export { ALCHEMIX_ARBITRUM_CONFIG, ALCHEMIX_BASE_CONFIG, ALCHEMIX_ETHEREUM_CONFIG, ALCHEMIX_OPTIMISM_CONFIG, COOLER_ETHEREUM_CONFIG, CURVANCE_MONAD_CONFIG, DOLOMITE_ROUTER_DEFAULTS, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, REMOTE_CACHE_STORE_TTL_S, RESUPPLY_ETHEREUM_CONFIG, RIPE_BASE_CONFIG, RIPE_HQ_IDS, RIPE_ROBINHOOD_CONFIG, RemoteFetchError, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, alchemixBaseKey, alchemixConfig, alchemixConfigFor, alchemixLendersByChain, alchemixMarketByKey, alchemixMarketKey, alchemixMarketsFor, 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, dolomiteIsolation, dolomiteIsolationMarket, dolomiteMarketIdByToken, dolomiteOdosExecutorShim, dolomiteRouters, 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, isMidnightCollateralRef, 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, midnightCollateralRef, midnightConfig, midnightLoanRef, midnightMarketById, midnightMarketIsEnterable, midnightMarkets, midnightMarketsByChain, midnightNotEnterableReason, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseAlchemixMarketKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseMidnightRef, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, refreshRemoteCache, resolveMidnightApiBase, resolveTenorApiUrl, resolveTermApiBase, resolveTermOrderStoreBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, ripeConfig, ripeConfigFor, ripeLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setRemoteCacheGithubToken, setRemoteCacheStore, setRemoteCacheWaitUntil, setTenorApiUrl, setTermApiBase, setTermOrderStoreBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey, skyChainData, skyConfig, skyConfigFor, skyLendersByChain, skyMarkets, tellerConfig, tellerConfigByChain, tellerPoolByAddress, tellerPools, tellerPoolsByChain, tenorApiUrlOverride, termApiBaseOverride, termConfig, termMarketById, termMarkets, termMarketsByChain, termMaxApiBaseUrl, termMaxChainIds, termMaxConfig, termMaxConfigByChain, termMaxLenderKey, termOrderStoreBaseOverride, tokenListCacheKey, twyneBaseKey, twyneBeaconFor, twyneChainData, twyneConfig, twyneConfigFor, twyneLendersByChain, twyneMarketByKey, twyneMarketFor, twyneMarketKey, twyneMarkets, twyneMarketsForIntermediateVault, twyneOperator, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
|
|
1543
|
+
export { ALCHEMIX_ARBITRUM_CONFIG, ALCHEMIX_BASE_CONFIG, ALCHEMIX_ETHEREUM_CONFIG, ALCHEMIX_OPTIMISM_CONFIG, COOLER_ETHEREUM_CONFIG, CURVANCE_MONAD_CONFIG, DOLOMITE_ROUTER_DEFAULTS, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, REMOTE_CACHE_STORE_TTL_S, RESUPPLY_ETHEREUM_CONFIG, RIPE_BASE_CONFIG, RIPE_HQ_IDS, RIPE_ROBINHOOD_CONFIG, RemoteFetchError, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, alchemixBaseKey, alchemixConfig, alchemixConfigFor, alchemixLendersByChain, alchemixMarketByKey, alchemixMarketKey, alchemixMarketsFor, 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, dolomiteIsolation, dolomiteIsolationMarket, dolomiteMarketIdByToken, dolomiteOdosExecutorShim, dolomiteRouters, 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, isMidnightCollateralRef, isMidnightCollateralVault, 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, midnightCollateralRef, midnightConfig, midnightLoanRef, midnightMarketById, midnightMarketIsEnterable, midnightMarkets, midnightMarketsByChain, midnightNotEnterableReason, midnightTenorVaultPeriphery, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseAlchemixMarketKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseMidnightRef, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, refreshRemoteCache, resolveMidnightApiBase, resolveTenorApiUrl, resolveTermApiBase, resolveTermOrderStoreBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, ripeConfig, ripeConfigFor, ripeLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setRemoteCacheGithubToken, setRemoteCacheStore, setRemoteCacheWaitUntil, setTenorApiUrl, setTermApiBase, setTermOrderStoreBase, siloMarkets, siloMarketsV3, siloPeripherals, siloPeripheralsV3, siloV2LenderKey, siloV3LenderKey, skyChainData, skyConfig, skyConfigFor, skyLendersByChain, skyMarkets, tellerConfig, tellerConfigByChain, tellerPoolByAddress, tellerPools, tellerPoolsByChain, tenorApiUrlOverride, termApiBaseOverride, termConfig, termMarketById, termMarkets, termMarketsByChain, termMaxApiBaseUrl, termMaxChainIds, termMaxConfig, termMaxConfigByChain, termMaxLenderKey, termOrderStoreBaseOverride, tokenListCacheKey, twyneBaseKey, twyneBeaconFor, twyneChainData, twyneConfig, twyneConfigFor, twyneLendersByChain, twyneMarketByKey, twyneMarketFor, twyneMarketKey, twyneMarkets, twyneMarketsForIntermediateVault, twyneOperator, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
|
|
@@ -2,8 +2,30 @@
|
|
|
2
2
|
export type MidnightConfigChain = {
|
|
3
3
|
/** Core Midnight contract. */
|
|
4
4
|
midnight: string;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* MidnightBundlesV1 periphery (spot supply/borrow/repay bundles) — the ABI
|
|
7
|
+
* our encoders speak. Absent on chains that only got V2 (Robinhood 4663,
|
|
8
|
+
* Arc 5042): V2 implements none of the five V1 bundle selectors, so it can
|
|
9
|
+
* never stand in here.
|
|
10
|
+
*/
|
|
11
|
+
midnightBundles?: string;
|
|
12
|
+
/** MidnightBundlesV2 (not yet encoded by us; recorded for when it is). */
|
|
13
|
+
midnightBundlesV2?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Tenor's periphery for the vault-as-collateral leg (see
|
|
16
|
+
* {@link MidnightCollateralParam.collateralVault}). The collateral vaults gate
|
|
17
|
+
* who may RECEIVE shares to Midnight and these contracts, so a user, our
|
|
18
|
+
* composer or an aggregator can never hold one — every way into or out of the
|
|
19
|
+
* leg goes through them. Addresses are NOT shared across chains (one CREATE
|
|
20
|
+
* deployer, different nonces), and on Base the address that is the supply
|
|
21
|
+
* callback on Ethereum is the WITHDRAW callback; each was matched by runtime
|
|
22
|
+
* code against the verified Ethereum deployment. Absent = no vault-leg routes.
|
|
23
|
+
*/
|
|
24
|
+
tenorVaultExecutor?: string | null;
|
|
25
|
+
/** `MidnightSupplyVaultSharesCallback` — a borrow take whose proceeds land in the vault. */
|
|
26
|
+
tenorSupplyVaultCallback?: string | null;
|
|
27
|
+
/** `MidnightWithdrawVaultSharesCallback` — funds a borrower's buy offer from vault shares. */
|
|
28
|
+
tenorWithdrawVaultCallback?: string | null;
|
|
7
29
|
/** On-chain mempool log contract where signed offers are published. */
|
|
8
30
|
midnightMempool: string;
|
|
9
31
|
ecrecoverRatifier?: string | null;
|
|
@@ -42,6 +64,28 @@ export type MidnightCollateralParam = {
|
|
|
42
64
|
* the collateral is itself a lending position. See TENOR_PLAN.md §P4.
|
|
43
65
|
*/
|
|
44
66
|
collateralVault?: string | null;
|
|
67
|
+
/**
|
|
68
|
+
* The vault's `receiveSharesGate` is set: only allowlisted contracts (Midnight
|
|
69
|
+
* and Tenor's periphery) may hold its shares. Then nothing can be bought on a
|
|
70
|
+
* DEX, minted by a generic 4626 route or held by the user — the leg is reached
|
|
71
|
+
* only through `tenorVaultExecutor` / `tenorSupplyVaultCallback`.
|
|
72
|
+
*/
|
|
73
|
+
collateralVaultGated?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Where the vault's yield comes from: its ONE Vault V2 adapter supplies ONE
|
|
76
|
+
* Morpho Blue market, so the share earns that market's supply rate net of
|
|
77
|
+
* the vault's fees (WAD strings). Read on-chain by the lender-metadata
|
|
78
|
+
* updater; absent when the vault has any other allocation shape. yield-tracer
|
|
79
|
+
* turns it into the leg's intrinsic yield from the stored
|
|
80
|
+
* `MORPHO_BLUE_<marketId>` row (a "composite" yield — no second fetch).
|
|
81
|
+
*/
|
|
82
|
+
collateralVaultSource?: {
|
|
83
|
+
kind: 'morpho-blue';
|
|
84
|
+
morpho: string;
|
|
85
|
+
marketId: string;
|
|
86
|
+
performanceFee: string;
|
|
87
|
+
managementFee: string;
|
|
88
|
+
};
|
|
45
89
|
};
|
|
46
90
|
/**
|
|
47
91
|
* Who may enter (take offers on) / liquidate a market. Midnight markets can pin
|
|
@@ -124,6 +168,19 @@ export declare const setTenorApiUrl: (url: string | undefined | null) => void;
|
|
|
124
168
|
export declare const tenorApiUrlOverride: () => string | undefined;
|
|
125
169
|
/** Resolve the Tenor GraphQL endpoint for a chain: override → config → hosted default. */
|
|
126
170
|
export declare const resolveTenorApiUrl: (chainId: string) => string;
|
|
171
|
+
/** Tenor's vault-leg periphery on a chain, or `undefined` when any part is missing. */
|
|
172
|
+
export declare const midnightTenorVaultPeriphery: (chainId: string | number) => {
|
|
173
|
+
executor: string;
|
|
174
|
+
supplyCallback: string;
|
|
175
|
+
withdrawCallback?: string;
|
|
176
|
+
} | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* Is `token` a vault-as-collateral share on this chain — a Midnight collateral
|
|
179
|
+
* leg that is an ERC-4626 over its market's own loan token? Such a share is a
|
|
180
|
+
* single-purpose collateral WRAPPER (it exists to be posted on one book), not an
|
|
181
|
+
* earn product, and — when gated — cannot be held outside Midnight at all.
|
|
182
|
+
*/
|
|
183
|
+
export declare const isMidnightCollateralVault: (chainId: string | number, token: string) => boolean;
|
|
127
184
|
export declare const midnightMarkets: () => MidnightMarketsType;
|
|
128
185
|
/** All Midnight market configs on a chain (empty array if none/unloaded). */
|
|
129
186
|
export declare const midnightMarketsByChain: (chainId: string | number) => MidnightMarketConfig[];
|