fill round update + notification update + visual fixes

This commit is contained in:
EmberSpirit
2023-10-08 22:44:14 +02:00
parent 5c7e176457
commit 68cd720c59
12 changed files with 239 additions and 165 deletions
+23 -8
View File
@@ -130,22 +130,29 @@ async function stakeAndClaimAllRounds() {
try {
const unclaimedRewards = walletStore.memeToken?.unclaimedRewards;
stateClaim.value = 2;
console.log("tokenNumber.value", tokenNumber.value);
console.log("walletStore.memeToken?.unclaimedRewards", walletStore.memeToken?.unclaimedRewards);
const coefficient = (10000 * tokenNumber.value) / walletStore.memeToken?.unclaimedRewards;
const coefficient = (10000 * tokenNumber.value) / unclaimedRewards;
var hash = await rewardLockerStore.stakeAndClaimAllRounds(coefficient);
stateClaim.value = 3;
const data = await waitForTransaction({
hash: hash,
});
stateClaim.value = 4;
await walletStore.loadWalletData();
var rewardData = data.logs.find((logObject) => {
return logObject.topics.find(
(topic) => topic === "0xd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba3"
);
});
//
console.log("rewardData", rewardData);
//ClaimedReward (address staker, uint256 reward)
const outputClaim = Number(rewardData.topics[2]) / Math.pow(10, tokenStore.memeToken.decimals);
showSuccessToast(
unclaimedRewards,
outputClaim.toFixed(5),
"Success!",
"You just claimed and staked",
"Join the next cycle to increase your rewards and win with your clan"
);
await walletStore.loadWalletData();
} catch (error) {
stateClaim.value = 0;
console.error(error);
@@ -161,14 +168,22 @@ async function claimAll() {
const data = await waitForTransaction({
hash: hash,
});
console.log("data", data);
await walletStore.loadWalletData();
var rewardData = data.logs.find((logObject) => {
return logObject.topics.find(
(topic) => topic === "0xd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba3"
);
});
//
console.log("rewardData", rewardData);
//ClaimedReward (address staker, uint256 reward)
const outputClaim = Number(rewardData.topics[2]) / Math.pow(10, tokenStore.memeToken.decimals);
showSuccessToast(
walletStore.memeToken?.unclaimedRewards,
outputClaim.toFixed(5),
"Success!",
"You just claimed",
"Join the next cycle to increase your rewards and win with your clan."
);
await walletStore.loadWalletData();
} catch (error) {
state.value = 0;
console.error(error);