|
|
@ -34,19 +34,20 @@ enum State { |
|
|
|
export class RemixdHandle extends WebsocketPlugin { |
|
|
|
export class RemixdHandle extends WebsocketPlugin { |
|
|
|
localhostProvider: any |
|
|
|
localhostProvider: any |
|
|
|
appManager: PluginManager |
|
|
|
appManager: PluginManager |
|
|
|
|
|
|
|
dependentPlugins: Array<string> |
|
|
|
constructor (localhostProvider, appManager) { |
|
|
|
constructor (localhostProvider, appManager) { |
|
|
|
super(profile) |
|
|
|
super(profile) |
|
|
|
this.localhostProvider = localhostProvider |
|
|
|
this.localhostProvider = localhostProvider |
|
|
|
this.appManager = appManager |
|
|
|
this.appManager = appManager |
|
|
|
|
|
|
|
this.dependentPlugins = ['hardhat', 'truffle', 'slither', 'foundry'] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async deactivate () { |
|
|
|
async deactivate () { |
|
|
|
|
|
|
|
for (const plugin of this.dependentPlugins) { |
|
|
|
|
|
|
|
await this.appManager.deactivatePlugin(plugin) |
|
|
|
|
|
|
|
} |
|
|
|
if (super.socket) super.deactivate() |
|
|
|
if (super.socket) super.deactivate() |
|
|
|
// this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342
|
|
|
|
// this.appManager.deactivatePlugin('git') // plugin call doesn't work.. see issue https://github.com/ethereum/remix-plugin/issues/342
|
|
|
|
if (this.appManager.isActive('hardhat')) this.appManager.deactivatePlugin('hardhat') |
|
|
|
|
|
|
|
if (this.appManager.isActive('truffle')) this.appManager.deactivatePlugin('truffle') |
|
|
|
|
|
|
|
if (this.appManager.isActive('slither')) this.appManager.deactivatePlugin('slither') |
|
|
|
|
|
|
|
if (this.appManager.isActive('foundry')) this.appManager.deactivatePlugin('foundry') |
|
|
|
|
|
|
|
this.localhostProvider.close((error) => { |
|
|
|
this.localhostProvider.close((error) => { |
|
|
|
if (error) console.log(error) |
|
|
|
if (error) console.log(error) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -58,6 +59,9 @@ export class RemixdHandle extends WebsocketPlugin { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async canceled () { |
|
|
|
async canceled () { |
|
|
|
|
|
|
|
for (const plugin of this.dependentPlugins) { |
|
|
|
|
|
|
|
await this.appManager.deactivatePlugin(plugin) |
|
|
|
|
|
|
|
} |
|
|
|
await this.appManager.deactivatePlugin('remixd') |
|
|
|
await this.appManager.deactivatePlugin('remixd') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -68,7 +72,7 @@ export class RemixdHandle extends WebsocketPlugin { |
|
|
|
* @param {String} txHash - hash of the transaction |
|
|
|
* @param {String} txHash - hash of the transaction |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async connectToLocalhost () { |
|
|
|
async connectToLocalhost () { |
|
|
|
const connection = (error?:any) => { |
|
|
|
const connection = async (error?:any) => { |
|
|
|
if (error) { |
|
|
|
if (error) { |
|
|
|
console.log(error) |
|
|
|
console.log(error) |
|
|
|
const alert:AlertModal = { |
|
|
|
const alert:AlertModal = { |
|
|
@ -91,11 +95,10 @@ export class RemixdHandle extends WebsocketPlugin { |
|
|
|
}, 3000) |
|
|
|
}, 3000) |
|
|
|
this.localhostProvider.init(() => { |
|
|
|
this.localhostProvider.init(() => { |
|
|
|
this.call('filePanel', 'setWorkspace', { name: LOCALHOST, isLocalhost: true }, true) |
|
|
|
this.call('filePanel', 'setWorkspace', { name: LOCALHOST, isLocalhost: true }, true) |
|
|
|
}) |
|
|
|
}); |
|
|
|
this.call('manager', 'activatePlugin', 'hardhat') |
|
|
|
for (const plugin of this.dependentPlugins) { |
|
|
|
this.call('manager', 'activatePlugin', 'truffle') |
|
|
|
await this.appManager.activatePlugin(plugin) |
|
|
|
this.call('manager', 'activatePlugin', 'slither') |
|
|
|
} |
|
|
|
this.call('manager', 'activatePlugin', 'foundry') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.localhostProvider.isConnected()) { |
|
|
|
if (this.localhostProvider.isConnected()) { |
|
|
|