Skip to content

Commit

Permalink
fix: vote delegation form for wallets that have active pool and vote …
Browse files Browse the repository at this point in the history
…delegation
  • Loading branch information
szymonmaslowski committed Jan 27, 2025
1 parent dd63902 commit 295cf77
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion source/renderer/app/api/wallets/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ export type SyncStateStatus =
| 'syncing'
| 'not_responding';
export type Discovery = 'random' | 'sequential';
export type DelegationStatus = 'delegating' | 'not_delegating';
export type DelegationStatus =
| 'delegating'
| 'not_delegating'
| 'voting'
| 'voting_and_delegating';
export type WalletSyncStateProgress = {
quantity: number;
unit: 'percentage';
Expand Down
14 changes: 10 additions & 4 deletions source/renderer/app/domains/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ export const WalletSyncStateStatuses: {
export const WalletDelegationStatuses: {
DELEGATING: DelegationStatus;
NOT_DELEGATING: DelegationStatus;
VOTING: DelegationStatus;
VOTING_AND_DELEGATING: DelegationStatus;
} = {
DELEGATING: 'delegating',
NOT_DELEGATING: 'not_delegating',
VOTING: 'voting',
VOTING_AND_DELEGATING: 'voting_and_delegating',
};
export type HwDeviceStatus =
| 'connecting'
Expand Down Expand Up @@ -234,10 +238,12 @@ export default class Wallet {

@computed
get isDelegating(): boolean {
return this.lastDelegationStakePoolStatus
? this.lastDelegationStakePoolStatus ===
WalletDelegationStatuses.DELEGATING
: this.delegationStakePoolStatus === WalletDelegationStatuses.DELEGATING;
const statusToCheck = (this.lastDelegationStakePoolStatus ||
this.delegationStakePoolStatus) as DelegationStatus;
return [
WalletDelegationStatuses.DELEGATING,
WalletDelegationStatuses.VOTING_AND_DELEGATING,
].includes(statusToCheck);
}

@computed
Expand Down

0 comments on commit 295cf77

Please sign in to comment.