Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
ccb248df
Commit
ccb248df
authored
Oct 10, 2023
by
isstuev
Committed by
isstuev
Oct 23, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
txs tab
parent
17ba06a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
65 deletions
+28
-65
resources.ts
lib/api/resources.ts
+2
-3
ZkEvmL2TxnBatch.tsx
ui/pages/ZkEvmL2TxnBatch.tsx
+24
-61
TxsContent.tsx
ui/txs/TxsContent.tsx
+2
-1
No files found.
lib/api/resources.ts
View file @
ccb248df
...
@@ -577,8 +577,7 @@ export type PaginatedResources = 'blocks' | 'block_txs' |
...
@@ -577,8 +577,7 @@ export type PaginatedResources = 'blocks' | 'block_txs' |
'
token_instance_transfers
'
|
'
token_instance_holders
'
|
'
token_instance_transfers
'
|
'
token_instance_holders
'
|
'
verified_contracts
'
|
'
verified_contracts
'
|
'
l2_output_roots
'
|
'
l2_withdrawals
'
|
'
l2_txn_batches
'
|
'
l2_deposits
'
|
'
l2_output_roots
'
|
'
l2_withdrawals
'
|
'
l2_txn_batches
'
|
'
l2_deposits
'
|
// 'zkevm_l2_txn_batches' | 'zkevm_l2_txn_batch_txs' |
'
zkevm_l2_txn_batches
'
|
'
zkevm_l2_txn_batch_txs
'
|
'
zkevm_l2_txn_batches
'
|
'
withdrawals
'
|
'
address_withdrawals
'
|
'
block_withdrawals
'
;
'
withdrawals
'
|
'
address_withdrawals
'
|
'
block_withdrawals
'
;
export
type
PaginatedResponse
<
Q
extends
PaginatedResources
>
=
ResourcePayload
<
Q
>
;
export
type
PaginatedResponse
<
Q
extends
PaginatedResources
>
=
ResourcePayload
<
Q
>
;
...
@@ -672,7 +671,7 @@ Q extends 'l2_txn_batches_count' ? number :
...
@@ -672,7 +671,7 @@ Q extends 'l2_txn_batches_count' ? number :
Q
extends
'
zkevm_l2_txn_batches
'
?
ZkEvmL2TxnBatchesResponse
:
Q
extends
'
zkevm_l2_txn_batches
'
?
ZkEvmL2TxnBatchesResponse
:
Q
extends
'
zkevm_l2_txn_batches_count
'
?
number
:
Q
extends
'
zkevm_l2_txn_batches_count
'
?
number
:
Q
extends
'
zkevm_l2_txn_batch
'
?
ZkEvmL2TxnBatch
:
Q
extends
'
zkevm_l2_txn_batch
'
?
ZkEvmL2TxnBatch
:
Q
extends
'
zkevm_l2_txn_batch_txs
'
?
Array
<
Transaction
>
:
Q
extends
'
zkevm_l2_txn_batch_txs
'
?
{
items
:
Array
<
Transaction
>
}
:
Q
extends
'
config_backend_version
'
?
BackendVersionConfig
:
Q
extends
'
config_backend_version
'
?
BackendVersionConfig
:
never
;
never
;
/* eslint-enable @typescript-eslint/indent */
/* eslint-enable @typescript-eslint/indent */
...
...
ui/pages/ZkEvmL2TxnBatch.tsx
View file @
ccb248df
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
// import type { PaginationParams } from 'ui/shared/pagination/types';
import
type
{
RoutedTab
}
from
'
ui/shared/Tabs/types
'
;
// import type { RoutedTab } from 'ui/shared/Tabs/types';
// import config from 'configs/app';
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
{
useAppContext
}
from
'
lib/contexts/app
'
;
import
{
useAppContext
}
from
'
lib/contexts/app
'
;
// import useIsMobile from 'lib/hooks/useIsMobile';
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
{
TX_ZKEVM_L2
}
from
'
stubs/tx
'
;
import
{
generateListStub
}
from
'
stubs/utils
'
;
import
{
ZKEVM_L2_TXN_BATCH
}
from
'
stubs/zkEvmL2
'
;
import
{
ZKEVM_L2_TXN_BATCH
}
from
'
stubs/zkEvmL2
'
;
// import { TX } from 'stubs/tx';
// import { generateListStub } from 'stubs/utils';
import
TextAd
from
'
ui/shared/ad/TextAd
'
;
import
TextAd
from
'
ui/shared/ad/TextAd
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
PageTitle
from
'
ui/shared/Page/PageTitle
'
;
import
useQueryWithPages
from
'
ui/shared/pagination/useQueryWithPages
'
;
import
RoutedTabs
from
'
ui/shared/Tabs/RoutedTabs
'
;
import
TabsSkeleton
from
'
ui/shared/Tabs/TabsSkeleton
'
;
import
TxsContent
from
'
ui/txs/TxsContent
'
;
import
ZkEvmL2TxnBatchDetails
from
'
ui/zkEvmL2TxnBatches/ZkEvmL2TxnBatchDetails
'
;
import
ZkEvmL2TxnBatchDetails
from
'
ui/zkEvmL2TxnBatches/ZkEvmL2TxnBatchDetails
'
;
// import Pagination from 'ui/shared/pagination/Pagination';
// import useQueryWithPages from 'ui/shared/pagination/useQueryWithPages';
// import RoutedTabs from 'ui/shared/Tabs/RoutedTabs';
// import TabsSkeleton from 'ui/shared/Tabs/TabsSkeleton';
// import TxsContent from 'ui/txs/TxsContent';
// const TAB_LIST_PROPS = {
// marginBottom: 0,
// py: 5,
// marginTop: -5,
// };
const
ZkEvmL2TxnBatch
=
()
=>
{
const
ZkEvmL2TxnBatch
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
// const isMobile = useIsMobile();
const
appProps
=
useAppContext
();
const
appProps
=
useAppContext
();
const
number
=
getQueryParamString
(
router
.
query
.
number
);
const
number
=
getQueryParamString
(
router
.
query
.
number
);
//
const tab = getQueryParamString(router.query.tab);
const
tab
=
getQueryParamString
(
router
.
query
.
tab
);
const
batchQuery
=
useApiQuery
(
'
zkevm_l2_txn_batch
'
,
{
const
batchQuery
=
useApiQuery
(
'
zkevm_l2_txn_batch
'
,
{
pathParams
:
{
number
},
pathParams
:
{
number
},
...
@@ -42,26 +31,15 @@ const ZkEvmL2TxnBatch = () => {
...
@@ -42,26 +31,15 @@ const ZkEvmL2TxnBatch = () => {
},
},
});
});
// const batchTxsQuery = useQueryWithPages({
const
batchTxsQuery
=
useQueryWithPages
({
// resourceName: 'zkevm_l2_txn_batch_txs',
resourceName
:
'
zkevm_l2_txn_batch_txs
'
,
// pathParams: { number },
pathParams
:
{
number
},
// options: {
options
:
{
// enabled: Boolean(!batchQuery.isPlaceholderData && batchQuery.data?.number && tab === 'txs'),
enabled
:
Boolean
(
!
batchQuery
.
isPlaceholderData
&&
batchQuery
.
data
?.
number
&&
tab
===
'
txs
'
),
// placeholderData: generateListStub<'block_txs'>(TX_ZKEVM_L2, 50, { next_page_params: {
// there is no pagination in zkevm_l2_txn_batch_txs
// number: 9004925,
placeholderData
:
generateListStub
<
'
block_txs
'
>
(
TX_ZKEVM_L2
,
50
,
{
next_page_params
:
null
}),
// index: 49,
},
// items_count: 50,
});
// } }),
// },
// });
// const batchTxsQuery = useApiQuery('zkevm_l2_txn_batch_txs', {
// pathParams: { number },
// queryOptions: {
// enabled: Boolean(!batchQuery.isPlaceholderData && batchQuery.data?.number && tab === 'txs'),
// placeholderData: Array(50).fill(TX),
// },
// });
if
(
!
number
)
{
if
(
!
number
)
{
throw
new
Error
(
'
Tx batch not found
'
,
{
cause
:
{
status
:
404
}
});
throw
new
Error
(
'
Tx batch not found
'
,
{
cause
:
{
status
:
404
}
});
...
@@ -71,22 +49,10 @@ const ZkEvmL2TxnBatch = () => {
...
@@ -71,22 +49,10 @@ const ZkEvmL2TxnBatch = () => {
throw
new
Error
(
undefined
,
{
cause
:
batchQuery
.
error
});
throw
new
Error
(
undefined
,
{
cause
:
batchQuery
.
error
});
}
}
// const tabs: Array<RoutedTab> = React.useMemo(() => ([
const
tabs
:
Array
<
RoutedTab
>
=
React
.
useMemo
(()
=>
([
// { id: 'index', title: 'Details', component: <ZkEvmL2TxnBatchDetails query={ batchQuery }/> },
{
id
:
'
index
'
,
title
:
'
Details
'
,
component
:
<
ZkEvmL2TxnBatchDetails
query=
{
batchQuery
}
/>
},
// { id: 'txs', title: 'Transactions', component: <TxsContent query={ batchTxsQuery } showBlockInfo={ false } showSocketInfo={ false }/> },
{
id
:
'
txs
'
,
title
:
'
Transactions
'
,
component
:
<
TxsContent
query=
{
batchTxsQuery
}
showSocketInfo=
{
false
}
/>
},
// ].filter(Boolean)), [ blockQuery, blockTxsQuery, blockWithdrawalsQuery ]);
].
filter
(
Boolean
)),
[
batchQuery
,
batchTxsQuery
]);
// const hasPagination = !isMobile && (
// (tab === 'txs' && blockTxsQuery.pagination.isVisible) ||
// (tab === 'withdrawals' && blockWithdrawalsQuery.pagination.isVisible)
// );
// let pagination;
// if (tab === 'txs') {
// pagination = blockTxsQuery.pagination;
// } else if (tab === 'withdrawals') {
// pagination = blockWithdrawalsQuery.pagination;
// }
const
backLink
=
React
.
useMemo
(()
=>
{
const
backLink
=
React
.
useMemo
(()
=>
{
const
hasGoBackLink
=
appProps
.
referrer
&&
appProps
.
referrer
.
includes
(
'
/zkevm_l2_txn_batches
'
);
const
hasGoBackLink
=
appProps
.
referrer
&&
appProps
.
referrer
.
includes
(
'
/zkevm_l2_txn_batches
'
);
...
@@ -108,15 +74,12 @@ const ZkEvmL2TxnBatch = () => {
...
@@ -108,15 +74,12 @@ const ZkEvmL2TxnBatch = () => {
title=
{
`Tx batch #${ number }`
}
title=
{
`Tx batch #${ number }`
}
backLink=
{
backLink
}
backLink=
{
backLink
}
/>
/>
{
/* {
batchQuery.isPlaceholderData ? <TabsSkeleton tabs={ tabs }/> : (
{
batchQuery
.
isPlaceholderData
?
<
TabsSkeleton
tabs=
{
tabs
}
/>
:
(
<
RoutedTabs
<
RoutedTabs
tabs=
{
tabs
}
tabs=
{
tabs
}
tabListProps={ isMobile ? undefined : TAB_LIST_PROPS }
// tabListProps=
{
isMobile
?
undefined
:
TAB_LIST_PROPS
}
rightSlot={ hasPagination ? <Pagination { ...(pagination as PaginationParams) }/> : null }
stickyEnabled={ hasPagination }
/>
/>
) } */
}
)
}
<
ZkEvmL2TxnBatchDetails
query=
{
batchQuery
}
/>
</>
</>
);
);
};
};
...
...
ui/txs/TxsContent.tsx
View file @
ccb248df
...
@@ -15,7 +15,8 @@ import TxsTable from './TxsTable';
...
@@ -15,7 +15,8 @@ import TxsTable from './TxsTable';
import
useTxsSort
from
'
./useTxsSort
'
;
import
useTxsSort
from
'
./useTxsSort
'
;
type
Props
=
{
type
Props
=
{
query
:
QueryWithPagesResult
<
'
txs_validated
'
|
'
txs_pending
'
>
|
QueryWithPagesResult
<
'
txs_watchlist
'
>
|
QueryWithPagesResult
<
'
block_txs
'
>
;
// eslint-disable-next-line max-len
query
:
QueryWithPagesResult
<
'
txs_validated
'
|
'
txs_pending
'
>
|
QueryWithPagesResult
<
'
txs_watchlist
'
>
|
QueryWithPagesResult
<
'
block_txs
'
>
|
QueryWithPagesResult
<
'
zkevm_l2_txn_batch_txs
'
>
;
showBlockInfo
?:
boolean
;
showBlockInfo
?:
boolean
;
showSocketInfo
?:
boolean
;
showSocketInfo
?:
boolean
;
socketInfoAlert
?:
string
;
socketInfoAlert
?:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment