|
|
|
@ -2,7 +2,7 @@ import { envChangeNotification } from "@remix-ui/helper" |
|
|
|
|
import { RunTab } from "../types/run-tab" |
|
|
|
|
import { setExecutionContext, setFinalContext, updateAccountBalances } from "./account" |
|
|
|
|
import { addExternalProvider, addInstance, removeExternalProvider, setNetworkNameFromProvider } from "./actions" |
|
|
|
|
import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setProxyEnvAddress, setRecorderCount, setSendValue } from "./payload" |
|
|
|
|
import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCompilationSource, setCurrentContract, setCurrentFile, setLoadType, setProxyEnvAddress, setRecorderCount, setSendValue } from "./payload" |
|
|
|
|
import { CompilerAbstract } from '@remix-project/remix-solidity' |
|
|
|
|
import * as ethJSUtil from 'ethereumjs-util' |
|
|
|
|
import Web3 from 'web3' |
|
|
|
@ -41,15 +41,17 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => { |
|
|
|
|
|
|
|
|
|
plugin.blockchain.event.register('removeProvider', name => removeExternalProvider(dispatch, name)) |
|
|
|
|
|
|
|
|
|
plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => broadcastCompilationResult(plugin, dispatch, file, source, languageVersion, data, input)) |
|
|
|
|
plugin.on('solidity', 'compilationFinished', (file, source, languageVersion, data, input, version) => broadcastCompilationResult('remix', plugin, dispatch, file, source, languageVersion, data, input)) |
|
|
|
|
|
|
|
|
|
plugin.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
plugin.on('vyper', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult('vyper', plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
|
|
|
|
|
plugin.on('lexon', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
plugin.on('lexon', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult('lexon', plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
|
|
|
|
|
plugin.on('yulp', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
plugin.on('yulp', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult('yulp', plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
|
|
|
|
|
plugin.on('nahmii-compiler', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult(plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
plugin.on('nahmii-compiler', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult('nahmii', plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
|
|
|
|
|
plugin.on('hardhat', 'compilationFinished', (file, source, languageVersion, data) => broadcastCompilationResult('hardhat', plugin, dispatch, file, source, languageVersion, data)) |
|
|
|
|
|
|
|
|
|
plugin.on('udapp', 'setEnvironmentModeReducer', (env: { context: string, fork: string }, from: string) => { |
|
|
|
|
plugin.call('notification', 'toast', envChangeNotification(env, from)) |
|
|
|
@ -92,7 +94,7 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const broadcastCompilationResult = async (plugin: RunTab, dispatch: React.Dispatch<any>, file, source, languageVersion, data, input?) => { |
|
|
|
|
const broadcastCompilationResult = async (compilerName: string, plugin: RunTab, dispatch: React.Dispatch<any>, file, source, languageVersion, data, input?) => { |
|
|
|
|
// TODO check whether the tab is configured
|
|
|
|
|
const compiler = new CompilerAbstract(languageVersion, data, source, input) |
|
|
|
|
plugin.compilersArtefacts[languageVersion] = compiler |
|
|
|
@ -119,6 +121,7 @@ const broadcastCompilationResult = async (plugin: RunTab, dispatch: React.Dispat |
|
|
|
|
} |
|
|
|
|
dispatch(fetchContractListSuccess({ [file]: contracts })) |
|
|
|
|
dispatch(setCurrentFile(file)) |
|
|
|
|
dispatch(setCompilationSource(compilerName)) |
|
|
|
|
// TODO: set current contract
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|