Skip to content
Merged
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: 5 additions & 1 deletion dappnode/hooks/use-get-exit-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { fetchWithRetry } from 'dappnode/utils/fetchWithRetry';
const useGetExitRequests = () => {
const { backendUrl } = useDappnodeUrls();
const [exitRequests, setExitRequests] = useState<ExitRequests>();
const [isLoading, setIsLoading] = useState<boolean>(false);

const nodeOperator = useActiveNodeOperator();

Expand All @@ -20,6 +21,7 @@ const useGetExitRequests = () => {

const getExitRequests = async () => {
try {
setIsLoading(true);
console.debug(`GETting validators exit requests from indexer API`);
const url = `${backendUrl}/api/v0/events_indexer/exit_requests?operatorId=${nodeOperator?.id}`;
const options = {
Expand All @@ -44,14 +46,16 @@ const useGetExitRequests = () => {
);

setExitRequests(filteredData);
setIsLoading(false);
} catch (e) {
console.error(
`Error GETting validators exit requests from indexer API: ${e}`,
);
setIsLoading(false);
}
};

return { exitRequests, getExitRequests };
return { exitRequests, getExitRequests, isLoading };
};

export default useGetExitRequests;
126 changes: 66 additions & 60 deletions dappnode/status/warnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import { useGetInfraStatus } from 'dappnode/hooks/use-get-infra-status';
export const Warnings: FC = () => {
const { brainUrl, stakersUiUrl, MEVPackageConfig } = useDappnodeUrls();
const { missingKeys, keysLoading, error: errorBrain } = useMissingKeys();
const { exitRequests, getExitRequests } = useGetExitRequests();
const {
exitRequests,
getExitRequests,
isLoading: exitsLoading,
} = useGetExitRequests();
const [isImportModalOpen, setIsImportModalOpen] = useState(false);
const { ECStatus, CCStatus, isCCLoading, isECLoading } = useGetInfraStatus();
const {
Expand Down Expand Up @@ -93,14 +97,19 @@ export const Warnings: FC = () => {
return (
<Stack direction="column" gap="sm">
<WarningWrapper
isLoading={isECLoading || isCCLoading || keysLoading || relaysLoading}
showIf
showIf={
!isECLoading &&
!isCCLoading &&
!keysLoading &&
!relaysLoading &&
!exitsLoading
}
>
<WarningCard $hasWarning={numWarnings > 0}>
<div>
{numWarnings > 0 ? (
<h3>
You have <NumWarningsLabel>{numWarnings}</NumWarningsLabel>{' '}
You have <NumWarningsLabel>{numWarnings}</NumWarningsLabel>
warning/s
</h3>
) : (
Expand Down Expand Up @@ -129,68 +138,65 @@ export const Warnings: FC = () => {
<h3>Your Consensus Client is not installed!</h3>
<p>Please, select and sync a client from the Stakers tab.</p>
<Link href={stakersUiUrl}> Set Consensus Client</Link>
</WarningCard>{' '}
</WarningCard>
</WarningWrapper>

<WarningWrapper isLoading={keysLoading} showIf>
<Stack direction="column" gap="sm">
<WarningWrapper showIf={missingKeys.length > 0 && !errorBrain}>
<WarningCard $direction="column">
<h3>
{' '}
<NumWarningsLabel>{missingKeys.length}</NumWarningsLabel> keys
are not imported in Web3Signer
</h3>
{missingKeys.map((key) => (
<AddressRow key={key}>
<Address address={key} symbols={16} />
<BeaconchainPubkeyLink pubkey={key} />
</AddressRow>
))}
<button onClick={() => setIsImportModalOpen(true)}>
<Link href={undefined}> Import keys</Link>
</button>

<ImportKeysWarningModal
isOpen={isImportModalOpen}
setIsOpen={setIsImportModalOpen}
/>
</WarningCard>
</WarningWrapper>
</Stack>

<WarningWrapper showIf={!!errorBrain}>
<Stack direction="column" gap="sm">
<WarningWrapper showIf={missingKeys.length > 0 && !errorBrain}>
<WarningCard $direction="column">
<h3>Your Brain API is not Up!</h3>
<p>Please, if Web3Signer is already installed, re-install it</p>
<Link href={stakersUiUrl}> Set Web3Signer</Link>
</WarningCard>
</WarningWrapper>
<h3>
<NumWarningsLabel>{missingKeys.length}</NumWarningsLabel> keys are
not imported in Web3Signer
</h3>
{missingKeys.map((key) => (
<AddressRow key={key}>
<Address address={key} symbols={16} />
<BeaconchainPubkeyLink pubkey={key} />
</AddressRow>
))}
<button onClick={() => setIsImportModalOpen(true)}>
<Link href={undefined}> Import keys</Link>
</button>

<WarningWrapper showIf={validatorsExitRequests.length > 0}>
<WarningCard>
<ValidatorMapStack $direction="column">
<Tooltip
placement="top"
title="At least one of your validators has been requested by Lido to exit"
>
<h3>
<NumWarningsLabel>
{validatorsExitRequests.length}
</NumWarningsLabel>{' '}
Validator/s requested to exit
</h3>
</Tooltip>
{validatorsExitRequests.map((val) => (
<AddressRow key={val.pubkey}>
<p>{val.index}</p>
<BeaconchainPubkeyLink pubkey={val.pubkey} />
</AddressRow>
))}
<Link href={brainUrl}>Exit validators</Link>
</ValidatorMapStack>
<ImportKeysWarningModal
isOpen={isImportModalOpen}
setIsOpen={setIsImportModalOpen}
/>
</WarningCard>
</WarningWrapper>
</Stack>

<WarningWrapper showIf={!!errorBrain}>
<WarningCard $direction="column">
<h3>Your Brain API is not Up!</h3>
<p>Please, if Web3Signer is already installed, re-install it</p>
<Link href={stakersUiUrl}> Set Web3Signer</Link>
</WarningCard>
</WarningWrapper>

<WarningWrapper showIf={validatorsExitRequests.length > 0}>
<WarningCard>
<ValidatorMapStack $direction="column">
<Tooltip
placement="top"
title="At least one of your validators has been requested by Lido to exit"
>
<h3>
<NumWarningsLabel>
{validatorsExitRequests.length}
</NumWarningsLabel>
Validator/s requested to exit
</h3>
</Tooltip>
{validatorsExitRequests.map((val) => (
<AddressRow key={val.pubkey}>
<p>{val.index}</p>
<BeaconchainPubkeyLink pubkey={val.pubkey} />
</AddressRow>
))}
<Link href={brainUrl}>Exit validators</Link>
</ValidatorMapStack>
</WarningCard>
</WarningWrapper>

<WarningWrapper isLoading={relaysLoading} showIf>
Expand Down