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
83fda2c9
Commit
83fda2c9
authored
Mar 08, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle blobs with no data
parent
760c69e2
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
44 deletions
+87
-44
blobs.ts
mocks/blobs/blobs.ts
+11
-1
blobs.ts
types/api/blobs.ts
+3
-3
BlobInfo.tsx
ui/blob/BlobInfo.tsx
+50
-36
Blob.pw.tsx
ui/pages/Blob.pw.tsx
+19
-0
Blob.pw.tsx_default_without-data-1.png
...es/__screenshots__/Blob.pw.tsx_default_without-data-1.png
+0
-0
TxBlobs.pw.tsx_default_base-view-mobile-1.png
...reenshots__/TxBlobs.pw.tsx_default_base-view-mobile-1.png
+0
-0
TxBlobs.pw.tsx_mobile_base-view-mobile-1.png
...creenshots__/TxBlobs.pw.tsx_mobile_base-view-mobile-1.png
+0
-0
TxBlobListItem.tsx
ui/tx/blobs/TxBlobListItem.tsx
+2
-2
TxBlobsTableItem.tsx
ui/tx/blobs/TxBlobsTableItem.tsx
+2
-2
No files found.
mocks/blobs/blobs.ts
View file @
83fda2c9
...
@@ -20,7 +20,17 @@ export const base2: Blob = {
...
@@ -20,7 +20,17 @@ export const base2: Blob = {
],
],
};
};
export
const
withoutData
:
Blob
=
{
blob_data
:
null
,
hash
:
'
0x0197fdb17195c176b23160f335daabd4b6a231aaaadd73ec567877c66a3affd3
'
,
kzg_commitment
:
null
,
kzg_proof
:
null
,
transaction_hashes
:
[
{
block_consensus
:
true
,
transaction_hash
:
'
0x22d597ebcf3e8d60096dd0363bc2f0f5e2df27ba1dacd696c51aa7c9409f3193
'
},
],
};
export
const
txBlobs
:
TxBlobs
=
{
export
const
txBlobs
:
TxBlobs
=
{
items
:
[
base1
,
base2
],
items
:
[
base1
,
base2
,
withoutData
],
next_page_params
:
null
,
next_page_params
:
null
,
};
};
types/api/blobs.ts
View file @
83fda2c9
export
interface
TxBlob
{
export
interface
TxBlob
{
hash
:
string
;
hash
:
string
;
blob_data
:
string
;
blob_data
:
string
|
null
;
kzg_commitment
:
string
;
kzg_commitment
:
string
|
null
;
kzg_proof
:
string
;
kzg_proof
:
string
|
null
;
}
}
export
type
TxBlobs
=
{
export
type
TxBlobs
=
{
...
...
ui/blob/BlobInfo.tsx
View file @
83fda2c9
import
{
Grid
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
{
Alert
,
Grid
,
GridItem
,
Skeleton
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
Blob
}
from
'
types/api/blobs
'
;
import
type
{
Blob
}
from
'
types/api/blobs
'
;
...
@@ -17,14 +17,20 @@ interface Props {
...
@@ -17,14 +17,20 @@ interface Props {
}
}
const
BlobInfo
=
({
data
,
isLoading
}:
Props
)
=>
{
const
BlobInfo
=
({
data
,
isLoading
}:
Props
)
=>
{
const
size
=
data
.
blob_data
.
replace
(
'
0x
'
,
''
).
length
/
2
;
return
(
return
(
<
Grid
<
Grid
columnGap=
{
8
}
columnGap=
{
8
}
rowGap=
{
3
}
rowGap=
{
3
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
216px minmax(728px, auto)
'
}
}
templateColumns=
{
{
base
:
'
minmax(0, 1fr)
'
,
lg
:
'
216px minmax(728px, auto)
'
}
}
>
>
{
!
data
.
blob_data
&&
(
<
GridItem
colSpan=
{
{
base
:
undefined
,
lg
:
2
}
}
mb=
{
3
}
>
<
Skeleton
isLoaded=
{
!
isLoading
}
>
<
Alert
status=
"warning"
>
This blob is not yet indexed
</
Alert
>
</
Skeleton
>
</
GridItem
>
)
}
{
data
.
kzg_proof
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Proof"
title=
"Proof"
hint=
"Zero knowledge proof. Allows for quick verification of commitment"
hint=
"Zero knowledge proof. Allows for quick verification of commitment"
...
@@ -35,6 +41,8 @@ const BlobInfo = ({ data, isLoading }: Props) => {
...
@@ -35,6 +41,8 @@ const BlobInfo = ({ data, isLoading }: Props) => {
<
CopyToClipboard
text=
{
data
.
kzg_proof
}
isLoading=
{
isLoading
}
/>
<
CopyToClipboard
text=
{
data
.
kzg_proof
}
isLoading=
{
isLoading
}
/>
</
Skeleton
>
</
Skeleton
>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
)
}
{
data
.
kzg_commitment
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Commitment"
title=
"Commitment"
hint=
"Commitment to the data in the blob"
hint=
"Commitment to the data in the blob"
...
@@ -45,17 +53,20 @@ const BlobInfo = ({ data, isLoading }: Props) => {
...
@@ -45,17 +53,20 @@ const BlobInfo = ({ data, isLoading }: Props) => {
<
CopyToClipboard
text=
{
data
.
kzg_commitment
}
isLoading=
{
isLoading
}
/>
<
CopyToClipboard
text=
{
data
.
kzg_commitment
}
isLoading=
{
isLoading
}
/>
</
Skeleton
>
</
Skeleton
>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
)
}
{
data
.
blob_data
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Size, bytes"
title=
"Size, bytes"
hint=
"Blob size in bytes"
hint=
"Blob size in bytes"
isLoading=
{
isLoading
}
isLoading=
{
isLoading
}
>
>
<
Skeleton
isLoaded=
{
!
isLoading
}
overflow=
"hidden"
whiteSpace=
"pre-wrap"
wordBreak=
"break-all"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
overflow=
"hidden"
whiteSpace=
"pre-wrap"
wordBreak=
"break-all"
>
{
size
.
toLocaleString
()
}
{
(
data
.
blob_data
.
replace
(
'
0x
'
,
''
).
length
/
2
)
.
toLocaleString
()
}
</
Skeleton
>
</
Skeleton
>
</
DetailsInfoItem
>
</
DetailsInfoItem
>
)
}
<
DetailsInfoItemDivider
/>
{
data
.
blob_data
&&
<
DetailsInfoItemDivider
/>
}
{
data
.
transaction_hashes
[
0
]
&&
(
{
data
.
transaction_hashes
[
0
]
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
...
@@ -68,9 +79,12 @@ const BlobInfo = ({ data, isLoading }: Props) => {
...
@@ -68,9 +79,12 @@ const BlobInfo = ({ data, isLoading }: Props) => {
)
}
)
}
<
DetailsSponsoredItem
isLoading=
{
isLoading
}
/>
<
DetailsSponsoredItem
isLoading=
{
isLoading
}
/>
{
data
.
blob_data
&&
(
<>
<
DetailsInfoItemDivider
/>
<
DetailsInfoItemDivider
/>
<
BlobData
data=
{
data
.
blob_data
}
hash=
{
data
.
hash
}
isLoading=
{
isLoading
}
/>
<
BlobData
data=
{
data
.
blob_data
}
hash=
{
data
.
hash
}
isLoading=
{
isLoading
}
/>
</>
)
}
</
Grid
>
</
Grid
>
);
);
};
};
...
...
ui/pages/Blob.pw.tsx
View file @
83fda2c9
...
@@ -47,3 +47,22 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
...
@@ -47,3 +47,22 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
maskColor
:
configs
.
maskColor
,
maskColor
:
configs
.
maskColor
,
});
});
});
});
test
(
'
without data
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
BLOB_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
blobsMock
.
withoutData
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
Blob
/>
</
TestApp
>,
{
hooksConfig
},
);
await
expect
(
component
).
toHaveScreenshot
({
mask
:
[
page
.
locator
(
configs
.
adsBannerSelector
)
],
maskColor
:
configs
.
maskColor
,
});
});
ui/pages/__screenshots__/Blob.pw.tsx_default_without-data-1.png
0 → 100644
View file @
83fda2c9
31.8 KB
ui/tx/__screenshots__/TxBlobs.pw.tsx_default_base-view-mobile-1.png
View replaced file @
760c69e2
View file @
83fda2c9
17.8 KB
|
W:
|
H:
23.2 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/tx/__screenshots__/TxBlobs.pw.tsx_mobile_base-view-mobile-1.png
View replaced file @
760c69e2
View file @
83fda2c9
18 KB
|
W:
|
H:
25.5 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/tx/blobs/TxBlobListItem.tsx
View file @
83fda2c9
...
@@ -13,7 +13,7 @@ interface Props {
...
@@ -13,7 +13,7 @@ interface Props {
}
}
const
TxBlobListItem
=
({
data
,
isLoading
}:
Props
)
=>
{
const
TxBlobListItem
=
({
data
,
isLoading
}:
Props
)
=>
{
const
size
=
data
.
blob_data
.
replace
(
'
0x
'
,
''
).
length
/
2
;
const
size
=
data
.
blob_data
?
data
.
blob_data
.
replace
(
'
0x
'
,
''
).
length
/
2
:
'
-
'
;
return
(
return
(
<
ListItemMobileGrid
.
Container
>
<
ListItemMobileGrid
.
Container
>
...
@@ -24,7 +24,7 @@ const TxBlobListItem = ({ data, isLoading }: Props) => {
...
@@ -24,7 +24,7 @@ const TxBlobListItem = ({ data, isLoading }: Props) => {
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Data type
</
ListItemMobileGrid
.
Label
>
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Data type
</
ListItemMobileGrid
.
Label
>
<
ListItemMobileGrid
.
Value
>
<
ListItemMobileGrid
.
Value
>
<
BlobDataType
isLoading=
{
isLoading
}
data=
{
data
.
blob_data
}
/>
{
data
.
blob_data
?
<
BlobDataType
isLoading=
{
isLoading
}
data=
{
data
.
blob_data
}
/>
:
'
-
'
}
</
ListItemMobileGrid
.
Value
>
</
ListItemMobileGrid
.
Value
>
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Size, bytes
</
ListItemMobileGrid
.
Label
>
<
ListItemMobileGrid
.
Label
isLoading=
{
isLoading
}
>
Size, bytes
</
ListItemMobileGrid
.
Label
>
...
...
ui/tx/blobs/TxBlobsTableItem.tsx
View file @
83fda2c9
...
@@ -12,7 +12,7 @@ interface Props {
...
@@ -12,7 +12,7 @@ interface Props {
}
}
const
TxBlobsTableItem
=
({
data
,
isLoading
}:
Props
)
=>
{
const
TxBlobsTableItem
=
({
data
,
isLoading
}:
Props
)
=>
{
const
size
=
data
.
blob_data
.
replace
(
'
0x
'
,
''
).
length
/
2
;
const
size
=
data
.
blob_data
?
data
.
blob_data
.
replace
(
'
0x
'
,
''
).
length
/
2
:
'
-
'
;
return
(
return
(
<
Tr
alignItems=
"top"
>
<
Tr
alignItems=
"top"
>
...
@@ -20,7 +20,7 @@ const TxBlobsTableItem = ({ data, isLoading }: Props) => {
...
@@ -20,7 +20,7 @@ const TxBlobsTableItem = ({ data, isLoading }: Props) => {
<
BlobEntity
hash=
{
data
.
hash
}
noIcon
isLoading=
{
isLoading
}
/>
<
BlobEntity
hash=
{
data
.
hash
}
noIcon
isLoading=
{
isLoading
}
/>
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
<
BlobDataType
isLoading=
{
isLoading
}
data=
{
data
.
blob_data
}
/>
{
data
.
blob_data
?
<
BlobDataType
isLoading=
{
isLoading
}
data=
{
data
.
blob_data
}
/>
:
'
-
'
}
</
Td
>
</
Td
>
<
Td
verticalAlign=
"middle"
>
<
Td
verticalAlign=
"middle"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
>
<
Skeleton
isLoaded=
{
!
isLoading
}
display=
"inline-block"
>
...
...
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