@1delta/data-sdk 0.0.16 → 0.0.18
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/README.md +658 -0
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/dist/lending.d.ts +14 -6
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
# @1delta/data-sdk
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @1delta/data-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The SDK is a **read-only data layer** organized into three modules:
|
|
14
|
+
|
|
15
|
+
| Module | Description |
|
|
16
|
+
|--------|-------------|
|
|
17
|
+
| **Lending** | Pool configs, reserves, tokens, oracles for all lending protocols |
|
|
18
|
+
| **Chains** | Chain metadata (RPC endpoints, explorers, native currency) |
|
|
19
|
+
| **Tokens** | Token lists per chain (fetched from remote) |
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Initialization
|
|
26
|
+
|
|
27
|
+
Data must be initialized before use. This is typically handled by `@1delta/initializer-sdk`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { fetchLenderMetaFromDirAndInitializeAll } from '@1delta/initializer-sdk'
|
|
31
|
+
|
|
32
|
+
// Loads all deployment data from the lender-metadata repo
|
|
33
|
+
await fetchLenderMetaFromDirAndInitializeAll()
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or initialize directly with custom data:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { initializeLenderData, initializeChainData } from '@1delta/data-sdk'
|
|
40
|
+
|
|
41
|
+
initializeLenderData({
|
|
42
|
+
aavePoolsOverride: myAavePools,
|
|
43
|
+
compoundV2PoolsOverride: myCompoundPools,
|
|
44
|
+
// ... other overrides
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
initializeChainData({
|
|
48
|
+
chainsOverride: myChainInfo,
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Lending Data
|
|
55
|
+
|
|
56
|
+
All lending getters are synchronous and return data from the global registry.
|
|
57
|
+
|
|
58
|
+
### Aave (V2 / V3 / all forks)
|
|
59
|
+
|
|
60
|
+
Covers: AAVE_V3, SPARK, LENDLE, ZEROLEND, AVALON, RADIANT_V2, KINZA, YLDR, and 70+ other forks.
|
|
61
|
+
|
|
62
|
+
#### `aavePools()`
|
|
63
|
+
|
|
64
|
+
Pool and data provider addresses per fork per chain.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { aavePools } from '@1delta/data-sdk'
|
|
68
|
+
|
|
69
|
+
const pools = aavePools()
|
|
70
|
+
// {
|
|
71
|
+
// AAVE_V3: {
|
|
72
|
+
// '1': { pool: '0x87870...', protocolDataProvider: '0x7B4E...' },
|
|
73
|
+
// '56': { pool: '0x6807...', protocolDataProvider: '0x23dF...' },
|
|
74
|
+
// },
|
|
75
|
+
// SPARK: {
|
|
76
|
+
// '1': { pool: '0xC13e...', protocolDataProvider: '0xFc21...' },
|
|
77
|
+
// },
|
|
78
|
+
// ZEROLEND: { ... },
|
|
79
|
+
// ...
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
// Type: { [fork: string]: { [chainId: string]: { pool: string; protocolDataProvider: string } } }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### `aaveReserves()`
|
|
86
|
+
|
|
87
|
+
List of underlying asset addresses per fork per chain.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { aaveReserves } from '@1delta/data-sdk'
|
|
91
|
+
|
|
92
|
+
const reserves = aaveReserves()
|
|
93
|
+
// {
|
|
94
|
+
// AAVE_V3: {
|
|
95
|
+
// '1': ['0xC02a...', '0x6B17...', '0xdAC1...'], // WETH, DAI, USDT, ...
|
|
96
|
+
// '56': ['0xbb4C...', '0x55d3...'],
|
|
97
|
+
// },
|
|
98
|
+
// ...
|
|
99
|
+
// }
|
|
100
|
+
|
|
101
|
+
// Type: { [fork: string]: { [chainId: string]: string[] } }
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### `aaveTokens()`
|
|
105
|
+
|
|
106
|
+
Mapping of underlying assets to their aToken, sToken, and vToken addresses.
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { aaveTokens } from '@1delta/data-sdk'
|
|
110
|
+
|
|
111
|
+
const tokens = aaveTokens()
|
|
112
|
+
// {
|
|
113
|
+
// AAVE_V3: {
|
|
114
|
+
// '1': {
|
|
115
|
+
// '0xC02a...': { // WETH underlying
|
|
116
|
+
// aToken: '0x4d5F...',
|
|
117
|
+
// sToken: '0x102e...',
|
|
118
|
+
// vToken: '0xeA51...',
|
|
119
|
+
// },
|
|
120
|
+
// ...
|
|
121
|
+
// },
|
|
122
|
+
// },
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
// Type: { [fork: string]: { [chainId: string]: { [underlying: string]: { aToken: string; sToken: string; vToken: string } } } }
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### `aaveOracles()`
|
|
129
|
+
|
|
130
|
+
Price oracle addresses per fork per chain.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { aaveOracles } from '@1delta/data-sdk'
|
|
134
|
+
|
|
135
|
+
const oracles = aaveOracles()
|
|
136
|
+
// { AAVE_V3: { '1': '0x54586...', '56': '0x6970...' }, ... }
|
|
137
|
+
|
|
138
|
+
// Type: { [lender: string]: { [chainId: string]: string } }
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
#### `aaveWethGateway()`
|
|
142
|
+
|
|
143
|
+
WETH gateway contract addresses for native asset wrapping.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { aaveWethGateway } from '@1delta/data-sdk'
|
|
147
|
+
|
|
148
|
+
const gateways = aaveWethGateway()
|
|
149
|
+
// { AAVE_V3: { '1': '0xD322...' }, SPARK: { '1': '0x...' }, ... }
|
|
150
|
+
|
|
151
|
+
// Type: { [fork: string]: { [chainId: string]: string } }
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Compound V2 (all forks)
|
|
157
|
+
|
|
158
|
+
Covers: COMPOUND_V2, VENUS (+ pool variants), BENQI, MENDI, MOONWELL, TECTONIC, ENCLABS, and 30+ other forks.
|
|
159
|
+
|
|
160
|
+
#### `compoundV2Pools()`
|
|
161
|
+
|
|
162
|
+
Comptroller addresses per fork per chain.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { compoundV2Pools } from '@1delta/data-sdk'
|
|
166
|
+
|
|
167
|
+
const pools = compoundV2Pools()
|
|
168
|
+
// {
|
|
169
|
+
// COMPOUND_V2: { '1': '0x3d9819...' },
|
|
170
|
+
// VENUS: { '56': '0xfD36E2...' },
|
|
171
|
+
// VENUS_ETH: { '56': '0x...' },
|
|
172
|
+
// BENQI: { '43114': '0x486Af...' },
|
|
173
|
+
// ...
|
|
174
|
+
// }
|
|
175
|
+
|
|
176
|
+
// Type: { [fork: string]: { [chainId: string]: string } }
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### `compoundV2Reserves()`
|
|
180
|
+
|
|
181
|
+
Reserve asset addresses per fork per chain.
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
import { compoundV2Reserves } from '@1delta/data-sdk'
|
|
185
|
+
|
|
186
|
+
const reserves = compoundV2Reserves()
|
|
187
|
+
// { VENUS: { '56': ['0xbb4C...', '0x55d3...'] }, ... }
|
|
188
|
+
|
|
189
|
+
// Type: { [fork: string]: { [chainId: string]: string[] } }
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### `compoundV2TokenArray()`
|
|
193
|
+
|
|
194
|
+
cToken to underlying mapping as an array (preferred for iteration).
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { compoundV2TokenArray } from '@1delta/data-sdk'
|
|
198
|
+
|
|
199
|
+
const tokenArray = compoundV2TokenArray()
|
|
200
|
+
// {
|
|
201
|
+
// VENUS: {
|
|
202
|
+
// '56': [
|
|
203
|
+
// { cToken: '0xA07c5b74...', underlying: '0xbb4CdB9C...' },
|
|
204
|
+
// { cToken: '0xecA88125...', underlying: '0x55d398326...' },
|
|
205
|
+
// ],
|
|
206
|
+
// },
|
|
207
|
+
// }
|
|
208
|
+
|
|
209
|
+
// Type: { [lender: string]: { [chainId: string]: Array<{ cToken: string; underlying: string }> } }
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### `compoundV2Tokens()`
|
|
213
|
+
|
|
214
|
+
cToken address mapping (keyed by address).
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
import { compoundV2Tokens } from '@1delta/data-sdk'
|
|
218
|
+
|
|
219
|
+
const tokens = compoundV2Tokens()
|
|
220
|
+
// { VENUS: { '56': { '0xA07c5b74...': '0xbb4CdB9C...' } } }
|
|
221
|
+
|
|
222
|
+
// Type: { [lender: string]: { [chainId: string]: { [cTokenAddress: string]: string } } }
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### `compoundV2Oracles()`
|
|
226
|
+
|
|
227
|
+
Oracle addresses per fork per chain.
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
import { compoundV2Oracles } from '@1delta/data-sdk'
|
|
231
|
+
|
|
232
|
+
const oracles = compoundV2Oracles()
|
|
233
|
+
// { VENUS: { '56': '0xd8B6dA...' }, ... }
|
|
234
|
+
|
|
235
|
+
// Type: { [lender: string]: { [chainId: string]: string } }
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### Compound V3 (Comet)
|
|
241
|
+
|
|
242
|
+
Covers: COMPOUND_V3_USDC, COMPOUND_V3_USDT, COMPOUND_V3_WETH, COMPOUND_V3_WSTETH, and other Comet markets.
|
|
243
|
+
|
|
244
|
+
#### `compoundV3Pools()`
|
|
245
|
+
|
|
246
|
+
Comet proxy addresses. Note: keyed by `chainId` first, then by comet/lender name.
|
|
247
|
+
|
|
248
|
+
```ts
|
|
249
|
+
import { compoundV3Pools } from '@1delta/data-sdk'
|
|
250
|
+
|
|
251
|
+
const pools = compoundV3Pools()
|
|
252
|
+
// {
|
|
253
|
+
// '1': {
|
|
254
|
+
// 'COMPOUND_V3_USDC': '0xc3d688...',
|
|
255
|
+
// 'COMPOUND_V3_WETH': '0xA17581...',
|
|
256
|
+
// },
|
|
257
|
+
// '42161': {
|
|
258
|
+
// 'COMPOUND_V3_USDC': '0xA5EDBDD...',
|
|
259
|
+
// },
|
|
260
|
+
// }
|
|
261
|
+
|
|
262
|
+
// Type: { [chainId: string]: { [comet: string]: string } }
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### `compoundV3BaseData()`
|
|
266
|
+
|
|
267
|
+
Base asset and minimum borrow amount per Comet market.
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
import { compoundV3BaseData } from '@1delta/data-sdk'
|
|
271
|
+
|
|
272
|
+
const baseData = compoundV3BaseData()
|
|
273
|
+
// {
|
|
274
|
+
// COMPOUND_V3_USDC: {
|
|
275
|
+
// '1': { baseAsset: '0xA0b86991...', baseBorrowMin: 100000000n },
|
|
276
|
+
// },
|
|
277
|
+
// }
|
|
278
|
+
|
|
279
|
+
// Type: { [lender: string]: { [chainId: string]: { baseAsset: string; baseBorrowMin: bigint } } }
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
#### `compoundV3Reserves()`
|
|
283
|
+
|
|
284
|
+
Collateral asset addresses per Comet market.
|
|
285
|
+
|
|
286
|
+
```ts
|
|
287
|
+
import { compoundV3Reserves } from '@1delta/data-sdk'
|
|
288
|
+
|
|
289
|
+
const reserves = compoundV3Reserves()
|
|
290
|
+
// { COMPOUND_V3_USDC: { '1': ['0xC02a...', '0x2260...'] }, ... }
|
|
291
|
+
|
|
292
|
+
// Type: { [fork: string]: { [chainId: string]: string[] } }
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
#### `compoundV3OraclesData()`
|
|
296
|
+
|
|
297
|
+
Per-asset oracle addresses and descriptions for Comet markets.
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
import { compoundV3OraclesData } from '@1delta/data-sdk'
|
|
301
|
+
|
|
302
|
+
const oracles = compoundV3OraclesData()
|
|
303
|
+
// {
|
|
304
|
+
// COMPOUND_V3_USDC: {
|
|
305
|
+
// '1': {
|
|
306
|
+
// '0xC02a...': { oracle: '0x5f4eC3...', description: 'ETH / USD' },
|
|
307
|
+
// '0x2260...': { oracle: '0xF4030...', description: 'BTC / USD' },
|
|
308
|
+
// },
|
|
309
|
+
// },
|
|
310
|
+
// }
|
|
311
|
+
|
|
312
|
+
// Type: { [lender: string]: { [chainId: string]: { [assetAddress: string]: { oracle: string; description: string } } } }
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
#### `compoundV3Bulker()`
|
|
316
|
+
|
|
317
|
+
Bulker contract addresses for batched Comet operations.
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
import { compoundV3Bulker } from '@1delta/data-sdk'
|
|
321
|
+
|
|
322
|
+
const bulkers = compoundV3Bulker()
|
|
323
|
+
// { COMPOUND_V3_USDC: { '1': '0xa397...' }, ... }
|
|
324
|
+
|
|
325
|
+
// Type: { [lender: string]: { [chainId: string]: string } }
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
### Morpho Blue
|
|
331
|
+
|
|
332
|
+
Covers: MORPHO_BLUE, LISTA_DAO.
|
|
333
|
+
|
|
334
|
+
#### `morphoPools()`
|
|
335
|
+
|
|
336
|
+
Morpho Blue singleton contract addresses.
|
|
337
|
+
|
|
338
|
+
```ts
|
|
339
|
+
import { morphoPools } from '@1delta/data-sdk'
|
|
340
|
+
|
|
341
|
+
const pools = morphoPools()
|
|
342
|
+
// {
|
|
343
|
+
// MORPHO_BLUE: { '1': '0xBBBBBbb...', '8453': '0xBBBBBbb...' },
|
|
344
|
+
// LISTA_DAO: { '56': '0x...' },
|
|
345
|
+
// }
|
|
346
|
+
|
|
347
|
+
// Type: { [fork: string]: { [chainId: string]: string } }
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
#### `morphoTypeMarkets()`
|
|
351
|
+
|
|
352
|
+
Market IDs (hashes) per protocol per chain.
|
|
353
|
+
|
|
354
|
+
```ts
|
|
355
|
+
import { morphoTypeMarkets } from '@1delta/data-sdk'
|
|
356
|
+
|
|
357
|
+
const markets = morphoTypeMarkets()
|
|
358
|
+
// {
|
|
359
|
+
// MORPHO_BLUE: {
|
|
360
|
+
// '1': ['0xb323495f...', '0xc54d7ac...', ...],
|
|
361
|
+
// '8453': ['0x1234...', ...],
|
|
362
|
+
// },
|
|
363
|
+
// LISTA_DAO: {
|
|
364
|
+
// '56': ['0xabcd...', ...],
|
|
365
|
+
// },
|
|
366
|
+
// }
|
|
367
|
+
|
|
368
|
+
// Type: { [protocol: string]: { [chainId: string]: string[] } }
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
#### `morphoOracles()`
|
|
372
|
+
|
|
373
|
+
Oracle info per market (keyed by market hash or chain).
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
import { morphoOracles } from '@1delta/data-sdk'
|
|
377
|
+
|
|
378
|
+
const oracles = morphoOracles()
|
|
379
|
+
// {
|
|
380
|
+
// '0xb323495f...': [{
|
|
381
|
+
// oracle: '0x...',
|
|
382
|
+
// loanAsset: '0xA0b8...',
|
|
383
|
+
// collateralAsset: '0xC02a...',
|
|
384
|
+
// loanAssetDecimals: 6,
|
|
385
|
+
// collateralAssetDecimals: 18,
|
|
386
|
+
// }],
|
|
387
|
+
// }
|
|
388
|
+
|
|
389
|
+
// Type: { [key: string]: MrophoOracleInfo[] }
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
#### `morphoTypeOracles()`
|
|
393
|
+
|
|
394
|
+
Oracle info grouped by chain then protocol.
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
import { morphoTypeOracles } from '@1delta/data-sdk'
|
|
398
|
+
|
|
399
|
+
const oracles = morphoTypeOracles()
|
|
400
|
+
// {
|
|
401
|
+
// '1': {
|
|
402
|
+
// 'MORPHO_BLUE': [{ oracle, loanAsset, collateralAsset, ... }],
|
|
403
|
+
// },
|
|
404
|
+
// }
|
|
405
|
+
|
|
406
|
+
// Type: { [chainId: string]: { [protocol: string]: MrophoOracleInfo[] } }
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### `morphoBundler3()`
|
|
410
|
+
|
|
411
|
+
Morpho Bundler3 and adapter contract addresses.
|
|
412
|
+
|
|
413
|
+
```ts
|
|
414
|
+
import { morphoBundler3 } from '@1delta/data-sdk'
|
|
415
|
+
|
|
416
|
+
const bundlers = morphoBundler3()
|
|
417
|
+
// {
|
|
418
|
+
// '1': {
|
|
419
|
+
// bundler3: '0x...',
|
|
420
|
+
// generalAdapter1: '0x...',
|
|
421
|
+
// paraswapAdapter: '0x...',
|
|
422
|
+
// aaveV3CoreMigrationAdapter: '0x...',
|
|
423
|
+
// // ... other optional adapters
|
|
424
|
+
// },
|
|
425
|
+
// }
|
|
426
|
+
|
|
427
|
+
// Type: { [chainId: string]: MorphoBundler3ChainConfig }
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### Euler V2
|
|
433
|
+
|
|
434
|
+
#### `eulerConfigs()`
|
|
435
|
+
|
|
436
|
+
Core Euler V2 infrastructure addresses.
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
import { eulerConfigs } from '@1delta/data-sdk'
|
|
440
|
+
|
|
441
|
+
const configs = eulerConfigs()
|
|
442
|
+
// {
|
|
443
|
+
// EULER_V2: {
|
|
444
|
+
// '1': {
|
|
445
|
+
// evc: '0x...',
|
|
446
|
+
// eVaultFactory: '0x...',
|
|
447
|
+
// protocolConfig: '0x...',
|
|
448
|
+
// vaultLens: '0x...',
|
|
449
|
+
// accountLens: '0x...',
|
|
450
|
+
// oracleLens: '0x...',
|
|
451
|
+
// irmLens: '0x...',
|
|
452
|
+
// utilsLens: '0x...',
|
|
453
|
+
// },
|
|
454
|
+
// },
|
|
455
|
+
// }
|
|
456
|
+
|
|
457
|
+
// Type: { [fork: string]: { [chainId: string]: EulerConfigEntry } }
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### `eulerVaults()`
|
|
461
|
+
|
|
462
|
+
Vault addresses and their underlying assets.
|
|
463
|
+
|
|
464
|
+
```ts
|
|
465
|
+
import { eulerVaults } from '@1delta/data-sdk'
|
|
466
|
+
|
|
467
|
+
const vaults = eulerVaults()
|
|
468
|
+
// {
|
|
469
|
+
// EULER_V2: {
|
|
470
|
+
// '1': [
|
|
471
|
+
// { underlying: '0xC02a...', vault: '0x...' },
|
|
472
|
+
// { underlying: '0xA0b8...', vault: '0x...' },
|
|
473
|
+
// ],
|
|
474
|
+
// },
|
|
475
|
+
// }
|
|
476
|
+
|
|
477
|
+
// Type: { [fork: string]: { [chainId: string]: Array<{ underlying: string; vault: string }> } }
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
### Init Protocol
|
|
483
|
+
|
|
484
|
+
#### `initConfig()`
|
|
485
|
+
|
|
486
|
+
Init protocol pool configurations.
|
|
487
|
+
|
|
488
|
+
```ts
|
|
489
|
+
import { initConfig } from '@1delta/data-sdk'
|
|
490
|
+
|
|
491
|
+
const config = initConfig()
|
|
492
|
+
// {
|
|
493
|
+
// INIT: {
|
|
494
|
+
// '5000': [
|
|
495
|
+
// { pool: '0x...', underlying: '0x...', modes: [1, 2] },
|
|
496
|
+
// ],
|
|
497
|
+
// },
|
|
498
|
+
// }
|
|
499
|
+
|
|
500
|
+
// Type: { [lender: string]: { [chainId: string]: Array<{ pool: string; underlying: string; modes: number[] }> } }
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
### Lista DAO
|
|
506
|
+
|
|
507
|
+
#### `listaNativeProvider()`
|
|
508
|
+
|
|
509
|
+
Lista DAO native asset provider addresses.
|
|
510
|
+
|
|
511
|
+
```ts
|
|
512
|
+
import { listaNativeProvider } from '@1delta/data-sdk'
|
|
513
|
+
|
|
514
|
+
const providers = listaNativeProvider()
|
|
515
|
+
// { '56': { nativeProvider: '0x...' } }
|
|
516
|
+
|
|
517
|
+
// Type: { [chainId: string]: { nativeProvider: string } }
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## Chain Data
|
|
523
|
+
|
|
524
|
+
#### `chains()`
|
|
525
|
+
|
|
526
|
+
Chain metadata for all supported networks.
|
|
527
|
+
|
|
528
|
+
```ts
|
|
529
|
+
import { chains } from '@1delta/data-sdk'
|
|
530
|
+
|
|
531
|
+
const allChains = chains()
|
|
532
|
+
// {
|
|
533
|
+
// '1': {
|
|
534
|
+
// name: 'Ethereum Mainnet',
|
|
535
|
+
// chain: 'ETH',
|
|
536
|
+
// chainId: '1',
|
|
537
|
+
// rpc: ['https://...'],
|
|
538
|
+
// nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
539
|
+
// explorers: [{ name: 'Etherscan', url: 'https://etherscan.io', standard: 'EIP3091' }],
|
|
540
|
+
// enum: 'ETHEREUM',
|
|
541
|
+
// ...
|
|
542
|
+
// },
|
|
543
|
+
// '56': { name: 'BNB Smart Chain', ... },
|
|
544
|
+
// }
|
|
545
|
+
|
|
546
|
+
// Type: { [chainId: string]: ChainInfo }
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## Token Lists
|
|
552
|
+
|
|
553
|
+
Token data is fetched remotely from `github.com/1delta-DAO/token-lists`.
|
|
554
|
+
|
|
555
|
+
#### `fetchTokenList(chainId)`
|
|
556
|
+
|
|
557
|
+
```ts
|
|
558
|
+
import { fetchTokenList } from '@1delta/data-sdk'
|
|
559
|
+
|
|
560
|
+
const tokens = await fetchTokenList('1')
|
|
561
|
+
// {
|
|
562
|
+
// '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2': {
|
|
563
|
+
// chainId: '1',
|
|
564
|
+
// name: 'Wrapped Ether',
|
|
565
|
+
// address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
566
|
+
// symbol: 'WETH',
|
|
567
|
+
// decimals: 18,
|
|
568
|
+
// logoURI: 'https://...',
|
|
569
|
+
// assetGroup: 'ETH',
|
|
570
|
+
// },
|
|
571
|
+
// ...
|
|
572
|
+
// }
|
|
573
|
+
|
|
574
|
+
// Type: { [address: string]: TokenListEntry }
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
#### `fetchTokenLists(chainIds)`
|
|
578
|
+
|
|
579
|
+
Batch fetch token lists for multiple chains in parallel.
|
|
580
|
+
|
|
581
|
+
```ts
|
|
582
|
+
import { fetchTokenLists } from '@1delta/data-sdk'
|
|
583
|
+
|
|
584
|
+
const lists = await fetchTokenLists(['1', '56', '42161'])
|
|
585
|
+
// { '1': { ... }, '56': { ... }, '42161': { ... } }
|
|
586
|
+
|
|
587
|
+
// Type: { [chainId: string]: TokenList }
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
## Enumerating All Deployments
|
|
593
|
+
|
|
594
|
+
A common pattern for iterating over all lender+chain pairs:
|
|
595
|
+
|
|
596
|
+
```ts
|
|
597
|
+
import { aavePools, compoundV2Pools, compoundV3Pools, morphoPools, eulerConfigs } from '@1delta/data-sdk'
|
|
598
|
+
|
|
599
|
+
const deployments: { lender: string; chainId: string }[] = []
|
|
600
|
+
|
|
601
|
+
// Aave forks: [fork] -> [chainId] -> pool config
|
|
602
|
+
for (const [lender, chains] of Object.entries(aavePools() ?? {})) {
|
|
603
|
+
for (const chainId of Object.keys(chains)) {
|
|
604
|
+
deployments.push({ lender, chainId })
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// Compound V2 forks: [fork] -> [chainId] -> comptroller
|
|
609
|
+
for (const [lender, chains] of Object.entries(compoundV2Pools() ?? {})) {
|
|
610
|
+
for (const chainId of Object.keys(chains)) {
|
|
611
|
+
deployments.push({ lender, chainId })
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
// Compound V3: [chainId] -> [comet] -> address (note: different nesting)
|
|
616
|
+
for (const [chainId, comets] of Object.entries(compoundV3Pools() ?? {})) {
|
|
617
|
+
for (const lender of Object.keys(comets)) {
|
|
618
|
+
deployments.push({ lender, chainId })
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// Morpho: [fork] -> [chainId] -> singleton address
|
|
623
|
+
for (const [lender, chains] of Object.entries(morphoPools() ?? {})) {
|
|
624
|
+
for (const chainId of Object.keys(chains)) {
|
|
625
|
+
deployments.push({ lender, chainId })
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Euler: [fork] -> [chainId] -> config
|
|
630
|
+
for (const [lender, chains] of Object.entries(eulerConfigs() ?? {})) {
|
|
631
|
+
for (const chainId of Object.keys(chains)) {
|
|
632
|
+
deployments.push({ lender, chainId })
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
## Data Source
|
|
640
|
+
|
|
641
|
+
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.
|
|
642
|
+
|
|
643
|
+
| Source file | Getter |
|
|
644
|
+
|-------------|--------|
|
|
645
|
+
| `config/aave-pools.json` | `aavePools()` |
|
|
646
|
+
| `config/compound-v2-pools.json` | `compoundV2Pools()` |
|
|
647
|
+
| `config/compound-v3-pools.json` | `compoundV3Pools()` |
|
|
648
|
+
| `config/morpho-pools.json` | `morphoPools()` |
|
|
649
|
+
| `config/euler-configs.json` | `eulerConfigs()` |
|
|
650
|
+
| `config/init-pools.json` | `initConfig()` |
|
|
651
|
+
| `data/aave-reserves.json` | `aaveReserves()` |
|
|
652
|
+
| `data/aave-tokens.json` | `aaveTokens()` |
|
|
653
|
+
| `data/compound-v2-reserves.json` | `compoundV2Reserves()` |
|
|
654
|
+
| `data/compound-v2-c-tokens.json` | `compoundV2Tokens()` |
|
|
655
|
+
| `data/compound-v2-tokens.json` | `compoundV2TokenArray()` |
|
|
656
|
+
| `data/compound-v3-base-data.json` | `compoundV3BaseData()` |
|
|
657
|
+
| `data/compound-v3-reserves.json` | `compoundV3Reserves()` |
|
|
658
|
+
| `data/euler-vaults.json` | `eulerVaults()` |
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ globalThis[GLOBAL_LENDER_DATA_KEY] = {
|
|
|
28
28
|
compoundV3Reserves: {},
|
|
29
29
|
aaveOracles: {},
|
|
30
30
|
compoundV2Oracles: {},
|
|
31
|
-
|
|
31
|
+
compoundV3OraclesData: {},
|
|
32
32
|
morphoOracles: {},
|
|
33
33
|
morphoTypeOracles: {},
|
|
34
34
|
morphoTypeMarkets: {},
|
|
@@ -47,7 +47,7 @@ function initializeLenderData({
|
|
|
47
47
|
aavePoolsOverride,
|
|
48
48
|
aaveOraclesOverride,
|
|
49
49
|
compoundV2OraclesOverride,
|
|
50
|
-
|
|
50
|
+
compoundV3OraclesDataOverride,
|
|
51
51
|
compoundV3PoolsOverride,
|
|
52
52
|
compoundV3BaseDataOverride,
|
|
53
53
|
morphoPoolsOverride,
|
|
@@ -72,7 +72,7 @@ function initializeLenderData({
|
|
|
72
72
|
if (aaveTokensOverride) data.aaveTokens = aaveTokensOverride;
|
|
73
73
|
if (aaveOraclesOverride) data.aaveOracles = aaveOraclesOverride;
|
|
74
74
|
if (compoundV2OraclesOverride) data.compoundV2Oracles = compoundV2OraclesOverride;
|
|
75
|
-
if (
|
|
75
|
+
if (compoundV3OraclesDataOverride) data.compoundV3OraclesData = compoundV3OraclesDataOverride;
|
|
76
76
|
if (aavePoolsOverride) data.aavePools = aavePoolsOverride;
|
|
77
77
|
if (compoundV3PoolsOverride) data.compoundV3Pools = compoundV3PoolsOverride;
|
|
78
78
|
if (morphoPoolsOverride) data.morphoPools = morphoPoolsOverride;
|
|
@@ -98,7 +98,7 @@ var aaveTokens = () => getGlobalData2()?.aaveTokens;
|
|
|
98
98
|
var aavePools = () => getGlobalData2()?.aavePools;
|
|
99
99
|
var aaveOracles = () => getGlobalData2()?.aaveOracles;
|
|
100
100
|
var compoundV2Oracles = () => getGlobalData2()?.compoundV2Oracles;
|
|
101
|
-
var
|
|
101
|
+
var compoundV3OraclesData = () => getGlobalData2()?.compoundV3OraclesData;
|
|
102
102
|
var morphoOracles = () => getGlobalData2()?.morphoOracles;
|
|
103
103
|
var morphoTypeOracles = () => getGlobalData2()?.morphoTypeOracles;
|
|
104
104
|
var morphoTypeMarkets = () => getGlobalData2()?.morphoTypeMarkets;
|
|
@@ -148,7 +148,7 @@ exports.compoundV2TokenArray = compoundV2TokenArray;
|
|
|
148
148
|
exports.compoundV2Tokens = compoundV2Tokens;
|
|
149
149
|
exports.compoundV3BaseData = compoundV3BaseData;
|
|
150
150
|
exports.compoundV3Bulker = compoundV3Bulker;
|
|
151
|
-
exports.
|
|
151
|
+
exports.compoundV3OraclesData = compoundV3OraclesData;
|
|
152
152
|
exports.compoundV3Pools = compoundV3Pools;
|
|
153
153
|
exports.compoundV3Reserves = compoundV3Reserves;
|
|
154
154
|
exports.eulerConfigs = eulerConfigs;
|
package/dist/index.mjs
CHANGED
|
@@ -26,7 +26,7 @@ globalThis[GLOBAL_LENDER_DATA_KEY] = {
|
|
|
26
26
|
compoundV3Reserves: {},
|
|
27
27
|
aaveOracles: {},
|
|
28
28
|
compoundV2Oracles: {},
|
|
29
|
-
|
|
29
|
+
compoundV3OraclesData: {},
|
|
30
30
|
morphoOracles: {},
|
|
31
31
|
morphoTypeOracles: {},
|
|
32
32
|
morphoTypeMarkets: {},
|
|
@@ -45,7 +45,7 @@ function initializeLenderData({
|
|
|
45
45
|
aavePoolsOverride,
|
|
46
46
|
aaveOraclesOverride,
|
|
47
47
|
compoundV2OraclesOverride,
|
|
48
|
-
|
|
48
|
+
compoundV3OraclesDataOverride,
|
|
49
49
|
compoundV3PoolsOverride,
|
|
50
50
|
compoundV3BaseDataOverride,
|
|
51
51
|
morphoPoolsOverride,
|
|
@@ -70,7 +70,7 @@ function initializeLenderData({
|
|
|
70
70
|
if (aaveTokensOverride) data.aaveTokens = aaveTokensOverride;
|
|
71
71
|
if (aaveOraclesOverride) data.aaveOracles = aaveOraclesOverride;
|
|
72
72
|
if (compoundV2OraclesOverride) data.compoundV2Oracles = compoundV2OraclesOverride;
|
|
73
|
-
if (
|
|
73
|
+
if (compoundV3OraclesDataOverride) data.compoundV3OraclesData = compoundV3OraclesDataOverride;
|
|
74
74
|
if (aavePoolsOverride) data.aavePools = aavePoolsOverride;
|
|
75
75
|
if (compoundV3PoolsOverride) data.compoundV3Pools = compoundV3PoolsOverride;
|
|
76
76
|
if (morphoPoolsOverride) data.morphoPools = morphoPoolsOverride;
|
|
@@ -96,7 +96,7 @@ var aaveTokens = () => getGlobalData2()?.aaveTokens;
|
|
|
96
96
|
var aavePools = () => getGlobalData2()?.aavePools;
|
|
97
97
|
var aaveOracles = () => getGlobalData2()?.aaveOracles;
|
|
98
98
|
var compoundV2Oracles = () => getGlobalData2()?.compoundV2Oracles;
|
|
99
|
-
var
|
|
99
|
+
var compoundV3OraclesData = () => getGlobalData2()?.compoundV3OraclesData;
|
|
100
100
|
var morphoOracles = () => getGlobalData2()?.morphoOracles;
|
|
101
101
|
var morphoTypeOracles = () => getGlobalData2()?.morphoTypeOracles;
|
|
102
102
|
var morphoTypeMarkets = () => getGlobalData2()?.morphoTypeMarkets;
|
|
@@ -133,4 +133,4 @@ async function fetchTokenLists(chainIds) {
|
|
|
133
133
|
return Object.fromEntries(results);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
export { aaveOracles, aavePools, aaveReserves, aaveTokens, aaveWethGateway, chains, compoundV2Oracles, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker,
|
|
136
|
+
export { aaveOracles, aavePools, aaveReserves, aaveTokens, aaveWethGateway, chains, compoundV2Oracles, compoundV2Pools, compoundV2Reserves, compoundV2TokenArray, compoundV2Tokens, compoundV3BaseData, compoundV3Bulker, compoundV3OraclesData, compoundV3Pools, compoundV3Reserves, eulerConfigs, eulerVaults, fetchTokenList, fetchTokenLists, initConfig, initializeChainData, initializeLenderData, listaNativeProvider, morphoBundler3, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles };
|
package/dist/lending.d.ts
CHANGED
|
@@ -71,10 +71,14 @@ type OracleMap = {
|
|
|
71
71
|
[chainId: string]: string;
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
type
|
|
74
|
+
type CompoundV3OracleEntry = {
|
|
75
|
+
oracle: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
type CompoundV3OracleDataMap = {
|
|
75
79
|
[lender: string]: {
|
|
76
80
|
[chainId: string]: {
|
|
77
|
-
[assetAddress: string]:
|
|
81
|
+
[assetAddress: string]: CompoundV3OracleEntry;
|
|
78
82
|
};
|
|
79
83
|
};
|
|
80
84
|
};
|
|
@@ -148,18 +152,22 @@ type EulerConfigsType = {
|
|
|
148
152
|
[chainId: string]: EulerConfigEntry;
|
|
149
153
|
};
|
|
150
154
|
};
|
|
155
|
+
type EulerVaultEntry = {
|
|
156
|
+
underlying: string;
|
|
157
|
+
vault: string;
|
|
158
|
+
};
|
|
151
159
|
type EulerVaultsType = {
|
|
152
160
|
[fork: string]: {
|
|
153
|
-
[chainId: string]:
|
|
161
|
+
[chainId: string]: EulerVaultEntry[];
|
|
154
162
|
};
|
|
155
163
|
};
|
|
156
164
|
/** Override datas used in the SDK - works across all module instances */
|
|
157
|
-
export declare function initializeLenderData({ aaveTokensOverride, aavePoolsOverride, aaveOraclesOverride, compoundV2OraclesOverride,
|
|
165
|
+
export declare function initializeLenderData({ aaveTokensOverride, aavePoolsOverride, aaveOraclesOverride, compoundV2OraclesOverride, compoundV3OraclesDataOverride, compoundV3PoolsOverride, compoundV3BaseDataOverride, morphoPoolsOverride, compoundV2TokensOverride, compoundV2TokenArrayOverride, compoundV2PoolsOverride, initConfigOverride, aaveReservesOverride, compoundV3ReservesOverride, compoundV2ReservesOverride, morphoOraclesOverride, morphoTypeOraclesOverride, morphoTypeMarketsOverride, aaveWethGatewayOverride, morphoBundler3Override, listaNativeProviderOverride, compoundV3BulkerOverride, eulerConfigsOverride, eulerVaultsOverride, }: {
|
|
158
166
|
aaveTokensOverride?: AaveTokensType;
|
|
159
167
|
aavePoolsOverride?: AavePoolsType;
|
|
160
168
|
aaveOraclesOverride?: OracleMap;
|
|
161
169
|
compoundV2OraclesOverride?: OracleMap;
|
|
162
|
-
|
|
170
|
+
compoundV3OraclesDataOverride?: CompoundV3OracleDataMap;
|
|
163
171
|
compoundV3PoolsOverride?: CompoundV3PoolsType;
|
|
164
172
|
compoundV3BaseDataOverride?: CompoundV3BaseDataType;
|
|
165
173
|
morphoPoolsOverride?: MorphoPoolsType;
|
|
@@ -184,7 +192,7 @@ export declare const aaveTokens: () => AaveTokensType;
|
|
|
184
192
|
export declare const aavePools: () => AavePoolsType;
|
|
185
193
|
export declare const aaveOracles: () => OracleMap;
|
|
186
194
|
export declare const compoundV2Oracles: () => OracleMap;
|
|
187
|
-
export declare const
|
|
195
|
+
export declare const compoundV3OraclesData: () => CompoundV3OracleDataMap;
|
|
188
196
|
export declare const morphoOracles: () => MorphoOracles;
|
|
189
197
|
export declare const morphoTypeOracles: () => MorphoTypeOracles;
|
|
190
198
|
export declare const morphoTypeMarkets: () => MorphoTypeMarkets;
|