|
|
|
@ -1,57 +1,74 @@ |
|
|
|
|
'use strict' |
|
|
|
|
import { RunTab, makeUdapp } from './app/udapp' |
|
|
|
|
import { RemixEngine } from './remixEngine' |
|
|
|
|
import { RemixAppManager } from './remixAppManager' |
|
|
|
|
import { ThemeModule } from './app/tabs/theme-module' |
|
|
|
|
import { LocaleModule } from './app/tabs/locale-module' |
|
|
|
|
import { NetworkModule } from './app/tabs/network-module' |
|
|
|
|
import { Web3ProviderModule } from './app/tabs/web3-provider' |
|
|
|
|
import { CompileAndRun } from './app/tabs/compile-and-run' |
|
|
|
|
import { SidePanel } from './app/components/side-panel' |
|
|
|
|
import { HiddenPanel } from './app/components/hidden-panel' |
|
|
|
|
import { VerticalIcons } from './app/components/vertical-icons' |
|
|
|
|
import { LandingPage } from './app/ui/landing-page/landing-page' |
|
|
|
|
import { MainPanel } from './app/components/main-panel' |
|
|
|
|
import { PermissionHandlerPlugin } from './app/plugins/permission-handler-plugin' |
|
|
|
|
import { AstWalker } from '@remix-project/remix-astwalker' |
|
|
|
|
import { LinkLibraries, DeployLibraries, OpenZeppelinProxy } from '@remix-project/core-plugin' |
|
|
|
|
import { CodeParser } from './app/plugins/parser/code-parser' |
|
|
|
|
import { SolidityScript } from './app/plugins/solidity-script' |
|
|
|
|
|
|
|
|
|
import { WalkthroughService } from './walkthroughService' |
|
|
|
|
|
|
|
|
|
import { OffsetToLineColumnConverter, CompilerMetadata, CompilerArtefacts, FetchAndCompile, CompilerImports, GistHandler } from '@remix-project/core-plugin' |
|
|
|
|
import {RunTab, makeUdapp} from './app/udapp' |
|
|
|
|
import {RemixEngine} from './remixEngine' |
|
|
|
|
import {RemixAppManager} from './remixAppManager' |
|
|
|
|
import {ThemeModule} from './app/tabs/theme-module' |
|
|
|
|
import {LocaleModule} from './app/tabs/locale-module' |
|
|
|
|
import {NetworkModule} from './app/tabs/network-module' |
|
|
|
|
import {Web3ProviderModule} from './app/tabs/web3-provider' |
|
|
|
|
import {CompileAndRun} from './app/tabs/compile-and-run' |
|
|
|
|
import {SidePanel} from './app/components/side-panel' |
|
|
|
|
import {HiddenPanel} from './app/components/hidden-panel' |
|
|
|
|
import {VerticalIcons} from './app/components/vertical-icons' |
|
|
|
|
import {LandingPage} from './app/ui/landing-page/landing-page' |
|
|
|
|
import {MainPanel} from './app/components/main-panel' |
|
|
|
|
import {PermissionHandlerPlugin} from './app/plugins/permission-handler-plugin' |
|
|
|
|
import {AstWalker} from '@remix-project/remix-astwalker' |
|
|
|
|
import { |
|
|
|
|
LinkLibraries, |
|
|
|
|
DeployLibraries, |
|
|
|
|
OpenZeppelinProxy |
|
|
|
|
} from '@remix-project/core-plugin' |
|
|
|
|
import {CodeParser} from './app/plugins/parser/code-parser' |
|
|
|
|
import {SolidityScript} from './app/plugins/solidity-script' |
|
|
|
|
|
|
|
|
|
import {WalkthroughService} from './walkthroughService' |
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
OffsetToLineColumnConverter, |
|
|
|
|
CompilerMetadata, |
|
|
|
|
CompilerArtefacts, |
|
|
|
|
FetchAndCompile, |
|
|
|
|
CompilerImports, |
|
|
|
|
GistHandler |
|
|
|
|
} from '@remix-project/core-plugin' |
|
|
|
|
|
|
|
|
|
import Registry from './app/state/registry' |
|
|
|
|
import { ConfigPlugin } from './app/plugins/config' |
|
|
|
|
import { StoragePlugin } from './app/plugins/storage' |
|
|
|
|
import { Layout } from './app/panels/layout' |
|
|
|
|
import { NotificationPlugin } from './app/plugins/notification' |
|
|
|
|
import { Blockchain } from './blockchain/blockchain' |
|
|
|
|
import { MergeVMProvider, LondonVMProvider, BerlinVMProvider, ShanghaiVMProvider } from './app/providers/vm-provider' |
|
|
|
|
import { MainnetForkVMProvider } from './app/providers/mainnet-vm-fork-provider' |
|
|
|
|
import { SepoliaForkVMProvider } from './app/providers/sepolia-vm-fork-provider' |
|
|
|
|
import { GoerliForkVMProvider } from './app/providers/goerli-vm-fork-provider' |
|
|
|
|
import { CustomForkVMProvider } from './app/providers/custom-vm-fork-provider' |
|
|
|
|
import { HardhatProvider } from './app/providers/hardhat-provider' |
|
|
|
|
import { GanacheProvider } from './app/providers/ganache-provider' |
|
|
|
|
import { FoundryProvider } from './app/providers/foundry-provider' |
|
|
|
|
import { ExternalHttpProvider } from './app/providers/external-http-provider' |
|
|
|
|
import { InjectedProviderDefault } from './app/providers/injected-provider-default' |
|
|
|
|
import { InjectedProviderTrustWallet } from './app/providers/injected-provider-trustwallet' |
|
|
|
|
import { Injected0ptimismProvider } from './app/providers/injected-optimism-provider' |
|
|
|
|
import { InjectedArbitrumOneProvider } from './app/providers/injected-arbitrum-one-provider' |
|
|
|
|
import { FileDecorator } from './app/plugins/file-decorator' |
|
|
|
|
import { CodeFormat } from './app/plugins/code-format' |
|
|
|
|
import { SolidityUmlGen } from './app/plugins/solidity-umlgen' |
|
|
|
|
import { ContractFlattener } from './app/plugins/contractFlattener' |
|
|
|
|
import {ConfigPlugin} from './app/plugins/config' |
|
|
|
|
import {StoragePlugin} from './app/plugins/storage' |
|
|
|
|
import {Layout} from './app/panels/layout' |
|
|
|
|
import {NotificationPlugin} from './app/plugins/notification' |
|
|
|
|
import {Blockchain} from './blockchain/blockchain' |
|
|
|
|
import { |
|
|
|
|
MergeVMProvider, |
|
|
|
|
LondonVMProvider, |
|
|
|
|
BerlinVMProvider, |
|
|
|
|
ShanghaiVMProvider |
|
|
|
|
} from './app/providers/vm-provider' |
|
|
|
|
import {MainnetForkVMProvider} from './app/providers/mainnet-vm-fork-provider' |
|
|
|
|
import {SepoliaForkVMProvider} from './app/providers/sepolia-vm-fork-provider' |
|
|
|
|
import {GoerliForkVMProvider} from './app/providers/goerli-vm-fork-provider' |
|
|
|
|
import {CustomForkVMProvider} from './app/providers/custom-vm-fork-provider' |
|
|
|
|
import {HardhatProvider} from './app/providers/hardhat-provider' |
|
|
|
|
import {GanacheProvider} from './app/providers/ganache-provider' |
|
|
|
|
import {FoundryProvider} from './app/providers/foundry-provider' |
|
|
|
|
import {ExternalHttpProvider} from './app/providers/external-http-provider' |
|
|
|
|
import {InjectedProviderDefault} from './app/providers/injected-provider-default' |
|
|
|
|
import {InjectedProviderTrustWallet} from './app/providers/injected-provider-trustwallet' |
|
|
|
|
import {Injected0ptimismProvider} from './app/providers/injected-optimism-provider' |
|
|
|
|
import {InjectedEphemeryTestnetProvider} from './app/providers/injected-ephemery-testnet-provider' |
|
|
|
|
import {InjectedArbitrumOneProvider} from './app/providers/injected-arbitrum-one-provider' |
|
|
|
|
import {FileDecorator} from './app/plugins/file-decorator' |
|
|
|
|
import {CodeFormat} from './app/plugins/code-format' |
|
|
|
|
import {SolidityUmlGen} from './app/plugins/solidity-umlgen' |
|
|
|
|
import {ContractFlattener} from './app/plugins/contractFlattener' |
|
|
|
|
|
|
|
|
|
const isElectron = require('is-electron') |
|
|
|
|
|
|
|
|
|
const remixLib = require('@remix-project/remix-lib') |
|
|
|
|
|
|
|
|
|
import { QueryParams } from '@remix-project/remix-lib' |
|
|
|
|
import { SearchPlugin } from './app/tabs/search' |
|
|
|
|
import {QueryParams} from '@remix-project/remix-lib' |
|
|
|
|
import {SearchPlugin} from './app/tabs/search' |
|
|
|
|
|
|
|
|
|
const Storage = remixLib.Storage |
|
|
|
|
const RemixDProvider = require('./app/files/remixDProvider') |
|
|
|
@ -67,12 +84,12 @@ const PluginManagerComponent = require('./app/components/plugin-manager-componen |
|
|
|
|
const CompileTab = require('./app/tabs/compile-tab') |
|
|
|
|
const SettingsTab = require('./app/tabs/settings-tab') |
|
|
|
|
const AnalysisTab = require('./app/tabs/analysis-tab') |
|
|
|
|
const { DebuggerTab } = require('./app/tabs/debugger-tab') |
|
|
|
|
const {DebuggerTab} = require('./app/tabs/debugger-tab') |
|
|
|
|
const TestTab = require('./app/tabs/test-tab') |
|
|
|
|
const FilePanel = require('./app/panels/file-panel') |
|
|
|
|
const Editor = require('./app/editor/editor') |
|
|
|
|
const Terminal = require('./app/panels/terminal') |
|
|
|
|
const { TabProxy } = require('./app/panels/tab-proxy.js') |
|
|
|
|
const {TabProxy} = require('./app/panels/tab-proxy.js') |
|
|
|
|
|
|
|
|
|
class AppComponent { |
|
|
|
|
constructor() { |
|
|
|
@ -84,7 +101,7 @@ class AppComponent { |
|
|
|
|
|
|
|
|
|
// load app config
|
|
|
|
|
const config = new Config(configStorage) |
|
|
|
|
Registry.getInstance().put({ api: config, name: 'config' }) |
|
|
|
|
Registry.getInstance().put({api: config, name: 'config'}) |
|
|
|
|
|
|
|
|
|
// load file system
|
|
|
|
|
this._components.filesProviders = {} |
|
|
|
@ -119,7 +136,7 @@ class AppComponent { |
|
|
|
|
this.panels = {} |
|
|
|
|
this.workspace = pluginLoader.get() |
|
|
|
|
this.engine = new RemixEngine() |
|
|
|
|
this.engine.register(appManager); |
|
|
|
|
this.engine.register(appManager) |
|
|
|
|
|
|
|
|
|
const matomoDomains = { |
|
|
|
|
'remix-alpha.ethereum.org': 27, |
|
|
|
@ -153,19 +170,19 @@ class AppComponent { |
|
|
|
|
this.themeModule = new ThemeModule() |
|
|
|
|
// ----------------- locale service ---------------------------------
|
|
|
|
|
this.localeModule = new LocaleModule() |
|
|
|
|
Registry.getInstance().put({ api: this.themeModule, name: 'themeModule' }) |
|
|
|
|
Registry.getInstance().put({ api: this.localeModule, name: 'localeModule' }) |
|
|
|
|
Registry.getInstance().put({api: this.themeModule, name: 'themeModule'}) |
|
|
|
|
Registry.getInstance().put({api: this.localeModule, name: 'localeModule'}) |
|
|
|
|
|
|
|
|
|
// ----------------- editor service ----------------------------
|
|
|
|
|
const editor = new Editor() // wrapper around ace editor
|
|
|
|
|
Registry.getInstance().put({ api: editor, name: 'editor' }) |
|
|
|
|
Registry.getInstance().put({api: editor, name: 'editor'}) |
|
|
|
|
editor.event.register('requiringToSaveCurrentfile', () => |
|
|
|
|
fileManager.saveCurrentFile() |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// ----------------- fileManager service ----------------------------
|
|
|
|
|
const fileManager = new FileManager(editor, appManager) |
|
|
|
|
Registry.getInstance().put({ api: fileManager, name: 'filemanager' }) |
|
|
|
|
Registry.getInstance().put({api: fileManager, name: 'filemanager'}) |
|
|
|
|
// ----------------- dGit provider ---------------------------------
|
|
|
|
|
const dGitProvider = new DGitProvider() |
|
|
|
|
|
|
|
|
@ -220,9 +237,11 @@ class AppComponent { |
|
|
|
|
const foundryProvider = new FoundryProvider(blockchain) |
|
|
|
|
const externalHttpProvider = new ExternalHttpProvider(blockchain) |
|
|
|
|
const trustWalletInjectedProvider = new InjectedProviderTrustWallet() |
|
|
|
|
const defaultInjectedProvider = new InjectedProviderDefault |
|
|
|
|
const defaultInjectedProvider = new InjectedProviderDefault() |
|
|
|
|
const injected0ptimismProvider = new Injected0ptimismProvider() |
|
|
|
|
const injectedArbitrumOneProvider = new InjectedArbitrumOneProvider() |
|
|
|
|
const injectedEphemeryTestnetProvider = |
|
|
|
|
new InjectedEphemeryTestnetProvider() |
|
|
|
|
// ----------------- convert offset to line/column service -----------
|
|
|
|
|
const offsetToLineColumnConverter = new OffsetToLineColumnConverter() |
|
|
|
|
Registry.getInstance().put({ |
|
|
|
@ -232,11 +251,13 @@ class AppComponent { |
|
|
|
|
// ----------------- run script after each compilation results -----------
|
|
|
|
|
const compileAndRun = new CompileAndRun() |
|
|
|
|
// -------------------Terminal----------------------------------------
|
|
|
|
|
makeUdapp(blockchain, compilersArtefacts, domEl => terminal.logHtml(domEl)) |
|
|
|
|
makeUdapp(blockchain, compilersArtefacts, (domEl) => |
|
|
|
|
terminal.logHtml(domEl) |
|
|
|
|
) |
|
|
|
|
const terminal = new Terminal( |
|
|
|
|
{ appManager, blockchain }, |
|
|
|
|
{appManager, blockchain}, |
|
|
|
|
{ |
|
|
|
|
getPosition: event => { |
|
|
|
|
getPosition: (event) => { |
|
|
|
|
const limitUp = 36 |
|
|
|
|
const limitDown = 20 |
|
|
|
|
const height = window.innerHeight |
|
|
|
@ -298,6 +319,7 @@ class AppComponent { |
|
|
|
|
trustWalletInjectedProvider, |
|
|
|
|
injected0ptimismProvider, |
|
|
|
|
injectedArbitrumOneProvider, |
|
|
|
|
injectedEphemeryTestnetProvider, |
|
|
|
|
this.walkthroughService, |
|
|
|
|
search, |
|
|
|
|
solidityumlgen, |
|
|
|
@ -307,7 +329,7 @@ class AppComponent { |
|
|
|
|
|
|
|
|
|
// LAYOUT & SYSTEM VIEWS
|
|
|
|
|
const appPanel = new MainPanel() |
|
|
|
|
Registry.getInstance().put({ api: this.mainview, name: 'mainview' }) |
|
|
|
|
Registry.getInstance().put({api: this.mainview, name: 'mainview'}) |
|
|
|
|
const tabProxy = new TabProxy(fileManager, editor) |
|
|
|
|
this.engine.register([appPanel, tabProxy]) |
|
|
|
|
|
|
|
|
@ -391,10 +413,10 @@ class AppComponent { |
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
this.layout.panels = { |
|
|
|
|
tabs: { plugin: tabProxy, active: true }, |
|
|
|
|
editor: { plugin: editor, active: true }, |
|
|
|
|
main: { plugin: appPanel, active: false }, |
|
|
|
|
terminal: { plugin: terminal, active: true, minimized: false } |
|
|
|
|
tabs: {plugin: tabProxy, active: true}, |
|
|
|
|
editor: {plugin: editor, active: true}, |
|
|
|
|
main: {plugin: appPanel, active: false}, |
|
|
|
|
terminal: {plugin: terminal, active: true, minimized: false} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -410,14 +432,41 @@ class AppComponent { |
|
|
|
|
await this.appManager.activatePlugin(['layout']) |
|
|
|
|
await this.appManager.activatePlugin(['notification']) |
|
|
|
|
await this.appManager.activatePlugin(['editor']) |
|
|
|
|
await this.appManager.activatePlugin(['permissionhandler', 'theme', 'locale', 'fileManager', 'compilerMetadata', 'compilerArtefacts', 'network', 'web3Provider', 'offsetToLineColumnConverter']) |
|
|
|
|
await this.appManager.activatePlugin([ |
|
|
|
|
'permissionhandler', |
|
|
|
|
'theme', |
|
|
|
|
'locale', |
|
|
|
|
'fileManager', |
|
|
|
|
'compilerMetadata', |
|
|
|
|
'compilerArtefacts', |
|
|
|
|
'network', |
|
|
|
|
'web3Provider', |
|
|
|
|
'offsetToLineColumnConverter' |
|
|
|
|
]) |
|
|
|
|
await this.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs']) |
|
|
|
|
await this.appManager.activatePlugin(['sidePanel']) // activating host plugin separately
|
|
|
|
|
await this.appManager.activatePlugin(['home']) |
|
|
|
|
await this.appManager.activatePlugin(['settings', 'config']) |
|
|
|
|
await this.appManager.activatePlugin(['hiddenPanel', 'pluginManager', 'codeParser', 'codeFormatter', 'fileDecorator', 'terminal', 'blockchain', 'fetchAndCompile', 'contentImport', 'gistHandler']) |
|
|
|
|
await this.appManager.activatePlugin([ |
|
|
|
|
'hiddenPanel', |
|
|
|
|
'pluginManager', |
|
|
|
|
'codeParser', |
|
|
|
|
'codeFormatter', |
|
|
|
|
'fileDecorator', |
|
|
|
|
'terminal', |
|
|
|
|
'blockchain', |
|
|
|
|
'fetchAndCompile', |
|
|
|
|
'contentImport', |
|
|
|
|
'gistHandler' |
|
|
|
|
]) |
|
|
|
|
await this.appManager.activatePlugin(['settings']) |
|
|
|
|
await this.appManager.activatePlugin(['walkthrough', 'storage', 'search', 'compileAndRun', 'recorder']) |
|
|
|
|
await this.appManager.activatePlugin([ |
|
|
|
|
'walkthrough', |
|
|
|
|
'storage', |
|
|
|
|
'search', |
|
|
|
|
'compileAndRun', |
|
|
|
|
'recorder' |
|
|
|
|
]) |
|
|
|
|
await this.appManager.activatePlugin(['solidity-script']) |
|
|
|
|
|
|
|
|
|
this.appManager.on( |
|
|
|
@ -448,7 +497,11 @@ class AppComponent { |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
|
} |
|
|
|
|
if (params.code && (!params.activate || params.activate.split(',').includes('solidity'))) { |
|
|
|
|
if ( |
|
|
|
|
params.code && |
|
|
|
|
(!params.activate || |
|
|
|
|
params.activate.split(',').includes('solidity')) |
|
|
|
|
) { |
|
|
|
|
// if code is given in url we focus on solidity plugin
|
|
|
|
|
this.menuicons.select('solidity') |
|
|
|
|
} else { |
|
|
|
@ -466,24 +519,28 @@ class AppComponent { |
|
|
|
|
if (params.call) { |
|
|
|
|
const callDetails = params.call.split('//') |
|
|
|
|
if (callDetails.length > 1) { |
|
|
|
|
this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} and calling "${callDetails[1]}" ...`) |
|
|
|
|
this.appManager.call( |
|
|
|
|
'notification', |
|
|
|
|
'toast', |
|
|
|
|
`initiating ${callDetails[0]} and calling "${callDetails[1]}" ...` |
|
|
|
|
) |
|
|
|
|
// @todo(remove the timeout when activatePlugin is on 0.3.0)
|
|
|
|
|
await this.appManager.call(...callDetails).catch(console.error) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (params.calls) { |
|
|
|
|
const calls = params.calls.split("///"); |
|
|
|
|
const calls = params.calls.split('///') |
|
|
|
|
|
|
|
|
|
// call all functions in the list, one after the other
|
|
|
|
|
for (const call of calls) { |
|
|
|
|
const callDetails = call.split("//"); |
|
|
|
|
const callDetails = call.split('//') |
|
|
|
|
if (callDetails.length > 1) { |
|
|
|
|
this.appManager.call( |
|
|
|
|
"notification", |
|
|
|
|
"toast", |
|
|
|
|
'notification', |
|
|
|
|
'toast', |
|
|
|
|
`initiating ${callDetails[0]} and calling "${callDetails[1]}" ...` |
|
|
|
|
); |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// @todo(remove the timeout when activatePlugin is on 0.3.0)
|
|
|
|
|
try { |
|
|
|
@ -503,7 +560,13 @@ class AppComponent { |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// activate solidity plugin
|
|
|
|
|
this.appManager.activatePlugin(['solidity', 'udapp', 'deploy-libraries', 'link-libraries', 'openzeppelin-proxy']) |
|
|
|
|
this.appManager.activatePlugin([ |
|
|
|
|
'solidity', |
|
|
|
|
'udapp', |
|
|
|
|
'deploy-libraries', |
|
|
|
|
'link-libraries', |
|
|
|
|
'openzeppelin-proxy' |
|
|
|
|
]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|