@defisaver/positions-sdk 0.0.132 → 0.0.134

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.
@@ -12,14 +12,14 @@ exports.morphoAaveV2AssetDefaultMarket = ['DAI', 'ETH', 'USDC', 'USDT', 'WBTC',
12
12
  exports.morphoAaveV3AssetEthMarket = [
13
13
  'ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH', 'sDAI', 'USDT',
14
14
  ];
15
- exports.aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe'];
15
+ exports.aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe', 'tBTC', 'cbBTC'];
16
16
  exports.aaveV3AssetsDefaultMarketOpt = [
17
17
  'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH', 'USDC',
18
18
  ];
19
19
  exports.aaveV3AssetsDefaultMarketArb = [
20
20
  'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB', 'weETH', 'GHO',
21
21
  ];
22
- exports.aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH'];
22
+ exports.aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC'];
23
23
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
24
24
  exports.aaveV3AssetsDefaultMarket = {
25
25
  [common_1.NetworkNumber.Eth]: exports.aaveV3AssetsDefaultMarketEth,
@@ -133,7 +133,10 @@ const getMorphoAaveV3MarketsData = (web3, network, selectedMarket, mainnetWeb3)
133
133
  if (scaledBalanceResponse.status !== 'fulfilled') {
134
134
  throw new Error('Failed to fetch market data.');
135
135
  }
136
- const morphoRewardsData = morphoRewards.status === 'fulfilled' ? yield morphoRewards.value.json() : null;
136
+ let morphoRewardsData = null;
137
+ if (morphoRewards.status === 'fulfilled') {
138
+ morphoRewardsData = morphoRewards.value.ok ? yield morphoRewards.value.json() : null;
139
+ }
137
140
  const assetsData = yield Promise.all(loanInfo.map((info, i) => __awaiter(void 0, void 0, void 0, function* () {
138
141
  var _a, _b, _c, _d, _e, _f;
139
142
  const morphoMarketData = Object.assign(Object.assign({}, multicallResponse[(2 * i) + loanInfoCallsToSkip][0]), { scaledMorphoBorrowOnPool: scaledBalanceResponse.value[2 * i][0], scaledMorphoSupplyOnPool: scaledBalanceResponse.value[(2 * i) + 1][0] });
@@ -204,7 +207,7 @@ const getMorphoAaveV3MarketsData = (web3, network, selectedMarket, mainnetWeb3)
204
207
  incentiveSupplyToken: 'MORPHO',
205
208
  incentiveBorrowToken: 'MORPHO',
206
209
  incentiveSupplyApy: ((_c = (_a = morphoRewardsData === null || morphoRewardsData === void 0 ? void 0 : morphoRewardsData.markets) === null || _a === void 0 ? void 0 : _a[(_b = marketData.underlyingTokenAddress) === null || _b === void 0 ? void 0 : _b.toLowerCase()]) === null || _c === void 0 ? void 0 : _c.morphoRatePerSecondSupplySide) || '0',
207
- incentiveBorrowApy: ((_f = (_d = morphoRewardsData.markets) === null || _d === void 0 ? void 0 : _d[(_e = marketData.underlyingTokenAddress) === null || _e === void 0 ? void 0 : _e.toLowerCase()]) === null || _f === void 0 ? void 0 : _f.morphoRatePerSecondBorrowSide) || '0',
210
+ incentiveBorrowApy: ((_f = (_d = morphoRewardsData === null || morphoRewardsData === void 0 ? void 0 : morphoRewardsData.markets) === null || _d === void 0 ? void 0 : _d[(_e = marketData.underlyingTokenAddress) === null || _e === void 0 ? void 0 : _e.toLowerCase()]) === null || _f === void 0 ? void 0 : _f.morphoRatePerSecondBorrowSide) || '0',
208
211
  totalBorrowVar: '0',
209
212
  borrowRateStable: '0',
210
213
  disabledStableBorrowing: false,
@@ -9,14 +9,14 @@ export const morphoAaveV2AssetDefaultMarket = ['DAI', 'ETH', 'USDC', 'USDT', 'WB
9
9
  export const morphoAaveV3AssetEthMarket = [
10
10
  'ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH', 'sDAI', 'USDT',
11
11
  ];
12
- export const aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe'];
12
+ export const aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe', 'tBTC', 'cbBTC'];
13
13
  export const aaveV3AssetsDefaultMarketOpt = [
14
14
  'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH', 'USDC',
15
15
  ];
16
16
  export const aaveV3AssetsDefaultMarketArb = [
17
17
  'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB', 'weETH', 'GHO',
18
18
  ];
19
- export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH'];
19
+ export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC'];
20
20
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
21
21
  export const aaveV3AssetsDefaultMarket = {
22
22
  [NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
@@ -127,7 +127,10 @@ export const getMorphoAaveV3MarketsData = (web3, network, selectedMarket, mainne
127
127
  if (scaledBalanceResponse.status !== 'fulfilled') {
128
128
  throw new Error('Failed to fetch market data.');
129
129
  }
130
- const morphoRewardsData = morphoRewards.status === 'fulfilled' ? yield morphoRewards.value.json() : null;
130
+ let morphoRewardsData = null;
131
+ if (morphoRewards.status === 'fulfilled') {
132
+ morphoRewardsData = morphoRewards.value.ok ? yield morphoRewards.value.json() : null;
133
+ }
131
134
  const assetsData = yield Promise.all(loanInfo.map((info, i) => __awaiter(void 0, void 0, void 0, function* () {
132
135
  var _a, _b, _c, _d, _e, _f;
133
136
  const morphoMarketData = Object.assign(Object.assign({}, multicallResponse[(2 * i) + loanInfoCallsToSkip][0]), { scaledMorphoBorrowOnPool: scaledBalanceResponse.value[2 * i][0], scaledMorphoSupplyOnPool: scaledBalanceResponse.value[(2 * i) + 1][0] });
@@ -198,7 +201,7 @@ export const getMorphoAaveV3MarketsData = (web3, network, selectedMarket, mainne
198
201
  incentiveSupplyToken: 'MORPHO',
199
202
  incentiveBorrowToken: 'MORPHO',
200
203
  incentiveSupplyApy: ((_c = (_a = morphoRewardsData === null || morphoRewardsData === void 0 ? void 0 : morphoRewardsData.markets) === null || _a === void 0 ? void 0 : _a[(_b = marketData.underlyingTokenAddress) === null || _b === void 0 ? void 0 : _b.toLowerCase()]) === null || _c === void 0 ? void 0 : _c.morphoRatePerSecondSupplySide) || '0',
201
- incentiveBorrowApy: ((_f = (_d = morphoRewardsData.markets) === null || _d === void 0 ? void 0 : _d[(_e = marketData.underlyingTokenAddress) === null || _e === void 0 ? void 0 : _e.toLowerCase()]) === null || _f === void 0 ? void 0 : _f.morphoRatePerSecondBorrowSide) || '0',
204
+ incentiveBorrowApy: ((_f = (_d = morphoRewardsData === null || morphoRewardsData === void 0 ? void 0 : morphoRewardsData.markets) === null || _d === void 0 ? void 0 : _d[(_e = marketData.underlyingTokenAddress) === null || _e === void 0 ? void 0 : _e.toLowerCase()]) === null || _f === void 0 ? void 0 : _f.morphoRatePerSecondBorrowSide) || '0',
202
205
  totalBorrowVar: '0',
203
206
  borrowRateStable: '0',
204
207
  disabledStableBorrowing: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "0.0.132",
3
+ "version": "0.0.134",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -13,14 +13,14 @@ export const morphoAaveV3AssetEthMarket = [
13
13
  'ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH', 'sDAI', 'USDT',
14
14
  ];
15
15
 
16
- export const aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe'];
16
+ export const aaveV3AssetsDefaultMarketEth = ['ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe', 'tBTC', 'cbBTC'];
17
17
  export const aaveV3AssetsDefaultMarketOpt = [
18
18
  'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH', 'USDC',
19
19
  ];
20
20
  export const aaveV3AssetsDefaultMarketArb = [
21
21
  'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB', 'weETH', 'GHO',
22
22
  ];
23
- export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH'];
23
+ export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC'];
24
24
 
25
25
  // @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
26
26
  export const aaveV3AssetsDefaultMarket = {
@@ -204,7 +204,10 @@ export const getMorphoAaveV3MarketsData = async (web3: Web3, network: NetworkNum
204
204
  throw new Error('Failed to fetch market data.');
205
205
  }
206
206
 
207
- const morphoRewardsData = morphoRewards.status === 'fulfilled' ? await morphoRewards.value.json() : null;
207
+ let morphoRewardsData: any = null;
208
+ if (morphoRewards.status === 'fulfilled') {
209
+ morphoRewardsData = morphoRewards.value.ok ? await morphoRewards.value.json() : null;
210
+ }
208
211
 
209
212
  const assetsData: MorphoAaveV3AssetData[] = await Promise.all(loanInfo.map(async (info, i: number) => {
210
213
  const morphoMarketData = {
@@ -290,7 +293,7 @@ export const getMorphoAaveV3MarketsData = async (web3: Web3, network: NetworkNum
290
293
  incentiveSupplyToken: 'MORPHO',
291
294
  incentiveBorrowToken: 'MORPHO',
292
295
  incentiveSupplyApy: morphoRewardsData?.markets?.[marketData.underlyingTokenAddress?.toLowerCase()]?.morphoRatePerSecondSupplySide || '0',
293
- incentiveBorrowApy: morphoRewardsData.markets?.[marketData.underlyingTokenAddress?.toLowerCase()]?.morphoRatePerSecondBorrowSide || '0',
296
+ incentiveBorrowApy: morphoRewardsData?.markets?.[marketData.underlyingTokenAddress?.toLowerCase()]?.morphoRatePerSecondBorrowSide || '0',
294
297
 
295
298
  totalBorrowVar: '0', // Morpho doesn't have all these, keeping it for compatability
296
299
  borrowRateStable: '0',