-
Notifications
You must be signed in to change notification settings - Fork 457
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
439 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Feature } from './types'; | ||
|
||
import { getEnvValue } from '../utils'; | ||
import rollup from './rollup'; | ||
|
||
const title = 'Fault proof system'; | ||
|
||
const config: Feature<{ isEnabled: true }> = (() => { | ||
if (rollup.isEnabled && rollup.type === 'optimistic' && getEnvValue('NEXT_PUBLIC_FAULT_PROOF_ENABLED') === 'true') { | ||
return Object.freeze({ | ||
title, | ||
isEnabled: true, | ||
}); | ||
} | ||
|
||
return Object.freeze({ | ||
title, | ||
isEnabled: false, | ||
}); | ||
})(); | ||
|
||
export default config; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
NEXT_PUBLIC_ROLLUP_TYPE=optimistic | ||
NEXT_PUBLIC_ROLLUP_L1_BASE_URL=https://example.com | ||
NEXT_PUBLIC_ROLLUP_L2_WITHDRAWAL_URL=https://example.com | ||
NEXT_PUBLIC_ROLLUP_L2_WITHDRAWAL_URL=https://example.com | ||
NEXT_PUBLIC_FAULT_PROOF_ENABLED=true |
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
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,19 @@ | ||
import type { NextPage } from 'next'; | ||
import dynamic from 'next/dynamic'; | ||
import React from 'react'; | ||
|
||
import PageNextJs from 'nextjs/PageNextJs'; | ||
|
||
const DisputeGames = dynamic(() => import('ui/pages/OptimisticL2DisputeGames'), { ssr: false }); | ||
|
||
const Page: NextPage = () => { | ||
return ( | ||
<PageNextJs pathname="/dispute-games"> | ||
<DisputeGames/> | ||
</PageNextJs> | ||
); | ||
}; | ||
|
||
export default Page; | ||
|
||
export { disputeGames as getServerSideProps } from 'nextjs/getServerSideProps'; |
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
76 changes: 76 additions & 0 deletions
76
ui/disputeGames/optimisticL2/OptimisticL2DisputeGamesListItem.tsx
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,76 @@ | ||
import { Skeleton } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import type { OptimisticL2DisputeGamesItem } from 'types/api/optimisticL2'; | ||
|
||
import config from 'configs/app'; | ||
import dayjs from 'lib/date/dayjs'; | ||
import CopyToClipboard from 'ui/shared/CopyToClipboard'; | ||
import BlockEntityL2 from 'ui/shared/entities/block/BlockEntityL2'; | ||
import HashStringShorten from 'ui/shared/HashStringShorten'; | ||
import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid'; | ||
|
||
const rollupFeature = config.features.rollup; | ||
|
||
type Props = { item: OptimisticL2DisputeGamesItem; isLoading?: boolean }; | ||
|
||
const OptimisticL2DisputeGamesListItem = ({ item, isLoading }: Props) => { | ||
if (!rollupFeature.isEnabled || rollupFeature.type !== 'optimistic') { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ListItemMobileGrid.Container> | ||
|
||
<ListItemMobileGrid.Label isLoading={ isLoading }>Index</ListItemMobileGrid.Label> | ||
<ListItemMobileGrid.Value fontWeight={ 600 } color="text"> | ||
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.index }</Skeleton> | ||
</ListItemMobileGrid.Value> | ||
|
||
<ListItemMobileGrid.Label isLoading={ isLoading }>Game type</ListItemMobileGrid.Label> | ||
<ListItemMobileGrid.Value> | ||
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.game_type }</Skeleton> | ||
</ListItemMobileGrid.Value> | ||
|
||
<ListItemMobileGrid.Label isLoading={ isLoading }>Address</ListItemMobileGrid.Label> | ||
<ListItemMobileGrid.Value color="text"> | ||
<Skeleton isLoaded={ !isLoading } display="flex" overflow="hidden" w="100%" alignItems="center"> | ||
<HashStringShorten hash={ item.contract_address } type="long"/> | ||
<CopyToClipboard text={ item.contract_address } ml={ 2 } isLoading={ isLoading }/> | ||
</Skeleton> | ||
</ListItemMobileGrid.Value> | ||
|
||
<ListItemMobileGrid.Label isLoading={ isLoading }>L2 block #</ListItemMobileGrid.Label> | ||
<ListItemMobileGrid.Value> | ||
<BlockEntityL2 | ||
isLoading={ isLoading } | ||
number={ item.l2_block_number } | ||
fontSize="sm" | ||
lineHeight={ 5 } | ||
noIcon | ||
/> | ||
</ListItemMobileGrid.Value> | ||
|
||
<ListItemMobileGrid.Label isLoading={ isLoading }>Age</ListItemMobileGrid.Label> | ||
<ListItemMobileGrid.Value> | ||
<Skeleton isLoaded={ !isLoading } display="inline-block">{ dayjs(item.created_at).fromNow() }</Skeleton> | ||
</ListItemMobileGrid.Value> | ||
|
||
<ListItemMobileGrid.Label isLoading={ isLoading }>Status</ListItemMobileGrid.Label> | ||
<ListItemMobileGrid.Value color="text"> | ||
<Skeleton isLoaded={ !isLoading } display="inline-block">{ item.status }</Skeleton> | ||
</ListItemMobileGrid.Value> | ||
|
||
{ item.resolved_at && ( | ||
<> | ||
<ListItemMobileGrid.Label isLoading={ isLoading }>Resolution age</ListItemMobileGrid.Label><ListItemMobileGrid.Value> | ||
<Skeleton isLoaded={ !isLoading } display="inline-block">{ dayjs(item.resolved_at).fromNow() }</Skeleton> | ||
</ListItemMobileGrid.Value> | ||
</> | ||
) } | ||
|
||
</ListItemMobileGrid.Container> | ||
); | ||
}; | ||
|
||
export default OptimisticL2DisputeGamesListItem; |
Oops, something went wrong.