@1delta/data-sdk 0.0.10 → 0.0.11

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.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './chains';
2
2
  export * from './lending';
3
+ export * from './tokens';
package/dist/index.js CHANGED
@@ -83,6 +83,22 @@ var compoundV2Pools = () => getGlobalData2()?.compoundV2Pools;
83
83
  var compoundV2Tokens = () => getGlobalData2()?.compoundV2Tokens;
84
84
  var initConfig = () => getGlobalData2()?.initConfig;
85
85
 
86
+ // src/tokens.ts
87
+ var getListUrl = (chainId) => `https://raw.githubusercontent.com/1delta-DAO/token-lists/main/${chainId}.json`;
88
+ async function fetchDeltaTokenList(chainId) {
89
+ const data = await fetch(getListUrl(chainId));
90
+ if (!data.ok) throw new Error(`HTTP error! status: ${data.status}`);
91
+ return (await data.json()).list;
92
+ }
93
+ async function fetchAllDeltaTokenList(chainIds) {
94
+ const promises = chainIds.map(async (chainId) => {
95
+ const list = await fetchDeltaTokenList(chainId);
96
+ return [chainId, list];
97
+ });
98
+ const results = await Promise.all(promises);
99
+ return Object.fromEntries(results);
100
+ }
101
+
86
102
  exports.aaveOracles = aaveOracles;
87
103
  exports.aavePools = aavePools;
88
104
  exports.aaveReserves = aaveReserves;
@@ -94,6 +110,8 @@ exports.compoundV2Tokens = compoundV2Tokens;
94
110
  exports.compoundV3BaseData = compoundV3BaseData;
95
111
  exports.compoundV3Pools = compoundV3Pools;
96
112
  exports.compoundV3Reserves = compoundV3Reserves;
113
+ exports.fetchAllDeltaTokenList = fetchAllDeltaTokenList;
114
+ exports.fetchDeltaTokenList = fetchDeltaTokenList;
97
115
  exports.initConfig = initConfig;
98
116
  exports.initializeChainData = initializeChainData;
99
117
  exports.initializeLenderData = initializeLenderData;
package/dist/index.mjs CHANGED
@@ -81,4 +81,20 @@ var compoundV2Pools = () => getGlobalData2()?.compoundV2Pools;
81
81
  var compoundV2Tokens = () => getGlobalData2()?.compoundV2Tokens;
82
82
  var initConfig = () => getGlobalData2()?.initConfig;
83
83
 
84
- export { aaveOracles, aavePools, aaveReserves, aaveTokens, chains, compoundV2Pools, compoundV2Reserves, compoundV2Tokens, compoundV3BaseData, compoundV3Pools, compoundV3Reserves, initConfig, initializeChainData, initializeLenderData, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles };
84
+ // src/tokens.ts
85
+ var getListUrl = (chainId) => `https://raw.githubusercontent.com/1delta-DAO/token-lists/main/${chainId}.json`;
86
+ async function fetchDeltaTokenList(chainId) {
87
+ const data = await fetch(getListUrl(chainId));
88
+ if (!data.ok) throw new Error(`HTTP error! status: ${data.status}`);
89
+ return (await data.json()).list;
90
+ }
91
+ async function fetchAllDeltaTokenList(chainIds) {
92
+ const promises = chainIds.map(async (chainId) => {
93
+ const list = await fetchDeltaTokenList(chainId);
94
+ return [chainId, list];
95
+ });
96
+ const results = await Promise.all(promises);
97
+ return Object.fromEntries(results);
98
+ }
99
+
100
+ export { aaveOracles, aavePools, aaveReserves, aaveTokens, chains, compoundV2Pools, compoundV2Reserves, compoundV2Tokens, compoundV3BaseData, compoundV3Pools, compoundV3Reserves, fetchAllDeltaTokenList, fetchDeltaTokenList, initConfig, initializeChainData, initializeLenderData, morphoOracles, morphoPools, morphoTypeMarkets, morphoTypeOracles };
@@ -0,0 +1,20 @@
1
+ export interface GeneralTokenListEntry {
2
+ chainId: string;
3
+ name: string;
4
+ address: string;
5
+ symbol: string;
6
+ decimals: number;
7
+ logoURI?: string;
8
+ assetGroup?: string;
9
+ props?: {
10
+ [key: string]: any;
11
+ };
12
+ }
13
+ type DeltaTokenList = {
14
+ [addr: string]: GeneralTokenListEntry;
15
+ };
16
+ export declare function fetchDeltaTokenList(chainId: string): Promise<DeltaTokenList>;
17
+ export declare function fetchAllDeltaTokenList(chainIds: string[]): Promise<{
18
+ [chainId: string]: DeltaTokenList;
19
+ }>;
20
+ export {};
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.10",
7
+ "version": "0.0.11",
8
8
  "description": "Hold and initialize lending protocol data across a stack",
9
9
  "files": [
10
10
  "dist"
@@ -16,10 +16,9 @@
16
16
  "main": "dist/index.js",
17
17
  "types": "dist/index.d.ts",
18
18
  "module": "dist/index.mjs",
19
- "dependencies": {},
20
19
  "devDependencies": {
21
- "tsup": "^8.5.0",
22
- "typescript": "^5.8.3"
20
+ "tsup": "^8.5.1",
21
+ "typescript": "^5.9.3"
23
22
  },
24
23
  "engines": {
25
24
  "node": ">=20"