@scallop-io/sui-scallop-sdk 0.46.1 → 0.46.3

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.
package/dist/index.mjs CHANGED
@@ -1278,7 +1278,7 @@ var calculateSpoolData = (parsedSpoolData, stakeMarketCoinPrice, stakeMarketCoin
1278
1278
  const pointPerSec = BigNumber(parsedSpoolData.pointPerPeriod).dividedBy(
1279
1279
  parsedSpoolData.period
1280
1280
  );
1281
- const remainingPeriod = BigNumber(parsedSpoolData.maxPoint).minus(parsedSpoolData.distributedPoint).dividedBy(pointPerSec);
1281
+ const remainingPeriod = pointPerSec.gt(0) ? BigNumber(parsedSpoolData.maxPoint).minus(parsedSpoolData.distributedPoint).dividedBy(pointPerSec) : BigNumber(0);
1282
1282
  const startDate = parsedSpoolData.createdAt;
1283
1283
  const endDate = remainingPeriod.plus(parsedSpoolData.lastUpdate).integerValue().toNumber();
1284
1284
  const timeDelta = BigNumber(
@@ -1345,7 +1345,7 @@ var calculateSpoolRewardPoolData = (parsedSpoolData, parsedSpoolRewardPoolData,
1345
1345
  const claimedRewardValue = claimedRewardCoin.multipliedBy(rewardCoinPrice);
1346
1346
  const rewardValueForYear = BigNumber(rewardPerSec).shiftedBy(-1 * rewardCoinDecimal).multipliedBy(rateYearFactor).multipliedBy(rewardCoinPrice);
1347
1347
  let rewardRate = rewardValueForYear.dividedBy(calculatedSpoolData.stakedValue).isFinite() ? rewardValueForYear.dividedBy(calculatedSpoolData.stakedValue).toNumber() : Infinity;
1348
- if (parsedSpoolData.maxPoint === parsedSpoolData.distributedPoint) {
1348
+ if (parsedSpoolData.maxPoint <= parsedSpoolData.distributedPoint || parsedSpoolData.pointPerPeriod === 0) {
1349
1349
  rewardRate = Infinity;
1350
1350
  }
1351
1351
  return {
@@ -3227,7 +3227,7 @@ var getVeScas = async (query, ownerAddress) => {
3227
3227
  }
3228
3228
  });
3229
3229
  await Promise.allSettled(tasks);
3230
- return veScas.filter(Boolean).sort((a, b) => a.currentVeScaBalance - b.currentVeScaBalance);
3230
+ return veScas.filter(Boolean).sort((a, b) => b.currentVeScaBalance - a.currentVeScaBalance);
3231
3231
  };
3232
3232
  var getVeSca = async (query, veScaKeyId, ownerAddress) => {
3233
3233
  const tableId = query.address.get(`vesca.tableId`);