-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #780 from blockscout/beacon
Beacon
- Loading branch information
Showing
25 changed files
with
623 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { GetServerSideProps } from 'next'; | ||
|
||
import appConfig from 'configs/app/config'; | ||
import type { Props } from 'lib/next/getServerSideProps'; | ||
import { getServerSideProps as getServerSidePropsBase } from 'lib/next/getServerSideProps'; | ||
|
||
export const getServerSideProps: GetServerSideProps<Props> = async(args) => { | ||
if (!appConfig.beaconChain.hasBeaconChain) { | ||
return { | ||
notFound: true, | ||
}; | ||
} | ||
|
||
return getServerSidePropsBase(args); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
export const data = { | ||
items: [ | ||
{ | ||
amount: '192175', | ||
block_number: 43242, | ||
index: 11688, | ||
receiver: { | ||
hash: '0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134', | ||
implementation_name: null, | ||
is_contract: false, | ||
is_verified: null, | ||
name: null, | ||
}, | ||
timestamp: '2022-06-07T18:12:24.000000Z', | ||
validator_index: 49622, | ||
}, | ||
{ | ||
amount: '192175', | ||
block_number: 43242, | ||
index: 11687, | ||
receiver: { | ||
hash: '0xf97e987c050e5Ab072211Ad2C213Eb5AEE4DF134', | ||
implementation_name: null, | ||
is_contract: false, | ||
is_verified: null, | ||
name: null, | ||
}, | ||
timestamp: '2022-05-07T18:12:24.000000Z', | ||
validator_index: 49621, | ||
}, | ||
{ | ||
amount: '182773', | ||
block_number: 43242, | ||
index: 11686, | ||
receiver: { | ||
hash: '0xf97e123c050e5Ab072211Ad2C213Eb5AEE4DF134', | ||
implementation_name: null, | ||
is_contract: false, | ||
is_verified: null, | ||
name: null, | ||
}, | ||
timestamp: '2022-04-07T18:12:24.000000Z', | ||
validator_index: 49620, | ||
}, | ||
], | ||
next_page_params: { | ||
index: 11639, | ||
items_count: 50, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { NextPage } from 'next'; | ||
import Head from 'next/head'; | ||
import React from 'react'; | ||
|
||
import getNetworkTitle from 'lib/networks/getNetworkTitle'; | ||
import Withdrawals from 'ui/pages/Withdrawals'; | ||
|
||
const WithdrawalsPage: NextPage = () => { | ||
const title = getNetworkTitle(); | ||
return ( | ||
<> | ||
<Head> | ||
<title>{ title }</title> | ||
</Head> | ||
<Withdrawals/> | ||
</> | ||
); | ||
}; | ||
|
||
export default WithdrawalsPage; | ||
|
||
export { getServerSideProps } from 'lib/next/getServerSidePropsBeacon'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { AddressParam } from './addressParams'; | ||
|
||
export type WithdrawalsResponse = { | ||
items: Array<WithdrawalsItem>; | ||
next_page_params: { | ||
index: number; | ||
items_count: number; | ||
}; | ||
} | ||
|
||
export type WithdrawalsItem = { | ||
amount: string; | ||
block_number: number; | ||
index: number; | ||
receiver: AddressParam; | ||
timestamp: string; | ||
validator_index: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Show, Hide } from '@chakra-ui/react'; | ||
import { useRouter } from 'next/router'; | ||
import React from 'react'; | ||
|
||
import useQueryWithPages from 'lib/hooks/useQueryWithPages'; | ||
import getQueryParamString from 'lib/router/getQueryParamString'; | ||
import ActionBar from 'ui/shared/ActionBar'; | ||
import DataListDisplay from 'ui/shared/DataListDisplay'; | ||
import Pagination from 'ui/shared/Pagination'; | ||
import WithdrawalsListItem from 'ui/withdrawals/WithdrawalsListItem'; | ||
import WithdrawalsTable from 'ui/withdrawals/WithdrawalsTable'; | ||
|
||
const AddressWithdrawals = ({ scrollRef }: {scrollRef?: React.RefObject<HTMLDivElement>}) => { | ||
const router = useRouter(); | ||
|
||
const hash = getQueryParamString(router.query.hash); | ||
|
||
const { data, isLoading, isError, pagination, isPaginationVisible } = useQueryWithPages({ | ||
resourceName: 'address_withdrawals', | ||
pathParams: { hash }, | ||
scrollRef, | ||
}); | ||
const content = data?.items ? ( | ||
<> | ||
<Show below="lg" ssr={ false }> | ||
{ data.items.map((item) => <WithdrawalsListItem item={ item } key={ item.index } view="address"/>) } | ||
</Show> | ||
<Hide below="lg" ssr={ false }> | ||
<WithdrawalsTable items={ data.items } view="address" top={ isPaginationVisible ? 80 : 0 }/> | ||
</Hide> | ||
</> | ||
) : null ; | ||
|
||
const actionBar = isPaginationVisible ? ( | ||
<ActionBar mt={ -6 } showShadow={ isLoading }> | ||
<Pagination ml="auto" { ...pagination }/> | ||
</ActionBar> | ||
) : null; | ||
|
||
return ( | ||
<DataListDisplay | ||
isError={ isError } | ||
isLoading={ isLoading } | ||
items={ data?.items } | ||
skeletonProps={{ isLongSkeleton: true, skeletonDesktopColumns: Array(5).fill(`${ 100 / 5 }%`), skeletonDesktopMinW: '950px' }} | ||
emptyText="There are no withdrawals for this address." | ||
content={ content } | ||
actionBar={ actionBar } | ||
/> | ||
); | ||
}; | ||
|
||
export default AddressWithdrawals; |
Oops, something went wrong.