@1delta/data-sdk
v0.0.26
Published
Hold and initialize lending protocol data across a stack
Downloads
2,542
Readme
@1delta/data-sdk
Global registry for lending protocol deployments, chain metadata, and token lists. Provides getters to access pool configurations, reserve lists, oracle addresses, and protocol-specific contract addresses across all supported chains and lending protocol forks.
Installation
pnpm add @1delta/data-sdkOverview
The SDK is a read-only data layer organized into three modules:
| Module | Description | |--------|-------------| | Lending | Pool configs, reserves, tokens, oracles for all lending protocols | | Chains | Chain metadata (RPC endpoints, explorers, native currency) | | Tokens | Token lists per chain (fetched from remote) |
All data is stored in a global registry (globalThis) so it's shared across module instances. Data is populated once via initializeLenderData() / initializeChainData() (typically called by @1delta/initializer-sdk) and then accessed through getter functions.
Initialization
Data must be initialized before use. This is typically handled by @1delta/initializer-sdk:
import { fetchLenderMetaFromDirAndInitializeAll } from '@1delta/initializer-sdk'
// Loads all deployment data from the lender-metadata repo
await fetchLenderMetaFromDirAndInitializeAll()Or initialize directly with custom data:
import { initializeLenderData, initializeChainData } from '@1delta/data-sdk'
initializeLenderData({
aavePoolsOverride: myAavePools,
compoundV2PoolsOverride: myCompoundPools,
// ... other overrides
})
initializeChainData({
chainsOverride: myChainInfo,
})Lending Data
All lending getters are synchronous and return data from the global registry.
Aave (V2 / V3 / all forks)
Covers: AAVE_V3, SPARK, LENDLE, ZEROLEND, AVALON, RADIANT_V2, KINZA, YLDR, and 70+ other forks.
aavePools()
Pool and data provider addresses per fork per chain.
import { aavePools } from '@1delta/data-sdk'
const pools = aavePools()
// {
// AAVE_V3: {
// '1': { pool: '0x87870...', protocolDataProvider: '0x7B4E...' },
// '56': { pool: '0x6807...', protocolDataProvider: '0x23dF...' },
// },
// SPARK: {
// '1': { pool: '0xC13e...', protocolDataProvider: '0xFc21...' },
// },
// ZEROLEND: { ... },
// ...
// }
// Type: { [fork: string]: { [chainId: string]: { pool: string; protocolDataProvider: string } } }aaveReserves()
List of underlying asset addresses per fork per chain.
import { aaveReserves } from '@1delta/data-sdk'
const reserves = aaveReserves()
// {
// AAVE_V3: {
// '1': ['0xC02a...', '0x6B17...', '0xdAC1...'], // WETH, DAI, USDT, ...
// '56': ['0xbb4C...', '0x55d3...'],
// },
// ...
// }
// Type: { [fork: string]: { [chainId: string]: string[] } }aaveTokens()
Mapping of underlying assets to their aToken, sToken, and vToken addresses.
import { aaveTokens } from '@1delta/data-sdk'
const tokens = aaveTokens()
// {
// AAVE_V3: {
// '1': {
// '0xC02a...': { // WETH underlying
// aToken: '0x4d5F...',
// sToken: '0x102e...',
// vToken: '0xeA51...',
// },
// ...
// },
// },
// }
// Type: { [fork: string]: { [chainId: string]: { [underlying: string]: { aToken: string; sToken: string; vToken: string } } } }aaveOracles()
Price oracle addresses per fork per chain.
import { aaveOracles } from '@1delta/data-sdk'
const oracles = aaveOracles()
// { AAVE_V3: { '1': '0x54586...', '56': '0x6970...' }, ... }
// Type: { [lender: string]: { [chainId: string]: string } }aaveWethGateway()
WETH gateway contract addresses for native asset wrapping.
import { aaveWethGateway } from '@1delta/data-sdk'
const gateways = aaveWethGateway()
// { AAVE_V3: { '1': '0xD322...' }, SPARK: { '1': '0x...' }, ... }
// Type: { [fork: string]: { [chainId: string]: string } }Compound V2 (all forks)
Covers: COMPOUND_V2, VENUS (+ pool variants), BENQI, MENDI, MOONWELL, TECTONIC, ENCLABS, and 30+ other forks.
compoundV2Pools()
Comptroller addresses per fork per chain.
import { compoundV2Pools } from '@1delta/data-sdk'
const pools = compoundV2Pools()
// {
// COMPOUND_V2: { '1': '0x3d9819...' },
// VENUS: { '56': '0xfD36E2...' },
// VENUS_ETH: { '56': '0x...' },
// BENQI: { '43114': '0x486Af...' },
// ...
// }
// Type: { [fork: string]: { [chainId: string]: string } }compoundV2Reserves()
Reserve asset addresses per fork per chain.
import { compoundV2Reserves } from '@1delta/data-sdk'
const reserves = compoundV2Reserves()
// { VENUS: { '56': ['0xbb4C...', '0x55d3...'] }, ... }
// Type: { [fork: string]: { [chainId: string]: string[] } }compoundV2TokenArray()
cToken to underlying mapping as an array (preferred for iteration).
import { compoundV2TokenArray } from '@1delta/data-sdk'
const tokenArray = compoundV2TokenArray()
// {
// VENUS: {
// '56': [
// { cToken: '0xA07c5b74...', underlying: '0xbb4CdB9C...' },
// { cToken: '0xecA88125...', underlying: '0x55d398326...' },
// ],
// },
// }
// Type: { [lender: string]: { [chainId: string]: Array<{ cToken: string; underlying: string }> } }compoundV2Tokens()
cToken address mapping (keyed by address).
import { compoundV2Tokens } from '@1delta/data-sdk'
const tokens = compoundV2Tokens()
// { VENUS: { '56': { '0xA07c5b74...': '0xbb4CdB9C...' } } }
// Type: { [lender: string]: { [chainId: string]: { [cTokenAddress: string]: string } } }compoundV2Oracles()
Oracle addresses per fork per chain.
import { compoundV2Oracles } from '@1delta/data-sdk'
const oracles = compoundV2Oracles()
// { VENUS: { '56': '0xd8B6dA...' }, ... }
// Type: { [lender: string]: { [chainId: string]: string } }Compound V3 (Comet)
Covers: COMPOUND_V3_USDC, COMPOUND_V3_USDT, COMPOUND_V3_WETH, COMPOUND_V3_WSTETH, and other Comet markets.
compoundV3Pools()
Comet proxy addresses. Note: keyed by chainId first, then by comet/lender name.
import { compoundV3Pools } from '@1delta/data-sdk'
const pools = compoundV3Pools()
// {
// '1': {
// 'COMPOUND_V3_USDC': '0xc3d688...',
// 'COMPOUND_V3_WETH': '0xA17581...',
// },
// '42161': {
// 'COMPOUND_V3_USDC': '0xA5EDBDD...',
// },
// }
// Type: { [chainId: string]: { [comet: string]: string } }compoundV3BaseData()
Base asset and minimum borrow amount per Comet market.
import { compoundV3BaseData } from '@1delta/data-sdk'
const baseData = compoundV3BaseData()
// {
// COMPOUND_V3_USDC: {
// '1': { baseAsset: '0xA0b86991...', baseBorrowMin: 100000000n },
// },
// }
// Type: { [lender: string]: { [chainId: string]: { baseAsset: string; baseBorrowMin: bigint } } }compoundV3Reserves()
Collateral asset addresses per Comet market.
import { compoundV3Reserves } from '@1delta/data-sdk'
const reserves = compoundV3Reserves()
// { COMPOUND_V3_USDC: { '1': ['0xC02a...', '0x2260...'] }, ... }
// Type: { [fork: string]: { [chainId: string]: string[] } }compoundV3OraclesData()
Per-asset oracle addresses and descriptions for Comet markets.
import { compoundV3OraclesData } from '@1delta/data-sdk'
const oracles = compoundV3OraclesData()
// {
// COMPOUND_V3_USDC: {
// '1': {
// '0xC02a...': { oracle: '0x5f4eC3...', description: 'ETH / USD' },
// '0x2260...': { oracle: '0xF4030...', description: 'BTC / USD' },
// },
// },
// }
// Type: { [lender: string]: { [chainId: string]: { [assetAddress: string]: { oracle: string; description: string } } } }compoundV3Bulker()
Bulker contract addresses for batched Comet operations.
import { compoundV3Bulker } from '@1delta/data-sdk'
const bulkers = compoundV3Bulker()
// { COMPOUND_V3_USDC: { '1': '0xa397...' }, ... }
// Type: { [lender: string]: { [chainId: string]: string } }Morpho Blue
Covers: MORPHO_BLUE, LISTA_DAO.
morphoPools()
Morpho Blue singleton contract addresses.
import { morphoPools } from '@1delta/data-sdk'
const pools = morphoPools()
// {
// MORPHO_BLUE: { '1': '0xBBBBBbb...', '8453': '0xBBBBBbb...' },
// LISTA_DAO: { '56': '0x...' },
// }
// Type: { [fork: string]: { [chainId: string]: string } }morphoTypeMarkets()
Market IDs (hashes) per protocol per chain.
import { morphoTypeMarkets } from '@1delta/data-sdk'
const markets = morphoTypeMarkets()
// {
// MORPHO_BLUE: {
// '1': ['0xb323495f...', '0xc54d7ac...', ...],
// '8453': ['0x1234...', ...],
// },
// LISTA_DAO: {
// '56': ['0xabcd...', ...],
// },
// }
// Type: { [protocol: string]: { [chainId: string]: string[] } }morphoOracles()
Oracle info per market (keyed by market hash or chain).
import { morphoOracles } from '@1delta/data-sdk'
const oracles = morphoOracles()
// {
// '0xb323495f...': [{
// oracle: '0x...',
// loanAsset: '0xA0b8...',
// collateralAsset: '0xC02a...',
// loanAssetDecimals: 6,
// collateralAssetDecimals: 18,
// }],
// }
// Type: { [key: string]: MrophoOracleInfo[] }morphoTypeOracles()
Oracle info grouped by chain then protocol.
import { morphoTypeOracles } from '@1delta/data-sdk'
const oracles = morphoTypeOracles()
// {
// '1': {
// 'MORPHO_BLUE': [{ oracle, loanAsset, collateralAsset, ... }],
// },
// }
// Type: { [chainId: string]: { [protocol: string]: MrophoOracleInfo[] } }morphoBundler3()
Morpho Bundler3 and adapter contract addresses.
import { morphoBundler3 } from '@1delta/data-sdk'
const bundlers = morphoBundler3()
// {
// '1': {
// bundler3: '0x...',
// generalAdapter1: '0x...',
// paraswapAdapter: '0x...',
// aaveV3CoreMigrationAdapter: '0x...',
// // ... other optional adapters
// },
// }
// Type: { [chainId: string]: MorphoBundler3ChainConfig }Euler V2
eulerConfigs()
Core Euler V2 infrastructure addresses.
import { eulerConfigs } from '@1delta/data-sdk'
const configs = eulerConfigs()
// {
// EULER_V2: {
// '1': {
// evc: '0x...',
// eVaultFactory: '0x...',
// protocolConfig: '0x...',
// vaultLens: '0x...',
// accountLens: '0x...',
// oracleLens: '0x...',
// irmLens: '0x...',
// utilsLens: '0x...',
// },
// },
// }
// Type: { [fork: string]: { [chainId: string]: EulerConfigEntry } }eulerVaults()
Vault addresses and their underlying assets.
import { eulerVaults } from '@1delta/data-sdk'
const vaults = eulerVaults()
// {
// EULER_V2: {
// '1': [
// { underlying: '0xC02a...', vault: '0x...' },
// { underlying: '0xA0b8...', vault: '0x...' },
// ],
// },
// }
// Type: { [fork: string]: { [chainId: string]: Array<{ underlying: string; vault: string }> } }Init Protocol
initConfig()
Init protocol pool configurations.
import { initConfig } from '@1delta/data-sdk'
const config = initConfig()
// {
// INIT: {
// '5000': [
// { pool: '0x...', underlying: '0x...', modes: [1, 2] },
// ],
// },
// }
// Type: { [lender: string]: { [chainId: string]: Array<{ pool: string; underlying: string; modes: number[] }> } }Lista DAO
listaNativeProvider()
Lista DAO native asset provider addresses.
import { listaNativeProvider } from '@1delta/data-sdk'
const providers = listaNativeProvider()
// { '56': { nativeProvider: '0x...' } }
// Type: { [chainId: string]: { nativeProvider: string } }Chain Data
chains()
Chain metadata for all supported networks.
import { chains } from '@1delta/data-sdk'
const allChains = chains()
// {
// '1': {
// name: 'Ethereum Mainnet',
// chain: 'ETH',
// chainId: '1',
// rpc: ['https://...'],
// nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
// explorers: [{ name: 'Etherscan', url: 'https://etherscan.io', standard: 'EIP3091' }],
// enum: 'ETHEREUM',
// ...
// },
// '56': { name: 'BNB Smart Chain', ... },
// }
// Type: { [chainId: string]: ChainInfo }Token Lists
Token data is fetched remotely from github.com/1delta-DAO/token-lists.
fetchTokenList(chainId)
import { fetchTokenList } from '@1delta/data-sdk'
const tokens = await fetchTokenList('1')
// {
// '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': {
// chainId: '1',
// name: 'Wrapped Ether',
// address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
// symbol: 'WETH',
// decimals: 18,
// logoURI: 'https://...',
// assetGroup: 'ETH',
// },
// ...
// }
// Type: { [address: string]: TokenListEntry }fetchTokenLists(chainIds)
Batch fetch token lists for multiple chains in parallel.
import { fetchTokenLists } from '@1delta/data-sdk'
const lists = await fetchTokenLists(['1', '56', '42161'])
// { '1': { ... }, '56': { ... }, '42161': { ... } }
// Type: { [chainId: string]: TokenList }Enumerating All Deployments
A common pattern for iterating over all lender+chain pairs:
import { aavePools, compoundV2Pools, compoundV3Pools, morphoPools, eulerConfigs } from '@1delta/data-sdk'
const deployments: { lender: string; chainId: string }[] = []
// Aave forks: [fork] -> [chainId] -> pool config
for (const [lender, chains] of Object.entries(aavePools() ?? {})) {
for (const chainId of Object.keys(chains)) {
deployments.push({ lender, chainId })
}
}
// Compound V2 forks: [fork] -> [chainId] -> comptroller
for (const [lender, chains] of Object.entries(compoundV2Pools() ?? {})) {
for (const chainId of Object.keys(chains)) {
deployments.push({ lender, chainId })
}
}
// Compound V3: [chainId] -> [comet] -> address (note: different nesting)
for (const [chainId, comets] of Object.entries(compoundV3Pools() ?? {})) {
for (const lender of Object.keys(comets)) {
deployments.push({ lender, chainId })
}
}
// Morpho: [fork] -> [chainId] -> singleton address
for (const [lender, chains] of Object.entries(morphoPools() ?? {})) {
for (const chainId of Object.keys(chains)) {
deployments.push({ lender, chainId })
}
}
// Euler: [fork] -> [chainId] -> config
for (const [lender, chains] of Object.entries(eulerConfigs() ?? {})) {
for (const chainId of Object.keys(chains)) {
deployments.push({ lender, chainId })
}
}Data Source
All deployment data originates from the 1delta-DAO/lender-metadata GitHub repository and is loaded at runtime by @1delta/initializer-sdk. The data-sdk itself contains no hardcoded deployment data — it only provides the typed getter/setter interface to the global registry.
| Source file | Getter |
|-------------|--------|
| config/aave-pools.json | aavePools() |
| config/compound-v2-pools.json | compoundV2Pools() |
| config/compound-v3-pools.json | compoundV3Pools() |
| config/morpho-pools.json | morphoPools() |
| config/euler-configs.json | eulerConfigs() |
| config/init-pools.json | initConfig() |
| data/aave-reserves.json | aaveReserves() |
| data/aave-tokens.json | aaveTokens() |
| data/compound-v2-reserves.json | compoundV2Reserves() |
| data/compound-v2-c-tokens.json | compoundV2Tokens() |
| data/compound-v2-tokens.json | compoundV2TokenArray() |
| data/compound-v3-base-data.json | compoundV3BaseData() |
| data/compound-v3-reserves.json | compoundV3Reserves() |
| data/euler-vaults.json | eulerVaults() |
