diff --git a/src/components/staking/conversion.vue b/src/components/staking/conversion.vue index 541cbc7..f60033c 100644 --- a/src/components/staking/conversion.vue +++ b/src/components/staking/conversion.vue @@ -21,11 +21,11 @@
  • Conversion in progress
    - $0.57 + {{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}
  • Locked
    - $0.57 + {{ priceCalculated(stakingStore.cecInfoData.esCecConversion) }}
  • Convert remaining time
    @@ -125,7 +125,7 @@ const collectionModal = () => { typeName: "es CEC", conversion: "Reveres conversion esCEC", conversionName: "CEC", - amount: stakingStore.cecInfoData.CecClaimable + // amount: stakingStore.cecInfoData.CecClaimable } } diff --git a/src/components/staking/header.vue b/src/components/staking/header.vue index d78b19b..d4af752 100644 --- a/src/components/staking/header.vue +++ b/src/components/staking/header.vue @@ -47,7 +47,7 @@
  • CEC collection
    -

    {{ priceCalculated(cecInfoData.CecCollection) }}

    +

    {{ priceCalculated(cecInfoData.cecClaimAll) }}

    @@ -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(); } }); diff --git a/src/components/staking/index.vue b/src/components/staking/index.vue index a076da1..cffef9e 100644 --- a/src/components/staking/index.vue +++ b/src/components/staking/index.vue @@ -119,7 +119,6 @@
    {{ priceCalculated(stakingStore.cecInfoData.esCecCollection) }}
    -
    {{stakingStore.cecInfoData.esCecCollection}}
    Stake