Skip to content

Commit 704147f

Browse files
authored
Merge pull request #52 from codingknite/fix/label-addresses
chore: label addresses
2 parents 0a6d7da + 357aaa1 commit 704147f

File tree

6 files changed

+83
-0
lines changed

6 files changed

+83
-0
lines changed

lib/hooks/useBundleV0.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { TagLabel, Tooltip } from '@chakra-ui/react';
2+
import React from 'react';
3+
4+
import Tag from 'ui/shared/chakra/Tag';
5+
6+
interface Props {
7+
address: string | undefined;
8+
}
9+
10+
export const BundleV0Tag = () => {
11+
return (
12+
<Tooltip>
13+
<Tag
14+
color="#fff"
15+
backgroundColor="#1385a7"
16+
display="flex"
17+
padding="2px 5px"
18+
>
19+
<TagLabel display="block">bundle v0.1.0</TagLabel>
20+
</Tag>
21+
</Tooltip>
22+
);
23+
};
24+
25+
export const useBundleV0 = ({ address }: Props) => {
26+
const isBundleV0 = address === '0xbabe1d25501157043c7b4ea7CBC877B9B4D8A057';
27+
28+
return isBundleV0;
29+
};

lib/hooks/useTestnetFaucet.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { TagLabel, Tooltip } from '@chakra-ui/react';
2+
import React from 'react';
3+
4+
import Tag from 'ui/shared/chakra/Tag';
5+
6+
interface Props {
7+
address: string | undefined;
8+
}
9+
10+
export const TestnetFaucetTag = () => {
11+
return (
12+
<Tooltip>
13+
<Tag
14+
color="#fff"
15+
backgroundColor="#a4133c"
16+
display="flex"
17+
padding="2px 5px"
18+
>
19+
<TagLabel display="block">testnet faucet</TagLabel>
20+
</Tag>
21+
</Tooltip>
22+
);
23+
};
24+
25+
export const useTestnetFaucet = ({ address }: Props) => {
26+
const isTestnetFaucet =
27+
address === '0x89C23f56A3C5c586c870cB26a18F13dBCCf798bE';
28+
29+
return isTestnetFaucet;
30+
};

ui/home/LatestTxsItem.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import type { Transaction } from 'types/api/transaction';
1313
import config from 'configs/app';
1414
import getValueWithUnit from 'lib/getValueWithUnit';
1515
import { useBlobScan } from 'lib/hooks/useBlobScan';
16+
import { BundleV0Tag, useBundleV0 } from 'lib/hooks/useBundleV0';
17+
import { TestnetFaucetTag, useTestnetFaucet } from 'lib/hooks/useTestnetFaucet';
1618
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1719
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1820
import { currencyUnits } from 'lib/units';
@@ -34,6 +36,8 @@ type Props = {
3436
const LatestTxsItem = ({ tx, isLoading }: Props) => {
3537
const isBlobScan = useBlobScan({ address: tx.from.hash });
3638
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
39+
const isBundleV0 = useBundleV0({ address: tx.to?.hash });
40+
const isTestnetFaucet = useTestnetFaucet({ address: tx.from.hash });
3741
const dataTo = tx.to ? tx.to : tx.created_contract;
3842
const timeAgo = useTimeAgoIncrement(tx.timestamp || '0', true);
3943
const columnNum = config.UI.views.tx.hiddenFields?.value && config.UI.views.tx.hiddenFields?.tx_fee ? 2 : 3;
@@ -62,6 +66,8 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
6266
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
6367
{ isWvmArchiver && <WvmArchiverTag/> }
6468
{ isBlobScan && <BlobScanTag/> }
69+
{ isBundleV0 && <BundleV0Tag/> }
70+
{ isTestnetFaucet && <TestnetFaucetTag/> }
6571
</HStack>
6672
<Flex
6773
alignItems="center"

ui/home/LatestTxsItemMobile.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import type { Transaction } from 'types/api/transaction';
1212
import config from 'configs/app';
1313
import getValueWithUnit from 'lib/getValueWithUnit';
1414
import { useBlobScan } from 'lib/hooks/useBlobScan';
15+
import { BundleV0Tag, useBundleV0 } from 'lib/hooks/useBundleV0';
16+
import { TestnetFaucetTag, useTestnetFaucet } from 'lib/hooks/useTestnetFaucet';
1517
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1618
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1719
import { currencyUnits } from 'lib/units';
@@ -31,6 +33,8 @@ type Props = {
3133
}
3234

3335
const LatestTxsItem = ({ tx, isLoading }: Props) => {
36+
const isBundleV0 = useBundleV0({ address: tx.to?.hash });
37+
const isTestnetFaucet = useTestnetFaucet({ address: tx.from.hash });
3438
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
3539
const isBlobScan = useBlobScan({ address: tx.from.hash });
3640
const dataTo = tx.to ? tx.to : tx.created_contract;
@@ -52,6 +56,8 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => {
5256
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
5357
{ isWvmArchiver && <WvmArchiverTag/> }
5458
{ isBlobScan && <BlobScanTag/> }
59+
{ isBundleV0 && <BundleV0Tag/> }
60+
{ isTestnetFaucet && <TestnetFaucetTag/> }
5561
</HStack>
5662
<TxAdditionalInfo tx={ tx } isMobile isLoading={ isLoading }/>
5763
</Flex>

ui/txs/TxsListItem.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import type { Transaction } from 'types/api/transaction';
1010
import config from 'configs/app';
1111
import getValueWithUnit from 'lib/getValueWithUnit';
1212
import { useBlobScan } from 'lib/hooks/useBlobScan';
13+
import { BundleV0Tag, useBundleV0 } from 'lib/hooks/useBundleV0';
14+
import { TestnetFaucetTag, useTestnetFaucet } from 'lib/hooks/useTestnetFaucet';
1315
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1416
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1517
import { space } from 'lib/html-entities';
@@ -38,7 +40,9 @@ type Props = {
3840

3941
const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeIncrement }: Props) => {
4042
const isBlobScan = useBlobScan({ address: tx.from.hash });
43+
const isBundleV0 = useBundleV0({ address: tx.to?.hash });
4144
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
45+
const isTestnetFaucet = useTestnetFaucet({ address: tx.from.hash });
4246
const dataTo = tx.to ? tx.to : tx.created_contract;
4347

4448
const timeAgo = useTimeAgoIncrement(tx.timestamp, enableTimeIncrement);
@@ -55,6 +59,8 @@ const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeI
5559
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>
5660
{ isWvmArchiver && <WvmArchiverTag/> }
5761
{ isBlobScan && <BlobScanTag/> }
62+
{ isTestnetFaucet && <TestnetFaucetTag/> }
63+
{ isBundleV0 && <BundleV0Tag/> }
5864
</HStack>
5965
<TxAdditionalInfo tx={ tx } isMobile isLoading={ isLoading }/>
6066
</Flex>

ui/txs/TxsTableItem.tsx

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

1313
import config from 'configs/app';
1414
import { useBlobScan } from 'lib/hooks/useBlobScan';
15+
import { BundleV0Tag, useBundleV0 } from 'lib/hooks/useBundleV0';
16+
import { TestnetFaucetTag, useTestnetFaucet } from 'lib/hooks/useTestnetFaucet';
1517
import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement';
1618
import { useWvmArchiver } from 'lib/hooks/useWvmArchiver';
1719
import AddressFromTo from 'ui/shared/address/AddressFromTo';
@@ -42,7 +44,9 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
4244
const timeAgo = useTimeAgoIncrement(tx.timestamp, enableTimeIncrement);
4345

4446
const isBlobScan = useBlobScan({ address: tx.from.hash });
47+
const isBundleV0 = useBundleV0({ address: tx.to?.hash });
4548
const isWvmArchiver = useWvmArchiver({ address: tx.from.hash });
49+
const isTestnetFaucet = useTestnetFaucet({ address: tx.from.hash });
4650

4751
return (
4852
<Tr
@@ -79,6 +83,8 @@ const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement,
7983

8084
{ isWvmArchiver && <WvmArchiverTag/> }
8185
{ isBlobScan && <BlobScanTag/> }
86+
{ isBundleV0 && <BundleV0Tag/> }
87+
{ isTestnetFaucet && <TestnetFaucetTag/> }
8288
</HStack>
8389
<TxStatus status={ tx.status } errorText={ tx.status === 'error' ? tx.result : undefined } isLoading={ isLoading }/>
8490
<TxWatchListTags tx={ tx } isLoading={ isLoading }/>

0 commit comments

Comments
 (0)