@defisaver/positions-sdk 2.1.104 → 2.1.106

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.
Files changed (43) hide show
  1. package/cjs/aaveV4/index.js +53 -20
  2. package/cjs/claiming/aaveV3.d.ts +1 -1
  3. package/cjs/claiming/aaveV3.js +3 -4
  4. package/cjs/claiming/index.d.ts +1 -2
  5. package/cjs/claiming/index.js +1 -3
  6. package/cjs/config/contracts.d.ts +0 -214
  7. package/cjs/config/contracts.js +1 -6
  8. package/cjs/helpers/morphoBlueHelpers/index.d.ts +0 -1
  9. package/cjs/helpers/morphoBlueHelpers/index.js +27 -32
  10. package/cjs/portfolio/index.js +0 -27
  11. package/cjs/types/aaveV4.d.ts +9 -0
  12. package/cjs/types/claiming.d.ts +1 -13
  13. package/cjs/types/claiming.js +0 -2
  14. package/cjs/types/morphoBlue.d.ts +2 -3
  15. package/esm/aaveV4/index.js +53 -20
  16. package/esm/claiming/aaveV3.d.ts +1 -1
  17. package/esm/claiming/aaveV3.js +3 -4
  18. package/esm/claiming/index.d.ts +1 -2
  19. package/esm/claiming/index.js +1 -2
  20. package/esm/config/contracts.d.ts +0 -214
  21. package/esm/config/contracts.js +0 -4
  22. package/esm/helpers/morphoBlueHelpers/index.d.ts +0 -1
  23. package/esm/helpers/morphoBlueHelpers/index.js +27 -31
  24. package/esm/portfolio/index.js +0 -27
  25. package/esm/types/aaveV4.d.ts +9 -0
  26. package/esm/types/claiming.d.ts +1 -13
  27. package/esm/types/claiming.js +0 -2
  28. package/esm/types/morphoBlue.d.ts +2 -3
  29. package/package.json +1 -1
  30. package/src/aaveV4/index.ts +48 -20
  31. package/src/claiming/aaveV3.ts +2 -3
  32. package/src/claiming/index.ts +0 -2
  33. package/src/config/contracts.ts +0 -4
  34. package/src/helpers/morphoBlueHelpers/index.ts +29 -32
  35. package/src/portfolio/index.ts +0 -25
  36. package/src/types/aaveV4.ts +9 -0
  37. package/src/types/claiming.ts +0 -15
  38. package/src/types/morphoBlue.ts +2 -3
  39. package/cjs/claiming/morphoBlue.d.ts +0 -5
  40. package/cjs/claiming/morphoBlue.js +0 -113
  41. package/esm/claiming/morphoBlue.d.ts +0 -5
  42. package/esm/claiming/morphoBlue.js +0 -105
  43. package/src/claiming/morphoBlue.ts +0 -119
@@ -96912,220 +96912,6 @@ export declare const SparkRewardsController: {
96912
96912
  };
96913
96913
  };
96914
96914
  };
96915
- export declare const MorphoDistributor: {
96916
- readonly abi: readonly [{
96917
- readonly inputs: readonly [{
96918
- readonly internalType: "address";
96919
- readonly name: "initialOwner";
96920
- readonly type: "address";
96921
- }, {
96922
- readonly internalType: "uint256";
96923
- readonly name: "initialTimelock";
96924
- readonly type: "uint256";
96925
- }, {
96926
- readonly internalType: "bytes32";
96927
- readonly name: "initialRoot";
96928
- readonly type: "bytes32";
96929
- }, {
96930
- readonly internalType: "bytes32";
96931
- readonly name: "initialIpfsHash";
96932
- readonly type: "bytes32";
96933
- }];
96934
- readonly stateMutability: "nonpayable";
96935
- readonly type: "constructor";
96936
- }, {
96937
- readonly inputs: readonly [];
96938
- readonly name: "acceptRoot";
96939
- readonly outputs: readonly [];
96940
- readonly stateMutability: "nonpayable";
96941
- readonly type: "function";
96942
- }, {
96943
- readonly inputs: readonly [{
96944
- readonly internalType: "address";
96945
- readonly name: "account";
96946
- readonly type: "address";
96947
- }, {
96948
- readonly internalType: "address";
96949
- readonly name: "reward";
96950
- readonly type: "address";
96951
- }, {
96952
- readonly internalType: "uint256";
96953
- readonly name: "claimable";
96954
- readonly type: "uint256";
96955
- }, {
96956
- readonly internalType: "bytes32[]";
96957
- readonly name: "proof";
96958
- readonly type: "bytes32[]";
96959
- }];
96960
- readonly name: "claim";
96961
- readonly outputs: readonly [{
96962
- readonly internalType: "uint256";
96963
- readonly name: "amount";
96964
- readonly type: "uint256";
96965
- }];
96966
- readonly stateMutability: "nonpayable";
96967
- readonly type: "function";
96968
- }, {
96969
- readonly inputs: readonly [{
96970
- readonly internalType: "address";
96971
- readonly name: "account";
96972
- readonly type: "address";
96973
- }, {
96974
- readonly internalType: "address";
96975
- readonly name: "reward";
96976
- readonly type: "address";
96977
- }];
96978
- readonly name: "claimed";
96979
- readonly outputs: readonly [{
96980
- readonly internalType: "uint256";
96981
- readonly name: "amount";
96982
- readonly type: "uint256";
96983
- }];
96984
- readonly stateMutability: "view";
96985
- readonly type: "function";
96986
- }, {
96987
- readonly inputs: readonly [];
96988
- readonly name: "ipfsHash";
96989
- readonly outputs: readonly [{
96990
- readonly internalType: "bytes32";
96991
- readonly name: "";
96992
- readonly type: "bytes32";
96993
- }];
96994
- readonly stateMutability: "view";
96995
- readonly type: "function";
96996
- }, {
96997
- readonly inputs: readonly [{
96998
- readonly internalType: "address";
96999
- readonly name: "";
97000
- readonly type: "address";
97001
- }];
97002
- readonly name: "isUpdater";
97003
- readonly outputs: readonly [{
97004
- readonly internalType: "bool";
97005
- readonly name: "";
97006
- readonly type: "bool";
97007
- }];
97008
- readonly stateMutability: "view";
97009
- readonly type: "function";
97010
- }, {
97011
- readonly inputs: readonly [];
97012
- readonly name: "owner";
97013
- readonly outputs: readonly [{
97014
- readonly internalType: "address";
97015
- readonly name: "";
97016
- readonly type: "address";
97017
- }];
97018
- readonly stateMutability: "view";
97019
- readonly type: "function";
97020
- }, {
97021
- readonly inputs: readonly [];
97022
- readonly name: "pendingRoot";
97023
- readonly outputs: readonly [{
97024
- readonly internalType: "bytes32";
97025
- readonly name: "root";
97026
- readonly type: "bytes32";
97027
- }, {
97028
- readonly internalType: "bytes32";
97029
- readonly name: "ipfsHash";
97030
- readonly type: "bytes32";
97031
- }, {
97032
- readonly internalType: "uint256";
97033
- readonly name: "validAt";
97034
- readonly type: "uint256";
97035
- }];
97036
- readonly stateMutability: "view";
97037
- readonly type: "function";
97038
- }, {
97039
- readonly inputs: readonly [];
97040
- readonly name: "revokePendingRoot";
97041
- readonly outputs: readonly [];
97042
- readonly stateMutability: "nonpayable";
97043
- readonly type: "function";
97044
- }, {
97045
- readonly inputs: readonly [];
97046
- readonly name: "root";
97047
- readonly outputs: readonly [{
97048
- readonly internalType: "bytes32";
97049
- readonly name: "";
97050
- readonly type: "bytes32";
97051
- }];
97052
- readonly stateMutability: "view";
97053
- readonly type: "function";
97054
- }, {
97055
- readonly inputs: readonly [{
97056
- readonly internalType: "address";
97057
- readonly name: "newOwner";
97058
- readonly type: "address";
97059
- }];
97060
- readonly name: "setOwner";
97061
- readonly outputs: readonly [];
97062
- readonly stateMutability: "nonpayable";
97063
- readonly type: "function";
97064
- }, {
97065
- readonly inputs: readonly [{
97066
- readonly internalType: "bytes32";
97067
- readonly name: "newRoot";
97068
- readonly type: "bytes32";
97069
- }, {
97070
- readonly internalType: "bytes32";
97071
- readonly name: "newIpfsHash";
97072
- readonly type: "bytes32";
97073
- }];
97074
- readonly name: "setRoot";
97075
- readonly outputs: readonly [];
97076
- readonly stateMutability: "nonpayable";
97077
- readonly type: "function";
97078
- }, {
97079
- readonly inputs: readonly [{
97080
- readonly internalType: "address";
97081
- readonly name: "updater";
97082
- readonly type: "address";
97083
- }, {
97084
- readonly internalType: "bool";
97085
- readonly name: "active";
97086
- readonly type: "bool";
97087
- }];
97088
- readonly name: "setRootUpdater";
97089
- readonly outputs: readonly [];
97090
- readonly stateMutability: "nonpayable";
97091
- readonly type: "function";
97092
- }, {
97093
- readonly inputs: readonly [{
97094
- readonly internalType: "uint256";
97095
- readonly name: "newTimelock";
97096
- readonly type: "uint256";
97097
- }];
97098
- readonly name: "setTimelock";
97099
- readonly outputs: readonly [];
97100
- readonly stateMutability: "nonpayable";
97101
- readonly type: "function";
97102
- }, {
97103
- readonly inputs: readonly [{
97104
- readonly internalType: "bytes32";
97105
- readonly name: "newRoot";
97106
- readonly type: "bytes32";
97107
- }, {
97108
- readonly internalType: "bytes32";
97109
- readonly name: "newIpfsHash";
97110
- readonly type: "bytes32";
97111
- }];
97112
- readonly name: "submitRoot";
97113
- readonly outputs: readonly [];
97114
- readonly stateMutability: "nonpayable";
97115
- readonly type: "function";
97116
- }, {
97117
- readonly inputs: readonly [];
97118
- readonly name: "timelock";
97119
- readonly outputs: readonly [{
97120
- readonly internalType: "uint256";
97121
- readonly name: "";
97122
- readonly type: "uint256";
97123
- }];
97124
- readonly stateMutability: "view";
97125
- readonly type: "function";
97126
- }];
97127
- readonly networks: {};
97128
- };
97129
96915
  export declare const AaveRewardsController: {
97130
96916
  readonly abi: readonly [{
97131
96917
  readonly inputs: readonly [{
@@ -1262,10 +1262,6 @@ export const SparkRewardsController = {
1262
1262
  }
1263
1263
  }
1264
1264
  };
1265
- export const MorphoDistributor = {
1266
- "abi": [{ "inputs": [{ "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "uint256", "name": "initialTimelock", "type": "uint256" }, { "internalType": "bytes32", "name": "initialRoot", "type": "bytes32" }, { "internalType": "bytes32", "name": "initialIpfsHash", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [], "name": "acceptRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "address", "name": "reward", "type": "address" }, { "internalType": "uint256", "name": "claimable", "type": "uint256" }, { "internalType": "bytes32[]", "name": "proof", "type": "bytes32[]" }], "name": "claim", "outputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }, { "internalType": "address", "name": "reward", "type": "address" }], "name": "claimed", "outputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ipfsHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "isUpdater", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingRoot", "outputs": [{ "internalType": "bytes32", "name": "root", "type": "bytes32" }, { "internalType": "bytes32", "name": "ipfsHash", "type": "bytes32" }, { "internalType": "uint256", "name": "validAt", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "revokePendingRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "root", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "setOwner", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "newRoot", "type": "bytes32" }, { "internalType": "bytes32", "name": "newIpfsHash", "type": "bytes32" }], "name": "setRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "updater", "type": "address" }, { "internalType": "bool", "name": "active", "type": "bool" }], "name": "setRootUpdater", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "newTimelock", "type": "uint256" }], "name": "setTimelock", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "newRoot", "type": "bytes32" }, { "internalType": "bytes32", "name": "newIpfsHash", "type": "bytes32" }], "name": "submitRoot", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "timelock", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1267
- "networks": {}
1268
- };
1269
1265
  export const AaveRewardsController = {
1270
1266
  "abi": [{ "inputs": [{ "internalType": "address[]", "name": "assets", "type": "address[]" }, { "internalType": "address", "name": "user", "type": "address" }], "name": "getAllUserRewards", "outputs": [{ "internalType": "address[]", "name": "rewardsList", "type": "address[]" }, { "internalType": "uint256[]", "name": "unclaimedAmounts", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }],
1271
1267
  "networks": {
@@ -56,4 +56,3 @@ export declare const getRewardsForMarket: (marketId: string, network?: NetworkNu
56
56
  supplyApy: string;
57
57
  borrowApy: string;
58
58
  }>;
59
- export declare const getMorphoUnderlyingSymbol: (_symbol: string) => string;
@@ -14,7 +14,7 @@ import { calculateNetApy } from '../../staking';
14
14
  import { LeverageType, NetworkNumber, } from '../../types/common';
15
15
  import { borrowOperations, SECONDS_PER_YEAR, WAD } from '../../constants';
16
16
  import { MorphoBlueViewContractViem } from '../../contracts';
17
- import { compareAddresses, LONGER_TIMEOUT, wethToEth } from '../../services/utils';
17
+ import { compareAddresses, LONGER_TIMEOUT } from '../../services/utils';
18
18
  import { getViemProvider } from '../../services/viem';
19
19
  export const getMorphoBlueAggregatedPositionData = ({ usedAssets, assetsData, marketInfo }) => {
20
20
  var _a, _b, _c, _d, _e, _f;
@@ -128,12 +128,13 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, provider, n
128
128
  const supplyRate = getSupplyRate(data[1].totalSupplyAssets.toString(), data[1].totalBorrowAssets.toString(), data[0].toString(), data[1].fee.toString());
129
129
  return { borrowRate, supplyRate };
130
130
  });
131
- const API_URL = 'https://blue-api.morpho.org/graphql';
131
+ const API_URL = 'https://api.morpho.org/graphql';
132
+ // Morpho Blue ACRM (Adaptive Curve IRM) always targets 90% utilization — protocol constant
133
+ const ACRM_TARGET_UTILIZATION = '900000000000000000';
132
134
  const MARKET_QUERY = `
133
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
134
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
135
+ query MarketByUniqueKey($marketId: String!, $chainId: Int!) {
136
+ marketById(marketId: $marketId, chainId: $chainId) {
135
137
  reallocatableLiquidityAssets
136
- targetBorrowUtilization
137
138
  loanAsset {
138
139
  address
139
140
  decimals
@@ -150,8 +151,8 @@ const MARKET_QUERY = `
150
151
  address
151
152
  name
152
153
  }
153
- allocationMarket {
154
- uniqueKey
154
+ withdrawMarket {
155
+ marketId
155
156
  loanAsset {
156
157
  address
157
158
  }
@@ -175,14 +176,14 @@ const MARKET_QUERY = `
175
176
  address
176
177
  }
177
178
  irmAddress
178
- lltv
179
+ lltv
179
180
  }
180
181
  }
181
182
  `;
182
183
  const REWARDS_QUERY = `
183
- query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
184
- marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
185
- uniqueKey
184
+ query MarketByUniqueKey($marketId: String!, $chainId: Int!) {
185
+ marketById(marketId: $marketId, chainId: $chainId) {
186
+ marketId
186
187
  state {
187
188
  rewards {
188
189
  amountPerSuppliedToken
@@ -211,17 +212,17 @@ export const getReallocatableLiquidity = (marketId_1, ...args_1) => __awaiter(vo
211
212
  headers: { 'Content-Type': 'application/json' },
212
213
  body: JSON.stringify({
213
214
  query: MARKET_QUERY,
214
- variables: { uniqueKey: marketId, chainId: network },
215
+ variables: { marketId, chainId: network },
215
216
  }),
216
217
  signal: AbortSignal.timeout(LONGER_TIMEOUT),
217
218
  });
218
219
  const data = yield response.json();
219
- const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketByUniqueKey;
220
+ const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
220
221
  if (!marketData)
221
222
  throw new Error('Market data not found');
222
223
  return {
223
224
  reallocatableLiquidity: marketData.reallocatableLiquidityAssets,
224
- targetBorrowUtilization: marketData.targetBorrowUtilization,
225
+ targetBorrowUtilization: ACRM_TARGET_UTILIZATION,
225
226
  };
226
227
  }
227
228
  catch (error) {
@@ -273,12 +274,12 @@ export const getReallocation = (market_1, assetsData_1, amountToBorrow_1, ...arg
273
274
  headers: { 'Content-Type': 'application/json' },
274
275
  body: JSON.stringify({
275
276
  query: MARKET_QUERY,
276
- variables: { uniqueKey: marketId, chainId: network },
277
+ variables: { marketId, chainId: network },
277
278
  }),
278
279
  signal: AbortSignal.timeout(LONGER_TIMEOUT),
279
280
  });
280
281
  const data = yield response.json();
281
- const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketByUniqueKey;
282
+ const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
282
283
  if (!marketData)
283
284
  throw new Error('Market data not found');
284
285
  const loanAssetInfo = getAssetInfoByAddress(loanToken, network);
@@ -288,9 +289,9 @@ export const getReallocation = (market_1, assetsData_1, amountToBorrow_1, ...arg
288
289
  const newTotalBorrowAssets = new Dec(totalBorrowWei).add(amountToBorrow).toString();
289
290
  const newUtil = new Dec(newTotalBorrowAssets).div(totalSupplyWei).toString();
290
291
  const newUtilScaled = new Dec(newUtil).mul(1e18).toString();
291
- if (new Dec(newUtilScaled).lt(marketData.targetBorrowUtilization))
292
+ if (new Dec(newUtilScaled).lt(ACRM_TARGET_UTILIZATION))
292
293
  return { vaults: [], withdrawals: [] };
293
- const liquidityToAllocate = getLiquidityToAllocate(amountToBorrow, totalBorrowWei, totalSupplyWei, marketData.targetBorrowUtilization, marketData.reallocatableLiquidityAssets);
294
+ const liquidityToAllocate = getLiquidityToAllocate(amountToBorrow, totalBorrowWei, totalSupplyWei, ACRM_TARGET_UTILIZATION, marketData.reallocatableLiquidityAssets);
294
295
  const vaultTotalAssets = marketData.publicAllocatorSharedLiquidity.reduce((acc, item) => {
295
296
  const vaultAddress = item.vault.address;
296
297
  acc[vaultAddress] = new Dec(acc[vaultAddress] || '0').add(item.assets).toString();
@@ -312,14 +313,14 @@ export const getReallocation = (market_1, assetsData_1, amountToBorrow_1, ...arg
312
313
  totalReallocated = new Dec(totalReallocated).add(amountToTake).toString();
313
314
  const withdrawal = [
314
315
  [
315
- item.allocationMarket.loanAsset.address,
316
- (_b = item.allocationMarket.collateralAsset) === null || _b === void 0 ? void 0 : _b.address,
317
- (_c = item.allocationMarket.oracle) === null || _c === void 0 ? void 0 : _c.address,
318
- item.allocationMarket.irmAddress,
319
- item.allocationMarket.lltv,
316
+ item.withdrawMarket.loanAsset.address,
317
+ (_b = item.withdrawMarket.collateralAsset) === null || _b === void 0 ? void 0 : _b.address,
318
+ (_c = item.withdrawMarket.oracle) === null || _c === void 0 ? void 0 : _c.address,
319
+ item.withdrawMarket.irmAddress,
320
+ item.withdrawMarket.lltv,
320
321
  ],
321
322
  amountToTake.toString(),
322
- item.allocationMarket.uniqueKey,
323
+ item.withdrawMarket.marketId,
323
324
  ];
324
325
  if (!withdrawalsPerVault[vaultAddress]) {
325
326
  withdrawalsPerVault[vaultAddress] = [];
@@ -346,11 +347,11 @@ export const getRewardsForMarket = (marketId_1, ...args_1) => __awaiter(void 0,
346
347
  headers: { 'Content-Type': 'application/json' },
347
348
  body: JSON.stringify({
348
349
  query: REWARDS_QUERY,
349
- variables: { uniqueKey: marketId, chainId: network },
350
+ variables: { marketId, chainId: network },
350
351
  }),
351
352
  });
352
353
  const data = yield response.json();
353
- const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketByUniqueKey;
354
+ const marketData = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.marketById;
354
355
  if (!marketData)
355
356
  throw new Error('Market data not found');
356
357
  const morphoAssetInfo = getAssetInfo('MORPHO');
@@ -359,8 +360,3 @@ export const getRewardsForMarket = (marketId_1, ...args_1) => __awaiter(void 0,
359
360
  const borrowAprPercent = new Dec(borrowApr).mul(100).toString();
360
361
  return { supplyApy: aprToApy(supplyAprPercent), borrowApy: aprToApy(borrowAprPercent) };
361
362
  });
362
- export const getMorphoUnderlyingSymbol = (_symbol) => {
363
- if (_symbol === 'MORPHO Legacy')
364
- return 'MORPHO';
365
- return wethToEth(_symbol);
366
- };
@@ -31,7 +31,6 @@ import { getUmbrellaData } from '../umbrella';
31
31
  import { getMeritUnclaimedRewards, getUnclaimedRewardsForAllMarkets } from '../claiming/aaveV3';
32
32
  import { getCompoundV3Rewards } from '../claiming/compV3';
33
33
  import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
34
- import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
35
34
  import { getKingRewards } from '../claiming/king';
36
35
  import { fetchEthenaAirdropRewards } from '../claiming/ethena';
37
36
  import { _getAaveV4AccountData, _getAaveV4SpokeData } from '../aaveV4';
@@ -39,7 +38,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
39
38
  return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
40
39
  const isMainnet = network === NetworkNumber.Eth;
41
40
  const isFluidSupported = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Base, NetworkNumber.Plasma].includes(network);
42
- const isMorphoRewardsSupported = [NetworkNumber.Eth, NetworkNumber.Base].includes(network);
43
41
  const morphoMarkets = Object.values(MorphoBlueMarkets(network)).filter((market) => market.chainIds.includes(network));
44
42
  const compoundV3Markets = Object.values(CompoundMarkets(network)).filter((market) => market.chainIds.includes(network) && market.value !== CompoundVersions.CompoundV2);
45
43
  const sparkMarkets = Object.values(SparkMarkets(network)).filter((market) => market.chainIds.includes(network));
@@ -127,7 +125,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
127
125
  spark: {},
128
126
  spk: {},
129
127
  king: {},
130
- morpho: {},
131
128
  ethena: {},
132
129
  };
133
130
  }
@@ -337,30 +334,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
337
334
  rewardsData[address.toLowerCase()].aaveV3 = { error: `Error fetching Aave V3 rewards data for address ${address}`, data: null };
338
335
  }
339
336
  }))).flat(),
340
- // Batch Morpho Blue rewards
341
- (() => __awaiter(this, void 0, void 0, function* () {
342
- if (!isMorphoRewardsSupported)
343
- return;
344
- try {
345
- const morphoRewards = yield fetchMorphoBlueRewards(client, network, addresses);
346
- for (const address of addresses) {
347
- const lowerAddress = address.toLowerCase();
348
- rewardsData[lowerAddress].morpho = {
349
- error: '',
350
- data: morphoRewards[lowerAddress] || [],
351
- };
352
- }
353
- }
354
- catch (error) {
355
- console.error('Error fetching Morpho Blue rewards data in batch:', error);
356
- for (const address of addresses) {
357
- rewardsData[address.toLowerCase()].morpho = {
358
- error: 'Error fetching Morpho Blue rewards data in batch',
359
- data: null,
360
- };
361
- }
362
- }
363
- }))(),
364
337
  // Batch Spark Airdrop rewards
365
338
  (() => __awaiter(this, void 0, void 0, function* () {
366
339
  try {
@@ -74,6 +74,8 @@ export interface AaveV4ReserveAssetOnChain {
74
74
  }
75
75
  export interface AaveV4ReserveAssetData {
76
76
  symbol: string;
77
+ /** Underlying token decimals as reported on-chain (independent of `@defisaver/tokens`). */
78
+ decimals: number;
77
79
  underlying: EthAddress;
78
80
  hub: EthAddress;
79
81
  hubName: string;
@@ -119,6 +121,11 @@ export interface AaveV4ReserveAssetData {
119
121
  hubLiquidity: string;
120
122
  premiumMultiplier: string;
121
123
  liquidityFee: string;
124
+ /**
125
+ * True when the underlying token is missing from `@defisaver/tokens` (placeholder `?` asset).
126
+ * The reserve is kept for read-only display, but amounts are zeroed and all actions are disabled.
127
+ */
128
+ isUnsupported?: boolean;
122
129
  }
123
130
  export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
124
131
  export interface AaveV4UsedReserveAsset {
@@ -138,6 +145,8 @@ export interface AaveV4UsedReserveAsset {
138
145
  isBorrowed: boolean;
139
146
  collateral: boolean;
140
147
  collateralFactor: number;
148
+ /** True when the underlying token is missing from `@defisaver/tokens` (placeholder `?` asset). */
149
+ isUnsupported?: boolean;
141
150
  }
142
151
  export interface AaveV4AggregatedPositionData {
143
152
  suppliedUsd: string;
@@ -8,8 +8,6 @@ export declare enum ClaimType {
8
8
  COMPOUND_V3_COMP = "COMPOUND_V3_COMP",
9
9
  /** Rewards from Spark (wstETH only for now) */
10
10
  SPARK_REWARDS = "SPARK_REWARDS",
11
- /** Rewards from Morpho */
12
- MORPHO = "MORPHO",
13
11
  /** Rewards from King (prev LTR^2 - received for weETH holding) */
14
12
  KING_REWARDS = "KING_REWARDS",
15
13
  /** Spark Airdrop */
@@ -57,16 +55,6 @@ export type KingRewardsClaimableToken = _ClaimableTokenPartial & {
57
55
  merkleProofs: string[];
58
56
  };
59
57
  };
60
- export type MorphoClaimableToken = _ClaimableTokenPartial & {
61
- claimType: ClaimType.MORPHO;
62
- additionalClaimFields: {
63
- originalAmount: string;
64
- merkleProofs: string[];
65
- distributor: EthAddress;
66
- isLegacy: boolean;
67
- txData: string;
68
- };
69
- };
70
58
  export type CompoundV3CompClaimableToken = _ClaimableTokenPartial & {
71
59
  claimType: ClaimType.COMPOUND_V3_COMP;
72
60
  additionalClaimFields: {
@@ -93,5 +81,5 @@ export type SparkWstEthRewardsClaimableToken = _ClaimableTokenPartial & {
93
81
  export type EthenaAirdropClaimableToken = _ClaimableTokenPartial & {
94
82
  claimType: ClaimType.ETHENA_AIRDROP;
95
83
  };
96
- export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | MorphoClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
84
+ export type ClaimableToken = AaveRewardsClaimableToken | AaveMeritRewardsClaimableToken | CompoundV3CompClaimableToken | SparkRewardsClaimableToken | KingRewardsClaimableToken | SparkAirdropClaimableToken | SparkWstEthRewardsClaimableToken | EthenaAirdropClaimableToken;
97
85
  export {};
@@ -8,8 +8,6 @@ export var ClaimType;
8
8
  ClaimType["COMPOUND_V3_COMP"] = "COMPOUND_V3_COMP";
9
9
  /** Rewards from Spark (wstETH only for now) */
10
10
  ClaimType["SPARK_REWARDS"] = "SPARK_REWARDS";
11
- /** Rewards from Morpho */
12
- ClaimType["MORPHO"] = "MORPHO";
13
11
  /** Rewards from King (prev LTR^2 - received for weETH holding) */
14
12
  ClaimType["KING_REWARDS"] = "KING_REWARDS";
15
13
  /** Spark Airdrop */
@@ -189,12 +189,12 @@ export interface MorphoBlueAllocationMarket {
189
189
  };
190
190
  irmAddress: string;
191
191
  lltv: string;
192
- uniqueKey: string;
192
+ marketId: string;
193
193
  }
194
194
  export interface MorphoBluePublicAllocatorItem {
195
195
  vault: MorphoBlueVault;
196
196
  assets: string;
197
- allocationMarket: MorphoBlueAllocationMarket;
197
+ withdrawMarket: MorphoBlueAllocationMarket;
198
198
  }
199
199
  export interface MorphoBlueAllocatorMarketState {
200
200
  borrowAssets: string;
@@ -202,7 +202,6 @@ export interface MorphoBlueAllocatorMarketState {
202
202
  }
203
203
  export interface MorphoBlueRealloactionMarketData {
204
204
  reallocatableLiquidityAssets: string;
205
- targetBorrowUtilization: string;
206
205
  publicAllocatorSharedLiquidity: MorphoBluePublicAllocatorItem[];
207
206
  state: MorphoBlueAllocatorMarketState;
208
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.104",
3
+ "version": "2.1.106",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",