Skip to content

Commit

Permalink
feat: Adapt to the new versions of Gnosisscan, Cronoscan, and Arbiscan
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbe37e committed Jul 5, 2024
1 parent 48d82b4 commit 079c2a1
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion manifest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/*'
]
: ['<all_urls>'],
js: ['src/content/index.ts'],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metasuites",
"version": "5.1.2",
"version": "5.2.0",
"repository": {
"type": "git",
"url": "https://github.com/blocksecteam/metasuites.git"
Expand Down
14 changes: 7 additions & 7 deletions src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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=*'
]
}
)
Expand Down
11 changes: 6 additions & 5 deletions src/common/config/allowlist.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export default {
ETHERSCAN_V1_MATCHES: [
'*://*.arbiscan.io/*',
'*://cronoscan.com/*',
'*://gnosisscan.io/*',
'*://opbnb-testnet.bscscan.com/*',
'*://goerli-optimism.etherscan.io/*'
],
Expand Down Expand Up @@ -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/*'],
Expand All @@ -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/*']
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<IconPhalcon
mode="dark"
Expand Down
3 changes: 3 additions & 0 deletions src/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { initSolanaExplorer } from '@src/content/solanaexpl'
import { initMetaSleuth } from '@src/content/metasleuth'
import { initDebank } from '@src/content/debank'
import { initArkham } from '@src/content/arkham'
import { initJito } from '@src/content/jito'

const currentUrl = window.location.href

Expand All @@ -36,4 +37,6 @@ if (isMatchURL(currentUrl, allowlist.BTC_EXPLORER_MATCHES)) {
initDebank()
} else if (isMatchURL(currentUrl, allowlist.ARKHAM_MATCHES)) {
initArkham()
} else if (isMatchURL(currentUrl, allowlist.JITO_MATCHES)) {
initJito()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@import '@common/styles/common.less';

.button {
gap: 4px;
border-radius: 6px !important;
background: @phalcon-primary-color !important;
display: flex !important;
.items-center;
}
50 changes: 50 additions & 0 deletions src/content/jito/components/PhalconExplorerButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { type FC } from 'react'
import { Button } from 'antd'

import { PHALCON_EXPLORER_DOMAIN } from '@common/config/uri'

import styles from './index.module.less'

interface Props {
txHash: string
}

const PhalconExplorerButton: FC<Props> = ({ txHash }) => {
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault()
window.open(`${PHALCON_EXPLORER_DOMAIN}/tx/solana/${txHash}`, '_blank')
}

return (
<Button
size="small"
type="primary"
className={styles.button}
onClick={handleClick}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
>
<path
d="M4.97136 6.67749C6.45817 5.96519 7.44247 5.62489 8.23283 5.35168C9.34886 4.96626 10.0843 4.71134 11.5736 3.63191C10.8564 3.30625 10.0599 3.12573 9.22201 3.12573C6.56307 3.12573 4.3298 4.94553 3.70044 7.40809C4.1005 7.1361 4.52495 6.89216 4.97258 6.67749H4.97136Z"
fill="white"
/>
<path
d="M14.0362 9.967C13.2702 11.2794 12.2737 12.2454 11.0747 12.8394C10.4759 13.137 9.89773 13.3468 9.30984 13.4822C8.79147 13.6017 8.27676 13.659 7.73643 13.659C7.08267 13.659 6.49722 13.5749 5.93494 13.4834C6.86313 14.1396 7.99744 14.525 9.2208 14.525C12.3688 14.525 14.9204 11.9734 14.9204 8.82536C14.9204 8.59118 14.9058 8.36187 14.879 8.13501C14.6399 8.8034 14.3594 9.41569 14.0374 9.96578L14.0362 9.967Z"
fill="white"
/>
<path
d="M14.996 2C14.9802 2.0183 14.9643 2.03537 14.9485 2.05367C14.3886 2.68181 13.7702 3.25629 13.1067 3.77222C9.65375 6.45922 9.42079 5.66031 5.54459 7.51791C1.40128 9.50358 1 13.4566 1 13.4566C4.85668 10.6111 6.59475 14.0104 10.7954 11.9296C15.2912 9.70238 14.996 2 14.996 2ZM8.9817 11.4136C8.9817 11.4136 7.47293 11.7759 5.50678 11.1087C5.50678 11.1087 4.66641 10.8416 3.99802 10.8416C3.99802 10.8416 4.09803 9.60725 6.97896 8.279C6.97774 8.30949 6.97652 8.33877 6.97652 8.36926C6.97652 9.47187 7.86933 10.3647 8.97194 10.3647C9.99161 10.3647 10.832 9.59993 10.9527 8.61441C10.5258 8.80103 10.0282 8.62417 9.83061 8.20947C9.71961 7.97651 9.72571 7.71672 9.82573 7.49595C9.90745 7.31544 10.0526 7.16054 10.2477 7.06784C10.277 7.0532 10.3075 7.04101 10.3368 7.03125C10.4929 6.97636 10.6454 6.90928 10.7942 6.83732C11.2906 6.59825 11.7687 6.31773 12.231 6.0189C12.7847 5.66153 13.3507 5.23464 13.7739 4.76993C13.7739 4.76993 13.0104 10.6696 8.9817 11.4148V11.4136Z"
fill="white"
/>
</svg>
Phalcon Explorer
</Button>
)
}

export default PhalconExplorerButton
1 change: 1 addition & 0 deletions src/content/jito/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as PhalconExplorerButton } from './PhalconExplorerButton'
24 changes: 24 additions & 0 deletions src/content/jito/index.tsx
Original file line number Diff line number Diff line change
@@ -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 = $(
'<span class="inline-flex align-middle" style="margin-left: 8px"></span>'
)
container.find('> div > div:not(:hidden)').append(rootEl)
createRoot(rootEl[0]).render(<PhalconExplorerButton txHash={txHash} />)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const PhalconExplorerButton: FC = () => {
onClick={handleClick}
className={styles.button}
>
Open in Phalcon Explorer
Phalcon Explorer
</Button>
</ConfigProvider>
</StyleProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const PhalconExplorerButton: FC<Props> = ({ txHash }) => {
fill="white"
/>
</svg>
Open in Phalcon Explorer
Phalcon Explorer
</Button>
)
}
Expand Down

0 comments on commit 079c2a1

Please sign in to comment.