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
db1e20c5
Unverified
Commit
db1e20c5
authored
Nov 14, 2022
by
tom goriunov
Committed by
GitHub
Nov 14, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #309 from blockscout/tx-contract-created
created contract tx state
parents
02bc55b3
ae65e565
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
27 deletions
+40
-27
transaction.ts
types/api/transaction.ts
+2
-2
TxDetails.tsx
ui/tx/TxDetails.tsx
+22
-12
TxsListItem.tsx
ui/txs/TxsListItem.tsx
+4
-3
TxsTableItem.tsx
ui/txs/TxsTableItem.tsx
+12
-10
No files found.
types/api/transaction.ts
View file @
db1e20c5
...
...
@@ -18,7 +18,7 @@ export interface Transaction {
timestamp
:
string
|
null
;
confirmation_duration
:
Array
<
number
>
;
from
:
AddressParam
;
to
:
AddressParam
;
to
:
AddressParam
|
null
;
created_contract
:
AddressParam
;
value
:
string
;
fee
:
Fee
;
...
...
@@ -39,7 +39,7 @@ export interface Transaction {
token_transfers
:
Array
<
TokenTransfer
>
|
null
;
token_transfers_overflow
:
boolean
;
exchange_rate
:
string
;
method
:
string
;
method
:
string
|
null
;
tx_types
:
Array
<
TransactionType
>
;
tx_tag
:
string
|
null
;
}
...
...
ui/tx/TxDetails.tsx
View file @
db1e20c5
...
...
@@ -58,10 +58,11 @@ const TxDetails = () => {
...
data
.
from
.
watchlist_names
||
[],
].
map
((
tag
)
=>
<
Tag
key=
{
tag
.
label
}
>
{
tag
.
display_name
}
</
Tag
>);
const
toAddress
=
data
.
to
&&
data
.
to
.
hash
?
data
.
to
:
data
.
created_contract
;
const
addressToTags
=
[
...
data
.
to
.
private_tags
||
[],
...
data
.
to
.
public_tags
||
[],
...
data
.
to
.
watchlist_names
||
[],
...
toAddress
.
private_tags
||
[],
...
toAddress
.
public_tags
||
[],
...
toAddress
.
watchlist_names
||
[],
].
map
((
tag
)
=>
<
Tag
key=
{
tag
.
label
}
>
{
tag
.
display_name
}
</
Tag
>);
return
(
...
...
@@ -143,31 +144,40 @@ const TxDetails = () => {
)
}
</
DetailsInfoItem
>
<
DetailsInfoItem
title=
{
data
.
to
.
is_contract
?
'
Interacted with contract
'
:
'
To
'
}
title=
{
toAddress
.
is_contract
?
'
Interacted with contract
'
:
'
To
'
}
hint=
"Address (external or contract) receiving the transaction."
flexWrap=
{
{
base
:
'
wrap
'
,
lg
:
'
nowrap
'
}
}
columnGap=
{
3
}
>
<
Address
>
<
AddressIcon
hash=
{
data
.
to
.
hash
}
/>
<
AddressLink
ml=
{
2
}
hash=
{
data
.
to
.
hash
}
/>
<
CopyToClipboard
text=
{
data
.
to
.
hash
}
/>
</
Address
>
{
data
.
to
.
is_contract
&&
data
.
result
===
'
success
'
&&
(
{
data
.
to
&&
data
.
to
.
hash
?
(
<
Address
>
<
AddressIcon
hash=
{
toAddress
.
hash
}
/>
<
AddressLink
ml=
{
2
}
hash=
{
toAddress
.
hash
}
/>
<
CopyToClipboard
text=
{
toAddress
.
hash
}
/>
</
Address
>
)
:
(
<
Flex
width=
"100%"
whiteSpace=
"pre"
>
<
span
>
[Contract
</
span
>
<
AddressLink
hash=
{
toAddress
.
hash
}
/>
<
span
>
created]
</
span
>
<
CopyToClipboard
text=
{
toAddress
.
hash
}
/>
</
Flex
>
)
}
{
toAddress
.
name
&&
<
Text
>
{
toAddress
.
name
}
</
Text
>
}
{
toAddress
.
is_contract
&&
data
.
result
===
'
success
'
&&
(
<
Tooltip
label=
"Contract execution completed"
>
<
chakra
.
span
display=
"inline-flex"
>
<
Icon
as=
{
successIcon
}
boxSize=
{
4
}
color=
"green.500"
cursor=
"pointer"
/>
</
chakra
.
span
>
</
Tooltip
>
)
}
{
data
.
to
.
is_contract
&&
Boolean
(
data
.
status
)
&&
data
.
result
!==
'
success
'
&&
(
{
toAddress
.
is_contract
&&
Boolean
(
data
.
status
)
&&
data
.
result
!==
'
success
'
&&
(
<
Tooltip
label=
"Error occured during contract execution"
>
<
chakra
.
span
display=
"inline-flex"
>
<
Icon
as=
{
errorIcon
}
boxSize=
{
4
}
color=
"red.500"
cursor=
"pointer"
/>
</
chakra
.
span
>
</
Tooltip
>
)
}
{
data
.
to
.
name
&&
<
Text
>
{
data
.
to
.
name
}
</
Text
>
}
{
addressToTags
.
length
>
0
&&
(
<
Flex
columnGap=
{
3
}
>
{
addressToTags
}
...
...
ui/txs/TxsListItem.tsx
View file @
db1e20c5
...
...
@@ -33,6 +33,7 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
const
iconColor
=
useColorModeValue
(
'
blue.600
'
,
'
blue.300
'
);
const
borderColor
=
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
);
const
dataTo
=
tx
.
to
&&
tx
.
to
.
hash
?
tx
.
to
:
tx
.
created_contract
;
return
(
<>
...
...
@@ -99,10 +100,10 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
color=
"gray.500"
/>
<
Address
width=
"calc((100%-40px)/2)"
>
<
AddressIcon
hash=
{
tx
.
t
o
.
hash
}
/>
<
AddressIcon
hash=
{
dataT
o
.
hash
}
/>
<
AddressLink
hash=
{
tx
.
t
o
.
hash
}
alias=
{
tx
.
t
o
.
name
}
hash=
{
dataT
o
.
hash
}
alias=
{
dataT
o
.
name
}
fontWeight=
"500"
ml=
{
2
}
/>
...
...
ui/txs/TxsTableItem.tsx
View file @
db1e20c5
...
...
@@ -44,12 +44,14 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
</
Address
>
);
const
dataTo
=
tx
.
to
&&
tx
.
to
.
hash
?
tx
.
to
:
tx
.
created_contract
;
const
addressTo
=
(
<
Address
>
<
Tooltip
label=
{
tx
.
t
o
.
implementation_name
}
>
<
Box
display=
"flex"
><
AddressIcon
hash=
{
tx
.
t
o
.
hash
}
/></
Box
>
<
Tooltip
label=
{
dataT
o
.
implementation_name
}
>
<
Box
display=
"flex"
><
AddressIcon
hash=
{
dataT
o
.
hash
}
/></
Box
>
</
Tooltip
>
<
AddressLink
hash=
{
tx
.
to
.
hash
}
alias=
{
tx
.
t
o
.
name
}
fontWeight=
"500"
ml=
{
2
}
truncation=
"constant"
/>
<
AddressLink
hash=
{
dataTo
.
hash
}
alias=
{
dataT
o
.
name
}
fontWeight=
"500"
ml=
{
2
}
truncation=
"constant"
/>
</
Address
>
);
...
...
@@ -92,13 +94,13 @@ const TxsTableItem = ({ tx }: {tx: Transaction}) => {
</
VStack
>
</
Td
>
<
Td
>
<
TruncatedTextTooltip
label=
{
tx
.
method
}
>
<
T
ag
colorScheme=
{
tx
.
method
===
'
Multicall
'
?
'
teal
'
:
'
gray
'
}
>
{
tx
.
method
}
</
T
ag
>
</
TruncatedTextTooltip
>
{
tx
.
method
?
(
<
T
runcatedTextTooltip
label=
{
tx
.
method
}
>
<
Tag
colorScheme=
{
tx
.
method
===
'
Multicall
'
?
'
teal
'
:
'
gray
'
}
>
{
tx
.
method
}
</
Tag
>
</
T
runcatedTextTooltip
>
)
:
'
-
'
}
</
Td
>
<
Td
>
{
tx
.
block
&&
<
Link
href=
{
link
(
'
block
'
,
{
id
:
tx
.
block
.
toString
()
})
}
>
{
tx
.
block
}
</
Link
>
}
...
...
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