Skip to content

Commit

Permalink
feat: Added support for Solana scans, local labels, and various web3 …
Browse files Browse the repository at this point in the history
…explorer integrations, including Arkham, Phalcon, Debank, and Merlin Scan
  • Loading branch information
0xbe37e committed May 25, 2024
1 parent 2ef5e74 commit 8866f91
Show file tree
Hide file tree
Showing 266 changed files with 5,336 additions and 739 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### v5.0.0

- [feat] Supports Solana scans
- [feat] Added local label functionality
- [feat] Supports Arkham local label functionality and Phalcon quick link, Debank local label functionality
- [feat] Supports Merlin Scan
- [feat] BTC Explorer supports local label functionality
- [feat] Etherscan supports quick opening of transaction lists in the Phalcon explorer

### v4.8.0

- [fix] Fix bug causing style conflicts
Expand Down
11 changes: 9 additions & 2 deletions manifest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ export default defineManifest((env: ConfigEnv) => {
{
matches: isDev
? [
'*://explorer.btc.com/*',
'*://*.btc.com/*',
'*://*.opensea.io/*',
'*://*.tronscan.org/*'
'*://*.tronscan.org/*',
'*://scan.merlinchain.io/*',
'*://solscan.io/*',
'*://*.solana.fm/*',
'*://*.metasleuth.io/*',
'*://explorer.solana.com/*',
'*://debank.com/*',
'*://platform.arkhamintelligence.com/*'
]
: ['<all_urls>'],
js: ['src/content/index.ts'],
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metasuites",
"version": "4.8.1",
"version": "5.0.0",
"repository": {
"type": "git",
"url": "https://github.com/blocksecteam/metasuites.git"
Expand Down Expand Up @@ -31,6 +31,7 @@
"buffer": "^6.0.3",
"chrome-extension-core": "0.1.8",
"classnames": "^2.3.2",
"colorjs.io": "^0.5.0",
"copy-to-clipboard": "^3.3.3",
"d3": "^5.0.0",
"d3-graphviz": "2.6.1",
Expand All @@ -45,6 +46,8 @@
"ky": "^0.33.3",
"lodash-es": "^4.17.21",
"normalize.css": "^8.0.1",
"papaparse": "^5.4.1",
"qs": "^6.12.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"save-svg-as-png": "^1.4.17",
Expand All @@ -62,6 +65,8 @@
"@types/json-bigint": "^1.0.1",
"@types/lodash-es": "^4.17.6",
"@types/node": "^18.11.8",
"@types/papaparse": "^5.3.14",
"@types/qs": "^6.9.15",
"@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8",
"@types/webextension-polyfill": "^0.10.0",
Expand Down
Binary file modified src/assets/images/analyze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/edit-private-label-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/oops-no-auth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/oops-service-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/oops-unauthorized-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/tab-bg-settings.png
Binary file not shown.
Binary file removed src/assets/images/tab-bg-shortcuts.png
Binary file not shown.
85 changes: 84 additions & 1 deletion src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import {
TRONSCAN_TABS_CHANGED,
LOAD_TRON_APPROVALS,
TRONSCAN_MULTI_SEARCH,
URL_UPDATED
URL_UPDATED,
GET_SOLSCAN_ACCOUNT_INFO,
GET_SOLANAFM_ACCOUNT_INFO,
GET_SOLANAFM_ACCOUNT_TRANSFERS,
GET_SOLSCAN_ACCOUNT_TAB_DATA,
GET_SOLSCAN_TRANSACTION
} from '@common/constants'

import { initBackgroundRequest } from './listeners'
Expand Down Expand Up @@ -132,4 +137,82 @@ browser.webRequest.onCompleted.addListener(
}
)

browser.webRequest.onCompleted.addListener(
async details => {
const { tabId, method } = details
if (tabId && method === 'GET') {
browser.tabs
.sendMessage(tabId, GET_SOLSCAN_ACCOUNT_INFO)
.catch(() => void 0)
}
},
{
urls: ['https://api.solscan.io/v2/account?*']
}
)

browser.webRequest.onCompleted.addListener(
async details => {
const { tabId, method } = details
if (tabId && method === 'GET') {
browser.tabs
.sendMessage(tabId, GET_SOLSCAN_ACCOUNT_TAB_DATA)
.catch(() => void 0)
}
},
{
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/activity/dextrading?*'
]
}
)

browser.webRequest.onCompleted.addListener(
async details => {
const { tabId, method } = details
if (tabId && method === 'GET') {
browser.tabs
.sendMessage(tabId, GET_SOLSCAN_TRANSACTION)
.catch(() => void 0)
}
},
{
urls: ['https://api.solscan.io/v2/transaction-v2?tx=*']
}
)

browser.webRequest.onCompleted.addListener(
async details => {
const { tabId, method } = details
if (tabId && method === 'GET') {
browser.tabs
.sendMessage(tabId, GET_SOLANAFM_ACCOUNT_INFO)
.catch(() => void 0)
}
},
{
urls: ['https://api.solana.fm/v0/accounts/*']
}
)

browser.webRequest.onCompleted.addListener(
async details => {
const { tabId, method } = details
if (tabId && method === 'GET') {
browser.tabs
.sendMessage(tabId, GET_SOLANAFM_ACCOUNT_TRANSFERS)
.catch(() => void 0)
}
},
{
urls: [
'https://api.solana.fm/v0/accounts/BNLtpXLqsjDGxzB1Mmcv3NmEiQhSSWFq8JViKrrrQ8Do/transfers?*'
]
}
)

initBackgroundRequest()
6 changes: 5 additions & 1 deletion src/background/listeners/explore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
GET_LATEST_BLOCK,
GET_CREATION_BLOCK,
GET_CONTRACT_VARIABLE_LOGS,
GET_CONTRACT_VARIABLE_LIST
GET_CONTRACT_VARIABLE_LIST,
GET_SIMULATION_FEES
} from '@common/constants'
import commonApi from '@common/api'

Expand Down Expand Up @@ -109,4 +110,7 @@ export default function initExploreRequest() {
chromeEvent.on(GET_CONTRACT_VARIABLE_LIST, async params => {
return await commonApi.getContractVariableList(params)
})
chromeEvent.on(GET_SIMULATION_FEES, async params => {
return await commonApi.getSimulationFees(params)
})
}
22 changes: 20 additions & 2 deletions src/common/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import qs from 'qs'

import request, { type BscResponse } from './request'
import type {
AddressMethodsReq,
Expand Down Expand Up @@ -39,7 +41,8 @@ import type {
CreationBlock,
PostContractVariableLogsReq,
ContractVariableLog,
ContractVariableListItem
ContractVariableListItem,
SimulationFeesParams
} from './types'

export default {
Expand Down Expand Up @@ -190,5 +193,20 @@ export default {
.post('api/v1/source-code/hash', {
json: { code }
})
.json<BscResponse<string>>()
.json<BscResponse<string>>(),
getSimulationFees: ({
chain,
isPrerun = true,
blockNumber
}: SimulationFeesParams) => {
const queryString = qs.stringify(
{ isPrerun, blockNumber: isPrerun ? null : blockNumber },
{
skipNulls: true
}
)
return request
.get(`api/v1/simulation/${chain}/base-fee?${queryString}`)
.json<BscResponse<{ baseFee: string }>>()
}
}
18 changes: 17 additions & 1 deletion src/common/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export interface PostAddressParams {
address: string
}

export interface FundFlowParams extends PostAddressParams {
token?: string
}

export interface PostPrivateVariablesParams extends PostAddressParams {
implAddress?: string
}
Expand All @@ -39,6 +43,9 @@ export interface AddressLabel {
implementAddress?: string
implementLabel?: string
implementLogo?: string
chain: string
chainId: number
isLocal?: boolean
}

export interface MethodLabel {
Expand All @@ -58,6 +65,8 @@ export interface AddressRiskScoreReq extends PostAddressParams {
export interface FundFlowRes {
nodes: FundFlowNode[]
edges: FundFlowEdge[]
code?: number
message?: string
}
export interface FundFlowNode extends Record<string, unknown> {
id: string
Expand All @@ -67,6 +76,7 @@ export interface FundFlowNode extends Record<string, unknown> {
type: number
isContract: boolean
url: string
color: string
/** used for filter */
selected?: boolean
index?: number
Expand Down Expand Up @@ -204,7 +214,7 @@ export interface PrivateVariableArgument {

export interface PrivateVariable {
name: string
inputs: { name: string; type: string }[]
inputs: { name: string; type: string; id: number }[]
outputs: { name: string; type: string }[]
value?: PrivateVariableArgument
mutability: ContractVariableMutability
Expand Down Expand Up @@ -364,3 +374,9 @@ export interface ContractVariableListItem {
mutability: ContractVariableMutability
visibility: ContractVariableVisibility
}

export interface SimulationFeesParams {
chain: string
blockNumber?: number
isPrerun: boolean
}
10 changes: 5 additions & 5 deletions src/common/components/BscModal/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
padding-left: 20px;
.justify-between;
.items-center;
.flex;
.md-flex;
.closeIcon {
padding: 20px;
cursor: pointer;
Expand All @@ -17,19 +17,19 @@
}

:global {
.ant-modal-content {
.metadock-modal-content {
border-radius: 2px !important;
padding: 0 !important;

.ant-modal-body {
.metadock-modal-body {
padding: 20px;
}
.ant-modal-header {
.metadock-modal-header {
padding: 0;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 0;
}
.ant-modal-footer {
.metadock-modal-footer {
padding: 20px;
border-top: 1px solid #f0f0f0;
text-align: left;
Expand Down
61 changes: 33 additions & 28 deletions src/common/components/BscModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Modal, type ModalProps } from 'antd'
import { Modal, type ModalProps, ConfigProvider } from 'antd'
import React, { type FC } from 'react'
import cls from 'classnames'

Expand All @@ -16,34 +16,39 @@ const BscModal: FC<ModalProps> = ({
...rest
}) => {
return (
<Modal
width={width}
zIndex={2147483647}
title={
<div className={styles.modalTitle}>
{title}
<div
className={styles.closeIcon}
onClick={e =>
onCancel?.(
e as unknown as React.MouseEvent<HTMLButtonElement, MouseEvent>
)
}
>
<IconClose />
<ConfigProvider prefixCls="metadock">
<Modal
width={width}
zIndex={2147483647}
title={
<div className={styles.modalTitle}>
{title}
<div
className={styles.closeIcon}
onClick={e =>
onCancel?.(
e as unknown as React.MouseEvent<
HTMLButtonElement,
MouseEvent
>
)
}
>
<IconClose />
</div>
</div>
</div>
}
centered
onCancel={onCancel}
className={cls(styles.bscModal, className)}
style={style}
footer={null}
closable={false}
{...rest}
>
{children}
</Modal>
}
centered
onCancel={onCancel}
className={cls(styles.bscModal, className)}
style={style}
footer={null}
closable={false}
{...rest}
>
{children}
</Modal>
</ConfigProvider>
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/components/Cell/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Cell: FC<CellProps> = props => {
style={style}
onClick={onClick}
>
<div className="items-center flex1 flex">
<div className="items-center flex1 md-flex">
{icon && <img className={styles.icon} src={icon} alt="" />}
<div className={cls(styles.title, 'flex1')}>
<span style={{ fontSize: desc ? '14px' : '12px' }}>{title}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/Cell/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
.title {
.flex-column;
.flex;
.md-flex;
span {
font-size: 14px;
&:nth-of-type(1) {
Expand Down
Loading

0 comments on commit 8866f91

Please sign in to comment.