@aurigami/sdk 1.19.2 → 1.19.4

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.19.2",
2
+ "version": "1.19.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -24,11 +24,21 @@ export class StakingRead extends BlockchainEntityRead {
24
24
  }
25
25
 
26
26
  public async getPLYWNEARPoolDetails(): Promise<PLYWNEARPoolDetails> {
27
- var stakedLiquidity: BN, rewardPerSeconds: BN[];
28
- await this.env.auriFairLaunch.getPoolInfo(consts.PLYWNEAR_POOL_ID).then((res) => {
29
- stakedLiquidity = res.totalStake;
30
- rewardPerSeconds = res.rewardPerSeconds;
31
- });
27
+ const { stakedLiquidity, rewardPerSeconds } = await this.env.auriFairLaunch
28
+ .getPoolInfo(consts.PLYWNEAR_POOL_ID)
29
+ .then((res) => {
30
+ const endedTime = res.endTime;
31
+ const startTime = res.startTime;
32
+ const now = Date.now() / 1000;
33
+ // If the pool has ended or not started, return 0 reward per second
34
+ if (endedTime < now || startTime > now) {
35
+ return {
36
+ stakedLiquidity: res.totalStake,
37
+ rewardPerSeconds: res.rewardPerSeconds.map((_) => BN.from(0)),
38
+ };
39
+ }
40
+ return { stakedLiquidity: res.totalStake, rewardPerSeconds: res.rewardPerSeconds };
41
+ });
32
42
 
33
43
  let stakedLiquidityAmount = new TokenAmount(PLYWNEARToken, stakedLiquidity!.toString());
34
44