@defisaver/positions-sdk 2.1.161-portfolio-api-2-dev → 2.1.162-npm-token-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.
Files changed (101) hide show
  1. package/cjs/aaveV3/index.d.ts +12 -2
  2. package/cjs/aaveV3/index.js +7 -1
  3. package/cjs/aaveV3/sgho.d.ts +16 -2
  4. package/cjs/claiming/aaveV3.d.ts +2 -2
  5. package/cjs/claiming/ethena.d.ts +1 -2
  6. package/cjs/claiming/king.d.ts +1 -2
  7. package/cjs/claiming/spark.d.ts +2 -2
  8. package/cjs/fluid/index.d.ts +49 -5
  9. package/cjs/helpers/aaveHelpers/index.d.ts +9 -1
  10. package/cjs/helpers/aaveHelpers/index.js +23 -6
  11. package/cjs/liquity/index.d.ts +12 -2
  12. package/cjs/liquityV2/index.d.ts +23 -3
  13. package/cjs/portfolio/index.d.ts +5 -5
  14. package/cjs/portfolio/index.js +36 -51
  15. package/cjs/savings/index.js +5 -2
  16. package/cjs/savings/morphoVaults/index.d.ts +1 -1
  17. package/cjs/savings/morphoVaults/index.js +56 -18
  18. package/cjs/savings/morphoVaults/options.d.ts +2 -0
  19. package/cjs/savings/morphoVaults/options.js +61 -1
  20. package/cjs/spark/index.js +1 -0
  21. package/cjs/types/aave.d.ts +3 -98
  22. package/cjs/types/compound.d.ts +2 -26
  23. package/cjs/types/curveUsd.d.ts +1 -9
  24. package/cjs/types/fluid.d.ts +0 -13
  25. package/cjs/types/index.d.ts +0 -1
  26. package/cjs/types/index.js +0 -1
  27. package/cjs/types/liquity.d.ts +0 -12
  28. package/cjs/types/liquityV2.d.ts +0 -24
  29. package/cjs/types/llamaLend.d.ts +1 -12
  30. package/cjs/types/morphoBlue.d.ts +0 -2
  31. package/cjs/types/portfolio.d.ts +10 -88
  32. package/cjs/types/savings/morphoVaults.d.ts +10 -2
  33. package/cjs/types/savings/morphoVaults.js +9 -1
  34. package/cjs/types/spark.d.ts +1 -21
  35. package/cjs/umbrella/index.d.ts +3 -2
  36. package/esm/aaveV3/index.d.ts +12 -2
  37. package/esm/aaveV3/index.js +7 -1
  38. package/esm/aaveV3/sgho.d.ts +16 -2
  39. package/esm/claiming/aaveV3.d.ts +2 -2
  40. package/esm/claiming/aaveV3.js +1 -1
  41. package/esm/claiming/ethena.d.ts +1 -2
  42. package/esm/claiming/king.d.ts +1 -2
  43. package/esm/claiming/spark.d.ts +2 -2
  44. package/esm/claiming/spark.js +1 -1
  45. package/esm/fluid/index.d.ts +49 -5
  46. package/esm/helpers/aaveHelpers/index.d.ts +9 -1
  47. package/esm/helpers/aaveHelpers/index.js +20 -5
  48. package/esm/liquity/index.d.ts +12 -2
  49. package/esm/liquityV2/index.d.ts +23 -3
  50. package/esm/portfolio/index.d.ts +5 -5
  51. package/esm/portfolio/index.js +36 -51
  52. package/esm/savings/index.js +5 -2
  53. package/esm/savings/morphoVaults/index.d.ts +1 -1
  54. package/esm/savings/morphoVaults/index.js +57 -19
  55. package/esm/savings/morphoVaults/options.d.ts +2 -0
  56. package/esm/savings/morphoVaults/options.js +61 -1
  57. package/esm/spark/index.js +1 -0
  58. package/esm/types/aave.d.ts +3 -98
  59. package/esm/types/compound.d.ts +2 -26
  60. package/esm/types/curveUsd.d.ts +1 -9
  61. package/esm/types/fluid.d.ts +0 -13
  62. package/esm/types/index.d.ts +0 -1
  63. package/esm/types/index.js +0 -1
  64. package/esm/types/liquity.d.ts +0 -12
  65. package/esm/types/liquityV2.d.ts +0 -24
  66. package/esm/types/llamaLend.d.ts +1 -12
  67. package/esm/types/morphoBlue.d.ts +0 -2
  68. package/esm/types/portfolio.d.ts +10 -88
  69. package/esm/types/savings/morphoVaults.d.ts +10 -2
  70. package/esm/types/savings/morphoVaults.js +8 -0
  71. package/esm/types/spark.d.ts +1 -21
  72. package/esm/umbrella/index.d.ts +3 -2
  73. package/package.json +3 -2
  74. package/src/aaveV3/index.ts +7 -3
  75. package/src/aaveV3/sgho.ts +17 -2
  76. package/src/claiming/aaveV3.ts +2 -4
  77. package/src/claiming/ethena.ts +5 -5
  78. package/src/claiming/king.ts +3 -3
  79. package/src/claiming/spark.ts +4 -6
  80. package/src/fluid/index.ts +3 -4
  81. package/src/helpers/aaveHelpers/index.ts +24 -7
  82. package/src/liquity/index.ts +2 -2
  83. package/src/liquityV2/index.ts +3 -3
  84. package/src/portfolio/index.ts +57 -76
  85. package/src/savings/index.ts +5 -2
  86. package/src/savings/morphoVaults/index.ts +73 -21
  87. package/src/savings/morphoVaults/options.ts +67 -1
  88. package/src/spark/index.ts +1 -0
  89. package/src/types/aave.ts +2 -104
  90. package/src/types/compound.ts +2 -38
  91. package/src/types/curveUsd.ts +1 -17
  92. package/src/types/fluid.ts +0 -14
  93. package/src/types/index.ts +1 -2
  94. package/src/types/liquity.ts +1 -13
  95. package/src/types/liquityV2.ts +1 -26
  96. package/src/types/llamaLend.ts +1 -19
  97. package/src/types/morphoBlue.ts +0 -3
  98. package/src/types/portfolio.ts +11 -111
  99. package/src/types/savings/morphoVaults.ts +11 -1
  100. package/src/types/spark.ts +1 -25
  101. package/src/umbrella/index.ts +1 -2
@@ -1,5 +1,5 @@
1
1
  import { Client } from 'viem';
2
- import { AaveMarketInfo, AaveV3MarketData, AaveV3PositionData, AaveV3UsedAssets, EModeCategoryDataMapping, StakeAaveData } from '../types';
2
+ import { AaveMarketInfo, AaveV3MarketData, AaveV3PositionData, AaveV3UsedAssets, EModeCategoryDataMapping } from '../types';
3
3
  import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
4
4
  import { getMeritCampaigns } from './merit';
5
5
  import { getMerkleCampaigns } from './merkl';
@@ -37,7 +37,17 @@ export declare const getAaveV3AccountData: (provider: EthereumProvider, network:
37
37
  export declare const getAaveV3FullPositionData: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, market: AaveMarketInfo) => Promise<AaveV3PositionData>;
38
38
  export declare const REWARDABLE_ASSETS: readonly ["0x028171bCA77440897B824Ca71D1c56caC55b68A3", "0x6C3c78838c761c6Ac7bE9F59fe808ea2A6E4379d", "0xD37EE7e4f452C6638c96536e68090De8cBcdb583", "0x279AF5b99540c1A3A7E3CDd326e19659401eF99e", "0xBcca60bB61934080951369a648Fb03DF4F96263C", "0x619beb58998eD2278e08620f97007e1116D5D25b", "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811", "0x531842cEbbdD378f8ee36D171d6cC9C4fcf475Ec", "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656", "0x9c39809Dec7F95F5e0713634a4D0701329B3b4d2", "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e", "0xF63B34710400CAd3e044cFfDcAb00a0f32E33eCf", "0xa06bC25B5805d5F8d82847D191Cb4Af5A3e873E0", "0x0b8f12b1788BFdE65Aa1ca52E3e9F3Ba401be16D", "0x6C5024Cd4F8A59110119C56f8933403A539555EB", "0xdC6a3Ab17299D9C2A412B0e0a4C1f55446AE0817", "0x5165d24277cD063F5ac44Efd447B27025e888f37", "0x7EbD09022Be45AD993BAA1CEc61166Fcc8644d97", "0xF256CC7847E919FAc9B808cC216cAc87CCF2f47a", "0xfAFEDF95E21184E3d880bd56D4806c4b8d31c69A", "0xB9D7CB55f463405CDfBe4E90a6D2Df01C2B92BF1", "0x5BdB050A92CADcCfCDcCCBFC17204a1C9cC0Ab73", "0xc713e5E149D5D0715DcD1c156a020976e7E56B88", "0xba728eAd5e496BE00DCF66F650b6d7758eCB50f8", "0x101cc05f4A51C0319f570d5E146a8C625198e636", "0x01C0eb1f8c6F1C1bF74ae028697ce7AA2a8b0E92", "0xc9BC48c72154ef3e5425641a3c747242112a46AF", "0xB5385132EE8321977FfF44b60cDE9fE9AB0B4e6b", "0x272F97b7a56a387aE942350bBC7Df5700f8a4576", "0x13210D4Fe0d5402bd7Ecbc4B5bC5cFcA3b71adB0", "0x2e8f4bdbe3d47d7d7de490437aea9915d930f1a3", "0xfdb93b3b10936cf81fa59a02a7523b6e2149b2b7", "0xA361718326c15715591c299427c62086F69923D9", "0xbA429f7011c9fa04cDd46a2Da24dc0FF0aC6099c", "0xd4937682df3C8aEF4FE912A96A74121C0829E664", "0xfE8F19B17fFeF0fDbfe2671F248903055AFAA8Ca", "0x683923dB55Fead99A79Fa01A27EeC3cB19679cC3", "0xC2e10006AccAb7B45D9184FcF5b7EC7763f5BaAe", "0x8dAE6Cb04688C62d939ed9B68d32Bc62e49970b1", "0x00ad8eBF64F141f1C81e9f8f792d3d1631c6c684", "0x6F634c6135D2EBD550000ac92F494F9CB8183dAe", "0x4dDff5885a67E4EffeC55875a3977D7E60F82ae0"];
39
39
  export declare const fetchYearlyMeritApyForStakingGho: () => Promise<string>;
40
- export declare const getStakeAaveData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<StakeAaveData>;
40
+ export declare const getStakeAaveData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<{
41
+ activatedCooldown: string;
42
+ activatedCooldownAmount: string;
43
+ stkAaveRewardsBalance: string;
44
+ aaveRewardsBalance: string;
45
+ stkAaveBalance: string;
46
+ stkGhoBalance: string;
47
+ ghoMeritApy: string;
48
+ stkAaveApy: string;
49
+ sgho: import("./sgho").SghoData;
50
+ }>;
41
51
  export { getMeritCampaigns, getMerkleCampaigns, };
42
52
  export { getSghoData } from './sgho';
43
53
  export type { SghoData, SghoUserData } from './sgho';
@@ -41,7 +41,10 @@ const aaveV3EmodeCategoriesMapping = (extractedState, usedAssets) => {
41
41
  : !usedAssetsValues.filter(u => u.isBorrowed && !e.borrowAssets.includes(u.symbol)).length;
42
42
  const afterEnteringCategory = (0, aaveHelpers_1.aaveAnyGetAggregatedPositionData)(Object.assign(Object.assign({}, extractedState), { usedAssets, eModeCategory: e.id }));
43
43
  const willStayOverCollateralized = new decimal_js_1.default(afterEnteringCategory.ratio === 'NaN' ? '0' : afterEnteringCategory.ratio).eq(0) || new decimal_js_1.default(afterEnteringCategory.ratio).gt(afterEnteringCategory.liqPercent);
44
- const enteringTerms = [borrowingOnlyFromCategory, willStayOverCollateralized];
44
+ const collateralOnlyFromCategory = e.id === 0 || !e.isolated
45
+ ? true
46
+ : !usedAssetsValues.filter(u => u.isSupplied && u.collateral && !e.collateralAssets.includes(u.symbol)).length;
47
+ const enteringTerms = [borrowingOnlyFromCategory, willStayOverCollateralized, collateralOnlyFromCategory];
45
48
  categoriesMapping[e.id] = {
46
49
  enteringTerms,
47
50
  canEnterCategory: !enteringTerms.includes(false),
@@ -59,6 +62,7 @@ const aaveV3EmodeCategoriesMapping = (extractedState, usedAssets) => {
59
62
  exports.aaveV3EmodeCategoriesMapping = aaveV3EmodeCategoriesMapping;
60
63
  function _getAaveV3MarketData(provider_1, network_1, market_1) {
61
64
  return __awaiter(this, arguments, void 0, function* (provider, network, market, blockNumber = 'latest') {
65
+ var _a;
62
66
  const _addresses = market.assets.map(a => (0, tokens_1.getAssetInfo)((0, utils_1.getWrappedNativeAssetFromUnwrapped)(a), network).address);
63
67
  const loanInfoContract = (0, contracts_1.AaveV3ViewContractViem)(provider, network);
64
68
  const aaveIncentivesContract = (0, contracts_1.AaveIncentiveDataProviderV3ContractViem)(provider, network);
@@ -92,6 +96,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
92
96
  borrowableBitmap: eModesInfo[i].borrowableBitmap.toString(),
93
97
  collateralBitmap: eModesInfo[i].collateralBitmap.toString(),
94
98
  ltvzeroBitmap: eModesInfo[i].ltvzeroBitmap.toString(),
99
+ isolated: (_a = eModesInfo[i].isolated) !== null && _a !== void 0 ? _a : false,
95
100
  borrowAssets: [],
96
101
  collateralAssets: [],
97
102
  ltvZeroAssets: [],
@@ -307,6 +312,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
307
312
  collateralAssets: assetsData.map((a) => a.symbol),
308
313
  borrowAssets: assetsData.map((a) => a.symbol),
309
314
  ltvZeroAssets: [],
315
+ isolated: false,
310
316
  };
311
317
  return { assetsData: payload, eModeCategoriesData };
312
318
  });
@@ -1,4 +1,18 @@
1
1
  import { EthAddress, NetworkNumber } from '../types/common';
2
- import { SghoData } from '../types/aave';
3
- export type { SghoData, SghoUserData } from '../types/aave';
2
+ export interface SghoUserData {
3
+ shares: string;
4
+ balance: string;
5
+ maxDeposit: string;
6
+ maxWithdraw: string;
7
+ underlyingBalance: string;
8
+ }
9
+ export interface SghoData {
10
+ totalAssets: string;
11
+ totalSupply: string;
12
+ supplyCap: string;
13
+ /** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
14
+ targetRate: string;
15
+ paused: boolean;
16
+ user: SghoUserData;
17
+ }
4
18
  export declare const getSghoData: (network: NetworkNumber, address?: EthAddress) => Promise<SghoData>;
@@ -1,6 +1,6 @@
1
1
  import { Client } from 'viem';
2
2
  import { EthAddress, NetworkNumber } from '../types';
3
- import { AaveRewardsClaimableToken, ClaimableToken, MerklRewardsClaimableToken } from '../types/claiming';
4
- export declare function getUnclaimedRewardsForAllMarkets(provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress): Promise<AaveRewardsClaimableToken[]>;
3
+ import { ClaimableToken, MerklRewardsClaimableToken } from '../types/claiming';
4
+ export declare function getUnclaimedRewardsForAllMarkets(provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress): Promise<ClaimableToken[]>;
5
5
  export declare function getMerklUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<MerklRewardsClaimableToken[]>;
6
6
  export declare function getMeritUnclaimedRewards(account: EthAddress, network: NetworkNumber): Promise<ClaimableToken[]>;
@@ -1,4 +1,3 @@
1
1
  import { EthAddress } from '../types/common';
2
- import { EthenaAirdropClaimableToken } from '../types/claiming';
3
2
  export declare const fetchEthenaAirdropReward: (address: EthAddress) => Promise<any>;
4
- export declare const fetchEthenaAirdropRewards: (walletAddresses: EthAddress[]) => Promise<Record<string, EthenaAirdropClaimableToken[]>>;
3
+ export declare const fetchEthenaAirdropRewards: (walletAddresses: EthAddress[]) => Promise<Record<string, any[]>>;
@@ -1,5 +1,4 @@
1
1
  import { Client } from 'viem';
2
2
  import { EthAddress, NetworkNumber } from '../types/common';
3
- import { KingRewardsClaimableToken } from '../types/claiming';
4
3
  export declare const fetchKingRewards: (walletAddress: EthAddress) => Promise<any>;
5
- export declare const getKingRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, KingRewardsClaimableToken[]>>;
4
+ export declare const getKingRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, any[]>>;
@@ -1,6 +1,6 @@
1
1
  import { Client } from 'viem';
2
2
  import { EthAddress, NetworkNumber } from '../types/common';
3
- import { SparkAirdropClaimableToken, SparkRewardsClaimableToken } from '../types/claiming';
3
+ import { SparkRewardsClaimableToken } from '../types/claiming';
4
4
  export declare const fetchSpkAirdropRewards: (walletAddress: EthAddress) => Promise<any>;
5
- export declare const fetchSparkAirdropRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, SparkAirdropClaimableToken[]>>;
5
+ export declare const fetchSparkAirdropRewards: (provider: Client, network: NetworkNumber, walletAddresses: EthAddress[]) => Promise<Record<string, any[]>>;
6
6
  export declare const fetchSparkRewards: (provider: Client, network: NetworkNumber, walletAddress: EthAddress, marketAddress: EthAddress) => Promise<SparkRewardsClaimableToken[]>;
@@ -1,6 +1,6 @@
1
1
  import { Client, PublicClient } from 'viem';
2
2
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
3
- import { FluidAssetsData, FluidEarnPositionData, FluidMarketData, FluidMarketInfo, FluidUsedAssets, FluidVaultData, InnerFluidMarketData } from '../types';
3
+ import { FluidAssetsData, FluidMarketData, FluidMarketInfo, FluidUsedAssets, FluidVaultData, InnerFluidMarketData } from '../types';
4
4
  export { FluidMerklOpportunityType, buildFluidMerklRewardMap, getFluidMerklCampaigns, attachFluidMerklIncentives, } from './merkl';
5
5
  export declare const EMPTY_USED_ASSET: {
6
6
  isSupplied: boolean;
@@ -71,10 +71,54 @@ export declare const getFluidTokenData: (provider: EthereumProvider, network: Ne
71
71
  depositRate: string;
72
72
  withdrawRate: string;
73
73
  }>;
74
- export declare const _getFluidDepositData: (provider: Client, network: NetworkNumber, token: string, address: EthAddress) => Promise<FluidEarnPositionData>;
75
- export declare const getFluidDepositData: (provider: EthereumProvider, network: NetworkNumber, token: string, address: EthAddress) => Promise<FluidEarnPositionData>;
76
- export declare const _getAllUserEarnPositionsWithFTokens: (provider: Client, network: NetworkNumber, user: EthAddress) => Promise<FluidEarnPositionData[]>;
77
- export declare const getAllUserEarnPositionsWithFTokens: (provider: EthereumProvider, network: NetworkNumber, user: EthAddress) => Promise<FluidEarnPositionData[]>;
74
+ export declare const _getFluidDepositData: (provider: Client, network: NetworkNumber, token: string, address: EthAddress) => Promise<{
75
+ fTokenAddress: string | undefined;
76
+ fTokenSymbol: string;
77
+ decimals: string;
78
+ totalDeposited: string;
79
+ withdrawable: string;
80
+ apy: string;
81
+ depositRate: string;
82
+ withdrawRate: string;
83
+ deposited: string;
84
+ depositedShares: string;
85
+ }>;
86
+ export declare const getFluidDepositData: (provider: EthereumProvider, network: NetworkNumber, token: string, address: EthAddress) => Promise<{
87
+ fTokenAddress: string | undefined;
88
+ fTokenSymbol: string;
89
+ decimals: string;
90
+ totalDeposited: string;
91
+ withdrawable: string;
92
+ apy: string;
93
+ depositRate: string;
94
+ withdrawRate: string;
95
+ deposited: string;
96
+ depositedShares: string;
97
+ }>;
98
+ export declare const _getAllUserEarnPositionsWithFTokens: (provider: Client, network: NetworkNumber, user: EthAddress) => Promise<{
99
+ fTokenAddress: string | undefined;
100
+ fTokenSymbol: string;
101
+ decimals: string;
102
+ totalDeposited: string;
103
+ withdrawable: string;
104
+ apy: string;
105
+ depositRate: string;
106
+ withdrawRate: string;
107
+ deposited: string;
108
+ depositedShares: string;
109
+ }[]>;
110
+ export declare const getAllUserEarnPositionsWithFTokens: (provider: EthereumProvider, network: NetworkNumber, user: EthAddress) => Promise<{
111
+ fTokenAddress: string | undefined;
112
+ fTokenSymbol: string;
113
+ decimals: string;
114
+ totalDeposited: string;
115
+ withdrawable: string;
116
+ apy: string;
117
+ depositRate: string;
118
+ withdrawRate: string;
119
+ deposited: string;
120
+ depositedShares: string;
121
+ }[]>;
78
122
  export declare const _getUserPositions: (provider: PublicClient, network: NetworkNumber, user: EthAddress) => Promise<{
79
123
  marketData: FluidMarketData | undefined;
80
124
  userData: {
@@ -1,4 +1,4 @@
1
- import { AaveHelperCommon, AaveMarketInfo, AaveV3AggregatedPositionData, AaveV3AssetsData, AaveV3UsedAsset, AaveV3UsedAssets, AaveVersions } from '../../types';
1
+ import { AaveHelperCommon, AaveMarketInfo, AaveV3AggregatedPositionData, AaveV3AssetsData, AaveV3UsedAsset, AaveV3UsedAssets, AaveVersions, EModeCategoriesData } from '../../types';
2
2
  import { EthereumProvider, NetworkNumber } from '../../types/common';
3
3
  export declare const AAVE_V3_MARKETS: AaveVersions[];
4
4
  export declare const isAaveV2: ({ selectedMarket }: {
@@ -15,6 +15,14 @@ export declare const aaveV3IsInSiloedMode: ({ usedAssets, assetsData }: {
15
15
  usedAssets: AaveV3UsedAssets;
16
16
  assetsData: AaveV3AssetsData;
17
17
  }) => boolean;
18
+ export declare const aaveV3IsEmodeIsolated: ({ eModeCategory, eModeCategoriesData }: {
19
+ eModeCategory: number;
20
+ eModeCategoriesData?: EModeCategoriesData;
21
+ }) => boolean;
22
+ export declare const aaveV3CanBeCollateralInEmode: ({ eModeCategory, eModeCategoriesData }: {
23
+ eModeCategory: number;
24
+ eModeCategoriesData?: EModeCategoriesData;
25
+ }, _asset: string) => boolean;
18
26
  export declare const aaveAnyGetCollSuppliedAssets: ({ usedAssets }: {
19
27
  usedAssets: AaveV3UsedAssets;
20
28
  }) => AaveV3UsedAsset[];
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getAaveUnderlyingSymbol = exports.getApyAfterValuesEstimation = exports.aaveAnyGetAggregatedPositionData = exports.aaveAnyGetUserReserveLtvAndLltv = exports.aaveAnyGetEmodeMutableProps = exports.aaveAnyGetSuppliableAsCollAssets = exports.aaveAnyGetSuppliableAssets = exports.aaveAnyGetCollSuppliedAssets = exports.aaveV3IsInSiloedMode = exports.aaveV3IsInIsolationMode = exports.isAaveV3 = exports.isAaveV2 = exports.AAVE_V3_MARKETS = void 0;
26
+ exports.getAaveUnderlyingSymbol = exports.getApyAfterValuesEstimation = exports.aaveAnyGetAggregatedPositionData = exports.aaveAnyGetUserReserveLtvAndLltv = exports.aaveAnyGetEmodeMutableProps = exports.aaveAnyGetSuppliableAsCollAssets = exports.aaveAnyGetSuppliableAssets = exports.aaveAnyGetCollSuppliedAssets = exports.aaveV3CanBeCollateralInEmode = exports.aaveV3IsEmodeIsolated = exports.aaveV3IsInSiloedMode = exports.aaveV3IsInIsolationMode = exports.isAaveV3 = exports.isAaveV2 = exports.AAVE_V3_MARKETS = void 0;
27
27
  const decimal_js_1 = __importDefault(require("decimal.js"));
28
28
  const tokens_1 = require("@defisaver/tokens");
29
29
  const types_1 = require("../../types");
@@ -43,6 +43,14 @@ const aaveV3IsInIsolationMode = ({ usedAssets, assetsData }) => Object.values(us
43
43
  exports.aaveV3IsInIsolationMode = aaveV3IsInIsolationMode;
44
44
  const aaveV3IsInSiloedMode = ({ usedAssets, assetsData }) => Object.values(usedAssets).some(({ symbol, debt }) => debt && assetsData[symbol].isSiloed);
45
45
  exports.aaveV3IsInSiloedMode = aaveV3IsInSiloedMode;
46
+ const aaveV3IsEmodeIsolated = ({ eModeCategory, eModeCategoriesData }) => { var _a; return eModeCategory !== 0 && !!((_a = eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) === null || _a === void 0 ? void 0 : _a.isolated); };
47
+ exports.aaveV3IsEmodeIsolated = aaveV3IsEmodeIsolated;
48
+ const aaveV3CanBeCollateralInEmode = ({ eModeCategory, eModeCategoriesData }, _asset) => {
49
+ if (!(0, exports.aaveV3IsEmodeIsolated)({ eModeCategory, eModeCategoriesData }))
50
+ return true;
51
+ return eModeCategoriesData[eModeCategory].collateralAssets.includes((0, utils_1.getNativeAssetFromWrapped)(_asset));
52
+ };
53
+ exports.aaveV3CanBeCollateralInEmode = aaveV3CanBeCollateralInEmode;
46
54
  const aaveAnyGetCollSuppliedAssets = ({ usedAssets }) => Object.values(usedAssets)
47
55
  .filter(({ isSupplied, collateral }) => isSupplied && collateral);
48
56
  exports.aaveAnyGetCollSuppliedAssets = aaveAnyGetCollSuppliedAssets;
@@ -51,13 +59,16 @@ const aaveAnyGetSuppliableAssets = (_a) => {
51
59
  const data = Object.assign({ usedAssets, eModeCategory, assetsData, selectedMarket, network }, rest);
52
60
  const collAccountAssets = (0, exports.aaveAnyGetCollSuppliedAssets)(data);
53
61
  const marketAssets = Object.values(assetsData);
54
- if (collAccountAssets.length === 0 || !(0, exports.isAaveV3)(data))
62
+ if (!(0, exports.isAaveV3)(data))
55
63
  return marketAssets.filter(({ canBeSupplied }) => canBeSupplied).map(({ symbol }) => ({ symbol, canBeCollateral: true }));
64
+ const canBeCollateralInEmode = (symbol) => (0, exports.aaveV3CanBeCollateralInEmode)(data, symbol);
65
+ if (collAccountAssets.length === 0)
66
+ return marketAssets.filter(({ canBeSupplied }) => canBeSupplied).map(({ symbol }) => ({ symbol, canBeCollateral: canBeCollateralInEmode(symbol) }));
56
67
  if ((0, exports.aaveV3IsInIsolationMode)(data)) {
57
68
  const collAsset = collAccountAssets[0].symbol;
58
- return marketAssets.filter(d => d.canBeSupplied).map(({ symbol }) => ({ symbol, canBeCollateral: symbol === collAsset }));
69
+ return marketAssets.filter(d => d.canBeSupplied).map(({ symbol }) => ({ symbol, canBeCollateral: symbol === collAsset && canBeCollateralInEmode(symbol) }));
59
70
  }
60
- return marketAssets.filter(d => d.canBeSupplied).map(({ symbol, isIsolated }) => ({ symbol, canBeCollateral: !isIsolated }));
71
+ return marketAssets.filter(d => d.canBeSupplied).map(({ symbol, isIsolated }) => ({ symbol, canBeCollateral: !isIsolated && canBeCollateralInEmode(symbol) }));
61
72
  };
62
73
  exports.aaveAnyGetSuppliableAssets = aaveAnyGetSuppliableAssets;
63
74
  const aaveAnyGetSuppliableAsCollAssets = (_a) => {
@@ -69,12 +80,15 @@ const aaveAnyGetEmodeMutableProps = ({ eModeCategory, eModeCategoriesData, asset
69
80
  const asset = (0, utils_1.getNativeAssetFromWrapped)(_asset);
70
81
  const assetData = assetsData[asset];
71
82
  const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || {
72
- collateralAssets: [], ltvZeroAssets: [], collateralFactor: '0', liquidationRatio: '0',
83
+ collateralAssets: [], ltvZeroAssets: [], collateralFactor: '0', liquidationRatio: '0', isolated: false,
73
84
  };
74
85
  if (eModeCategory === 0
75
86
  || !eModeCategoryData.collateralAssets.includes(asset)
76
87
  || new decimal_js_1.default(eModeCategoryData.collateralFactor || 0).eq(0)) {
77
88
  const { liquidationRatio, collateralFactor } = assetData;
89
+ if (eModeCategory !== 0 && eModeCategoryData.isolated && !eModeCategoryData.collateralAssets.includes(asset)) {
90
+ return ({ liquidationRatio, collateralFactor: '0' });
91
+ }
78
92
  return ({ liquidationRatio, collateralFactor });
79
93
  }
80
94
  if (eModeCategoryData.ltvZeroAssets.includes(asset))
@@ -110,7 +124,10 @@ const aaveAnyGetUserReserveLtvAndLltv = ({ eModeCategory, eModeCategoriesData, a
110
124
  || !eModeCategoryData
111
125
  || !eModeCategoryData.collateralAssets.includes(asset)
112
126
  || new decimal_js_1.default(eModeCategoryData.collateralFactor || 0).eq(0)) {
113
- return { ltv: assetData.collateralFactor, lltv: assetData.liquidationRatio };
127
+ const ltv = eModeCategory !== 0 && (eModeCategoryData === null || eModeCategoryData === void 0 ? void 0 : eModeCategoryData.isolated) && !eModeCategoryData.collateralAssets.includes(asset)
128
+ ? '0'
129
+ : assetData.collateralFactor;
130
+ return { ltv, lltv: assetData.liquidationRatio };
114
131
  }
115
132
  const ltv = eModeCategoryData.ltvZeroAssets.includes(asset) ? '0' : eModeCategoryData.collateralFactor;
116
133
  return { ltv, lltv: eModeCategoryData.liquidationRatio };
@@ -1,6 +1,6 @@
1
1
  import { Client } from 'viem';
2
2
  import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
3
- import { LiquityStakingData, LiquityTroveInfo } from '../types';
3
+ import { LiquityTroveInfo } from '../types';
4
4
  export declare const LIQUITY_NORMAL_MODE_RATIO = 110;
5
5
  export declare const LIQUITY_RECOVERY_MODE_RATIO = 150;
6
6
  export declare const _getLiquityAccountBalances: (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
@@ -8,4 +8,14 @@ export declare const getLiquityAccountBalances: (provider: EthereumProvider, net
8
8
  export declare const getDebtInFront: (provider: EthereumProvider, address: EthAddress) => Promise<string>;
9
9
  export declare const _getLiquityTroveInfo: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<LiquityTroveInfo>;
10
10
  export declare const getLiquityTroveInfo: (provider: EthereumProvider, network: NetworkNumber, address: EthAddress) => Promise<LiquityTroveInfo>;
11
- export declare const getLiquityStakingData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<LiquityStakingData>;
11
+ export declare const getLiquityStakingData: (provider: Client, network: NetworkNumber, address: EthAddress) => Promise<{
12
+ totalLUSDDeposited: string;
13
+ totalLQTYStaked: string;
14
+ stakedLQTY: string;
15
+ stakedLUSDBalance: string;
16
+ rewardETH: string;
17
+ rewardLUSD: string;
18
+ stabilityRewardETH: string;
19
+ stabilityRewardLQTY: string;
20
+ showStakingBalances: boolean;
21
+ }>;
@@ -1,6 +1,6 @@
1
1
  import { Client, PublicClient } from 'viem';
2
2
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
3
- import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2SBoldYBoldData, LiquityV2StakingData, LiquityV2TroveData, LiquityV2Versions } from '../types';
3
+ import { LiquityV2AssetsData, LiquityV2MarketData, LiquityV2MarketInfo, LiquityV2TroveData, LiquityV2Versions } from '../types';
4
4
  export type SPYieldGainParameters = {
5
5
  P: string;
6
6
  aggWeightedDebtSum: string;
@@ -44,5 +44,25 @@ export type sBoldYieldParameters = {
44
44
  wsETH: string;
45
45
  rETH: string;
46
46
  };
47
- export declare const getLiquityV2Staking: (provider: Client, network: NetworkNumber, market: LiquityV2Versions, user: EthAddress) => Promise<LiquityV2StakingData>;
48
- export declare const getLiquitySAndYBold: (provider: Client, network: NetworkNumber, markets: any, user: EthAddress) => Promise<LiquityV2SBoldYBoldData>;
47
+ export declare const getLiquityV2Staking: (provider: Client, network: NetworkNumber, market: LiquityV2Versions, user: EthAddress) => Promise<{
48
+ totalBOLDDeposited: string;
49
+ stakedBOLDBalance: string;
50
+ stabilityRewardColl: string;
51
+ stabilityRewardYield: string;
52
+ showStakingBalances: boolean;
53
+ debtTokenBalance: string;
54
+ stabilityPoolApy: string;
55
+ }>;
56
+ export declare const getLiquitySAndYBold: (provider: Client, network: NetworkNumber, markets: any, user: EthAddress) => Promise<{
57
+ spApy: string;
58
+ yBoldApy: string;
59
+ totalBoldDepositedSBold: string;
60
+ boldRateSBold: string;
61
+ maxWithdrawSBold: string;
62
+ totalBoldDepositedYBold: string;
63
+ boldRateYBold: string;
64
+ maxWithdrawYBold: string;
65
+ sBoldBalance: string;
66
+ yBoldBalance: string;
67
+ stYBoldBalance: string;
68
+ }>;
@@ -1,9 +1,9 @@
1
1
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
2
- import { PortfolioDataOptions, PortfolioMarketsData, PortfolioPositionsData, PortfolioRewardsData, PortfolioStakingPositionsData } from '../types';
3
- export declare function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], isSim?: boolean, options?: PortfolioDataOptions): Promise<{
2
+ import { PortfolioPositionsData } from '../types';
3
+ export declare function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], isSim?: boolean): Promise<{
4
4
  positions: PortfolioPositionsData;
5
- stakingPositions: PortfolioStakingPositionsData;
6
- rewardsData: PortfolioRewardsData;
7
- markets: PortfolioMarketsData;
5
+ stakingPositions: any;
6
+ rewardsData: any;
7
+ markets: any;
8
8
  }>;
9
9
  export * from './discovery';