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
591e8583
Commit
591e8583
authored
Oct 13, 2022
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f14fc6b3
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
27 deletions
+12
-27
divideBns.ts
lib/bigint/divideBns.ts
+0
-14
getValueWithUnit.tsx
lib/getValueWithUnit.tsx
+1
-1
CurrencyValue.tsx
ui/shared/CurrencyValue.tsx
+2
-2
TxAdditionalInfo.tsx
ui/txs/TxAdditionalInfo.tsx
+5
-6
TxsListItem.tsx
ui/txs/TxsListItem.tsx
+3
-3
TxsSkeletonDesktop.tsx
ui/txs/TxsSkeletonDesktop.tsx
+1
-1
No files found.
lib/bigint/divideBns.ts
deleted
100644 → 0
View file @
f14fc6b3
import
BigNumber
from
'
bignumber.js
'
;
export
default
function
divideBns
(
dividend
:
string
|
number
,
divisor
:
string
|
number
,
accuracy
?:
number
)
{
const
dividendBn
=
new
BigNumber
(
dividend
);
const
divisorBn
=
new
BigNumber
(
divisor
);
const
result
=
dividendBn
.
dividedBy
(
divisorBn
);
let
numResult
:
string
;
if
(
accuracy
)
{
numResult
=
result
.
toFixed
(
accuracy
);
}
numResult
=
result
.
toFixed
();
return
parseFloat
(
numResult
);
}
lib/
tx/getValue
.tsx
→
lib/
getValueWithUnit
.tsx
View file @
591e8583
...
@@ -2,7 +2,7 @@ import BigNumber from 'bignumber.js';
...
@@ -2,7 +2,7 @@ import BigNumber from 'bignumber.js';
import
{
WEI
,
GWEI
}
from
'
lib/consts
'
;
import
{
WEI
,
GWEI
}
from
'
lib/consts
'
;
export
default
function
getValue
(
value
:
string
|
number
,
unit
:
'
wei
'
|
'
gwei
'
|
'
ether
'
=
'
wei
'
)
{
export
default
function
getValue
WithUnit
(
value
:
string
|
number
,
unit
:
'
wei
'
|
'
gwei
'
|
'
ether
'
=
'
wei
'
)
{
let
unitBn
:
BigNumber
.
Value
;
let
unitBn
:
BigNumber
.
Value
;
switch
(
unit
)
{
switch
(
unit
)
{
case
'
wei
'
:
case
'
wei
'
:
...
...
ui/shared/CurrencyValue.tsx
View file @
591e8583
...
@@ -4,7 +4,7 @@ import React from 'react';
...
@@ -4,7 +4,7 @@ import React from 'react';
import
type
{
Unit
}
from
'
types/unit
'
;
import
type
{
Unit
}
from
'
types/unit
'
;
import
getValue
from
'
lib/tx/getValue
'
;
import
getValue
WithUnit
from
'
lib/getValueWithUnit
'
;
interface
Props
{
interface
Props
{
value
:
string
;
value
:
string
;
...
@@ -17,7 +17,7 @@ interface Props {
...
@@ -17,7 +17,7 @@ interface Props {
}
}
const
CurrencyValue
=
({
value
,
currency
=
''
,
unit
,
exchangeRate
,
className
,
accuracy
,
accuracyUsd
}:
Props
)
=>
{
const
CurrencyValue
=
({
value
,
currency
=
''
,
unit
,
exchangeRate
,
className
,
accuracy
,
accuracyUsd
}:
Props
)
=>
{
const
valueCurr
=
getValue
(
value
,
unit
);
const
valueCurr
=
getValue
WithUnit
(
value
,
unit
);
const
valueResult
=
parseFloat
(
accuracy
?
valueCurr
.
toFixed
(
accuracy
)
:
valueCurr
.
toFixed
());
const
valueResult
=
parseFloat
(
accuracy
?
valueCurr
.
toFixed
(
accuracy
)
:
valueCurr
.
toFixed
());
let
usdContent
;
let
usdContent
;
...
...
ui/txs/TxAdditionalInfo.tsx
View file @
591e8583
...
@@ -5,9 +5,8 @@ import React from 'react';
...
@@ -5,9 +5,8 @@ import React from 'react';
import
type
{
Transaction
}
from
'
types/api/transaction
'
;
import
type
{
Transaction
}
from
'
types/api/transaction
'
;
import
divideBns
from
'
lib/bigint/divideBns
'
;
import
getValueWithUnit
from
'
lib/getValueWithUnit
'
;
import
link
from
'
lib/link/link
'
;
import
link
from
'
lib/link/link
'
;
import
getValue
from
'
lib/tx/getValue
'
;
import
CurrencyValue
from
'
ui/shared/CurrencyValue
'
;
import
CurrencyValue
from
'
ui/shared/CurrencyValue
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
Utilization
from
'
ui/shared/Utilization
'
;
import
Utilization
from
'
ui/shared/Utilization
'
;
...
@@ -48,7 +47,7 @@ const TxAdditionalInfo = ({ tx }: { tx: Transaction }) => {
...
@@ -48,7 +47,7 @@ const TxAdditionalInfo = ({ tx }: { tx: Transaction }) => {
<
Text
>
{
BigNumber
(
tx
.
gas_used
).
toFormat
()
}
</
Text
>
<
Text
>
{
BigNumber
(
tx
.
gas_used
).
toFormat
()
}
</
Text
>
<
TextSeparator
/>
<
TextSeparator
/>
<
Text
>
{
BigNumber
(
tx
.
gas_limit
).
toFormat
()
}
</
Text
>
<
Text
>
{
BigNumber
(
tx
.
gas_limit
).
toFormat
()
}
</
Text
>
<
Utilization
ml=
{
4
}
value=
{
Number
(
divideBns
(
tx
.
gas_used
,
tx
.
gas_limit
,
2
))
}
/>
<
Utilization
ml=
{
4
}
value=
{
Number
(
BigNumber
(
tx
.
gas_used
).
dividedBy
(
BigNumber
(
tx
.
gas_limit
)).
toFixed
(
2
))
}
/>
</
Flex
>
</
Flex
>
</
Box
>
</
Box
>
)
}
)
}
...
@@ -58,19 +57,19 @@ const TxAdditionalInfo = ({ tx }: { tx: Transaction }) => {
...
@@ -58,19 +57,19 @@ const TxAdditionalInfo = ({ tx }: { tx: Transaction }) => {
{
tx
.
base_fee_per_gas
!==
null
&&
(
{
tx
.
base_fee_per_gas
!==
null
&&
(
<
Box
>
<
Box
>
<
Text
as=
"span"
fontWeight=
"500"
>
Base:
</
Text
>
<
Text
as=
"span"
fontWeight=
"500"
>
Base:
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValue
(
tx
.
base_fee_per_gas
,
'
gwei
'
).
toFixed
()
}
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValue
WithUnit
(
tx
.
base_fee_per_gas
,
'
gwei
'
).
toFixed
()
}
</
Text
>
</
Box
>
</
Box
>
)
}
)
}
{
tx
.
max_fee_per_gas
!==
null
&&
(
{
tx
.
max_fee_per_gas
!==
null
&&
(
<
Box
>
<
Box
>
<
Text
as=
"span"
fontWeight=
"500"
>
Max:
</
Text
>
<
Text
as=
"span"
fontWeight=
"500"
>
Max:
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValue
(
tx
.
max_fee_per_gas
,
'
gwei
'
).
toFixed
()
}
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValue
WithUnit
(
tx
.
max_fee_per_gas
,
'
gwei
'
).
toFixed
()
}
</
Text
>
</
Box
>
</
Box
>
)
}
)
}
{
tx
.
max_priority_fee_per_gas
!==
null
&&
(
{
tx
.
max_priority_fee_per_gas
!==
null
&&
(
<
Box
>
<
Box
>
<
Text
as=
"span"
fontWeight=
"500"
>
Max priority:
</
Text
>
<
Text
as=
"span"
fontWeight=
"500"
>
Max priority:
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValue
(
tx
.
max_priority_fee_per_gas
,
'
gwei
'
).
toFixed
()
}
</
Text
>
<
Text
fontWeight=
"600"
as=
"span"
>
{
getValue
WithUnit
(
tx
.
max_priority_fee_per_gas
,
'
gwei
'
).
toFixed
()
}
</
Text
>
</
Box
>
</
Box
>
)
}
)
}
</
Box
>
</
Box
>
...
...
ui/txs/TxsListItem.tsx
View file @
591e8583
...
@@ -18,8 +18,8 @@ import type { Transaction } from 'types/api/transaction';
...
@@ -18,8 +18,8 @@ import type { Transaction } from 'types/api/transaction';
import
rightArrowIcon
from
'
icons/arrows/east.svg
'
;
import
rightArrowIcon
from
'
icons/arrows/east.svg
'
;
import
transactionIcon
from
'
icons/transactions.svg
'
;
import
transactionIcon
from
'
icons/transactions.svg
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
getValueWithUnit
from
'
lib/getValueWithUnit
'
;
import
link
from
'
lib/link/link
'
;
import
link
from
'
lib/link/link
'
;
import
getValue
from
'
lib/tx/getValue
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
Address
from
'
ui/shared/address/Address
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressIcon
from
'
ui/shared/address/AddressIcon
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
...
@@ -113,11 +113,11 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
...
@@ -113,11 +113,11 @@ const TxsListItem = ({ tx }: {tx: Transaction}) => {
</
Flex
>
</
Flex
>
<
Box
mt=
{
2
}
>
<
Box
mt=
{
2
}
>
<
Text
as=
"span"
>
Value
{
appConfig
.
network
.
currency
}
</
Text
>
<
Text
as=
"span"
>
Value
{
appConfig
.
network
.
currency
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
parseFloat
(
getValue
(
tx
.
value
).
toFixed
())
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
parseFloat
(
getValue
WithUnit
(
tx
.
value
).
toFixed
())
}
</
Text
>
</
Box
>
</
Box
>
<
Box
mt=
{
2
}
mb=
{
3
}
>
<
Box
mt=
{
2
}
mb=
{
3
}
>
<
Text
as=
"span"
>
Fee
{
appConfig
.
network
.
currency
}
</
Text
>
<
Text
as=
"span"
>
Fee
{
appConfig
.
network
.
currency
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
parseFloat
(
getValue
(
tx
.
fee
.
value
).
toFixed
())
}
</
Text
>
<
Text
as=
"span"
variant=
"secondary"
>
{
parseFloat
(
getValue
WithUnit
(
tx
.
fee
.
value
).
toFixed
())
}
</
Text
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
<
Modal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
size=
"full"
>
<
Modal
isOpen=
{
isOpen
}
onClose=
{
onClose
}
size=
"full"
>
...
...
ui/txs/TxsSkeletonDesktop.tsx
View file @
591e8583
...
@@ -11,7 +11,7 @@ const TxsInternalsSkeletonDesktop = ({ isPending }: {isPending?: boolean}) => {
...
@@ -11,7 +11,7 @@ const TxsInternalsSkeletonDesktop = ({ isPending }: {isPending?: boolean}) => {
<
Skeleton
w=
"78px"
/>
<
Skeleton
w=
"78px"
/>
<
Skeleton
w=
"360px"
/>
<
Skeleton
w=
"360px"
/>
</
Flex
>
</
Flex
>
<
SkeletonTable
columns=
{
[
'
20%
'
,
'
20%
'
,
'
20%
'
,
'
20%
'
,
'
20
%
'
]
}
/>
<
SkeletonTable
columns=
{
[
'
32px
'
,
'
20%
'
,
'
18%
'
,
'
15%
'
,
'
11%
'
,
'
292px
'
,
'
18%
'
,
'
18
%
'
]
}
/>
</>
</>
);
);
};
};
...
...
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