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
a7e81c1e
Unverified
Commit
a7e81c1e
authored
Aug 07, 2023
by
tom goriunov
Committed by
GitHub
Aug 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom block fields for Rootstock (#1072)
parent
4302dcd1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
107 additions
and
3 deletions
+107
-3
block.ts
mocks/blocks/block.ts
+10
-0
block.ts
types/api/block.ts
+6
-0
BlockDetails.pw.tsx
ui/block/BlockDetails.pw.tsx
+18
-0
BlockDetails.tsx
ui/block/BlockDetails.tsx
+71
-1
BlockDetails.pw.tsx_dark-color-mode_regular-block-mobile-dark-mode-1.png
....tsx_dark-color-mode_regular-block-mobile-dark-mode-1.png
+0
-0
BlockDetails.pw.tsx_default_genesis-block-1.png
...enshots__/BlockDetails.pw.tsx_default_genesis-block-1.png
+0
-0
BlockDetails.pw.tsx_default_regular-block-mobile-dark-mode-1.png
...tails.pw.tsx_default_regular-block-mobile-dark-mode-1.png
+0
-0
BlockDetails.pw.tsx_default_rootstock-custom-fields-1.png
...BlockDetails.pw.tsx_default_rootstock-custom-fields-1.png
+0
-0
DetailsInfoItem.tsx
ui/shared/DetailsInfoItem.tsx
+1
-1
HashStringShortenDynamic.tsx
ui/shared/HashStringShortenDynamic.tsx
+1
-1
No files found.
mocks/blocks/block.ts
View file @
a7e81c1e
/* eslint-disable max-len */
import
type
{
Block
,
BlocksResponse
}
from
'
types/api/block
'
;
import
type
{
Block
,
BlocksResponse
}
from
'
types/api/block
'
;
export
const
base
:
Block
=
{
export
const
base
:
Block
=
{
...
@@ -122,6 +123,15 @@ export const base2: Block = {
...
@@ -122,6 +123,15 @@ export const base2: Block = {
],
],
};
};
export
const
rootstock
:
Block
=
{
...
base
,
bitcoin_merged_mining_coinbase_transaction
:
'
0x0000000000000080a1219cea298d65d545b56abafe7c5421edfaf084cf9e374bb23ea985ebd86b206088ac0000000000000000266a24aa21a9edb2ac3022ad2a5327449f029b6aa3d2e55605061b5d8171b30abf5b330d1959c900000000000000002a6a52534b424c4f434b3a481d071e57c6c47cb8eb716295a7079b15859962abf35e32f107b21f003f0bb900000000
'
,
bitcoin_merged_mining_header
:
'
0x000000204a7e42cadf8b5b0a094755c5a13298e596d61f361c6d31171a00000000000000970e51977cd6f82bab9ed62e678c8d8ca664af9d5c3b5cea39d5d4337c7abedae334c9649fc63e1982a84aaa
'
,
bitcoin_merged_mining_merkle_proof
:
'
0x09f386e5e6feb20706a1b5d0817eae96f0ebb0d713eeefe6d5625afc6fd87fcdfe8cc9118bb49e32db87f8e928dcb13dd327b526ced76fb9de0115a5dca8d2a9657c929360ad07418fc7e1a3120da27e0002470d0c98c9b8b5b2835e64e379421d2469204533307bf0c5a087d93fd1dfb3aaea3ee83099928860f6cca891cf59d73c4e3c6053ea4b385dce39067e87c28805ddd89c4ff10500401bec7c248f749ad6f0933e6ad270e447d01711aca1cc26d7989ee59e1431fd2fd5d058edca6d
'
,
hash_for_merged_mining
:
'
0x481d071e57c6c47cb8eb716295a7079b15859962abf35e32f107b21f003f0bb9
'
,
minimum_gas_price
:
'
59240000
'
,
};
export
const
baseListResponse
:
BlocksResponse
=
{
export
const
baseListResponse
:
BlocksResponse
=
{
items
:
[
items
:
[
base
,
base
,
...
...
types/api/block.ts
View file @
a7e81c1e
...
@@ -30,6 +30,12 @@ export interface Block {
...
@@ -30,6 +30,12 @@ export interface Block {
tx_fees
:
string
|
null
;
tx_fees
:
string
|
null
;
uncles_hashes
:
Array
<
string
>
;
uncles_hashes
:
Array
<
string
>
;
withdrawals_count
?:
number
;
withdrawals_count
?:
number
;
// ROOTSTOCK FIELDS
bitcoin_merged_mining_coinbase_transaction
?:
string
|
null
;
bitcoin_merged_mining_header
?:
string
|
null
;
bitcoin_merged_mining_merkle_proof
?:
string
|
null
;
hash_for_merged_mining
?:
string
|
null
;
minimum_gas_price
?:
string
|
null
;
}
}
export
interface
BlocksResponse
{
export
interface
BlocksResponse
{
...
...
ui/block/BlockDetails.pw.tsx
View file @
a7e81c1e
...
@@ -51,3 +51,21 @@ test('genesis block', async({ mount, page }) => {
...
@@ -51,3 +51,21 @@ test('genesis block', async({ mount, page }) => {
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
rootstock custom fields
'
,
async
({
mount
,
page
})
=>
{
const
query
=
{
data
:
blockMock
.
rootstock
,
isLoading
:
false
,
}
as
UseQueryResult
<
Block
,
ResourceError
>
;
const
component
=
await
mount
(
<
TestApp
>
<
BlockDetails
query=
{
query
}
/>
</
TestApp
>,
{
hooksConfig
},
);
await
page
.
getByText
(
'
View details
'
).
click
();
await
expect
(
component
).
toHaveScreenshot
();
});
ui/block/BlockDetails.tsx
View file @
a7e81c1e
...
@@ -28,6 +28,7 @@ import GasUsedToTargetRatio from 'ui/shared/GasUsedToTargetRatio';
...
@@ -28,6 +28,7 @@ import GasUsedToTargetRatio from 'ui/shared/GasUsedToTargetRatio';
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
import
HashStringShortenDynamic
from
'
ui/shared/HashStringShortenDynamic
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
LinkInternal
from
'
ui/shared/LinkInternal
'
;
import
PrevNext
from
'
ui/shared/PrevNext
'
;
import
PrevNext
from
'
ui/shared/PrevNext
'
;
import
RawDataSnippet
from
'
ui/shared/RawDataSnippet
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
TextSeparator
from
'
ui/shared/TextSeparator
'
;
import
Utilization
from
'
ui/shared/Utilization/Utilization
'
;
import
Utilization
from
'
ui/shared/Utilization/Utilization
'
;
...
@@ -127,7 +128,12 @@ const BlockDetails = ({ query }: Props) => {
...
@@ -127,7 +128,12 @@ const BlockDetails = ({ query }: Props) => {
})();
})();
return
(
return
(
<
Grid
columnGap=
{
8
}
rowGap=
{
{
base
:
3
,
lg
:
3
}
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
auto minmax(0, 1fr)
'
}
}
overflow=
"hidden"
>
<
Grid
columnGap=
{
8
}
rowGap=
{
{
base
:
3
,
lg
:
3
}
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
minmax(min-content, 200px) minmax(0, 1fr)
'
}
}
overflow=
"hidden"
>
<
DetailsInfoItem
<
DetailsInfoItem
title=
{
`${ data.type === 'reorg' ? 'Reorg' : 'Block' } height`
}
title=
{
`${ data.type === 'reorg' ? 'Reorg' : 'Block' } height`
}
hint=
"The block height of a particular block is defined as the number of blocks preceding it in the blockchain"
hint=
"The block height of a particular block is defined as the number of blocks preceding it in the blockchain"
...
@@ -266,6 +272,17 @@ const BlockDetails = ({ query }: Props) => {
...
@@ -266,6 +272,17 @@ const BlockDetails = ({ query }: Props) => {
{
BigNumber
(
data
.
gas_limit
).
toFormat
()
}
{
BigNumber
(
data
.
gas_limit
).
toFormat
()
}
</
Skeleton
>
</
Skeleton
>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
{
data
.
minimum_gas_price
&&
(
<
DetailsInfoItem
title=
"Minimum gas price"
hint=
"Minimum gas price"
isLoading=
{
isPlaceholderData
}
>
<
Skeleton
isLoaded=
{
!
isPlaceholderData
}
>
{
BigNumber
(
data
.
minimum_gas_price
).
toFormat
()
}
</
Skeleton
>
</
DetailsInfoItem
>
)
}
{
data
.
base_fee_per_gas
&&
(
{
data
.
base_fee_per_gas
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Base fee per gas"
title=
"Base fee per gas"
...
@@ -350,6 +367,59 @@ const BlockDetails = ({ query }: Props) => {
...
@@ -350,6 +367,59 @@ const BlockDetails = ({ query }: Props) => {
<>
<>
<
GridItem
colSpan=
{
{
base
:
undefined
,
lg
:
2
}
}
mt=
{
{
base
:
1
,
lg
:
4
}
}
/>
<
GridItem
colSpan=
{
{
base
:
undefined
,
lg
:
2
}
}
mt=
{
{
base
:
1
,
lg
:
4
}
}
/>
{
data
.
bitcoin_merged_mining_header
&&
(
<
DetailsInfoItem
title=
"Bitcoin merged mining header"
hint=
"Bitcoin merged mining header"
flexWrap=
"nowrap"
alignSelf=
"flex-start"
>
<
Box
whiteSpace=
"nowrap"
overflow=
"hidden"
>
<
HashStringShortenDynamic
hash=
{
data
.
bitcoin_merged_mining_header
}
/>
</
Box
>
<
CopyToClipboard
text=
{
data
.
bitcoin_merged_mining_header
}
/>
</
DetailsInfoItem
>
)
}
{
data
.
bitcoin_merged_mining_coinbase_transaction
&&
(
<
DetailsInfoItem
title=
"Bitcoin merged mining coinbase transaction"
hint=
"Bitcoin merged mining coinbase transaction"
>
<
RawDataSnippet
data=
{
data
.
bitcoin_merged_mining_coinbase_transaction
}
isLoading=
{
isPlaceholderData
}
showCopy=
{
false
}
textareaMaxHeight=
"100px"
/>
</
DetailsInfoItem
>
)
}
{
data
.
bitcoin_merged_mining_merkle_proof
&&
(
<
DetailsInfoItem
title=
"Bitcoin merged mining Merkle proof"
hint=
"Bitcoin merged mining Merkle proof"
>
<
RawDataSnippet
data=
{
data
.
bitcoin_merged_mining_merkle_proof
}
isLoading=
{
isPlaceholderData
}
showCopy=
{
false
}
textareaMaxHeight=
"100px"
/>
</
DetailsInfoItem
>
)
}
{
data
.
hash_for_merged_mining
&&
(
<
DetailsInfoItem
title=
"Hash for merged mining"
hint=
"Hash for merged mining"
flexWrap=
"nowrap"
alignSelf=
"flex-start"
>
<
Box
whiteSpace=
"nowrap"
overflow=
"hidden"
>
<
HashStringShortenDynamic
hash=
{
data
.
hash_for_merged_mining
}
/>
</
Box
>
<
CopyToClipboard
text=
{
data
.
hash_for_merged_mining
}
/>
</
DetailsInfoItem
>
)
}
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Difficulty"
title=
"Difficulty"
hint=
{
`Block difficulty for ${ validatorTitle }, used to calibrate block generation time`
}
hint=
{
`Block difficulty for ${ validatorTitle }, used to calibrate block generation time`
}
...
...
ui/block/__screenshots__/BlockDetails.pw.tsx_dark-color-mode_regular-block-mobile-dark-mode-1.png
View replaced file @
4302dcd1
View file @
a7e81c1e
104 KB
|
W:
|
H:
104 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/block/__screenshots__/BlockDetails.pw.tsx_default_genesis-block-1.png
View replaced file @
4302dcd1
View file @
a7e81c1e
52.7 KB
|
W:
|
H:
52.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/block/__screenshots__/BlockDetails.pw.tsx_default_regular-block-mobile-dark-mode-1.png
View replaced file @
4302dcd1
View file @
a7e81c1e
103 KB
|
W:
|
H:
103 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/block/__screenshots__/BlockDetails.pw.tsx_default_rootstock-custom-fields-1.png
0 → 100644
View file @
a7e81c1e
171 KB
ui/shared/DetailsInfoItem.tsx
View file @
a7e81c1e
...
@@ -15,7 +15,7 @@ interface Props extends Omit<HTMLChakraProps<'div'>, 'title'> {
...
@@ -15,7 +15,7 @@ interface Props extends Omit<HTMLChakraProps<'div'>, 'title'> {
const
DetailsInfoItem
=
({
title
,
hint
,
note
,
children
,
id
,
isLoading
,
...
styles
}:
Props
)
=>
{
const
DetailsInfoItem
=
({
title
,
hint
,
note
,
children
,
id
,
isLoading
,
...
styles
}:
Props
)
=>
{
return
(
return
(
<>
<>
<
GridItem
py=
{
{
base
:
1
,
lg
:
2
}
}
id=
{
id
}
lineHeight=
{
5
}
{
...
styles
}
whiteSpace=
"nowrap"
_notFirst=
{
{
mt
:
{
base
:
3
,
lg
:
0
}
}
}
>
<
GridItem
py=
{
{
base
:
1
,
lg
:
2
}
}
id=
{
id
}
lineHeight=
{
5
}
{
...
styles
}
_notFirst=
{
{
mt
:
{
base
:
3
,
lg
:
0
}
}
}
>
<
Flex
columnGap=
{
2
}
alignItems=
"flex-start"
>
<
Flex
columnGap=
{
2
}
alignItems=
"flex-start"
>
<
Hint
label=
{
hint
}
isLoading=
{
isLoading
}
/>
<
Hint
label=
{
hint
}
isLoading=
{
isLoading
}
/>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
...
...
ui/shared/HashStringShortenDynamic.tsx
View file @
a7e81c1e
...
@@ -93,7 +93,7 @@ const HashStringShortenDynamic = ({ hash, fontWeight = '400', isTooltipDisabled,
...
@@ -93,7 +93,7 @@ const HashStringShortenDynamic = ({ hash, fontWeight = '400', isTooltipDisabled,
if
(
isTruncated
)
{
if
(
isTruncated
)
{
return
(
return
(
<
Tooltip
label=
{
hash
}
isDisabled=
{
isTooltipDisabled
}
>
{
content
}
</
Tooltip
>
<
Tooltip
label=
{
hash
}
isDisabled=
{
isTooltipDisabled
}
maxW=
{
{
base
:
'
100vw
'
,
lg
:
'
400px
'
}
}
>
{
content
}
</
Tooltip
>
);
);
}
}
...
...
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