质押cec 转化、取消转化

This commit is contained in:
yuyongdong 2024-09-12 14:59:45 +08:00
parent 97b8e8ff8f
commit ef0bcff811
3 changed files with 32 additions and 11 deletions

View File

@ -21,11 +21,11 @@
<div class="text">
<li>
<div>Conversion in progress</div>
<span>$0.57</span>
<span>{{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}</span>
</li>
<li>
<div>Locked</div>
<span>$0.57</span>
<span>{{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}</span>
</li>
<li>
<div>Convert remaining time</div>
@ -125,7 +125,7 @@ const collectionModal = () => {
typeName: "es CEC",
conversion: "Reveres conversion esCEC",
conversionName: "CEC",
amount: stakingStore.cecInfoData.CecClaimable
// amount: stakingStore.cecInfoData.CecClaimable
}
}

View File

@ -47,7 +47,7 @@
</div>
<div class="right">
<div>CEC collection</div>
<p>{{ priceCalculated(cecInfoData.CecCollection) }}</p>
<p>{{ priceCalculated(cecInfoData.cecClaimAll) }}</p>
</div>
</li>
</div>
@ -129,6 +129,8 @@ import {BlockChain} from "@/components/chain/BlockChain";
const localWalletStore = walletStore();
const stakingStore = useStakingStore();
const timer = ref(null)
const count = ref()
const vipDialogVisible = ref(false);
const cecInfoData = ref({
cecBalance: BigInt("0"),
@ -141,6 +143,7 @@ const cecInfoData = ref({
esCecCollection: BigInt("0"),
totalCollection: BigInt("0"),
CecClaimable: BigInt("0"),
cecClaimAll: BigInt("0"),
});
/**
@ -186,13 +189,15 @@ const getCecData = async () => {
// cec esCec
cecInfoData.value.CecDisarm = cecInfoData.value.esCecConversion;
try {
cecInfoData.value.CecClaimable = BigInt(await bc.vester.queryClaimable())
const stakeCecCollection = await bc.staking.queryClaimableByCEC();
const stakeEsCecCollection = await bc.staking.queryClaimableByEsCEC();
cecInfoData.value.CecCollection = BigInt(await bc.staking.queryClaimableByCEC());
cecInfoData.value.esCecCollection = BigInt(await bc.staking.queryClaimableByEsCEC());
console.log("cecInfoData.value.esCecCollection", cecInfoData.value.esCecCollection);
cecInfoData.value.totalCollection = cecInfoData.value.esCecCollection + cecInfoData.value.CecCollection;
cecInfoData.value.CecCollection = BigInt(await bc.staking.queryCumulativeByCEC());
cecInfoData.value.esCecCollection = BigInt(await bc.staking.queryCumulativeByEsCEC());
cecInfoData.value.CecClaim = BigInt(await bc.staking.queryCumulativeByCEC());
cecInfoData.value.esCecClaim = BigInt(await bc.staking.queryCumulativeByEsCEC());
cecInfoData.value.CecClaimable = BigInt(await bc.vester.queryClaimable())
cecInfoData.value.cecClaimAll = BigInt(await bc.vester.queryClaimabledAll())
cecInfoData.value.totalCollection = cecInfoData.value.CecClaim + cecInfoData.value.esCecClaim;
stakingStore.cecInfoData = cecInfoData.value;
} catch (e) {
console.log("query claimable error", e);
@ -205,6 +210,23 @@ const vipHandleClose = () => {
vipDialogVisible.value = false;
};
const getCode = () =>{
const TIME_COUNT = 5;
if (!timer.value) {
count.value = TIME_COUNT;
// this.show = false;
timer.value = setInterval(() => {
if (count.value > 0 && count.value <= TIME_COUNT) {
count.value--;
} else {
getCecData()
clearInterval(timer.value);
timer.value = null;
}
}, 1000)
}
}
watch(localWalletStore, () => {
// console.log('localWalletStore.token',localWalletStore.address,localWalletStore.token)
// if(localWalletStore.token) {
@ -214,7 +236,7 @@ watch(localWalletStore, () => {
onMounted(() => {
if (localWalletStore.address) {
getCecData();
getCode();
}
});
</script>

View File

@ -119,7 +119,6 @@
<img src="@/assets/img/staking/esCEC.png" alt="">
</div>
<div class="amount">{{ priceCalculated(stakingStore.cecInfoData.esCecCollection) }}</div>
<div>{{stakingStore.cecInfoData.esCecCollection}}</div>
<div class="btns">
<div class="btn">
<span @click="esCecStakingText">Stake</span>