@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 +16 -0
- package/dist/test.js +1 -1
- package/dist/types/stake.d.ts +2 -0
- package/package.json +1 -1
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('
|
|
208
|
+
.getStakeByWallet(new web3_js_1.PublicKey('E48CKgbZVpDzerQ7DdommgqNobRHLqHy8RUVi8HXkSHE'), constants_1.STAKE_SEASON_1)
|
|
209
209
|
.then(console.log);
|
package/dist/types/stake.d.ts
CHANGED