@triadxyz/triad-protocol 0.0.5-beta → 0.0.6-beta

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/stake.js CHANGED
@@ -72,13 +72,29 @@ class Stake {
72
72
  let rewards = stake.dailyRewards
73
73
  .slice(start, end)
74
74
  .reduce((a, b) => a + b, 0);
75
+ let allRewards = stake.dailyRewards.reduce((a, b) => a + b);
76
+ stake.rewardsToClaim = 0;
77
+ stake.dailyRewards.forEach((item, index) => {
78
+ let week = 0;
79
+ let limit = 6;
80
+ if (!stake.weeklyRewardsPaid[week]) {
81
+ stake.rewardsToClaim += item;
82
+ }
83
+ if (index === limit) {
84
+ limit += 6;
85
+ week + 1;
86
+ }
87
+ });
75
88
  stake.weeklyRewards = rewards;
89
+ stake.allRewards = allRewards;
76
90
  }
77
91
  catch (error) {
78
92
  stake.apr = 0;
79
93
  stake.dailyRewards = [];
80
94
  stake.weeklyRewardsPaid = [];
81
95
  stake.weeklyRewards = 0;
96
+ stake.rewardsToClaim = 0;
97
+ stake.allRewards = 0;
82
98
  }
83
99
  }
84
100
  return myStakes;
package/dist/test.js CHANGED
@@ -205,5 +205,5 @@ const updateStakeRewards = () => __awaiter(void 0, void 0, void 0, function* ()
205
205
  }
206
206
  });
207
207
  triadProtocol.stake
208
- .getStakeByWallet(new web3_js_1.PublicKey('HTbGREt61NFttBCoANvhT58SrmUAy1sFbtCk7BQqaNYh'), constants_1.STAKE_SEASON_1)
208
+ .getStakeByWallet(new web3_js_1.PublicKey('E48CKgbZVpDzerQ7DdommgqNobRHLqHy8RUVi8HXkSHE'), constants_1.STAKE_SEASON_1)
209
209
  .then(console.log);
@@ -111,4 +111,6 @@ export type StakeResponse = {
111
111
  dailyRewards?: number[];
112
112
  weeklyRewardsPaid?: boolean[];
113
113
  weeklyRewards?: number;
114
+ rewardsToClaim?: number;
115
+ allRewards?: number;
114
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triadxyz/triad-protocol",
3
- "version": "0.0.5-beta",
3
+ "version": "0.0.6-beta",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",