@1delta/margin-fetcher 0.0.18 → 0.0.20
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/abis/aave-v2/YLDR.d.ts.map +1 -1
- package/dist/abis/aave-v2/YLDR.js +176 -148
- package/dist/abis/aave-v3/YLDR.js +29 -29
- package/dist/abis/compound-v3/Comet.d.ts +0 -20
- package/dist/abis/compound-v3/Comet.d.ts.map +1 -1
- package/dist/abis/compound-v3/Comet.js +0 -25
- package/dist/assets/liquidityThresholds.d.ts +10 -0
- package/dist/assets/liquidityThresholds.d.ts.map +1 -1
- package/dist/assets/liquidityThresholds.js +9 -2
- package/dist/flash-liquidity/fetchLiquidity.d.ts +2 -2
- package/dist/flash-liquidity/fetchLiquidity.d.ts.map +1 -1
- package/dist/flash-liquidity/fetchLiquidity.js +85 -54
- package/dist/flash-liquidity/types.d.ts +1 -0
- package/dist/flash-liquidity/types.d.ts.map +1 -1
- package/dist/lending/aave-v3-type/publicCallBuild.d.ts +1 -1
- package/dist/lending/aave-v3-type/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/aave-v3-type/publicCallBuild.js +46 -48
- package/dist/lending/aave-v3-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v3-type/publicCallParse.js +8 -2
- package/dist/lending/compound-v3/publicCallParse.d.ts.map +1 -1
- package/dist/lending/compound-v3/publicCallParse.js +8 -3
- package/dist/lending/fetchLender.js +3 -3
- package/dist/lending/morpho/convertPublic.js +1 -1
- package/dist/lending/user-data/abis.d.ts +20 -20
- package/dist/lending/user-data/compound-v3/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/compound-v3/userCallBuild.js +1 -7
- package/dist/lending/user-data/compound-v3/userCallParse.d.ts +2 -2
- package/dist/lending/user-data/compound-v3/userCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/compound-v3/userCallParse.js +19 -20
- package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallBuild.js +6 -4
- package/dist/lending/user-data/types.js +2 -2
- package/dist/lending-pairs/computeLendingPairs.d.ts +10 -1
- package/dist/lending-pairs/computeLendingPairs.d.ts.map +1 -1
- package/dist/lending-pairs/computeLendingPairs.js +26 -22
- package/dist/prices/defillama/index.d.ts.map +1 -1
- package/dist/prices/defillama/index.js +162 -151
- package/dist/prices/index.d.ts +3 -2
- package/dist/prices/index.d.ts.map +1 -1
- package/dist/prices/index.js +3 -2
- package/dist/prices/main-prices/addresses/aaveOracles.d.ts +159 -143
- package/dist/prices/main-prices/addresses/aaveOracles.d.ts.map +1 -1
- package/dist/prices/main-prices/addresses/aaveOracles.js +276 -260
- package/dist/prices/main-prices/addresses/morpho.d.ts.map +1 -1
- package/dist/prices/main-prices/addresses/morpho.js +305 -0
- package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
- package/dist/prices/main-prices/fetchOracleData.js +25 -11
- package/dist/prices/pendle/fetchPendlePrices.d.ts +7 -0
- package/dist/prices/pendle/fetchPendlePrices.d.ts.map +1 -0
- package/dist/prices/pendle/fetchPendlePrices.js +148 -0
- package/dist/prices/pendle/index.d.ts +2 -0
- package/dist/prices/pendle/index.d.ts.map +1 -0
- package/dist/prices/pendle/index.js +1 -0
- package/dist/types/apiReturnType.d.ts +2 -0
- package/dist/types/apiReturnType.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +10 -16
- package/dist/yields/index.d.ts.map +1 -1
- package/dist/yields/index.js +58 -33
- package/package.json +3 -6
- package/src/abis/aave-v2/YLDR.ts +177 -149
- package/src/abis/aave-v3/YLDR.ts +45 -45
- package/src/abis/compound-v3/Comet.ts +0 -25
- package/src/assets/liquidityThresholds.ts +22 -3
- package/src/flash-liquidity/fetchLiquidity.ts +298 -261
- package/src/flash-liquidity/types.ts +1 -0
- package/src/lending/aave-v3-type/publicCallBuild.ts +74 -68
- package/src/lending/aave-v3-type/publicCallParse.ts +8 -2
- package/src/lending/compound-v3/publicCallParse.ts +10 -3
- package/src/lending/fetchLender.ts +3 -3
- package/src/lending/morpho/convertPublic.ts +1 -1
- package/src/lending/user-data/compound-v3/userCallBuild.ts +1 -8
- package/src/lending/user-data/compound-v3/userCallParse.ts +39 -29
- package/src/lending/user-data/morpho/userCallBuild.ts +6 -4
- package/src/lending/user-data/types.ts +2 -2
- package/src/lending-pairs/computeLendingPairs.ts +423 -410
- package/src/prices/defillama/index.ts +233 -227
- package/src/prices/index.ts +3 -2
- package/src/prices/main-prices/addresses/aaveOracles.ts +292 -277
- package/src/prices/main-prices/addresses/morpho.ts +305 -0
- package/src/prices/main-prices/fetchOracleData.ts +33 -24
- package/src/prices/pendle/fetchPendlePrices.ts +208 -0
- package/src/prices/pendle/index.ts +1 -0
- package/src/types/apiReturnType.ts +42 -39
- package/src/utils/index.ts +11 -18
- package/src/yields/index.ts +219 -178
- package/test/flashLiquidity.test.ts +40 -0
- package/test/index.test.ts +101 -97
- package/test/lenderData.test.ts +18 -13254
- package/test/mainPriceMB.test.ts +1 -1
- package/test/mainPrices.test.ts +24 -19
- package/test/morpho.test.ts +1 -1
- package/test/morphoPrice.test.ts +1 -1
- package/test/userDataAave.test.ts +73 -0
- package/test/yields.test.ts +27 -0
- package/tsconfig.json +2 -1
- package/dist/abis/aave/AToken.d.ts +0 -526
- package/dist/abis/aave/AToken.d.ts.map +0 -1
- package/dist/abis/aave/AToken.js +0 -686
- package/dist/abis/aave/AavePoolV3.d.ts +0 -819
- package/dist/abis/aave/AavePoolV3.d.ts.map +0 -1
- package/dist/abis/aave/AavePoolV3.js +0 -1060
- package/dist/abis/init/Core.d.ts +0 -523
- package/dist/abis/init/Core.d.ts.map +0 -1
- package/dist/abis/init/Core.js +0 -681
- package/dist/abis/init/InitFlashAggregator.d.ts +0 -624
- package/dist/abis/init/InitFlashAggregator.d.ts.map +0 -1
- package/dist/abis/init/InitFlashAggregator.js +0 -795
- package/dist/abis/init/PosManager.d.ts +0 -802
- package/dist/abis/init/PosManager.d.ts.map +0 -1
- package/dist/abis/init/PosManager.js +0 -1055
- package/dist/abis/uniswap/FeeOnTransferDetector.d.ts +0 -102
- package/dist/abis/uniswap/FeeOnTransferDetector.d.ts.map +0 -1
- package/dist/abis/uniswap/FeeOnTransferDetector.js +0 -133
- package/dist/abis/uniswap/UniswapV2Pair.d.ts +0 -513
- package/dist/abis/uniswap/UniswapV2Pair.d.ts.map +0 -1
- package/dist/abis/uniswap/UniswapV2Pair.js +0 -659
- package/src/abis/aave/AToken.ts +0 -686
- package/src/abis/aave/AavePoolV3.ts +0 -1060
- package/src/abis/init/Core.ts +0 -681
- package/src/abis/init/InitFlashAggregator.ts +0 -795
- package/src/abis/init/PosManager.ts +0 -1055
- package/src/abis/uniswap/FeeOnTransferDetector.ts +0 -133
- package/src/abis/uniswap/UniswapV2Pair.ts +0 -659
- /package/test/{userdata.test.ts → userData.test.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fetch from
|
|
1
|
+
import fetch from 'axios';
|
|
2
2
|
const prefixEthereum = 'ethereum:';
|
|
3
3
|
const RETH = '0xae78736Cd615f374D3085123A210448E74Fc6393';
|
|
4
4
|
const WBTC = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599';
|
|
@@ -32,14 +32,14 @@ const FRAX = '0x853d955acef822db058eb8505911ed77f175b99e';
|
|
|
32
32
|
const WEETH = '0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee';
|
|
33
33
|
const ARB = '0xb50721bcf8d664c30412cfbc6cf7a15145234ad1';
|
|
34
34
|
const WUSDM = '0x57f5e098cad7a3d1eed53991d4d66c45c9af7812';
|
|
35
|
-
const RSETH =
|
|
36
|
-
const CBETH =
|
|
37
|
-
const SNX =
|
|
38
|
-
const VUSD =
|
|
39
|
-
const EZETH =
|
|
40
|
-
const LBTC =
|
|
41
|
-
const BRBTC =
|
|
42
|
-
const SDAI =
|
|
35
|
+
const RSETH = '0xa1290d69c65a6fe4df752f95823fae25cb99e5a7';
|
|
36
|
+
const CBETH = '0xbe9895146f7af43049ca1c1ae358b0541ea49704';
|
|
37
|
+
const SNX = '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f';
|
|
38
|
+
const VUSD = '0x677ddbd918637e5f2c79e164d402454de7da8619';
|
|
39
|
+
const EZETH = '0xbf5495Efe5DB9ce00f80364C8B423567e58d2110';
|
|
40
|
+
const LBTC = '0x8236a87084f8B84306f72007F36F2618A5634494';
|
|
41
|
+
const BRBTC = '0x2eC37d45FCAE65D9787ECf71dc85a444968f6646';
|
|
42
|
+
const SDAI = '0x83f20f44975d03b1b09e64809b757c47f942beea';
|
|
43
43
|
const datasEthereum = [
|
|
44
44
|
RETH,
|
|
45
45
|
WBTC,
|
|
@@ -80,41 +80,45 @@ const datasEthereum = [
|
|
|
80
80
|
VUSD,
|
|
81
81
|
LBTC,
|
|
82
82
|
BRBTC,
|
|
83
|
-
SDAI
|
|
84
|
-
]
|
|
83
|
+
SDAI,
|
|
84
|
+
]
|
|
85
|
+
.map((d) => prefixEthereum + d)
|
|
86
|
+
.join(',');
|
|
85
87
|
const prefixAvalanche = 'avax:';
|
|
86
88
|
const WAVAX = '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7';
|
|
87
|
-
const SAVAX =
|
|
88
|
-
const prefixArbitrum =
|
|
89
|
-
const GMX =
|
|
90
|
-
const prefixOptimism =
|
|
91
|
-
const OP =
|
|
92
|
-
const SUSD =
|
|
93
|
-
const WRSETH =
|
|
94
|
-
const prefixBase =
|
|
95
|
-
const AERO =
|
|
96
|
-
const prefixCore =
|
|
97
|
-
const WCORE =
|
|
98
|
-
const prefixMetis =
|
|
99
|
-
const WMETIS =
|
|
100
|
-
const prefixSonic =
|
|
101
|
-
const WS =
|
|
102
|
-
const prefixFantom =
|
|
103
|
-
const WFTM =
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
].map(d =>
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const
|
|
89
|
+
const SAVAX = '0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE';
|
|
90
|
+
const prefixArbitrum = 'arbitrum:';
|
|
91
|
+
const GMX = '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a';
|
|
92
|
+
const prefixOptimism = 'optimism:';
|
|
93
|
+
const OP = '0x4200000000000000000000000000000000000042';
|
|
94
|
+
const SUSD = '0x8c6f28f2F1A3C87F0f938b96d27520d9751ec8d9';
|
|
95
|
+
const WRSETH = '0x87eee96d50fb761ad85b1c982d28a042169d61b1';
|
|
96
|
+
const prefixBase = 'base:';
|
|
97
|
+
const AERO = '0x940181a94A35A4569E4529A3CDfB74e38FD98631';
|
|
98
|
+
const prefixCore = 'core:';
|
|
99
|
+
const WCORE = '0xb0788b601c0d712702bc829b52771199ad8e33ff';
|
|
100
|
+
const prefixMetis = 'metis:';
|
|
101
|
+
const WMETIS = '0x75cb093e4d61d2a2e65d8e0bbb01de8d89b53481';
|
|
102
|
+
const prefixSonic = 'sonic:';
|
|
103
|
+
const WS = '0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38';
|
|
104
|
+
const prefixFantom = 'fantom:';
|
|
105
|
+
const WFTM = '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83';
|
|
106
|
+
const prefixHyperEVM = 'hyperliquid:';
|
|
107
|
+
const WYPE = '0x5555555555555555555555555555555555555555';
|
|
108
|
+
// const prefixKaia = 'kaia:'
|
|
109
|
+
// const WKAIA = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'
|
|
110
|
+
const datasAvalanche = [WAVAX, SAVAX].map((d) => prefixAvalanche + d).join(',');
|
|
111
|
+
const datasArbitrum = [GMX].map((d) => prefixArbitrum + d).join(',');
|
|
112
|
+
const datasOptimism = [OP, SUSD, WRSETH]
|
|
113
|
+
.map((d) => prefixOptimism + d)
|
|
114
|
+
.join(',');
|
|
115
|
+
const datasBase = [AERO].map((d) => prefixBase + d).join(',');
|
|
116
|
+
const datasCore = [WCORE].map((d) => prefixCore + d).join(',');
|
|
117
|
+
const datasMetis = [WMETIS].map((d) => prefixMetis + d).join(',');
|
|
118
|
+
const datasFantom = [WFTM].map((d) => prefixFantom + d).join(',');
|
|
119
|
+
const datasSonic = [WS].map((d) => prefixSonic + d).join(',');
|
|
120
|
+
const datasHyperEvm = [WYPE].map((d) => prefixHyperEVM + d).join(',');
|
|
121
|
+
// const datasKaia = [WKAIA].map((d) => prefixKaia + d).join(',')
|
|
118
122
|
const URL = `https://coins.llama.fi/prices/current/${[
|
|
119
123
|
datasEthereum,
|
|
120
124
|
datasAvalanche,
|
|
@@ -124,7 +128,8 @@ const URL = `https://coins.llama.fi/prices/current/${[
|
|
|
124
128
|
datasCore,
|
|
125
129
|
datasMetis,
|
|
126
130
|
datasFantom,
|
|
127
|
-
|
|
131
|
+
datasHyperEvm,
|
|
132
|
+
// datasKaia,
|
|
128
133
|
datasSonic, //
|
|
129
134
|
].join(',')}?searchWidth=4h`;
|
|
130
135
|
const URL_HIST = (ref) => `https://coins.llama.fi/prices/historical/${ref}/${[
|
|
@@ -136,99 +141,103 @@ const URL_HIST = (ref) => `https://coins.llama.fi/prices/historical/${ref}/${[
|
|
|
136
141
|
datasCore,
|
|
137
142
|
datasMetis,
|
|
138
143
|
datasFantom,
|
|
139
|
-
datasKaia,
|
|
144
|
+
// datasKaia,
|
|
145
|
+
datasHyperEvm,
|
|
140
146
|
datasSonic, //
|
|
141
147
|
].join(',')}?searchWidth=4h`;
|
|
142
148
|
const SYMBOL_MAP = {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
149
|
+
weth: 'WETH',
|
|
150
|
+
usde: 'USDE',
|
|
151
|
+
meth: 'METH',
|
|
152
|
+
mnt: 'WMNT',
|
|
153
|
+
usdc: 'USDC',
|
|
154
|
+
usdt: 'USDT',
|
|
155
|
+
wbtc: 'WBTC',
|
|
156
|
+
usdy: 'USDY',
|
|
157
|
+
crv: 'CRV',
|
|
158
|
+
op: 'OP',
|
|
159
|
+
bal: 'BAL',
|
|
160
|
+
eura: 'AGEUR',
|
|
161
|
+
link: 'LINK',
|
|
162
|
+
dai: 'DAI',
|
|
163
|
+
bnb: 'WBNB',
|
|
164
|
+
matic: 'WPOL',
|
|
165
|
+
wpol: 'WPOL',
|
|
166
|
+
pol: 'WPOL',
|
|
167
|
+
stmatic: 'STMATIC',
|
|
168
|
+
maticx: 'MATICX',
|
|
169
|
+
wavax: 'WAVAX',
|
|
170
|
+
aave: 'AAVE',
|
|
171
|
+
comp: 'COMP',
|
|
172
|
+
eurs: 'EURS',
|
|
173
|
+
fbtc: 'FBTC',
|
|
174
|
+
taiko: 'TAIKO',
|
|
175
|
+
cmeth: 'CMETH',
|
|
176
|
+
ausd: 'AUSD',
|
|
177
|
+
susde: 'SUSDE',
|
|
178
|
+
fuel: 'FUEL',
|
|
179
|
+
gho: 'GHO',
|
|
180
|
+
frax: 'FRAX',
|
|
181
|
+
weeth: 'WEETH',
|
|
182
|
+
arb: 'ARB',
|
|
183
|
+
lusd: 'LUSD',
|
|
184
|
+
reth: 'RETH',
|
|
185
|
+
gmx: 'GMX',
|
|
186
|
+
wusdm: 'WUSDM',
|
|
187
|
+
rseth: 'RSETH',
|
|
188
|
+
susd: 'SUSD',
|
|
189
|
+
wrseth: 'WRSETH',
|
|
190
|
+
cbeth: 'CBETH',
|
|
191
|
+
aero: 'AERO',
|
|
192
|
+
snx: 'SNX',
|
|
193
|
+
wftm: 'WFTM',
|
|
194
|
+
ftm: 'WFTM',
|
|
195
|
+
wcore: 'WCORE',
|
|
196
|
+
core: 'WCORE',
|
|
197
|
+
ws: 'WS',
|
|
198
|
+
s: 'WS',
|
|
199
|
+
wmetis: 'WMETIS',
|
|
200
|
+
metis: 'WMETIS',
|
|
201
|
+
vusd: 'VUSD',
|
|
202
|
+
ezeth: 'EZETH',
|
|
203
|
+
lbtc: 'LBTC',
|
|
204
|
+
brbtc: 'BRBTC',
|
|
205
|
+
sdai: 'SDAI',
|
|
206
|
+
wkaia: 'KAIA',
|
|
207
|
+
savax: 'SAVAX',
|
|
208
|
+
whype: 'WHYPE',
|
|
202
209
|
};
|
|
203
210
|
export async function fetchDefillamaData() {
|
|
204
211
|
try {
|
|
205
212
|
const res = await fetch(URL);
|
|
206
|
-
let prices = Object.assign({}, ...Object.values(res.data.coins).map(
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
prices[
|
|
211
|
-
prices[
|
|
212
|
-
prices[
|
|
213
|
-
prices[
|
|
214
|
-
prices[
|
|
215
|
-
prices[
|
|
216
|
-
prices[
|
|
217
|
-
prices[
|
|
218
|
-
prices[
|
|
219
|
-
prices[
|
|
220
|
-
prices[
|
|
221
|
-
prices[
|
|
222
|
-
prices[
|
|
223
|
-
prices[
|
|
224
|
-
prices[
|
|
225
|
-
prices[
|
|
226
|
-
prices[
|
|
227
|
-
prices[
|
|
213
|
+
let prices = Object.assign({}, ...Object.values(res.data.coins).map((k) => {
|
|
214
|
+
// @ts-ignore
|
|
215
|
+
return { [SYMBOL_MAP[k.symbol.toLowerCase()]]: k.price };
|
|
216
|
+
}));
|
|
217
|
+
prices['POL'] = prices['WPOL'];
|
|
218
|
+
prices['BNB'] = prices['WBNB'];
|
|
219
|
+
prices['ETH'] = prices['WETH'];
|
|
220
|
+
prices['S'] = prices['WS'];
|
|
221
|
+
prices['CORE'] = prices['WCORE'];
|
|
222
|
+
prices['AVAX'] = prices['WAVAX'];
|
|
223
|
+
prices['METIS'] = prices['WMETIS'];
|
|
224
|
+
// prices['WKAIA'] = prices['KAIA']
|
|
225
|
+
prices['USDBC'] = prices['USDC'];
|
|
226
|
+
prices['BTCB'] = prices['WBTC'];
|
|
227
|
+
prices['CBBTC'] = prices['WBTC'];
|
|
228
|
+
prices['SOLVBTC'] = prices['WBTC'];
|
|
229
|
+
prices['XSOLVBTC'] = prices['WBTC'];
|
|
230
|
+
prices['SUBTC'] = prices['WBTC'];
|
|
231
|
+
prices['IBTC'] = prices['WBTC'];
|
|
232
|
+
prices['ENZOBTC'] = prices['WBTC'];
|
|
233
|
+
prices['LUSD'] = prices['USDT'];
|
|
234
|
+
prices['XDAI'] = prices['DAI'];
|
|
235
|
+
prices['WXDAI'] = prices['DAI'];
|
|
236
|
+
prices['HYPE'] = prices['WHYPE'];
|
|
228
237
|
return prices;
|
|
229
238
|
}
|
|
230
239
|
catch (e) {
|
|
231
|
-
console.log(
|
|
240
|
+
console.log('error fetching prices from defillama', e);
|
|
232
241
|
return {};
|
|
233
242
|
}
|
|
234
243
|
}
|
|
@@ -236,34 +245,36 @@ export async function fetchDefillamaHistData() {
|
|
|
236
245
|
try {
|
|
237
246
|
const nowMinus24 = Math.floor(Date.now() / 1000 - 24 * 3600);
|
|
238
247
|
const resHist = await fetch(URL_HIST(nowMinus24));
|
|
239
|
-
let histPrices = Object.assign({}, ...Object.values(resHist.data.coins).map(
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
histPrices[
|
|
244
|
-
histPrices[
|
|
245
|
-
histPrices[
|
|
246
|
-
histPrices[
|
|
247
|
-
histPrices[
|
|
248
|
-
histPrices[
|
|
249
|
-
histPrices[
|
|
250
|
-
histPrices[
|
|
251
|
-
histPrices[
|
|
252
|
-
histPrices[
|
|
253
|
-
histPrices[
|
|
254
|
-
histPrices[
|
|
255
|
-
histPrices[
|
|
256
|
-
histPrices[
|
|
257
|
-
histPrices[
|
|
258
|
-
histPrices[
|
|
259
|
-
histPrices[
|
|
260
|
-
histPrices[
|
|
261
|
-
histPrices[
|
|
262
|
-
histPrices[
|
|
248
|
+
let histPrices = Object.assign({}, ...Object.values(resHist.data.coins).map((k) => {
|
|
249
|
+
// @ts-ignore
|
|
250
|
+
return { [SYMBOL_MAP[k.symbol.toLowerCase()]]: k.price };
|
|
251
|
+
}));
|
|
252
|
+
histPrices['POL'] = histPrices['WPOL'];
|
|
253
|
+
histPrices['BNB'] = histPrices['WBNB'];
|
|
254
|
+
histPrices['ETH'] = histPrices['WETH'];
|
|
255
|
+
histPrices['S'] = histPrices['WS'];
|
|
256
|
+
histPrices['CORE'] = histPrices['WCORE'];
|
|
257
|
+
histPrices['AVAX'] = histPrices['WAVAX'];
|
|
258
|
+
histPrices['METIS'] = histPrices['WMETIS'];
|
|
259
|
+
histPrices['HYPE'] = histPrices['WHYPE'];
|
|
260
|
+
// histPrices['WKAIA'] = histPrices['KAIA']
|
|
261
|
+
histPrices['LUSD'] = histPrices['USDT'];
|
|
262
|
+
histPrices['XDAI'] = histPrices['DAI'];
|
|
263
|
+
histPrices['WXDAI'] = histPrices['DAI'];
|
|
264
|
+
histPrices['BTCB'] = histPrices['WBTC'];
|
|
265
|
+
histPrices['M-BTC'] = histPrices['WBTC'];
|
|
266
|
+
histPrices['SOLVBTC'] = histPrices['WBTC'];
|
|
267
|
+
histPrices['XSOLVBTC'] = histPrices['WBTC'];
|
|
268
|
+
histPrices['UNIBTC'] = histPrices['WBTC'];
|
|
269
|
+
histPrices['HEMIBTC'] = histPrices['WBTC'];
|
|
270
|
+
histPrices['SUBTC'] = histPrices['WBTC'];
|
|
271
|
+
histPrices['IBTC'] = histPrices['WBTC'];
|
|
272
|
+
histPrices['ENZOBTC'] = histPrices['WBTC'];
|
|
273
|
+
histPrices['PUMPBTC'] = histPrices['WBTC'];
|
|
263
274
|
return histPrices;
|
|
264
275
|
}
|
|
265
276
|
catch (e) {
|
|
266
|
-
console.log(
|
|
277
|
+
console.log('error fetching prices from defillama', e);
|
|
267
278
|
return {};
|
|
268
279
|
}
|
|
269
280
|
}
|
package/dist/prices/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prices/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prices/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA"}
|
package/dist/prices/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './defillama';
|
|
2
|
+
export * from './main-prices';
|
|
3
|
+
export * from './pendle';
|