diff --git a/CHANGELOG.md b/CHANGELOG.md index 7135d0d..8ebef5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +### v5.0.1 + +- [perf] Search for private tags ignores case sensitivity +- [fix] Fix the bug where saving local labels on the Arkham website fails +- [dix] Fix the bug where importing local labels fails + ### v5.0.0 - [feat] Supports Solana scans diff --git a/README.md b/README.md index e1da200..af4132a 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,6 @@ For up to the minute news, follow our [Twitter](https://twitter.com/MetaDockTeam - [x] Show evm.storage shortcut - [x] Show transaction simulator - [x] Show Variable Logs -- [x] Manage Local Private Labels ## Supported Websites List @@ -66,12 +65,6 @@ For up to the minute news, follow our [Twitter](https://twitter.com/MetaDockTeam - tronscan.org - era.zksync.network - blockscout.com -- debank.com -- platform.arkhamintelligence.com -- scan.merlinchain.io -- solscan.io -- solana.fm -- explorer.solana.com ## Contributing diff --git a/package.json b/package.json index 5cff9de..6e49ac8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metasuites", - "version": "5.0.0", + "version": "5.0.1", "repository": { "type": "git", "url": "https://github.com/blocksecteam/metasuites.git" diff --git a/src/common/components/ComplianceRadarPlot/index.tsx b/src/common/components/ComplianceRadarPlot/index.tsx index f592cf4..a926d47 100644 --- a/src/common/components/ComplianceRadarPlot/index.tsx +++ b/src/common/components/ComplianceRadarPlot/index.tsx @@ -53,7 +53,7 @@ const ComplianceRadarPlot: FC = ({ backgroundColor: '#6a7985' } }, - formatter: function (params: any, v: any) { + formatter: function (params: any) { const data = params.value function getRisk(value: number) { return Object.values(NFT_RISKS).find( diff --git a/src/common/components/ModalAddPrivateLabel/index.tsx b/src/common/components/ModalAddPrivateLabel/index.tsx index e1b1834..4932aad 100644 --- a/src/common/components/ModalAddPrivateLabel/index.tsx +++ b/src/common/components/ModalAddPrivateLabel/index.tsx @@ -22,7 +22,7 @@ interface Props { onSuccess?: (label?: string, color?: string) => void } -const LABEL_COLORS = [ +export const LABEL_COLORS = [ '#EF4444', '#FB923C', '#EAB308', @@ -34,6 +34,8 @@ const LABEL_COLORS = [ '#BE185D' ] +export const DEFAULT_LABEL_COLOR = '#D9D9D9' + const ModalAddPrivateLabel: FC = ({ visible, chainType, diff --git a/src/content/arkham/components/MainPrivateLabel/index.tsx b/src/content/arkham/components/MainPrivateLabel/index.tsx index e14f536..8249295 100644 --- a/src/content/arkham/components/MainPrivateLabel/index.tsx +++ b/src/content/arkham/components/MainPrivateLabel/index.tsx @@ -4,6 +4,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/content/arkham/feat-scripts/main-address-label.tsx b/src/content/arkham/feat-scripts/main-address-label.tsx index d5505a2..ce3a7ac 100644 --- a/src/content/arkham/feat-scripts/main-address-label.tsx +++ b/src/content/arkham/feat-scripts/main-address-label.tsx @@ -2,13 +2,14 @@ import { createRoot } from 'react-dom/client' import $ from 'jquery' import { ChainType } from '@common/constants' +import { pickAddress } from '@common/utils' import { MainPrivateLabel } from '../components' const renderMainAddressLabel = async () => { const container = $('div[class^="Header_displayNameAddress"]:first') - const mainAddress = container.find('input').val() + const mainAddress = pickAddress(window.location.pathname) if (!mainAddress) return diff --git a/src/content/btc/components/MainPrivateLabel/index.tsx b/src/content/btc/components/MainPrivateLabel/index.tsx index 6285834..f44f85a 100644 --- a/src/content/btc/components/MainPrivateLabel/index.tsx +++ b/src/content/btc/components/MainPrivateLabel/index.tsx @@ -4,6 +4,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/content/debank/components/MainPrivateLabel/index.tsx b/src/content/debank/components/MainPrivateLabel/index.tsx index 4b288da..324aae4 100644 --- a/src/content/debank/components/MainPrivateLabel/index.tsx +++ b/src/content/debank/components/MainPrivateLabel/index.tsx @@ -4,6 +4,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore } from '@common/hooks' import { hexToRgba, formatAddress } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/content/etherscan/components/MainPrivateLabel/index.tsx b/src/content/etherscan/components/MainPrivateLabel/index.tsx index 9aac686..b3a7a21 100644 --- a/src/content/etherscan/components/MainPrivateLabel/index.tsx +++ b/src/content/etherscan/components/MainPrivateLabel/index.tsx @@ -5,6 +5,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore, useTheme } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -13,8 +14,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const { isDarkMode } = useTheme() diff --git a/src/content/scans/components/MainPrivateLabel/index.tsx b/src/content/scans/components/MainPrivateLabel/index.tsx index b711934..3983e36 100644 --- a/src/content/scans/components/MainPrivateLabel/index.tsx +++ b/src/content/scans/components/MainPrivateLabel/index.tsx @@ -5,6 +5,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore, useTheme } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -13,8 +14,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const { isDarkMode } = useTheme() diff --git a/src/content/solanaexpl/components/MainPrivateLabel/index.tsx b/src/content/solanaexpl/components/MainPrivateLabel/index.tsx index 8a649ce..f6d57a4 100644 --- a/src/content/solanaexpl/components/MainPrivateLabel/index.tsx +++ b/src/content/solanaexpl/components/MainPrivateLabel/index.tsx @@ -1,9 +1,10 @@ import { type FC, useState } from 'react' import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' -import { useStore, useTheme } from '@common/hooks' +import { useStore } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/content/solanafm/components/MainPrivateLabel/index.tsx b/src/content/solanafm/components/MainPrivateLabel/index.tsx index cde28c0..d20de69 100644 --- a/src/content/solanafm/components/MainPrivateLabel/index.tsx +++ b/src/content/solanafm/components/MainPrivateLabel/index.tsx @@ -4,6 +4,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore, useTheme } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/content/solscan/components/MainPrivateLabel/index.tsx b/src/content/solscan/components/MainPrivateLabel/index.tsx index 6285834..f44f85a 100644 --- a/src/content/solscan/components/MainPrivateLabel/index.tsx +++ b/src/content/solscan/components/MainPrivateLabel/index.tsx @@ -4,6 +4,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/content/tronscan/components/MainPrivateLabel/index.tsx b/src/content/tronscan/components/MainPrivateLabel/index.tsx index cde28c0..d20de69 100644 --- a/src/content/tronscan/components/MainPrivateLabel/index.tsx +++ b/src/content/tronscan/components/MainPrivateLabel/index.tsx @@ -4,6 +4,7 @@ import { IconAdd, IconEdit, ModalAddPrivateLabel } from '@common/components' import { useStore, useTheme } from '@common/hooks' import { hexToRgba } from '@common/utils' import type { ChainType } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -12,8 +13,6 @@ interface Props { address: string } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const MainPrivateLabel: FC = ({ address, chainType }) => { const [privateLabels] = useStore('privateLabels') diff --git a/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/ImportPrivateLabelsDrawer/index.tsx b/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/ImportPrivateLabelsDrawer/index.tsx index c3d2dfe..e0d96b7 100644 --- a/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/ImportPrivateLabelsDrawer/index.tsx +++ b/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/ImportPrivateLabelsDrawer/index.tsx @@ -4,8 +4,13 @@ import { parse } from 'papaparse' import { Drawer, IconImport } from '@common/components' import type { PrivateLabel } from '@src/store' -import { EXT_SUPPORT_WEB_LIST } from '@common/constants' +import { ChainType } from '@common/constants' import { useStore } from '@common/hooks' +import { formatAddress } from '@common/utils' +import { + LABEL_COLORS, + DEFAULT_LABEL_COLOR +} from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -24,13 +29,24 @@ const ImportPrivateLabelsDrawer: FC = ({ visible, onClose }) => { accept: '.csv', multiple: false, className: styles.upload, + beforeUpload: file => { + const isLt4M = file.size / 1024 / 1024 < 4 + if (!isLt4M) { + message.error('File must smaller than 4MB') + return Upload.LIST_IGNORE + } + return true + }, customRequest: async ({ file, onSuccess, onError }) => { parse(file as File, { complete: parsedData => { const [headerRow, ...dataRows] = parsedData.data as string[][] const jsonData = dataRows.map(row => { return headerRow.reduce((obj, header, index) => { - obj[header.toLowerCase()] = row[index] + obj[header] = row[index] + if (!LABEL_COLORS.includes(obj.color?.toUpperCase())) { + obj.color = DEFAULT_LABEL_COLOR + } return obj }, {} as Record) }) @@ -44,22 +60,19 @@ const ImportPrivateLabelsDrawer: FC = ({ visible, onClose }) => { onChange: async info => { const { status, response } = info.file if (status === 'done') { - const chainList = EXT_SUPPORT_WEB_LIST.flatMap(item => [ - item, - ...(item.testNets || []) - ]) - .filter(item => item.chain) - .map(item => item.chain) + const supportedChainTypes = Object.values(ChainType).filter( + item => item !== 'unknown' + ) const labels: PrivateLabel[] = response.filter((item: PrivateLabel) => { return ( item.label && item.address && - chainList.includes(item.chain) && + supportedChainTypes.includes(item.chainType) && item.label.length <= 35 ) }) const records = labels.reduce((obj, item) => { - obj[`${item.chain}-${item.address}`] = item + obj[`${item.chainType}-${formatAddress(item.address)}`] = item return obj }, {} as Record) setPrivateLabels({ ...privateLabels, ...records }) @@ -79,8 +92,9 @@ const ImportPrivateLabelsDrawer: FC = ({ visible, onClose }) => {

- Support upload CSV files only, with a maximum file size of 1MB. Each - import can include up to 1,000 addresses (labels optional). + Only CSV format is supported for import, with a maximum file size of + 4MB. Please refer to the exported CSV format for the correct import + format.

diff --git a/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/LabelItem/index.tsx b/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/LabelItem/index.tsx index 51a9097..dab019d 100644 --- a/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/LabelItem/index.tsx +++ b/src/popup/components/Settings/components/PrivateLabelManagementDrawer/components/LabelItem/index.tsx @@ -8,6 +8,7 @@ import type { PrivateLabel } from '@src/store' import { useStore } from '@common/hooks' import { chromeEvent } from '@common/event' import { REFRESH } from '@common/constants' +import { DEFAULT_LABEL_COLOR } from '@common/components/ModalAddPrivateLabel' import styles from './index.module.less' @@ -15,8 +16,6 @@ interface Props { data: PrivateLabel } -const DEFAULT_LABEL_COLOR = '#D9D9D9' - const LabelItem: FC = ({ data, data: { chainType, address, label } diff --git a/src/popup/components/Settings/components/PrivateLabelManagementDrawer/index.tsx b/src/popup/components/Settings/components/PrivateLabelManagementDrawer/index.tsx index 5f8a6d5..6ceaf46 100644 --- a/src/popup/components/Settings/components/PrivateLabelManagementDrawer/index.tsx +++ b/src/popup/components/Settings/components/PrivateLabelManagementDrawer/index.tsx @@ -24,7 +24,10 @@ const PrivateLabelManagementDrawer: FC = ({ visible, onClose }) => { const labelList = useMemo(() => { return Object.values(privateLabels).filter(item => { if (keyword.trim()) { - return item.label.indexOf(keyword) > -1 + return ( + item.label.toLowerCase().indexOf(keyword.toLowerCase()) > -1 || + item.address.toLowerCase().indexOf(keyword.toLowerCase()) > -1 + ) } else { return true }