fix file read error

pull/4735/head
aniket-engg 6 months ago committed by Aniket
parent 7643e38bff
commit 003380a18a
  1. 2
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  2. 39
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -85,7 +85,7 @@
"udapp.solScan.modalMessage": "Contract code will be shared to third party Solidity Scan.\n Would you like to continue?", "udapp.solScan.modalMessage": "Contract code will be shared to third party Solidity Scan.\n Would you like to continue?",
"udapp.solScan.modalOkLabel": "Continue", "udapp.solScan.modalOkLabel": "Continue",
"udapp.solScan.modalCancelLabel": "Cancel", "udapp.solScan.modalCancelLabel": "Cancel",
"udapp.solScan.errModalTitle": "Error", "udapp.solScan.errModalTitle": "Scanning error",
"udapp._comment_recorderCardUI.tsx": "libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx", "udapp._comment_recorderCardUI.tsx": "libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx",
"udapp.transactionsRecorded": "Transactions recorded", "udapp.transactionsRecorded": "Transactions recorded",

@ -223,40 +223,8 @@ export function UniversalDappUI(props: UdappProps) {
await props.plugin.call('notification', 'toast', 'Running scan...') await props.plugin.call('notification', 'toast', 'Running scan...')
const workspace = await props.plugin.call('filePanel', 'getCurrentWorkspace') const workspace = await props.plugin.call('filePanel', 'getCurrentWorkspace')
const fileName = props.instance.filePath || `${workspace.name}/${props.instance.contractData.contract.file}` const fileName = props.instance.filePath || `${workspace.name}/${props.instance.contractData.contract.file}`
// const existsOrNot = await props.plugin.call('fileManager', 'exists', fileName) const filePath = `.workspaces/${fileName}`
// console.log('existsOrNot---->', existsOrNot) const file = await props.plugin.call('fileManager', 'readFile', filePath)
// const file = await props.plugin.call('fileManager', 'readFile', fileName)
const file = `// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
* @custom:dev-run-script ./scripts/deploy_with_ethers.ts
*/
contract Storage {
constructor() payable {}
uint256 number;
/**
* @dev Store value in variable
* @param num value to store
*/
function store(uint256 num) public {
number = num;
}
/**
* @dev Return value
* @return value of 'number'
*/
function retrieve() public view returns (uint256){
return number;
}
}`
const urlResponse = await axios.post(`https://solidityscan.remixproject.org/`, { const urlResponse = await axios.post(`https://solidityscan.remixproject.org/`, {
file, file,
@ -271,11 +239,12 @@ export function UniversalDappUI(props: UdappProps) {
ws.addEventListener('error', console.error); ws.addEventListener('error', console.error);
ws.addEventListener('open', (event) => { ws.addEventListener('open', (event) => {
console.log('Connected to the solidityscan server.') console.log('Connected to the server.')
}) })
ws.addEventListener('message', async (event) => { ws.addEventListener('message', async (event) => {
const data = JSON.parse(event.data) const data = JSON.parse(event.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.") {
const reqToInitScan = { const reqToInitScan = {
"action": "message", "action": "message",

Loading…
Cancel
Save