@defisaver/positions-sdk 2.1.41 → 2.1.43-dev-stats-test-dev

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.
@@ -59,6 +59,7 @@ exports.aaveV3EmodeCategoriesMapping = aaveV3EmodeCategoriesMapping;
59
59
  function _getAaveV3MarketData(provider_1, network_1, market_1) {
60
60
  return __awaiter(this, arguments, void 0, function* (provider, network, market, blockNumber = 'latest') {
61
61
  const _addresses = market.assets.map(a => (0, tokens_1.getAssetInfo)((0, utils_1.getWrappedNativeAssetFromUnwrapped)(a), network).address);
62
+ console.log('Fetched addresses');
62
63
  const isL2 = (0, utils_1.isLayer2Network)(network);
63
64
  const loanInfoContract = (0, contracts_1.AaveV3ViewContractViem)(provider, network);
64
65
  const aaveIncentivesContract = (0, contracts_1.AaveIncentiveDataProviderV3ContractViem)(provider, network);
@@ -73,6 +74,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
73
74
  (0, merkl_1.getMerkleCampaigns)(network),
74
75
  (0, merit_1.getMeritCampaigns)(network, market.value),
75
76
  ]);
77
+ console.log('Fetched tokens, emodes, campaigns, incentives');
76
78
  isBorrowAllowed = (0, utils_1.isLayer2Network)(network) ? isBorrowAllowed : true;
77
79
  const eModeCategoriesData = {};
78
80
  for (let i = 0; i < eModesInfo.length; i++) {
@@ -90,6 +92,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
90
92
  collateralAssets: [],
91
93
  };
92
94
  }
95
+ console.log('Parsed e modes info');
93
96
  if (networksWithIncentives.includes(network) && rewardInfo) {
94
97
  rewardInfo = rewardInfo.reduce((all, _market) => {
95
98
  // eslint-disable-next-line no-param-reassign
@@ -97,6 +100,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
97
100
  return all;
98
101
  }, {});
99
102
  }
103
+ console.log('Parsed reward info');
100
104
  const assetsData = yield Promise.all(loanInfo
101
105
  .map((tokenMarket, i) => __awaiter(this, void 0, void 0, function* () {
102
106
  const symbol = market.assets[i];
@@ -158,6 +162,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
158
162
  borrowIncentives: [],
159
163
  });
160
164
  })));
165
+ console.log('Parsed assets data');
161
166
  // Get incentives data
162
167
  yield Promise.all(assetsData.map((_market, index) => __awaiter(this, void 0, void 0, function* () {
163
168
  var _a, _b;
@@ -165,8 +170,10 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
165
170
  // @ts-ignore
166
171
  const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
167
172
  const isStakingAsset = staking_1.STAKING_ASSETS.includes(_market.symbol);
173
+ console.log('Processing market', _market.symbol);
168
174
  if (isStakingAsset) {
169
175
  const yieldApy = yield (0, staking_1.getStakingApy)(_market.symbol, network);
176
+ console.log('Got yield apy', yieldApy);
170
177
  _market.supplyIncentives.push({
171
178
  apy: yieldApy,
172
179
  token: _market.symbol,
@@ -194,6 +201,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
194
201
  eligibilityId: identifier,
195
202
  });
196
203
  }
204
+ console.log('Processed merkle a incentives');
197
205
  const vTokenAddress = _market.vTokenAddress.toLowerCase(); // DEV: Should vTokenAddress be in AaveV3AssetData type?
198
206
  if ((_b = merkleRewardsMap[vTokenAddress]) === null || _b === void 0 ? void 0 : _b.borrow) {
199
207
  const { apy, rewardTokenSymbol, description, identifier, } = merkleRewardsMap[vTokenAddress].borrow;
@@ -205,6 +213,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
205
213
  eligibilityId: identifier,
206
214
  });
207
215
  }
216
+ console.log('Processed merkle v incentives');
208
217
  if (meritRewardsMap.supply[_market.symbol]) {
209
218
  const { apy, rewardTokenSymbol, description } = meritRewardsMap.supply[_market.symbol];
210
219
  _market.supplyIncentives.push({
@@ -214,6 +223,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
214
223
  description,
215
224
  });
216
225
  }
226
+ console.log('Processed merit supply incentives');
217
227
  if (meritRewardsMap.borrow[_market.symbol]) {
218
228
  const { apy, rewardTokenSymbol, description } = meritRewardsMap.borrow[_market.symbol];
219
229
  _market.borrowIncentives.push({
@@ -223,8 +233,10 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
223
233
  description,
224
234
  });
225
235
  }
236
+ console.log('Processed merit borrow incentives');
226
237
  if (!rewardForMarket)
227
238
  return;
239
+ console.log('Reward for market', rewardForMarket);
228
240
  // @ts-ignore
229
241
  rewardForMarket.aIncentiveData.rewardsTokenInformation.forEach(supplyRewardData => {
230
242
  if (supplyRewardData) {
@@ -291,6 +303,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
291
303
  collateralAssets: assetsData.map((a) => a.symbol),
292
304
  borrowAssets: assetsData.map((a) => a.symbol),
293
305
  };
306
+ console.log('Parsed payload');
294
307
  return { assetsData: payload, eModeCategoriesData };
295
308
  });
296
309
  }
@@ -68,6 +68,7 @@ const fetchMeritRewardsData = () => __awaiter(void 0, void 0, void 0, function*
68
68
  exports.fetchMeritRewardsData = fetchMeritRewardsData;
69
69
  const getMeritCampaigns = (chainId, market) => __awaiter(void 0, void 0, void 0, function* () {
70
70
  var _a;
71
+ console.log('Fetching Merit campaigns');
71
72
  const meritData = yield (0, exports.fetchMeritRewardsData)();
72
73
  const relevantCampaigns = {
73
74
  supply: {},
@@ -39,6 +39,7 @@ const formatAaveAsset = (_symbol) => {
39
39
  };
40
40
  exports.formatAaveAsset = formatAaveAsset;
41
41
  const getMerkleCampaigns = (chainId) => __awaiter(void 0, void 0, void 0, function* () {
42
+ console.log('Fetching Merkle campaigns');
42
43
  try {
43
44
  const res = yield fetch('https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave', {
44
45
  signal: AbortSignal.timeout(utils_1.DEFAULT_TIMEOUT),
@@ -102,7 +102,7 @@ exports.MORPHO_VAULT_STEAKHOUSE_USDT = {
102
102
  exports.MORPHO_VAULT_STEAKHOUSE_USDC = {
103
103
  type: types_1.MorphoVaultType.MorphoVaultSteakhouseUSDC,
104
104
  name: 'Steakhouse USDC',
105
- address: '0xbEef047a543E45807105E51A8BBEFCc5950fcfBa',
105
+ address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
106
106
  asset: 'USDC',
107
107
  deploymentBlock: 18928285,
108
108
  isLegacy: false,
@@ -48,6 +48,7 @@ export const aaveV3EmodeCategoriesMapping = (extractedState, usedAssets) => {
48
48
  export function _getAaveV3MarketData(provider_1, network_1, market_1) {
49
49
  return __awaiter(this, arguments, void 0, function* (provider, network, market, blockNumber = 'latest') {
50
50
  const _addresses = market.assets.map(a => getAssetInfo(getWrappedNativeAssetFromUnwrapped(a), network).address);
51
+ console.log('Fetched addresses');
51
52
  const isL2 = isLayer2Network(network);
52
53
  const loanInfoContract = AaveV3ViewContractViem(provider, network);
53
54
  const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
@@ -62,6 +63,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
62
63
  getMerkleCampaigns(network),
63
64
  getMeritCampaigns(network, market.value),
64
65
  ]);
66
+ console.log('Fetched tokens, emodes, campaigns, incentives');
65
67
  isBorrowAllowed = isLayer2Network(network) ? isBorrowAllowed : true;
66
68
  const eModeCategoriesData = {};
67
69
  for (let i = 0; i < eModesInfo.length; i++) {
@@ -79,6 +81,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
79
81
  collateralAssets: [],
80
82
  };
81
83
  }
84
+ console.log('Parsed e modes info');
82
85
  if (networksWithIncentives.includes(network) && rewardInfo) {
83
86
  rewardInfo = rewardInfo.reduce((all, _market) => {
84
87
  // eslint-disable-next-line no-param-reassign
@@ -86,6 +89,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
86
89
  return all;
87
90
  }, {});
88
91
  }
92
+ console.log('Parsed reward info');
89
93
  const assetsData = yield Promise.all(loanInfo
90
94
  .map((tokenMarket, i) => __awaiter(this, void 0, void 0, function* () {
91
95
  const symbol = market.assets[i];
@@ -147,6 +151,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
147
151
  borrowIncentives: [],
148
152
  });
149
153
  })));
154
+ console.log('Parsed assets data');
150
155
  // Get incentives data
151
156
  yield Promise.all(assetsData.map((_market, index) => __awaiter(this, void 0, void 0, function* () {
152
157
  var _a, _b;
@@ -154,8 +159,10 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
154
159
  // @ts-ignore
155
160
  const rewardForMarket = rewardInfo === null || rewardInfo === void 0 ? void 0 : rewardInfo[_market.underlyingTokenAddress];
156
161
  const isStakingAsset = STAKING_ASSETS.includes(_market.symbol);
162
+ console.log('Processing market', _market.symbol);
157
163
  if (isStakingAsset) {
158
164
  const yieldApy = yield getStakingApy(_market.symbol, network);
165
+ console.log('Got yield apy', yieldApy);
159
166
  _market.supplyIncentives.push({
160
167
  apy: yieldApy,
161
168
  token: _market.symbol,
@@ -183,6 +190,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
183
190
  eligibilityId: identifier,
184
191
  });
185
192
  }
193
+ console.log('Processed merkle a incentives');
186
194
  const vTokenAddress = _market.vTokenAddress.toLowerCase(); // DEV: Should vTokenAddress be in AaveV3AssetData type?
187
195
  if ((_b = merkleRewardsMap[vTokenAddress]) === null || _b === void 0 ? void 0 : _b.borrow) {
188
196
  const { apy, rewardTokenSymbol, description, identifier, } = merkleRewardsMap[vTokenAddress].borrow;
@@ -194,6 +202,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
194
202
  eligibilityId: identifier,
195
203
  });
196
204
  }
205
+ console.log('Processed merkle v incentives');
197
206
  if (meritRewardsMap.supply[_market.symbol]) {
198
207
  const { apy, rewardTokenSymbol, description } = meritRewardsMap.supply[_market.symbol];
199
208
  _market.supplyIncentives.push({
@@ -203,6 +212,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
203
212
  description,
204
213
  });
205
214
  }
215
+ console.log('Processed merit supply incentives');
206
216
  if (meritRewardsMap.borrow[_market.symbol]) {
207
217
  const { apy, rewardTokenSymbol, description } = meritRewardsMap.borrow[_market.symbol];
208
218
  _market.borrowIncentives.push({
@@ -212,8 +222,10 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
212
222
  description,
213
223
  });
214
224
  }
225
+ console.log('Processed merit borrow incentives');
215
226
  if (!rewardForMarket)
216
227
  return;
228
+ console.log('Reward for market', rewardForMarket);
217
229
  // @ts-ignore
218
230
  rewardForMarket.aIncentiveData.rewardsTokenInformation.forEach(supplyRewardData => {
219
231
  if (supplyRewardData) {
@@ -280,6 +292,7 @@ export function _getAaveV3MarketData(provider_1, network_1, market_1) {
280
292
  collateralAssets: assetsData.map((a) => a.symbol),
281
293
  borrowAssets: assetsData.map((a) => a.symbol),
282
294
  };
295
+ console.log('Parsed payload');
283
296
  return { assetsData: payload, eModeCategoriesData };
284
297
  });
285
298
  }
@@ -64,6 +64,7 @@ export const fetchMeritRewardsData = () => __awaiter(void 0, void 0, void 0, fun
64
64
  });
65
65
  export const getMeritCampaigns = (chainId, market) => __awaiter(void 0, void 0, void 0, function* () {
66
66
  var _a;
67
+ console.log('Fetching Merit campaigns');
67
68
  const meritData = yield fetchMeritRewardsData();
68
69
  const relevantCampaigns = {
69
70
  supply: {},
@@ -34,6 +34,7 @@ export const formatAaveAsset = (_symbol) => {
34
34
  return _symbol;
35
35
  };
36
36
  export const getMerkleCampaigns = (chainId) => __awaiter(void 0, void 0, void 0, function* () {
37
+ console.log('Fetching Merkle campaigns');
37
38
  try {
38
39
  const res = yield fetch('https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave', {
39
40
  signal: AbortSignal.timeout(DEFAULT_TIMEOUT),
@@ -99,7 +99,7 @@ export const MORPHO_VAULT_STEAKHOUSE_USDT = {
99
99
  export const MORPHO_VAULT_STEAKHOUSE_USDC = {
100
100
  type: MorphoVaultType.MorphoVaultSteakhouseUSDC,
101
101
  name: 'Steakhouse USDC',
102
- address: '0xbEef047a543E45807105E51A8BBEFCc5950fcfBa',
102
+ address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
103
103
  asset: 'USDC',
104
104
  deploymentBlock: 18928285,
105
105
  isLegacy: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.41",
3
+ "version": "2.1.43-dev-stats-test-dev",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -79,6 +79,7 @@ export const aaveV3EmodeCategoriesMapping = (extractedState: any, usedAssets: Aa
79
79
  export async function _getAaveV3MarketData(provider: Client, network: NetworkNumber, market: AaveMarketInfo, blockNumber: 'latest' | number = 'latest'): Promise<AaveV3MarketData> {
80
80
  const _addresses = market.assets.map(a => getAssetInfo(getWrappedNativeAssetFromUnwrapped(a), network).address);
81
81
 
82
+ console.log('Fetched addresses');
82
83
  const isL2 = isLayer2Network(network);
83
84
  const loanInfoContract = AaveV3ViewContractViem(provider, network);
84
85
  const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
@@ -94,6 +95,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
94
95
  getMerkleCampaigns(network),
95
96
  getMeritCampaigns(network, market.value),
96
97
  ]);
98
+ console.log('Fetched tokens, emodes, campaigns, incentives');
97
99
  isBorrowAllowed = isLayer2Network(network) ? isBorrowAllowed : true;
98
100
 
99
101
  const eModeCategoriesData: EModeCategoriesData = {};
@@ -112,6 +114,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
112
114
  };
113
115
  }
114
116
 
117
+ console.log('Parsed e modes info');
115
118
  if (networksWithIncentives.includes(network) && rewardInfo) {
116
119
  rewardInfo = rewardInfo.reduce((all: any, _market: any) => {
117
120
  // eslint-disable-next-line no-param-reassign
@@ -120,6 +123,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
120
123
  }, {});
121
124
  }
122
125
 
126
+ console.log('Parsed reward info');
123
127
  const assetsData: AaveV3AssetData[] = await Promise.all(loanInfo
124
128
  .map(async (tokenMarket, i) => {
125
129
  const symbol = market.assets[i];
@@ -184,16 +188,17 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
184
188
  });
185
189
  }),
186
190
  );
187
-
191
+ console.log('Parsed assets data');
188
192
  // Get incentives data
189
193
  await Promise.all(assetsData.map(async (_market: AaveV3AssetData, index) => {
190
194
  /* eslint-disable no-param-reassign */
191
195
  // @ts-ignore
192
196
  const rewardForMarket = rewardInfo?.[_market.underlyingTokenAddress];
193
197
  const isStakingAsset = STAKING_ASSETS.includes(_market.symbol);
194
-
198
+ console.log('Processing market', _market.symbol);
195
199
  if (isStakingAsset) {
196
200
  const yieldApy = await getStakingApy(_market.symbol, network as NetworkNumber);
201
+ console.log('Got yield apy', yieldApy);
197
202
  _market.supplyIncentives.push({
198
203
  apy: yieldApy,
199
204
  token: _market.symbol,
@@ -224,6 +229,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
224
229
  eligibilityId: identifier as IncentiveEligibilityId,
225
230
  });
226
231
  }
232
+ console.log('Processed merkle a incentives');
227
233
 
228
234
  const vTokenAddress = (_market as any).vTokenAddress.toLowerCase(); // DEV: Should vTokenAddress be in AaveV3AssetData type?
229
235
  if (merkleRewardsMap[vTokenAddress]?.borrow) {
@@ -238,6 +244,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
238
244
  eligibilityId: identifier as IncentiveEligibilityId,
239
245
  });
240
246
  }
247
+ console.log('Processed merkle v incentives');
241
248
 
242
249
  if (meritRewardsMap.supply[_market.symbol]) {
243
250
  const { apy, rewardTokenSymbol, description } = meritRewardsMap.supply[_market.symbol];
@@ -248,7 +255,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
248
255
  description,
249
256
  });
250
257
  }
251
-
258
+ console.log('Processed merit supply incentives');
252
259
  if (meritRewardsMap.borrow[_market.symbol]) {
253
260
  const { apy, rewardTokenSymbol, description } = meritRewardsMap.borrow[_market.symbol];
254
261
  _market.borrowIncentives.push({
@@ -258,8 +265,9 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
258
265
  description,
259
266
  });
260
267
  }
261
-
268
+ console.log('Processed merit borrow incentives');
262
269
  if (!rewardForMarket) return;
270
+ console.log('Reward for market', rewardForMarket);
263
271
  // @ts-ignore
264
272
  rewardForMarket.aIncentiveData.rewardsTokenInformation.forEach(supplyRewardData => {
265
273
  if (supplyRewardData) {
@@ -328,6 +336,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
328
336
  borrowAssets: assetsData.map((a) => a.symbol),
329
337
  };
330
338
 
339
+ console.log('Parsed payload');
331
340
  return { assetsData: payload, eModeCategoriesData };
332
341
  }
333
342
 
@@ -71,6 +71,7 @@ export const fetchMeritRewardsData = async (): Promise<Record<string, number | n
71
71
  };
72
72
 
73
73
  export const getMeritCampaigns = async (chainId: NetworkNumber, market: AaveVersions): Promise<MeritTokenRewardMap> => {
74
+ console.log('Fetching Merit campaigns');
74
75
  const meritData = await fetchMeritRewardsData();
75
76
  const relevantCampaigns = {
76
77
  supply: {},
@@ -30,6 +30,7 @@ export const formatAaveAsset = (_symbol: string) => {
30
30
  };
31
31
 
32
32
  export const getMerkleCampaigns = async (chainId: NetworkNumber): Promise<MerkleRewardMap> => {
33
+ console.log('Fetching Merkle campaigns');
33
34
  try {
34
35
  const res = await fetch('https://api.merkl.xyz/v4/opportunities?mainProtocolId=aave', {
35
36
  signal: AbortSignal.timeout(DEFAULT_TIMEOUT),
@@ -113,7 +113,7 @@ export const MORPHO_VAULT_STEAKHOUSE_USDT: MorphoVault = {
113
113
  export const MORPHO_VAULT_STEAKHOUSE_USDC: MorphoVault = {
114
114
  type: MorphoVaultType.MorphoVaultSteakhouseUSDC,
115
115
  name: 'Steakhouse USDC',
116
- address: '0xbEef047a543E45807105E51A8BBEFCc5950fcfBa',
116
+ address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
117
117
  asset: 'USDC',
118
118
  deploymentBlock: 18928285,
119
119
  isLegacy: false,