From cb1dc8cea42451097c9644170757959e9afc0b47 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 3 Jun 2024 21:01:15 +0530 Subject: [PATCH] successful scan --- .../src/lib/components/solScanTable.tsx | 26 +++++++++++++++++++ .../src/lib/components/universalDappUI.tsx | 21 ++++++++++----- 2 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx diff --git a/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx b/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx new file mode 100644 index 0000000000..81fec80473 --- /dev/null +++ b/libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx @@ -0,0 +1,26 @@ +// eslint-disable-next-line no-use-before-define +import React from 'react' + +interface SolScanTableProps { + scanDetails: Record[] +} + +export function SolScanTable(props: SolScanTableProps) { + + return ( + + + + + + + + + + + + + +
h1h2
r1r2
+ ) +} diff --git a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx index 420ad0e138..9fbf8f23eb 100644 --- a/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx @@ -226,10 +226,7 @@ export function UniversalDappUI(props: UdappProps) { const filePath = `.workspaces/${fileName}` const file = await props.plugin.call('fileManager', 'readFile', filePath) - const urlResponse = await axios.post(`https://solidityscan.remixproject.org/`, { - file, - fileName - }) + const urlResponse = await axios.post(`https://solidityscan.remixproject.org/uploadFile`, { file, fileName}) if (urlResponse.data.status === 'success') { const ws = new WebSocket('wss://solidityscan.remixproject.org/solidityscan') @@ -244,13 +241,14 @@ export function UniversalDappUI(props: UdappProps) { const data = JSON.parse(event.data) console.log('data---->', data) if (data.type === "auth_token_register" && data.payload.message === "Auth token registered.") { + // Message on Bearer token successful registration const reqToInitScan = { "action": "message", "payload": { "type": "private_project_scan_initiate", "body": { "file_urls": [ - urlResponse.data.result.url + urlResponse.data.result.url ], "project_name": "RemixProject", "project_type": "new" @@ -259,6 +257,8 @@ export function UniversalDappUI(props: UdappProps) { } ws.send(JSON.stringify(reqToInitScan)) } else if (data.type === "scan_status" && data.payload.scan_status === "download_failed") { + // Message on failed scan + const modal: AppModal = { id: 'SolidityScanError', title: , @@ -267,12 +267,21 @@ export function UniversalDappUI(props: UdappProps) { } await props.plugin.call('notification', 'modal', modal) } else if (data.type === "scan_status" && data.payload.scan_status === "scan_done") { + // Message on successful scan + console.log('data.payload--->', data.payload) + const url = data.payload.scan_details.link + + const {data: scanData} = await axios.post('https://solidityscan.remixproject.org/downloadResult', { url }) + console.log('scanData--->', scanData) + const scanDetails = scanData.scan_report.multi_file_scan_details + console.log('scanDetails--->', scanDetails) + const modal: AppModal = { id: 'SolidityScanSuccess', title: , - message: 'Scan successful', + message: `Scan successful`, okLabel: 'Close' } await props.plugin.call('notification', 'modal', modal)