From f6b6b85807410ac02fe5a84faca21b38798188e4 Mon Sep 17 00:00:00 2001 From: cong_wang Date: Thu, 26 Oct 2023 21:55:45 +0800 Subject: [PATCH] feat: Adapt to Polygonscan's new template, fix NFT risk radar chart issues caused by opensea updates, and repair broken links in downloaded fundflow SVGs --- CHANGELOG.md | 4 ++++ package.json | 2 +- src/common/components/Dropdown/index.module.less | 2 +- src/common/components/ModalFundFlow/dot.ts | 2 +- src/common/components/ModalFundFlow/graph.ts | 12 ++++++------ src/common/config/allowlist.ts | 5 +++-- .../opensea/feat-scripts/compliance-analysis.tsx | 4 ++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eece704..3667e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 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 + ### v4.0.1 - [fix] Resolve domain matching issues diff --git a/package.json b/package.json index f97bb4c..ca7e172 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metadock", - "version": "4.0.1", + "version": "4.1.0", "repository": { "type": "git", "url": "https://github.com/blocksecteam/metadock.git" diff --git a/src/common/components/Dropdown/index.module.less b/src/common/components/Dropdown/index.module.less index 5571256..1522fd7 100644 --- a/src/common/components/Dropdown/index.module.less +++ b/src/common/components/Dropdown/index.module.less @@ -12,7 +12,7 @@ .btn { color: #fff; - background-color: #0784c3; + background-color: var(--bs-primary); padding: 0.25rem 0.6rem; border-radius: 6px; .flex-center; diff --git a/src/common/components/ModalFundFlow/dot.ts b/src/common/components/ModalFundFlow/dot.ts index f503a35..23ca3a1 100644 --- a/src/common/components/ModalFundFlow/dot.ts +++ b/src/common/components/ModalFundFlow/dot.ts @@ -26,7 +26,7 @@ const genNode = ( tooltip="${address}" target="_blank" fixedsize="true" - width="2.9" + width="3" height="1" image="${logo || ChainUtils.getChainLogo(chain)}" label=<${ diff --git a/src/common/components/ModalFundFlow/graph.ts b/src/common/components/ModalFundFlow/graph.ts index d1d3bc9..500d1dd 100644 --- a/src/common/components/ModalFundFlow/graph.ts +++ b/src/common/components/ModalFundFlow/graph.ts @@ -97,7 +97,7 @@ export const nodeHover = ( } }) - imgPosition.analyze.x = `${Number(pathList[8][0]) + 10}` + imgPosition.analyze.x = `${Number(pathList[8][0]) + 12}` imgPosition.analyze.y = `${Number(pathList[8][1]) - 30}` } @@ -157,10 +157,6 @@ export const nodeHover = ( nodeAClone.on('mouseleave', () => { clearGraphTemp() }) - - nodeAClone.on('click', function () { - if (nodeData.url) window.open(nodeData.url) - }) } export const nodeStrokeWidthChange = ( @@ -192,6 +188,10 @@ export const initNodes = (fundFlow: FundFlowRes) => { node.select('path').attr('fill', '#f8f8f8') + node + .select('g > a') + .attr('href', fundFlow.nodes.find(v => v.id === d3Ele.key)!.url) + // Initializes the position of the image const _image = node.select('image') if (_image) { @@ -207,7 +207,7 @@ export const initNodes = (fundFlow: FundFlowRes) => { node.on('mouseenter', () => { nodeStrokeWidthChange(node, '#00a54c', '3') - nodeHover(node, d3Ele.key, fundFlow!.nodes.find(v => v.id === d3Ele.key)!) + nodeHover(node, d3Ele.key, fundFlow.nodes.find(v => v.id === d3Ele.key)!) }) node.on('mouseleave', () => { diff --git a/src/common/config/allowlist.ts b/src/common/config/allowlist.ts index b87d68b..1769549 100644 --- a/src/common/config/allowlist.ts +++ b/src/common/config/allowlist.ts @@ -1,6 +1,6 @@ export default { ETHERSCAN_V1_MATCHES: [ - '*://*.polygonscan.com/*', + '*://mumbai.polygonscan.com/*', '*://*.snowtrace.io/*', '*://optimistic.etherscan.io/*', '*://*.arbiscan.io/*', @@ -27,7 +27,8 @@ export default { '*://bscscan.com/*', '*://goto.bscscan.com/*', '*://www.bscscan.com/*', - '*://testnet.bscscan.com/*' + '*://testnet.bscscan.com/*', + '*://polygonscan.com/*' ], BTC_EXPLORER_MATCHES: ['*://explorer.btc.com/*'], BLOCKSEC_MATCHES: ['*://*.blocksec.com/*'], diff --git a/src/content/opensea/feat-scripts/compliance-analysis.tsx b/src/content/opensea/feat-scripts/compliance-analysis.tsx index 9c356f6..797e0d9 100644 --- a/src/content/opensea/feat-scripts/compliance-analysis.tsx +++ b/src/content/opensea/feat-scripts/compliance-analysis.tsx @@ -14,11 +14,11 @@ const genComplianceRadarPlot = async () => { if (originGraphEl) return const containerEl = document.querySelector( - '#main > div > div > div > div:nth-of-type(5) > div > div:nth-of-type(2) > div, #main > div > div > div:nth-of-type(5) > div > div:nth-of-type(2) > div' + '#main > main > div > div > div > div:nth-of-type(5) > div > div:nth-of-type(2) > div, #main > div > div > div:nth-of-type(5) > div > div:nth-of-type(2) > div' ) const linkEl = document.querySelector( - '#main > div > div > div > div:nth-of-type(3) > div > div > div:last-of-type > div > div > div:first-of-type > div > div > a:first-of-type, #main > div > div > div:nth-of-type(3) > div > div > div:last-of-type > div > div > div:first-of-type > div > div > a:first-of-type' + '#main > main > div > div > div > div:nth-of-type(3) > div > div > div:last-of-type > div > div > div:first-of-type > div > div > a:first-of-type, #main > div > div > div:nth-of-type(3) > div > div > div:last-of-type > div > div > div:first-of-type > div > div > a:first-of-type' ) if (!containerEl || !linkEl) return