Skip to content

Commit

Permalink
Merge pull request #5 from aurora-is-near/failed-pre-chain-txs
Browse files Browse the repository at this point in the history
Show rejected pre-chain txs
  • Loading branch information
spilin authored Feb 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents a132191 + d263a91 commit 7fc44b7
Showing 4 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions types/api/transaction.ts
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ export type Transaction = {
zkevm_sequence_hash?: string;
near_receipt_hash?: string;
near_transaction_hash?: string;
error?: string;
}

export const ZKEVM_L2_TX_STATUSES = [ 'Confirmed by Sequencer', 'L1 Confirmed' ];
2 changes: 1 addition & 1 deletion ui/pages/Transactions.tsx
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ const Transactions = () => {
<TxsWithFrontendSorting query={ txsQuery } showSocketInfo={ txsQuery.pagination.page === 1 } socketInfoNum={ num } socketInfoAlert={ socketAlert }/> },
{
id: 'pending',
title: 'Pending',
title: 'Rejected',
component: (
<TxsWithFrontendSorting
query={ txsQuery }
20 changes: 18 additions & 2 deletions ui/tx/TxDetails.tsx
Original file line number Diff line number Diff line change
@@ -114,6 +114,14 @@ const TxDetails = () => {
</Tooltip>
) : null;

const getTxStatus = () => {
if (!data.block && data.error) {
return 'error';
} else {
return data.status;
}
};

return (
<>
{ config.chain.isTestnet && (
@@ -133,7 +141,7 @@ const TxDetails = () => {
flexWrap="nowrap"
isLoading={ isPlaceholderData }
>
{ data.status === null && <Spinner mr={ 2 } size="sm" flexShrink={ 0 }/> }
{ (data.status === null && !data.error) && <Spinner mr={ 2 } size="sm" flexShrink={ 0 }/> }
<Skeleton isLoaded={ !isPlaceholderData } overflow="hidden">
<HashStringShortenDynamic hash={ data.hash }/>
</Skeleton>
@@ -144,7 +152,7 @@ const TxDetails = () => {
hint="Current transaction state: Success, Failed (Error), or Pending (In Process)"
isLoading={ isPlaceholderData }
>
<TxStatus status={ data.status } errorText={ data.status === 'error' ? data.result : undefined } isLoading={ isPlaceholderData }/>
<TxStatus status={ getTxStatus() } errorText={ data.status === 'error' ? data.result : undefined } isLoading={ isPlaceholderData }/>
{ data.method && (
<Tag colorScheme={ data.method === 'Multicall' ? 'teal' : 'gray' } isLoading={ isPlaceholderData } isTruncated ml={ 3 }>
{ data.method }
@@ -172,6 +180,14 @@ const TxDetails = () => {
<TxRevertReason { ...data.revert_reason }/>
</DetailsInfoItem>
) }
{ !data.block && data.error && (
<DetailsInfoItem
title="Revert reason"
hint="The revert reason of the transaction"
>
<TxRevertReason raw={ data.error }/>
</DetailsInfoItem>
) }
<DetailsInfoItem
title="Block"
hint="Block number containing the transaction"
10 changes: 9 additions & 1 deletion ui/txs/TxsTableItem.tsx
Original file line number Diff line number Diff line change
@@ -68,6 +68,14 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
/>
) : '-';

const getTxStatus = () => {
if (!tx.block && tx.error) {
return 'error';
} else {
return tx.status;
}
};

return (
<Tr
as={ motion.tr }
@@ -95,7 +103,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
<Td>
<VStack alignItems="start">
<TxType types={ tx.tx_types } isLoading={ isLoading }/>
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
<TxStatus status={ getTxStatus() } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
</VStack>
</Td>

0 comments on commit 7fc44b7

Please sign in to comment.