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
ae531917
Commit
ae531917
authored
Oct 20, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update block rewards
parent
04fd0313
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
21 deletions
+27
-21
reward.ts
types/api/reward.ts
+1
-1
BlockDetails.tsx
ui/block/BlockDetails.tsx
+12
-11
BlocksListItem.tsx
ui/blocks/BlocksListItem.tsx
+8
-6
BlocksTableItem.tsx
ui/blocks/BlocksTableItem.tsx
+6
-3
No files found.
types/api/reward.ts
View file @
ae531917
export
interface
Reward
{
export
interface
Reward
{
reward
:
number
;
reward
:
string
;
type
:
'
Miner Reward
'
|
'
Validator Reward
'
|
'
Emission Reward
'
|
'
Chore Reward
'
|
'
Uncle Reward
'
;
type
:
'
Miner Reward
'
|
'
Validator Reward
'
|
'
Emission Reward
'
|
'
Chore Reward
'
|
'
Uncle Reward
'
;
}
}
ui/block/BlockDetails.tsx
View file @
ae531917
...
@@ -153,6 +153,18 @@ const BlockDetails = () => {
...
@@ -153,6 +153,18 @@ const BlockDetails = () => {
)
}
)
}
</
DetailsInfoItem
>
</
DetailsInfoItem
>
)
}
)
}
{
data
.
rewards
?.
filter
(({
type
})
=>
type
!==
'
Validator Reward
'
&&
type
!==
'
Miner Reward
'
)
.
map
(({
type
,
reward
})
=>
(
<
DetailsInfoItem
key=
{
type
}
title=
{
type
}
hint=
"Amount of distributed reward. Miners receive a static block reward + Tx fees + uncle fees."
>
{
BigNumber
(
reward
).
dividedBy
(
WEI
).
toFixed
()
}
{
appConfig
.
network
.
currency
}
</
DetailsInfoItem
>
))
}
{
sectionGap
}
{
sectionGap
}
...
@@ -293,17 +305,6 @@ const BlockDetails = () => {
...
@@ -293,17 +305,6 @@ const BlockDetails = () => {
>
>
{
data
.
nonce
}
{
data
.
nonce
}
</
DetailsInfoItem
>
</
DetailsInfoItem
>
{
data
.
rewards
?.
filter
(({
type
})
=>
type
!==
'
Validator Reward
'
&&
type
!==
'
Miner Reward
'
)
.
map
(({
type
,
reward
})
=>
(
<
DetailsInfoItem
key=
{
type
}
title=
{
type
}
hint=
"Amount of distributed reward. Miners receive a static block reward + Tx fees + uncle fees."
>
{
BigNumber
(
reward
).
dividedBy
(
WEI
).
toFixed
()
}
{
appConfig
.
network
.
currency
}
</
DetailsInfoItem
>
))
}
</>
</>
)
}
)
}
</
Grid
>
</
Grid
>
...
...
ui/blocks/BlocksListItem.tsx
View file @
ae531917
import
{
Flex
,
Link
,
Spinner
,
Text
,
Box
,
Icon
,
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Link
,
Spinner
,
Text
,
Box
,
Icon
}
from
'
@chakra-ui/react
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
BigNumber
from
'
bignumber.js
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -6,8 +6,7 @@ import type { Block } from 'types/api/block';
...
@@ -6,8 +6,7 @@ import type { Block } from 'types/api/block';
import
appConfig
from
'
configs/app/config
'
;
import
appConfig
from
'
configs/app/config
'
;
import
flameIcon
from
'
icons/flame.svg
'
;
import
flameIcon
from
'
icons/flame.svg
'
;
import
getBlockReward
from
'
lib/block/getBlockReward
'
;
import
{
WEI
,
ZERO
}
from
'
lib/consts
'
;
import
{
WEI
}
from
'
lib/consts
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
link
from
'
lib/link/link
'
;
import
link
from
'
lib/link/link
'
;
import
AccountListItemMobile
from
'
ui/shared/AccountListItemMobile
'
;
import
AccountListItemMobile
from
'
ui/shared/AccountListItemMobile
'
;
...
@@ -21,14 +20,17 @@ interface Props {
...
@@ -21,14 +20,17 @@ interface Props {
}
}
const
BlocksListItem
=
({
data
,
isPending
}:
Props
)
=>
{
const
BlocksListItem
=
({
data
,
isPending
}:
Props
)
=>
{
const
spinnerEmptyColor
=
useColorModeValue
(
'
blackAlpha.200
'
,
'
whiteAlpha.200
'
);
const
totalReward
=
data
.
rewards
const
{
totalReward
,
burntFees
,
txFees
}
=
getBlockReward
(
data
);
?.
map
(({
reward
})
=>
BigNumber
(
reward
))
.
reduce
((
result
,
item
)
=>
result
.
plus
(
item
),
ZERO
)
||
ZERO
;
const
burntFees
=
BigNumber
(
data
.
burnt_fees
||
0
);
const
txFees
=
BigNumber
(
data
.
tx_fees
||
0
);
return
(
return
(
<
AccountListItemMobile
rowGap=
{
3
}
>
<
AccountListItemMobile
rowGap=
{
3
}
>
<
Flex
justifyContent=
"space-between"
w=
"100%"
>
<
Flex
justifyContent=
"space-between"
w=
"100%"
>
<
Flex
columnGap=
{
2
}
alignItems=
"center"
>
<
Flex
columnGap=
{
2
}
alignItems=
"center"
>
{
isPending
&&
<
Spinner
size=
"sm"
color=
"blue.500"
emptyColor=
{
spinnerEmptyColor
}
/>
}
{
isPending
&&
<
Spinner
size=
"sm"
/>
}
<
Link
<
Link
fontWeight=
{
600
}
fontWeight=
{
600
}
href=
{
link
(
'
block
'
,
{
id
:
String
(
data
.
height
)
})
}
href=
{
link
(
'
block
'
,
{
id
:
String
(
data
.
height
)
})
}
...
...
ui/blocks/BlocksTableItem.tsx
View file @
ae531917
...
@@ -5,8 +5,7 @@ import React from 'react';
...
@@ -5,8 +5,7 @@ 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
{
WEI
,
ZERO
}
from
'
lib/consts
'
;
import
{
WEI
}
from
'
lib/consts
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
dayjs
from
'
lib/date/dayjs
'
;
import
link
from
'
lib/link/link
'
;
import
link
from
'
lib/link/link
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
import
AddressLink
from
'
ui/shared/address/AddressLink
'
;
...
@@ -19,7 +18,11 @@ interface Props {
...
@@ -19,7 +18,11 @@ interface Props {
}
}
const
BlocksTableItem
=
({
data
,
isPending
}:
Props
)
=>
{
const
BlocksTableItem
=
({
data
,
isPending
}:
Props
)
=>
{
const
{
totalReward
,
burntFees
,
txFees
}
=
getBlockReward
(
data
);
const
totalReward
=
data
.
rewards
?.
map
(({
reward
})
=>
BigNumber
(
reward
))
.
reduce
((
result
,
item
)
=>
result
.
plus
(
item
),
ZERO
)
||
ZERO
;
const
burntFees
=
BigNumber
(
data
.
burnt_fees
||
0
);
const
txFees
=
BigNumber
(
data
.
tx_fees
||
0
);
return
(
return
(
<
Tr
>
<
Tr
>
...
...
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