@triadxyz/triad-protocol 0.0.5-beta → 0.0.7-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 +19 -0
- package/dist/test.js +0 -3
- package/dist/types/stake.d.ts +2 -0
- package/package.json +1 -1
package/dist/stake.js
CHANGED
|
@@ -72,13 +72,32 @@ 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
|
+
let index = 0;
|
|
78
|
+
let week = 0;
|
|
79
|
+
let limit = 7;
|
|
80
|
+
for (const item of stake.dailyRewards) {
|
|
81
|
+
if (!stake.weeklyRewardsPaid[week]) {
|
|
82
|
+
stake.rewardsToClaim += item;
|
|
83
|
+
}
|
|
84
|
+
if (index === limit) {
|
|
85
|
+
limit += 6;
|
|
86
|
+
week += 1;
|
|
87
|
+
}
|
|
88
|
+
index++;
|
|
89
|
+
}
|
|
75
90
|
stake.weeklyRewards = rewards;
|
|
91
|
+
stake.allRewards = allRewards;
|
|
76
92
|
}
|
|
77
93
|
catch (error) {
|
|
94
|
+
console.log(error);
|
|
78
95
|
stake.apr = 0;
|
|
79
96
|
stake.dailyRewards = [];
|
|
80
97
|
stake.weeklyRewardsPaid = [];
|
|
81
98
|
stake.weeklyRewards = 0;
|
|
99
|
+
stake.rewardsToClaim = 0;
|
|
100
|
+
stake.allRewards = 0;
|
|
82
101
|
}
|
|
83
102
|
}
|
|
84
103
|
return myStakes;
|
package/dist/test.js
CHANGED
|
@@ -204,6 +204,3 @@ const updateStakeRewards = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
204
204
|
console.log(`Failed chunks saved to ./src/utils/stake-season-1/stakes/2/failedChunks_${ts}.json`);
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
|
-
triadProtocol.stake
|
|
208
|
-
.getStakeByWallet(new web3_js_1.PublicKey('HTbGREt61NFttBCoANvhT58SrmUAy1sFbtCk7BQqaNYh'), constants_1.STAKE_SEASON_1)
|
|
209
|
-
.then(console.log);
|
package/dist/types/stake.d.ts
CHANGED