Skip to content

Commit

Permalink
feat: Adapt Mumbai and Fantom to new template, add label to contract …
Browse files Browse the repository at this point in the history
…creator address, fix UTC time format bug in variable history table
  • Loading branch information
0xbe37e committed Nov 10, 2023
1 parent f6b6b85 commit d0d9b66
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 12 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
### v4.1.1

- [feat] Adapt Mumbai and Fantom's new look
- [feat] Add label to contract creator address
- [fix] Fix UTC time format bug in variable history

### v4.1.0

[feat] Adapt to the new template of Polygonscan [fix] Resolve NFT risk radar chart malfunction due to opensea website updates [fix] Correct invalid redirect links in the downloaded fundflow SVG images
- [feat] Adapt to the new template of Polygonscan
- [fix] Resolve NFT risk radar chart malfunction due to opensea website updates
- [fix] Correct invalid redirect links in the downloaded fundflow SVG images

### v4.0.1

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": "metadock",
"version": "4.1.0",
"version": "4.1.1",
"repository": {
"type": "git",
"url": "https://github.com/blocksecteam/metadock.git"
Expand Down
4 changes: 3 additions & 1 deletion src/common/components/ModalContractVariableLogs/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const columns = (
width: 220,
render: (timestamp: number, record) => {
if (record.isHolder) return ''
const formattedDate = dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss')
const formattedDate = dayjs(timestamp)
.utc()
.format('YYYY-MM-DD HH:mm:ss')
return (
<span>
{utc2locale
Expand Down
8 changes: 5 additions & 3 deletions src/common/config/allowlist.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default {
ETHERSCAN_V1_MATCHES: [
'*://mumbai.polygonscan.com/*',
'*://zkevm.polygonscan.com/*',
'*://*.snowtrace.io/*',
'*://optimistic.etherscan.io/*',
'*://*.arbiscan.io/*',
'*://*.ftmscan.com/*',
'*://testnet.ftmscan.com/*',
'*://cronoscan.com/*',
'*://*.moonscan.io/*',
'*://*.basescan.org/*',
Expand All @@ -18,6 +18,7 @@ export default {
'*://goerli-optimism.etherscan.io/*'
],
ETHERSCAN_V2_MATCHES: [
'*://ftmscan.com/*',
'*://cn.etherscan.com/*',
'*://goto.etherscan.com/*',
'*://sepolia.etherscan.io/*',
Expand All @@ -28,7 +29,8 @@ export default {
'*://goto.bscscan.com/*',
'*://www.bscscan.com/*',
'*://testnet.bscscan.com/*',
'*://polygonscan.com/*'
'*://polygonscan.com/*',
'*://mumbai.polygonscan.com/*'
],
BTC_EXPLORER_MATCHES: ['*://explorer.btc.com/*'],
BLOCKSEC_MATCHES: ['*://*.blocksec.com/*'],
Expand Down
12 changes: 10 additions & 2 deletions src/common/constants/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ export const TABLE_LIST_ADDRESS_SELECTORS =
export const TABLE_LIST_METHOD_SELECTORS =
'.card tbody .u-label.u-label--info, maindiv tbody .u-label.u-label--info'

/** *scans address v2 */
/** etherscan address */
export const TABLE_LIST_ADDRESS_SELECTORS_V2 =
".card tbody *:has(+ a.js-clipboard[aria-label='Copy Address'])"

/** *scans methods v2 */
/** etherscan methods */
export const TABLE_LIST_METHOD_SELECTORS_V2 =
'.table-responsive table tbody span.d-block.badge.text-truncate'

/** *scans address */
export const TR_CONTRACT_ADDRESS_SELECTORS =
"#ContentPlaceHolder1_trContract a.hash-tag[href*='/address/']"

/** etherscan address */
export const TR_CONTRACT_ADDRESS_SELECTORS_V2 =
"#ContentPlaceHolder1_trContract a[href*='/address/']"
7 changes: 5 additions & 2 deletions src/content/etherscan/feat-scripts/enhanced-labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { chromeEvent } from '@common/event'
import type { AddressLabel } from '@common/api/types'
import {
GET_ADDRESS_LABELS,
TABLE_LIST_ADDRESS_SELECTORS_V2
TABLE_LIST_ADDRESS_SELECTORS_V2,
TR_CONTRACT_ADDRESS_SELECTORS_V2
} from '@common/constants'
import { widthScanV2Tooltip } from '@common/hoc'
import { TokenSymbol } from '@common/components'
Expand Down Expand Up @@ -59,7 +60,9 @@ const handleReplace = async (

/** enhanced address label */
const genEnhancedLabels = async (chain: string) => {
const addressTags = $(TABLE_LIST_ADDRESS_SELECTORS_V2).toArray()
const addressTags = $(
`${TABLE_LIST_ADDRESS_SELECTORS_V2}, ${TR_CONTRACT_ADDRESS_SELECTORS_V2}`
).toArray()
const iframes = document.querySelectorAll('iframe')

function handleCollectReplaceTarget(nodeList: HTMLElement[]) {
Expand Down
5 changes: 3 additions & 2 deletions src/content/scans/feat-scripts/enhanced-labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { chromeEvent } from '@common/event'
import type { AddressLabel } from '@common/api/types'
import {
GET_ADDRESS_LABELS,
TABLE_LIST_ADDRESS_SELECTORS
TABLE_LIST_ADDRESS_SELECTORS,
TR_CONTRACT_ADDRESS_SELECTORS
} from '@common/constants'
import { CopyButton, TokenSymbol } from '@common/components'

Expand Down Expand Up @@ -62,7 +63,7 @@ const handleReplace = async (
/** enhanced address label */
const genEnhancedLabels = async (chain: string) => {
const addressTags = document.querySelectorAll<HTMLElement>(
TABLE_LIST_ADDRESS_SELECTORS
`${TABLE_LIST_ADDRESS_SELECTORS}, ${TR_CONTRACT_ADDRESS_SELECTORS}`
)
const iframes = document.querySelectorAll('iframe')

Expand Down

0 comments on commit d0d9b66

Please sign in to comment.