Skip to content

Commit

Permalink
Merge pull request #375 from lidofinance/feature/si-1459-show-sdk-lin…
Browse files Browse the repository at this point in the history
…k-on-422-for-rewards

Support 422 error for rewards
  • Loading branch information
itaven authored Jul 1, 2024
2 parents db05a5f + 5f40497 commit 03b8d67
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
22 changes: 22 additions & 0 deletions features/rewards/components/errorBlocks/ErrorUnprocessable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Link from 'next/link';
import { ErrorBlockBase } from './ErrorBlockBase';

export const ErrorUnprocessable = () => (
<ErrorBlockBase
textProps={{ color: 'error' }}
text={
<>
This address has reached limit for parsed stETH transfers. Fetch rewards
directly from Lido Subgraph using{' '}
<Link
href={
'https://lidofinance.github.io/lido-ethereum-sdk/methods/rewards/#get-rewards-from-subgraph'
}
>
Rewards Module from Lido Ethereum SDK
</Link>
.
</>
}
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ErrorRateLimited } from '../errorBlocks/ErrorRateLimited';

import { extractErrorMessage } from 'utils';
import { FetcherError } from 'utils/fetcherError';
import { ErrorUnprocessable } from '../errorBlocks/ErrorUnprocessable';

type Props = {
error: unknown;
Expand All @@ -20,5 +21,9 @@ export const RewardsListErrorMessage: React.FC<Props> = ({ error }) => {
return <ErrorRateLimited />;
}

if (error instanceof FetcherError && error.status === 422) {
return <ErrorUnprocessable />;
}

return <ErrorBlockBase text={errorMessage} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const TypeCell: FC<RewardsTableCellProps> = (props) => {
</OnlyMobileCellValueWrapper>
<TypeCellValueWrapper>
{capitalize(String(value))}{' '}
{data.direction && capitalize(data.direction)}{' '}
{value === 'transfer' && data.direction && capitalize(data.direction)}
<IndexerLink transactionHash={data.transactionHash} />
</TypeCellValueWrapper>
</Td>
Expand Down

0 comments on commit 03b8d67

Please sign in to comment.