successful scan

pull/4735/head
aniket-engg 6 months ago committed by Aniket
parent b3ebe7544a
commit cb1dc8cea4
  1. 26
      libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx
  2. 21
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -0,0 +1,26 @@
// eslint-disable-next-line no-use-before-define
import React from 'react'
interface SolScanTableProps {
scanDetails: Record<string, any>[]
}
export function SolScanTable(props: SolScanTableProps) {
return (
<table className="table h6 table-sm">
<thead>
<tr>
<td scope="col">h1</td>
<td scope="col">h2</td>
</tr>
</thead>
<tbody>
<tr>
<td scope="col">r1</td>
<td scope="col">r2</td>
</tr>
</tbody>
</table>
)
}

@ -226,10 +226,7 @@ export function UniversalDappUI(props: UdappProps) {
const filePath = `.workspaces/${fileName}` const filePath = `.workspaces/${fileName}`
const file = await props.plugin.call('fileManager', 'readFile', filePath) const file = await props.plugin.call('fileManager', 'readFile', filePath)
const urlResponse = await axios.post(`https://solidityscan.remixproject.org/`, { const urlResponse = await axios.post(`https://solidityscan.remixproject.org/uploadFile`, { file, fileName})
file,
fileName
})
if (urlResponse.data.status === 'success') { if (urlResponse.data.status === 'success') {
const ws = new WebSocket('wss://solidityscan.remixproject.org/solidityscan') const ws = new WebSocket('wss://solidityscan.remixproject.org/solidityscan')
@ -244,13 +241,14 @@ export function UniversalDappUI(props: UdappProps) {
const data = JSON.parse(event.data) const data = JSON.parse(event.data)
console.log('data---->', data) console.log('data---->', data)
if (data.type === "auth_token_register" && data.payload.message === "Auth token registered.") { if (data.type === "auth_token_register" && data.payload.message === "Auth token registered.") {
// Message on Bearer token successful registration
const reqToInitScan = { const reqToInitScan = {
"action": "message", "action": "message",
"payload": { "payload": {
"type": "private_project_scan_initiate", "type": "private_project_scan_initiate",
"body": { "body": {
"file_urls": [ "file_urls": [
urlResponse.data.result.url urlResponse.data.result.url
], ],
"project_name": "RemixProject", "project_name": "RemixProject",
"project_type": "new" "project_type": "new"
@ -259,6 +257,8 @@ export function UniversalDappUI(props: UdappProps) {
} }
ws.send(JSON.stringify(reqToInitScan)) ws.send(JSON.stringify(reqToInitScan))
} else if (data.type === "scan_status" && data.payload.scan_status === "download_failed") { } else if (data.type === "scan_status" && data.payload.scan_status === "download_failed") {
// Message on failed scan
const modal: AppModal = { const modal: AppModal = {
id: 'SolidityScanError', id: 'SolidityScanError',
title: <FormattedMessage id="udapp.solScan.errModalTitle" />, title: <FormattedMessage id="udapp.solScan.errModalTitle" />,
@ -267,12 +267,21 @@ export function UniversalDappUI(props: UdappProps) {
} }
await props.plugin.call('notification', 'modal', modal) await props.plugin.call('notification', 'modal', modal)
} else if (data.type === "scan_status" && data.payload.scan_status === "scan_done") { } else if (data.type === "scan_status" && data.payload.scan_status === "scan_done") {
// Message on successful scan
console.log('data.payload--->', data.payload) 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 = { const modal: AppModal = {
id: 'SolidityScanSuccess', id: 'SolidityScanSuccess',
title: <FormattedMessage id="udapp.solScan.successModalTitle" />, title: <FormattedMessage id="udapp.solScan.successModalTitle" />,
message: 'Scan successful', message: `Scan successful`,
okLabel: 'Close' okLabel: 'Close'
} }
await props.plugin.call('notification', 'modal', modal) await props.plugin.call('notification', 'modal', modal)

Loading…
Cancel
Save