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
172791f3
Commit
172791f3
authored
May 15, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skeleton for raw trace data
parent
f665a2a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
17 deletions
+10
-17
tx.ts
stubs/tx.ts
+3
-0
TxRawTrace.tsx
ui/tx/TxRawTrace.tsx
+7
-17
No files found.
stubs/tx.ts
View file @
172791f3
import
type
{
RawTracesResponse
}
from
'
types/api/rawTrace
'
;
import
type
{
Transaction
,
TransactionsResponse
}
from
'
types/api/transaction
'
;
import
type
{
Transaction
,
TransactionsResponse
}
from
'
types/api/transaction
'
;
import
{
ADDRESS_PARAMS
}
from
'
./addressParams
'
;
import
{
ADDRESS_PARAMS
}
from
'
./addressParams
'
;
...
@@ -58,3 +59,5 @@ export const TXS: TransactionsResponse = {
...
@@ -58,3 +59,5 @@ export const TXS: TransactionsResponse = {
filter
:
'
validated
'
,
filter
:
'
validated
'
,
},
},
};
};
export
const
TX_RAW_TRACE
:
RawTracesResponse
=
[];
ui/tx/TxRawTrace.tsx
View file @
172791f3
import
{
Flex
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -10,6 +9,7 @@ import { SECOND } from 'lib/consts';
...
@@ -10,6 +9,7 @@ import { SECOND } from 'lib/consts';
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
getQueryParamString
from
'
lib/router/getQueryParamString
'
;
import
useSocketChannel
from
'
lib/socket/useSocketChannel
'
;
import
useSocketChannel
from
'
lib/socket/useSocketChannel
'
;
import
useSocketMessage
from
'
lib/socket/useSocketMessage
'
;
import
useSocketMessage
from
'
lib/socket/useSocketMessage
'
;
import
{
TX_RAW_TRACE
}
from
'
stubs/tx
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
RawDataSnippet
from
'
ui/shared/RawDataSnippet
'
;
import
RawDataSnippet
from
'
ui/shared/RawDataSnippet
'
;
import
TxPendingAlert
from
'
ui/tx/TxPendingAlert
'
;
import
TxPendingAlert
from
'
ui/tx/TxPendingAlert
'
;
...
@@ -23,10 +23,11 @@ const TxRawTrace = () => {
...
@@ -23,10 +23,11 @@ const TxRawTrace = () => {
const
hash
=
getQueryParamString
(
router
.
query
.
hash
);
const
hash
=
getQueryParamString
(
router
.
query
.
hash
);
const
txInfo
=
useFetchTxInfo
({
updateDelay
:
5
*
SECOND
});
const
txInfo
=
useFetchTxInfo
({
updateDelay
:
5
*
SECOND
});
const
{
data
,
is
Loading
,
isError
}
=
useApiQuery
(
'
tx_raw_trace
'
,
{
const
{
data
,
is
PlaceholderData
,
isError
}
=
useApiQuery
(
'
tx_raw_trace
'
,
{
pathParams
:
{
hash
},
pathParams
:
{
hash
},
queryOptions
:
{
queryOptions
:
{
enabled
:
Boolean
(
hash
)
&&
Boolean
(
txInfo
.
data
?.
status
)
&&
isSocketOpen
,
enabled
:
Boolean
(
hash
)
&&
Boolean
(
txInfo
.
data
?.
status
)
&&
isSocketOpen
,
placeholderData
:
TX_RAW_TRACE
,
},
},
});
});
...
@@ -36,7 +37,7 @@ const TxRawTrace = () => {
...
@@ -36,7 +37,7 @@ const TxRawTrace = () => {
const
channel
=
useSocketChannel
({
const
channel
=
useSocketChannel
({
topic
:
`transactions:
${
hash
}
`
,
topic
:
`transactions:
${
hash
}
`
,
isDisabled
:
!
hash
||
!
txInfo
.
data
?.
status
,
isDisabled
:
!
hash
||
!
txInfo
.
isPlaceholderData
||
!
txInfo
.
data
?.
status
,
onJoin
:
()
=>
setIsSocketOpen
(
true
),
onJoin
:
()
=>
setIsSocketOpen
(
true
),
});
});
useSocketMessage
({
useSocketMessage
({
...
@@ -45,7 +46,7 @@ const TxRawTrace = () => {
...
@@ -45,7 +46,7 @@ const TxRawTrace = () => {
handler
:
handleRawTraceMessage
,
handler
:
handleRawTraceMessage
,
});
});
if
(
!
txInfo
.
isLoading
&&
!
txInfo
.
isError
&&
!
txInfo
.
data
.
status
)
{
if
(
!
txInfo
.
isLoading
&&
!
txInfo
.
is
PlaceholderData
&&
!
txInfo
.
is
Error
&&
!
txInfo
.
data
.
status
)
{
return
txInfo
.
socketStatus
?
<
TxSocketAlert
status=
{
txInfo
.
socketStatus
}
/>
:
<
TxPendingAlert
/>;
return
txInfo
.
socketStatus
?
<
TxSocketAlert
status=
{
txInfo
.
socketStatus
}
/>
:
<
TxPendingAlert
/>;
}
}
...
@@ -53,26 +54,15 @@ const TxRawTrace = () => {
...
@@ -53,26 +54,15 @@ const TxRawTrace = () => {
return
<
DataFetchAlert
/>;
return
<
DataFetchAlert
/>;
}
}
if
(
isLoading
||
txInfo
.
isLoading
)
{
return
(
<>
<
Flex
justifyContent=
"end"
mb=
{
2
}
>
<
Skeleton
w=
{
5
}
h=
{
5
}
/>
</
Flex
>
<
Skeleton
w=
"100%"
h=
"500px"
/>
</>
);
}
const
dataToDisplay
=
rawTraces
?
rawTraces
:
data
;
const
dataToDisplay
=
rawTraces
?
rawTraces
:
data
;
if
(
dataToDisplay
.
length
===
0
)
{
if
(
!
isPlaceholderData
&&
dataToDisplay
?
.
length
===
0
)
{
return
<
span
>
No trace entries found.
</
span
>;
return
<
span
>
No trace entries found.
</
span
>;
}
}
const
text
=
JSON
.
stringify
(
dataToDisplay
,
undefined
,
4
);
const
text
=
JSON
.
stringify
(
dataToDisplay
,
undefined
,
4
);
return
<
RawDataSnippet
data=
{
text
}
/>;
return
<
RawDataSnippet
data=
{
text
}
isLoading=
{
isPlaceholderData
}
/>;
};
};
export
default
TxRawTrace
;
export
default
TxRawTrace
;
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