From c63f4b1618e5cacba0d58b13d4d13c99ebc6130b Mon Sep 17 00:00:00 2001 From: cong_wang Date: Wed, 28 Aug 2024 10:43:51 +0800 Subject: [PATCH] feat: Adapt to MantleScan --- CHANGELOG.md | 4 + manifest.config.ts | 3 +- package.json | 2 +- src/common/config/allowlist.ts | 3 +- src/common/config/feature.support.ts | 305 +++++++++++++++++++++++++-- src/common/constants/support.ts | 53 ++++- 6 files changed, 339 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17a65cd..0fb484c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### v5.4.0 + +- [feat] Adapt to MantleScan + ### v5.3.0 - [test] Add new test cases to ensure the functionality of the code is thoroughly tested diff --git a/manifest.config.ts b/manifest.config.ts index 6a17d9f..6925329 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -39,7 +39,8 @@ export default defineManifest((env: ConfigEnv) => { '*://*.celoscan.io/*', '*://*.bttcscan.com/*', '*://era.zksync.network/*', - '*://snowscan.xyz/*' + '*://snowscan.xyz/*', + '*://mantlescan.xyz/*' ] : [''], js: ['src/content/index.all_frames.ts'], diff --git a/package.json b/package.json index 38cd519..e275294 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metasuites", - "version": "5.3.0", + "version": "5.4.0", "repository": { "type": "git", "url": "https://github.com/blocksecteam/metasuites.git" diff --git a/src/common/config/allowlist.ts b/src/common/config/allowlist.ts index a80a945..57436b2 100644 --- a/src/common/config/allowlist.ts +++ b/src/common/config/allowlist.ts @@ -27,7 +27,8 @@ export default { '*://*.basescan.org/*', '*://cronoscan.com/*', '*://gnosisscan.io/*', - '*://*.arbiscan.io/*' + '*://*.arbiscan.io/*', + '*://mantlescan.xyz/*' ], BTC_EXPLORER_MATCHES: ['*://*.btc.com/*'], BLOCKSEC_MATCHES: ['*://*.blocksec.com/*'], diff --git a/src/common/config/feature.support.ts b/src/common/config/feature.support.ts index a77c558..957e69c 100644 --- a/src/common/config/feature.support.ts +++ b/src/common/config/feature.support.ts @@ -1,15 +1,78 @@ import BaseFeatureSupport from '@common/constants/abstract/BaseFeatureSupport' +import BaseConstant from '@common/constants/abstract/BaseConstants' +import { PHALCON_EXPLORER_DOMAIN } from '@common/config/uri' -// prettier-ignore export class FeatureActiveSupport { - static DEBANK = new BaseFeatureSupport('debank', ['eth', 'bsc', 'polygon', 'fantom', 'arbitrum', 'cronos', 'moonbeam', 'avalanche', 'optimism', 'base', 'zkevm', 'linea', 'btt', 'celo', 'gnosis', 'moonriver', 'wemix', 'nova.arbitrum']) - static APPROVAL_DIAGNOSIS = new BaseFeatureSupport('approval-diagnosis', ['eth', 'bsc', 'polygon', 'fantom', 'arbitrum', 'cronos', 'moonbeam', 'avalanche', 'optimism', 'moonriver', 'btt', 'celo', 'gnosis', 'base', 'zkevm', 'linea', 'wemix']) - static PROXY_CONTRACT_LOG = new BaseFeatureSupport('proxy-contract-log', ['eth', 'bsc', 'polygon', 'fantom', 'arbitrum', 'cronos', 'moonbeam', 'avalanche', 'optimism']) - static TRANSACTION_EXPLAIN = new BaseFeatureSupport('transaction-explain', ['eth']) + static DEBANK = new BaseFeatureSupport('debank', [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'arbitrum', + 'cronos', + 'moonbeam', + 'avalanche', + 'optimism', + 'base', + 'zkevm', + 'linea', + 'btt', + 'celo', + 'gnosis', + 'moonriver', + 'wemix', + 'nova.arbitrum', + 'era.zksync', + 'mantle' + ]) + static APPROVAL_DIAGNOSIS = new BaseFeatureSupport('approval-diagnosis', [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'arbitrum', + 'cronos', + 'moonbeam', + 'avalanche', + 'optimism', + 'moonriver', + 'btt', + 'celo', + 'gnosis', + 'base', + 'zkevm', + 'linea', + 'wemix', + 'tron', + 'mantle' + ]) + static PROXY_CONTRACT_LOG = new BaseFeatureSupport('proxy-contract-log', [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'arbitrum', + 'cronos', + 'moonbeam', + 'avalanche', + 'optimism' + ]) + static TRANSACTION_EXPLAIN = new BaseFeatureSupport('transaction-explain', [ + 'eth' + ]) static EVM_STORAGE = new BaseFeatureSupport('evm-storage', ['eth']) static TRANSACTION_SIMULATOR = new BaseFeatureSupport( 'transaction-simulator', - ['eth', 'bsc', 'polygon', 'fantom', 'arbitrum', 'avalanche', 'optimism'], + [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'arbitrum', + 'avalanche', + 'optimism', + 'mantle' + ], [ { chain: 'eth', @@ -64,12 +127,22 @@ export class FeatureActiveSupport { chain: 'optimism', logo: 'https://assets.blocksec.com/image/1671777583236-2.png', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 } + }, + { + name: 'Mantle', + chain: 'mantle', + logo: 'https://assets.blocksec.com/image/1721387994429-2.svg', + nativeCurrency: { + decimals: 18, + name: 'MNT', + symbol: 'MNT' + } } ] ) static ETHERVM = new BaseFeatureSupport( 'decompile-in-ethervm', - ['eth', 'bsc', 'gor.eth', 'sepolia.eth'], + ['eth', 'bsc', 'gor.eth', 'sepolia.eth', 'tron'], [ { chain: 'eth', @@ -86,12 +159,26 @@ export class FeatureActiveSupport { { chain: 'sepolia.eth', url: 'https://ethervm.io/decompile/sepolia' + }, + { + chain: 'tron', + url: 'https://ethervm.io/decompile/tron' } ] ) static ETHERSCAN_DETH = new BaseFeatureSupport( 'etherscan_deth', - ['eth', 'bsc', 'polygon', 'fantom', 'optimism', 'arbitrum', 'avalanche', 'cronos'], + [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'optimism', + 'arbitrum', + 'avalanche', + 'cronos', + 'base' + ], [ { chain: 'eth', @@ -124,13 +211,39 @@ export class FeatureActiveSupport { { chain: 'cronos', url: 'https://cronoscan.deth.net/address' + }, + { + chain: 'base', + url: 'https://basescan.deth.net/address' } ] ) static TENDERLY = new BaseFeatureSupport( 'tenderly', - ['polygon', 'bsc', 'arbitrum', 'fantom', 'avalanche', 'eth', 'optimism', 'base', 'cronos', 'moonbeam', 'moonriver', 'gnosis', 'gor.eth', 'test.fantom', 'gor.optimism', 'mumbai.polygon', 'sepolia.eth', 'gor.base', 'gor.arbitrum', 'nova.arbitrum'], + [ + 'polygon', + 'bsc', + 'arbitrum', + 'fantom', + 'avalanche', + 'eth', + 'optimism', + 'base', + 'cronos', + 'moonbeam', + 'moonriver', + 'gnosis', + 'gor.eth', + 'test.fantom', + 'gor.optimism', + 'mumbai.polygon', + 'sepolia.eth', + 'gor.base', + 'gor.arbitrum', + 'nova.arbitrum', + 'mantle' + ], [ { pathname: 'polygon', @@ -148,6 +261,7 @@ export class FeatureActiveSupport { pathname: 'fantom', chain: 'fantom' }, + { pathname: 'ava', chain: 'avalanche' @@ -211,6 +325,10 @@ export class FeatureActiveSupport { { pathname: 'arbitrum-nova', chain: 'nova.arbitrum' + }, + { + pathname: 'mantle', + chain: 'mantle' } ] ) @@ -250,7 +368,22 @@ export class FeatureActiveSupport { ) static PHALCON = new BaseFeatureSupport( 'phalcon', - ['eth', 'sepolia.eth', 'gor.eth', 'polygon', 'bsc', 'avalanche', 'arbitrum', 'optimism', 'fantom'], + [ + 'eth', + 'sepolia.eth', + 'gor.eth', + 'polygon', + 'bsc', + 'avalanche', + 'arbitrum', + 'optimism', + 'fantom', + 'linea', + 'base', + 'era.zksync', + 'solana', + 'mantle' + ], [ { pathname: 'eth', @@ -270,7 +403,7 @@ export class FeatureActiveSupport { { pathname: 'polygon', chain: 'polygon', - supportSimulator: true + supportSimulator: false }, { pathname: 'bsc', @@ -278,7 +411,7 @@ export class FeatureActiveSupport { supportSimulator: true }, { - pathname: 'avax', + pathname: 'avalanche', chain: 'avalanche', supportSimulator: true }, @@ -293,14 +426,152 @@ export class FeatureActiveSupport { supportSimulator: true }, { - pathname: 'ftm', + pathname: 'fantom', chain: 'fantom', supportSimulator: false + }, + { + pathname: 'linea', + chain: 'linea', + supportSimulator: false + }, + { + pathname: 'base', + chain: 'base', + supportSimulator: false + }, + { + pathname: 'zksync-era', + chain: 'era.zksync', + supportSimulator: false + }, + { + pathname: 'solana', + chain: 'solana', + supportSimulator: false + }, + { + pathname: 'mantle', + chain: 'mantle', + supportSimulator: true + } + ] + ) + static ALTERNATIVE_BLOCK_EXPLORES = new BaseFeatureSupport( + 'alternative-block-explorers', + ['eth'] + ) + static METASLEUTH = new BaseFeatureSupport('metasleuth', [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'arbitrum', + 'cronos', + 'moonbeam', + 'avalanche', + 'optimism', + 'linea', + 'base', + 'tron', + 'solana', + 'mantle' + ]) + static FORTA_ALERT = new BaseFeatureSupport('forta-alert', [ + 'eth', + 'bsc', + 'polygon', + 'fantom', + 'arbitrum', + 'avalanche', + 'optimism' + ]) + static CONTRACT_PRIVATE_VARIABLES = new BaseFeatureSupport( + 'contract-private-variables', + ['eth', 'bsc', 'polygon', 'arbitrum', 'avalanche', 'optimism'] + ) + static DEDAUB = new BaseFeatureSupport( + 'dedaub', + ['eth', 'fantom', 'arbitrum', 'optimism', 'polygon', 'avalanche', 'base'], + [ + { + chain: 'eth', + pathname: 'ethereum' + }, + { + chain: 'fantom', + pathname: 'fantom' + }, + { + chain: 'arbitrum', + pathname: 'arbitrum' + }, + { + chain: 'optimism', + pathname: 'optimism' + }, + { + chain: 'polygon', + pathname: 'polygon' + }, + { + chain: 'avalanche', + pathname: 'avalanche' + }, + { + chain: 'base', + pathname: 'base' } ] ) - static ALTERNATIVE_BLOCK_EXPLORES = new BaseFeatureSupport('alternative-block-explorers', ['eth']) - static METASLEUTH = new BaseFeatureSupport('metasleuth', ['eth', 'bsc', 'polygon', 'fantom', 'arbitrum', 'cronos', 'moonbeam', 'avalanche', 'optimism', 'linea', 'base']) - static FORTA_ALERT = new BaseFeatureSupport('forta-alert', ['eth','bsc', 'polygon', 'fantom', 'arbitrum' ,'avalanche', 'optimism']) - static CONTRACT_PRIVATE_VARIABLES = new BaseFeatureSupport('contract-private-variables', ['eth', 'bsc', 'polygon', 'arbitrum', 'avalanche', 'optimism']) + static ARKHAM = new BaseFeatureSupport( + 'arkham', + ['eth', 'polygon', 'avalanche', 'arbitrum', 'base'], + [ + { + pathname: 'eth', + chain: 'eth', + name: 'ETHEREUM' + }, + { + pathname: 'polygon', + chain: 'polygon', + name: 'POLYGON' + }, + { + pathname: 'avalanche', + chain: 'avalanche', + name: 'AVALANCHE' + }, + { + pathname: 'arbitrum', + chain: 'arbitrum', + name: 'ARBITRUM' + }, + { + pathname: 'base', + chain: 'base', + name: 'BASE' + } + ] + ) +} + +export class TransactionParsers extends BaseConstant { + static PHALCON = new BaseConstant( + 'phalcon', + 'phalcon', + PHALCON_EXPLORER_DOMAIN + ) + static TENDERLY = new BaseConstant( + 'tenderly', + 'tenderly', + 'https://dashboard.tenderly.co' + ) + static OPENCHAIN = new BaseConstant( + 'openchain', + 'openchain', + 'https://openchain.xyz/trace' + ) + static DEDAUB = new BaseConstant('dedaub', 'dedaub', 'https://app.dedaub.com') } diff --git a/src/common/constants/support.ts b/src/common/constants/support.ts index 3396f4c..471a07b 100644 --- a/src/common/constants/support.ts +++ b/src/common/constants/support.ts @@ -1,3 +1,7 @@ +/** + * TODO: Will be removed in the future, please use `FeatureActiveSupport` + */ + import { PHALCON_EXPLORER_DOMAIN } from '@common/config/uri' import BaseConstant from './abstract/BaseConstants' @@ -415,6 +419,13 @@ export const EXT_SUPPORT_WEB_LIST: ExtSupportWebsite[] = [ siteName: 'MERLINSCAN', logo: 'https://assets.blocksec.com/image/1711950037081-2.png' }, + { + name: 'MantleScan', + chain: 'mantle', + domains: ['mantlescan.xyz'], + siteName: 'ETHERSCAN', + logo: 'https://assets.blocksec.com/image/1721387994429-2.svg' + }, { name: 'Solscan', chain: 'solana', @@ -469,7 +480,8 @@ export const SLEUTH_SUPPORT_LIST = [ 'linea', 'base', 'tron', - 'solana' + 'solana', + 'mantle' ] export const ALTERNATIVE_BLOCK_EXPLORES_SUPPORT_LIST = ['eth'] @@ -539,6 +551,11 @@ export const PHALCON_SUPPORT_LIST = [ pathname: 'solana', chain: 'solana', supportSimulator: false + }, + { + pathname: 'mantle', + chain: 'mantle', + supportSimulator: true } ] @@ -654,6 +671,10 @@ export const TENDERLY_SUPPORT_LIST = [ { pathname: 'arbitrum-nova', chain: 'nova.arbitrum' + }, + { + pathname: 'mantle', + chain: 'mantle' } ] @@ -687,6 +708,11 @@ export const DEDAUB_SUPPORT_DIRECT_LIST = [ chain: 'base', pathname: 'base' } + // not fully supported + // { + // chain: 'mantle', + // pathname: 'mantle' + // } ] export const ETHERSCAN_DETH_SUPPORT_LIST = [ @@ -807,17 +833,20 @@ export const SIMULATE_SUPPORT_LIST = [ chain: 'optimism', logo: 'https://assets.blocksec.com/image/1671777583236-2.png', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 } + }, + { + name: 'Mantle', + chain: 'mantle', + logo: 'https://assets.blocksec.com/image/1721387994429-2.svg', + nativeCurrency: { + decimals: 18, + name: 'MNT', + symbol: 'MNT' + } } ] -export const TX_EXPLAIN_SUPPORT_LIST = [ - 'eth' - // 'bsc', - // 'polygon', - // 'fantom', - // 'avalanche', - // 'optimism' -] +export const TX_EXPLAIN_SUPPORT_LIST = ['eth'] export const EVM_STORAGE_SUPPORT_LIST = ['eth'] @@ -880,7 +909,8 @@ export const DEBANK_SUPPORT_LIST = [ 'moonriver', 'wemix', 'nova.arbitrum', - 'era.zksync' + 'era.zksync', + 'mantle' ] export const APPROVAL_DIAGNOSIS_SUPPORT_LIST = [ @@ -901,7 +931,8 @@ export const APPROVAL_DIAGNOSIS_SUPPORT_LIST = [ 'zkevm', 'linea', 'wemix', - 'tron' + 'tron', + 'mantle' ] export const ARKHAM_PHALCON_SUPPORTED_LIST = [