|
|
|
@ -41,6 +41,7 @@ import { InjectedProviderDefault } from './app/providers/injected-provider-defau |
|
|
|
|
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 {InjectedEphemeryTestnetProvider} from './app/providers/injected-ephemery-testnet-provider' |
|
|
|
|
import {FileDecorator} from './app/plugins/file-decorator' |
|
|
|
|
import {CodeFormat} from './app/plugins/code-format' |
|
|
|
|
import {SolidityUmlGen} from './app/plugins/solidity-umlgen' |
|
|
|
@ -93,9 +94,7 @@ class AppComponent { |
|
|
|
|
api: this._components.filesProviders.browser, |
|
|
|
|
name: 'fileproviders/browser' |
|
|
|
|
}) |
|
|
|
|
this._components.filesProviders.localhost = new RemixDProvider( |
|
|
|
|
this.appManager |
|
|
|
|
) |
|
|
|
|
this._components.filesProviders.localhost = new RemixDProvider(this.appManager) |
|
|
|
|
Registry.getInstance().put({ |
|
|
|
|
api: this._components.filesProviders.localhost, |
|
|
|
|
name: 'fileproviders/localhost' |
|
|
|
@ -119,7 +118,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, |
|
|
|
@ -127,15 +126,8 @@ class AppComponent { |
|
|
|
|
'remix.ethereum.org': 23, |
|
|
|
|
'6fd22d6fe5549ad4c4d8fd3ca0b7816b.mod': 35 // remix desktop
|
|
|
|
|
} |
|
|
|
|
this.showMatamo = |
|
|
|
|
matomoDomains[window.location.hostname] && |
|
|
|
|
!Registry.getInstance() |
|
|
|
|
.get('config') |
|
|
|
|
.api.exists('settings/matomo-analytics') |
|
|
|
|
this.walkthroughService = new WalkthroughService( |
|
|
|
|
appManager, |
|
|
|
|
this.showMatamo |
|
|
|
|
) |
|
|
|
|
this.showMatamo = matomoDomains[window.location.hostname] && !Registry.getInstance().get('config').api.exists('settings/matomo-analytics') |
|
|
|
|
this.walkthroughService = new WalkthroughService(appManager, this.showMatamo) |
|
|
|
|
|
|
|
|
|
const hosts = ['127.0.0.1:8080', '192.168.0.101:8080', 'localhost:8080'] |
|
|
|
|
// workaround for Electron support
|
|
|
|
@ -221,9 +213,10 @@ 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({ |
|
|
|
@ -233,11 +226,11 @@ 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}, |
|
|
|
|
{ |
|
|
|
|
getPosition: event => { |
|
|
|
|
getPosition: (event) => { |
|
|
|
|
const limitUp = 36 |
|
|
|
|
const limitDown = 20 |
|
|
|
|
const height = window.innerHeight |
|
|
|
@ -299,6 +292,7 @@ class AppComponent { |
|
|
|
|
trustWalletInjectedProvider, |
|
|
|
|
injected0ptimismProvider, |
|
|
|
|
injectedArbitrumOneProvider, |
|
|
|
|
injectedEphemeryTestnetProvider, |
|
|
|
|
this.walkthroughService, |
|
|
|
|
search, |
|
|
|
|
solidityumlgen, |
|
|
|
@ -317,42 +311,18 @@ class AppComponent { |
|
|
|
|
this.sidePanel = new SidePanel() |
|
|
|
|
this.hiddenPanel = new HiddenPanel() |
|
|
|
|
|
|
|
|
|
const pluginManagerComponent = new PluginManagerComponent( |
|
|
|
|
appManager, |
|
|
|
|
this.engine |
|
|
|
|
) |
|
|
|
|
const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine) |
|
|
|
|
const filePanel = new FilePanel(appManager) |
|
|
|
|
const landingPage = new LandingPage( |
|
|
|
|
appManager, |
|
|
|
|
this.menuicons, |
|
|
|
|
fileManager, |
|
|
|
|
filePanel, |
|
|
|
|
contentImport |
|
|
|
|
) |
|
|
|
|
this.settings = new SettingsTab( |
|
|
|
|
Registry.getInstance().get('config').api, |
|
|
|
|
editor, |
|
|
|
|
appManager |
|
|
|
|
) |
|
|
|
|
const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport) |
|
|
|
|
this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor, appManager) |
|
|
|
|
|
|
|
|
|
this.engine.register([ |
|
|
|
|
this.menuicons, |
|
|
|
|
landingPage, |
|
|
|
|
this.hiddenPanel, |
|
|
|
|
this.sidePanel, |
|
|
|
|
filePanel, |
|
|
|
|
pluginManagerComponent, |
|
|
|
|
this.settings |
|
|
|
|
]) |
|
|
|
|
this.engine.register([this.menuicons, landingPage, this.hiddenPanel, this.sidePanel, filePanel, pluginManagerComponent, this.settings]) |
|
|
|
|
|
|
|
|
|
// CONTENT VIEWS & DEFAULT PLUGINS
|
|
|
|
|
const openZeppelinProxy = new OpenZeppelinProxy(blockchain) |
|
|
|
|
const linkLibraries = new LinkLibraries(blockchain) |
|
|
|
|
const deployLibraries = new DeployLibraries(blockchain) |
|
|
|
|
const compileTab = new CompileTab( |
|
|
|
|
Registry.getInstance().get('config').api, |
|
|
|
|
Registry.getInstance().get('filemanager').api |
|
|
|
|
) |
|
|
|
|
const compileTab = new CompileTab(Registry.getInstance().get('config').api, Registry.getInstance().get('filemanager').api) |
|
|
|
|
const run = new RunTab( |
|
|
|
|
blockchain, |
|
|
|
|
Registry.getInstance().get('config').api, |
|
|
|
@ -411,27 +381,44 @@ 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(['solidity-script']) |
|
|
|
|
|
|
|
|
|
this.appManager.on( |
|
|
|
|
'filePanel', |
|
|
|
|
'workspaceInitializationCompleted', |
|
|
|
|
async () => { |
|
|
|
|
this.appManager.on('filePanel', 'workspaceInitializationCompleted', async () => { |
|
|
|
|
// for e2e tests
|
|
|
|
|
const loadedElement = document.createElement('span') |
|
|
|
|
loadedElement.setAttribute('data-id', 'workspaceloaded') |
|
|
|
|
document.body.appendChild(loadedElement) |
|
|
|
|
await this.appManager.registerContextMenuItems() |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
await this.appManager.activatePlugin(['filePanel']) |
|
|
|
|
// Set workspace after initial activation
|
|
|
|
@ -442,9 +429,7 @@ class AppComponent { |
|
|
|
|
.then(async () => { |
|
|
|
|
try { |
|
|
|
|
if (params.deactivate) { |
|
|
|
|
await this.appManager.deactivatePlugin( |
|
|
|
|
params.deactivate.split(',') |
|
|
|
|
) |
|
|
|
|
await this.appManager.deactivatePlugin(params.deactivate.split(',')) |
|
|
|
|
} |
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e) |
|
|
|
@ -454,10 +439,7 @@ class AppComponent { |
|
|
|
|
this.menuicons.select('solidity') |
|
|
|
|
} else { |
|
|
|
|
// If plugins are loaded from the URL params, we focus on the last one.
|
|
|
|
|
if ( |
|
|
|
|
this.appManager.pluginLoader.current === 'queryParams' && |
|
|
|
|
this.workspace.length > 0 |
|
|
|
|
) { |
|
|
|
|
if (this.appManager.pluginLoader.current === 'queryParams' && this.workspace.length > 0) { |
|
|
|
|
this.menuicons.select(this.workspace[this.workspace.length - 1]) |
|
|
|
|
} else { |
|
|
|
|
this.appManager.call('tabs', 'focus', 'home') |
|
|
|
@ -474,17 +456,13 @@ class AppComponent { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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", |
|
|
|
|
`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)
|
|
|
|
|
try { |
|
|
|
|