Skip to content

Commit a3d8c37

Browse files
authored
Merge pull request #44 from codingknite/feat/blobscan-archiver
blobscan archiver
2 parents a620b6e + 0875b42 commit a3d8c37

File tree

7 files changed

+87
-4
lines changed

7 files changed

+87
-4
lines changed

lib/hooks/useBlobScan.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
interface Props {
2+
address: string | undefined;
3+
}
4+
5+
const blobScanNetworks = [
6+
{
7+
address: '0x2BC885e26A3947646FAbb96C68cE82f5937038a7',
8+
},
9+
];
10+
11+
export function useBlobScan({ address }: Props) {
12+
const isBlobScanNetwork = blobScanNetworks.some(
13+
(network) => network.address === address,
14+
);
15+
16+
return isBlobScanNetwork;
17+
}

ui/home/LatestTxsItem.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import type { Transaction } from 'types/api/transaction';
1212

1313
import config from 'configs/app';
1414
import getValueWithUnit from 'lib/getValueWithUnit';
15+
import { useBlobScan } from 'lib/hooks/useBlobScan';
1516
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1617
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1718
import { currencyUnits } from 'lib/units';
1819
import AddressFromTo from 'ui/shared/address/AddressFromTo';
1920
import TxEntity from 'ui/shared/entities/tx/TxEntity';
21+
import BlobScanTag from 'ui/shared/statusTag/BlobScanTag';
2022
import TxStatus from 'ui/shared/statusTag/TxStatus';
2123
import WvmArchiverTag from 'ui/shared/statusTag/WvmArchiverTag';
2224
import TxFeeStability from 'ui/shared/tx/TxFeeStability';
@@ -30,6 +32,7 @@ type Props = {
3032
}
3133

3234
const LatestTxsItem = ({ tx, isLoading }: Props) => {
35+
const isBlobScan = useBlobScan({ address: tx.from.hash });
3336
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
3437
const dataTo = tx.to ? tx.to : tx.created_contract;
3538
const timeAgo = useTimeAgoIncrement(tx.timestamp || '0', true);
@@ -58,6 +61,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
5861
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
5962
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
6063
{ isWvmArchiver && <WvmArchiverTag/> }
64+
{ isBlobScan && <BlobScanTag/> }
6165
</HStack>
6266
<Flex
6367
alignItems="center"

ui/home/LatestTxsItemMobile.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import type { Transaction } from 'types/api/transaction';
1111

1212
import config from 'configs/app';
1313
import getValueWithUnit from 'lib/getValueWithUnit';
14+
import { useBlobScan } from 'lib/hooks/useBlobScan';
1415
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1516
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1617
import { currencyUnits } from 'lib/units';
1718
import AddressFromTo from 'ui/shared/address/AddressFromTo';
1819
import TxEntity from 'ui/shared/entities/tx/TxEntity';
20+
import BlobScanTag from 'ui/shared/statusTag/BlobScanTag';
1921
import TxStatus from 'ui/shared/statusTag/TxStatus';
2022
import WvmArchiverTag from 'ui/shared/statusTag/WvmArchiverTag';
2123
import TxFeeStability from 'ui/shared/tx/TxFeeStability';
@@ -30,6 +32,7 @@ type Props = {
3032

3133
const LatestTxsItem = ({ tx, isLoading }: Props) => {
3234
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
35+
const isBlobScan = useBlobScan({ address: tx.from.hash });
3336
const dataTo = tx.to ? tx.to : tx.created_contract;
3437
const timeAgo = useTimeAgoIncrement(tx.timestamp || '0', true);
3538

@@ -48,6 +51,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
4851
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
4952
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
5053
{ isWvmArchiver && <WvmArchiverTag/> }
54+
{ isBlobScan && <BlobScanTag/> }
5155
</HStack>
5256
<TxAdditionalInfo tx={ tx } isMobile isLoading={ isLoading }/>
5357
</Flex>

ui/shared/statusTag/BlobScanTag.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { TagLabel, Tooltip } from '@chakra-ui/react';
2+
import React from 'react';
3+
4+
import Tag from 'ui/shared/chakra/Tag';
5+
import IconSvg from 'ui/shared/IconSvg';
6+
7+
const BlobScanTag = () => {
8+
return (
9+
<Tooltip>
10+
<Tag
11+
color="#fff"
12+
backgroundColor="#52224D"
13+
display="flex"
14+
padding="2px 5px"
15+
>
16+
<IconSvg name="gear_slim" boxSize={ 2.5 } mr={ 1 } flexShrink={ 0 }/>
17+
<TagLabel display="block">blobscan-archiver</TagLabel>
18+
</Tag>
19+
</Tooltip>
20+
);
21+
};
22+
23+
export default BlobScanTag;

ui/tx/details/TxInfo.tsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { route } from 'nextjs-routes';
2727
import config from 'configs/app';
2828
import { WEI, WEI_IN_GWEI } from 'lib/consts';
2929
import { useArweaveId } from 'lib/hooks/useArweaveId';
30+
import { useBlobScan } from 'lib/hooks/useBlobScan';
3031
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
3132
import getNetworkValidatorTitle from 'lib/networks/getNetworkValidatorTitle';
3233
import getConfirmationDuration from 'lib/tx/getConfirmationDuration';
@@ -46,6 +47,7 @@ import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic';
4647
import IconSvg from 'ui/shared/IconSvg';
4748
import LogDecodedInputData from 'ui/shared/logs/LogDecodedInputData';
4849
import RawInputData from 'ui/shared/RawInputData';
50+
import BlobScanTag from 'ui/shared/statusTag/BlobScanTag';
4951
import TxStatus from 'ui/shared/statusTag/TxStatus';
5052
import WvmArchiverTag from 'ui/shared/statusTag/WvmArchiverTag';
5153
import TextSeparator from 'ui/shared/TextSeparator';
@@ -75,6 +77,7 @@ interface Props {
7577
const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
7678
const size = useWindowSize();
7779
const { colorMode } = useColorMode();
80+
const isBlobScan = useBlobScan({ address: data?.from.hash });
7881
const isWvmArchiver = useWvmArchiver({ address: data?.from.hash });
7982
const isSmallDevice = size.width && size.width < 768;
8083
const wvmIconPath =
@@ -320,14 +323,28 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
320323
hint="The external application source that generated this transaction"
321324
isLoading={ isLoading }
322325
>
323-
Application
326+
Application
324327
</DetailsInfoItem.Label>
325328
<DetailsInfoItem.Value>
326329
<WvmArchiverTag/>
327330
</DetailsInfoItem.Value>
328331
</>
329332
) }
330333

334+
{ isBlobScan && (
335+
<>
336+
<DetailsInfoItem.Label
337+
hint="The external application source that generated this transaction"
338+
isLoading={ isLoading }
339+
>
340+
Application
341+
</DetailsInfoItem.Label>
342+
<DetailsInfoItem.Value>
343+
<BlobScanTag/>
344+
</DetailsInfoItem.Value>
345+
</>
346+
) }
347+
331348
<DetailsInfoItem.Label
332349
hint="Block number containing the transaction"
333350
isLoading={ isLoading }
@@ -438,7 +455,7 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
438455
hint="The Arweave TXID of the WeaveVM block"
439456
isLoading={ isLoading }
440457
>
441-
Block archive proof
458+
Block archive proof
442459
</DetailsInfoItem.Label>
443460
<DetailsInfoItem.Value>
444461
<IconSvg
@@ -451,7 +468,13 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
451468
/>
452469
{ arweaveId === 'block_not_archived_or_backfilled' ? (
453470
<>
454-
<Text color={ colorMode === 'dark' ? '#1AFFB1' : '#00B774' } marginLeft="5px" marginRight="12px">Pending </Text>
471+
<Text
472+
color={ colorMode === 'dark' ? '#1AFFB1' : '#00B774' }
473+
marginLeft="5px"
474+
marginRight="12px"
475+
>
476+
Pending{ ' ' }
477+
</Text>
455478

456479
<RotatingLines
457480
strokeColor="grey"
@@ -470,7 +493,11 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
470493
color={ colorMode === 'dark' ? '#1AFFB1' : '#00B774' }
471494
marginLeft="5px"
472495
>
473-
<EntityBase.Content text={ isSmallDevice ? truncateArweaveId(arweaveId) : arweaveId }/>
496+
<EntityBase.Content
497+
text={
498+
isSmallDevice ? truncateArweaveId(arweaveId) : arweaveId
499+
}
500+
/>
474501
</Link>
475502

476503
<CopyToClipboard text={ arweaveId }/>

ui/txs/TxsListItem.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import type { Transaction } from 'types/api/transaction';
99

1010
import config from 'configs/app';
1111
import getValueWithUnit from 'lib/getValueWithUnit';
12+
import { useBlobScan } from 'lib/hooks/useBlobScan';
1213
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1314
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1415
import { space } from 'lib/html-entities';
@@ -17,6 +18,7 @@ import AddressFromTo from 'ui/shared/address/AddressFromTo';
1718
import BlockEntity from 'ui/shared/entities/block/BlockEntity';
1819
import TxEntity from 'ui/shared/entities/tx/TxEntity';
1920
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile';
21+
import BlobScanTag from 'ui/shared/statusTag/BlobScanTag';
2022
import TxStatus from 'ui/shared/statusTag/TxStatus';
2123
import WvmArchiverTag from 'ui/shared/statusTag/WvmArchiverTag';
2224
import TxFeeStability from 'ui/shared/tx/TxFeeStability';
@@ -35,6 +37,7 @@ type Props = {
3537
}
3638

3739
const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeIncrement }: Props) => {
40+
const isBlobScan = useBlobScan({ address: tx.from.hash });
3841
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
3942
const dataTo = tx.to ? tx.to : tx.created_contract;
4043

@@ -51,6 +54,7 @@ const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeI
5154
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
5255
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
5356
{ isWvmArchiver && <WvmArchiverTag/> }
57+
{ isBlobScan && <BlobScanTag/> }
5458
</HStack>
5559
<TxAdditionalInfo tx={ tx } isMobile isLoading={ isLoading }/>
5660
</Flex>

ui/txs/TxsTableItem.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ import React from 'react';
1111
import type { Transaction } from 'types/api/transaction';
1212

1313
import config from 'configs/app';
14+
import { useBlobScan } from 'lib/hooks/useBlobScan';
1415
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1516
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1617
import AddressFromTo from 'ui/shared/address/AddressFromTo';
1718
import Tag from 'ui/shared/chakra/Tag';
1819
import CurrencyValue from 'ui/shared/CurrencyValue';
1920
import BlockEntity from 'ui/shared/entities/block/BlockEntity';
2021
import TxEntity from 'ui/shared/entities/tx/TxEntity';
22+
import BlobScanTag from 'ui/shared/statusTag/BlobScanTag';
2123
import TxStatus from 'ui/shared/statusTag/TxStatus';
2224
import WvmArchiverTag from 'ui/shared/statusTag/WvmArchiverTag';
2325
import TxFeeStability from 'ui/shared/tx/TxFeeStability';
@@ -39,6 +41,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
3941
const dataTo = tx.to ? tx.to : tx.created_contract;
4042
const timeAgo = useTimeAgoIncrement(tx.timestamp, enableTimeIncrement);
4143

44+
const isBlobScan = useBlobScan({ address: tx.from.hash });
4245
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
4346

4447
return (
@@ -75,6 +78,7 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
7578
}
7679

7780
{ isWvmArchiver && <WvmArchiverTag/> }
81+
{ isBlobScan && <BlobScanTag/> }
7882
</HStack>
7983
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
8084
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>

0 commit comments

Comments
 (0)