From 54bba0d5b05162658e6b9d6f20c9526b8e012677 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 28 Oct 2024 09:22:53 +0100 Subject: [PATCH 01/45] initial --- apps/remix-ide/src/app/tabs/locales/en/editor.json | 1 + libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/editor.json b/apps/remix-ide/src/app/tabs/locales/en/editor.json index 6f0f3675554..45805618c42 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/editor.json +++ b/apps/remix-ide/src/app/tabs/locales/en/editor.json @@ -28,6 +28,7 @@ "editor.explainFunctionByAI": "```\n{content}\n```\nExplain the function {currentFunction}", "editor.explainFunctionByAISol": "```\n{content}\n```\nExplain the function {currentFunction}", "editor.ExplainPipeMessage": "```\n {content}\n```\nExplain the snipped above", + "editor.PastedCodeSafety": "```\n {content}\n```\n\nReply in a short maner: Does this code contain major security vulenerabilities leading to a scam or loss of funds?", "editor.executeFreeFunction": "Run a free function", "editor.executeFreeFunction2": "Run the free function \"{name}\"", "editor.toastText1": "This can only execute free function", diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index ab8de7ec347..795e274a118 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -660,7 +660,7 @@ export const EditorUI = (props: EditorUIProps) => { } }) - editor.onDidPaste((e) => { + editor.onDidPaste(async (e) => { if (!pasteCodeRef.current && e && e.range && e.range.startLineNumber >= 0 && e.range.endLineNumber >= 0 && e.range.endLineNumber - e.range.startLineNumber > 10) { const modalContent: AlertModal = { id: 'newCodePasted', @@ -697,9 +697,15 @@ export const EditorUI = (props: EditorUIProps) => { ), } + + const pastedCode = editor.getModel().getValueInRange(e.range) + const pastedCodePrompt = intl.formatMessage({ id: 'editor.PastedCodeSafety' }, { content:pastedCode }) + // props.plugin.call('remixAI', 'chatPipe', 'solidity_answer', pastedCodePrompt) + const result = props.plugin.call('remixAI', 'solidity_answer', pastedCodePrompt) props.plugin.call('notification', 'alert', modalContent) pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) + console.log('result test:', await result) } }) From 7adc82c4e1820e47213681ac62ae4a05c36535f4 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 28 Oct 2024 16:46:44 +0100 Subject: [PATCH 02/45] added new function --- .../src/app/plugins/remixAIPlugin.tsx | 24 ++++++++++++++++--- .../src/inferencers/remote/remoteInference.ts | 20 ++++++++++------ .../editor/src/lib/remix-ui-editor.tsx | 8 +++---- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx index d6d3c78a480..73cd4e489e0 100644 --- a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx +++ b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx @@ -15,7 +15,7 @@ const profile = { displayName: 'Remix AI', methods: ['code_generation', 'code_completion', "solidity_answer", "code_explaining", - "code_insertion", "error_explaining", + "code_insertion", "error_explaining", "vulnerability_check", "initialize", 'chatPipe', 'ProcessChatRequestBuffer', 'isChatRequestPending'], events: [], icon: 'assets/img/remix-logo-blue.png', @@ -162,6 +162,23 @@ export class RemixAIPlugin extends ViewPlugin { return result } + async vulnerability_check(prompt: string, params: IParams=GenerationParams): Promise { + if (this.isInferencing) { + this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI is already busy!" }) + return + } + + let result + if (this.isOnDesktop && !this.useRemoteInferencer) { + result = await this.call(this.remixDesktopPluginName, 'vulnerability_check', prompt) + + } else { + result = await this.remoteInferencer.vulnerability_check(prompt) + } + if (result && params.terminal_output) this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result }) + return result + } + async code_insertion(msg_pfx: string, msg_sfx: string): Promise { if (this.isOnDesktop && !this.useRemoteInferencer) { return await this.call(this.remixDesktopPluginName, 'code_insertion', msg_pfx, msg_sfx) @@ -182,11 +199,12 @@ export class RemixAIPlugin extends ViewPlugin { if (fn === "code_explaining") ChatApi.composer.send("Explain the current code") else if (fn === "error_explaining") ChatApi.composer.send("Explain the error") else if (fn === "solidity_answer") ChatApi.composer.send("Answer the following question") - else console.log("chatRequestBuffer is not empty. First process the last request.") + else if (fn === "vulnerability_check") ChatApi.composer.send("Is there any vulnerability in the pasted code?") + else console.log("chatRequestBuffer function name not recognized.") } } else { - console.log("chatRequestBuffer is not empty. First process the last request.") + console.log("chatRequestBuffer is not empty. First process the last request.", this.chatRequestBuffer) } } diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index f618133a0f1..4975f985f91 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=false + test_env=true test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { @@ -27,7 +27,7 @@ export class RemoteInferencer implements ICompletions { try { const options = { headers: { 'Content-Type': 'application/json', } } - const result = await axios.post(`${requestURL}`, payload, options) + const result = await axios.post(requestURL, payload, options) switch (rType) { case AIRequestType.COMPLETION: @@ -56,7 +56,7 @@ export class RemoteInferencer implements ICompletions { } } - private async _streamInferenceRequest(endpoint, payload, rType:AIRequestType){ + private async _streamInferenceRequest(payload, rType:AIRequestType){ let resultText = "" try { this.event.emit('onInference') @@ -122,26 +122,32 @@ export class RemoteInferencer implements ICompletions { async code_generation(prompt, options:IParams=GenerationParams): Promise { const payload = { prompt, "endpoint":"code_completion", ...options } - if (options.stream_result) return this._streamInferenceRequest(payload.endpoint, payload, AIRequestType.COMPLETION) + if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.COMPLETION) else return this._makeRequest(payload, AIRequestType.COMPLETION) } async solidity_answer(prompt, options:IParams=GenerationParams): Promise { const main_prompt = buildSolgptPromt(prompt, this.model_op) const payload = { 'prompt': main_prompt, "endpoint":"solidity_answer", ...options } - if (options.stream_result) return this._streamInferenceRequest(payload.endpoint, payload, AIRequestType.GENERAL) + if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL) else return this._makeRequest(payload, AIRequestType.GENERAL) } async code_explaining(prompt, context:string="", options:IParams=GenerationParams): Promise { const payload = { prompt, "endpoint":"code_explaining", context, ...options } - if (options.stream_result) return this._streamInferenceRequest(payload.endpoint, payload, AIRequestType.GENERAL) + if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL) else return this._makeRequest(payload, AIRequestType.GENERAL) } async error_explaining(prompt, options:IParams=GenerationParams): Promise { const payload = { prompt, "endpoint":"error_explaining", ...options } - if (options.stream_result) return this._streamInferenceRequest(payload.endpoint, payload, AIRequestType.GENERAL) + if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL) + else return this._makeRequest(payload, AIRequestType.GENERAL) + } + + async vulnerability_check(prompt, options:IParams=GenerationParams): Promise { + const payload = { prompt, "endpoint":"vulnerability_check", ...options } + if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL) else return this._makeRequest(payload, AIRequestType.GENERAL) } } diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 795e274a118..56e9bc273e6 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -700,12 +700,12 @@ export const EditorUI = (props: EditorUIProps) => { const pastedCode = editor.getModel().getValueInRange(e.range) const pastedCodePrompt = intl.formatMessage({ id: 'editor.PastedCodeSafety' }, { content:pastedCode }) - // props.plugin.call('remixAI', 'chatPipe', 'solidity_answer', pastedCodePrompt) - const result = props.plugin.call('remixAI', 'solidity_answer', pastedCodePrompt) + props.plugin.call('remixAI', 'chatPipe', 'vulnerability_check', pastedCodePrompt) props.plugin.call('notification', 'alert', modalContent) - pasteCodeRef.current = true + // pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) - console.log('result test:', await result) + // const result = await props.plugin.call('remixAI', 'vulnerability_check', pastedCodePrompt) + // console.log(JSON.parse(result)) } }) From 3055f30143fa0591eb2602b6057ceb7132d82013 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:58:20 +0100 Subject: [PATCH 03/45] minor --- apps/remix-ide/src/app/files/fileManager.ts | 2 +- .../src/app/plugins/remixAIPlugin.tsx | 42 ++-- .../src/app/tabs/locales/en/editor.json | 2 +- .../remix-ai-core/src/agents/securityAgent.ts | 183 ++++++++++++++++-- libs/remix-ai-core/src/index.ts | 3 +- .../src/inferencers/remote/remoteInference.ts | 2 +- .../lib/providers/inlineCompletionProvider.ts | 9 +- .../editor/src/lib/remix-ui-editor.tsx | 2 +- 8 files changed, 191 insertions(+), 54 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index a821ced648f..707c14bb301 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -26,7 +26,7 @@ const profile = { 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'dirList', 'fileList', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', 'saveCurrentFile', 'setBatchFiles', 'isGitRepo', 'isFile', 'isDirectory', 'hasGitSubmodule', 'copyFolderToJson', 'diff', - 'hasGitSubmodules' + 'hasGitSubmodules', 'getOpenedFiles' ], kind: 'file-system' } diff --git a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx index 73cd4e489e0..ffef2d52949 100644 --- a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx +++ b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx @@ -3,7 +3,7 @@ import { ViewPlugin } from '@remixproject/engine-web' import { Plugin } from '@remixproject/engine'; import { RemixAITab, ChatApi } from '@remix-ui/remix-ai' import React, { useCallback } from 'react'; -import { ICompletions, IModel, RemoteInferencer, IRemoteModel, IParams, GenerationParams, CodeExplainAgent } from '@remix/remix-ai-core'; +import { ICompletions, IModel, RemoteInferencer, IRemoteModel, IParams, GenerationParams, CodeExplainAgent, SecurityAgent} from '@remix/remix-ai-core'; import { CustomRemixApi } from '@remix-api' type chatRequestBufferT = { @@ -35,13 +35,14 @@ export class RemixAIPlugin extends ViewPlugin { remoteInferencer:RemoteInferencer = null isInferencing: boolean = false chatRequestBuffer: chatRequestBufferT = null - agent: CodeExplainAgent + codeExpAgent: CodeExplainAgent + securityAgent: SecurityAgent useRemoteInferencer:boolean = false constructor(inDesktop:boolean) { super(profile) this.isOnDesktop = inDesktop - this.agent = new CodeExplainAgent(this) + this.codeExpAgent = new CodeExplainAgent(this) // user machine dont use ressource for remote inferencing } @@ -57,6 +58,8 @@ export class RemixAIPlugin extends ViewPlugin { this.useRemoteInferencer = true this.initialize() } + + this.securityAgent = new SecurityAgent(this) } async initialize(model1?:IModel, model2?:IModel, remoteModel?:IRemoteModel, useRemote?:boolean){ @@ -92,11 +95,6 @@ export class RemixAIPlugin extends ViewPlugin { } async code_generation(prompt: string): Promise { - if (this.isInferencing) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI is already busy!" }) - return - } - if (this.isOnDesktop && !this.useRemoteInferencer) { return await this.call(this.remixDesktopPluginName, 'code_generation', prompt) } else { @@ -113,12 +111,7 @@ export class RemixAIPlugin extends ViewPlugin { } async solidity_answer(prompt: string, params: IParams=GenerationParams): Promise { - if (this.isInferencing) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI is already busy!" }) - return - } - - const newPrompt = await this.agent.chatCommand(prompt) + const newPrompt = await this.codeExpAgent.chatCommand(prompt) let result if (this.isOnDesktop && !this.useRemoteInferencer) { result = await this.call(this.remixDesktopPluginName, 'solidity_answer', newPrompt) @@ -130,11 +123,6 @@ export class RemixAIPlugin extends ViewPlugin { } async code_explaining(prompt: string, context: string, params: IParams=GenerationParams): Promise { - if (this.isInferencing) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI is already busy!" }) - return - } - let result if (this.isOnDesktop && !this.useRemoteInferencer) { result = await this.call(this.remixDesktopPluginName, 'code_explaining', prompt, context, params) @@ -147,11 +135,6 @@ export class RemixAIPlugin extends ViewPlugin { } async error_explaining(prompt: string, context: string="", params: IParams=GenerationParams): Promise { - if (this.isInferencing) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI is already busy!" }) - return - } - let result if (this.isOnDesktop && !this.useRemoteInferencer) { result = await this.call(this.remixDesktopPluginName, 'error_explaining', prompt) @@ -163,22 +146,21 @@ export class RemixAIPlugin extends ViewPlugin { } async vulnerability_check(prompt: string, params: IParams=GenerationParams): Promise { - if (this.isInferencing) { - this.call('terminal', 'log', { type: 'aitypewriterwarning', value: "RemixAI is already busy!" }) - return - } - let result if (this.isOnDesktop && !this.useRemoteInferencer) { result = await this.call(this.remixDesktopPluginName, 'vulnerability_check', prompt) } else { - result = await this.remoteInferencer.vulnerability_check(prompt) + result = await this.remoteInferencer.vulnerability_check(prompt, params) } if (result && params.terminal_output) this.call('terminal', 'log', { type: 'aitypewriterwarning', value: result }) return result } + getVulnerabilityReport(file: string): any { + return this.securityAgent.getReport(file) + } + async code_insertion(msg_pfx: string, msg_sfx: string): Promise { if (this.isOnDesktop && !this.useRemoteInferencer) { return await this.call(this.remixDesktopPluginName, 'code_insertion', msg_pfx, msg_sfx) diff --git a/apps/remix-ide/src/app/tabs/locales/en/editor.json b/apps/remix-ide/src/app/tabs/locales/en/editor.json index 45805618c42..81d9f8c7c40 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/editor.json +++ b/apps/remix-ide/src/app/tabs/locales/en/editor.json @@ -28,7 +28,7 @@ "editor.explainFunctionByAI": "```\n{content}\n```\nExplain the function {currentFunction}", "editor.explainFunctionByAISol": "```\n{content}\n```\nExplain the function {currentFunction}", "editor.ExplainPipeMessage": "```\n {content}\n```\nExplain the snipped above", - "editor.PastedCodeSafety": "```\n {content}\n```\n\nReply in a short maner: Does this code contain major security vulenerabilities leading to a scam or loss of funds?", + "editor.PastedCodeSafety": "```\n {content}\n```\n\nReply in a short manner: Does this code contain major security vulenerabilities leading to a scam or loss of funds?", "editor.executeFreeFunction": "Run a free function", "editor.executeFreeFunction2": "Run the free function \"{name}\"", "editor.toastText1": "This can only execute free function", diff --git a/libs/remix-ai-core/src/agents/securityAgent.ts b/libs/remix-ai-core/src/agents/securityAgent.ts index 32387b1209e..04b0e786e30 100644 --- a/libs/remix-ai-core/src/agents/securityAgent.ts +++ b/libs/remix-ai-core/src/agents/securityAgent.ts @@ -1,24 +1,185 @@ // security checks import * as fs from 'fs'; -class SecurityAgent { - private codebase: string[]; // list of code base file +interface SecurityReport { + compiled: boolean; + vulnerabilities: string[]; + isNotSafe: string; + fileName: string; + reportTimestamp: string; + recommendations: string[]; + fileModifiedSinceLastReport: boolean; + hasPastedCode: boolean; +} + +class WorkspaceWatcher { + private intervalId: NodeJS.Timeout | null = null; + public interval: number; + private task: () => void; + + constructor(task: () => void, interval: number) { + this.task = task; + this.interval = interval; + } + + start(): void { + if (this.intervalId === null) { + this.intervalId = setInterval(() => { + this.task(); + }, this.interval); + } + } + + stop(): void { + if (this.intervalId !== null) { + clearInterval(this.intervalId); + this.intervalId = null; + } + } + + isRunning(): boolean { + return this.intervalId !== null; + } +} + +export class SecurityAgent { public currentFile: string; + public openedFiles: any; + private basePlugin: any; + private watcher: WorkspaceWatcher; + public reports: SecurityReport[] = []; + + constructor(plugin) { + this.basePlugin = plugin; + + this.basePlugin.on('fileManager', 'fileAdded', (path) => { }); + this.basePlugin.on('fileManager', 'fileChanged', (path) => { //this.modifiedFile(path) + }); + + this.basePlugin.on('fileManager', 'fileRemoved', (path) => { this.removeFileFromReport(path) }); + this.basePlugin.on('fileManager', 'fileRenamed', (oldName, newName) => { + this.removeFileFromReport(oldName); + this.addFileToReport(newName); + }); + + this.basePlugin.on('solidity', 'compilationFinished', async (fileName, source, languageVersion, data) => { this.onCompilationFinished(fileName) }); + this.basePlugin.on('vyper', 'compilationFinished', async (fileName, source, languageVersion, data) => { this.onCompilationFinished(fileName) }); + this.basePlugin.on('hardhat', 'compilationFinished', async (fileName, source, languageVersion, data) => { this.onCompilationFinished(fileName) }); + this.basePlugin.on('foundry', 'compilationFinished', async (fileName, source, languageVersion, data) => { this.onCompilationFinished(fileName) }); + + this.watcher = new WorkspaceWatcher(async () => { + try { + this.currentFile = await this.basePlugin.call('fileManager', 'getCurrentFile'); + this.openedFiles = await this.basePlugin.call('fileManager', 'getOpenedFiles'); + + Object.keys(this.openedFiles).forEach(key => { + this.addFileToReport(this.openedFiles[key]); + }); + } catch (error) { + // no file selected or opened currently + } + }, 10000); + this.watcher.start(); + } + + addFileToReport(file: string): void { + const report = this.reports.find((r) => r.fileName === file); + if (report) { + // nothing to do + } else { + this.reports.push({ + compiled: false, + isNotSafe: 'No', + vulnerabilities: [], + fileName: file, + reportTimestamp: null, + recommendations: [], + fileModifiedSinceLastReport: false, + hasPastedCode: false + }); + } - constructor(codebasePath: string) { - // git or fs - this.codebase = this.loadCodebase(codebasePath); } - private loadCodebase(path: string): string[] { - const files = fs.readdirSync(path); - return files - .filter(file => file.endsWith('.ts')) - .flatMap(file => fs.readFileSync(`${path}/${file}`, 'utf-8').split('\n')); + async onCompilationFinished(file: string) { + let report = this.reports.find((r) => r.fileName === file); + if (report) { + report.compiled = true; + report.fileModifiedSinceLastReport = false; + } else { + report = { + compiled: true, + isNotSafe: 'No', + vulnerabilities: [], + fileName: file, + reportTimestamp: null, + recommendations: [], + fileModifiedSinceLastReport: false, + hasPastedCode: false + } + this.reports.push(report); + } + + try { + this.processFile(file); + console.log('Checking for vulnerabilities after compilation', this.reports); + } catch (error) { + console.error('Error checking for vulnerabilities after compilation: ', error); + } + + // check for security vulnerabilities } - public update(currentFile, lineNumber){ + removeFileFromReport(file: string): void { + const index = this.reports.findIndex((r) => r.fileName === file); + if (index !== -1) { + this.reports.splice(index, 1); + } + } + + modifiedFile(file: string): void { + const report = this.reports.find((r) => r.fileName === file); + if (report) { + report.fileModifiedSinceLastReport = true; + } + } + + async processFile(file: string) { + try { + const report = this.reports.find((r) => r.fileName === file); + if (report) { } + else { + this.reports.push({ + compiled: false, + isNotSafe: 'No', + vulnerabilities: [], + fileName: file, + reportTimestamp: null, + recommendations: [], + fileModifiedSinceLastReport: false, + hasPastedCode: false + }); + } + + if (!report.reportTimestamp || report.fileModifiedSinceLastReport) { + const content = await this.basePlugin.call('fileManager', 'getFile', file); + const prompt = "```\n" + content + "\n```\n\nReply in a short manner: Does this code contain major security vulenerabilities leading to a scam or loss of funds?" + + let result = await this.basePlugin.call('remixAI', 'vulnerability_check', prompt) + result = JSON.parse(result); + report.vulnerabilities = result.Reason; + report.recommendations = result.Suggestion; + report.isNotSafe = result.Answer; + report.reportTimestamp = new Date().toISOString(); + } + + } catch (error) { + console.error('Error processing file: ', error); + } + } + getReport(file: string): SecurityReport { + return this.reports.find((r) => r.fileName === file); } public getRecommendations(currentLine: string, numSuggestions: number = 3): string[] { diff --git a/libs/remix-ai-core/src/index.ts b/libs/remix-ai-core/src/index.ts index fe54a57f2f8..a53c630f32b 100644 --- a/libs/remix-ai-core/src/index.ts +++ b/libs/remix-ai-core/src/index.ts @@ -21,4 +21,5 @@ export { export * from './types/types' export * from './helpers/streamHandler' -export * from './agents/codeExplainAgent' \ No newline at end of file +export * from './agents/codeExplainAgent' +export * from './agents/securityAgent' \ No newline at end of file diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index 4975f985f91..c6ad3816184 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=true + test_env=false test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { diff --git a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts index 674d069f1cc..5f15022b10c 100644 --- a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts @@ -9,7 +9,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli props: EditorUIProps monaco: any completionEnabled: boolean - task: string + task: string = 'code_completion' currentCompletion: any private lastRequestTime: number = 0; private readonly minRequestInterval: number = 200; @@ -60,13 +60,6 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli endColumn: getTextAtLine(model.getLineCount()).length + 1, }); - if (!word.endsWith(' ') && - !word.endsWith('.') && - !word.endsWith('"') && - !word.endsWith('(')) { - return; - } - try { const split = word.split('\n') if (split.length < 2) return diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 56e9bc273e6..5947c47447f 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -697,7 +697,7 @@ export const EditorUI = (props: EditorUIProps) => { ), } - + // get the file name const pastedCode = editor.getModel().getValueInRange(e.range) const pastedCodePrompt = intl.formatMessage({ id: 'editor.PastedCodeSafety' }, { content:pastedCode }) props.plugin.call('remixAI', 'chatPipe', 'vulnerability_check', pastedCodePrompt) From 7b72b7b90dcfc572dd634369fdf50ec87020e82e Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:35:10 +0100 Subject: [PATCH 04/45] added ask remix AI button to modal --- .../editor/src/lib/remix-ui-editor.tsx | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 3ca90aa2862..743dfd0996b 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -666,6 +666,10 @@ export const EditorUI = (props: EditorUIProps) => { editor.onDidPaste(async (e) => { if (!pasteCodeRef.current && e && e.range && e.range.startLineNumber >= 0 && e.range.endLineNumber >= 0 && e.range.endLineNumber - e.range.startLineNumber > 10) { + // get the file name + const pastedCode = editor.getModel().getValueInRange(e.range) + const pastedCodePrompt = intl.formatMessage({ id: 'editor.PastedCodeSafety' }, { content:pastedCode }) + const modalContent: AlertModal = { id: 'newCodePasted', title: intl.formatMessage({ id: 'editor.title1' }), @@ -697,14 +701,23 @@ export const EditorUI = (props: EditorUIProps) => { }} /> +
+ +
), } - // get the file name - const pastedCode = editor.getModel().getValueInRange(e.range) - const pastedCodePrompt = intl.formatMessage({ id: 'editor.PastedCodeSafety' }, { content:pastedCode }) - props.plugin.call('remixAI', 'chatPipe', 'vulnerability_check', pastedCodePrompt) + props.plugin.call('notification', 'alert', modalContent) // pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) From f47deea9bb3c20421147464c610c3556cc8eb9fe Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:53:41 +0100 Subject: [PATCH 05/45] new modal with remix AI --- .../src/app/plugins/remixAIPlugin.tsx | 4 +-- .../src/inferencers/remote/remoteInference.ts | 2 +- .../editor/src/lib/remix-ui-editor.tsx | 31 +++++++++---------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx index e373c69991d..1c5618145fd 100644 --- a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx +++ b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx @@ -3,7 +3,7 @@ import { ViewPlugin } from '@remixproject/engine-web' import { Plugin } from '@remixproject/engine'; import { RemixAITab, ChatApi } from '@remix-ui/remix-ai' import React, { useCallback } from 'react'; -import { ICompletions, IModel, RemoteInferencer, IRemoteModel, IParams, GenerationParams, CodeExplainAgent, SecurityAgent} from '@remix/remix-ai-core'; +import { ICompletions, IModel, RemoteInferencer, IRemoteModel, IParams, GenerationParams, CodeExplainAgent, SecurityAgent } from '@remix/remix-ai-core'; import { CustomRemixApi } from '@remix-api' import { PluginViewWrapper } from '@remix-ui/helper' @@ -37,7 +37,7 @@ export class RemixAIPlugin extends ViewPlugin { isInferencing: boolean = false chatRequestBuffer: chatRequestBufferT = null codeExpAgent: CodeExplainAgent - securityAgent: SecurityAgent + securityAgent: SecurityAgent useRemoteInferencer:boolean = false dispatch: any diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index c6ad3816184..4975f985f91 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=false + test_env=true test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 743dfd0996b..b80eeff8d85 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint import { FormattedMessage, useIntl } from 'react-intl' import { isArray } from 'lodash' import Editor, { DiffEditor, loader, Monaco } from '@monaco-editor/react' -import { AlertModal } from '@remix-ui/app' +import { AppModal } from '@remix-ui/app' import { ConsoleLogs, QueryParams } from '@remix-project/remix-lib' import { reducerActions, reducerListener, initialState } from './actions/editor' import { solidityTokensProvider, solidityLanguageConfig } from './syntaxes/solidity' @@ -670,9 +670,18 @@ export const EditorUI = (props: EditorUIProps) => { const pastedCode = editor.getModel().getValueInRange(e.range) const pastedCodePrompt = intl.formatMessage({ id: 'editor.PastedCodeSafety' }, { content:pastedCode }) - const modalContent: AlertModal = { + const modalContent: AppModal = { id: 'newCodePasted', - title: intl.formatMessage({ id: 'editor.title1' }), + title: "New code pasted", + okLabel: 'Ask RemixAI', + cancelLabel: 'Close', + cancelFn: () => {}, + okFn: async () => { + await props.plugin.call('popupPanel', 'showPopupPanel', true) + setTimeout(async () => { + props.plugin.call('remixAI', 'chatPipe', 'vulnerability_check', pastedCodePrompt) + }, 500) + }, message: (
{' '} @@ -701,24 +710,12 @@ export const EditorUI = (props: EditorUIProps) => { }} />
-
- -
- ), + ) } - props.plugin.call('notification', 'alert', modalContent) + props.plugin.call('notification', 'modal', modalContent) // pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) // const result = await props.plugin.call('remixAI', 'vulnerability_check', pastedCodePrompt) From 872eff9ca5724d1879bf724a9f2695c50a6664c8 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 16 Dec 2024 13:52:27 +0100 Subject: [PATCH 06/45] disable testenv --- libs/remix-ai-core/src/inferencers/remote/remoteInference.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index 4975f985f91..c6ad3816184 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=true + test_env=false test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { From f39c7771f85d79b6a73ee558120e455b35ccdfc6 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 16 Dec 2024 14:43:46 +0100 Subject: [PATCH 07/45] added matamo eventz --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index b80eeff8d85..9cbe23d7d25 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -681,6 +681,8 @@ export const EditorUI = (props: EditorUIProps) => { setTimeout(async () => { props.plugin.call('remixAI', 'chatPipe', 'vulnerability_check', pastedCodePrompt) }, 500) + // add matamo event + _paq.push(['trackEvent', 'ai', 'remixAI', 'vulnerability_check_pasted_code']) }, message: (
@@ -718,8 +720,6 @@ export const EditorUI = (props: EditorUIProps) => { props.plugin.call('notification', 'modal', modalContent) // pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) - // const result = await props.plugin.call('remixAI', 'vulnerability_check', pastedCodePrompt) - // console.log(JSON.parse(result)) } }) From 56d5f72f3aa3651bbb956ee6ccab2fd2f50afbf1 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:18:25 +0100 Subject: [PATCH 08/45] lint --- libs/remix-ai-core/src/inferencers/remote/remoteInference.ts | 2 +- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index c6ad3816184..4975f985f91 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=false + test_env=true test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index 9cbe23d7d25..c5fe29751b0 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -716,7 +716,6 @@ export const EditorUI = (props: EditorUIProps) => {
) } - props.plugin.call('notification', 'modal', modalContent) // pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) From 7693972372fe16744f054da319309d9a75c17a79 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:00:23 +0100 Subject: [PATCH 09/45] test env off --- libs/remix-ai-core/src/inferencers/remote/remoteInference.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index 4975f985f91..c6ad3816184 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=true + test_env=false test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { From 3d17a58083732d6c61dc2e10432618325e0ecbd8 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:10:14 +0100 Subject: [PATCH 10/45] error handling AI chat --- libs/remix-ai-core/src/helpers/streamHandler.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/remix-ai-core/src/helpers/streamHandler.ts b/libs/remix-ai-core/src/helpers/streamHandler.ts index 9eb55118614..a298c8b88ec 100644 --- a/libs/remix-ai-core/src/helpers/streamHandler.ts +++ b/libs/remix-ai-core/src/helpers/streamHandler.ts @@ -46,6 +46,7 @@ export const HandleStreamResponse = async (streamResponse, } catch (error) { console.error('Error parsing JSON:', error); + return { 'generateText': 'Try again!', 'isGenerating': false } } } if (done_cb) { From 1af0283c3da9a6836c30662ae2961eb893ea7f49 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Wed, 18 Dec 2024 14:11:32 +0100 Subject: [PATCH 11/45] error handling AI chat --- libs/remix-ai-core/src/helpers/streamHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ai-core/src/helpers/streamHandler.ts b/libs/remix-ai-core/src/helpers/streamHandler.ts index a298c8b88ec..23a30ac0527 100644 --- a/libs/remix-ai-core/src/helpers/streamHandler.ts +++ b/libs/remix-ai-core/src/helpers/streamHandler.ts @@ -55,7 +55,7 @@ export const HandleStreamResponse = async (streamResponse, } catch (error) { console.error('Error parsing JSON:', error); - return { 'generateText': '', 'isGenerating': false } + return { 'generateText': 'Try again!', 'isGenerating': false } } } From 4475ed0c79034e4c81d4c020e01b903cf02e403b Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:28:17 +0100 Subject: [PATCH 12/45] typo --- apps/remix-ide/src/app/tabs/locales/en/editor.json | 2 +- libs/remix-ai-core/src/inferencers/remote/remoteInference.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/editor.json b/apps/remix-ide/src/app/tabs/locales/en/editor.json index 81d9f8c7c40..b5a06a18ad1 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/editor.json +++ b/apps/remix-ide/src/app/tabs/locales/en/editor.json @@ -28,7 +28,7 @@ "editor.explainFunctionByAI": "```\n{content}\n```\nExplain the function {currentFunction}", "editor.explainFunctionByAISol": "```\n{content}\n```\nExplain the function {currentFunction}", "editor.ExplainPipeMessage": "```\n {content}\n```\nExplain the snipped above", - "editor.PastedCodeSafety": "```\n {content}\n```\n\nReply in a short manner: Does this code contain major security vulenerabilities leading to a scam or loss of funds?", + "editor.PastedCodeSafety": "```\n {content}\n```\n\nReply in a short manner: Does this code contain major security vulnerabilities leading to a scam or loss of funds?", "editor.executeFreeFunction": "Run a free function", "editor.executeFreeFunction2": "Run the free function \"{name}\"", "editor.toastText1": "This can only execute free function", diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index c6ad3816184..4975f985f91 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=false + test_env=true test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { From e9e36ca9c2694cfb1973edb1f111cf3e39fa4a1c Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:34:24 +0100 Subject: [PATCH 13/45] typo --- libs/remix-ai-core/src/agents/securityAgent.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/remix-ai-core/src/agents/securityAgent.ts b/libs/remix-ai-core/src/agents/securityAgent.ts index 0a8f285db40..f55aaa7f2bc 100644 --- a/libs/remix-ai-core/src/agents/securityAgent.ts +++ b/libs/remix-ai-core/src/agents/securityAgent.ts @@ -163,7 +163,7 @@ export class SecurityAgent { if (!report.reportTimestamp || report.fileModifiedSinceLastReport) { const content = await this.basePlugin.call('fileManager', 'getFile', file); - const prompt = "```\n" + content + "\n```\n\nReply in a short manner: Does this code contain major security vulenerabilities leading to a scam or loss of funds?" + const prompt = "```\n" + content + "\n```\n\nReply in a short manner: Does this code contain major security vulnerabilities leading to a scam or loss of funds?" let result = await this.basePlugin.call('remixAI', 'vulnerability_check', prompt) result = JSON.parse(result); @@ -183,7 +183,6 @@ export class SecurityAgent { } public getRecommendations(currentLine: string, numSuggestions: number = 3): string[] { - // process the code base highlighting security vulnerabilities and deliver recommendations const suggestions: string[] = []; return suggestions; } From f48a2df2a0873a9f8d6f54d0031246fa8f73eca6 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:12:35 +0100 Subject: [PATCH 14/45] minor --- libs/remix-ai-core/src/inferencers/remote/remoteInference.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index 4975f985f91..c6ad3816184 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -12,7 +12,7 @@ export class RemoteInferencer implements ICompletions { max_history = 7 model_op = RemoteBackendOPModel.CODELLAMA // default model operation change this to llama if necessary event: EventEmitter - test_env=true + test_env=false test_url="http://solcodertest.org" constructor(apiUrl?:string, completionUrl?:string) { From 4bcfd933344b61ae82f5f76bff6595ede7c62099 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:58:52 +0100 Subject: [PATCH 15/45] Update remix-ui-editor.tsx --- libs/remix-ui/editor/src/lib/remix-ui-editor.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx index c5fe29751b0..e330efb78a8 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -717,7 +717,6 @@ export const EditorUI = (props: EditorUIProps) => { ) } props.plugin.call('notification', 'modal', modalContent) - // pasteCodeRef.current = true _paq.push(['trackEvent', 'editor', 'onDidPaste', 'more_than_10_lines']) } }) From c6a6599d930476f679f7445fd012238bbbf19bb0 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Mon, 13 Jan 2025 14:08:28 +0100 Subject: [PATCH 16/45] fix imports. fix exports. rename app.js --- apps/remix-ide/src/{app.js => app.ts} | 122 +++++++++++------- .../src/app/components/main-panel.tsx | 2 +- .../components/plugin-manager-component.js | 2 +- .../src/app/components/popup-panel.tsx | 2 +- apps/remix-ide/src/app/editor/editor.js | 12 +- apps/remix-ide/src/app/files/dgitProvider.ts | 2 +- apps/remix-ide/src/app/files/fileManager.ts | 2 +- .../remix-ide/src/app/files/remixDProvider.js | 2 +- .../src/app/files/workspaceFileProvider.js | 6 +- apps/remix-ide/src/app/panels/file-panel.js | 2 +- apps/remix-ide/src/app/panels/layout.ts | 2 +- apps/remix-ide/src/app/panels/tab-proxy.js | 2 +- apps/remix-ide/src/app/panels/terminal.tsx | 3 +- apps/remix-ide/src/app/tabs/analysis-tab.js | 2 +- apps/remix-ide/src/app/tabs/compile-tab.js | 2 +- apps/remix-ide/src/app/tabs/debugger-tab.js | 2 +- apps/remix-ide/src/app/tabs/settings-tab.tsx | 2 +- apps/remix-ide/src/app/tabs/test-tab.js | 2 +- apps/remix-ide/tsconfig.json | 2 +- libs/remix-ui/plugin-manager/src/types.d.ts | 22 +--- .../remix-ui/workspace/src/lib/types/index.ts | 12 +- 21 files changed, 109 insertions(+), 98 deletions(-) rename apps/remix-ide/src/{app.js => app.ts} (88%) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.ts similarity index 88% rename from apps/remix-ide/src/app.js rename to apps/remix-ide/src/app.ts index ab3b9ff2464..86eb8697a28 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.ts @@ -26,21 +26,21 @@ import { WalkthroughService } from './walkthroughService' import { OffsetToLineColumnConverter, CompilerMetadata, CompilerArtefacts, FetchAndCompile, CompilerImports, GistHandler } from '@remix-project/core-plugin' -import {Registry} from '@remix-project/remix-lib' -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, CancunVMProvider} 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 { Registry } from '@remix-project/remix-lib' +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, CancunVMProvider } 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 { EnvironmentExplorer } from './app/providers/environment-explorer' import { FileDecorator } from './app/plugins/file-decorator' import { CodeFormat } from './app/plugins/code-format' @@ -58,7 +58,7 @@ import { xtermPlugin } from './app/plugins/electron/xtermPlugin' import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin' import { compilerLoaderPlugin, compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin' import { appUpdaterPlugin } from './app/plugins/electron/appUpdaterPlugin' -import { remixAIDesktopPlugin } from './app/plugins/electron/remixAIDesktopPlugin' +import { remixAIDesktopPlugin } from './app/plugins/electron/remixAIDesktopPlugin' import { RemixAIPlugin } from './app/plugins/remixAIPlugin' import { SlitherHandleDesktop } from './app/plugins/electron/slitherPlugin' import { SlitherHandle } from './app/files/slither-handle' @@ -72,9 +72,9 @@ import { Matomo } from './app/plugins/matomo' import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin' -const isElectron = require('is-electron') +import isElectron from 'is-electron' -const remixLib = require('@remix-project/remix-lib') +import * as remixLib from '@remix-project/remix-lib' import { QueryParams } from '@remix-project/remix-lib' import { SearchPlugin } from './app/tabs/search' @@ -82,27 +82,27 @@ import { ScriptRunnerUIPlugin } from './app/tabs/script-runner-ui' import { ElectronProvider } from './app/files/electronProvider' const Storage = remixLib.Storage -const RemixDProvider = require('./app/files/remixDProvider') -const Config = require('./config') +import RemixDProvider from './app/files/remixDProvider' +import Config from './config' -const FileManager = require('./app/files/fileManager') +import FileManager from './app/files/fileManager' import FileProvider from "./app/files/fileProvider" import { appPlatformTypes } from '@remix-ui/app' -const DGitProvider = require('./app/files/dgitProvider') -const WorkspaceFileProvider = require('./app/files/workspaceFileProvider') +import DGitProvider from './app/files/dgitProvider' +import WorkspaceFileProvider from './app/files/workspaceFileProvider' -const PluginManagerComponent = require('./app/components/plugin-manager-component') +import PluginManagerComponent from './app/components/plugin-manager-component' -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 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') +import CompileTab from './app/tabs/compile-tab' +import SettingsTab from './app/tabs/settings-tab' +import AnalysisTab from './app/tabs/analysis-tab' +import DebuggerTab from './app/tabs/debugger-tab' +import TestTab from './app/tabs/test-tab' +import Filepanel from './app/panels/file-panel' +import Editor from './app/editor/editor' +import Terminal from './app/panels/terminal' +import TabProxy from './app/panels/tab-proxy.js' const _paq = (window._paq = window._paq || []) @@ -115,16 +115,49 @@ export class platformApi { } } +type Components = { + filesProviders: { + browser?: any + localhost?: any + workspace?: any + electron?: any + } +} + class AppComponent { + appManager: RemixAppManager + queryParams: QueryParams + private _components: Components + panels: any + workspace: any + engine: RemixEngine + matomoConfAlreadySet: any + matomoCurrentSetting: any + showMatomo: boolean + walkthroughService: WalkthroughService + platform: 'desktop' | 'web' + gistHandler: GistHandler + themeModule: ThemeModule + localeModule: LocaleModule + notification: NotificationPlugin + layout: Layout + mainview: any + menuicons: VerticalIcons + sidePanel: SidePanel + hiddenPanel: HiddenPanel + pinnedPanel: PinnedPanel + popupPanel: PopupPanel + statusBar: StatusBar + settings: SettingsTab constructor() { const PlatFormAPi = new platformApi() Registry.getInstance().put({ api: PlatFormAPi, name: 'platform' }) - this.appManager = new RemixAppManager({}) + this.appManager = new RemixAppManager() this.queryParams = new QueryParams() - this._components = {} + this._components = {} as Components // setup storage const configStorage = new Storage('config-v0.8:') @@ -161,7 +194,6 @@ class AppComponent { name: 'fileproviders' }) - } async run() { @@ -184,7 +216,7 @@ class AppComponent { this.matomoConfAlreadySet = Registry.getInstance().get('config').api.exists('settings/matomo-analytics') this.matomoCurrentSetting = Registry.getInstance().get('config').api.get('settings/matomo-analytics') - let electronTracking = window.electronAPI ? await window.electronAPI.canTrackMatomo() : false + const electronTracking = (window as any).electronAPI ? await (window as any).electronAPI.canTrackMatomo() : false const lastMatomoCheck = window.localStorage.getItem('matomo-analytics-consent') const sixMonthsAgo = new Date(); @@ -193,11 +225,11 @@ class AppComponent { const e2eforceMatomoToShow = window.localStorage.getItem('showMatomo') && window.localStorage.getItem('showMatomo') === 'true' const contextShouldShowMatomo = matomoDomains[window.location.hostname] || e2eforceMatomoToShow || electronTracking const shouldRenewConsent = this.matomoCurrentSetting === false && (!lastMatomoCheck || new Date(Number(lastMatomoCheck)) < sixMonthsAgo) // it is set to false for more than 6 months. - this.showMatomo = contextShouldShowMatomo && (!this.matomoConfAlreadySet || shouldRenewConsent) + this.showMatomo = contextShouldShowMatomo && (!this.matomoConfAlreadySet || shouldRenewConsent) if (this.showMatomo && shouldRenewConsent) { _paq.push(['trackEvent', 'Matomo', 'refreshMatomoPermissions']); - } + } this.walkthroughService = new WalkthroughService(appManager) @@ -387,7 +419,7 @@ class AppComponent { ganacheProvider, foundryProvider, externalHttpProvider, - environmentExplorer, + environmentExplorer, this.walkthroughService, search, solidityumlgen, @@ -456,10 +488,10 @@ class AppComponent { this.popupPanel = new PopupPanel() const pluginManagerComponent = new PluginManagerComponent(appManager, this.engine) - const filePanel = new FilePanel(appManager, contentImport) + const filePanel = new Filepanel(appManager, contentImport) this.statusBar = new StatusBar(filePanel, this.menuicons) const landingPage = new LandingPage(appManager, this.menuicons, fileManager, filePanel, contentImport) - this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor, appManager) + this.settings = new SettingsTab(Registry.getInstance().get('config').api, editor)//, appManager) this.engine.register([this.menuicons, landingPage, this.hiddenPanel, this.sidePanel, this.statusBar, filePanel, pluginManagerComponent, this.settings, this.pinnedPanel, this.popupPanel]) @@ -514,7 +546,7 @@ class AppComponent { async activate() { const queryParams = new QueryParams() - const params = queryParams.get() + const params: any = queryParams.get() try { this.engine.register(await this.appManager.registeredPlugins()) @@ -610,10 +642,11 @@ class AppComponent { } if (params.call) { - const callDetails = params.call.split('//') + const callDetails: any = params.call.split('//') if (callDetails.length > 1) { this.appManager.call('notification', 'toast', `initiating ${callDetails[0]} and calling "${callDetails[1]}" ...`) // @todo(remove the timeout when activatePlugin is on 0.3.0) + //@ts-ignore await this.appManager.call(...callDetails).catch(console.error) } } @@ -629,6 +662,7 @@ class AppComponent { // @todo(remove the timeout when activatePlugin is on 0.3.0) try { + //@ts-ignore await this.appManager.call(...callDetails) } catch (e) { console.error(e) diff --git a/apps/remix-ide/src/app/components/main-panel.tsx b/apps/remix-ide/src/app/components/main-panel.tsx index e48399e839b..a7f8a6a4225 100644 --- a/apps/remix-ide/src/app/components/main-panel.tsx +++ b/apps/remix-ide/src/app/components/main-panel.tsx @@ -15,7 +15,7 @@ const profile = { export class MainPanel extends AbstractPanel { element: HTMLDivElement dispatch: React.Dispatch = () => {} - constructor(config) { + constructor(config = null) { super(profile) this.element = document.createElement('div') this.element.setAttribute('data-id', 'mainPanelPluginsContainer') diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index 816d9c1c11f..e4471bbed20 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -19,7 +19,7 @@ const profile = { maintainedBy: "Remix" } -class PluginManagerComponent extends ViewPlugin { +export default class PluginManagerComponent extends ViewPlugin { constructor (appManager, engine) { super(profile) this.appManager = appManager diff --git a/apps/remix-ide/src/app/components/popup-panel.tsx b/apps/remix-ide/src/app/components/popup-panel.tsx index b000fde79d1..1728dbfbba6 100644 --- a/apps/remix-ide/src/app/components/popup-panel.tsx +++ b/apps/remix-ide/src/app/components/popup-panel.tsx @@ -24,7 +24,7 @@ export class PopupPanel extends AbstractPanel { dispatch: React.Dispatch = () => { } appStateDispatch: React.Dispatch = () => { } - constructor(config) { + constructor(config = null) { super(profile) this.event = new EventEmitter() } diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index b5f763db627..04259079aa5 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -16,7 +16,7 @@ const profile = { methods: ['highlight', 'discardHighlight', 'clearAnnotations', 'addLineText', 'discardLineTexts', 'addAnnotation', 'gotoLine', 'revealRange', 'getCursorPosition', 'open', 'addModel','addErrorMarker', 'clearErrorMarkers', 'getText', 'getPositionAt', 'openReadOnly'], } -class Editor extends Plugin { +export default class Editor extends Plugin { constructor () { super(profile) @@ -90,7 +90,7 @@ class Editor extends Plugin { } render () { - return
{ + return
{ this.ref = element this.ref.currentContent = () => this.currentContent() // used by e2e test this.ref.setCurrentContent = (value) => { @@ -102,7 +102,7 @@ class Editor extends Plugin { this.ref.gotoLine = (line, column) => this.gotoLine(line, column || 0) this.ref.getCursorPosition = () => this.getCursorPosition() this.ref.addDecoration = (marker, filePath, typeOfDecoration) => this.addDecoration(marker, filePath, typeOfDecoration) - this.ref.clearDecorationsByPlugin = (filePath, plugin, typeOfDecoration) => this.clearDecorationsByPlugin(filePath, plugin, typeOfDecoration) + this.ref.clearDecorationsByPlugin = (filePath, plugin, typeOfDecoration) => this.clearDecorationsByPlugin(filePath, plugin, typeOfDecoration) this.ref.keepDecorationsFor = (name, typeOfDecoration) => this.keepDecorationsFor(name, typeOfDecoration) }} id='editorView'> @@ -249,7 +249,7 @@ class Editor extends Plugin { */ async _createSession (path, content, mode, readOnly) { if (!this.activated) return - + this.emit('addModel', content, mode, path, readOnly || this.readOnlySessions[path]) return { path, @@ -548,7 +548,7 @@ class Editor extends Plugin { decoration.from = from const { currentDecorations, registeredDecorations } = this.api.addDecoration(decoration, path, typeOfDecoration) - if (!this.registeredDecorations[typeOfDecoration][filePath]) this.registeredDecorations[typeOfDecoration][filePath] = [] + if (!this.registeredDecorations[typeOfDecoration][filePath]) this.registeredDecorations[typeOfDecoration][filePath] = [] this.registeredDecorations[typeOfDecoration][filePath].push(...registeredDecorations) if (!this.currentDecorations[typeOfDecoration][filePath]) this.currentDecorations[typeOfDecoration][filePath] = [] this.currentDecorations[typeOfDecoration][filePath].push(...currentDecorations) @@ -601,5 +601,3 @@ class Editor extends Plugin { return this.api.getPositionAt(offset) } } - -module.exports = Editor diff --git a/apps/remix-ide/src/app/files/dgitProvider.ts b/apps/remix-ide/src/app/files/dgitProvider.ts index cdb863b4b71..4a8778c0ef0 100644 --- a/apps/remix-ide/src/app/files/dgitProvider.ts +++ b/apps/remix-ide/src/app/files/dgitProvider.ts @@ -28,7 +28,7 @@ const profile: LibraryProfile = { , 'getGitHubUser', 'remotebranches', 'remotecommits', 'repositories', 'getCommitChanges', 'compareBranches'], kind: 'file-system' } -class DGitProvider extends Plugin { +export default class DGitProvider extends Plugin { constructor() { super(profile) } diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index a821ced648f..dfb2f651a36 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -40,7 +40,7 @@ const errorMsg = { const createError = (err) => { return new Error(`${errorMsg[err.code]} ${err.message || ''}`) } -class FileManager extends Plugin { +export default class FileManager extends Plugin { mode: string openedFiles: any editor: any diff --git a/apps/remix-ide/src/app/files/remixDProvider.js b/apps/remix-ide/src/app/files/remixDProvider.js index 62171fdc5bb..f13ccbaa0c3 100644 --- a/apps/remix-ide/src/app/files/remixDProvider.js +++ b/apps/remix-ide/src/app/files/remixDProvider.js @@ -1,7 +1,7 @@ 'use strict' import FileProvider from "./fileProvider" -module.exports = class RemixDProvider extends FileProvider { +export default class RemixDProvider extends FileProvider { constructor (appManager) { super('localhost') this._appManager = appManager diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index 900ad8ccbaf..c7e33862c4e 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -3,7 +3,7 @@ const EventManager = require('events') import FileProvider from "./fileProvider" -class WorkspaceFileProvider extends FileProvider { +export default class WorkspaceFileProvider extends FileProvider { constructor () { super('') this.workspacesPath = '.workspaces' @@ -18,10 +18,10 @@ class WorkspaceFileProvider extends FileProvider { }) }).catch((e) => { console.log(e) - }) + }) } catch (e) { // we don't need to log error if this throws an error - } + } } setWorkspace (workspace) { diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 2b3946bca1f..6277bffcc93 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -55,7 +55,7 @@ const profile = { version: packageJson.version, maintainedBy: 'Remix' } -module.exports = class Filepanel extends ViewPlugin { +export default class Filepanel extends ViewPlugin { constructor(appManager, contentImport) { super(profile) this.registry = Registry.getInstance() diff --git a/apps/remix-ide/src/app/panels/layout.ts b/apps/remix-ide/src/app/panels/layout.ts index 539a9b1c486..2ed6541d9eb 100644 --- a/apps/remix-ide/src/app/panels/layout.ts +++ b/apps/remix-ide/src/app/panels/layout.ts @@ -12,7 +12,7 @@ const profile: Profile = { interface panelState { active: boolean plugin: Plugin - minimized: boolean + minimized?: boolean } interface panels { tabs: panelState diff --git a/apps/remix-ide/src/app/panels/tab-proxy.js b/apps/remix-ide/src/app/panels/tab-proxy.js index d71bd3ec6a5..8c90ca8b8e5 100644 --- a/apps/remix-ide/src/app/panels/tab-proxy.js +++ b/apps/remix-ide/src/app/panels/tab-proxy.js @@ -10,7 +10,7 @@ const profile = { kind: 'other' } -export class TabProxy extends Plugin { +export default class TabProxy extends Plugin { constructor (fileManager, editor) { super(profile) this.event = new EventEmitter() diff --git a/apps/remix-ide/src/app/panels/terminal.tsx b/apps/remix-ide/src/app/panels/terminal.tsx index a30cf085bdc..3623a592cb7 100644 --- a/apps/remix-ide/src/app/panels/terminal.tsx +++ b/apps/remix-ide/src/app/panels/terminal.tsx @@ -24,7 +24,7 @@ const profile = { version: packageJson.version } -class Terminal extends Plugin { +export default class Terminal extends Plugin { fileImport: CompilerImports event: any globalRegistry: Registry @@ -163,4 +163,3 @@ class Terminal extends Plugin { } } -module.exports = Terminal diff --git a/apps/remix-ide/src/app/tabs/analysis-tab.js b/apps/remix-ide/src/app/tabs/analysis-tab.js index 77080b17704..90d0900fb8f 100644 --- a/apps/remix-ide/src/app/tabs/analysis-tab.js +++ b/apps/remix-ide/src/app/tabs/analysis-tab.js @@ -22,7 +22,7 @@ const profile = { maintainedBy: 'Remix' } -class AnalysisTab extends ViewPlugin { +export default class AnalysisTab extends ViewPlugin { constructor () { super(profile) this.event = new EventManager() diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 70f0d498a79..eed9cb68185 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -28,7 +28,7 @@ const profile = { // - events: ['compilationFinished'], // - methods: ['getCompilationResult'] -class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerApi +export default class CompileTab extends CompilerApiMixin(ViewPlugin) { // implements ICompilerApi constructor (config, fileManager) { super(profile) this.fileManager = fileManager diff --git a/apps/remix-ide/src/app/tabs/debugger-tab.js b/apps/remix-ide/src/app/tabs/debugger-tab.js index 9560713ffee..0e30f19b2ff 100644 --- a/apps/remix-ide/src/app/tabs/debugger-tab.js +++ b/apps/remix-ide/src/app/tabs/debugger-tab.js @@ -22,7 +22,7 @@ const profile = { maintainedBy: 'Remix' } -export class DebuggerTab extends DebuggerApiMixin(ViewPlugin) { +export default class DebuggerTab extends DebuggerApiMixin(ViewPlugin) { constructor () { super(profile) this.el = document.createElement('div') diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index 08557e3a310..8a5ac39a94c 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -27,7 +27,7 @@ const profile = { maintainedBy: 'Remix' } -module.exports = class SettingsTab extends ViewPlugin { +export default class SettingsTab extends ViewPlugin { config: any = {} editor: any private _deps: { diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 6a317cdacd2..8d695366fdf 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -22,7 +22,7 @@ const profile = { maintainedBy: 'Remix' } -module.exports = class TestTab extends ViewPlugin { +export default class TestTab extends ViewPlugin { constructor (fileManager, offsetToLineColumnConverter, filePanel, compileTab, appManager, contentImport) { super(profile) this.compileTab = compileTab diff --git a/apps/remix-ide/tsconfig.json b/apps/remix-ide/tsconfig.json index c702a5fbd51..f3e89427cc4 100644 --- a/apps/remix-ide/tsconfig.json +++ b/apps/remix-ide/tsconfig.json @@ -12,5 +12,5 @@ "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nrwl/react/typings/image.d.ts" ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "src/app.js.bkup"] } diff --git a/libs/remix-ui/plugin-manager/src/types.d.ts b/libs/remix-ui/plugin-manager/src/types.d.ts index cfe333c636c..2e16627e8a0 100644 --- a/libs/remix-ui/plugin-manager/src/types.d.ts +++ b/libs/remix-ui/plugin-manager/src/types.d.ts @@ -34,14 +34,11 @@ export class RemixAppManager extends PluginManager { event: EventEmitter pluginsDirectory: string pluginLoader: PluginLoader // eslint-disable-line no-use-before-define - permissionHandler: PermissionHandler getAll(): import('@remixproject/plugin-utils').Profile[] getIds(): string[] isDependent(name: any): any isRequired(name: any): any registeredPlugins(): Promise - turnPluginOn(name: string | string[]) - turnPluginOff(name: string) } export class PluginManagerSettings { @@ -67,7 +64,7 @@ export type PluginPermissions = { } } -export class PluginManagerComponent extends ViewPlugin extends Plugin implements PluginBase { +export class PluginManagerComponent extends ViewPlugin implements PluginBase { constructor(appManager: RemixAppManager, engine: Engine) appManager: RemixAppManager pluginSettings: PluginManagerSettings @@ -154,14 +151,6 @@ declare class PluginLoader { set(plugin: any, actives: any): void get(): any } -// eslint-disable-next-line no-redeclare -export type PluginManagerSettings = { - openDialog: () => void - onValidation: () => void - clearPermission: (from: any, to: any, method: any) => void - settings: () => HTMLElement - render: () => HTMLElement -} export interface DefaultLocalPlugin extends Profile { name: string @@ -198,14 +187,5 @@ export type PluginManagerProfile = Profile & { type: 'iframe' | 'ws' hash: string } -// eslint-disable-next-line no-redeclare -export type LocalPlugin = { - create: () => Profile - updateName: (target: string) => void - updateDisplayName: (displayName: string) => void - updateProfile: (key: string, e: Event) => void - updateMethods: (target: any) => void - form: () => HTMLElement -} export { } diff --git a/libs/remix-ui/workspace/src/lib/types/index.ts b/libs/remix-ui/workspace/src/lib/types/index.ts index ba23f4cdc25..e98dbd2075f 100644 --- a/libs/remix-ui/workspace/src/lib/types/index.ts +++ b/libs/remix-ui/workspace/src/lib/types/index.ts @@ -70,7 +70,7 @@ export interface FilePanelType extends ViewPlugin { setWorkspace: ({ name, isLocalhost }, setEvent: boolean) => void createWorkspace: (name: string, workspaceTemplateName: string) => void renameWorkspace: (oldName: string, newName: string) => void - compileContractForUml: (path: string) => void + compileContractForUml?: (path: string) => void workspaceRenamed: ({ name }) => void workspaceCreated: ({ name }) => void workspaceDeleted: ({ name }) => void @@ -81,7 +81,7 @@ export interface FilePanelType extends ViewPlugin { appManager: RemixAppManager registry?: any // registry pluginApi?: any - request: { + request?: { createWorkspace: () => void setWorkspace: (workspaceName: string) => void createNewFile: () => void @@ -89,10 +89,10 @@ export interface FilePanelType extends ViewPlugin { getCurrentWorkspace: () => void } // api request, workspaces: any - registeredMenuItems: MenuItems // menu items - removedMenuItems: MenuItems - initialWorkspace: string - resetNewFile: () => void + registeredMenuItems?: MenuItems // menu items + removedMenuItems?: MenuItems + initialWorkspace?: string + resetNewFile?: () => void getWorkspaces: () => string[] expandPath: string[] } From 249bfc4ac7bdbefbb743aaebb95e6186edabf712 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 14 Jan 2025 09:55:24 +0100 Subject: [PATCH 17/45] remove redundant file type from include array --- apps/remix-ide/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/tsconfig.json b/apps/remix-ide/tsconfig.json index f3e89427cc4..c702a5fbd51 100644 --- a/apps/remix-ide/tsconfig.json +++ b/apps/remix-ide/tsconfig.json @@ -12,5 +12,5 @@ "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", "../../node_modules/@nrwl/react/typings/image.d.ts" ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "src/app.js.bkup"] + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] } From 2924e4ef157439144e599d18d295617a4a87d9ff Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Tue, 7 Jan 2025 12:10:55 +0100 Subject: [PATCH 18/45] fix --- libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx index d9f9b449559..639df9df960 100644 --- a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx +++ b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx @@ -88,6 +88,11 @@ export const TabsUI = (props: TabsUIProps) => { const getAI = async () => { try { + const init_state = await props.plugin.call('settings', 'getCopilotSetting') + if (init_state === undefined || init_state === null) { + await props.plugin.call('settings', 'updateCopilotChoice', ai_switch) + return ai_switch + } return await props.plugin.call('settings', 'getCopilotSetting') } catch (e) { return false From c61b5fbf5baf26c2d7f3ab45e7159b6dee1f3056 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:09:47 +0100 Subject: [PATCH 19/45] Update remix-ui-tabs.tsx minor --- libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx index 639df9df960..0d279961a33 100644 --- a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx +++ b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx @@ -93,7 +93,7 @@ export const TabsUI = (props: TabsUIProps) => { await props.plugin.call('settings', 'updateCopilotChoice', ai_switch) return ai_switch } - return await props.plugin.call('settings', 'getCopilotSetting') + return init_state } catch (e) { return false } From 7200f31fad4cc59cf1be1216620bb3787712abdb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 14 Jan 2025 16:57:36 +0100 Subject: [PATCH 20/45] flaky --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ac8815bdfb..e47c15c3636 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 8aa15f221cb..2916e55a15d 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -195,7 +195,7 @@ module.exports = { .journalChildIncludes('inside getOwner', { shouldHaveOnlyOneOccurrence: true }) }, - 'Emit 2 similar events and check the filtering is done properly #group4': function (browser: NightwatchBrowser) { + 'Emit 2 similar events and check the filtering is done properly #group4 #flaky': function (browser: NightwatchBrowser) { let addressRef: string browser .addFile('contracts/contract_with_event.sol', { content: contract_with_event }) From 43084d19b631be3a06e84fa766d0d58aa7c011eb Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 07:18:55 +0100 Subject: [PATCH 21/45] flaky test --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e47c15c3636..47c92c67777 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -785,7 +785,7 @@ workflows: browser: ["chrome", "firefox"] script: ["flaky.sh"] job: ["nogroup"] - jobsize: ["1"] + jobsize: ["10"] parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> From 71a86d57566e772dbdccd22599de99e9cb5e1852 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 07:42:16 +0100 Subject: [PATCH 22/45] more asserting --- .../src/commands/selectContract.ts | 27 ++++++++----------- apps/remix-ide-e2e/src/tests/terminal.test.ts | 18 ++++++------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectContract.ts b/apps/remix-ide-e2e/src/commands/selectContract.ts index d270f8949d2..5db4c506f1c 100644 --- a/apps/remix-ide-e2e/src/commands/selectContract.ts +++ b/apps/remix-ide-e2e/src/commands/selectContract.ts @@ -1,22 +1,17 @@ -import { NightwatchBrowser } from 'nightwatch' -import EventEmitter from 'events' +import { NightwatchBrowser } from 'nightwatch'; +import EventEmitter from 'events'; -const selector = '.udapp_contractNames' +const selector = '.udapp_contractNames'; class SelectContract extends EventEmitter { - command (this: NightwatchBrowser, contractName: string): NightwatchBrowser { - this.api.waitForElementVisible(selector).perform((done) => { - selectContract(this.api, contractName, () => { - done() - this.emit('complete') - }) - }) - return this + command(this: NightwatchBrowser, contractName: string): NightwatchBrowser { + this.api + .waitForElementVisible(selector) + .waitForElementPresent(`${selector} option[value="${contractName}"]`) + .click(`${selector} option[value="${contractName}"]`) + .perform(() => this.emit('complete')); + return this; } } -function selectContract (browser: NightwatchBrowser, contractName: string, callback: VoidFunction) { - browser.click(`${selector} option[value="${contractName}"]`).perform(() => callback()) -} - -module.exports = SelectContract +module.exports = SelectContract; diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 2916e55a15d..add4ee2c6be 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -209,18 +209,16 @@ module.exports = { .createContract('') .getAddressAtPosition(0, (address) => { addressRef = address - }) - .perform((done) => { browser.addFile('scripts/test_filtering_event.ts', { content: test_filtering_event.replace('
', addressRef) }) - .perform(() => done()) + .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') + .pause(1000) + .waitForElementContainsText('*[data-id="terminalJournal"]', '1') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'true') + .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') // re-emit the event + .waitForElementContainsText('*[data-id="terminalJournal"]', '2') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'false') }) - .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') - .pause(1000) - .waitForElementContainsText('*[data-id="terminalJournal"]', '1') - .waitForElementContainsText('*[data-id="terminalJournal"]', 'true') - .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') // re-emit the event - .waitForElementContainsText('*[data-id="terminalJournal"]', '2') - .waitForElementContainsText('*[data-id="terminalJournal"]', 'false') + }, 'Should display auto-complete menu #group4': function (browser: NightwatchBrowser) { From 8bc48959dad584d83884b750fa8fbb9c4703e45a Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 08:07:20 +0100 Subject: [PATCH 23/45] turn off flaky --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47c92c67777..1d7985eeb7c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index add4ee2c6be..77bb44f5484 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -195,7 +195,7 @@ module.exports = { .journalChildIncludes('inside getOwner', { shouldHaveOnlyOneOccurrence: true }) }, - 'Emit 2 similar events and check the filtering is done properly #group4 #flaky': function (browser: NightwatchBrowser) { + 'Emit 2 similar events and check the filtering is done properly #group4': function (browser: NightwatchBrowser) { let addressRef: string browser .addFile('contracts/contract_with_event.sol', { content: contract_with_event }) From 195212fb679259ca43a56b07bc327dd50eb321c4 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 08:08:14 +0100 Subject: [PATCH 24/45] turn off flaky --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d7985eeb7c..4ac8815bdfb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -785,7 +785,7 @@ workflows: browser: ["chrome", "firefox"] script: ["flaky.sh"] job: ["nogroup"] - jobsize: ["10"] + jobsize: ["1"] parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> From 52946ddb2cd6ec307f832d701ff6f496060d7f1b Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 08:08:48 +0100 Subject: [PATCH 25/45] lint --- apps/remix-ide-e2e/src/commands/selectContract.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectContract.ts b/apps/remix-ide-e2e/src/commands/selectContract.ts index 5db4c506f1c..87bbc40c301 100644 --- a/apps/remix-ide-e2e/src/commands/selectContract.ts +++ b/apps/remix-ide-e2e/src/commands/selectContract.ts @@ -1,7 +1,7 @@ -import { NightwatchBrowser } from 'nightwatch'; -import EventEmitter from 'events'; +import { NightwatchBrowser } from 'nightwatch' +import EventEmitter from 'events' -const selector = '.udapp_contractNames'; +const selector = '.udapp_contractNames' class SelectContract extends EventEmitter { command(this: NightwatchBrowser, contractName: string): NightwatchBrowser { @@ -9,9 +9,9 @@ class SelectContract extends EventEmitter { .waitForElementVisible(selector) .waitForElementPresent(`${selector} option[value="${contractName}"]`) .click(`${selector} option[value="${contractName}"]`) - .perform(() => this.emit('complete')); - return this; + .perform(() => this.emit('complete')) + return this } } -module.exports = SelectContract; +module.exports = SelectContract From 6de3e3d44b79468df564e7fe16c1f746701bd1b9 Mon Sep 17 00:00:00 2001 From: dxsullivan <193140725+dxsullivan@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:27:43 +0800 Subject: [PATCH 26/45] Fix: libs/remix-ui/run-tab/src/lib/actions/deploy.ts --- libs/remix-ui/run-tab/src/lib/actions/deploy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts index ed66b6128b2..f8ba1ae56ef 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts @@ -42,7 +42,7 @@ const loadContractFromAddress = (plugin: RunTab, address, confirmCb, cb) => { export const getSelectedContract = (contractName: string, compiler: CompilerAbstractType): ContractData => { if (!contractName) return null - // const compiler = plugin.compilersArtefacts[compilerAtributeName] + // const compiler = plugin.compilersArtefacts[compilerAttributeName] if (!compiler) return null From c6a5af31c924391b04260008e26a77ab08512cea Mon Sep 17 00:00:00 2001 From: dxsullivan <193140725+dxsullivan@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:27:52 +0800 Subject: [PATCH 27/45] Fix: libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx --- .../search/src/lib/components/results/ResultSummary.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx index 2878b491c67..cb1e28495a6 100644 --- a/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx +++ b/libs/remix-ui/search/src/lib/components/results/ResultSummary.tsx @@ -13,10 +13,10 @@ interface ResultSummaryProps { export const ResultSummary = (props: ResultSummaryProps) => { const intl = useIntl() - const { hightLightInPath, replaceText, state } = useContext(SearchContext) + const { highlightInPath, replaceText, state } = useContext(SearchContext) const { modal } = useDialogDispatchers() const selectLine = async (line: SearchResultLineLine) => { - await hightLightInPath(props.searchResult, line) + await highlightInPath(props.searchResult, line) } const confirmReplace = async (line: SearchResultLineLine) => { From c25d7a706b1988d4252622e84469801da3448d5f Mon Sep 17 00:00:00 2001 From: dxsullivan <193140725+dxsullivan@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:27:59 +0800 Subject: [PATCH 28/45] Fix: libs/remix-ui/search/src/lib/context/context.tsx --- libs/remix-ui/search/src/lib/context/context.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/search/src/lib/context/context.tsx b/libs/remix-ui/search/src/lib/context/context.tsx index 336955c7443..e0d79330429 100644 --- a/libs/remix-ui/search/src/lib/context/context.tsx +++ b/libs/remix-ui/search/src/lib/context/context.tsx @@ -19,7 +19,7 @@ export interface SearchingStateInterface { setWholeWord: (value: boolean) => void setSearchResults: (value: SearchResult[]) => void findText: (path: string) => Promise - hightLightInPath: (result: SearchResult, line: SearchResultLineLine) => void + highlightInPath: (result: SearchResult, line: SearchResultLineLine) => void replaceText: (result: SearchResult, line: SearchResultLineLine) => Promise reloadFile: (file: string) => void toggleCaseSensitive: () => void @@ -194,7 +194,7 @@ export const SearchProvider = ({ children = [], reducer = SearchReducer, initial // do nothing } }, - hightLightInPath: async (result: SearchResult, line: SearchResultLineLine) => { + highlightInPath: async (result: SearchResult, line: SearchResultLineLine) => { await plugin.call('editor', 'discardHighlight') await plugin.call('editor', 'highlight', line.position, result.path) await plugin.call('editor', 'revealRange', line.position.start.line, line.position.start.column, line.position.end.line, line.position.end.column) From fad4d978762f8175a90cb729df25fdcdfe07af91 Mon Sep 17 00:00:00 2001 From: oliveredget <188809800+oliveredget@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:58:53 +0800 Subject: [PATCH 29/45] Update udapp.json Signed-off-by: oliveredget <188809800+oliveredget@users.noreply.github.com> --- apps/remix-dapp/src/locales/en/udapp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-dapp/src/locales/en/udapp.json b/apps/remix-dapp/src/locales/en/udapp.json index 4315f57a596..0d3952cc1aa 100644 --- a/apps/remix-dapp/src/locales/en/udapp.json +++ b/apps/remix-dapp/src/locales/en/udapp.json @@ -26,7 +26,7 @@ "udapp.contractOptionsTitle2": "Select a compiled contract to deploy or to use with At Address.", "udapp.contractOptionsTitle3": "Select and compile *.sol file to deploy or access a contract.", "udapp.contractOptionsTitle4": "When there is a compiled .sol file, choose the contract to deploy or to use with At Address.", - "udapp.checkSumWarning": "It seems you are not using a checksumed address.A checksummed address is an address that contains uppercase letters, as specified in {a}.Checksummed addresses are meant to help prevent users from sending transactions to the wrong address.", + "udapp.checkSumWarning": "It seems you are not using a checksummed address.A checksummed address is an address that contains uppercase letters, as specified in {a}.Checksummed addresses are meant to help prevent users from sending transactions to the wrong address.", "udapp.isOverSizePromptEip170": "Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fail if the current network has activated the eip 170. More info: {a}", "udapp.isOverSizePromptEip3860": "Contract creation init code exceeds the allowed max code size of 49152 bytes. The deployment will likely fail if the current network has activated the eip 3860. More info: {a}", "udapp.thisContractMayBeAbstract": "This contract may be abstract, it may not implement an abstract parent's methods completely or it may not invoke an inherited contract's constructor correctly.", From 27d114da8aecb28271372e75c983c2126fa46aac Mon Sep 17 00:00:00 2001 From: oliveredget <188809800+oliveredget@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:59:06 +0800 Subject: [PATCH 30/45] Update udapp.json Signed-off-by: oliveredget <188809800+oliveredget@users.noreply.github.com> --- apps/remix-dapp/src/locales/zh/udapp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-dapp/src/locales/zh/udapp.json b/apps/remix-dapp/src/locales/zh/udapp.json index 35dad029bb1..695b0ffee7e 100644 --- a/apps/remix-dapp/src/locales/zh/udapp.json +++ b/apps/remix-dapp/src/locales/zh/udapp.json @@ -23,7 +23,7 @@ "udapp.contractOptionsTitle2": "选择要部署或与 At Address 一起使用的已编译合约。", "udapp.contractOptionsTitle3": "选择并编译 *.sol 文件以部署或访问合约。", "udapp.contractOptionsTitle4": "当有编译的 .sol 文件时,选择 {br} 合约进行部署或与 AtAddress 一起使用。", - "udapp.checkSumWarning": "您似乎没有使用 checksumed address 。{br} checksumed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", + "udapp.checkSumWarning": "您似乎没有使用 checksummed address 。{br} checksumed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", "udapp.isOverSizePromptEip170": "合约创建初始化返回长度超过24576字节的数据。部署可能会失败。 {br}更多信息:{a}", "udapp.isOverSizePromptEip3860": "合约创建初始化代码超出了允许的最大代码大小 49152 字节。如果当前网络已激活 eip 3860,则部署可能会失败。更多信息:{a}", "udapp.thisContractMayBeAbstract": "这个合约可能是抽象的,它可能没有完全实现抽象父类的方法,或者它可能没有正确调用继承合约的构造函数。", From 43a39d1ddc2eafc3ea6cd84bfc6f68778d967243 Mon Sep 17 00:00:00 2001 From: oliveredget <188809800+oliveredget@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:59:25 +0800 Subject: [PATCH 31/45] Update udapp.json Signed-off-by: oliveredget <188809800+oliveredget@users.noreply.github.com> --- apps/remix-dapp/src/locales/zh/udapp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-dapp/src/locales/zh/udapp.json b/apps/remix-dapp/src/locales/zh/udapp.json index 695b0ffee7e..169fd6d6993 100644 --- a/apps/remix-dapp/src/locales/zh/udapp.json +++ b/apps/remix-dapp/src/locales/zh/udapp.json @@ -23,7 +23,7 @@ "udapp.contractOptionsTitle2": "选择要部署或与 At Address 一起使用的已编译合约。", "udapp.contractOptionsTitle3": "选择并编译 *.sol 文件以部署或访问合约。", "udapp.contractOptionsTitle4": "当有编译的 .sol 文件时,选择 {br} 合约进行部署或与 AtAddress 一起使用。", - "udapp.checkSumWarning": "您似乎没有使用 checksummed address 。{br} checksumed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", + "udapp.checkSumWarning": "您似乎没有使用 checksummed address 。{br} checksummed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", "udapp.isOverSizePromptEip170": "合约创建初始化返回长度超过24576字节的数据。部署可能会失败。 {br}更多信息:{a}", "udapp.isOverSizePromptEip3860": "合约创建初始化代码超出了允许的最大代码大小 49152 字节。如果当前网络已激活 eip 3860,则部署可能会失败。更多信息:{a}", "udapp.thisContractMayBeAbstract": "这个合约可能是抽象的,它可能没有完全实现抽象父类的方法,或者它可能没有正确调用继承合约的构造函数。", From 214768a3e6e840745b8ea71b96d95adee038e81b Mon Sep 17 00:00:00 2001 From: oliveredget <188809800+oliveredget@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:59:33 +0800 Subject: [PATCH 32/45] Update udapp.json Signed-off-by: oliveredget <188809800+oliveredget@users.noreply.github.com> --- apps/remix-dapp/src/locales/zh/udapp.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-dapp/src/locales/zh/udapp.json b/apps/remix-dapp/src/locales/zh/udapp.json index 169fd6d6993..7fb99322b35 100644 --- a/apps/remix-dapp/src/locales/zh/udapp.json +++ b/apps/remix-dapp/src/locales/zh/udapp.json @@ -23,7 +23,7 @@ "udapp.contractOptionsTitle2": "选择要部署或与 At Address 一起使用的已编译合约。", "udapp.contractOptionsTitle3": "选择并编译 *.sol 文件以部署或访问合约。", "udapp.contractOptionsTitle4": "当有编译的 .sol 文件时,选择 {br} 合约进行部署或与 AtAddress 一起使用。", - "udapp.checkSumWarning": "您似乎没有使用 checksummed address 。{br} checksummed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksumed address 旨在帮助防止用户将交易发送到错误地址。", + "udapp.checkSumWarning": "您似乎没有使用 checksummed address 。{br} checksummed address 是包含大写字母的地址,如 {a} 中所指定。{br} checksummed address 旨在帮助防止用户将交易发送到错误地址。", "udapp.isOverSizePromptEip170": "合约创建初始化返回长度超过24576字节的数据。部署可能会失败。 {br}更多信息:{a}", "udapp.isOverSizePromptEip3860": "合约创建初始化代码超出了允许的最大代码大小 49152 字节。如果当前网络已激活 eip 3860,则部署可能会失败。更多信息:{a}", "udapp.thisContractMayBeAbstract": "这个合约可能是抽象的,它可能没有完全实现抽象父类的方法,或者它可能没有正确调用继承合约的构造函数。", From be9a02362803d31e7331b0391353f169f33fff86 Mon Sep 17 00:00:00 2001 From: chloefeal <188809157+chloefeal@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:21:38 +0800 Subject: [PATCH 33/45] Update libs/remix-ai-core/src/prompts/promptBuilder.ts Signed-off-by: chloefeal <188809157+chloefeal@users.noreply.github.com> --- libs/remix-ai-core/src/prompts/promptBuilder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ai-core/src/prompts/promptBuilder.ts b/libs/remix-ai-core/src/prompts/promptBuilder.ts index fea867e36c7..e22088bc6a7 100644 --- a/libs/remix-ai-core/src/prompts/promptBuilder.ts +++ b/libs/remix-ai-core/src/prompts/promptBuilder.ts @@ -7,7 +7,7 @@ export const PromptBuilder = (inst, answr, modelop) => { if (modelop === RemoteBackendOPModel.MISTRAL) return "" } -export const buildSolgptPromt = (userPrompt:string, modelOP:RemoteBackendOPModel) => { +export const buildSolgptPrompt = (userPrompt:string, modelOP:RemoteBackendOPModel) => { if (modelOP === undefined) { console.log('WARNING: modelOP is undefined. Provide a valid model OP for chat history') return userPrompt From b58e6b50abd5b1ebc4c9025296604dbb2ccd7a1e Mon Sep 17 00:00:00 2001 From: chloefeal <188809157+chloefeal@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:21:48 +0800 Subject: [PATCH 34/45] Update libs/remix-ai-core/src/inferencers/remote/remoteInference.ts Signed-off-by: chloefeal <188809157+chloefeal@users.noreply.github.com> --- libs/remix-ai-core/src/inferencers/remote/remoteInference.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index c6ad3816184..dbee3e37ab2 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -1,6 +1,6 @@ import { ICompletions, IParams, AIRequestType, RemoteBackendOPModel, JsonStreamParser } from "../../types/types"; import { GenerationParams, CompletionParams, InsertionParams } from "../../types/models"; -import { buildSolgptPromt } from "../../prompts/promptBuilder"; +import { buildSolgptPrompt } from "../../prompts/promptBuilder"; import EventEmitter from "events"; import { ChatHistory } from "../../prompts/chat"; import axios from 'axios'; @@ -127,7 +127,7 @@ export class RemoteInferencer implements ICompletions { } async solidity_answer(prompt, options:IParams=GenerationParams): Promise { - const main_prompt = buildSolgptPromt(prompt, this.model_op) + const main_prompt = buildSolgptPrompt(prompt, this.model_op) const payload = { 'prompt': main_prompt, "endpoint":"solidity_answer", ...options } if (options.stream_result) return this._streamInferenceRequest(payload, AIRequestType.GENERAL) else return this._makeRequest(payload, AIRequestType.GENERAL) From 9f4a40f3721ebc4b33c1579c65ac14fa86dcc92e Mon Sep 17 00:00:00 2001 From: chloefeal <188809157+chloefeal@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:21:58 +0800 Subject: [PATCH 35/45] Update libs/remix-ai-core/src/index.ts Signed-off-by: chloefeal <188809157+chloefeal@users.noreply.github.com> --- libs/remix-ai-core/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ai-core/src/index.ts b/libs/remix-ai-core/src/index.ts index fe54a57f2f8..e6368183cd4 100644 --- a/libs/remix-ai-core/src/index.ts +++ b/libs/remix-ai-core/src/index.ts @@ -6,7 +6,7 @@ import { IModel, IModelResponse, IModelRequest, InferenceModel, ICompletions, import { ModelType } from './types/constants' import { DefaultModels, InsertionParams, CompletionParams, GenerationParams } from './types/models' import { getCompletionPrompt, getInsertionPrompt } from './prompts/completionPrompts' -import { buildSolgptPromt, PromptBuilder } from './prompts/promptBuilder' +import { buildSolgptPrompt, PromptBuilder } from './prompts/promptBuilder' import { RemoteInferencer } from './inferencers/remote/remoteInference' import { ChatHistory } from './prompts/chat' import { downloadLatestReleaseExecutable } from './helpers/inferenceServerReleases' @@ -14,7 +14,7 @@ import { downloadLatestReleaseExecutable } from './helpers/inferenceServerReleas export { IModel, IModelResponse, IModelRequest, InferenceModel, ModelType, DefaultModels, ICompletions, IParams, IRemoteModel, - getCompletionPrompt, getInsertionPrompt, IStreamResponse, buildSolgptPromt, + getCompletionPrompt, getInsertionPrompt, IStreamResponse, buildSolgptPrompt, RemoteInferencer, InsertionParams, CompletionParams, GenerationParams, ChatEntry, AIRequestType, RemoteBackendOPModel, ChatHistory, downloadLatestReleaseExecutable } From 38528a9eb4de0cc29e7d518dfbc56e5b4b17da96 Mon Sep 17 00:00:00 2001 From: chloefeal <188809157+chloefeal@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:22:05 +0800 Subject: [PATCH 36/45] Update apps/remixdesktop/src/lib/InferenceServerManager.ts Signed-off-by: chloefeal <188809157+chloefeal@users.noreply.github.com> --- apps/remixdesktop/src/lib/InferenceServerManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remixdesktop/src/lib/InferenceServerManager.ts b/apps/remixdesktop/src/lib/InferenceServerManager.ts index 4587e822dbb..fa928f2672d 100644 --- a/apps/remixdesktop/src/lib/InferenceServerManager.ts +++ b/apps/remixdesktop/src/lib/InferenceServerManager.ts @@ -6,7 +6,7 @@ import { EventEmitter } from 'events'; import { ICompletions, IModel, IParams, InsertionParams, CompletionParams, GenerationParams, ModelType, AIRequestType, IStreamResponse, ChatHistory, downloadLatestReleaseExecutable, - buildSolgptPromt } from "@remix/remix-ai-core" + buildSolgptPrompt } from "@remix/remix-ai-core" import { platform } from 'os'; class ServerStatusTimer { From 9e12656f3a9357200a749c2469c3f56db109d543 Mon Sep 17 00:00:00 2001 From: kilavvy <140459108+kilavvy@users.noreply.github.com> Date: Sun, 12 Jan 2025 14:24:46 +0100 Subject: [PATCH 37/45] Update deploy.ts --- libs/remix-ui/run-tab/src/lib/actions/deploy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts index f8ba1ae56ef..37fbca3d273 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts @@ -22,7 +22,7 @@ const txHelper = remixLib.execution.txHelper const txFormat = remixLib.execution.txFormat const loadContractFromAddress = (plugin: RunTab, address, confirmCb, cb) => { - if (/.(.abi)$/.exec(plugin.config.get('currentFile'))) { + if (/\.(abi)$/.exec(plugin.config.get('currentFile'))) { confirmCb(() => { let abi try { From 62a4c29868c96a0ce42e7cd933002f50da696b48 Mon Sep 17 00:00:00 2001 From: kilavvy <140459108+kilavvy@users.noreply.github.com> Date: Sun, 12 Jan 2025 14:32:41 +0100 Subject: [PATCH 38/45] Update carouselTypes.ts --- .../remix-ui/home-tab/src/lib/components/types/carouselTypes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/home-tab/src/lib/components/types/carouselTypes.ts b/libs/remix-ui/home-tab/src/lib/components/types/carouselTypes.ts index d65054171dd..0f43f1a2255 100644 --- a/libs/remix-ui/home-tab/src/lib/components/types/carouselTypes.ts +++ b/libs/remix-ui/home-tab/src/lib/components/types/carouselTypes.ts @@ -34,7 +34,7 @@ export interface CarouselProps { beforeChange?: (nextSlide: number, state: StateCallBack) => void; // Change callback before sliding every time. `(previousSlide, currentState) => ...` sliderClass?: string; // Use this to style your own track list. itemClass?: string; // Use this to style your own Carousel item. For example add padding-left and padding-right - itemAriaLabel?: string; // Use this to add your own Carousel item aria-label.if it is not defined the child aria label will be applied if the child dont have one than a default empty string will be applied + itemAriaLabel?: string; // Use this to add your own Carousel item aria-label.if it is not defined the child aria label will be applied if the child doesn't have one, then a default empty string will be applied containerClass?: string; // Use this to style the whole container. For example add padding to allow the "dots" or "arrows" to go to other places without being overflown. className?: string; // Use this to style the whole container with styled-components dotListClass?: string; // Use this to style the dot list. From 5a1d8a94dd6437f6a8ace1dea50eee755b04a757 Mon Sep 17 00:00:00 2001 From: crStiv Date: Wed, 15 Jan 2025 18:17:36 +0100 Subject: [PATCH 39/45] Update remix-ui-terminal.tsx --- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx index 4e0d224c1bc..e2f281ed4b2 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -235,12 +235,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { try { if (script.trim().startsWith('git')) { // await this.call('git', 'execute', script) code might be used in the future - // TODO: rm gpt or redirect gpt to sol-pgt - } else if (script.trim().startsWith('gpt')) { - call('terminal', 'log',{ type: 'warn', value: `> ${script}` }) - await call('remixAI', 'solidity_answer', script) // No streaming supported in terminal - _paq.push(['trackEvent', 'ai', 'remixAI', 'askFromTerminal']) - } else if (script.trim().startsWith('sol-gpt')) { + } else if (script.trim().startsWith('gpt') || script.trim().startsWith('sol-gpt')) { call('terminal', 'log',{ type: 'warn', value: `> ${script}` }) await call('remixAI', 'solidity_answer', script) // No streaming supported in terminal _paq.push(['trackEvent', 'ai', 'remixAI', 'askFromTerminal']) From 05832f5129ca24d8d426a0d141d955b90c4e3801 Mon Sep 17 00:00:00 2001 From: kilavvy <140459108+kilavvy@users.noreply.github.com> Date: Sun, 19 Jan 2025 13:19:44 +0100 Subject: [PATCH 40/45] Update solidity.ts --- libs/remix-ui/editor/src/lib/syntaxes/solidity.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/editor/src/lib/syntaxes/solidity.ts b/libs/remix-ui/editor/src/lib/syntaxes/solidity.ts index fda352456e6..67da59e5976 100644 --- a/libs/remix-ui/editor/src/lib/syntaxes/solidity.ts +++ b/libs/remix-ui/editor/src/lib/syntaxes/solidity.ts @@ -1236,7 +1236,7 @@ export const solidityTokensProvider = { 'abstract', 'payable', 'nonpayable', - 'constants', + 'constant', 'immutable', 'assert', 'require', From e61ed52672ca2eed01df0b3240537f96c1dba7e6 Mon Sep 17 00:00:00 2001 From: "fuder.eth" <139509124+vtjl10@users.noreply.github.com> Date: Sun, 19 Jan 2025 13:44:39 +0100 Subject: [PATCH 41/45] Update txRunner.ts --- libs/remix-lib/src/execution/txRunner.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunner.ts b/libs/remix-lib/src/execution/txRunner.ts index ee2ee5ed2d2..e875ff6713a 100644 --- a/libs/remix-lib/src/execution/txRunner.ts +++ b/libs/remix-lib/src/execution/txRunner.ts @@ -16,7 +16,7 @@ export type Transaction = { export class TxRunner { event pendingTxs - queusTxs + queueTxs opt internalRunner constructor (internalRunner, opt) { @@ -25,7 +25,7 @@ export class TxRunner { this.event = new EventManager() this.pendingTxs = {} - this.queusTxs = [] + this.queueTxs = [] } rawRun (args: Transaction, confirmationCb, gasEstimationForceSend, promptCb, cb) { @@ -42,14 +42,14 @@ export class TxRunner { function run (self, tx: Transaction, stamp, confirmationCb, gasEstimationForceSend = null, promptCb = null, callback = null) { if (Object.keys(self.pendingTxs).length) { - return self.queusTxs.push({ tx, stamp, confirmationCb, gasEstimationForceSend, promptCb, callback }) + return self.queueTxs.push({ tx, stamp, confirmationCb, gasEstimationForceSend, promptCb, callback }) } self.pendingTxs[stamp] = tx self.execute(tx, confirmationCb, gasEstimationForceSend, promptCb, function (error, result) { delete self.pendingTxs[stamp] if (callback && typeof callback === 'function') callback(error, result) - if (self.queusTxs.length) { - const next = self.queusTxs.pop() + if (self.queueTxs.length) { + const next = self.queueTxs.pop() run(self, next.tx, next.stamp, next.confirmationCb, next.gasEstimationForceSend, next.promptCb, next.callback) } }) From dfd2cf1a3f97fd081e287a54132ac097a004458a Mon Sep 17 00:00:00 2001 From: "fuder.eth" <139509124+vtjl10@users.noreply.github.com> Date: Sun, 19 Jan 2025 13:46:35 +0100 Subject: [PATCH 42/45] Update txRunnerVM.ts --- libs/remix-lib/src/execution/txRunnerVM.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index 12bfd3636ea..f326c9dc8e4 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -24,7 +24,7 @@ export class TxRunnerVM { blockNumber pendingTxs vmaccounts - queusTxs + queueTxs blocks: Uint8Array[] logsManager commonContext @@ -41,7 +41,7 @@ export class TxRunnerVM { this.commonContext = this.getVMObject().common this.pendingTxs = {} this.vmaccounts = vmaccounts - this.queusTxs = [] + this.queueTxs = [] /* txHash is generated using the nonce, in order to have unique transaction hash, we need to keep using different nonce (in case of a call) From 9e6dbfee7cf1417a05b497e3491cf96bc7265726 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 10 Jan 2025 13:32:25 +0100 Subject: [PATCH 43/45] update type definition --- libs/remix-ui/run-tab/src/lib/types/blockchain.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/remix-ui/run-tab/src/lib/types/blockchain.d.ts b/libs/remix-ui/run-tab/src/lib/types/blockchain.d.ts index 428c782a8e1..d47d0d89f7e 100644 --- a/libs/remix-ui/run-tab/src/lib/types/blockchain.d.ts +++ b/libs/remix-ui/run-tab/src/lib/types/blockchain.d.ts @@ -25,6 +25,7 @@ export class Blockchain extends Plugin { }; setupProviders(): void; providers: any; + defaultPinnedProviders: string[]; getCurrentProvider(): any; /** Return the list of accounts */ getAccounts(cb?: any): any; From 63779ad248c0467e603223f721bcc5606495ae59 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 10 Jan 2025 13:32:47 +0100 Subject: [PATCH 44/45] add useEffect to handle disconnection condition --- libs/remix-ui/run-tab/src/lib/run-tab.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/remix-ui/run-tab/src/lib/run-tab.tsx b/libs/remix-ui/run-tab/src/lib/run-tab.tsx index c6eb716af69..d352347eb94 100644 --- a/libs/remix-ui/run-tab/src/lib/run-tab.tsx +++ b/libs/remix-ui/run-tab/src/lib/run-tab.tsx @@ -235,6 +235,16 @@ export function RunTabUI(props: RunTabProps) { } }, [runTab.popup]) + useEffect(() => { + if (runTab.selectExEnv.includes('injected') && + Object.entries(runTab.accounts.loadedAccounts).length === 0 && + runTab.accounts.selectedAccount.length > 0) { + // switch to vm-cancum because no account is loaded from injected provider + const context = plugin.blockchain.defaultPinnedProviders[0] // vm-cancun + setExecutionEnvironment({ context, fork: '' }) + } + }, [runTab.accounts.loadedAccounts]) + const setCheckIpfs = (value: boolean) => { dispatch(setIpfsCheckedState(value)) } From 6b7131b3bd964b98be17d9fef892de6a2d5a2cf8 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Fri, 17 Jan 2025 11:37:04 +0100 Subject: [PATCH 45/45] change env status. update gitignore for env --- .env => .env.local | 2 +- .gitignore | 1 + apps/walletconnect/webpack.config.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename .env => .env.local (65%) diff --git a/.env b/.env.local similarity index 65% rename from .env rename to .env.local index 1a2b47f98fc..fb35ddc9730 100644 --- a/.env +++ b/.env.local @@ -2,4 +2,4 @@ gist_token= account_passphrase= account_password= NODE_OPTIONS=--max-old-space-size=2048 -# WALLET_CONNECT_PROJECT_ID= +WALLET_CONNECT_PROJECT_ID= diff --git a/.gitignore b/.gitignore index 7955bf6455c..ab745444262 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ soljson.js *_group*.ts stats.json release +.env # compiled output diff --git a/apps/walletconnect/webpack.config.js b/apps/walletconnect/webpack.config.js index c1ae621262f..8da8a912468 100644 --- a/apps/walletconnect/webpack.config.js +++ b/apps/walletconnect/webpack.config.js @@ -46,7 +46,7 @@ module.exports = composePlugins(withNx(), (config) => { process: 'process/browser' }) ) - + console.log(process.env.WALLET_CONNECT_PROJECT_ID) // set the define plugin to load the WALLET_CONNECT_PROJECT_ID config.plugins.push( new webpack.DefinePlugin({