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
2813872e
Commit
2813872e
authored
Oct 11, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate block list to big-number-js
parent
88c99dbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
BlocksListItem.tsx
ui/blocks/BlocksListItem.tsx
+7
-6
BlocksTableItem.tsx
ui/blocks/BlocksTableItem.tsx
+7
-9
No files found.
ui/blocks/BlocksListItem.tsx
View file @
2813872e
import
{
Flex
,
Link
,
Spinner
,
Text
,
Box
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Link
,
Spinner
,
Text
,
Box
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
constants
,
utils
}
from
'
ether
s
'
;
import
BigNumber
from
'
bignumber.j
s
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
import
flameIcon
from
'
icons/flame.svg
'
;
import
flameIcon
from
'
icons/flame.svg
'
;
import
getBlockReward
from
'
lib/block/getBlockReward
'
;
import
getBlockReward
from
'
lib/block/getBlockReward
'
;
import
{
WEI
}
from
'
lib/consts
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
useNetwork
from
'
lib/hooks/useNetwork
'
;
import
useNetwork
from
'
lib/hooks/useNetwork
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
useLink
from
'
lib/link/useLink
'
;
...
@@ -54,20 +55,20 @@ const BlocksListItem = ({ data, isPending }: Props) => {
...
@@ -54,20 +55,20 @@ const BlocksListItem = ({ data, isPending }: Props) => {
<
Box
>
<
Box
>
<
Text
fontWeight=
{
500
}
>
Gas used
</
Text
>
<
Text
fontWeight=
{
500
}
>
Gas used
</
Text
>
<
Flex
columnGap=
{
4
}
>
<
Flex
columnGap=
{
4
}
>
<
Text
variant=
"secondary"
>
{
utils
.
commify
(
data
.
gas_used
)
}
</
Text
>
<
Text
variant=
"secondary"
>
{
BigNumber
(
data
.
gas_used
).
toFormat
(
)
}
</
Text
>
<
Utilization
colorScheme=
"gray"
value=
{
utils
.
parseUnits
(
data
.
gas_used
).
mul
(
10
_000
).
div
(
utils
.
parseUnits
(
data
.
gas_limit
)).
toNumber
()
/
10
_000
}
/>
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
).
div
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
<
GasUsedToTargetRatio
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
<
GasUsedToTargetRatio
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
</
Flex
>
</
Flex
>
</
Box
>
</
Box
>
<
Flex
columnGap=
{
2
}
>
<
Flex
columnGap=
{
2
}
>
<
Text
fontWeight=
{
500
}
>
Reward
{
network
?.
currency
}
</
Text
>
<
Text
fontWeight=
{
500
}
>
Reward
{
network
?.
currency
}
</
Text
>
<
Text
variant=
"secondary"
>
{
utils
.
formatUnits
(
totalReward
)
}
</
Text
>
<
Text
variant=
"secondary"
>
{
totalReward
.
div
(
WEI
).
toFixed
(
)
}
</
Text
>
</
Flex
>
</
Flex
>
<
Flex
>
<
Flex
>
<
Text
fontWeight=
{
500
}
>
Burnt fees
</
Text
>
<
Text
fontWeight=
{
500
}
>
Burnt fees
</
Text
>
<
Icon
as=
{
flameIcon
}
boxSize=
{
5
}
color=
"gray.500"
ml=
{
2
}
/>
<
Icon
as=
{
flameIcon
}
boxSize=
{
5
}
color=
"gray.500"
ml=
{
2
}
/>
<
Text
variant=
"secondary"
ml=
{
1
}
>
{
utils
.
formatUnits
(
burntFees
)
}
</
Text
>
<
Text
variant=
"secondary"
ml=
{
1
}
>
{
burntFees
.
div
(
WEI
).
toFixed
(
)
}
</
Text
>
<
Utilization
ml=
{
4
}
value=
{
txFees
.
eq
(
constants
.
Zero
)
?
1
:
burntFees
.
mul
(
10
_000
).
div
(
txFees
).
toNumber
()
/
10
_000
}
/>
<
Utilization
ml=
{
4
}
value=
{
burntFees
.
div
(
txFees
).
toNumber
()
}
/>
</
Flex
>
</
Flex
>
</
AccountListItemMobile
>
</
AccountListItemMobile
>
);
);
...
...
ui/blocks/BlocksTableItem.tsx
View file @
2813872e
import
{
Tr
,
Td
,
Text
,
Link
,
Flex
,
Box
,
Icon
,
Tooltip
,
Spinner
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Tr
,
Td
,
Text
,
Link
,
Flex
,
Box
,
Icon
,
Tooltip
,
Spinner
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
constants
,
utils
}
from
'
ether
s
'
;
import
BigNumber
from
'
bignumber.j
s
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
import
type
{
Block
}
from
'
types/api/block
'
;
import
flameIcon
from
'
icons/flame.svg
'
;
import
flameIcon
from
'
icons/flame.svg
'
;
import
getBlockReward
from
'
lib/block/getBlockReward
'
;
import
getBlockReward
from
'
lib/block/getBlockReward
'
;
import
{
WEI
}
from
'
lib/consts
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
useLink
from
'
lib/link/useLink
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
...
@@ -45,24 +46,21 @@ const BlocksTableItem = ({ data, isPending }: Props) => {
...
@@ -45,24 +46,21 @@ const BlocksTableItem = ({ data, isPending }: Props) => {
</
Td
>
</
Td
>
<
Td
isNumeric
fontSize=
"sm"
>
{
data
.
tx_count
}
</
Td
>
<
Td
isNumeric
fontSize=
"sm"
>
{
data
.
tx_count
}
</
Td
>
<
Td
fontSize=
"sm"
>
<
Td
fontSize=
"sm"
>
<
Box
>
{
utils
.
commify
(
data
.
gas_used
)
}
</
Box
>
<
Box
>
{
BigNumber
(
data
.
gas_used
).
toFormat
(
)
}
</
Box
>
<
Flex
mt=
{
2
}
>
<
Flex
mt=
{
2
}
>
<
Utilization
<
Utilization
colorScheme=
"gray"
value=
{
BigNumber
(
data
.
gas_used
).
dividedBy
(
BigNumber
(
data
.
gas_limit
)).
toNumber
()
}
/>
colorScheme=
"gray"
value=
{
utils
.
parseUnits
(
data
.
gas_used
).
mul
(
10
_000
).
div
(
utils
.
parseUnits
(
data
.
gas_limit
)).
toNumber
()
/
10
_000
}
/>
<
GasUsedToTargetRatio
ml=
{
2
}
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
<
GasUsedToTargetRatio
ml=
{
2
}
value=
{
data
.
gas_target_percentage
||
undefined
}
/>
</
Flex
>
</
Flex
>
</
Td
>
</
Td
>
<
Td
fontSize=
"sm"
>
{
utils
.
formatUnits
(
totalReward
)
}
</
Td
>
<
Td
fontSize=
"sm"
>
{
totalReward
.
dividedBy
(
WEI
).
toFixed
(
)
}
</
Td
>
<
Td
fontSize=
"sm"
>
<
Td
fontSize=
"sm"
>
<
Flex
alignItems=
"center"
columnGap=
{
1
}
>
<
Flex
alignItems=
"center"
columnGap=
{
1
}
>
<
Icon
as=
{
flameIcon
}
boxSize=
{
5
}
color=
{
useColorModeValue
(
'
gray.500
'
,
'
inherit
'
)
}
/>
<
Icon
as=
{
flameIcon
}
boxSize=
{
5
}
color=
{
useColorModeValue
(
'
gray.500
'
,
'
inherit
'
)
}
/>
{
Number
(
utils
.
formatUnits
(
burntFees
)
).
toFixed
(
8
)
}
{
burntFees
.
dividedBy
(
WEI
).
toFixed
(
8
)
}
</
Flex
>
</
Flex
>
<
Tooltip
label=
"Burnt fees / Txn fees * 100%"
>
<
Tooltip
label=
"Burnt fees / Txn fees * 100%"
>
<
Box
w=
"min-content"
>
<
Box
w=
"min-content"
>
<
Utilization
mt=
{
2
}
value=
{
txFees
.
eq
(
constants
.
Zero
)
?
1
:
burntFees
.
mul
(
10
_000
).
div
(
txFees
).
toNumber
()
/
10
_000
}
/>
<
Utilization
mt=
{
2
}
value=
{
burntFees
.
div
(
txFees
).
toNumber
()
}
/>
</
Box
>
</
Box
>
</
Tooltip
>
</
Tooltip
>
</
Td
>
</
Td
>
...
...
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