@scallop-io/sui-scallop-sdk 0.44.14 → 0.44.15

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.
@@ -5,7 +5,7 @@ export declare const PROTOCOL_OBJECT_ID = "0xefe8b36d5b2e43728cc323298626b831778
5
5
  export declare const BORROW_FEE_PROTOCOL_ID = "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
6
6
  export declare const SUPPORT_POOLS: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus", "afsui", "hasui", "vsui"];
7
7
  export declare const SUPPORT_COLLATERALS: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus", "afsui", "hasui", "vsui"];
8
- export declare const SUPPORT_SPOOLS: readonly ["ssui", "susdc", "susdt"];
8
+ export declare const SUPPORT_SPOOLS: readonly ["ssui", "susdc", "susdt", "safsui", "shasui", "svsui"];
9
9
  export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
10
10
  export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "usdc", "usdt"];
11
11
  export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui"];
package/dist/index.js CHANGED
@@ -94,7 +94,14 @@ var SUPPORT_COLLATERALS = [
94
94
  "hasui",
95
95
  "vsui"
96
96
  ];
97
- var SUPPORT_SPOOLS = ["ssui", "susdc", "susdt"];
97
+ var SUPPORT_SPOOLS = [
98
+ "ssui",
99
+ "susdc",
100
+ "susdt",
101
+ "safsui",
102
+ "shasui",
103
+ "svsui"
104
+ ];
98
105
  var SUPPORT_SPOOLS_REWARDS = ["sui"];
99
106
  var SUPPORT_BORROW_INCENTIVE_POOLS = ["sui", "usdc", "usdt"];
100
107
  var SUPPORT_BORROW_INCENTIVE_REWARDS = ["sui"];
@@ -168,12 +175,18 @@ var marketCoins = {
168
175
  var stakeMarketCoins = {
169
176
  ssui: "ssui",
170
177
  susdc: "susdc",
171
- susdt: "susdt"
178
+ susdt: "susdt",
179
+ safsui: "safsui",
180
+ shasui: "shasui",
181
+ svsui: "svsui"
172
182
  };
173
183
  var spoolRewardCoins = {
174
184
  ssui: "sui",
175
185
  susdc: "sui",
176
- susdt: "sui"
186
+ susdt: "sui",
187
+ safsui: "sui",
188
+ shasui: "sui",
189
+ svsui: "sui"
177
190
  };
178
191
  var borrowIncentiveRewardCoins = {
179
192
  sui: "sui",
@@ -401,6 +414,22 @@ var EMPTY_ADDRESSES = {
401
414
  susdc: {
402
415
  id: "",
403
416
  rewardPoolId: ""
417
+ },
418
+ susdt: {
419
+ id: "",
420
+ rewardPoolId: ""
421
+ },
422
+ safsui: {
423
+ id: "",
424
+ rewardPoolId: ""
425
+ },
426
+ shasui: {
427
+ id: "",
428
+ rewardPoolId: ""
429
+ },
430
+ svsui: {
431
+ id: "",
432
+ rewardPoolId: ""
404
433
  }
405
434
  }
406
435
  },
@@ -2007,7 +2036,10 @@ var getStakeAccounts = async (query, ownerAddress) => {
2007
2036
  const stakeAccounts = {
2008
2037
  ssui: [],
2009
2038
  susdc: [],
2010
- susdt: []
2039
+ susdt: [],
2040
+ safsui: [],
2041
+ shasui: [],
2042
+ svsui: []
2011
2043
  };
2012
2044
  const stakeMarketCoinTypes = Object.keys(stakeAccounts).reduce(
2013
2045
  (types, stakeMarketCoinName) => {
@@ -2064,6 +2096,39 @@ var getStakeAccounts = async (query, ownerAddress) => {
2064
2096
  points,
2065
2097
  totalPoints
2066
2098
  });
2099
+ } else if ((0, import_utils4.normalizeStructTag)(type) === stakeMarketCoinTypes.safsui) {
2100
+ stakeAccounts.safsui.push({
2101
+ id,
2102
+ type: (0, import_utils4.normalizeStructTag)(type),
2103
+ stakePoolId,
2104
+ stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
2105
+ staked,
2106
+ index,
2107
+ points,
2108
+ totalPoints
2109
+ });
2110
+ } else if ((0, import_utils4.normalizeStructTag)(type) === stakeMarketCoinTypes.shasui) {
2111
+ stakeAccounts.shasui.push({
2112
+ id,
2113
+ type: (0, import_utils4.normalizeStructTag)(type),
2114
+ stakePoolId,
2115
+ stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
2116
+ staked,
2117
+ index,
2118
+ points,
2119
+ totalPoints
2120
+ });
2121
+ } else if ((0, import_utils4.normalizeStructTag)(type) === stakeMarketCoinTypes.svsui) {
2122
+ stakeAccounts.svsui.push({
2123
+ id,
2124
+ type: (0, import_utils4.normalizeStructTag)(type),
2125
+ stakePoolId,
2126
+ stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
2127
+ staked,
2128
+ index,
2129
+ points,
2130
+ totalPoints
2131
+ });
2067
2132
  }
2068
2133
  }
2069
2134
  }
@@ -2418,6 +2483,9 @@ var getLending = async (query, poolCoinName, ownerAddress, indexer = false, mark
2418
2483
  );
2419
2484
  const suppliedCoin = suppliedAmount.shiftedBy(-1 * coinDecimal);
2420
2485
  const suppliedValue = suppliedCoin.multipliedBy(coinPrice ?? 0);
2486
+ const marketCoinPrice = (0, import_bignumber3.default)(coinPrice ?? 0).multipliedBy(
2487
+ marketPool?.conversionRate ?? 1
2488
+ );
2421
2489
  const unstakedMarketAmount = (0, import_bignumber3.default)(marketCoinAmount);
2422
2490
  const unstakedMarketCoin = unstakedMarketAmount.shiftedBy(-1 * coinDecimal);
2423
2491
  const availableSupplyAmount = (0, import_bignumber3.default)(coinAmount);
@@ -2437,6 +2505,8 @@ var getLending = async (query, poolCoinName, ownerAddress, indexer = false, mark
2437
2505
  marketCoinType: query.utils.parseMarketCoinType(poolCoinName),
2438
2506
  coinDecimal,
2439
2507
  coinPrice: coinPrice ?? 0,
2508
+ conversionRate: marketPool?.conversionRate ?? 1,
2509
+ marketCoinPrice: marketCoinPrice.toNumber(),
2440
2510
  supplyApr: marketPool?.supplyApr ?? 0,
2441
2511
  supplyApy: marketPool?.supplyApy ?? 0,
2442
2512
  rewardApr: spool?.rewardApr ?? 0,
@@ -4461,14 +4531,14 @@ var ScallopBuilder = class {
4461
4531
  /**
4462
4532
  * Request the scallop API to initialize data.
4463
4533
  *
4464
- * @param forece - Whether to force initialization.
4534
+ * @param force - Whether to force initialization.
4465
4535
  */
4466
- async init(forece = false) {
4467
- if (forece || !this.address.getAddresses()) {
4536
+ async init(force = false) {
4537
+ if (force || !this.address.getAddresses()) {
4468
4538
  await this.address.read();
4469
4539
  }
4470
- await this.query.init(forece);
4471
- await this.utils.init(forece);
4540
+ await this.query.init(force);
4541
+ await this.utils.init(force);
4472
4542
  }
4473
4543
  /**
4474
4544
  * Create a scallop txBlock instance that enhances transaction block.