toast rework + fix bugs
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
<div class="rewards-body">
|
||||
<div class="rewards-coin low-mid-text">$BLOOD</div>
|
||||
<div class="rewards-amount header" v-if="activeRound === currentRound">0</div>
|
||||
<div class="rewards-amount header" v-else>{{ getCurrentRoundData?.rewards_total }}</div>
|
||||
<div class="rewards-amount header" v-else>{{ getCurrentRoundData?.rewards_total.toFixed(5) }}</div>
|
||||
</div>
|
||||
<img class="bloodline-token" src="/assets/img/token/bloodline.png" alt="vampir" />
|
||||
</div>
|
||||
@@ -71,7 +71,11 @@
|
||||
<template v-else-if="getCurrentRoundData?.rewards_total > 0">
|
||||
<Transition name="smooth">
|
||||
<div class="stake-buttons" v-show="!stakeMenu">
|
||||
<div class="btn btn-immortal" @click="claimRewards">Claim</div>
|
||||
<div class="btn btn-immortal" v-if="stateClaimedComp === 0" @click="claimRewards">Claim</div>
|
||||
<div class="btn btn-immortal" disabled v-if="stateClaimedComp === 2">Sign Transaction</div>
|
||||
<div class="btn btn-immortal" disabled v-if="stateClaimedComp === 3">
|
||||
<loading-component></loading-component>
|
||||
</div>
|
||||
<div class="btn btn-immortal" @click="openStake">Stake</div>
|
||||
</div>
|
||||
</Transition>
|
||||
@@ -105,12 +109,14 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from "pinia";
|
||||
import RewardsWrapper from "@/components/RewardsWrapper.vue";
|
||||
import { inject, ref, onMounted } from "vue";
|
||||
import { inject, ref, onMounted, computed } from "vue";
|
||||
import { useRewardLockerStore } from "@/stores/rewardlocker";
|
||||
import { useWalletStoreV2 } from "@/stores/walletV2";
|
||||
import { useRoundsStore } from "@/stores/rounds";
|
||||
import { useRouter } from "vue-router";
|
||||
import StakeMenu from "@/components/StakeMenu.vue";
|
||||
import { waitForTransaction } from "@wagmi/core";
|
||||
import LoadingComponent from "@/components/LoadingComponent.vue";
|
||||
|
||||
const clanRewards = ref(0);
|
||||
const rewards = ref(0);
|
||||
@@ -127,6 +133,7 @@ const { activeRound, currentRound, getCurrentRoundData } = storeToRefs(roundStor
|
||||
const stakeMenu = ref(false);
|
||||
const stake = ref(null);
|
||||
const tokenNumber = ref(null);
|
||||
const stateClaim = ref(0);
|
||||
|
||||
async function stakeAndClaim() {
|
||||
console.log(tokenNumber.value);
|
||||
@@ -143,11 +150,36 @@ function openStake() {
|
||||
onMounted(async () => {});
|
||||
|
||||
async function claimRewards() {
|
||||
console.log("getCurrentRoundData", getCurrentRoundData);
|
||||
console.log("activeRound.value", activeRound.value);
|
||||
var result = await rewardLockerStore.claim([activeRound.value]);
|
||||
console.log("result", result);
|
||||
try {
|
||||
stateClaim.value = 2;
|
||||
console.log("getCurrentRoundData", getCurrentRoundData);
|
||||
console.log("activeRound.value", activeRound.value);
|
||||
var hash = await rewardLockerStore.claim([activeRound.value]);
|
||||
stateClaim.value = 3;
|
||||
console.log("hash", hash);
|
||||
const data = await waitForTransaction({
|
||||
hash: hash,
|
||||
});
|
||||
stateClaim.value = 4;
|
||||
//reload
|
||||
await roundStore.fillRound(activeRound.value, true);
|
||||
await walletStore.loadWalletData();
|
||||
} catch (error) {
|
||||
stateClaim.value = 0;
|
||||
console.error(error);
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
const stateClaimedComp = computed(() => {
|
||||
let returnState = 0;
|
||||
if (stateClaim.value === 2) {
|
||||
returnState = 2;
|
||||
} else if (stateClaim.value === 3) {
|
||||
returnState = 3;
|
||||
}
|
||||
return returnState;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="sass">
|
||||
|
||||
Reference in New Issue
Block a user