Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/intl/compiled/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7437,6 +7437,12 @@
"value": "View Wagyu Key Gen audit by HashCloak"
}
],
"k4Vqjz": [
{
"type": 0,
"value": "Selected account must be active before it can absorb another validator."
}
],
"k4x6Ud": [
{
"type": 0,
Expand Down
3 changes: 3 additions & 0 deletions src/intl/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2817,6 +2817,9 @@
"k43c+l": {
"message": "View Wagyu Key Gen audit by HashCloak"
},
"k4Vqjz": {
"message": "Selected account must be active before it can absorb another validator."
},
"k4x6Ud": {
"message": "This marked the merging of the execution layer (existing Mainnet) with the new consensus layer (the Beacon Chain) to form the single Ethereum chain of today."
},
Expand Down
9 changes: 7 additions & 2 deletions src/pages/Actions/components/PullConsolidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import ValidatorSelector from './ValidatorSelector';

import { generateCompoundParams } from '../utils';
import { TICKER_NAME } from '../../../utils/envVars';
import { getEtherBalance, getCredentialType } from '../../../utils/validators';
import {
getEtherBalance,
getCredentialType,
isValidatorActive,
} from '../../../utils/validators';
import { getSignTxStatus } from '../../../utils/txStatus';
import { useTxModal } from '../../../hooks/useTxModal';
import { useCompoundingQueue } from '../../../hooks/useCompoundingQueue';
Expand Down Expand Up @@ -129,7 +133,8 @@ const PullConsolidation = ({
label={<FormattedMessage defaultMessage="Pull funds" />}
disabled={
getCredentialType(targetValidator) < ValidatorType.Compounding ||
sourceValidatorSet.length < 1
sourceValidatorSet.length < 1 ||
!isValidatorActive(targetValidator)
}
destructive
secondary
Expand Down
19 changes: 9 additions & 10 deletions src/pages/Actions/components/PushConsolidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ import ValidatorSelector from './ValidatorSelector';

import { generateCompoundParams } from '../utils';
import { COMPOUNDING_CREDENTIALS, TICKER_NAME } from '../../../utils/envVars';
import { getCredentialType, getEtherBalance } from '../../../utils/validators';
import {
getCredentialType,
getEtherBalance,
isValidatorActive,
} from '../../../utils/validators';
import { getSignTxStatus } from '../../../utils/txStatus';

import { useCompoundingQueue } from '../../../hooks/useCompoundingQueue';
Expand Down Expand Up @@ -155,15 +159,10 @@ const PushConsolidation = ({
}
}, [targetValidator]);

const validValidatorStatus = useMemo(() => {
// Handle both dora and beaconcha.in status'
return (
targetValidator &&
['active_online', 'active_offline', 'active_ongoing'].includes(
targetValidator.status
)
);
}, [targetValidator]);
const validValidatorStatus = useMemo(
() => !!targetValidator && isValidatorActive(targetValidator),
[targetValidator]
);

const CONFIRMATION_MESSAGE = formatMessage(
{
Expand Down
7 changes: 7 additions & 0 deletions src/pages/Actions/components/ValidatorActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
getCredentialType,
getEtherBalance,
hasValidatorExited,
isValidatorActive,
} from '../../../utils/validators';

import {
Expand Down Expand Up @@ -259,6 +260,12 @@ const ValidatorActions: React.FC<Props> = ({ validator, validators }) => {
<FormattedMessage defaultMessage="Selected account must be upgraded to compounding type to absorb another validator." />
</em>
)}
{!isValidatorActive(validator) && (
<em>
{' '}
<FormattedMessage defaultMessage="Selected account must be active before it can absorb another validator." />
</em>
)}
{sourceValidatorSet.length < 1 && (
<em>
{' '}
Expand Down
6 changes: 6 additions & 0 deletions src/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ export const hasExitEpochBeenSet = (exitEpoch: BigNumber | number) =>
export const hasValidatorExited = (validator: BeaconChainValidator) =>
hasExitEpochBeenSet(validator.exitepoch);

// Handles both dora and beaconcha.in status strings
export const isValidatorActive = (validator: BeaconChainValidator): boolean =>
['active_online', 'active_offline', 'active_ongoing'].includes(
validator.status
);

export const getCredentialType = (
validator: BeaconChainValidator
): ValidatorType =>
Expand Down