refactor ICompilerAPI

pull/1342/head
yann300 3 years ago committed by davidzagi93@gmail.com
parent 6f451bd2ec
commit 7c75848104
  1. 1
      apps/remix-ide/src/app/tabs/compile-tab.js
  2. 2
      apps/solidity-compiler/src/app/app.tsx
  3. 42
      apps/solidity-compiler/src/app/compiler.ts
  4. 1
      libs/remix-lib/src/types/ICompilerApi.ts

@ -5,7 +5,6 @@ import { SolidityCompiler } from '@remix-ui/solidity-compiler' // eslint-disable
import { CompileTabLogic } from '@remix-ui/solidity-compiler' // eslint-disable-line import { CompileTabLogic } from '@remix-ui/solidity-compiler' // eslint-disable-line
import { CompilerApiMixin } from '@remixproject/solidity-compiler-plugin' import { CompilerApiMixin } from '@remixproject/solidity-compiler-plugin'
import { ViewPlugin } from '@remixproject/engine-web' import { ViewPlugin } from '@remixproject/engine-web'
import QueryParams from '../../lib/query-params' import QueryParams from '../../lib/query-params'
// import { ICompilerApi } from '@remix-project/remix-lib-ts' // import { ICompilerApi } from '@remix-project/remix-lib-ts'
import * as packageJson from '../../../../../package.json' import * as packageJson from '../../../../../package.json'

@ -6,7 +6,7 @@ import { CompilerClientApi } from './compiler'
const remix = new CompilerClientApi() const remix = new CompilerClientApi()
export const App = () => { export const App = () => {
return ( return (
<div> <div>
<SolidityCompiler api={remix} /> <SolidityCompiler api={remix} />

@ -2,10 +2,7 @@ import { PluginClient } from "@remixproject/plugin";
import { createClient } from "@remixproject/plugin-webview"; import { createClient } from "@remixproject/plugin-webview";
import { CompilerApiMixin } from './compiler-api' import { CompilerApiMixin } from './compiler-api'
import { ICompilerApi } from '@remix-project/remix-lib-ts' import { ICompilerApi } from '@remix-project/remix-lib-ts'
<<<<<<< HEAD
import { CompileTabLogic } from '@remix-ui/solidity-compiler' import { CompileTabLogic } from '@remix-ui/solidity-compiler'
=======
>>>>>>> 49c62946c (better org of types)
const profile = { const profile = {
name: 'solidity', name: 'solidity',
@ -26,7 +23,6 @@ const defaultAppParameters = {
includeNightlies: false includeNightlies: false
} }
<<<<<<< HEAD
const defaultCompilerParameters = { const defaultCompilerParameters = {
runs: '200', runs: '200',
optimize: false, optimize: false,
@ -34,44 +30,6 @@ const defaultCompilerParameters = {
evmVersion: null, // compiler default evmVersion: null, // compiler default
language: 'Solidity' language: 'Solidity'
} }
=======
export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements ICompilerApi {
// interface matches libs/remix-ui/solidity-compiler/types/index.ts : ICompilerApi
currentFile: string
contractMap: {
file: string
} | Record<string, any>
compileErrors: any
compileTabLogic: any
contractsDetails: Record<string, any>
configurationSettings: ConfigurationSettings
setHardHatCompilation: (value: boolean) => void
getParameters: () => ConfigurationSettings
setParameters: (params: Partial<ConfigurationSettings>) => void
setCompilerConfig: (settings: ConfigurationSettings) => void
getConfiguration: (value: string) => string
setConfiguration: (name: string, value: string) => void
getFileManagerMode: () => string
getCompilationResult: () => any
onCurrentFileChanged: (fileName: string) => void
onResetResults: () => void
onSetWorkspace: (isLocalhost: boolean) => void
onNoFileSelected: () => void
onCompilationFinished: (contractsDetails: any, contractMap: any) => void
onSessionSwitched: () => void
onContentChanged: () => void
fileExists: (file: string) => Promise<boolean>
writeFile: (file: string, content: string) => Promise<void>
readFile: (file: string) => Promise<string>
open: (file: string) => void
>>>>>>> 49c62946c (better org of types)
export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements ICompilerApi { export class CompilerClientApi extends CompilerApiMixin(PluginClient) implements ICompilerApi {
constructor () { constructor () {
super() super()

@ -28,7 +28,6 @@ export interface ICompilerApi {
onContentChanged: () => void onContentChanged: () => void
resolveContentAndSave: (url: string) => Promise<string> resolveContentAndSave: (url: string) => Promise<string>
fileExists: (file: string) => Promise<boolean> fileExists: (file: string) => Promise<boolean>
writeFile: (file: string, content: string) => Promise<void> writeFile: (file: string, content: string) => Promise<void>
readFile: (file: string) => Promise<string> readFile: (file: string) => Promise<string>

Loading…
Cancel
Save