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
faf1e0e4
Commit
faf1e0e4
authored
Jan 03, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
38bee0d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
59 deletions
+61
-59
ContractCode.tsx
ui/address/contract/ContractCode.tsx
+24
-41
RawDataSnippet.tsx
ui/shared/RawDataSnippet.tsx
+34
-0
TxRawTrace.tsx
ui/tx/TxRawTrace.tsx
+3
-18
No files found.
ui/address/contract/ContractCode.tsx
View file @
faf1e0e4
import
{
Box
,
Text
,
Flex
,
Skeleton
,
Textarea
,
Button
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Skeleton
,
Button
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
link
from
'
lib/link/link
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
RawDataSnippet
from
'
ui/shared/RawDataSnippet
'
;
const
ContractCode
=
()
=>
{
const
router
=
useRouter
();
...
...
@@ -38,50 +38,33 @@ const ContractCode = () => {
);
}
const
verificationButton
=
(
<
Button
size=
"sm"
ml=
"auto"
mr=
{
3
}
as=
"a"
href=
{
link
(
'
address_contract_verification
'
,
{
id
:
router
.
query
.
id
?.
toString
()
})
}
>
Verify
&
publish
</
Button
>
);
return
(
<>
{
data
.
creation_bytecode
&&
(
<
Box
>
<
Flex
alignItems=
"center"
mb=
{
3
}
>
<
Text
fontWeight=
{
500
}
>
Contract creation code
</
Text
>
<
Button
size=
"sm"
ml=
"auto"
mr=
{
3
}
as=
"a"
href=
{
link
(
'
address_contract_verification
'
,
{
id
:
router
.
query
.
id
?.
toString
()
})
}
>
Verify
&
publish
</
Button
>
<
CopyToClipboard
text=
{
data
.
creation_bytecode
}
/>
</
Flex
>
<
Textarea
variant=
"filledInactive"
p=
{
4
}
minHeight=
"400px"
value=
{
data
.
creation_bytecode
}
fontSize=
"sm"
borderRadius=
"md"
readOnly
/>
</
Box
>
<
RawDataSnippet
data=
{
data
.
creation_bytecode
}
title=
"Contract creation code"
rightSlot=
{
verificationButton
}
/>
)
}
{
data
.
deployed_bytecode
&&
(
<
Box
mt=
{
6
}
>
<
Flex
justifyContent=
"space-between"
mb=
{
3
}
>
<
Text
fontWeight=
{
500
}
>
Deployed ByteCode
</
Text
>
<
CopyToClipboard
text=
{
data
.
deployed_bytecode
}
/>
</
Flex
>
<
Textarea
variant=
"filledInactive"
p=
{
4
}
minHeight=
"400px"
value=
{
data
.
deployed_bytecode
}
fontSize=
"sm"
borderRadius=
"md"
readOnly
/>
</
Box
>
<
RawDataSnippet
mt=
{
6
}
data=
{
data
.
deployed_bytecode
}
title=
"Deployed ByteCode"
/>
)
}
</>
);
...
...
ui/shared/RawDataSnippet.tsx
0 → 100644
View file @
faf1e0e4
import
{
Box
,
Flex
,
Text
,
Textarea
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
CopyToClipboard
from
'
./CopyToClipboard
'
;
interface
Props
{
data
:
string
;
title
?:
string
;
className
?:
string
;
rightSlot
?:
React
.
ReactNode
;
}
const
RawDataSnippet
=
({
data
,
className
,
title
,
rightSlot
}:
Props
)
=>
{
return
(
<
Box
className=
{
className
}
>
<
Flex
justifyContent=
{
title
?
'
space-between
'
:
'
flex-end
'
}
alignItems=
"center"
mb=
{
3
}
>
{
title
&&
<
Text
fontWeight=
{
500
}
>
{
title
}
</
Text
>
}
{
rightSlot
}
<
CopyToClipboard
text=
{
data
}
/>
</
Flex
>
<
Textarea
variant=
"filledInactive"
p=
{
4
}
minHeight=
"400px"
value=
{
data
}
fontSize=
"sm"
borderRadius=
"md"
readOnly
/>
</
Box
>
);
};
export
default
React
.
memo
(
chakra
(
RawDataSnippet
));
ui/tx/TxRawTrace.tsx
View file @
faf1e0e4
import
{
Flex
,
Textarea
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
{
SECOND
}
from
'
lib/consts
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
DataFetchAlert
from
'
ui/shared/DataFetchAlert
'
;
import
RawDataSnippet
from
'
ui/shared/RawDataSnippet
'
;
import
TxPendingAlert
from
'
ui/tx/TxPendingAlert
'
;
import
TxSocketAlert
from
'
ui/tx/TxSocketAlert
'
;
import
useFetchTxInfo
from
'
ui/tx/useFetchTxInfo
'
;
...
...
@@ -46,22 +46,7 @@ const TxRawTrace = () => {
const
text
=
JSON
.
stringify
(
data
,
undefined
,
4
);
return
(
<>
<
Flex
justifyContent=
"end"
mb=
{
2
}
>
<
CopyToClipboard
text=
{
text
}
/>
</
Flex
>
<
Textarea
variant=
"filledInactive"
minHeight=
"500px"
p=
{
4
}
value=
{
text
}
fontSize=
"sm"
borderRadius=
"md"
readOnly
/>
</>
);
return
<
RawDataSnippet
data=
{
text
}
/>;
};
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