From 079c2a10d1b74f29cc813391d2ef65edcf7c81d5 Mon Sep 17 00:00:00 2001 From: cong_wang Date: Fri, 5 Jul 2024 17:01:24 +0800 Subject: [PATCH] feat: Adapt to the new versions of Gnosisscan, Cronoscan, and Arbiscan --- CHANGELOG.md | 5 ++ manifest.config.ts | 3 +- package.json | 2 +- src/background/index.ts | 14 +++--- src/common/config/allowlist.ts | 11 ++-- .../transaction-hash-phalcon-link.tsx | 2 +- src/content/index.ts | 3 ++ .../PhalconExplorerButton/index.module.less | 9 ++++ .../PhalconExplorerButton/index.tsx | 50 +++++++++++++++++++ src/content/jito/components/index.ts | 1 + src/content/jito/index.tsx | 24 +++++++++ .../PhalconExplorerButton/index.tsx | 2 +- .../PhalconExplorerButton/index.tsx | 2 +- 13 files changed, 111 insertions(+), 17 deletions(-) create mode 100644 src/content/jito/components/PhalconExplorerButton/index.module.less create mode 100644 src/content/jito/components/PhalconExplorerButton/index.tsx create mode 100644 src/content/jito/components/index.ts create mode 100644 src/content/jito/index.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 21c1f00..f53b882 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### v5.2.0 + +- [feat] Add a Phalcon Explorer entry on the explorer.jito.wtf bundle page +- [feat] Adapt to the new versions of Gnosisscan, Cronoscan, and Arbiscan + ### v5.1.2 - [fix] Fix the issue where the solscan tx page does not correctly display the Phalcon Explorer button diff --git a/manifest.config.ts b/manifest.config.ts index f2e7923..6a17d9f 100644 --- a/manifest.config.ts +++ b/manifest.config.ts @@ -57,7 +57,8 @@ export default defineManifest((env: ConfigEnv) => { '*://*.metasleuth.io/*', '*://explorer.solana.com/*', '*://debank.com/*', - '*://platform.arkhamintelligence.com/*' + '*://platform.arkhamintelligence.com/*', + '*://explorer.jito.wtf/*' ] : [''], js: ['src/content/index.ts'], diff --git a/package.json b/package.json index 06dc0e6..937bc77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metasuites", - "version": "5.1.2", + "version": "5.2.0", "repository": { "type": "git", "url": "https://github.com/blocksecteam/metasuites.git" diff --git a/src/background/index.ts b/src/background/index.ts index a02499e..d577cbf 100644 --- a/src/background/index.ts +++ b/src/background/index.ts @@ -163,17 +163,17 @@ browser.webRequest.onCompleted.addListener( }, { urls: [ - 'https://api.solscan.io/v2/account/soltransfer/txs?*', - 'https://api.solscan.io/v2/account/transaction?*', - 'https://api.solscan.io/v2/account/v2/tokenaccounts?*', - 'https://api.solscan.io/v2/account/stake?*', + 'https://api-v2.solscan.io/v2/account/soltransfer/txs?*', + 'https://api-v2.solscan.io/v2/account/transaction?*', + 'https://api-v2.solscan.io/v2/account/v2/tokenaccounts?*', + 'https://api-v2.solscan.io/v2/account/stake?*', 'https://api-v2.solscan.io/v2/account/activity/dextrading?*', 'https://api-v2.solscan.io/v2/token/transfer?address=*', 'https://api-v2.solscan.io/v2/account/transfer?address=*', - 'https://api.solscan.io/v2/account/transaction?address=*', - 'https://api.solscan.io/v2/token/holders?token=*', + 'https://api-v2.solscan.io/v2/account/transaction?address=*', + 'https://api-v2.solscan.io/v2/token/holders?token=*', 'https://api-v2.solscan.io/v2/token/activity/dextrading/total?address=*', - 'https://api.solscan.io/v2/account/token/txs?address=*' + 'https://api-v2.solscan.io/v2/account/token/txs?address=*' ] } ) diff --git a/src/common/config/allowlist.ts b/src/common/config/allowlist.ts index de492b9..197bb05 100644 --- a/src/common/config/allowlist.ts +++ b/src/common/config/allowlist.ts @@ -1,8 +1,5 @@ export default { ETHERSCAN_V1_MATCHES: [ - '*://*.arbiscan.io/*', - '*://cronoscan.com/*', - '*://gnosisscan.io/*', '*://opbnb-testnet.bscscan.com/*', '*://goerli-optimism.etherscan.io/*' ], @@ -30,7 +27,10 @@ export default { '*://*.lineascan.build/*', '*://*.wemixscan.com/*', '*://testnet.ftmscan.com/*', - '*://*.basescan.org/*' + '*://*.basescan.org/*', + '*://cronoscan.com/*', + '*://gnosisscan.io/*', + '*://*.arbiscan.io/*' ], BTC_EXPLORER_MATCHES: ['*://*.btc.com/*'], BLOCKSEC_MATCHES: ['*://*.blocksec.com/*'], @@ -44,5 +44,6 @@ export default { MS_MATCHES: ['*://*.metasleuth.io/*'], DEBANK_MATCHES: ['*://debank.com/*'], ARKHAM_MATCHES: ['*://platform.arkhamintelligence.com/*'], - DEX_MATCHES: ['*://dexscreener.com/*'] + DEX_MATCHES: ['*://dexscreener.com/*'], + JITO_MATCHES: ['*://explorer.jito.wtf/bundle/*'] } diff --git a/src/content/etherscan/feat-scripts/transaction-hash-phalcon-link.tsx b/src/content/etherscan/feat-scripts/transaction-hash-phalcon-link.tsx index b158425..8549b26 100644 --- a/src/content/etherscan/feat-scripts/transaction-hash-phalcon-link.tsx +++ b/src/content/etherscan/feat-scripts/transaction-hash-phalcon-link.tsx @@ -27,7 +27,7 @@ const PhalconExplorerButton: FC<{ hash: string }> = ({ hash }) => { window.open(`${PHALCON_EXPLORER_DOMAIN}/tx/${pathname}/${hash}`, '_blank') } - if (!chain) return null + if (!pathname) return null return ( = ({ txHash }) => { + const handleClick = (e: React.MouseEvent) => { + e.preventDefault() + window.open(`${PHALCON_EXPLORER_DOMAIN}/tx/solana/${txHash}`, '_blank') + } + + return ( + + ) +} + +export default PhalconExplorerButton diff --git a/src/content/jito/components/index.ts b/src/content/jito/components/index.ts new file mode 100644 index 0000000..b407562 --- /dev/null +++ b/src/content/jito/components/index.ts @@ -0,0 +1 @@ +export { default as PhalconExplorerButton } from './PhalconExplorerButton' diff --git a/src/content/jito/index.tsx b/src/content/jito/index.tsx new file mode 100644 index 0000000..b4f684d --- /dev/null +++ b/src/content/jito/index.tsx @@ -0,0 +1,24 @@ +import $ from 'jquery' +import { createRoot } from 'react-dom/client' + +import { store } from '@src/store' + +import { PhalconExplorerButton } from './components' + +export const initJito = async () => { + const { quick2Parsers } = await store.get('options') + if (!quick2Parsers) return + const containers = $( + '#__next > div > div > div > div:nth-of-type(3) > main > main > div:nth-of-type(2) > div > div:nth-of-type(8) > div:nth-of-type(2) > div > a' + ) + containers.each(function () { + const container = $(this) + const txHash = container.find('div.break-all').text().trim() + console.log('txHash', txHash) + const rootEl = $( + '' + ) + container.find('> div > div:not(:hidden)').append(rootEl) + createRoot(rootEl[0]).render() + }) +} diff --git a/src/content/merlin/components/PhalconExplorerButton/index.tsx b/src/content/merlin/components/PhalconExplorerButton/index.tsx index c1f3a33..2f1d39c 100644 --- a/src/content/merlin/components/PhalconExplorerButton/index.tsx +++ b/src/content/merlin/components/PhalconExplorerButton/index.tsx @@ -31,7 +31,7 @@ const PhalconExplorerButton: FC = () => { onClick={handleClick} className={styles.button} > - Open in Phalcon Explorer + Phalcon Explorer diff --git a/src/content/solscan/components/PhalconExplorerButton/index.tsx b/src/content/solscan/components/PhalconExplorerButton/index.tsx index b39612c..3da898b 100644 --- a/src/content/solscan/components/PhalconExplorerButton/index.tsx +++ b/src/content/solscan/components/PhalconExplorerButton/index.tsx @@ -41,7 +41,7 @@ const PhalconExplorerButton: FC = ({ txHash }) => { fill="white" /> - Open in Phalcon Explorer + Phalcon Explorer ) }