@1delta/data-sdk 0.0.43 → 0.0.44

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
@@ -69,6 +69,7 @@ var LENDER_DATA_DEFAULTS = () => ({
69
69
  morphoBundler3: {},
70
70
  initConfig: {},
71
71
  listaNativeProvider: {},
72
+ listaCollateralProviders: {},
72
73
  midnightConfig: {},
73
74
  midnightMarkets: {},
74
75
  termConfig: {},
@@ -302,6 +303,32 @@ var initConfig = () => getGlobalData2()?.initConfig;
302
303
 
303
304
  // src/lending/lista.ts
304
305
  var listaNativeProvider = () => getGlobalData2()?.listaNativeProvider;
306
+ var listaCollateralProviders = () => getGlobalData2()?.listaCollateralProviders;
307
+ var listaCollateralProvider = (chainId, provider) => {
308
+ if (!provider) return void 0;
309
+ return listaCollateralProviders()?.[String(chainId)]?.[provider.toLowerCase()];
310
+ };
311
+ var listaSmartLpByCollateral = (chainId, collateralToken) => {
312
+ if (!collateralToken) return void 0;
313
+ const chain = listaCollateralProviders()?.[String(chainId)];
314
+ if (!chain) return void 0;
315
+ const needle = collateralToken.toLowerCase();
316
+ for (const [address, entry] of Object.entries(chain)) {
317
+ if (entry.kind !== "smart-lp") continue;
318
+ if (entry.collateralToken.toLowerCase() === needle) {
319
+ return { ...entry, address };
320
+ }
321
+ }
322
+ return void 0;
323
+ };
324
+ var isListaSmartLpAsset = (entry, asset) => {
325
+ const needle = asset.toLowerCase();
326
+ if (entry.dexLp && entry.dexLp.toLowerCase() === needle) return true;
327
+ return (entry.coins ?? []).some(
328
+ (c) => c.address.toLowerCase() === needle || // the pool spells its native coin with the same 0xEeee… sentinel
329
+ c.isNative && needle === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
330
+ );
331
+ };
305
332
 
306
333
  // src/lending/midnight.ts
307
334
  var midnightConfig = () => getGlobalData2()?.midnightConfig;
@@ -951,6 +978,7 @@ exports.inverseConfigFor = inverseConfigFor;
951
978
  exports.inverseLendersByChain = inverseLendersByChain;
952
979
  exports.inverseMarketByAddress = inverseMarketByAddress;
953
980
  exports.inverseMarkets = inverseMarkets;
981
+ exports.isListaSmartLpAsset = isListaSmartLpAsset;
954
982
  exports.liquityBranchByIndex = liquityBranchByIndex;
955
983
  exports.liquityBranchByTroveManager = liquityBranchByTroveManager;
956
984
  exports.liquityBranchesByChain = liquityBranchesByChain;
@@ -958,7 +986,10 @@ exports.liquityConfig = liquityConfig;
958
986
  exports.liquityConfigFor = liquityConfigFor;
959
987
  exports.liquityLendersByChain = liquityLendersByChain;
960
988
  exports.liquityMarkets = liquityMarkets;
989
+ exports.listaCollateralProvider = listaCollateralProvider;
990
+ exports.listaCollateralProviders = listaCollateralProviders;
961
991
  exports.listaNativeProvider = listaNativeProvider;
992
+ exports.listaSmartLpByCollateral = listaSmartLpByCollateral;
962
993
  exports.llamaLendApiBaseUrl = llamaLendApiBaseUrl;
963
994
  exports.llamaLendChainData = llamaLendChainData;
964
995
  exports.llamaLendConfig = llamaLendConfig;
package/dist/index.mjs CHANGED
@@ -67,6 +67,7 @@ var LENDER_DATA_DEFAULTS = () => ({
67
67
  morphoBundler3: {},
68
68
  initConfig: {},
69
69
  listaNativeProvider: {},
70
+ listaCollateralProviders: {},
70
71
  midnightConfig: {},
71
72
  midnightMarkets: {},
72
73
  termConfig: {},
@@ -300,6 +301,32 @@ var initConfig = () => getGlobalData2()?.initConfig;
300
301
 
301
302
  // src/lending/lista.ts
302
303
  var listaNativeProvider = () => getGlobalData2()?.listaNativeProvider;
304
+ var listaCollateralProviders = () => getGlobalData2()?.listaCollateralProviders;
305
+ var listaCollateralProvider = (chainId, provider) => {
306
+ if (!provider) return void 0;
307
+ return listaCollateralProviders()?.[String(chainId)]?.[provider.toLowerCase()];
308
+ };
309
+ var listaSmartLpByCollateral = (chainId, collateralToken) => {
310
+ if (!collateralToken) return void 0;
311
+ const chain = listaCollateralProviders()?.[String(chainId)];
312
+ if (!chain) return void 0;
313
+ const needle = collateralToken.toLowerCase();
314
+ for (const [address, entry] of Object.entries(chain)) {
315
+ if (entry.kind !== "smart-lp") continue;
316
+ if (entry.collateralToken.toLowerCase() === needle) {
317
+ return { ...entry, address };
318
+ }
319
+ }
320
+ return void 0;
321
+ };
322
+ var isListaSmartLpAsset = (entry, asset) => {
323
+ const needle = asset.toLowerCase();
324
+ if (entry.dexLp && entry.dexLp.toLowerCase() === needle) return true;
325
+ return (entry.coins ?? []).some(
326
+ (c) => c.address.toLowerCase() === needle || // the pool spells its native coin with the same 0xEeee… sentinel
327
+ c.isNative && needle === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
328
+ );
329
+ };
303
330
 
304
331
  // src/lending/midnight.ts
305
332
  var midnightConfig = () => getGlobalData2()?.midnightConfig;
@@ -857,4 +884,4 @@ async function fetchMainTokensMap() {
857
884
  return await data.json();
858
885
  }
859
886
 
860
- export { CURVANCE_MONAD_CONFIG, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, RESUPPLY_ETHEREUM_CONFIG, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chainLogoURI, chains, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, curvanceConfig, curvanceConfigFor, curvanceLendersByChain, curvancePositionManager, curvancePositionManagersFor, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, dssChainData, dssConfigFor, dssDebtJoin, dssDebtToken, dssMarketByIlk, eulerConfigs, eulerVaults, exactlyConfig, exactlyMarketByAddress, exactlyMarketByAsset, exactlyMarkets, exactlyMarketsByChain, fetchMainTokensMap, 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, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, inverseChainData, inverseConfig, inverseConfigFor, inverseLendersByChain, inverseMarketByAddress, inverseMarkets, liquityBranchByIndex, liquityBranchByTroveManager, liquityBranchesByChain, liquityConfig, liquityConfigFor, liquityLendersByChain, liquityMarkets, listaNativeProvider, llamaLendApiBaseUrl, llamaLendChainData, llamaLendConfig, llamaLendConfigFor, llamaLendLenderKey, llamaLendLendersByChain, llamaLendLeverageZap, llamaLendMarketByController, llamaLendMarketByVault, llamaLendMarkets, llamaLendSupportsDelegation, llamaLendSupportsLeverage, 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, 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, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
887
+ export { CURVANCE_MONAD_CONFIG, FRAXLEND_ETHEREUM_CONFIG, GEARBOX_ACCOUNT_COMPRESSOR_V310, RESUPPLY_ETHEREUM_CONFIG, aaveOracles, aaveOraclesConfig, aavePools, aaveReserves, aaveTokens, aaveV4Oracles, aaveV4Peripherals, aaveV4SpokeLenderKey, aaveV4Spokes, aaveWethGateway, chainLogoURI, chains, compoundV2Oracles, compoundV2OraclesConfig, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, curvanceConfig, curvanceConfigFor, curvanceLendersByChain, curvancePositionManager, curvancePositionManagersFor, dolomiteChains, dolomiteConfigs, dolomiteEmode, dolomiteMarketIdByToken, dssChainData, dssConfigFor, dssDebtJoin, dssDebtToken, dssMarketByIlk, eulerConfigs, eulerVaults, exactlyConfig, exactlyMarketByAddress, exactlyMarketByAsset, exactlyMarkets, exactlyMarketsByChain, fetchMainTokensMap, 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, getAaveV4SpokeEntry, getAaveV4SpokePeripherals, getChainEntries, getSiloV2MarketEntry, getSiloV3MarketEntry, initConfig, initializeChainData, initializeLenderData, inverseChainData, inverseConfig, inverseConfigFor, inverseLendersByChain, inverseMarketByAddress, inverseMarkets, isListaSmartLpAsset, liquityBranchByIndex, liquityBranchByTroveManager, liquityBranchesByChain, liquityConfig, liquityConfigFor, liquityLendersByChain, liquityMarkets, listaCollateralProvider, listaCollateralProviders, listaNativeProvider, listaSmartLpByCollateral, llamaLendApiBaseUrl, llamaLendChainData, llamaLendConfig, llamaLendConfigFor, llamaLendLenderKey, llamaLendLendersByChain, llamaLendLeverageZap, llamaLendMarketByController, llamaLendMarketByVault, llamaLendMarkets, llamaLendSupportsDelegation, llamaLendSupportsLeverage, 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, 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, usddChainData, usddConfig, usddConfigFor, usddLendersByChain, usddMarketByIlk, usddMarkets };
@@ -4,3 +4,77 @@ export type ListaNativeProviderType = {
4
4
  };
5
5
  };
6
6
  export declare const listaNativeProvider: () => ListaNativeProviderType;
7
+ /**
8
+ * SHAPE of a per-market Lista collateral provider.
9
+ *
10
+ * Moolah gates collateral behind `providers(id, collateralToken)`: when it is
11
+ * non-zero, only that contract may `supplyCollateral` / `withdrawCollateral`
12
+ * (and on withdraw the receiver must be the provider itself). Two INCOMPATIBLE
13
+ * shapes are deployed and nothing on-chain announces which one an address is:
14
+ *
15
+ * - `erc20` — forwards Moolah's own selectors verbatim and takes the
16
+ * collateral token itself (the slisBNB provider).
17
+ * - `native` — the chain-level provider from `listaNativeProvider()`: same
18
+ * selectors plus WBNB/WETH-native variants.
19
+ * - `smart-lp` — Lista's `SmartProvider`. A DIFFERENT ABI: it zaps a two-coin
20
+ * StableSwap pool, so the inputs are the POOL COINS, not the
21
+ * collateral token — which is `onlyMoolah`-transferable and can
22
+ * never be held or approved by a user.
23
+ *
24
+ * Encoding one shape for the other calls a selector the contract does not
25
+ * implement, i.e. an empty revert. Callers therefore resolve the shape here and
26
+ * must FAIL CLOSED on a provider that is absent.
27
+ */
28
+ export type ListaCollateralProviderKind = 'erc20' | 'native' | 'smart-lp';
29
+ export type ListaSmartLpCoin = {
30
+ address: string;
31
+ symbol: string;
32
+ decimals: number;
33
+ /** the pool holds the chain's native coin behind the 0xEeee… sentinel */
34
+ isNative: boolean;
35
+ };
36
+ export type ListaCollateralProvider = {
37
+ kind: ListaCollateralProviderKind;
38
+ collateralToken: string;
39
+ collateralSymbol: string;
40
+ collateralDecimals: number;
41
+ /** `smart-lp` only — the StableSwap pool the provider zaps through */
42
+ dex?: string;
43
+ /** `smart-lp` only — the pool's info/quoting contract */
44
+ dexInfo?: string;
45
+ /** `smart-lp` only — the pool's LP token (1:1 with the collateral receipt) */
46
+ dexLp?: string;
47
+ /**
48
+ * `smart-lp` only — pool coin order, which comes from `dex.coins(i)` and
49
+ * NOT from the collateral symbol: "USDT & USDe-SmartLP" is `[USDe, USDT]`.
50
+ */
51
+ coins?: [ListaSmartLpCoin, ListaSmartLpCoin];
52
+ };
53
+ /** chainId -> provider address (lowercase) -> shape */
54
+ export type ListaCollateralProvidersType = {
55
+ [chainId: string]: {
56
+ [provider: string]: ListaCollateralProvider;
57
+ };
58
+ };
59
+ export declare const listaCollateralProviders: () => ListaCollateralProvidersType;
60
+ /**
61
+ * Resolve a provider address (as returned live by the Lista lens on
62
+ * `params.market.collateralProvider`) to its shape. `undefined` means the
63
+ * roster has never seen it — treat that as UNSUPPORTED, never as
64
+ * "assume Morpho-shaped".
65
+ */
66
+ export declare const listaCollateralProvider: (chainId: string | number, provider: string | undefined) => ListaCollateralProvider | undefined;
67
+ /**
68
+ * Reverse lookup: the SmartLP provider serving a given collateral token, with
69
+ * its own address folded in.
70
+ *
71
+ * Callers that hold a market's `collateralProvider` should use
72
+ * {@link listaCollateralProvider} — it is authoritative. This exists for the
73
+ * paths that only know the ASSET (routing decisions taken before market data
74
+ * is fetched, e.g. "can the direct route pay this market with USDT?").
75
+ */
76
+ export declare const listaSmartLpByCollateral: (chainId: string | number, collateralToken: string | undefined) => (ListaCollateralProvider & {
77
+ address: string;
78
+ }) | undefined;
79
+ /** Is `asset` one of the provider's two pool coins, or its LP token? */
80
+ export declare const isListaSmartLpAsset: (entry: ListaCollateralProvider, asset: string) => boolean;
@@ -33,7 +33,7 @@ import type { FrankencoinConfigType, FrankencoinMarketsType } from './frankencoi
33
33
  import type { GearboxResolversType } from './gearbox';
34
34
  import type { InitConfigType } from './initProtocol';
35
35
  import type { InverseConfigType, InverseMarketsType } from './inverse';
36
- import type { ListaNativeProviderType } from './lista';
36
+ import type { ListaCollateralProvidersType, ListaNativeProviderType } from './lista';
37
37
  import type { LiquityConfigType, LiquityMarketsType } from './liquity';
38
38
  import type { LlamaLendConfigType, LlamaLendMarketsType } from './llamalend';
39
39
  import type { MidnightConfigType, MidnightMarketsType } from './midnight';
@@ -79,6 +79,7 @@ export interface GlobalLenderDataRegistry {
79
79
  morphoBundler3: MorphoBundler3Type;
80
80
  initConfig: InitConfigType;
81
81
  listaNativeProvider: ListaNativeProviderType;
82
+ listaCollateralProviders: ListaCollateralProvidersType;
82
83
  midnightConfig: MidnightConfigType;
83
84
  midnightMarkets: MidnightMarketsType;
84
85
  termConfig: TermConfigType;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.43",
7
+ "version": "0.0.44",
8
8
  "description": "Hold and initialize lending protocol data across a stack",
9
9
  "files": [
10
10
  "dist"