Skip to content

Commit 295cf77

Browse files
fix: vote delegation form for wallets that have active pool and vote delegation
1 parent dd63902 commit 295cf77

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

source/renderer/app/api/wallets/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ export type SyncStateStatus =
7777
| 'syncing'
7878
| 'not_responding';
7979
export type Discovery = 'random' | 'sequential';
80-
export type DelegationStatus = 'delegating' | 'not_delegating';
80+
export type DelegationStatus =
81+
| 'delegating'
82+
| 'not_delegating'
83+
| 'voting'
84+
| 'voting_and_delegating';
8185
export type WalletSyncStateProgress = {
8286
quantity: number;
8387
unit: 'percentage';

source/renderer/app/domains/Wallet.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ export const WalletSyncStateStatuses: {
3333
export const WalletDelegationStatuses: {
3434
DELEGATING: DelegationStatus;
3535
NOT_DELEGATING: DelegationStatus;
36+
VOTING: DelegationStatus;
37+
VOTING_AND_DELEGATING: DelegationStatus;
3638
} = {
3739
DELEGATING: 'delegating',
3840
NOT_DELEGATING: 'not_delegating',
41+
VOTING: 'voting',
42+
VOTING_AND_DELEGATING: 'voting_and_delegating',
3943
};
4044
export type HwDeviceStatus =
4145
| 'connecting'
@@ -234,10 +238,12 @@ export default class Wallet {
234238

235239
@computed
236240
get isDelegating(): boolean {
237-
return this.lastDelegationStakePoolStatus
238-
? this.lastDelegationStakePoolStatus ===
239-
WalletDelegationStatuses.DELEGATING
240-
: this.delegationStakePoolStatus === WalletDelegationStatuses.DELEGATING;
241+
const statusToCheck = (this.lastDelegationStakePoolStatus ||
242+
this.delegationStakePoolStatus) as DelegationStatus;
243+
return [
244+
WalletDelegationStatuses.DELEGATING,
245+
WalletDelegationStatuses.VOTING_AND_DELEGATING,
246+
].includes(statusToCheck);
241247
}
242248

243249
@computed

0 commit comments

Comments
 (0)