@aurigami/sdk 1.19.2 → 1.19.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.
@@ -4782,20 +4782,35 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4782
4782
  var _proto = StakingRead.prototype;
4783
4783
  _proto.getPLYWNEARPoolDetails = /*#__PURE__*/function () {
4784
4784
  var _getPLYWNEARPoolDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4785
- var stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, totalStakeValuation, promises, i, rewardTokenAddress, rewardToken, rewardPerSecond, APYs;
4785
+ var _yield$this$env$auriF, stakedLiquidity, rewardPerSeconds, stakedLiquidityAmount, totalStakeValuation, promises, i, rewardTokenAddress, rewardToken, rewardPerSecond, APYs;
4786
4786
  return _regeneratorRuntime().wrap(function _callee$(_context) {
4787
4787
  while (1) switch (_context.prev = _context.next) {
4788
4788
  case 0:
4789
4789
  _context.next = 2;
4790
4790
  return this.env.auriFairLaunch.getPoolInfo(PLYWNEAR_POOL_ID).then(function (res) {
4791
- stakedLiquidity = res.totalStake;
4792
- rewardPerSeconds = res.rewardPerSeconds;
4791
+ var endedTime = res.endTime;
4792
+ // If the pool has ended, return 0 reward per second
4793
+ if (endedTime < Date.now() / 1000) {
4794
+ return {
4795
+ stakedLiquidity: res.totalStake,
4796
+ rewardPerSeconds: res.rewardPerSeconds.map(function (_) {
4797
+ return ethers.BigNumber.from(0);
4798
+ })
4799
+ };
4800
+ }
4801
+ return {
4802
+ stakedLiquidity: res.totalStake,
4803
+ rewardPerSeconds: res.rewardPerSeconds
4804
+ };
4793
4805
  });
4794
4806
  case 2:
4807
+ _yield$this$env$auriF = _context.sent;
4808
+ stakedLiquidity = _yield$this$env$auriF.stakedLiquidity;
4809
+ rewardPerSeconds = _yield$this$env$auriF.rewardPerSeconds;
4795
4810
  stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity.toString());
4796
- _context.next = 5;
4811
+ _context.next = 8;
4797
4812
  return fetchValuation(stakedLiquidityAmount, this._networkConnection.provider);
4798
- case 5:
4813
+ case 8:
4799
4814
  totalStakeValuation = _context.sent;
4800
4815
  promises = []; // Calculate the reward per second in USD
4801
4816
  for (i = 0; i < rewardPerSeconds.length; i++) {
@@ -4805,9 +4820,9 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4805
4820
  promises.push(fetchValuation(new TokenAmount(rewardToken, rewardPerSecond.toString()), this._networkConnection.provider));
4806
4821
  }
4807
4822
  APYs = [];
4808
- _context.next = 11;
4823
+ _context.next = 14;
4809
4824
  return Promise.all(promises);
4810
- case 11:
4825
+ case 14:
4811
4826
  _context.sent.forEach(function (rewardPerSecondValuation, i) {
4812
4827
  var rewardTokenAddress = PLYWNEAR_REWARD_TOKENS[i];
4813
4828
  var apy = calcLMRewardApr(rewardPerSecondValuation, totalStakeValuation, ONE_DAY * 365).toFixed(DECIMAL_PRECISION);
@@ -4820,7 +4835,7 @@ var StakingRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4820
4835
  totalStakedLiquidity: stakedLiquidityAmount,
4821
4836
  APYs: APYs
4822
4837
  });
4823
- case 13:
4838
+ case 16:
4824
4839
  case "end":
4825
4840
  return _context.stop();
4826
4841
  }