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. 19
      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 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,6 +241,7 @@ 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": {
@ -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: <FormattedMessage id="udapp.solScan.errModalTitle" />,
@ -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: <FormattedMessage id="udapp.solScan.successModalTitle" />,
message: 'Scan successful',
message: `Scan successful`,
okLabel: 'Close'
}
await props.plugin.call('notification', 'modal', modal)

Loading…
Cancel
Save