@1delta/data-sdk 0.0.44 → 0.0.45

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
@@ -176,6 +176,13 @@ function findAaveV4PositionManager(chainId, lenderKey, nameQuery) {
176
176
  );
177
177
  return hit?.address?.toLowerCase();
178
178
  }
179
+ function getAaveV4SpokeAccess(chainId, lenderKey) {
180
+ return getAaveV4SpokeEntry(chainId, lenderKey)?.access;
181
+ }
182
+ function isAaveV4OperationRestricted(chainId, lenderKey, operation) {
183
+ const access = getAaveV4SpokeAccess(chainId, lenderKey);
184
+ return !!access?.restrictedOperations?.includes(operation);
185
+ }
179
186
  function aaveV4SpokeLenderKey(spoke) {
180
187
  if (!spoke || !spoke.startsWith("0x") || spoke.length !== 42) {
181
188
  throw new Error(`aaveV4SpokeLenderKey: invalid spoke address ${spoke}`);
@@ -964,6 +971,7 @@ exports.gearboxResolvers = gearboxResolvers;
964
971
  exports.gearboxV3LenderKey = gearboxV3LenderKey;
965
972
  exports.getAaveV4GatewayAddresses = getAaveV4GatewayAddresses;
966
973
  exports.getAaveV4PositionManagers = getAaveV4PositionManagers;
974
+ exports.getAaveV4SpokeAccess = getAaveV4SpokeAccess;
967
975
  exports.getAaveV4SpokeEntry = getAaveV4SpokeEntry;
968
976
  exports.getAaveV4SpokePeripherals = getAaveV4SpokePeripherals;
969
977
  exports.getChainEntries = getChainEntries;
@@ -978,6 +986,7 @@ exports.inverseConfigFor = inverseConfigFor;
978
986
  exports.inverseLendersByChain = inverseLendersByChain;
979
987
  exports.inverseMarketByAddress = inverseMarketByAddress;
980
988
  exports.inverseMarkets = inverseMarkets;
989
+ exports.isAaveV4OperationRestricted = isAaveV4OperationRestricted;
981
990
  exports.isListaSmartLpAsset = isListaSmartLpAsset;
982
991
  exports.liquityBranchByIndex = liquityBranchByIndex;
983
992
  exports.liquityBranchByTroveManager = liquityBranchByTroveManager;
package/dist/index.mjs CHANGED
@@ -174,6 +174,13 @@ function findAaveV4PositionManager(chainId, lenderKey, nameQuery) {
174
174
  );
175
175
  return hit?.address?.toLowerCase();
176
176
  }
177
+ function getAaveV4SpokeAccess(chainId, lenderKey) {
178
+ return getAaveV4SpokeEntry(chainId, lenderKey)?.access;
179
+ }
180
+ function isAaveV4OperationRestricted(chainId, lenderKey, operation) {
181
+ const access = getAaveV4SpokeAccess(chainId, lenderKey);
182
+ return !!access?.restrictedOperations?.includes(operation);
183
+ }
177
184
  function aaveV4SpokeLenderKey(spoke) {
178
185
  if (!spoke || !spoke.startsWith("0x") || spoke.length !== 42) {
179
186
  throw new Error(`aaveV4SpokeLenderKey: invalid spoke address ${spoke}`);
@@ -884,4 +891,4 @@ async function fetchMainTokensMap() {
884
891
  return await data.json();
885
892
  }
886
893
 
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 };
894
+ 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, 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, 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 };
@@ -12,11 +12,44 @@ export type AaveV4ReserveEntry = {
12
12
  oracle?: string;
13
13
  oracleDecimals?: number;
14
14
  };
15
+ /** A user-facing spoke operation a whitelabel variant may restrict. */
16
+ export type AaveV4RestrictedOperation = 'supply' | 'borrow' | 'withdraw' | 'repay';
17
+ export type AaveV4AccessGate = {
18
+ /** Contract answering the membership question. */
19
+ contract: string;
20
+ /** Solidity signature of the `(address) -> bool` membership check. */
21
+ check: string;
22
+ /** Human label for the allowed set, for API/UI copy. */
23
+ label: string;
24
+ };
25
+ /**
26
+ * Operation restrictions a spoke imposes BEYOND the stock V4 rules.
27
+ *
28
+ * Set by the `lender-metadata` access probe, which positively identifies a
29
+ * whitelabel spoke on-chain. ABSENT means the spoke behaves like a stock one.
30
+ *
31
+ * The distinction that matters: the stock `onlyPositionManager(onBehalfOf)`
32
+ * rule — which makes EVERY on-behalf op revert `Unauthorized()` without a
33
+ * user-approved PM — is protocol-wide and modelled by the position-manager
34
+ * layer, so it is deliberately NOT recorded here. This field carries only what
35
+ * a given deployment does differently, and it is about the OWNER of the
36
+ * position (`onBehalfOf`), not the caller.
37
+ *
38
+ * Today the only instance is ether.fi's Optimism spoke, whose `borrow` is
39
+ * restricted to ether.fi Cash Safes.
40
+ */
41
+ export type AaveV4SpokeAccess = {
42
+ /** Ops NOT available to an arbitrary address acting FOR ITSELF. */
43
+ restrictedOperations: AaveV4RestrictedOperation[];
44
+ gate: AaveV4AccessGate;
45
+ };
15
46
  export type AaveV4SpokeEntry = {
16
47
  spoke: string;
17
48
  oracle: string;
18
49
  label: string;
19
50
  dynamicConfigKeyMax?: number;
51
+ /** Present only when the spoke restricts an op — see `AaveV4SpokeAccess`. */
52
+ access?: AaveV4SpokeAccess;
20
53
  /**
21
54
  * UI/grouping hint only (`AAVE_V4_CORE` / `AAVE_V4_PLUS` / `AAVE_V4_PRIME`).
22
55
  * NOT used for routing or lender keying.
@@ -136,6 +169,21 @@ export declare function getAaveV4PositionManagers(chainId: string, lenderKey: st
136
169
  * without hardcoding the addresses.
137
170
  */
138
171
  export declare function findAaveV4PositionManager(chainId: string, lenderKey: string, nameQuery: string): string | undefined;
172
+ /**
173
+ * Access restrictions for a per-spoke V4 lender key, or `undefined` when the
174
+ * spoke behaves like a stock one.
175
+ */
176
+ export declare function getAaveV4SpokeAccess(chainId: string, lenderKey: string): AaveV4SpokeAccess | undefined;
177
+ /**
178
+ * Is `operation` restricted to an allowlist on this spoke?
179
+ *
180
+ * Answers the MARKET-level question only — whether a gate exists at all. It
181
+ * cannot say whether a given address passes it; that needs an on-chain call to
182
+ * `access.gate.contract` with `access.gate.check`. Callers that have no user in
183
+ * hand (quotes, listings) should treat `true` as "not available by default" and
184
+ * say so, rather than building a transaction that reverts on-chain.
185
+ */
186
+ export declare function isAaveV4OperationRestricted(chainId: string, lenderKey: string, operation: AaveV4RestrictedOperation): boolean;
139
187
  /**
140
188
  * Synthesize the per-spoke lender key for an Aave V4 spoke.
141
189
  *
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.44",
7
+ "version": "0.0.45",
8
8
  "description": "Hold and initialize lending protocol data across a stack",
9
9
  "files": [
10
10
  "dist"