Skip to content

Commit 53adb80

Browse files
authored
Release fix (#2133)
* FIX: withdraw on single keys * FIX: total balance and number of keys on all
1 parent e24e59f commit 53adb80

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

launcher/src/components/UI/staking-page/StakingScreen.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,11 @@ const withdrawModalHandler = () => {
562562
const withdrawValidatorKey = async () => {
563563
stakingStore.withdrawAndExitResponse = null;
564564
const key = stakingStore.selectedSingleKeyToWithdraw;
565+
if (!stakingStore.selectedServiceToFilter) {
566+
stakingStore.selectedServiceToFilter = serviceStore.installedServices.find(
567+
(service) => service?.config?.serviceID === key?.validatorID
568+
);
569+
}
565570
566571
try {
567572
let res;

launcher/src/components/UI/staking-page/components/management/components/val-rewards/TotalBalance.vue

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,21 @@ const ttlBal = t("displayValidator.ttlBal");
3636
3737
const stakingStore = useStakingStore();
3838
39-
// Computed property to get the total number of keys based on validatorID
4039
const totalKeys = computed(() => {
41-
return stakingStore.keyNumbers;
40+
return stakingStore.keys?.filter((key) => key.key && key.key.trim() !== "").length || 0;
4241
});
4342
44-
// Computed property to calculate the total balance for the validator service
4543
const totalBalance = computed(() => {
4644
const validatorID = stakingStore.selectedServiceToFilter?.config?.serviceID;
47-
if (!validatorID) return 0;
48-
const keysForValidator = stakingStore.keys.filter((key) => key.validatorID === validatorID);
49-
return keysForValidator.reduce((sum, key) => {
50-
return !isNaN(key.balance) ? (sum += key.balance) : (sum += 0);
45+
46+
if (validatorID) {
47+
const keysForValidator = stakingStore.keys.filter((key) => key.validatorID === validatorID);
48+
return keysForValidator.reduce((sum, key) => {
49+
return !isNaN(key.balance) ? (sum += key.balance) : sum;
50+
}, 0);
51+
}
52+
return stakingStore.keys.reduce((sum, key) => {
53+
return !isNaN(key.balance) ? (sum += key?.balance) : sum;
5154
}, 0);
5255
});
5356
</script>

launcher/src/components/UI/staking-page/components/modals/WithdrawMultiple.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
</template>
7878

7979
<script setup>
80-
import { useStakingStore } from "@/store/theStaking";
8180
import { useDeepClone, useTruncate } from "@/composables/utils";
81+
import { useStakingStore } from "@/store/theStaking";
8282
import { computed, ref, watch } from "vue";
8383
8484
const emit = defineEmits(["confirmWithdraw", "exportMessage"]);

0 commit comments

Comments
 (0)