1- // TODO @tom 2drum refactor this to use TokenValue
21import { Box , Flex } from '@chakra-ui/react' ;
3- import BigNumber from 'bignumber.js' ;
42import React from 'react' ;
53
64import type { AddressParam } from 'types/api/addressParams' ;
75import type { BlockBaseFeeCelo } from 'types/api/block' ;
86import type { TokenInfo } from 'types/api/token' ;
97
108import { Link } from 'toolkit/chakra/link' ;
11- import { WEI , ZERO_ADDRESS } from 'toolkit/utils/consts' ;
9+ import { ZERO_ADDRESS } from 'toolkit/utils/consts' ;
1210import AddressFromTo from 'ui/shared/address/AddressFromTo' ;
1311import * as DetailedInfo from 'ui/shared/DetailedInfo/DetailedInfo' ;
1412import AddressEntity from 'ui/shared/entities/address/AddressEntity' ;
15- import TokenEntity from 'ui/shared/entities/token/TokenEntity' ;
1613import IconSvg from 'ui/shared/IconSvg' ;
14+ import TokenValue from 'ui/shared/value/TokenValue' ;
1715
1816type ItemProps = BlockBaseFeeCelo [ 'breakdown' ] [ number ] & {
1917 addressFrom : AddressParam ;
@@ -26,10 +24,10 @@ const BreakDownItem = ({ amount, percentage, address, addressFrom, token }: Item
2624 return (
2725 < Flex alignItems = "center" columnGap = { 2 } flexWrap = "wrap" >
2826 < Box color = "text.secondary" > { percentage } % of amount</ Box >
29- < Flex columnGap = { 2 } >
30- { BigNumber ( amount ) . dividedBy ( WEI ) . toFixed ( ) }
31- < TokenEntity token = { token } noCopy onlySymbol />
32- </ Flex >
27+ < TokenValue
28+ amount = { amount }
29+ token = { token }
30+ / >
3331 { isBurning ? (
3432 < >
3533 < AddressEntity address = { addressFrom } truncation = "constant" />
@@ -46,8 +44,6 @@ interface Props {
4644}
4745
4846const BlockDetailsBaseFeeCelo = ( { data } : Props ) => {
49- const totalBaseFee = BigNumber ( data . amount ) . dividedBy ( WEI ) . toFixed ( ) ;
50-
5147 const totalFeeLabel = (
5248 < Box whiteSpace = "pre-wrap" >
5349 < span > The FeeHandler regularly burns 80% of its tokens. Non-CELO tokens are swapped to CELO beforehand. The remaining 20% are sent to the </ span >
@@ -70,10 +66,10 @@ const BlockDetailsBaseFeeCelo = ({ data }: Props) => {
7066 Base fee total
7167 </ DetailedInfo . ItemLabel >
7268 < DetailedInfo . ItemValue multiRow flexDirection = "column" alignItems = "flex-start" >
73- < Flex columnGap = { 2 } >
74- { totalBaseFee }
75- < TokenEntity token = { data . token } noCopy onlySymbol />
76- </ Flex >
69+ < TokenValue
70+ amount = { data . amount }
71+ token = { data . token }
72+ / >
7773 { data . breakdown . length > 0 && (
7874 < Flex flexDir = "column" rowGap = { 2 } mt = { 2 } >
7975 { data . breakdown . map ( ( item , index ) => (
0 commit comments