pull/5370/head
filip mertens 12 months ago
parent 0d8fed3ca9
commit b7f4408b3d
  1. 5
      apps/remix-ide/src/app/plugins/electron/compilerLoaderPlugin.ts
  2. 27
      apps/remixdesktop/src/plugins/compilerLoader.ts
  3. 2
      libs/remix-lib/src/index.ts
  4. 14
      libs/remix-lib/src/types/ICompilerApi.ts
  5. 8
      libs/remix-ui/solidity-compiler/src/lib/api/compiler-api.ts
  6. 18
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  7. 5
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -24,7 +24,6 @@ export class compilerLoaderPluginDesktop extends ElectronPlugin {
constructor() {
super(profile)
this.methods = []
}
onActivation(): void {
@ -40,6 +39,10 @@ export class compilerLoaderPluginDesktop extends ElectronPlugin {
console.log('compilerList', compilerList)
this.emit('compilersDownloaded', compilerList)
})
this.on('compilerloader', 'setSolJsonBinData', (url) => {
console.log('setSolJsonBinData', url)
})
}

@ -45,11 +45,36 @@ const clientProfile: Profile = {
methods: ['getPort', 'downloadCompiler', 'listCompilers', 'getBaseUrls', 'getLists'],
}
export interface iSolJsonBinDataBuild {
path: string,
version: string,
build: string,
longVersion: string,
}
export interface iSolJsonBinData {
baseURLWasm: string,
baseURLBin: string,
wasmList: iSolJsonBinDataBuild[],
binList: iSolJsonBinDataBuild[]
}
class CompilerLoaderPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile)
}
async onActivation(): Promise<void> {
const lists = await this.getLists()
console.log('onActivation', (server.address() as any))
const baseURLS: iSolJsonBinData = {
baseURLWasm: 'http://localhost:' + (server.address() as any).port + '/compilers',
baseURLBin: 'http://localhost:' + (server.address() as any).port + '/compilers',
wasmList: lists.wasmData,
binList: lists.binData
}
this.emit('setSolJsonBinData', baseURLS)
}
async getPort(): Promise<number> {
return (server.address() as any).port
}
@ -153,7 +178,7 @@ const getLists = async()=>{
}
return {
binData, wasmData
binData: binData.builds as any[], wasmData: wasmData.builds as any[]
}
}

@ -17,7 +17,7 @@ import { TxRunnerVM } from './execution/txRunnerVM'
import { TxRunnerWeb3 } from './execution/txRunnerWeb3'
import * as txResultHelper from './helpers/txResultHelper'
export { ConsoleLogs } from './helpers/hhconsoleSigs'
export { ICompilerApi, ConfigurationSettings } from './types/ICompilerApi'
export { ICompilerApi, ConfigurationSettings, iSolJsonBinData, iSolJsonBinDataBuild } from './types/ICompilerApi'
export { QueryParams } from './query-params'
export { VMexecutionResult } from './execution/txRunnerVM'
export { Registry } from './registry'

@ -48,6 +48,20 @@ export interface ICompilerApi {
emit?: (key: string, ...payload: any) => void
compilersDownloaded: (list: string[]) => void
setSolJsonBinData: (binData: iSolJsonBinData) => void
}
export interface iSolJsonBinDataBuild {
path: string,
version: string,
build: string,
longVersion: string,
}
export interface iSolJsonBinData {
baseURLWasm: string,
baseURLBin: string,
wasmList: iSolJsonBinDataBuild[],
binList: iSolJsonBinDataBuild[]
}
export type terminalLog = {

@ -1,7 +1,7 @@
import React from 'react';
import { compile, helper } from '@remix-project/remix-solidity'
import { CompileTabLogic, parseContracts } from '@remix-ui/solidity-compiler' // eslint-disable-line
import type { ConfigurationSettings } from '@remix-project/remix-lib'
import type { ConfigurationSettings, iSolJsonBinData } from '@remix-project/remix-lib'
export const CompilerApiMixin = (Base) => class extends Base {
currentFile: string
@ -29,6 +29,7 @@ export const CompilerApiMixin = (Base) => class extends Base {
statusChanged: (data: { key: string, title?: string, type?: string }) => void
compilersDownloaded: (list: string[]) => void
setSolJsonBinData: (urls: iSolJsonBinData) => void
initCompilerApi () {
this.configurationSettings = null
@ -293,6 +294,11 @@ export const CompilerApiMixin = (Base) => class extends Base {
this.compilersDownloaded(list)
})
this.on('compilerloader', 'setSolJsonBinData', (urls: iSolJsonBinData) => {
console.log('basuURLS', urls)
this.setSolJsonBinData(urls)
})
this.data.eventHandlers.onCompilationFinished = async (success, data, source, input, version) => {
this.compileErrors = data
if (success) {

@ -5,8 +5,10 @@ import {ContractSelection} from './contract-selection' // eslint-disable-line
import {Toaster} from '@remix-ui/toaster' // eslint-disable-line
import {ModalDialog} from '@remix-ui/modal-dialog' // eslint-disable-line
import {Renderer} from '@remix-ui/renderer' // eslint-disable-line
import {baseURLBin, baseURLWasm} from '@remix-project/remix-solidity'
import './css/style.css'
import { iSolJsonBinData } from '@remix-project/remix-lib'
export const SolidityCompiler = (props: SolidityCompilerProps) => {
const {
@ -36,7 +38,13 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
cancelFn: () => {},
handleHide: null
},
compilersDownloaded: []
compilersDownloaded: [],
solJsonBinData: {
baseURLBin,
baseURLWasm,
binList: [],
wasmList: []
}
})
const [currentVersion, setCurrentVersion] = useState('')
const [hideWarnings, setHideWarnings] = useState<boolean>(false)
@ -142,6 +150,13 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
})
}
api.setSolJsonBinData = (urls: iSolJsonBinData) => {
setState((prevState) => {
return {...prevState, baseURLS: urls}
})
}
const setConfigFilePath = (path: string) => {
setState((prevState) => {
return {...prevState, configFilePath: path}
@ -230,6 +245,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
configFilePath={state.configFilePath}
setConfigFilePath={setConfigFilePath}
compilersDownloaded={state.compilersDownloaded}
solJsonBinData={state.solJsonBinData}
/>
{contractsFile[currentFile] && contractsFile[currentFile].contractsDetails && (

@ -1,4 +1,4 @@
import { ICompilerApi, ConfigurationSettings } from '@remix-project/remix-lib'
import { ICompilerApi, ConfigurationSettings, iSolJsonBinData } from '@remix-project/remix-lib'
import { CompileTabLogic } from '../logic/compileTabLogic'
export type onCurrentFileChanged = (fileName: string) => void
@ -22,7 +22,10 @@ export interface CompilerContainerProps {
configFilePath: string,
setConfigFilePath: (path: string) => void,
compilersDownloaded: string[]
solJsonBinData: iSolJsonBinData
}
export interface ContractSelectionProps {
api: ICompilerApi,
compiledFileName: string,

Loading…
Cancel
Save