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
900bf7d9
Unverified
Commit
900bf7d9
authored
Sep 15, 2022
by
Igor Stuev
Committed by
GitHub
Sep 15, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #152 from blockscout/refactor-address
refactor everything about address ui
parents
0cfe93cf
dc950b42
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
285 additions
and
118 deletions
+285
-118
Tag.ts
theme/components/Tag.ts
+1
-1
AddressIcon.tsx
ui/shared/AddressIcon.tsx
+0
-13
AddressLinkWithTooltip.tsx
ui/shared/AddressLinkWithTooltip.tsx
+0
-48
AddressSnippet.tsx
ui/shared/AddressSnippet.tsx
+13
-10
CopyToClipboard.tsx
ui/shared/CopyToClipboard.tsx
+4
-3
HashStringShorten.tsx
ui/shared/HashStringShorten.tsx
+16
-0
HashStringShortenDynamic.tsx
ui/shared/HashStringShortenDynamic.tsx
+97
-0
TransactionSnippet.tsx
ui/shared/TransactionSnippet.tsx
+8
-7
Address.tsx
ui/shared/address/Address.tsx
+15
-0
AddressIcon.tsx
ui/shared/address/AddressIcon.tsx
+13
-0
AddressLink.tsx
ui/shared/address/AddressLink.tsx
+64
-0
TokenTransfer.tsx
ui/tx/TokenTransfer.tsx
+3
-3
TxDecodedInputData.tsx
ui/tx/TxDecodedInputData.tsx
+10
-3
TxDetails.tsx
ui/tx/TxDetails.tsx
+13
-6
TxStatus.tsx
ui/tx/TxStatus.tsx
+1
-1
TxInternalsTableItem.tsx
ui/tx/internals/TxInternalsTableItem.tsx
+13
-12
TxLogItem.tsx
ui/tx/logs/TxLogItem.tsx
+7
-4
TxStateTableItem.tsx
ui/tx/state/TxStateTableItem.tsx
+7
-7
No files found.
theme/components/Tag.ts
View file @
900bf7d9
...
...
@@ -33,7 +33,7 @@ const sizes = {
};
const
baseStyleContainer
=
defineStyle
({
display
:
'
inline-
flex
'
,
display
:
'
inline-
block
'
,
overflow
:
'
hidden
'
,
textOverflow
:
'
ellipsis
'
,
borderRadius
:
'
sm
'
,
...
...
ui/shared/AddressIcon.tsx
deleted
100644 → 0
View file @
0cfe93cf
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
Jazzicon
,
{
jsNumberForAddress
}
from
'
react-jazzicon
'
;
const
AddressIcon
=
({
address
}:
{
address
:
string
})
=>
{
return
(
<
Box
width=
"24px"
display=
"inline-flex"
>
<
Jazzicon
diameter=
{
24
}
seed=
{
jsNumberForAddress
(
address
)
}
/>
</
Box
>
);
};
export
default
AddressIcon
;
ui/shared/AddressLinkWithTooltip.tsx
deleted
100644 → 0
View file @
0cfe93cf
import
{
Flex
,
Link
}
from
'
@chakra-ui/react
'
;
import
type
{
HTMLChakraProps
}
from
'
@chakra-ui/system
'
;
import
React
from
'
react
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
AddressWithDots
from
'
./AddressWithDots
'
;
import
CopyToClipboard
from
'
./CopyToClipboard
'
;
const
FONT_WEIGHT
=
'
600
'
;
interface
Props
extends
HTMLChakraProps
<
'
div
'
>
{
address
:
string
;
type
?:
'
address
'
|
'
transaction
'
|
'
token
'
;
fontWeight
?:
string
;
truncated
?:
boolean
;
withCopy
?:
boolean
;
}
const
AddressLinkWithTooltip
=
({
address
,
type
=
'
address
'
,
truncated
,
withCopy
=
true
,
...
styles
}:
Props
)
=>
{
const
link
=
useLink
();
let
url
;
if
(
type
===
'
transaction
'
)
{
url
=
link
(
'
tx_index
'
,
{
id
:
address
});
}
else
if
(
type
===
'
token
'
)
{
url
=
link
(
'
token_index
'
,
{
id
:
address
});
}
else
{
url
=
link
(
'
address_index
'
,
{
id
:
address
});
}
return
(
<
Flex
columnGap=
{
2
}
alignItems=
"center"
overflow=
"hidden"
maxW=
"100%"
{
...
styles
}
>
<
Link
href=
{
url
}
target=
"_blank"
overflow=
"hidden"
fontWeight=
{
styles
.
fontWeight
||
FONT_WEIGHT
}
lineHeight=
"24px"
whiteSpace=
"nowrap"
>
<
AddressWithDots
address=
{
address
}
fontWeight=
{
styles
.
fontWeight
||
FONT_WEIGHT
}
truncated=
{
truncated
}
/>
</
Link
>
{
withCopy
&&
<
CopyToClipboard
text=
{
address
}
/>
}
</
Flex
>
);
};
export
default
React
.
memo
(
AddressLinkWithTooltip
);
ui/shared/AddressSnippet.tsx
View file @
900bf7d9
import
{
Box
,
HStack
,
Text
}
from
'
@chakra-ui/react
'
;
import
{
Text
,
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
interface
Props
{
address
:
string
;
...
...
@@ -11,13 +13,14 @@ interface Props {
const
AddressSnippet
=
({
address
,
subtitle
}:
Props
)
=>
{
return
(
<
HStack
spacing=
{
4
}
key=
{
address
}
overflow=
"hidden"
alignItems=
"start"
maxW=
"100%"
>
<
AddressIcon
address=
{
address
}
/>
<
Box
overflow=
"hidden"
>
<
AddressLinkWithTooltip
address=
{
address
}
/>
{
subtitle
&&
<
Text
fontSize=
"sm"
variant=
"secondary"
mt=
{
0.5
}
>
{
subtitle
}
</
Text
>
}
</
Box
>
</
HStack
>
<
Box
maxW=
"100%"
>
<
Address
>
<
AddressIcon
hash=
{
address
}
/>
<
AddressLink
hash=
{
address
}
fontWeight=
"600"
ml=
{
2
}
/>
<
CopyToClipboard
text=
{
address
}
ml=
{
1
}
/>
</
Address
>
{
subtitle
&&
<
Text
fontSize=
"sm"
variant=
"secondary"
mt=
{
0.5
}
ml=
{
{
base
:
0
,
lg
:
8
}
}
>
{
subtitle
}
</
Text
>
}
</
Box
>
);
};
...
...
ui/shared/CopyToClipboard.tsx
View file @
900bf7d9
import
{
IconButton
,
Tooltip
,
useClipboard
}
from
'
@chakra-ui/react
'
;
import
{
IconButton
,
Tooltip
,
useClipboard
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
CopyIcon
from
'
icons/copy.svg
'
;
const
CopyToClipboard
=
({
text
}:
{
text
:
string
})
=>
{
const
CopyToClipboard
=
({
text
,
className
}:
{
text
:
string
;
className
?
:
string
})
=>
{
const
{
hasCopied
,
onCopy
}
=
useClipboard
(
text
,
3000
);
const
[
copied
,
setCopied
]
=
useState
(
false
);
...
...
@@ -26,9 +26,10 @@ const CopyToClipboard = ({ text }: {text: string}) => {
display=
"inline-block"
flexShrink=
{
0
}
onClick=
{
onCopy
}
className=
{
className
}
/>
</
Tooltip
>
);
};
export
default
CopyToClipboard
;
export
default
chakra
(
CopyToClipboard
)
;
ui/shared/HashStringShorten.tsx
0 → 100644
View file @
900bf7d9
import
{
Tooltip
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
interface
Props
{
hash
:
string
;
}
const
HashStringShorten
=
({
hash
}:
Props
)
=>
{
return
(
<
Tooltip
label=
{
hash
}
>
{
hash
.
slice
(
0
,
4
)
+
'
...
'
+
hash
.
slice
(
-
4
)
}
</
Tooltip
>
);
};
export
default
HashStringShorten
;
ui/shared/
AddressWithDots
.tsx
→
ui/shared/
HashStringShortenDynamic
.tsx
View file @
900bf7d9
// this component trims
address
like 0x123...4567 (always 4 chars after dots)
// or shows full
address
, if fits
// this component trims
hash string
like 0x123...4567 (always 4 chars after dots)
// or shows full
hash string
, if fits
// i can't do this with pure css. if you can, feel free to replace it
...
...
@@ -20,28 +20,20 @@ const TAIL_LENGTH = 4;
const
HEAD_MIN_LENGTH
=
4
;
interface
Props
{
address
:
string
;
fontWeight
:
string
|
number
;
truncated
?:
boolean
;
hash
:
string
;
fontWeight
?:
string
|
number
;
}
const
shortenAddress
=
(
address
:
string
)
=>
address
.
slice
(
0
,
4
)
+
'
...
'
+
address
.
slice
(
-
4
);
const
AddressWithDots
=
({
address
,
fontWeight
,
truncated
}:
Props
)
=>
{
const
addressRef
=
useRef
<
HTMLSpanElement
>
(
null
);
const
[
displayedAddress
,
setAddress
]
=
React
.
useState
(
truncated
?
shortenAddress
(
address
)
:
address
);
const
HashStringShortenDynamic
=
({
hash
,
fontWeight
=
'
400
'
}:
Props
)
=>
{
const
elementRef
=
useRef
<
HTMLSpanElement
>
(
null
);
const
[
displayedString
,
setDisplayedString
]
=
React
.
useState
(
hash
);
const
isFontFaceLoaded
=
useFontFaceObserver
([
{
family
:
BODY_TYPEFACE
,
weight
:
String
(
fontWeight
)
as
FontFace
[
'
weight
'
]
},
]);
const
calculateString
=
useCallback
(()
=>
{
const
addressEl
=
addressRef
.
current
;
if
(
!
addressEl
)
{
return
;
}
const
parent
=
addressRef
?.
current
?.
parentNode
as
HTMLElement
;
const
parent
=
elementRef
?.
current
?.
parentNode
as
HTMLElement
;
if
(
!
parent
)
{
return
;
}
...
...
@@ -49,51 +41,49 @@ const AddressWithDots = ({ address, fontWeight, truncated }: Props) => {
const
shadowEl
=
document
.
createElement
(
'
span
'
);
shadowEl
.
style
.
opacity
=
'
0
'
;
parent
.
appendChild
(
shadowEl
);
shadowEl
.
textContent
=
address
;
shadowEl
.
textContent
=
hash
;
const
parentWidth
=
getWidth
(
parent
);
if
(
getWidth
(
shadowEl
)
>
parentWidth
)
{
for
(
let
i
=
1
;
i
<=
address
.
length
-
TAIL_LENGTH
-
HEAD_MIN_LENGTH
;
i
++
)
{
const
res
=
address
.
slice
(
0
,
address
.
length
-
i
-
TAIL_LENGTH
)
+
'
...
'
+
address
.
slice
(
-
TAIL_LENGTH
);
for
(
let
i
=
1
;
i
<=
hash
.
length
-
TAIL_LENGTH
-
HEAD_MIN_LENGTH
;
i
++
)
{
const
res
=
hash
.
slice
(
0
,
hash
.
length
-
i
-
TAIL_LENGTH
)
+
'
...
'
+
hash
.
slice
(
-
TAIL_LENGTH
);
shadowEl
.
textContent
=
res
;
if
(
getWidth
(
shadowEl
)
<
parentWidth
||
i
===
address
.
length
-
TAIL_LENGTH
-
HEAD_MIN_LENGTH
)
{
set
Address
(
res
);
if
(
getWidth
(
shadowEl
)
<
parentWidth
||
i
===
hash
.
length
-
TAIL_LENGTH
-
HEAD_MIN_LENGTH
)
{
set
DisplayedString
(
res
);
break
;
}
}
}
else
{
set
Address
(
address
);
set
DisplayedString
(
hash
);
}
parent
.
removeChild
(
shadowEl
);
},
[
address
]);
},
[
hash
]);
// we want to do recalculation when isFontFaceLoaded flag is changed
// but we don't want to create more resize event listeners
// that's why there are separate useEffect hooks
useEffect
(()
=>
{
!
truncated
&&
calculateString
();
},
[
calculateString
,
isFontFaceLoaded
,
truncated
]);
calculateString
();
},
[
calculateString
,
isFontFaceLoaded
]);
useEffect
(()
=>
{
if
(
!
truncated
)
{
const
resizeHandler
=
_debounce
(
calculateString
,
100
);
const
resizeObserver
=
new
ResizeObserver
(
resizeHandler
);
resizeObserver
.
observe
(
document
.
body
);
return
function
cleanup
()
{
resizeObserver
.
unobserve
(
document
.
body
);
};
}
},
[
calculateString
,
truncated
]);
const
resizeHandler
=
_debounce
(
calculateString
,
100
);
const
resizeObserver
=
new
ResizeObserver
(
resizeHandler
);
resizeObserver
.
observe
(
document
.
body
);
return
function
cleanup
()
{
resizeObserver
.
unobserve
(
document
.
body
);
};
},
[
calculateString
]);
const
content
=
<
span
ref=
{
addressRef
}
>
{
displayedAddress
}
</
span
>;
const
isTruncated
=
truncated
||
address
.
length
!==
displayedAddress
.
length
;
const
content
=
<
span
ref=
{
elementRef
}
>
{
displayedString
}
</
span
>;
const
isTruncated
=
hash
.
length
!==
displayedString
.
length
;
if
(
isTruncated
)
{
return
(
<
Tooltip
label=
{
address
}
>
{
content
}
</
Tooltip
>
<
Tooltip
label=
{
hash
}
>
{
content
}
</
Tooltip
>
);
}
...
...
@@ -104,4 +94,4 @@ function getWidth(el: HTMLElement) {
return
el
.
getBoundingClientRect
().
width
;
}
export
default
React
.
memo
(
AddressWithDots
);
export
default
React
.
memo
(
HashStringShortenDynamic
);
ui/shared/TransactionSnippet.tsx
View file @
900bf7d9
import
{
Box
,
HStack
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
transactionIcon
from
'
icons/transactions.svg
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
interface
Props
{
hash
:
string
;
...
...
@@ -10,12 +12,11 @@ interface Props {
const
TransactionSnippet
=
({
hash
}:
Props
)
=>
{
return
(
<
HStack
spacing=
{
2
}
overflow=
"hidden"
alignItems=
"start"
maxW=
"100%"
>
<
Address
maxW=
"100%"
>
<
Icon
as=
{
transactionIcon
}
boxSize=
{
6
}
color=
{
useColorModeValue
(
'
gray.500
'
,
'
gray.400
'
)
}
/>
<
Box
overflow=
"hidden"
>
<
AddressLinkWithTooltip
address=
{
hash
}
type=
"transaction"
/>
</
Box
>
</
HStack
>
<
AddressLink
hash=
{
hash
}
fontWeight=
"600"
type=
"transaction"
ml=
{
2
}
/>
<
CopyToClipboard
text=
{
hash
}
ml=
{
1
}
/>
</
Address
>
);
};
...
...
ui/shared/address/Address.tsx
0 → 100644
View file @
900bf7d9
import
{
Flex
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
interface
Props
{
className
?:
string
;
children
:
React
.
ReactNode
;
}
const
Address
=
({
children
,
className
}:
Props
)
=>
{
return
<
Flex
alignItems=
"center"
overflow=
"hidden"
className=
{
className
}
>
{
children
}
</
Flex
>;
};
const
AddressChakra
=
chakra
(
Address
);
export
default
React
.
memo
(
AddressChakra
);
ui/shared/address/AddressIcon.tsx
0 → 100644
View file @
900bf7d9
import
{
Box
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
Jazzicon
,
{
jsNumberForAddress
}
from
'
react-jazzicon
'
;
const
AddressIcon
=
({
hash
,
className
}:
{
hash
:
string
;
className
?:
string
})
=>
{
return
(
<
Box
className=
{
className
}
width=
"24px"
display=
"inline-flex"
>
<
Jazzicon
diameter=
{
24
}
seed=
{
jsNumberForAddress
(
hash
)
}
/>
</
Box
>
);
};
export
default
chakra
(
AddressIcon
);
ui/shared/address/AddressLink.tsx
0 → 100644
View file @
900bf7d9
import
{
Link
,
chakra
,
shouldForwardProp
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
HashStringShorten
from
'
ui/shared/HashStringShorten
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
interface
Props
{
type
?:
'
address
'
|
'
transaction
'
|
'
token
'
;
className
?:
string
;
hash
:
string
;
truncation
?:
'
constant
'
|
'
dynamic
'
|
'
none
'
;
fontWeight
?:
string
;
}
const
AddressLink
=
({
type
,
className
,
truncation
=
'
dynamic
'
,
hash
,
fontWeight
}:
Props
)
=>
{
const
link
=
useLink
();
let
url
;
if
(
type
===
'
transaction
'
)
{
url
=
link
(
'
tx_index
'
,
{
id
:
hash
});
}
else
if
(
type
===
'
token
'
)
{
url
=
link
(
'
token_index
'
,
{
id
:
hash
});
}
else
{
url
=
link
(
'
address_index
'
,
{
id
:
hash
});
}
const
content
=
(()
=>
{
switch
(
truncation
)
{
case
'
constant
'
:
return
<
HashStringShorten
hash=
{
hash
}
/>;
case
'
dynamic
'
:
return
<
HashStringShortenDynamic
hash=
{
hash
}
fontWeight=
{
fontWeight
}
/>;
case
'
none
'
:
return
<
span
>
{
hash
}
</
span
>;
}
})();
return
(
<
Link
className=
{
className
}
href=
{
url
}
target=
"_blank"
overflow=
"hidden"
whiteSpace=
"nowrap"
>
{
content
}
</
Link
>
);
};
const
AddressLinkChakra
=
chakra
(
AddressLink
,
{
shouldForwardProp
:
(
prop
)
=>
{
const
isChakraProp
=
!
shouldForwardProp
(
prop
);
// forward fontWeight to the AddressLink since it's needed for underlying HashStringShortenDynamic component
if
(
isChakraProp
&&
prop
!==
'
fontWeight
'
)
{
return
false
;
}
return
true
;
},
});
export
default
React
.
memo
(
AddressLinkChakra
);
ui/tx/TokenTransfer.tsx
View file @
900bf7d9
...
...
@@ -3,7 +3,7 @@ import React from 'react';
import
rightArrowIcon
from
'
icons/arrows/right.svg
'
;
import
{
space
}
from
'
lib/html-entities
'
;
import
AddressLink
WithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
Token
from
'
ui/shared/Token
'
;
interface
Props
{
...
...
@@ -17,9 +17,9 @@ interface Props {
const
TokenTransfer
=
({
from
,
to
,
amount
,
usd
,
token
}:
Props
)
=>
{
return
(
<
Center
>
<
AddressLink
WithTooltip
address=
{
from
}
fontWeight=
"500"
truncated
withCopy=
{
false
}
/>
<
AddressLink
fontWeight=
"500"
hash=
{
from
}
truncation=
"constant"
/>
<
Icon
as=
{
rightArrowIcon
}
boxSize=
{
6
}
mx=
{
2
}
color=
"gray.500"
/>
<
AddressLink
WithTooltip
address=
{
to
}
fontWeight=
"500"
truncated
withCopy=
{
false
}
/>
<
AddressLink
fontWeight=
"500"
hash=
{
to
}
truncation=
"constant"
/>
<
Text
fontWeight=
{
500
}
as=
"span"
ml=
{
4
}
>
For:
{
space
}
<
Text
fontWeight=
{
600
}
as=
"span"
>
{
amount
}
</
Text
>
{
space
}
<
Text
fontWeight=
{
400
}
variant=
"secondary"
as=
"span"
>
($
{
usd
.
toFixed
(
2
)
}
)
</
Text
>
...
...
ui/tx/TxDecodedInputData.tsx
View file @
900bf7d9
import
{
Flex
,
Text
,
Grid
,
GridItem
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
interface
RowProps
{
...
...
@@ -109,10 +110,16 @@ const TxDecodedInputData = () => {
Data
</
GridItem
>
<
TableRow
name=
"from"
type=
"address"
>
<
AddressLinkWithTooltip
address=
"0x0000000000000000000000000000000000000000"
columnGap=
{
0
}
justifyContent=
"space-between"
fontWeight=
"400"
/>
<
Address
justifyContent=
"space-between"
>
<
AddressLink
hash=
"0x0000000000000000000000000000000000000000"
/>
<
CopyToClipboard
text=
"0x0000000000000000000000000000000000000000"
/>
</
Address
>
</
TableRow
>
<
TableRow
name=
"from"
type=
"address"
>
<
AddressLinkWithTooltip
address=
"0xcf0c50b7ea8af37d57380a0ac199d55b0782c718"
columnGap=
{
0
}
justifyContent=
"space-between"
fontWeight=
"400"
/>
<
Address
justifyContent=
"space-between"
>
<
AddressLink
hash=
"0xcf0c50b7ea8af37d57380a0ac199d55b0782c718"
/>
<
CopyToClipboard
text=
"0xcf0c50b7ea8af37d57380a0ac199d55b0782c718"
/>
</
Address
>
</
TableRow
>
<
TableRow
name=
"tokenId"
type=
"uint256"
isLast
>
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
>
...
...
ui/tx/TxDetails.tsx
View file @
900bf7d9
...
...
@@ -7,8 +7,9 @@ import clockIcon from 'icons/clock.svg';
import
flameIcon
from
'
icons/flame.svg
'
;
import
successIcon
from
'
icons/status/success.svg
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
CopyToClipboard
from
'
ui/shared/CopyToClipboard
'
;
import
DetailsInfoItem
from
'
ui/shared/DetailsInfoItem
'
;
import
RawInputData
from
'
ui/shared/RawInputData
'
;
...
...
@@ -77,15 +78,21 @@ const TxDetails = () => {
hint=
"Address (external or contract) sending the transaction."
mt=
{
8
}
>
<
AddressIcon
address=
{
tx
.
address_from
}
/>
<
AddressLinkWithTooltip
address=
{
tx
.
address_from
}
columnGap=
{
0
}
ml=
{
2
}
fontWeight=
"400"
/>
<
Address
>
<
AddressIcon
hash=
{
tx
.
address_from
}
/>
<
AddressLink
ml=
{
2
}
hash=
{
tx
.
address_from
}
/>
<
CopyToClipboard
text=
{
tx
.
address_from
}
/>
</
Address
>
</
DetailsInfoItem
>
<
DetailsInfoItem
title=
"Interacted with contract"
hint=
"Address (external or contract) receiving the transaction."
>
<
AddressIcon
address=
{
tx
.
address_to
}
/>
<
AddressLinkWithTooltip
address=
{
tx
.
address_to
}
columnGap=
{
0
}
ml=
{
2
}
fontWeight=
"400"
/>
<
Address
>
<
AddressIcon
hash=
{
tx
.
address_to
}
/>
<
AddressLink
ml=
{
2
}
hash=
{
tx
.
address_to
}
/>
<
CopyToClipboard
text=
{
tx
.
address_to
}
/>
</
Address
>
<
Tag
colorScheme=
"orange"
variant=
"solid"
ml=
{
3
}
>
SANA
</
Tag
>
<
Icon
as=
{
successIcon
}
boxSize=
{
4
}
ml=
{
2
}
color=
"green.500"
/>
<
Token
symbol=
"USDT"
ml=
{
3
}
/>
...
...
ui/tx/TxStatus.tsx
View file @
900bf7d9
...
...
@@ -14,7 +14,7 @@ const TxStatus = ({ status }: Props) => {
const
colorScheme
=
status
===
'
success
'
?
'
green
'
:
'
red
'
;
return
(
<
Tag
colorScheme=
{
colorScheme
}
>
<
Tag
colorScheme=
{
colorScheme
}
display=
"inline-flex"
>
<
TagLeftIcon
boxSize=
{
2.5
}
as=
{
icon
}
/>
<
TagLabel
>
{
label
}
</
TagLabel
>
</
Tag
>
...
...
ui/tx/internals/TxInternalsTableItem.tsx
View file @
900bf7d9
import
{
Tr
,
Td
,
Tag
,
Flex
,
Icon
}
from
'
@chakra-ui/react
'
;
import
{
Tr
,
Td
,
Tag
,
Icon
}
from
'
@chakra-ui/react
'
;
import
capitalize
from
'
lodash/capitalize
'
;
import
React
from
'
react
'
;
import
rightArrowIcon
from
'
icons/arrows/right.svg
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
TxStatus
from
'
ui/tx/TxStatus
'
;
interface
Props
{
...
...
@@ -24,17 +25,17 @@ const TxInternalTableItem = ({ type, status, from, to, value, gasLimit }: Props)
<
TxStatus
status=
{
status
}
/>
</
Td
>
<
Td
pr=
"0"
>
<
Flex
alignItems=
"center"
>
<
AddressIcon
address
=
{
from
}
/>
<
AddressLink
WithTooltip
address=
{
from
}
fontWeight=
"500"
withCopy=
{
false
}
ml=
{
2
}
/>
<
Icon
as=
{
rightArrowIcon
}
boxSize=
{
6
}
mx=
{
2
}
color=
"gray.500"
/>
</
Flex
>
<
Address
>
<
AddressIcon
hash
=
{
from
}
/>
<
AddressLink
ml=
{
2
}
fontWeight=
"500"
hash=
{
from
}
/>
<
Icon
as=
{
rightArrowIcon
}
boxSize=
{
6
}
mx=
{
2
}
flexShrink=
{
0
}
color=
"gray.500"
/>
</
Address
>
</
Td
>
<
Td
pl=
"0"
>
<
Flex
alignItems=
"center"
>
<
AddressIcon
address
=
{
to
}
/>
<
AddressLink
WithTooltip
address=
{
to
}
fontWeight=
"500"
withCopy=
{
false
}
ml=
{
2
}
/>
</
Flex
>
<
Address
>
<
AddressIcon
hash
=
{
to
}
/>
<
AddressLink
ml=
{
2
}
fontWeight=
"500"
hash=
{
to
}
/>
</
Address
>
</
Td
>
<
Td
isNumeric
>
{
value
}
...
...
ui/tx/logs/TxLogItem.tsx
View file @
900bf7d9
...
...
@@ -2,8 +2,9 @@ import { SearchIcon } from '@chakra-ui/icons';
import
{
Text
,
Grid
,
GridItem
,
Link
,
Tooltip
,
Button
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
TxLogTopic
from
'
ui/tx/logs/TxLogTopic
'
;
import
DecodedInputData
from
'
ui/tx/TxDecodedInputData
'
;
...
...
@@ -24,8 +25,10 @@ const TxLogItem = ({ address, index, topics, data }: Props) => {
<
Grid
gridTemplateColumns=
"200px 1fr"
gap=
{
8
}
py=
{
8
}
_notFirst=
{
{
borderTopWidth
:
'
1px
'
,
borderTopColor
:
borderColor
}
}
>
<
RowHeader
>
Address
</
RowHeader
>
<
GridItem
display=
"flex"
alignItems=
"center"
>
<
AddressIcon
address=
{
address
}
/>
<
AddressLinkWithTooltip
address=
{
address
}
columnGap=
{
0
}
ml=
{
2
}
fontWeight=
"400"
withCopy=
{
false
}
/>
<
Address
>
<
AddressIcon
hash=
{
address
}
/>
<
AddressLink
hash=
{
address
}
ml=
{
2
}
/>
</
Address
>
<
Tooltip
label=
"Find matches topic"
>
<
Link
ml=
{
2
}
>
<
SearchIcon
w=
{
5
}
h=
{
5
}
/>
...
...
ui/tx/state/TxStateTableItem.tsx
View file @
900bf7d9
...
...
@@ -7,7 +7,6 @@ import {
Box
,
Tr
,
Td
,
Flex
,
Stat
,
StatArrow
,
Portal
,
...
...
@@ -18,8 +17,9 @@ import React, { useRef } from 'react';
import
type
{
TTxStateItem
}
from
'
data/txState
'
;
import
{
nbsp
}
from
'
lib/html-entities
'
;
import
AddressIcon
from
'
ui/shared/AddressIcon
'
;
import
AddressLinkWithTooltip
from
'
ui/shared/AddressLinkWithTooltip
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
TxStateStorageItem
from
'
./TxStateStorageItem
'
;
...
...
@@ -57,10 +57,10 @@ const TxStateTableItem = ({ txStateItem }: { txStateItem: TTxStateItem }) => {
</
AccordionButton
>
</
Td
>
<
Td
border=
{
0
}
>
<
Flex
height=
"30px"
alignItems=
"center
"
>
<
AddressIcon
address
=
{
txStateItem
.
address
}
/>
<
AddressLink
WithTooltip
address=
{
txStateItem
.
address
}
fontWeight=
"500"
truncated
withCopy=
{
false
}
ml=
{
2
}
/>
</
Flex
>
<
Address
height=
"30px
"
>
<
AddressIcon
hash
=
{
txStateItem
.
address
}
/>
<
AddressLink
hash=
{
txStateItem
.
address
}
fontWeight=
"500"
truncation=
"constant"
ml=
{
2
}
/>
</
Address
>
</
Td
>
<
Td
border=
{
0
}
lineHeight=
"30px"
><
Link
>
{
txStateItem
.
miner
}
</
Link
></
Td
>
<
Td
border=
{
0
}
isNumeric
lineHeight=
"30px"
>
...
...
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