get artifacts from file

pull/5370/head
aniket-engg 3 years ago committed by Aniket
parent 318ee6ddb6
commit 1bf9f9f727
  1. 1
      apps/remix-ide/src/remixAppManager.js
  2. 8
      libs/remix-core-plugin/src/lib/compiler-artefacts.ts

@ -114,6 +114,7 @@ export class RemixAppManager extends PluginManager {
const res = await fetch(this.pluginsDirectory) const res = await fetch(this.pluginsDirectory)
plugins = await res.json() plugins = await res.json()
plugins = plugins.filter((plugin) => { plugins = plugins.filter((plugin) => {
if(plugin.name === 'scriptRunner') plugin.url = 'http://127.0.0.1:8081'
if (plugin.targets && Array.isArray(plugin.targets) && plugin.targets.length > 0) { if (plugin.targets && Array.isArray(plugin.targets) && plugin.targets.length > 0) {
return (plugin.targets.includes('remix')) return (plugin.targets.includes('remix'))
} }

@ -80,12 +80,12 @@ export class CompilerArtefacts extends Plugin {
const artefactsFilePaths = fileList.filter(filePath => { const artefactsFilePaths = fileList.filter(filePath => {
const filenameArr = filePath.split('/') const filenameArr = filePath.split('/')
const filename = filenameArr[filenameArr.length - 1] const filename = filenameArr[filenameArr.length - 1]
if (filename === `${contractName}.json` || filename === `${contractName}_metadata.json`) return true if (filename === `${contractName}_fullOP.json`) return true
}) })
if (artefactsFilePaths && artefactsFilePaths.length) { if (artefactsFilePaths && artefactsFilePaths.length) {
const content = await this.call('fileManager', 'readFile', artefactsFilePaths[1]) const content = await this.call('fileManager', 'readFile', artefactsFilePaths[0])
const artifacts = JSON.parse(content) const artifacts = JSON.parse(content)
return { abi: artifacts.abi, bytecode: artifacts.data.bytecode.object } return artifacts
} else { } else {
for (const dirPath of dirList) { for (const dirPath of dirList) {
const result = await this.getArtefactsFromFE (dirPath, contractName) const result = await this.getArtefactsFromFE (dirPath, contractName)
@ -106,7 +106,7 @@ export class CompilerArtefacts extends Plugin {
const contractsData = Object.values(contractsDataByFilename) const contractsData = Object.values(contractsDataByFilename)
if (contractsData && contractsData.length) { if (contractsData && contractsData.length) {
const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName)) const index = contractsData.findIndex((contractsObj) => Object.keys(contractsObj).includes(contractName))
if (index !== -1) return { abi: contractsData[index][contractName].abi, bytecode: contractsData[index][contractName].evm.bytecode.object } if (index !== -1) return contractsData[index][contractName]
else { else {
const result = await this.getArtefactsFromFE ('contracts', contractName) const result = await this.getArtefactsFromFE ('contracts', contractName)
if (result) return result if (result) return result

Loading…
Cancel
Save