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
5101e054
Commit
5101e054
authored
Oct 15, 2022
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rounding
parent
591e8583
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
8 deletions
+15
-8
CurrencyValue.tsx
ui/shared/CurrencyValue.tsx
+10
-3
TxAdditionalInfo.tsx
ui/txs/TxAdditionalInfo.tsx
+3
-3
TxsListItem.tsx
ui/txs/TxsListItem.tsx
+2
-2
No files found.
ui/shared/CurrencyValue.tsx
View file @
5101e054
...
...
@@ -18,13 +18,20 @@ interface Props {
const
CurrencyValue
=
({
value
,
currency
=
''
,
unit
,
exchangeRate
,
className
,
accuracy
,
accuracyUsd
}:
Props
)
=>
{
const
valueCurr
=
getValueWithUnit
(
value
,
unit
);
const
valueResult
=
parseFloat
(
accuracy
?
valueCurr
.
toFixed
(
accuracy
)
:
valueCurr
.
toFixed
()
);
const
valueResult
=
accuracy
?
valueCurr
.
dp
(
accuracy
).
toFormat
()
:
valueCurr
.
toFormat
(
);
let
usdContent
;
if
(
exchangeRate
!==
undefined
&&
exchangeRate
!==
null
)
{
const
exchangeRateBn
=
new
BigNumber
(
exchangeRate
);
const
usdBn
=
valueCurr
.
times
(
exchangeRateBn
);
const
usdResult
=
parseFloat
(
accuracyUsd
?
usdBn
.
toFixed
(
accuracyUsd
)
:
usdBn
.
toFixed
());
let
usdResult
:
string
;
if
(
accuracyUsd
&&
!
usdBn
.
isEqualTo
(
0
))
{
const
usdBnDp
=
usdBn
.
dp
(
accuracyUsd
);
usdResult
=
usdBnDp
.
isEqualTo
(
0
)
?
usdBn
.
precision
(
accuracyUsd
).
toFormat
()
:
usdBnDp
.
toFormat
();
}
else
{
usdResult
=
usdBn
.
toFormat
();
}
usdContent
=
(
<
Text
as=
"span"
variant=
"secondary"
whiteSpace=
"pre"
fontWeight=
{
400
}
>
($
{
usdResult
}
)
</
Text
>
);
...
...
@@ -32,7 +39,7 @@ const CurrencyValue = ({ value, currency = '', unit, exchangeRate, className, ac
return
(
<
Box
as=
"span"
className=
{
className
}
>
<
Text
as=
"span
"
>
<
Text
display=
"inline-block
"
>
{
valueResult
}{
currency
?
` ${ currency }`
:
''
}
</
Text
>
{
usdContent
}
...
...
ui/txs/TxAdditionalInfo.tsx
View file @
5101e054
...
...
@@ -57,19 +57,19 @@ const TxAdditionalInfo = ({ tx }: { tx: Transaction }) => {
{
tx
.
base_fee_per_gas
!==
null
&&
(
<
Box
>
<
Text
as=
"span"
fontWeight=
"500"
>
Base:
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValueWithUnit
(
tx
.
base_fee_per_gas
,
'
gwei
'
).
toF
ixed
()
}
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValueWithUnit
(
tx
.
base_fee_per_gas
,
'
gwei
'
).
toF
ormat
()
}
</
Text
>
</
Box
>
)
}
{
tx
.
max_fee_per_gas
!==
null
&&
(
<
Box
>
<
Text
as=
"span"
fontWeight=
"500"
>
Max:
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValueWithUnit
(
tx
.
max_fee_per_gas
,
'
gwei
'
).
toF
ixed
()
}
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValueWithUnit
(
tx
.
max_fee_per_gas
,
'
gwei
'
).
toF
ormat
()
}
</
Text
>
</
Box
>
)
}
{
tx
.
max_priority_fee_per_gas
!==
null
&&
(
<
Box
>
<
Text
as=
"span"
fontWeight=
"500"
>
Max priority:
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValueWithUnit
(
tx
.
max_priority_fee_per_gas
,
'
gwei
'
).
toF
ixed
()
}
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValueWithUnit
(
tx
.
max_priority_fee_per_gas
,
'
gwei
'
).
toF
ormat
()
}
</
Text
>
</
Box
>
)
}
</
Box
>
...
...
ui/txs/TxsListItem.tsx
View file @
5101e054
...
...
@@ -113,11 +113,11 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
</
Flex
>
<
Box
mt=
{
2
}
>
<
Text
as=
"span"
>
Value
{
appConfig
.
network
.
currency
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
parseFloat
(
getValueWithUnit
(
tx
.
value
).
toFixed
()
)
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
getValueWithUnit
(
tx
.
value
).
toFormat
(
)
}
</
Text
>
</
Box
>
<
Box
mt=
{
2
}
mb=
{
3
}
>
<
Text
as=
"span"
>
Fee
{
appConfig
.
network
.
currency
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
parseFloat
(
getValueWithUnit
(
tx
.
fee
.
value
).
toFixed
()
)
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
getValueWithUnit
(
tx
.
fee
.
value
).
toFormat
(
)
}
</
Text
>
</
Box
>
</
Box
>
<
Modal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
size=
"full"
>
...
...
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