diff --git a/package.json b/package.json index 73f244d..d69c77c 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,11 @@ "command": "rmxPlugins.languageSelector", "title": "Language selector", "category": "Remix IDE" + }, + { + "command": "rmxPlugins.deploy", + "title": "Deploy contracts through Ethcode", + "category": "Remix IDE" } ], "keybindings": [ diff --git a/src/extension.ts b/src/extension.ts index b7624b3..502b74c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,6 +1,6 @@ "use strict"; -import { window, commands, workspace, InputBoxOptions, ExtensionContext, QuickPickItem, env, Uri } from "vscode"; -import { PluginManager, Engine } from '@remixproject/engine'; +import { window, commands, extensions, workspace, env, Uri, InputBoxOptions, ExtensionContext, QuickPickItem } from "vscode"; +import { Engine } from '@remixproject/engine'; import { ThemeUrls} from '@remixproject/plugin-api' import { VscodeAppManager, WebviewPlugin, ThemePlugin, FileManagerPlugin, EditorPlugin, EditorOptions, transformCmd, ThemeOptions, ContentImportPlugin } from '@remixproject/engine-vscode'; @@ -8,7 +8,7 @@ import { RmxPluginsProvider } from "./rmxPlugins"; import NativeSolcPlugin from "./plugins/native_solidity_plugin"; import { pluginActivate, pluginDeactivate, pluginDocumentation, pluginUninstall } from './optionInputs'; import { ToViewColumn, GetPluginData } from "./utils"; -import { PluginInfo, CompilerInputOptions } from "./types"; +import { PluginInfo, CompilerInputOptions, ICompilationResult } from "./types"; import { Profile } from '@remixproject/plugin-utils'; class VscodeManager extends VscodeAppManager { @@ -207,6 +207,20 @@ export async function activate(context: ExtensionContext) { console.log(error); } }); + // extension connector + commands.registerCommand('rmxPlugins.deploy', async () => { + console.log('should deploy'); + const ethcode = extensions.getExtension('ethential.ethcode'); + await ethcode.activate(); + await manager.activatePlugin(['solidity']); + const compilationResult: ICompilationResult = solpl.getCompilationResult(); + console.log(compilationResult); + + if(ethcode.isActive) { + const ethcodeApi = ethcode.exports; + ethcodeApi.loadCompiled(compilationResult); + } + }) commands.registerCommand('rmxPlugins.openDocumentation', async (pluginId: string) => { const pluginData: PluginInfo = GetPluginData(pluginId, rmxPluginsProvider.getData()); diff --git a/src/plugins/native_solidity_plugin.ts b/src/plugins/native_solidity_plugin.ts index 0b1db4f..10bd9d0 100644 --- a/src/plugins/native_solidity_plugin.ts +++ b/src/plugins/native_solidity_plugin.ts @@ -2,7 +2,7 @@ import { CommandPlugin } from "@remixproject/engine-vscode"; import { window, OutputChannel, workspace } from "vscode"; import { fork, ChildProcess } from "child_process"; import * as path from "path"; -import { ISources, CompilerInput, CompilerInputOptions } from "../types"; +import { ISources, CompilerInput, CompilerInputOptions, ICompilationResult } from "../types"; const profile = { name: 'solidity', @@ -16,14 +16,6 @@ const profile = { methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig'] }; -interface ICompilationResult { - source: { - target: string; - sources: ISources; - }; - data: any; -} - export default class NativeSolcPlugin extends CommandPlugin { private version: string = 'latest'; private versions: Array; diff --git a/src/types.ts b/src/types.ts index 41541a4..37af99c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -19,6 +19,19 @@ interface Notifications { udapp?: string[] | null; network?: string[] | null; } +/** + * Compilation result interface + */ +export interface ICompilationResult { + source: { + target: string; + sources: ISources; + }; + data: any; +} +/** + * Compiler input interface + */ export interface CompilerInput { // Required: Source code language. Currently supported are "Solidity" and "Yul". language: Language, diff --git a/yarn.lock b/yarn.lock index 6e93564..2a4c3f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -69,54 +69,55 @@ url "^0.11.0" valid-url "^1.0.9" -"@remixproject/engine-vscode@0.3.9-alpha.6": - version "0.3.9-alpha.6" - resolved "https://registry.yarnpkg.com/@remixproject/engine-vscode/-/engine-vscode-0.3.9-alpha.6.tgz#cce0da7b4070e6a087d6aa2058ba7a2bc9932ba6" - integrity sha512-GxXkvzAcFUXhRowTapkIv/LvqmcFYkafB3KwkC72GypoGuOGOg7aUZsocaSPRJ2hJHeSATeiW7r7HTj0BvR+EQ== +"@remixproject/engine-vscode@0.3.9-alpha.12": + version "0.3.9-alpha.12" + resolved "https://registry.yarnpkg.com/@remixproject/engine-vscode/-/engine-vscode-0.3.9-alpha.12.tgz#5ca8abac01b794d46cd22c606669a10a0cca070f" + integrity sha512-lLt2DoOFKzG5bqk7rfNDl6mwl/rjtY/DmWAPTmAGLkrRUcpujXfbwMbpyZBldsrNy/L/lby47pxCU/dkx9nkWA== dependencies: "@remix-project/remix-url-resolver" "0.0.19" - "@remixproject/engine" "0.3.9-alpha.6" - "@remixproject/plugin-api" "0.3.9-alpha.6" - "@remixproject/plugin-utils" "0.3.9-alpha.6" + "@remixproject/engine" "0.3.9-alpha.12" + "@remixproject/plugin-api" "0.3.9-alpha.12" + "@remixproject/plugin-utils" "0.3.9-alpha.12" + axios "^0.21.1" -"@remixproject/engine@0.3.9-alpha.6": - version "0.3.9-alpha.6" - resolved "https://registry.yarnpkg.com/@remixproject/engine/-/engine-0.3.9-alpha.6.tgz#59746c32e88353dec6b5c7b3130a11dd76864f38" - integrity sha512-V+vLN5jPc4DAkmfLaW+41IT7itKTIDzkPdA/tePM44G4QVk8ZjdEh1yWQF2AraJehkcbdXaeOQ20yBr+7p3zCw== +"@remixproject/engine@0.3.9-alpha.12": + version "0.3.9-alpha.12" + resolved "https://registry.yarnpkg.com/@remixproject/engine/-/engine-0.3.9-alpha.12.tgz#1af5bbb647a63680b6b17d882fd8987537b93f88" + integrity sha512-hzJyeYC1AvuNFAZwfK5YvwcpozTAzPMoG1JzE/pr0Jd5/0fB6NQfdgWdytvD46+WqAUfijywpG9R9M+tVId05g== dependencies: - "@remixproject/plugin-api" "0.3.9-alpha.6" - "@remixproject/plugin-utils" "0.3.9-alpha.6" + "@remixproject/plugin-api" "0.3.9-alpha.12" + "@remixproject/plugin-utils" "0.3.9-alpha.12" -"@remixproject/plugin-api@0.3.9-alpha.6", "@remixproject/plugin-api@^0.3.9-alpha.6": - version "0.3.9-alpha.6" - resolved "https://registry.yarnpkg.com/@remixproject/plugin-api/-/plugin-api-0.3.9-alpha.6.tgz#793acc1784fd3ec940ef2924000b71793804778e" - integrity sha512-eibWnlMQAheWey3tXVu2+MmIXl8lY9jP/AgugiVq0441kC6NwCkZ7ptt61XJwHcYcDa9v95i3AHBtft5pxlGqw== +"@remixproject/plugin-api@0.3.9-alpha.12": + version "0.3.9-alpha.12" + resolved "https://registry.yarnpkg.com/@remixproject/plugin-api/-/plugin-api-0.3.9-alpha.12.tgz#5b7d6618d5cf6d16a5d88c253e3cd62ba368a643" + integrity sha512-bcBiq2ln1zaXntdKIHZhouZjT+itXtPQXkUZPJqB2CJoV+j000yBbSDY/ypzJgQvOP1H1SA6orir5rIGnPvi/g== dependencies: - "@remixproject/plugin-utils" "0.3.9-alpha.6" + "@remixproject/plugin-utils" "0.3.9-alpha.12" -"@remixproject/plugin-utils@0.3.9-alpha.6", "@remixproject/plugin-utils@^0.3.9-alpha.6": - version "0.3.9-alpha.6" - resolved "https://registry.yarnpkg.com/@remixproject/plugin-utils/-/plugin-utils-0.3.9-alpha.6.tgz#84829167bd853a66bb1e224fc2f98736f58d27af" - integrity sha512-jdSCsFcDwvAySttgrqp3YLwUOmeVlshLVeVStQiBMZkfCJGrzHXk7hn4yXU9hGXOYuqMo9SYC4MbqlJ0YFiz1Q== +"@remixproject/plugin-utils@0.3.9-alpha.12": + version "0.3.9-alpha.12" + resolved "https://registry.yarnpkg.com/@remixproject/plugin-utils/-/plugin-utils-0.3.9-alpha.12.tgz#969b458fb10c266e75aeb7a12d236303be90e353" + integrity sha512-ePu34xmwB4Q9jt0qEJ3+ww/m5VjTCcg/+Tgazu7Y2WPeyr0tgdCL6n2ndAIX4rQWkbtULZn3LleodjcRz/DMJQ== dependencies: tslib "2.0.1" -"@remixproject/plugin-vscode@^0.3.9-alpha.6": - version "0.3.9-alpha.6" - resolved "https://registry.yarnpkg.com/@remixproject/plugin-vscode/-/plugin-vscode-0.3.9-alpha.6.tgz#6c7a88da3e90f43369f0c6fea567cd672778acd4" - integrity sha512-UTyNuEOWrwnqkGEcsmXTfk3XzZjlRB6mASKTcbx+ASV5M8PaTiSyc13JAw6wHtY0di5jqiKxrtxYLEb2NRlmZw== +"@remixproject/plugin-vscode@0.3.9-alpha.12": + version "0.3.9-alpha.12" + resolved "https://registry.yarnpkg.com/@remixproject/plugin-vscode/-/plugin-vscode-0.3.9-alpha.12.tgz#274edbd941656982303d45c402d10b94e155da6d" + integrity sha512-PKMRQrHuypKJM8pPIEe9eQWn9zuMZ3lc1iwemS9wqCtniy/1i4tQb7t3hBEix+SIhOhvaGBzquLpw35pSBJMqA== dependencies: - "@remixproject/plugin" "0.3.9-alpha.6" - "@remixproject/plugin-api" "0.3.9-alpha.6" - "@remixproject/plugin-utils" "0.3.9-alpha.6" + "@remixproject/plugin" "0.3.9-alpha.12" + "@remixproject/plugin-api" "0.3.9-alpha.12" + "@remixproject/plugin-utils" "0.3.9-alpha.12" -"@remixproject/plugin@0.3.9-alpha.6", "@remixproject/plugin@^0.3.9-alpha.6": - version "0.3.9-alpha.6" - resolved "https://registry.yarnpkg.com/@remixproject/plugin/-/plugin-0.3.9-alpha.6.tgz#37f882bbc3b2e2797df8374ac47d605be66bb84c" - integrity sha512-5MIGacXUXS+TLdVn4NYDzi/mSPxIaDvlycWkJdTq1vf9JDs5nZAsKpToPKLjxtTHqT9naixvK7aBfiaGEYHa9g== +"@remixproject/plugin@0.3.9-alpha.12": + version "0.3.9-alpha.12" + resolved "https://registry.yarnpkg.com/@remixproject/plugin/-/plugin-0.3.9-alpha.12.tgz#71aafde368abd13b5909fbf70df8c79d572068ec" + integrity sha512-G/5MzUTLQv5oDD8/msR/816J88Dp+Pn575CYB6BBaDtp+hxoxjOi0X8r8Xp0o4zV344hB8PK3x1SHoH/TPblcw== dependencies: - "@remixproject/plugin-api" "0.3.9-alpha.6" - "@remixproject/plugin-utils" "0.3.9-alpha.6" + "@remixproject/plugin-api" "0.3.9-alpha.12" + "@remixproject/plugin-utils" "0.3.9-alpha.12" events "3.2.0" "@types/glob@*":