@1delta/data-sdk 0.0.53 → 0.0.55
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 +18 -0
- package/dist/index.mjs +15 -1
- package/dist/lending/inverse.d.ts +6 -1
- package/dist/lending/midnight.d.ts +18 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -410,6 +410,20 @@ var midnightNotEnterableReason = (market, nowSec = Math.floor(Date.now() / 1e3))
|
|
|
410
410
|
return "market gating could not be resolved";
|
|
411
411
|
}
|
|
412
412
|
};
|
|
413
|
+
var MIDNIGHT_COLLATERAL_MARK = "-c";
|
|
414
|
+
var midnightCollateralRef = (token, collateralIndex) => `${token.toLowerCase()}${MIDNIGHT_COLLATERAL_MARK}${collateralIndex}`;
|
|
415
|
+
var midnightLoanRef = (loanToken) => loanToken.toLowerCase();
|
|
416
|
+
var parseMidnightRef = (ref) => {
|
|
417
|
+
const at = ref.lastIndexOf(MIDNIGHT_COLLATERAL_MARK);
|
|
418
|
+
if (at > 0) {
|
|
419
|
+
const tail = ref.slice(at + MIDNIGHT_COLLATERAL_MARK.length);
|
|
420
|
+
if (/^\d+$/.test(tail)) {
|
|
421
|
+
return { token: ref.slice(0, at).toLowerCase(), collateralIndex: Number(tail) };
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return { token: ref.toLowerCase(), collateralIndex: void 0 };
|
|
425
|
+
};
|
|
426
|
+
var isMidnightCollateralRef = (ref) => parseMidnightRef(ref).collateralIndex !== void 0;
|
|
413
427
|
|
|
414
428
|
// src/lending/term.ts
|
|
415
429
|
var termConfig = () => getGlobalData2()?.termConfig;
|
|
@@ -1307,6 +1321,7 @@ exports.inverseMarketByAddress = inverseMarketByAddress;
|
|
|
1307
1321
|
exports.inverseMarkets = inverseMarkets;
|
|
1308
1322
|
exports.isAaveV4OperationRestricted = isAaveV4OperationRestricted;
|
|
1309
1323
|
exports.isListaSmartLpAsset = isListaSmartLpAsset;
|
|
1324
|
+
exports.isMidnightCollateralRef = isMidnightCollateralRef;
|
|
1310
1325
|
exports.liquityBranchByIndex = liquityBranchByIndex;
|
|
1311
1326
|
exports.liquityBranchByTroveManager = liquityBranchByTroveManager;
|
|
1312
1327
|
exports.liquityBranchesByChain = liquityBranchesByChain;
|
|
@@ -1333,7 +1348,9 @@ exports.llamaLendSupportsLeverage = llamaLendSupportsLeverage;
|
|
|
1333
1348
|
exports.loadCached = loadCached;
|
|
1334
1349
|
exports.loadCachedJson = loadCachedJson;
|
|
1335
1350
|
exports.midnightApiBaseOverride = midnightApiBaseOverride;
|
|
1351
|
+
exports.midnightCollateralRef = midnightCollateralRef;
|
|
1336
1352
|
exports.midnightConfig = midnightConfig;
|
|
1353
|
+
exports.midnightLoanRef = midnightLoanRef;
|
|
1337
1354
|
exports.midnightMarketById = midnightMarketById;
|
|
1338
1355
|
exports.midnightMarketIsEnterable = midnightMarketIsEnterable;
|
|
1339
1356
|
exports.midnightMarkets = midnightMarkets;
|
|
@@ -1349,6 +1366,7 @@ exports.parseAaveV4SpokeLenderKey = parseAaveV4SpokeLenderKey;
|
|
|
1349
1366
|
exports.parseFraxlendPairKey = parseFraxlendPairKey;
|
|
1350
1367
|
exports.parseGearboxV3LenderKey = parseGearboxV3LenderKey;
|
|
1351
1368
|
exports.parseLlamaLendLenderKey = parseLlamaLendLenderKey;
|
|
1369
|
+
exports.parseMidnightRef = parseMidnightRef;
|
|
1352
1370
|
exports.parseSiloV2LenderKey = parseSiloV2LenderKey;
|
|
1353
1371
|
exports.parseSiloV3LenderKey = parseSiloV3LenderKey;
|
|
1354
1372
|
exports.parseTermMaxLenderKey = parseTermMaxLenderKey;
|
package/dist/index.mjs
CHANGED
|
@@ -408,6 +408,20 @@ var midnightNotEnterableReason = (market, nowSec = Math.floor(Date.now() / 1e3))
|
|
|
408
408
|
return "market gating could not be resolved";
|
|
409
409
|
}
|
|
410
410
|
};
|
|
411
|
+
var MIDNIGHT_COLLATERAL_MARK = "-c";
|
|
412
|
+
var midnightCollateralRef = (token, collateralIndex) => `${token.toLowerCase()}${MIDNIGHT_COLLATERAL_MARK}${collateralIndex}`;
|
|
413
|
+
var midnightLoanRef = (loanToken) => loanToken.toLowerCase();
|
|
414
|
+
var parseMidnightRef = (ref) => {
|
|
415
|
+
const at = ref.lastIndexOf(MIDNIGHT_COLLATERAL_MARK);
|
|
416
|
+
if (at > 0) {
|
|
417
|
+
const tail = ref.slice(at + MIDNIGHT_COLLATERAL_MARK.length);
|
|
418
|
+
if (/^\d+$/.test(tail)) {
|
|
419
|
+
return { token: ref.slice(0, at).toLowerCase(), collateralIndex: Number(tail) };
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return { token: ref.toLowerCase(), collateralIndex: void 0 };
|
|
423
|
+
};
|
|
424
|
+
var isMidnightCollateralRef = (ref) => parseMidnightRef(ref).collateralIndex !== void 0;
|
|
411
425
|
|
|
412
426
|
// src/lending/term.ts
|
|
413
427
|
var termConfig = () => getGlobalData2()?.termConfig;
|
|
@@ -1196,4 +1210,4 @@ async function fetchMainTokensMap() {
|
|
|
1196
1210
|
}
|
|
1197
1211
|
}
|
|
1198
1212
|
|
|
1199
|
-
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, midnightMarketIsEnterable, midnightMarkets, midnightMarketsByChain, midnightNotEnterableReason, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles, morphoTypeVaults, parseAaveV4SpokeLenderKey, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, resolveMidnightApiBase, resolveTenorApiUrl, resolveTermApiBase, resolveTermOrderStoreBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setRemoteCacheGithubToken, setRemoteCacheStore, 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, twyneBaseKey, twyneBeaconFor, twyneChainData, twyneConfig, twyneConfigFor, twyneLendersByChain, twyneMarketByKey, twyneMarketFor, twyneMarketKey, twyneMarkets, twyneMarketsForIntermediateVault, twyneOperator, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
|
|
1213
|
+
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, 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, parseFraxlendPairKey, parseGearboxV3LenderKey, parseLlamaLendLenderKey, parseMidnightRef, parseSiloV2LenderKey, parseSiloV3LenderKey, parseTermMaxLenderKey, resolveMidnightApiBase, resolveTenorApiUrl, resolveTermApiBase, resolveTermOrderStoreBase, resupplyConfig, resupplyConfigFor, resupplyLendersByChain, riverChainData, riverConfig, riverConfigFor, riverLendersByChain, riverMarketByIndex, riverMarkets, setMidnightApiBase, setRemoteCacheGithubToken, setRemoteCacheStore, 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, twyneBaseKey, twyneBeaconFor, twyneChainData, twyneConfig, twyneConfigFor, twyneLendersByChain, twyneMarketByKey, twyneMarketFor, twyneMarketKey, twyneMarkets, twyneMarketsForIntermediateVault, twyneOperator, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
|
|
@@ -10,8 +10,13 @@ export type InverseConfigChain = {
|
|
|
10
10
|
borrowController: string;
|
|
11
11
|
/** Debt decimals (18). */
|
|
12
12
|
debtDecimals?: number;
|
|
13
|
+
/** The Curve tricrypto pool that IS the DBR market (TriDBR: DOLA/DBR/INV).
|
|
14
|
+
* Its `price_oracle(0)` EMA is the PRIMARY borrow-rate source — FiRM
|
|
15
|
+
* prices no DBR itself, so without this the rate can only come from
|
|
16
|
+
* Inverse's own API. Absent ⇒ the on-chain leg is skipped. */
|
|
17
|
+
dbrPricePool?: string;
|
|
13
18
|
/** Metadata snapshot of the DBR price in DOLA (= fixed borrow APR as a
|
|
14
|
-
* decimal) —
|
|
19
|
+
* decimal) — LAST RESORT, after the on-chain pool and the API. */
|
|
15
20
|
dbrPriceDolaSnapshot?: string;
|
|
16
21
|
};
|
|
17
22
|
export type InverseConfigType = {
|
|
@@ -142,3 +142,21 @@ export declare const midnightMarketById: (chainId: string | number, marketId: st
|
|
|
142
142
|
export declare const midnightMarketIsEnterable: (market: Pick<MidnightMarketConfig, "gating" | "deprecatedAt" | "maturity">, nowSec?: number) => boolean;
|
|
143
143
|
/** Human-readable reason a market refuses new positions, or `undefined` if it does not. */
|
|
144
144
|
export declare const midnightNotEnterableReason: (market: Pick<MidnightMarketConfig, "gating" | "deprecatedAt" | "maturity">, nowSec?: number) => string | undefined;
|
|
145
|
+
/** Ref for a Midnight COLLATERAL LEG row: `<token>-c<collateralIndex>`. */
|
|
146
|
+
export declare const midnightCollateralRef: (token: string, collateralIndex: number) => string;
|
|
147
|
+
/** Ref for a Midnight LOAN-side row (borrow / lend): the bare loan token. */
|
|
148
|
+
export declare const midnightLoanRef: (loanToken: string) => string;
|
|
149
|
+
/**
|
|
150
|
+
* Split a Midnight row ref back into its token and side.
|
|
151
|
+
*
|
|
152
|
+
* `collateralIndex === undefined` means the LOAN side (credit / debt), which is
|
|
153
|
+
* the bare-token form. Anything else is that collateral leg. A trailing
|
|
154
|
+
* `-c<digits>` is the only thing read as a leg marker, so a token address —
|
|
155
|
+
* which cannot contain `-` — is never mistaken for one.
|
|
156
|
+
*/
|
|
157
|
+
export declare const parseMidnightRef: (ref: string) => {
|
|
158
|
+
token: string;
|
|
159
|
+
collateralIndex: number | undefined;
|
|
160
|
+
};
|
|
161
|
+
/** True when `ref` names a collateral leg rather than the loan side. */
|
|
162
|
+
export declare const isMidnightCollateralRef: (ref: string) => boolean;
|