Skip to content

Commit

Permalink
Merge pull request #1680 from blockscout/tom2drum/issue-1674
Browse files Browse the repository at this point in the history
Handle undefined timestamp for zkEVM batch
  • Loading branch information
tom2drum authored Mar 7, 2024
2 parents a5a4211 + b3f5a0b commit d423fb8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions types/api/zkEvmL2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type ZkEvmL2TxnBatchesItem = {
verify_tx_hash: string | null;
sequence_tx_hash: string | null;
status: string;
timestamp: string;
timestamp: string | null;
tx_count: number;
}

Expand All @@ -26,7 +26,7 @@ export type ZkEvmL2TxnBatch = {
sequence_tx_hash: string;
state_root: string;
status: typeof ZKEVM_L2_TX_BATCH_STATUSES[number];
timestamp: string;
timestamp: string | null;
transactions: Array<string>;
verify_tx_hash: string;
}
Expand Down
4 changes: 2 additions & 2 deletions ui/txnBatches/zkEvmL2/ZkEvmL2TxnBatchDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const ZkEvmL2TxnBatchDetails = ({ query }: Props) => {
title="Timestamp"
isLoading={ isPlaceholderData }
>
<DetailsTimestamp timestamp={ data.timestamp } isLoading={ isPlaceholderData }/>
{ data.timestamp ? <DetailsTimestamp timestamp={ data.timestamp } isLoading={ isPlaceholderData }/> : 'Undefined' }
</DetailsInfoItem>
<DetailsInfoItem
title="Verify tx hash"
Expand All @@ -98,7 +98,7 @@ const ZkEvmL2TxnBatchDetails = ({ query }: Props) => {
hash={ data.verify_tx_hash }
maxW="100%"
/>
) : <Text>pending</Text> }
) : <Text>Pending</Text> }
</DetailsInfoItem>
<DetailsInfoItem
title="Transactions"
Expand Down
2 changes: 1 addition & 1 deletion ui/txnBatches/zkEvmL2/ZkEvmTxnBatchesListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const rollupFeature = config.features.rollup;
type Props = { item: ZkEvmL2TxnBatchesItem; isLoading?: boolean };

const ZkEvmTxnBatchesListItem = ({ item, isLoading }: Props) => {
const timeAgo = dayjs(item.timestamp).fromNow();
const timeAgo = item.timestamp ? dayjs(item.timestamp).fromNow() : 'Undefined';

if (!rollupFeature.isEnabled || rollupFeature.type !== 'zkEvm') {
return null;
Expand Down
2 changes: 1 addition & 1 deletion ui/txnBatches/zkEvmL2/ZkEvmTxnBatchesTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const rollupFeature = config.features.rollup;
type Props = { item: ZkEvmL2TxnBatchesItem; isLoading?: boolean };

const TxnBatchesTableItem = ({ item, isLoading }: Props) => {
const timeAgo = dayjs(item.timestamp).fromNow();
const timeAgo = item.timestamp ? dayjs(item.timestamp).fromNow() : 'Undefined';

if (!rollupFeature.isEnabled || rollupFeature.type !== 'zkEvm') {
return null;
Expand Down

0 comments on commit d423fb8

Please sign in to comment.