@defisaver/positions-sdk 2.0.14-dev-portfolio → 2.0.14-dev-portfolio1

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.
@@ -30,6 +30,7 @@ const aaveV2_1 = require("../aaveV2");
30
30
  const compoundV2_1 = require("../compoundV2");
31
31
  const viem_1 = require("../services/viem");
32
32
  const liquity_1 = require("../liquity");
33
+ const liquityV2_1 = require("../liquityV2");
33
34
  const fluid_1 = require("../fluid");
34
35
  const eulerHelpers_1 = require("../helpers/eulerHelpers");
35
36
  const umbrella_1 = require("../umbrella");
@@ -51,6 +52,8 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
51
52
  const compoundV2Markets = [types_1.CompoundVersions.CompoundV2].map((version) => (0, markets_1.CompoundMarkets)(network)[version]).filter((market) => market.chainIds.includes(network));
52
53
  const crvUsdMarkets = Object.values((0, markets_1.CrvUsdMarkets)(network)).filter((market) => market.chainIds.includes(network));
53
54
  const llamaLendMarkets = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb].includes(network) ? Object.values((0, markets_1.LlamaLendMarkets)(network)).filter((market) => market.chainIds.includes(network)) : [];
55
+ const liquityV2Markets = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)) : [];
56
+ const liquityV2MarketsStaking = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)).filter(market => !market.isLegacy) : [];
54
57
  const client = (0, viem_1.getViemProvider)(provider, network, {
55
58
  batch: {
56
59
  multicall: {
@@ -75,6 +78,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
75
78
  const compoundV2MarketsData = {};
76
79
  const crvUsdMarketsData = {};
77
80
  const llamaLendMarketsData = {};
81
+ const liquityV2MarketsData = {};
78
82
  const markets = {
79
83
  morphoMarketsData,
80
84
  compoundV3MarketsData,
@@ -85,6 +89,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
85
89
  compoundV2MarketsData,
86
90
  crvUsdMarketsData,
87
91
  llamaLendMarketsData,
92
+ liquityV2MarketsData,
88
93
  };
89
94
  const positions = {};
90
95
  const stakingPositions = {};
@@ -119,6 +124,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
119
124
  aaveV2: {},
120
125
  compoundV2: {},
121
126
  liquity: {},
127
+ liquityV2: {},
122
128
  fluid: {
123
129
  error: '',
124
130
  data: {},
@@ -172,6 +178,10 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
172
178
  const marketData = yield (0, llamaLend_1._getLlamaLendGlobalData)(client, network, market);
173
179
  llamaLendMarketsData[market.value] = marketData;
174
180
  })),
181
+ ...liquityV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
182
+ const marketData = yield (0, liquityV2_1._getLiquityV2MarketData)(client, network, market);
183
+ liquityV2MarketsData[market.value] = marketData;
184
+ })),
175
185
  // === INDEPENDENT USER DATA (doesn't depend on market data) ===
176
186
  ...addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
177
187
  if (!isMainnet)
@@ -246,6 +256,21 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
246
256
  stakingPositions[address.toLowerCase()].umbrella = { error: `Error fetching Umbrella staking data for address ${address}`, data: null };
247
257
  }
248
258
  })),
259
+ // Liquity V2 staking
260
+ ...liquityV2MarketsStaking.map(market => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
261
+ try {
262
+ if (!isMainnet) {
263
+ stakingPositions[address.toLowerCase()].liquityV2[market.value] = { error: '', data: null };
264
+ return;
265
+ }
266
+ const liquityV2StakingData = yield (0, liquityV2_1.getLiquityV2Staking)(client, network, market.value, address);
267
+ stakingPositions[address.toLowerCase()].liquityV2[market.value] = { error: '', data: liquityV2StakingData };
268
+ }
269
+ catch (error) {
270
+ console.error(`Error fetching Liquity V2 staking data for address ${address}, market ${market.value}:`, error);
271
+ stakingPositions[address.toLowerCase()].liquityV2[market.value] = { error: `Error fetching Liquity V2 staking data for address ${address}`, data: null };
272
+ }
273
+ }))).flat(),
249
274
  // === REWARDS DATA (independent of market data) ===
250
275
  // Batch King rewards
251
276
  (() => __awaiter(this, void 0, void 0, function* () {
@@ -535,6 +560,20 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
535
560
  positions[address.toLowerCase()].llamaLend[market.value] = { error: `Error fetching LlamaLend account data for address ${address} on market ${market.value}`, data: null };
536
561
  }
537
562
  }))).flat(),
563
+ // liquity sBold/yBold and staking options
564
+ ...addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
565
+ try {
566
+ if (!isMainnet) {
567
+ stakingPositions[address.toLowerCase()].liquityV2SBoldYBold = { error: '', data: null };
568
+ return;
569
+ }
570
+ const data = yield (0, liquityV2_1.getLiquitySAndYBold)(client, network, stakingPositions[address.toLowerCase()].liquityV2, address);
571
+ stakingPositions[address.toLowerCase()].liquityV2SBoldYBold = { error: '', data };
572
+ }
573
+ catch (error) {
574
+ console.error(`Error fetching SBold/YBold data for address ${address}:`, error);
575
+ }
576
+ })),
538
577
  ]);
539
578
  return {
540
579
  positions,
@@ -80330,6 +80330,20 @@ export declare const LiquityV2ActivePool: {
80330
80330
  };
80331
80331
  export declare const LiquityV2sBoldVault: {
80332
80332
  readonly abi: readonly [{
80333
+ readonly inputs: readonly [{
80334
+ readonly internalType: "address";
80335
+ readonly name: "account";
80336
+ readonly type: "address";
80337
+ }];
80338
+ readonly name: "balanceOf";
80339
+ readonly outputs: readonly [{
80340
+ readonly internalType: "uint256";
80341
+ readonly name: "";
80342
+ readonly type: "uint256";
80343
+ }];
80344
+ readonly stateMutability: "view";
80345
+ readonly type: "function";
80346
+ }, {
80333
80347
  readonly inputs: readonly [{
80334
80348
  readonly internalType: "uint256";
80335
80349
  readonly name: "assets";
@@ -1189,7 +1189,7 @@ export const LiquityV2ActivePool = {
1189
1189
  "networks": {}
1190
1190
  };
1191
1191
  export const LiquityV2sBoldVault = {
1192
- "abi": [{ "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], "name": "convertToShares", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "maxWithdraw", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "sps", "outputs": [{ "internalType": "address", "name": "sp", "type": "address" }, { "internalType": "uint96", "name": "weight", "type": "uint96" }, { "internalType": "address", "name": "coll", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalAssets", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1192
+ "abi": [{ "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "assets", "type": "uint256" }], "name": "convertToShares", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "maxWithdraw", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "sps", "outputs": [{ "internalType": "address", "name": "sp", "type": "address" }, { "internalType": "uint96", "name": "weight", "type": "uint96" }, { "internalType": "address", "name": "coll", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalAssets", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }],
1193
1193
  "networks": {
1194
1194
  "1": {
1195
1195
  "address": "0x50bd66d59911f5e086ec87ae43c811e0d059dd11"
@@ -528167,7 +528167,96 @@ export declare const AaveRewardsControllerViem: (client: Client, network: Networ
528167
528167
  };
528168
528168
  export declare const LiquityV2sBoldVaultViem: (client: Client, network: NetworkNumber, block?: Blockish) => {
528169
528169
  read: {
528170
+ balanceOf: (args: readonly [`0x${string}`], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
528171
+ readonly inputs: readonly [{
528172
+ readonly internalType: "address";
528173
+ readonly name: "account";
528174
+ readonly type: "address";
528175
+ }];
528176
+ readonly name: "balanceOf";
528177
+ readonly outputs: readonly [{
528178
+ readonly internalType: "uint256";
528179
+ readonly name: "";
528180
+ readonly type: "uint256";
528181
+ }];
528182
+ readonly stateMutability: "view";
528183
+ readonly type: "function";
528184
+ }, {
528185
+ readonly inputs: readonly [{
528186
+ readonly internalType: "uint256";
528187
+ readonly name: "assets";
528188
+ readonly type: "uint256";
528189
+ }];
528190
+ readonly name: "convertToShares";
528191
+ readonly outputs: readonly [{
528192
+ readonly internalType: "uint256";
528193
+ readonly name: "";
528194
+ readonly type: "uint256";
528195
+ }];
528196
+ readonly stateMutability: "view";
528197
+ readonly type: "function";
528198
+ }, {
528199
+ readonly inputs: readonly [{
528200
+ readonly internalType: "address";
528201
+ readonly name: "owner";
528202
+ readonly type: "address";
528203
+ }];
528204
+ readonly name: "maxWithdraw";
528205
+ readonly outputs: readonly [{
528206
+ readonly internalType: "uint256";
528207
+ readonly name: "";
528208
+ readonly type: "uint256";
528209
+ }];
528210
+ readonly stateMutability: "view";
528211
+ readonly type: "function";
528212
+ }, {
528213
+ readonly inputs: readonly [{
528214
+ readonly internalType: "uint256";
528215
+ readonly name: "";
528216
+ readonly type: "uint256";
528217
+ }];
528218
+ readonly name: "sps";
528219
+ readonly outputs: readonly [{
528220
+ readonly internalType: "address";
528221
+ readonly name: "sp";
528222
+ readonly type: "address";
528223
+ }, {
528224
+ readonly internalType: "uint96";
528225
+ readonly name: "weight";
528226
+ readonly type: "uint96";
528227
+ }, {
528228
+ readonly internalType: "address";
528229
+ readonly name: "coll";
528230
+ readonly type: "address";
528231
+ }];
528232
+ readonly stateMutability: "view";
528233
+ readonly type: "function";
528234
+ }, {
528235
+ readonly inputs: readonly [];
528236
+ readonly name: "totalAssets";
528237
+ readonly outputs: readonly [{
528238
+ readonly internalType: "uint256";
528239
+ readonly name: "";
528240
+ readonly type: "uint256";
528241
+ }];
528242
+ readonly stateMutability: "view";
528243
+ readonly type: "function";
528244
+ }], "balanceOf", readonly [`0x${string}`]>, "address" | "args" | "abi" | "functionName">> | undefined) => Promise<bigint>;
528170
528245
  maxWithdraw: (args: readonly [`0x${string}`], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
528246
+ readonly inputs: readonly [{
528247
+ readonly internalType: "address";
528248
+ readonly name: "account";
528249
+ readonly type: "address";
528250
+ }];
528251
+ readonly name: "balanceOf";
528252
+ readonly outputs: readonly [{
528253
+ readonly internalType: "uint256";
528254
+ readonly name: "";
528255
+ readonly type: "uint256";
528256
+ }];
528257
+ readonly stateMutability: "view";
528258
+ readonly type: "function";
528259
+ }, {
528171
528260
  readonly inputs: readonly [{
528172
528261
  readonly internalType: "uint256";
528173
528262
  readonly name: "assets";
@@ -528229,6 +528318,20 @@ export declare const LiquityV2sBoldVaultViem: (client: Client, network: NetworkN
528229
528318
  readonly type: "function";
528230
528319
  }], "maxWithdraw", readonly [`0x${string}`]>, "address" | "args" | "abi" | "functionName">> | undefined) => Promise<bigint>;
528231
528320
  totalAssets: (options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
528321
+ readonly inputs: readonly [{
528322
+ readonly internalType: "address";
528323
+ readonly name: "account";
528324
+ readonly type: "address";
528325
+ }];
528326
+ readonly name: "balanceOf";
528327
+ readonly outputs: readonly [{
528328
+ readonly internalType: "uint256";
528329
+ readonly name: "";
528330
+ readonly type: "uint256";
528331
+ }];
528332
+ readonly stateMutability: "view";
528333
+ readonly type: "function";
528334
+ }, {
528232
528335
  readonly inputs: readonly [{
528233
528336
  readonly internalType: "uint256";
528234
528337
  readonly name: "assets";
@@ -528290,6 +528393,20 @@ export declare const LiquityV2sBoldVaultViem: (client: Client, network: NetworkN
528290
528393
  readonly type: "function";
528291
528394
  }], "totalAssets", readonly []>, "address" | "args" | "abi" | "functionName">> | undefined) => Promise<bigint>;
528292
528395
  convertToShares: (args: readonly [bigint], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
528396
+ readonly inputs: readonly [{
528397
+ readonly internalType: "address";
528398
+ readonly name: "account";
528399
+ readonly type: "address";
528400
+ }];
528401
+ readonly name: "balanceOf";
528402
+ readonly outputs: readonly [{
528403
+ readonly internalType: "uint256";
528404
+ readonly name: "";
528405
+ readonly type: "uint256";
528406
+ }];
528407
+ readonly stateMutability: "view";
528408
+ readonly type: "function";
528409
+ }, {
528293
528410
  readonly inputs: readonly [{
528294
528411
  readonly internalType: "uint256";
528295
528412
  readonly name: "assets";
@@ -528351,6 +528468,20 @@ export declare const LiquityV2sBoldVaultViem: (client: Client, network: NetworkN
528351
528468
  readonly type: "function";
528352
528469
  }], "convertToShares", readonly [bigint]>, "address" | "args" | "abi" | "functionName">> | undefined) => Promise<bigint>;
528353
528470
  sps: (args: readonly [bigint], options?: import("viem").Prettify<import("viem").UnionOmit<import("viem").ReadContractParameters<readonly [{
528471
+ readonly inputs: readonly [{
528472
+ readonly internalType: "address";
528473
+ readonly name: "account";
528474
+ readonly type: "address";
528475
+ }];
528476
+ readonly name: "balanceOf";
528477
+ readonly outputs: readonly [{
528478
+ readonly internalType: "uint256";
528479
+ readonly name: "";
528480
+ readonly type: "uint256";
528481
+ }];
528482
+ readonly stateMutability: "view";
528483
+ readonly type: "function";
528484
+ }, {
528354
528485
  readonly inputs: readonly [{
528355
528486
  readonly internalType: "uint256";
528356
528487
  readonly name: "assets";
@@ -528414,6 +528545,20 @@ export declare const LiquityV2sBoldVaultViem: (client: Client, network: NetworkN
528414
528545
  };
528415
528546
  address: `0x${string}`;
528416
528547
  abi: readonly [{
528548
+ readonly inputs: readonly [{
528549
+ readonly internalType: "address";
528550
+ readonly name: "account";
528551
+ readonly type: "address";
528552
+ }];
528553
+ readonly name: "balanceOf";
528554
+ readonly outputs: readonly [{
528555
+ readonly internalType: "uint256";
528556
+ readonly name: "";
528557
+ readonly type: "uint256";
528558
+ }];
528559
+ readonly stateMutability: "view";
528560
+ readonly type: "function";
528561
+ }, {
528417
528562
  readonly inputs: readonly [{
528418
528563
  readonly internalType: "uint256";
528419
528564
  readonly name: "assets";
@@ -37,3 +37,30 @@ export declare const getLiquityV2TroveData: (provider: EthereumProvider, network
37
37
  allMarketsData: Record<LiquityV2Versions, LiquityV2MarketData>;
38
38
  }, fetchDebtInFront?: boolean) => Promise<LiquityV2TroveData>;
39
39
  export declare const getLiquityV2ClaimableCollateral: (collSurplusPoolAddress: EthAddress, account: EthAddress, provider: EthereumProvider, network: NetworkNumber) => Promise<string>;
40
+ export type sBoldYieldParameters = {
41
+ WETH: string;
42
+ wsETH: string;
43
+ rETH: string;
44
+ };
45
+ export declare const getLiquityV2Staking: (provider: Client, network: NetworkNumber, market: LiquityV2Versions, user: EthAddress) => Promise<{
46
+ totalBOLDDeposited: string;
47
+ stakedBOLDBalance: string;
48
+ stabilityRewardColl: string;
49
+ stabilityRewardYield: string;
50
+ showStakingBalances: boolean;
51
+ debtTokenBalance: string;
52
+ stabilityPoolApy: string;
53
+ }>;
54
+ export declare const getLiquitySAndYBold: (provider: Client, network: NetworkNumber, markets: any, user: EthAddress) => Promise<{
55
+ spApy: string;
56
+ yBoldApy: string;
57
+ totalBoldDepositedSBold: string;
58
+ boldRateSBold: string;
59
+ maxWithdrawSBold: string;
60
+ totalBoldDepositedYBold: string;
61
+ boldRateYBold: string;
62
+ maxWithdrawYBold: string;
63
+ sBoldBalance: string;
64
+ yBoldBalance: string;
65
+ stYBoldBalance: string;
66
+ }>;