From d1b961c57c8780e63bf1484be0ba491c93b12303 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 19 Jul 2023 15:03:49 +0100 Subject: [PATCH 01/73] Add language config and tokens provider for circom support in the editor --- apps/remix-ide/src/app/editor/editor.js | 3 +- .../editor/src/lib/remix-ui-editor.tsx | 7 + .../editor/src/lib/syntaxes/circom.ts | 211 ++++++++++++++++++ 3 files changed, 220 insertions(+), 1 deletion(-) create mode 100644 libs/remix-ui/editor/src/lib/syntaxes/circom.ts diff --git a/apps/remix-ide/src/app/editor/editor.js b/apps/remix-ide/src/app/editor/editor.js index 2de1353d15..2b0a4dd912 100644 --- a/apps/remix-ide/src/app/editor/editor.js +++ b/apps/remix-ide/src/app/editor/editor.js @@ -51,7 +51,8 @@ class Editor extends Plugin { rs: 'rust', cairo: 'cairo', ts: 'typescript', - move: 'move' + move: 'move', + circom: 'circom' } this.activated = false 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 fe39eed3e8..373d28be1b 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.tsx @@ -17,6 +17,7 @@ import { RemixHighLightProvider } from './providers/highlightProvider' import { RemixDefinitionProvider } from './providers/definitionProvider' import { RemixCodeActionProvider } from './providers/codeActionProvider' import './remix-ui-editor.css' +import { circomLanguageConfig, circomTokensProvider } from './syntaxes/circom' enum MarkerSeverity { @@ -322,6 +323,8 @@ export const EditorUI = (props: EditorUIProps) => { monacoRef.current.editor.setModelLanguage(file.model, 'remix-zokrates') } else if (file.language === 'move') { monacoRef.current.editor.setModelLanguage(file.model, 'remix-move') + } else if (file.language === 'circom') { + monacoRef.current.editor.setModelLanguage(file.model, 'remix-circom') } }, [props.currentFile]) @@ -731,6 +734,7 @@ export const EditorUI = (props: EditorUIProps) => { monacoRef.current.languages.register({ id: 'remix-cairo' }) monacoRef.current.languages.register({ id: 'remix-zokrates' }) monacoRef.current.languages.register({ id: 'remix-move' }) + monacoRef.current.languages.register({ id: 'remix-circom' }) // Register a tokens provider for the language monacoRef.current.languages.setMonarchTokensProvider('remix-solidity', solidityTokensProvider as any) @@ -745,6 +749,9 @@ export const EditorUI = (props: EditorUIProps) => { monacoRef.current.languages.setMonarchTokensProvider('remix-move', moveTokenProvider as any) monacoRef.current.languages.setLanguageConfiguration('remix-move', moveLanguageConfig as any) + monacoRef.current.languages.setMonarchTokensProvider('remix-circom', circomTokensProvider as any) + monacoRef.current.languages.setLanguageConfiguration('remix-circom', circomLanguageConfig(monacoRef.current) as any) + monacoRef.current.languages.registerDefinitionProvider('remix-solidity', new RemixDefinitionProvider(props, monaco)) monacoRef.current.languages.registerDocumentHighlightProvider('remix-solidity', new RemixHighLightProvider(props, monaco)) monacoRef.current.languages.registerReferenceProvider('remix-solidity', new RemixReferenceProvider(props, monaco)) diff --git a/libs/remix-ui/editor/src/lib/syntaxes/circom.ts b/libs/remix-ui/editor/src/lib/syntaxes/circom.ts new file mode 100644 index 0000000000..b610dd4f8e --- /dev/null +++ b/libs/remix-ui/editor/src/lib/syntaxes/circom.ts @@ -0,0 +1,211 @@ +/* eslint-disable */ +export const circomLanguageConfig = (monaco) => ({ + wordPattern: + /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + + comments: { + lineComment: "//", + blockComment: ["/*", "*/"], + }, + + brackets: [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ], + + onEnterRules: [ + { + // e.g. /** | */ + beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, + afterText: /^\s*\*\/$/, + action: { + indentAction: monaco.languages.IndentAction.IndentOutdent, + appendText: " * ", + }, + }, + { + // e.g. /** ...| + beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, + action: { + indentAction: monaco.languages.IndentAction.None, + appendText: " * ", + }, + }, + { + // e.g. * ...| + beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, + action: { + indentAction: monaco.languages.IndentAction.None, + appendText: "* ", + }, + }, + { + // e.g. */| + beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, + action: { + indentAction: monaco.languages.IndentAction.None, + removeText: 1, + }, + }, +], + + autoClosingPairs: [ + { open: "{", close: "}" }, + { open: "[", close: "]" }, + { open: "(", close: ")" }, + { open: '"', close: '"', notIn: ["string"] }, + { open: "'", close: "'", notIn: ["string", "comment"] }, + { open: "`", close: "`", notIn: ["string", "comment"] }, + { open: "/**", close: " */", notIn: ["string"] }, + ], + + folding: { + markers: { + start: new RegExp("^\\s*//\\s*#?region\\b"), + end: new RegExp("^\\s*//\\s*#?endregion\\b"), + }, + }, +}) + +export const circomTokensProvider = { + defaultToken: "", + tokenPostfix: ".circom", + + keywords: [ + "signal", + "input", + "output", + "public", + "template", + "component", + "parallel", + "custom", + "var", + "function", + "return", + "if", + "else", + "for", + "while", + "do", + "log", + "assert", + "include", + "pragma", + ], + + typeKeywords: ["input", "output", "public"], + + operators: [ + "!", + "~", + "-", + "||", + "&&", + "==", + "!=", + "<", + ">", + "<=", + ">=", + "|", + "&", + "<<", + ">>", + "+", + "-", + "*", + "/", + "\\", + "%", + "**", + "^", + "=", + "<--", + "<==", + ], + + // we include these common regular expressions + // symbols: /[=>](?!@symbols)/, "@brackets"], + // [ + // /@symbols/, + // { cases: { "@operators": "operator", "@default": "" } }, + // ], + + // @ annotations. + // As an example, we emit a debugging log message on these tokens. + // Note: message are supressed during the first load -- change some lines to see them. + [ + /@\s*[a-zA-Z_\$][\w\$]*/, + { token: "annotation", log: "annotation token: $0" }, + ], + + // numbers + [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], + [/0[xX][0-9a-fA-F]+/, "number.hex"], + [/\d+/, "number"], + + // delimiter: after number because of .\d floats + [/[;,.]/, "delimiter"], + + // strings + [/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string + [/"/, { token: "string.quote", bracket: "@open", next: "@string" }], + + // characters + [/'[^\\']'/, "string"], + [/(')(@escapes)(')/, ["string", "string.escape", "string"]], + [/'/, "string.invalid"], + ], + + comment: [ + [/[^\/*]+/, "comment"], + [/\/\*/, "comment", "@push"], // nested comment + ["\\*/", "comment", "@pop"], + [/[\/*]/, "comment"], + ], + + string: [ + [/[^\\"]+/, "string"], + [/@escapes/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }], + ], + + whitespace: [ + [/[ \t\r\n]+/, "white"], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"], + ], + }, +} From 633dfc2de9a72a42d11ebdf32cf59aecf7675875 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 25 Jul 2023 11:11:57 +0100 Subject: [PATCH 02/73] Remove used comments --- .../editor/src/lib/syntaxes/circom.ts | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/syntaxes/circom.ts b/libs/remix-ui/editor/src/lib/syntaxes/circom.ts index b610dd4f8e..6b09887c3a 100644 --- a/libs/remix-ui/editor/src/lib/syntaxes/circom.ts +++ b/libs/remix-ui/editor/src/lib/syntaxes/circom.ts @@ -16,7 +16,6 @@ export const circomLanguageConfig = (monaco) => ({ onEnterRules: [ { - // e.g. /** | */ beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, afterText: /^\s*\*\/$/, action: { @@ -25,7 +24,6 @@ export const circomLanguageConfig = (monaco) => ({ }, }, { - // e.g. /** ...| beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, action: { indentAction: monaco.languages.IndentAction.None, @@ -33,7 +31,6 @@ export const circomLanguageConfig = (monaco) => ({ }, }, { - // e.g. * ...| beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, action: { indentAction: monaco.languages.IndentAction.None, @@ -41,7 +38,6 @@ export const circomLanguageConfig = (monaco) => ({ }, }, { - // e.g. */| beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, action: { indentAction: monaco.languages.IndentAction.None, @@ -126,18 +122,12 @@ export const circomTokensProvider = { "<==", ], - // we include these common regular expressions - // symbols: /[=>](?!@symbols)/, "@brackets"], - // [ - // /@symbols/, - // { cases: { "@operators": "operator", "@default": "" } }, - // ], - - // @ annotations. - // As an example, we emit a debugging log message on these tokens. - // Note: message are supressed during the first load -- change some lines to see them. [ /@\s*[a-zA-Z_\$][\w\$]*/, { token: "annotation", log: "annotation token: $0" }, ], - // numbers [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"], [/0[xX][0-9a-fA-F]+/, "number.hex"], [/\d+/, "number"], - // delimiter: after number because of .\d floats [/[;,.]/, "delimiter"], - // strings - [/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string + [/"([^"\\]|\\.)*$/, "string.invalid"], [/"/, { token: "string.quote", bracket: "@open", next: "@string" }], - // characters [/'[^\\']'/, "string"], [/(')(@escapes)(')/, ["string", "string.escape", "string"]], [/'/, "string.invalid"], @@ -190,7 +165,7 @@ export const circomTokensProvider = { comment: [ [/[^\/*]+/, "comment"], - [/\/\*/, "comment", "@push"], // nested comment + [/\/\*/, "comment", "@push"], ["\\*/", "comment", "@pop"], [/[\/*]/, "comment"], ], From 9825a540080a77e4f010288dfb89869a17d83acc Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 25 Jul 2023 12:04:26 +0100 Subject: [PATCH 03/73] Added .circom icons --- libs/remix-ui/helper/src/lib/remix-ui-helper.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/remix-ui/helper/src/lib/remix-ui-helper.ts b/libs/remix-ui/helper/src/lib/remix-ui-helper.ts index e06253c325..21925ed8f8 100644 --- a/libs/remix-ui/helper/src/lib/remix-ui-helper.ts +++ b/libs/remix-ui/helper/src/lib/remix-ui-helper.ts @@ -80,7 +80,8 @@ export const getPathIcon = (path: string) => { ? 'fak fa-lexon' : path.endsWith('ts') ? 'small fak fa-ts-logo' : path.endsWith('.tsc') ? 'fad fa-brackets-curly' : path.endsWith('.cairo') - ? 'small fak fa-cairo' : 'far fa-file' + ? 'small fak fa-cairo' : path.endsWith('.circom') + ? 'fak fa-circom-plug1' : 'far fa-file' } export const isNumeric = (value) => { From 6626945d054d49f856a0bcc6843f150a39f24c78 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 25 Jul 2023 16:16:55 +0100 Subject: [PATCH 04/73] modify themes array in themes module to carry extra values for sol2uml --- apps/remix-ide/src/app/tabs/theme-module.js | 41 ++++++++++++++------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/theme-module.js b/apps/remix-ide/src/app/tabs/theme-module.js index e1e066c4b5..6d3e248a93 100644 --- a/apps/remix-ide/src/app/tabs/theme-module.js +++ b/apps/remix-ide/src/app/tabs/theme-module.js @@ -5,20 +5,33 @@ import * as packageJson from '../../../../../package.json' import Registry from '../state/registry' const _paq = window._paq = window._paq || [] +//sol2uml dot files cannot work with css variables so hex values for colors are used const themes = [ - { name: 'Dark', quality: 'dark', url: 'assets/css/themes/remix-dark_tvx1s2.css' }, - { name: 'Light', quality: 'light', url: 'assets/css/themes/remix-light_powaqg.css' }, - { name: 'Violet', quality: 'light', url: 'assets/css/themes/remix-violet.css' }, - { name: 'Unicorn', quality: 'light', url: 'assets/css/themes/remix-unicorn.css' }, - { name: 'Midcentury', quality: 'light', url: 'assets/css/themes/remix-midcentury_hrzph3.css' }, - { name: 'Black', quality: 'dark', url: 'assets/css/themes/remix-black_undtds.css' }, - { name: 'Candy', quality: 'light', url: 'assets/css/themes/remix-candy_ikhg4m.css' }, - { name: 'HackerOwl', quality: 'dark', url: 'assets/css/themes/remix-hacker_owl.css' }, + { name: 'Dark', quality: 'dark', url: 'assets/css/themes/remix-dark_tvx1s2.css', backgroundColor: '#222336', textColor: '#babbcc', + shapeColor: '#babbcc',fillColor: '#2a2c3f' }, + { name: 'Light', quality: 'light', url: 'assets/css/themes/remix-light_powaqg.css', backgroundColor: '#eef1f6', textColor: '#3b445e', + shapeColor: '#343a40',fillColor: '#ffffff' }, + { name: 'Violet', quality: 'light', url: 'assets/css/themes/remix-violet.css', backgroundColor: '#f1eef6', textColor: '#3b445e', + shapeColor: '#343a40',fillColor: '#f8fafe' }, + { name: 'Unicorn', quality: 'light', url: 'assets/css/themes/remix-unicorn.css', backgroundColor: '#f1eef6', textColor: '#343a40', + shapeColor: '#343a40',fillColor: '#f8fafe' }, + { name: 'Midcentury', quality: 'light', url: 'assets/css/themes/remix-midcentury_hrzph3.css', backgroundColor: '#DBE2E0', textColor: '#11556c', + shapeColor: '#343a40',fillColor: '#eeede9' }, + { name: 'Black', quality: 'dark', url: 'assets/css/themes/remix-black_undtds.css', backgroundColor: '#1a1a1a', textColor: '#babbcc', + shapeColor: '#b5b4bc',fillColor: '#1f2020' }, + { name: 'Candy', quality: 'light', url: 'assets/css/themes/remix-candy_ikhg4m.css', backgroundColor: '#d5efff', textColor: '#11556c', + shapeColor: '#343a40',fillColor: '#fbe7f8' }, + { name: 'HackerOwl', quality: 'dark', url: 'assets/css/themes/remix-hacker_owl.css', backgroundColor: '#011628', textColor: '#babbcc', + shapeColor: '#8694a1',fillColor: '#011C32' }, - { name: 'Cerulean', quality: 'light', url: 'assets/css/themes/bootstrap-cerulean.min.css' }, - { name: 'Flatly', quality: 'light', url: 'assets/css/themes/bootstrap-flatly.min.css' }, - { name: 'Spacelab', quality: 'light', url: 'assets/css/themes/bootstrap-spacelab.min.css' }, - { name: 'Cyborg', quality: 'dark', url: 'assets/css/themes/bootstrap-cyborg.min.css' } + { name: 'Cerulean', quality: 'light', url: 'assets/css/themes/bootstrap-cerulean.min.css', backgroundColor: '#ffffff', textColor: '#343a40', + shapeColor: '#343a40',fillColor: '#f8f9fa' }, + { name: 'Flatly', quality: 'light', url: 'assets/css/themes/bootstrap-flatly.min.css', backgroundColor: '#ffffff', textColor: '#343a40', + shapeColor: '#7b8a8b',fillColor: '#ffffff' }, + { name: 'Spacelab', quality: 'light', url: 'assets/css/themes/bootstrap-spacelab.min.css', backgroundColor: '#ffffff', textColor: '#343a40', + shapeColor: '#333333', fillColor: '#eeeeee' }, + { name: 'Cyborg', quality: 'dark', url: 'assets/css/themes/bootstrap-cyborg.min.css', backgroundColor: '#060606', textColor: '#adafae', + shapeColor: '#adafae', fillColor: '#222222' } ] const profile = { @@ -55,7 +68,7 @@ export class ThemeModule extends Plugin { this.forced = !!queryTheme } - /** Return the active theme + /** Return the active theme * @return {{ name: string, quality: string, url: string }} - The active theme */ currentTheme () { @@ -93,7 +106,7 @@ export class ThemeModule extends Plugin { * @param {string} [themeName] - The name of the theme */ switchTheme (themeName) { - themeName = themeName && themeName.toLocaleLowerCase() + themeName = themeName && themeName.toLocaleLowerCase() if (themeName && !Object.keys(this.themes).includes(themeName)) { throw new Error(`Theme ${themeName} doesn't exist`) } From 6f83294eb82d722e4446d0248f56fc5ef82f45ce Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 25 Jul 2023 17:14:31 +0100 Subject: [PATCH 05/73] get active theme from themeModule and set uml style from active theme --- apps/remix-ide/src/app/plugins/solidity-umlgen.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx index 66e4ecbc87..75857ced56 100644 --- a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx @@ -106,7 +106,7 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen { const ast = result.length > 1 ? parser.parse(result) : parser.parse(source.sources[file].content) this.umlClasses = convertAST2UmlClasses(ast, this.currentFile) let umlDot = '' - this.activeTheme = themeCollection.find(theme => theme.themeName === currentTheme.name) + this.activeTheme = await this.call('theme', 'currentTheme') umlDot = convertUmlClasses2Dot(this.umlClasses, false, { backColor: this.activeTheme.backgroundColor, textColor: this.activeTheme.textColor, shapeColor: this.activeTheme.shapeColor, fillColor: this.activeTheme.fillColor }) const payload = vizRenderStringSync(umlDot) this.updatedSvg = payload From be1bc6e1ff8502414032dcff56e90813341cc180 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 25 Jul 2023 17:37:09 +0100 Subject: [PATCH 06/73] remove dependence on previous theme switching implementation --- .../src/app/plugins/solidity-umlgen.tsx | 86 +++++++------------ apps/remix-ide/src/app/tabs/theme-module.js | 4 +- .../solidity-uml-gen/src/types/index.ts | 5 +- 3 files changed, 38 insertions(+), 57 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx index 75857ced56..7cc304f754 100644 --- a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx @@ -24,32 +24,32 @@ const profile = { events: [], } -const themeCollection = [ - { themeName: 'HackerOwl', backgroundColor: '#011628', textColor: '#babbcc', - shapeColor: '#8694a1',fillColor: '#011C32'}, - { themeName: 'Cerulean', backgroundColor: '#ffffff', textColor: '#343a40', - shapeColor: '#343a40',fillColor: '#f8f9fa'}, - { themeName: 'Cyborg', backgroundColor: '#060606', textColor: '#adafae', - shapeColor: '#adafae', fillColor: '#222222'}, - { themeName: 'Dark', backgroundColor: '#222336', textColor: '#babbcc', - shapeColor: '#babbcc',fillColor: '#2a2c3f'}, - { themeName: 'Flatly', backgroundColor: '#ffffff', textColor: '#343a40', - shapeColor: '#7b8a8b',fillColor: '#ffffff'}, - { themeName: 'Black', backgroundColor: '#1a1a1a', textColor: '#babbcc', - shapeColor: '#b5b4bc',fillColor: '#1f2020'}, - { themeName: 'Light', backgroundColor: '#eef1f6', textColor: '#3b445e', - shapeColor: '#343a40',fillColor: '#ffffff'}, - { themeName: 'Midcentury', backgroundColor: '#DBE2E0', textColor: '#11556c', - shapeColor: '#343a40',fillColor: '#eeede9'}, - { themeName: 'Spacelab', backgroundColor: '#ffffff', textColor: '#343a40', - shapeColor: '#333333', fillColor: '#eeeeee'}, - { themeName: 'Candy', backgroundColor: '#d5efff', textColor: '#11556c', - shapeColor: '#343a40',fillColor: '#fbe7f8' }, - { themeName: 'Violet', backgroundColor: '#f1eef6', textColor: '#3b445e', - shapeColor: '#343a40',fillColor: '#f8fafe' }, - { themeName: 'Unicorn', backgroundColor: '#f1eef6', textColor: '#343a40', - shapeColor: '#343a40',fillColor: '#f8fafe' }, -] +// const themeCollection = [ +// { themeName: 'HackerOwl', backgroundColor: '#011628', textColor: '#babbcc', +// shapeColor: '#8694a1',fillColor: '#011C32'}, +// { themeName: 'Cerulean', backgroundColor: '#ffffff', textColor: '#343a40', +// shapeColor: '#343a40',fillColor: '#f8f9fa'}, +// { themeName: 'Cyborg', backgroundColor: '#060606', textColor: '#adafae', +// shapeColor: '#adafae', fillColor: '#222222'}, +// { themeName: 'Dark', backgroundColor: '#222336', textColor: '#babbcc', +// shapeColor: '#babbcc',fillColor: '#2a2c3f'}, +// { themeName: 'Flatly', backgroundColor: '#ffffff', textColor: '#343a40', +// shapeColor: '#7b8a8b',fillColor: '#ffffff'}, +// { themeName: 'Black', backgroundColor: '#1a1a1a', textColor: '#babbcc', +// shapeColor: '#b5b4bc',fillColor: '#1f2020'}, +// { themeName: 'Light', backgroundColor: '#eef1f6', textColor: '#3b445e', +// shapeColor: '#343a40',fillColor: '#ffffff'}, +// { themeName: 'Midcentury', backgroundColor: '#DBE2E0', textColor: '#11556c', +// shapeColor: '#343a40',fillColor: '#eeede9'}, +// { themeName: 'Spacelab', backgroundColor: '#ffffff', textColor: '#343a40', +// shapeColor: '#333333', fillColor: '#eeeeee'}, +// { themeName: 'Candy', backgroundColor: '#d5efff', textColor: '#11556c', +// shapeColor: '#343a40',fillColor: '#fbe7f8' }, +// { themeName: 'Violet', backgroundColor: '#f1eef6', textColor: '#3b445e', +// shapeColor: '#343a40',fillColor: '#f8fafe' }, +// { themeName: 'Unicorn', backgroundColor: '#f1eef6', textColor: '#343a40', +// shapeColor: '#343a40',fillColor: '#f8fafe' }, +// ] /** * add context menu which will offer download as pdf and download png. @@ -81,8 +81,8 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen { this.currentlySelectedTheme = '' this.themeName = '' - this.themeCollection = themeCollection - this.activeTheme = themeCollection.find(t => t.themeName === 'Dark') + + this.activeTheme = {} as ThemeSummary this.appManager = appManager this.element = document.createElement('div') this.element.setAttribute('id', 'sol-uml-gen') @@ -127,35 +127,15 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen { private handleThemeChange() { this.on('theme', 'themeChanged', async (theme) => { this.currentlySelectedTheme = theme.quality - const themeQuality: ThemeQualityType = await this.call('theme', 'currentTheme') - themeCollection.forEach((theme) => { - if (theme.themeName === themeQuality.name) { - this.themeDark = theme.backgroundColor - this.activeTheme = theme - const umlDot = convertUmlClasses2Dot(this.umlClasses, false, { backColor: this.activeTheme.backgroundColor, textColor: this.activeTheme.textColor, shapeColor: this.activeTheme.shapeColor, fillColor: this.activeTheme.fillColor }) - this.updatedSvg = vizRenderStringSync(umlDot) - this.renderComponent() - } - }) + this.activeTheme = theme + this.themeDark = theme.backgroundColor + const umlDot = convertUmlClasses2Dot(this.umlClasses, false, { backColor: this.activeTheme.backgroundColor, textColor: this.activeTheme.textColor, shapeColor: this.activeTheme.shapeColor, fillColor: this.activeTheme.fillColor }) + this.updatedSvg = vizRenderStringSync(umlDot) + this.renderComponent() await this.call('tabs', 'focus', 'solidityumlgen') }) } - async mangleSvgPayload(svgPayload: string) : Promise { - const parser = new DOMParser() - const themeQuality: ThemeQualityType = await this.call('theme', 'currentTheme') - const parsedDocument = parser.parseFromString(svgPayload, 'image/svg+xml') - const element = parsedDocument.getElementsByTagName('svg') - themeCollection.forEach((theme) => { - if (theme.themeName === themeQuality.name) { - parsedDocument.documentElement.setAttribute('style', `background-color: var(${this.getThemeCssVariables('--body-bg')})`) - element[0].setAttribute('fill', theme.backgroundColor) - } - }) - const stringifiedSvg = new XMLSerializer().serializeToString(parsedDocument) - return stringifiedSvg - } - onDeactivation(): void { this.off('solidity', 'compilationFinished') } diff --git a/apps/remix-ide/src/app/tabs/theme-module.js b/apps/remix-ide/src/app/tabs/theme-module.js index 6d3e248a93..4ff7c2b0d1 100644 --- a/apps/remix-ide/src/app/tabs/theme-module.js +++ b/apps/remix-ide/src/app/tabs/theme-module.js @@ -72,7 +72,9 @@ export class ThemeModule extends Plugin { * @return {{ name: string, quality: string, url: string }} - The active theme */ currentTheme () { - return this.themes[this.active] + const current = this.themes[this.active] + console.log({ current }) + return current } /** Returns all themes as an array */ diff --git a/libs/remix-ui/solidity-uml-gen/src/types/index.ts b/libs/remix-ui/solidity-uml-gen/src/types/index.ts index 210b9c6066..4359302642 100644 --- a/libs/remix-ui/solidity-uml-gen/src/types/index.ts +++ b/libs/remix-ui/solidity-uml-gen/src/types/index.ts @@ -16,7 +16,6 @@ export interface ISolidityUmlGen extends ViewPlugin { showUmlDiagram(path: string, svgPayload: string): void updateComponent(state: any): JSX.Element setDispatch(dispatch: React.Dispatch): void - mangleSvgPayload(svgPayload: string) : Promise generateCustomAction(action: customAction): Promise flattenContract (source: any, filePath: string, data: any): Promise hideSpinner(): void @@ -27,5 +26,5 @@ export interface ISolidityUmlGen extends ViewPlugin { export type ThemeQualityType = { name: string, quality: 'light' | 'dark', url: string } -export type ThemeSummary = { themeName: string, backgroundColor: string, textColor?: string, -shapeColor?: string, fillColor?: string } \ No newline at end of file +export type ThemeSummary = { name: string, quality: 'light' | 'dark', url: string, backgroundColor: string, textColor?: string, +shapeColor?: string, fillColor?: string } From 6078188c9f7d6a8c0915d94eec7bc76dffedcf6f Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Tue, 25 Jul 2023 17:38:30 +0100 Subject: [PATCH 07/73] clean up --- .../src/app/plugins/solidity-umlgen.tsx | 27 ------------------- apps/remix-ide/src/app/tabs/theme-module.js | 4 +-- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx index 7cc304f754..11ab06ddeb 100644 --- a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx @@ -24,33 +24,6 @@ const profile = { events: [], } -// const themeCollection = [ -// { themeName: 'HackerOwl', backgroundColor: '#011628', textColor: '#babbcc', -// shapeColor: '#8694a1',fillColor: '#011C32'}, -// { themeName: 'Cerulean', backgroundColor: '#ffffff', textColor: '#343a40', -// shapeColor: '#343a40',fillColor: '#f8f9fa'}, -// { themeName: 'Cyborg', backgroundColor: '#060606', textColor: '#adafae', -// shapeColor: '#adafae', fillColor: '#222222'}, -// { themeName: 'Dark', backgroundColor: '#222336', textColor: '#babbcc', -// shapeColor: '#babbcc',fillColor: '#2a2c3f'}, -// { themeName: 'Flatly', backgroundColor: '#ffffff', textColor: '#343a40', -// shapeColor: '#7b8a8b',fillColor: '#ffffff'}, -// { themeName: 'Black', backgroundColor: '#1a1a1a', textColor: '#babbcc', -// shapeColor: '#b5b4bc',fillColor: '#1f2020'}, -// { themeName: 'Light', backgroundColor: '#eef1f6', textColor: '#3b445e', -// shapeColor: '#343a40',fillColor: '#ffffff'}, -// { themeName: 'Midcentury', backgroundColor: '#DBE2E0', textColor: '#11556c', -// shapeColor: '#343a40',fillColor: '#eeede9'}, -// { themeName: 'Spacelab', backgroundColor: '#ffffff', textColor: '#343a40', -// shapeColor: '#333333', fillColor: '#eeeeee'}, -// { themeName: 'Candy', backgroundColor: '#d5efff', textColor: '#11556c', -// shapeColor: '#343a40',fillColor: '#fbe7f8' }, -// { themeName: 'Violet', backgroundColor: '#f1eef6', textColor: '#3b445e', -// shapeColor: '#343a40',fillColor: '#f8fafe' }, -// { themeName: 'Unicorn', backgroundColor: '#f1eef6', textColor: '#343a40', -// shapeColor: '#343a40',fillColor: '#f8fafe' }, -// ] - /** * add context menu which will offer download as pdf and download png. * add menu under the first download button to download diff --git a/apps/remix-ide/src/app/tabs/theme-module.js b/apps/remix-ide/src/app/tabs/theme-module.js index 4ff7c2b0d1..6d3e248a93 100644 --- a/apps/remix-ide/src/app/tabs/theme-module.js +++ b/apps/remix-ide/src/app/tabs/theme-module.js @@ -72,9 +72,7 @@ export class ThemeModule extends Plugin { * @return {{ name: string, quality: string, url: string }} - The active theme */ currentTheme () { - const current = this.themes[this.active] - console.log({ current }) - return current + return this.themes[this.active] } /** Returns all themes as an array */ From 25570c57c96d2f5489f1a1cf76a870dd9c461b4a Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 26 Jul 2023 19:42:19 +0530 Subject: [PATCH 08/73] add quickfix for visibility --- .../src/lib/providers/codeActionProvider.ts | 69 ++++++++++++------- .../editor/src/lib/providers/quickfixes.ts | 4 ++ 2 files changed, 50 insertions(+), 23 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 4f37162731..12175c8646 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -2,6 +2,7 @@ import { Monaco } from "@monaco-editor/react" import monaco from "../../types/monaco" import { EditorUIProps } from "../remix-ui-editor" import { default as fixes } from "./quickfixes" +import { monacoTypes } from "@remix-ui/editor" export class RemixCodeActionProvider implements monaco.languages.CodeActionProvider { props: EditorUIProps @@ -12,34 +13,56 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } async provideCodeActions ( - model /**ITextModel*/, - range /**Range*/, - context /**CodeActionContext*/, - token /**CancellationToken*/ + model: monaco.editor.ITextModel /**ITextModel*/, + range: monaco.Range /**Range*/, + context: monaco.languages.CodeActionContext /**CodeActionContext*/, + token: monaco.CancellationToken /**CancellationToken*/ ) { - - const actions = context.markers.map(error => { + const actions = [] + for (const error of context.markers) { + console.log('error----->', error) const errStrings = Object.keys(fixes) const errStr = errStrings.find(es => error.message.includes(es)) - const fix = fixes[errStr] - return { - title: fix.title, - diagnostics: [error], - kind: "quickfix", - edit: { - edits: [ - { - resource: model.uri, - edit: { - range: fix.range || error, - text: fix.message - } + if (errStr) { + let fix = fixes[errStr] + const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) + const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) + if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { + console.log('nodeAtPosition---->', nodeAtPosition) + if (nodeAtPosition.parameters && nodeAtPosition.parameters.length > 0) { + const paramNodes = nodeAtPosition.parameters + const lastParamNode = paramNodes[paramNodes.length - 1] + console.log('lastParamNode---->', lastParamNode) + const lastParamEndLoc = lastParamNode.loc.end + console.log('lastParamEndLoc---->', lastParamEndLoc) + fix.range = { + startLineNumber: lastParamEndLoc.line, + endLineNumber: lastParamEndLoc.line, + startColumn: lastParamEndLoc.column + 11, + endColumn: lastParamEndLoc.column + 19 } - ] - }, - isPreferred: true + } + } + actions.push({ + title: fix.title, + diagnostics: [error], + kind: "quickfix", + edit: { + edits: [ + { + resource: model.uri, + edit: { + range: fix.range || error, + text: fix.message + } + } + ] + }, + isPreferred: true + }) } - }) + } + return { actions: actions, dispose: () => {} diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index 49cc0d13d6..f2c698ec70 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -12,5 +12,9 @@ export default { startColumn: 1, endColumn: 1 } + }, + "SyntaxError: No visibility specified. Did you intend to add \"public\"": { + "title": "Add public visibility", + "message": "public", } } \ No newline at end of file From 68d1f7592f0da90aba647586fb9e8196eb526c51 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 28 Jul 2023 12:25:50 +0530 Subject: [PATCH 09/73] visibility added for method with params --- .../src/lib/providers/codeActionProvider.ts | 19 ++++++++++--------- .../editor/src/lib/providers/quickfixes.ts | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 12175c8646..8054f46a0b 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -20,29 +20,30 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi ) { const actions = [] for (const error of context.markers) { - console.log('error----->', error) + let fix + let msg const errStrings = Object.keys(fixes) const errStr = errStrings.find(es => error.message.includes(es)) if (errStr) { - let fix = fixes[errStr] + fix = fixes[errStr] const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { - console.log('nodeAtPosition---->', nodeAtPosition) - if (nodeAtPosition.parameters && nodeAtPosition.parameters.length > 0) { + if (nodeAtPosition.parameters && nodeAtPosition.parameters && nodeAtPosition.parameters.length > 0) { const paramNodes = nodeAtPosition.parameters const lastParamNode = paramNodes[paramNodes.length - 1] - console.log('lastParamNode---->', lastParamNode) const lastParamEndLoc = lastParamNode.loc.end - console.log('lastParamEndLoc---->', lastParamEndLoc) + const lineContent = model.getLineContent(lastParamEndLoc.line) + msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) fix.range = { startLineNumber: lastParamEndLoc.line, endLineNumber: lastParamEndLoc.line, - startColumn: lastParamEndLoc.column + 11, - endColumn: lastParamEndLoc.column + 19 + startColumn: 0, + endColumn: error.startColumn + msg.length } } } + actions.push({ title: fix.title, diagnostics: [error], @@ -53,7 +54,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi resource: model.uri, edit: { range: fix.range || error, - text: fix.message + text: msg || fix.message } } ] diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index f2c698ec70..c0d6117191 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -15,6 +15,6 @@ export default { }, "SyntaxError: No visibility specified. Did you intend to add \"public\"": { "title": "Add public visibility", - "message": "public", + "message": "public ", } } \ No newline at end of file From c892a707afc977b73f3be46430ae0f038e99be3d Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 28 Jul 2023 13:20:19 +0530 Subject: [PATCH 10/73] visibility added for method without params --- .../src/lib/providers/codeActionProvider.ts | 68 +++++++++++-------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 8054f46a0b..7c1fcd4e38 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -29,39 +29,51 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { - if (nodeAtPosition.parameters && nodeAtPosition.parameters && nodeAtPosition.parameters.length > 0) { + if (nodeAtPosition.parameters) { const paramNodes = nodeAtPosition.parameters - const lastParamNode = paramNodes[paramNodes.length - 1] - const lastParamEndLoc = lastParamNode.loc.end - const lineContent = model.getLineContent(lastParamEndLoc.line) - msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) - fix.range = { - startLineNumber: lastParamEndLoc.line, - endLineNumber: lastParamEndLoc.line, - startColumn: 0, - endColumn: error.startColumn + msg.length - } + if (paramNodes.length) { + const lastParamNode = paramNodes[paramNodes.length - 1] + const lastParamEndLoc = lastParamNode.loc.end + const lineContent = model.getLineContent(lastParamEndLoc.line) + msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) + fix.range = { + startLineNumber: lastParamEndLoc.line, + endLineNumber: lastParamEndLoc.line, + startColumn: 0, + endColumn: error.startColumn + msg.length + } + } else { + const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) + const i = lineContent.indexOf('()') + msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) + fix.range = { + startLineNumber: nodeAtPosition.loc.start.line, + endLineNumber: nodeAtPosition.loc.start.line, + startColumn: 0, + endColumn: error.startColumn + msg.length + } + } } } + } - actions.push({ - title: fix.title, - diagnostics: [error], - kind: "quickfix", - edit: { - edits: [ - { - resource: model.uri, - edit: { - range: fix.range || error, - text: msg || fix.message - } + actions.push({ + title: fix.title, + diagnostics: [error], + kind: "quickfix", + edit: { + edits: [ + { + resource: model.uri, + edit: { + range: fix.range || error, + text: msg || fix.message } - ] - }, - isPreferred: true - }) - } + } + ] + }, + isPreferred: true + }) } return { From f005dceecea83c17d31006c9f0cc5891dae18f64 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 28 Jul 2023 14:02:18 +0530 Subject: [PATCH 11/73] linting fix --- .../src/lib/providers/codeActionProvider.ts | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 7c1fcd4e38..d1858ce9dc 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -43,37 +43,36 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi endColumn: error.startColumn + msg.length } } else { - const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) - const i = lineContent.indexOf('()') - msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) - fix.range = { - startLineNumber: nodeAtPosition.loc.start.line, - endLineNumber: nodeAtPosition.loc.start.line, - startColumn: 0, - endColumn: error.startColumn + msg.length - } + const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) + const i = lineContent.indexOf('()') + msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) + fix.range = { + startLineNumber: nodeAtPosition.loc.start.line, + endLineNumber: nodeAtPosition.loc.start.line, + startColumn: 0, + endColumn: error.startColumn + msg.length } + } } } - } - - actions.push({ - title: fix.title, - diagnostics: [error], - kind: "quickfix", - edit: { - edits: [ - { - resource: model.uri, - edit: { - range: fix.range || error, - text: msg || fix.message + actions.push({ + title: fix.title, + diagnostics: [error], + kind: "quickfix", + edit: { + edits: [ + { + resource: model.uri, + edit: { + range: fix.range || error, + text: msg || fix.message + } } - } - ] - }, - isPreferred: true - }) + ] + }, + isPreferred: true + }) + } } return { From e8fbcb7a16d7caa95f2592694775271b2c887a14 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 28 Jul 2023 20:13:34 +0530 Subject: [PATCH 12/73] support other AST node for fn with params --- .../editor/src/lib/providers/codeActionProvider.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index d1858ce9dc..f21ded6d16 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -29,11 +29,20 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { + console.log('nodeAtPosition--->', nodeAtPosition) if (nodeAtPosition.parameters) { - const paramNodes = nodeAtPosition.parameters + const paramNodes = !Array.isArray(nodeAtPosition.parameters) ? nodeAtPosition.parameters.parameters : nodeAtPosition.parameters + console.log('paramNodes------->', paramNodes) if (paramNodes.length) { const lastParamNode = paramNodes[paramNodes.length - 1] - const lastParamEndLoc = lastParamNode.loc.end + console.log('lastParamNode------->', lastParamNode) + let loccc + if (!Array.isArray(nodeAtPosition.parameters)) { + loccc = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) + console.log('locccc---->', loccc) + loccc.end.line += 1 + } + const lastParamEndLoc = loccc ? loccc.end : lastParamNode.loc.end const lineContent = model.getLineContent(lastParamEndLoc.line) msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) fix.range = { From ce33fafde03cce14bfc231b97106970d943181f8 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 31 Jul 2023 13:43:28 +0530 Subject: [PATCH 13/73] without params both AST supported --- .../src/lib/providers/codeActionProvider.ts | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index f21ded6d16..1b7108d135 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -29,20 +29,37 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { - console.log('nodeAtPosition--->', nodeAtPosition) - if (nodeAtPosition.parameters) { - const paramNodes = !Array.isArray(nodeAtPosition.parameters) ? nodeAtPosition.parameters.parameters : nodeAtPosition.parameters - console.log('paramNodes------->', paramNodes) + if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { + const paramNodes = nodeAtPosition.parameters.parameters if (paramNodes.length) { const lastParamNode = paramNodes[paramNodes.length - 1] - console.log('lastParamNode------->', lastParamNode) - let loccc - if (!Array.isArray(nodeAtPosition.parameters)) { - loccc = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) - console.log('locccc---->', loccc) - loccc.end.line += 1 + const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) + const lastParamEndLoc = location.end + const lineContent = model.getLineContent(lastParamEndLoc.line + 1) + msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) + fix.range = { + startLineNumber: lastParamEndLoc.line + 1, + endLineNumber: lastParamEndLoc.line + 1, + startColumn: 0, + endColumn: error.startColumn + msg.length + } + } else { + const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) + const lineContent = model.getLineContent(location.start.line + 1) + const i = lineContent.indexOf('()') + msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) + fix.range = { + startLineNumber: location.start.line + 1, + endLineNumber: location.start.line + 1, + startColumn: 0, + endColumn: error.startColumn + msg.length } - const lastParamEndLoc = loccc ? loccc.end : lastParamNode.loc.end + } + } else { + const paramNodes = nodeAtPosition.parameters + if (paramNodes.length) { + const lastParamNode = paramNodes[paramNodes.length - 1] + const lastParamEndLoc = lastParamNode.loc.end const lineContent = model.getLineContent(lastParamEndLoc.line) msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) fix.range = { @@ -50,7 +67,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi endLineNumber: lastParamEndLoc.line, startColumn: 0, endColumn: error.startColumn + msg.length - } + } } else { const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) const i = lineContent.indexOf('()') @@ -62,6 +79,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi endColumn: error.startColumn + msg.length } } + } } actions.push({ From 87adb564a34298fcc19bdaec14c805bb946e25d4 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 31 Jul 2023 18:38:50 +0530 Subject: [PATCH 14/73] both node with and without params supported --- libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 1b7108d135..0efce23bee 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -36,7 +36,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) const lastParamEndLoc = location.end const lineContent = model.getLineContent(lastParamEndLoc.line + 1) - msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) + msg = lineContent.substring(0, lastParamEndLoc.column + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + 1, lineContent.length) fix.range = { startLineNumber: lastParamEndLoc.line + 1, endLineNumber: lastParamEndLoc.line + 1, @@ -61,7 +61,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const lastParamNode = paramNodes[paramNodes.length - 1] const lastParamEndLoc = lastParamNode.loc.end const lineContent = model.getLineContent(lastParamEndLoc.line) - msg = lineContent.substring(0, lastParamEndLoc.column + 10) + fix.message + lineContent.substring(lastParamEndLoc.column + 10, lineContent.length) + msg = lineContent.substring(0, lastParamEndLoc.column + lastParamNode.name.length + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + lastParamNode.name.length + 1, lineContent.length) fix.range = { startLineNumber: lastParamEndLoc.line, endLineNumber: lastParamEndLoc.line, From 6d8d479f5aa302045444c6b85b43855a321eb15e Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 31 Jul 2023 19:54:54 +0530 Subject: [PATCH 15/73] handle node type --- libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts | 3 ++- libs/remix-ui/editor/src/lib/providers/quickfixes.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 0efce23bee..019e7502d0 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -81,7 +81,8 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } - } + } else if (fix && fix.nodeType !== nodeAtPosition.nodeType) return + actions.push({ title: fix.title, diagnostics: [error], diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index c0d6117191..ec8e7fda6f 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -1,11 +1,13 @@ export default { "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: \" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": { "title": "Add open-source license", - "message": "// SPDX-License-Identifier: GPL-3.0" + "message": "// SPDX-License-Identifier: GPL-3.0", + "nodeType": "SourceUnit" }, "Warning: Source file does not specify required compiler version! Consider adding" : { "title": "Add pragma line", "message": "pragma solidity ^0.*.*;", + "nodeType": "PragmaDirective", "range": { startLineNumber: 2, endLineNumber: 2, @@ -16,5 +18,6 @@ export default { "SyntaxError: No visibility specified. Did you intend to add \"public\"": { "title": "Add public visibility", "message": "public ", + "nodeType": "FunctionDefinition" } } \ No newline at end of file From aa502b69d6ade4ab09d6fc8ff21ff784391bb485 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 2 Aug 2023 12:03:50 +0530 Subject: [PATCH 16/73] add view mutability quick fix --- .../editor/src/lib/providers/codeActionProvider.ts | 2 +- libs/remix-ui/editor/src/lib/providers/quickfixes.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 019e7502d0..4cbfffe9da 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -81,7 +81,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } - } else if (fix && fix.nodeType !== nodeAtPosition.nodeType) return + } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return actions.push({ title: fix.title, diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index ec8e7fda6f..10a2ccc080 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -16,8 +16,13 @@ export default { } }, "SyntaxError: No visibility specified. Did you intend to add \"public\"": { - "title": "Add public visibility", + "title": "Add visibility 'public'", "message": "public ", "nodeType": "FunctionDefinition" + }, + "Warning: Function state mutability can be restricted to view": { + "title": "Add mutability 'view'", + "message": "view ", + "nodeType": "FunctionDefinition" } } \ No newline at end of file From bcbb0263d4d611863109450960b3099ff722b80f Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 2 Aug 2023 12:18:31 +0530 Subject: [PATCH 17/73] id and comments --- .../editor/src/lib/providers/codeActionProvider.ts | 9 +++++++++ libs/remix-ui/editor/src/lib/providers/quickfixes.ts | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 4cbfffe9da..1c4f3e75bc 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -28,12 +28,17 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi fix = fixes[errStr] const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) + // Check if a function is hovered if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { + // Identify type of AST node if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { const paramNodes = nodeAtPosition.parameters.parameters + // If method has parameters if (paramNodes.length) { + // Get last function parameter node const lastParamNode = paramNodes[paramNodes.length - 1] const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) + // Get end location of last function parameter, it returns end column of parameter name const lastParamEndLoc = location.end const lineContent = model.getLineContent(lastParamEndLoc.line + 1) msg = lineContent.substring(0, lastParamEndLoc.column + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + 1, lineContent.length) @@ -44,6 +49,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi endColumn: error.startColumn + msg.length } } else { + // If method has no parameters const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) const lineContent = model.getLineContent(location.start.line + 1) const i = lineContent.indexOf('()') @@ -57,8 +63,11 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } else { const paramNodes = nodeAtPosition.parameters + // If method has parameters if (paramNodes.length) { + // Get last function parameter node const lastParamNode = paramNodes[paramNodes.length - 1] + // Get end location of last function parameter, it returns start column of parameter name const lastParamEndLoc = lastParamNode.loc.end const lineContent = model.getLineContent(lastParamEndLoc.line) msg = lineContent.substring(0, lastParamEndLoc.column + lastParamNode.name.length + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + lastParamNode.name.length + 1, lineContent.length) diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index 10a2ccc080..14b24a5b0b 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -1,10 +1,12 @@ export default { "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: \" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": { + "id": 1, "title": "Add open-source license", "message": "// SPDX-License-Identifier: GPL-3.0", "nodeType": "SourceUnit" }, "Warning: Source file does not specify required compiler version! Consider adding" : { + "id": 2, "title": "Add pragma line", "message": "pragma solidity ^0.*.*;", "nodeType": "PragmaDirective", @@ -16,11 +18,13 @@ export default { } }, "SyntaxError: No visibility specified. Did you intend to add \"public\"": { + "id": 3, "title": "Add visibility 'public'", "message": "public ", "nodeType": "FunctionDefinition" }, "Warning: Function state mutability can be restricted to view": { + "id": 4, "title": "Add mutability 'view'", "message": "view ", "nodeType": "FunctionDefinition" From 03cd0c53eb6c0dcef2d4573b04918137f7fe896d Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 2 Aug 2023 12:31:14 +0530 Subject: [PATCH 18/73] pure mutability quick fix --- .../src/lib/providers/codeActionProvider.ts | 20 +++++++++++++++---- .../editor/src/lib/providers/quickfixes.ts | 6 ++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 1c4f3e75bc..8ae1291fd4 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -41,7 +41,10 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi // Get end location of last function parameter, it returns end column of parameter name const lastParamEndLoc = location.end const lineContent = model.getLineContent(lastParamEndLoc.line + 1) - msg = lineContent.substring(0, lastParamEndLoc.column + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + 1, lineContent.length) + if (fix.id === 5 && lineContent.includes(' view ')) { + msg = lineContent.replace('view', 'pure') + } else + msg = lineContent.substring(0, lastParamEndLoc.column + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + 1, lineContent.length) fix.range = { startLineNumber: lastParamEndLoc.line + 1, endLineNumber: lastParamEndLoc.line + 1, @@ -53,7 +56,10 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) const lineContent = model.getLineContent(location.start.line + 1) const i = lineContent.indexOf('()') - msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) + if (fix.id === 5 && lineContent.includes(' view ')) { + msg = lineContent.replace('view', 'pure') + } else + msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) fix.range = { startLineNumber: location.start.line + 1, endLineNumber: location.start.line + 1, @@ -70,7 +76,10 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi // Get end location of last function parameter, it returns start column of parameter name const lastParamEndLoc = lastParamNode.loc.end const lineContent = model.getLineContent(lastParamEndLoc.line) - msg = lineContent.substring(0, lastParamEndLoc.column + lastParamNode.name.length + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + lastParamNode.name.length + 1, lineContent.length) + if (fix.id === 5 && lineContent.includes(' view ')) { + msg = lineContent.replace('view', 'pure') + } else + msg = lineContent.substring(0, lastParamEndLoc.column + lastParamNode.name.length + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + lastParamNode.name.length + 1, lineContent.length) fix.range = { startLineNumber: lastParamEndLoc.line, endLineNumber: lastParamEndLoc.line, @@ -80,7 +89,10 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } else { const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) const i = lineContent.indexOf('()') - msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) + if (fix.id === 5 && lineContent.includes(' view ')) { + msg = lineContent.replace('view', 'pure') + } else + msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) fix.range = { startLineNumber: nodeAtPosition.loc.start.line, endLineNumber: nodeAtPosition.loc.start.line, diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index 14b24a5b0b..5eb8777076 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -28,5 +28,11 @@ export default { "title": "Add mutability 'view'", "message": "view ", "nodeType": "FunctionDefinition" + }, + "Warning: Function state mutability can be restricted to pure": { + "id": 5, + "title": "Add mutability 'pure'", + "message": "pure ", + "nodeType": "FunctionDefinition" } } \ No newline at end of file From 7570cb941961bff7ddd356ab6285d891f9e9cb43 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 2 Aug 2023 13:52:11 +0530 Subject: [PATCH 19/73] e2e fix by updating sol version --- apps/remix-ide-e2e/src/tests/remixd.test.ts | 2 +- apps/remix-ide-e2e/src/tests/solidityImport.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide-e2e/src/tests/remixd.test.ts b/apps/remix-ide-e2e/src/tests/remixd.test.ts index a1a617f645..e8155e05e6 100644 --- a/apps/remix-ide-e2e/src/tests/remixd.test.ts +++ b/apps/remix-ide-e2e/src/tests/remixd.test.ts @@ -104,7 +104,7 @@ module.exports = { }) .addFile('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol']) .clickLaunchIcon('solidity') - .setSolidityCompilerVersion('soljson-v0.8.19+commit.7dd6d404.js') // open-zeppelin moved to pragma ^0.8.0 + .setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') // open-zeppelin moved to pragma ^0.8.20 .testContracts('test_import_node_modules_with_github_import.sol', sources[4]['test_import_node_modules_with_github_import.sol'], ['ERC20', 'test11']) }, 'Static Analysis run with remixd #group3': '' + function (browser) { diff --git a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts index 79bddb5ed5..cd86bd7bdd 100644 --- a/apps/remix-ide-e2e/src/tests/solidityImport.test.ts +++ b/apps/remix-ide-e2e/src/tests/solidityImport.test.ts @@ -38,7 +38,7 @@ module.exports = { 'Test GitHub Import - from master branch #group1': function (browser: NightwatchBrowser) { browser - .setSolidityCompilerVersion('soljson-v0.8.19+commit.7dd6d404.js') // open-zeppelin moved to pragma ^0.8.19 (master branch) + .setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') // open-zeppelin moved to pragma ^0.8.20 (master branch) .addFile('Untitled4.sol', sources[3]['Untitled4.sol']) .clickLaunchIcon('filePanel') .verifyContracts(['test7', 'ERC20'], { wait: 10000 }) @@ -54,7 +54,7 @@ module.exports = { 'Test GitHub Import - no branch specified #group2': function (browser: NightwatchBrowser) { browser - .setSolidityCompilerVersion('soljson-v0.8.19+commit.7dd6d404.js') // open-zeppelin moved to pragma ^0.8.19 (master branch) + .setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') // open-zeppelin moved to pragma ^0.8.20 (master branch) .clickLaunchIcon('filePanel') .click('li[data-id="treeViewLitreeViewItemREADME.txt"') .addFile('Untitled6.sol', sources[5]['Untitled6.sol']) @@ -64,7 +64,7 @@ module.exports = { 'Test GitHub Import - raw URL #group4': function (browser: NightwatchBrowser) { browser - .setSolidityCompilerVersion('soljson-v0.8.19+commit.7dd6d404.js') // open-zeppelin moved to pragma ^0.8.0 (master branch) + .setSolidityCompilerVersion('soljson-v0.8.20+commit.a1b79de6.js') // open-zeppelin moved to pragma ^0.8.20 (master branch) .clickLaunchIcon('filePanel') .click('li[data-id="treeViewLitreeViewItemREADME.txt"') .addFile('Untitled7.sol', sources[6]['Untitled7.sol']) From 413c666d310b7d5667d4275a67a11c91e0dbc5fa Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 2 Aug 2023 14:28:20 +0530 Subject: [PATCH 20/73] fix e2e with warning count update --- apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts b/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts index c455d1ec32..9a12195b6e 100644 --- a/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts +++ b/apps/remix-ide-e2e/src/tests/staticAnalysis.test.ts @@ -54,7 +54,7 @@ module.exports = { .click('label[id="headingshowLibWarnings"]') .pause(1000) .click('*[data-rb-event-key="remix"]') - .assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '382') + .assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '386') .click('label[id="headingshowLibWarnings"]') .pause(1000) .assert.containsText('span#ssaRemixtab > *[data-id="RemixStaticAnalysisErrorCount', '1') From cb8041c446079990ab05fbf7ea18925ee302d3e2 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 14:05:15 +0100 Subject: [PATCH 21/73] add husky and pretty-quick packages --- package.json | 2 ++ yarn.lock | 76 ++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 136f03fa9c..5abd4aec77 100644 --- a/package.json +++ b/package.json @@ -313,6 +313,7 @@ "gulp": "^4.0.2", "hardhat": "^2.14.0", "https-browserify": "^1.0.0", + "husky": "^8.0.3", "ipfs-http-client": "^47.0.1", "ipfs-mini": "^1.1.5", "is-electron": "^2.2.0", @@ -335,6 +336,7 @@ "nyc": "^13.3.0", "onchange": "^3.2.1", "os-browserify": "^0.3.0", + "pretty-quick": "^3.1.3", "process": "^0.11.10", "react-refresh": "^0.14.0", "react-test-renderer": "^17.0.2", diff --git a/yarn.lock b/yarn.lock index 0cc5034dac..622cfda848 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5754,7 +5754,7 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10" integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA== -"@types/minimatch@*": +"@types/minimatch@*", "@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== @@ -7380,6 +7380,11 @@ array-differ@^2.0.3: resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== +array-differ@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" + integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== + array-each@^1.0.0, array-each@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" @@ -7522,6 +7527,11 @@ arrify@^1.0.1, arrify@~1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== +arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + asap@^2.0.0, asap@~2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f" @@ -9583,6 +9593,14 @@ chalk@^2.0.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.3.2, chalk@^2.4.1, chalk@^2.4 escape-string-regexp "^1.0.5" supports-color "^5.3.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -10795,7 +10813,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -12855,6 +12873,21 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" + integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -14143,7 +14176,7 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" -get-stream@^5.1.0: +get-stream@^5.0.0, get-stream@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== @@ -15259,6 +15292,11 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -15271,6 +15309,11 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" +husky@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" + integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== + hyperscript-attribute-to-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/hyperscript-attribute-to-property/-/hyperscript-attribute-to-property-1.0.2.tgz#66ad4164f88beefacf46ec884bd3d1173c1c382a" @@ -19436,7 +19479,7 @@ move-concurrently@^1.0.1, move-concurrently@~1.0.1: rimraf "^2.5.4" run-queue "^1.0.3" -mri@^1.1.0: +mri@^1.1.0, mri@^1.1.5: version "1.2.0" resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== @@ -19611,6 +19654,17 @@ multimatch@^3.0.0: arrify "^1.0.1" minimatch "^3.0.4" +multimatch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3" + integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ== + dependencies: + "@types/minimatch" "^3.0.3" + array-differ "^3.0.0" + array-union "^2.1.0" + arrify "^2.0.1" + minimatch "^3.0.4" + murmurhash3js-revisited@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" @@ -20280,7 +20334,7 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-run-path@^4.0.1: +npm-run-path@^4.0.0, npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== @@ -22111,6 +22165,18 @@ pretty-ms@^2.1.0: parse-ms "^1.0.0" plur "^1.0.0" +pretty-quick@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.1.3.tgz#15281108c0ddf446675157ca40240099157b638e" + integrity sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA== + dependencies: + chalk "^3.0.0" + execa "^4.0.0" + find-up "^4.1.0" + ignore "^5.1.4" + mri "^1.1.5" + multimatch "^4.0.0" + private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" From 9f3f33f19454d1f884e37cbbe515b581e740552b Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 14:31:20 +0100 Subject: [PATCH 22/73] add prettier config --- .prettierrc.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000000..eb9e1f1f9e --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,14 @@ +{ + "tabWidth": 2, + "useTabs": false, + "semi": false, + "singleQuote": true, + "quoteProps": "consistent", + "jsxSingleQuote": false, + "bracketSpacing": false, + "trailingComma": "none", + "jsxBracketSameLine": false, + "arrowParens": "always", + "singleAttributePerLine": false, + "ignorePath": ".prettierignore" +} From a65c0d2540d234ebbe5d1bfb9286f980e8a41531 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 14:32:55 +0100 Subject: [PATCH 23/73] add prettierignore file --- .prettierignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..e9c70767c5 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +**/.yarn/* + +# Ignore node_modules +./node_modules + +# Ignore e2e files +./apps/remix-ide-e2e/* + +# Ignore build artefacts +./dist + +# Ignore all json files +**/*.json From 9a3b2c21184e92e263d13fb7b1eca61925974e3a Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 14:39:04 +0100 Subject: [PATCH 24/73] add husky precommit and pretty-quick script in package.json --- .husky/pre-commit | 4 ++++ package.json | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000000..618c2bfbc7 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + + diff --git a/package.json b/package.json index 5abd4aec77..b95b547635 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,8 @@ "watch": "watchify apps/remix-ide/src/index.js -dv -p browserify-reload -o apps/remix-ide/build/app.js --exclude solc", "reinstall": "rm ./node-modules/ -rf && rm yarn.lock && rm ./build/ -rf && yarn install & yarn run build", "ganache-cli": "npx ganache-cli", - "build-contracts": "find ./node_modules/@openzeppelin/contracts | grep -i '.sol' > libs/remix-ui/editor/src/lib/providers/completion/contracts/contracts.txt && find ./node_modules/@uniswap/v3-core/contracts | grep -i '.sol' >> libs/remix-ui/editor/src/lib/providers/completion/contracts/contracts.txt" + "build-contracts": "find ./node_modules/@openzeppelin/contracts | grep -i '.sol' > libs/remix-ui/editor/src/lib/providers/completion/contracts/contracts.txt && find ./node_modules/@uniswap/v3-core/contracts | grep -i '.sol' >> libs/remix-ui/editor/src/lib/providers/completion/contracts/contracts.txt", + "prepare": "husky install" }, "dependencies": { "@babel/plugin-proposal-class-properties": "^7.16.0", @@ -313,7 +314,7 @@ "gulp": "^4.0.2", "hardhat": "^2.14.0", "https-browserify": "^1.0.0", - "husky": "^8.0.3", + "husky": "^8.0.0", "ipfs-http-client": "^47.0.1", "ipfs-mini": "^1.1.5", "is-electron": "^2.2.0", @@ -365,5 +366,10 @@ }, "resolutions": { "@types/react": "^17.0.24" + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged --pattern \"**/*.{js,jsx,ts,tsx}\"" + } } } From 92bcdb10a154d98eb3e56534bad9bb0b6c26fb66 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 14:42:09 +0100 Subject: [PATCH 25/73] add hustky pretty-quick staged script --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 618c2bfbc7..0da96d6baa 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" - +npx pretty-quick --staged From 57d71acebcd2ed7567b95bce148b114bd71713af Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 14:48:41 +0100 Subject: [PATCH 26/73] testing precommit hook --- .../workspace/src/lib/reducers/workspace.ts | 1353 ++++++++++------- 1 file changed, 779 insertions(+), 574 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index a6d82f2885..66170be1d2 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -1,71 +1,71 @@ -import { extractNameFromKey } from '@remix-ui/helper' -import { action, FileType } from '../types' +import {extractNameFromKey} from '@remix-ui/helper' +import {action, FileType} from '../types' import * as _ from 'lodash' -import { fileDecoration } from '@remix-ui/file-decorators' -import { ROOT_PATH } from '../utils/constants' +import {fileDecoration} from '@remix-ui/file-decorators' +import {ROOT_PATH} from '../utils/constants' interface Action { type: string payload: any } export interface BrowserState { browser: { - currentWorkspace: string, + currentWorkspace: string workspaces: { - name: string; - isGitRepo: boolean; + name: string + isGitRepo: boolean branches?: { - remote: any; - name: string; - }[], + remote: any + name: string + }[] currentBranch?: string - }[], - files: { [x: string]: Record }, + }[] + files: {[x: string]: Record} expandPath: string[] - isRequestingDirectory: boolean, - isSuccessfulDirectory: boolean, - isRequestingWorkspace: boolean, - isSuccessfulWorkspace: boolean, - isRequestingCloning: boolean, - isSuccessfulCloning: boolean, - error: string, + isRequestingDirectory: boolean + isSuccessfulDirectory: boolean + isRequestingWorkspace: boolean + isSuccessfulWorkspace: boolean + isRequestingCloning: boolean + isSuccessfulCloning: boolean + error: string contextMenu: { - registeredMenuItems: action[], - removedMenuItems: action[], + registeredMenuItems: action[] + removedMenuItems: action[] error: string - }, + } fileState: fileDecoration[] - }, + } localhost: { - sharedFolder: string, - files: { [x: string]: Record }, - expandPath: string[], - isRequestingDirectory: boolean, - isSuccessfulDirectory: boolean, - isRequestingLocalhost: boolean, - isSuccessfulLocalhost: boolean, - error: string, + sharedFolder: string + files: {[x: string]: Record} + expandPath: string[] + isRequestingDirectory: boolean + isSuccessfulDirectory: boolean + isRequestingLocalhost: boolean + isSuccessfulLocalhost: boolean + error: string contextMenu: { - registeredMenuItems: action[], - removedMenuItems: action[], + registeredMenuItems: action[] + removedMenuItems: action[] error: string - }, + } fileState: [] - }, - mode: 'browser' | 'localhost', + } + mode: 'browser' | 'localhost' notification: { - title: string, - message: string, - actionOk: () => void, - actionCancel: (() => void) | null, - labelOk: string, + title: string + message: string + actionOk: () => void + actionCancel: (() => void) | null + labelOk: string labelCancel: string - }, - readonly: boolean, - popup: string, - focusEdit: string, - focusElement: { key: string, type: 'file' | 'folder' | 'gist' }[], - initializingFS: boolean, - gitConfig: { username: string, email: string, token: string }, + } + readonly: boolean + popup: string + focusEdit: string + focusElement: {key: string; type: 'file' | 'folder' | 'gist'}[] + initializingFS: boolean + gitConfig: {username: string; email: string; token: string} } export const browserInitialState: BrowserState = { @@ -108,8 +108,8 @@ export const browserInitialState: BrowserState = { notification: { title: '', message: '', - actionOk: () => { }, - actionCancel: () => { }, + actionOk: () => {}, + actionCancel: () => {}, labelOk: '', labelCancel: '' }, @@ -118,645 +118,790 @@ export const browserInitialState: BrowserState = { focusEdit: '', focusElement: [], initializingFS: true, - gitConfig: { username: '', email: '', token: '' } + gitConfig: {username: '', email: '', token: ''} } export const browserReducer = (state = browserInitialState, action: Action) => { switch (action.type) { - case 'SET_CURRENT_WORKSPACE': { - const payload = action.payload as { name: string; isGitRepo: boolean; branches?: { remote: any; name: string; }[], currentBranch?: string } - const workspaces = state.browser.workspaces.find(({ name }) => name === payload.name) ? state.browser.workspaces : [...state.browser.workspaces, action.payload] - - return { - ...state, - browser: { - ...state.browser, - currentWorkspace: payload.name, - workspaces: workspaces.filter(workspace => workspace) + case 'SET_CURRENT_WORKSPACE': { + const payload = action.payload as { + name: string + isGitRepo: boolean + branches?: {remote: any; name: string}[] + currentBranch?: string + } + const workspaces = state.browser.workspaces.find( + ({name}) => name === payload.name + ) + ? state.browser.workspaces + : [...state.browser.workspaces, action.payload] + + return { + ...state, + browser: { + ...state.browser, + currentWorkspace: payload.name, + workspaces: workspaces.filter((workspace) => workspace) + } } } - } - case 'SET_WORKSPACES': { - const payload = action.payload as { name: string; isGitRepo: boolean; branches?: { remote: any; name: string; }[], currentBranch?: string }[] - - return { - ...state, - browser: { - ...state.browser, - workspaces: payload.filter(workspace => workspace) + case 'SET_WORKSPACES': { + const payload = action.payload as { + name: string + isGitRepo: boolean + branches?: {remote: any; name: string}[] + currentBranch?: string + }[] + + return { + ...state, + browser: { + ...state.browser, + workspaces: payload.filter((workspace) => workspace) + } } } - } - case 'SET_MODE': { - const payload = action.payload as 'browser' | 'localhost' + case 'SET_MODE': { + const payload = action.payload as 'browser' | 'localhost' - return { - ...state, - mode: payload + return { + ...state, + mode: payload + } } - } - case 'FETCH_DIRECTORY_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingDirectory: state.mode === 'browser', - isSuccessfulDirectory: false, - error: null - }, - localhost: { - ...state.localhost, - isRequestingDirectory: state.mode === 'localhost', - isSuccessfulDirectory: false, - error: null + case 'FETCH_DIRECTORY_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingDirectory: state.mode === 'browser', + isSuccessfulDirectory: false, + error: null + }, + localhost: { + ...state.localhost, + isRequestingDirectory: state.mode === 'localhost', + isSuccessfulDirectory: false, + error: null + } } } - } - - case 'FETCH_DIRECTORY_SUCCESS': { - const payload = action.payload as { path: string, fileTree } - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files, - isRequestingDirectory: false, - isSuccessfulDirectory: true, - error: null - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files, - isRequestingDirectory: false, - isSuccessfulDirectory: true, - error: null + case 'FETCH_DIRECTORY_SUCCESS': { + const payload = action.payload as {path: string; fileTree} + + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fetchDirectoryContent(state, payload) + : state.browser.files, + isRequestingDirectory: false, + isSuccessfulDirectory: true, + error: null + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fetchDirectoryContent(state, payload) + : state.localhost.files, + isRequestingDirectory: false, + isSuccessfulDirectory: true, + error: null + } } } - } - case 'FETCH_DIRECTORY_ERROR': { - return { - ...state, - browser: { - ...state.browser, - isRequestingDirectory: false, - isSuccessfulDirectory: false, - error: state.mode === 'browser' ? action.payload : null - }, - localhost: { - ...state.localhost, - isRequestingDirectory: false, - isSuccessfulDirectory: false, - error: state.mode === 'localhost' ? action.payload : null + case 'FETCH_DIRECTORY_ERROR': { + return { + ...state, + browser: { + ...state.browser, + isRequestingDirectory: false, + isSuccessfulDirectory: false, + error: state.mode === 'browser' ? action.payload : null + }, + localhost: { + ...state.localhost, + isRequestingDirectory: false, + isSuccessfulDirectory: false, + error: state.mode === 'localhost' ? action.payload : null + } } } - } - case 'FETCH_WORKSPACE_DIRECTORY_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: state.mode === 'browser', - isSuccessfulWorkspace: false, - error: null - }, - localhost: { - ...state.localhost, - isRequestingWorkspace: state.mode === 'localhost', - isSuccessfulWorkspace: false, - error: null + case 'FETCH_WORKSPACE_DIRECTORY_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: state.mode === 'browser', + isSuccessfulWorkspace: false, + error: null + }, + localhost: { + ...state.localhost, + isRequestingWorkspace: state.mode === 'localhost', + isSuccessfulWorkspace: false, + error: null + } } } - } - case 'FETCH_WORKSPACE_DIRECTORY_SUCCESS': { - const payload = action.payload as { path: string, fileTree } - - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fetchWorkspaceDirectoryContent(state, payload) : state.browser.files, - isRequestingWorkspace: false, - isSuccessfulWorkspace: true, - error: null - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fetchWorkspaceDirectoryContent(state, payload) : state.localhost.files, - isRequestingWorkspace: false, - isSuccessfulWorkspace: true, - error: null, - sharedFolder: null + case 'FETCH_WORKSPACE_DIRECTORY_SUCCESS': { + const payload = action.payload as {path: string; fileTree} + + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fetchWorkspaceDirectoryContent(state, payload) + : state.browser.files, + isRequestingWorkspace: false, + isSuccessfulWorkspace: true, + error: null + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fetchWorkspaceDirectoryContent(state, payload) + : state.localhost.files, + isRequestingWorkspace: false, + isSuccessfulWorkspace: true, + error: null, + sharedFolder: null + } } } - } - case 'FETCH_WORKSPACE_DIRECTORY_ERROR': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: false, - isSuccessfulWorkspace: false, - error: state.mode === 'browser' ? action.payload : null - }, - localhost: { - ...state.localhost, - isRequestingWorkspace: false, - isSuccessfulWorkspace: false, - error: state.mode === 'localhost' ? action.payload : null + case 'FETCH_WORKSPACE_DIRECTORY_ERROR': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: false, + isSuccessfulWorkspace: false, + error: state.mode === 'browser' ? action.payload : null + }, + localhost: { + ...state.localhost, + isRequestingWorkspace: false, + isSuccessfulWorkspace: false, + error: state.mode === 'localhost' ? action.payload : null + } } } - } - case 'DISPLAY_NOTIFICATION': { - const payload = action.payload as { title: string, message: string, actionOk: () => void, actionCancel: () => void, labelOk: string, labelCancel: string } + case 'DISPLAY_NOTIFICATION': { + const payload = action.payload as { + title: string + message: string + actionOk: () => void + actionCancel: () => void + labelOk: string + labelCancel: string + } - return { - ...state, - notification: { - title: payload.title, - message: payload.message, - actionOk: payload.actionOk || browserInitialState.notification.actionOk, - actionCancel: payload.actionCancel || browserInitialState.notification.actionCancel, - labelOk: payload.labelOk, - labelCancel: payload.labelCancel + return { + ...state, + notification: { + title: payload.title, + message: payload.message, + actionOk: + payload.actionOk || browserInitialState.notification.actionOk, + actionCancel: + payload.actionCancel || + browserInitialState.notification.actionCancel, + labelOk: payload.labelOk, + labelCancel: payload.labelCancel + } } } - } - case 'HIDE_NOTIFICATION': { - return { - ...state, - notification: browserInitialState.notification + case 'HIDE_NOTIFICATION': { + return { + ...state, + notification: browserInitialState.notification + } } - } - - case 'FILE_ADDED_SUCCESS': { - const payload = action.payload as string - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fileAdded(state, payload) : state.browser.files, - expandPath: state.mode === 'browser' ? [...new Set([...state.browser.expandPath, payload])] : state.browser.expandPath - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fileAdded(state, payload) : state.localhost.files, - expandPath: state.mode === 'localhost' ? [...new Set([...state.localhost.expandPath, payload])] : state.localhost.expandPath + case 'FILE_ADDED_SUCCESS': { + const payload = action.payload as string + + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fileAdded(state, payload) + : state.browser.files, + expandPath: + state.mode === 'browser' + ? [...new Set([...state.browser.expandPath, payload])] + : state.browser.expandPath + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fileAdded(state, payload) + : state.localhost.files, + expandPath: + state.mode === 'localhost' + ? [...new Set([...state.localhost.expandPath, payload])] + : state.localhost.expandPath + } } } - } - case 'FOLDER_ADDED_SUCCESS': { - const payload = action.payload as { path: string, folderPath: string, fileTree } + case 'FOLDER_ADDED_SUCCESS': { + const payload = action.payload as { + path: string + folderPath: string + fileTree + } - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files, - expandPath: state.mode === 'browser' ? [...new Set([...state.browser.expandPath, payload.folderPath])] : state.browser.expandPath - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files, - expandPath: state.mode === 'localhost' ? [...new Set([...state.localhost.expandPath, payload.folderPath])] : state.localhost.expandPath + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fetchDirectoryContent(state, payload) + : state.browser.files, + expandPath: + state.mode === 'browser' + ? [...new Set([...state.browser.expandPath, payload.folderPath])] + : state.browser.expandPath + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fetchDirectoryContent(state, payload) + : state.localhost.files, + expandPath: + state.mode === 'localhost' + ? [ + ...new Set([ + ...state.localhost.expandPath, + payload.folderPath + ]) + ] + : state.localhost.expandPath + } } } - } - - case 'FILE_REMOVED_SUCCESS': { - const payload = action.payload as string - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fileRemoved(state, payload) : state.browser.files, - expandPath: state.mode === 'browser' ? [...(state.browser.expandPath.filter(path => path !== payload))] : state.browser.expandPath - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fileRemoved(state, payload) : state.localhost.files, - expandPath: state.mode === 'localhost' ? [...(state.browser.expandPath.filter(path => path !== payload))] : state.localhost.expandPath + case 'FILE_REMOVED_SUCCESS': { + const payload = action.payload as string + + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fileRemoved(state, payload) + : state.browser.files, + expandPath: + state.mode === 'browser' + ? [...state.browser.expandPath.filter((path) => path !== payload)] + : state.browser.expandPath + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fileRemoved(state, payload) + : state.localhost.files, + expandPath: + state.mode === 'localhost' + ? [...state.browser.expandPath.filter((path) => path !== payload)] + : state.localhost.expandPath + } } } - } - case 'ROOT_FOLDER_CHANGED': { - const payload = action.payload as string - return { - ...state, - localhost: { - ...state.localhost, - sharedFolder: payload, - files: {} + case 'ROOT_FOLDER_CHANGED': { + const payload = action.payload as string + return { + ...state, + localhost: { + ...state.localhost, + sharedFolder: payload, + files: {} + } } } - } - case 'ADD_INPUT_FIELD': { - const payload = action.payload as { path: string, fileTree, type: 'file' | 'folder' } + case 'ADD_INPUT_FIELD': { + const payload = action.payload as { + path: string + fileTree + type: 'file' | 'folder' + } - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files - }, - focusEdit: payload.path + '/' + 'blank' + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fetchDirectoryContent(state, payload) + : state.browser.files + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fetchDirectoryContent(state, payload) + : state.localhost.files + }, + focusEdit: payload.path + '/' + 'blank' + } } - } - - case 'REMOVE_INPUT_FIELD': { - const payload = action.payload as { path: string, fileTree } - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? removeInputField(state, payload.path) : state.browser.files - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? removeInputField(state, payload.path) : state.localhost.files - }, - focusEdit: null + case 'REMOVE_INPUT_FIELD': { + const payload = action.payload as {path: string; fileTree} + + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? removeInputField(state, payload.path) + : state.browser.files + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? removeInputField(state, payload.path) + : state.localhost.files + }, + focusEdit: null + } } - } - case 'SET_READ_ONLY_MODE': { - const payload = action.payload as boolean + case 'SET_READ_ONLY_MODE': { + const payload = action.payload as boolean - return { - ...state, - readonly: payload + return { + ...state, + readonly: payload + } } - } - - case 'FILE_RENAMED_SUCCESS': { - const payload = action.payload as { path: string, oldPath: string, fileTree } - return { - ...state, - browser: { - ...state.browser, - files: state.mode === 'browser' ? fetchDirectoryContent(state, payload, payload.oldPath) : state.browser.files - }, - localhost: { - ...state.localhost, - files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload, payload.oldPath) : state.localhost.files + case 'FILE_RENAMED_SUCCESS': { + const payload = action.payload as { + path: string + oldPath: string + fileTree } - } - } - case 'CREATE_WORKSPACE_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: true, - isSuccessfulWorkspace: false, - error: null + return { + ...state, + browser: { + ...state.browser, + files: + state.mode === 'browser' + ? fetchDirectoryContent(state, payload, payload.oldPath) + : state.browser.files + }, + localhost: { + ...state.localhost, + files: + state.mode === 'localhost' + ? fetchDirectoryContent(state, payload, payload.oldPath) + : state.localhost.files + } } } - } - case 'CREATE_WORKSPACE_SUCCESS': { - const payload = action.payload as { name: string; isGitRepo: boolean; branches?: { remote: any; name: string; }[], currentBranch?: string } - const workspaces = state.browser.workspaces.find(({ name }) => name === payload.name) ? state.browser.workspaces : [...state.browser.workspaces, action.payload] - - return { - ...state, - browser: { - ...state.browser, - currentWorkspace: payload.name, - workspaces: workspaces.filter(workspace => workspace), - isRequestingWorkspace: false, - isSuccessfulWorkspace: true, - error: null + case 'CREATE_WORKSPACE_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: true, + isSuccessfulWorkspace: false, + error: null + } } } - } - case 'CREATE_WORKSPACE_ERROR': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: false, - isSuccessfulWorkspace: false, - error: action.payload + case 'CREATE_WORKSPACE_SUCCESS': { + const payload = action.payload as { + name: string + isGitRepo: boolean + branches?: {remote: any; name: string}[] + currentBranch?: string + } + const workspaces = state.browser.workspaces.find( + ({name}) => name === payload.name + ) + ? state.browser.workspaces + : [...state.browser.workspaces, action.payload] + + return { + ...state, + browser: { + ...state.browser, + currentWorkspace: payload.name, + workspaces: workspaces.filter((workspace) => workspace), + isRequestingWorkspace: false, + isSuccessfulWorkspace: true, + error: null + } } } - } - case 'RENAME_WORKSPACE': { - const payload = action.payload as { oldName: string, workspaceName: string } - let renamedWorkspace - const workspaces = state.browser.workspaces.filter(({ name, isGitRepo, branches, currentBranch }) => { - if (name && (name !== payload.oldName)) { - return true - } else { - renamedWorkspace = { - name: payload.workspaceName, - isGitRepo, - branches, - currentBranch + case 'CREATE_WORKSPACE_ERROR': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: false, + isSuccessfulWorkspace: false, + error: action.payload } - return false } - }) + } - return { - ...state, - browser: { - ...state.browser, - currentWorkspace: payload.workspaceName, - workspaces: [...workspaces, renamedWorkspace], - expandPath: [] + case 'RENAME_WORKSPACE': { + const payload = action.payload as {oldName: string; workspaceName: string} + let renamedWorkspace + const workspaces = state.browser.workspaces.filter( + ({name, isGitRepo, branches, currentBranch}) => { + if (name && name !== payload.oldName) { + return true + } else { + renamedWorkspace = { + name: payload.workspaceName, + isGitRepo, + branches, + currentBranch + } + return false + } + } + ) + + return { + ...state, + browser: { + ...state.browser, + currentWorkspace: payload.workspaceName, + workspaces: [...workspaces, renamedWorkspace], + expandPath: [] + } } } - } - - case 'DELETE_WORKSPACE': { - const payload = action.payload as string - const workspaces = state.browser.workspaces.filter(({ name }) => name && (name !== payload)) - return { - ...state, - browser: { - ...state.browser, - workspaces: workspaces + case 'DELETE_WORKSPACE': { + const payload = action.payload as string + const workspaces = state.browser.workspaces.filter( + ({name}) => name && name !== payload + ) + + return { + ...state, + browser: { + ...state.browser, + workspaces: workspaces + } } } - } - case 'DISPLAY_POPUP_MESSAGE': { - const payload = action.payload as string + case 'DISPLAY_POPUP_MESSAGE': { + const payload = action.payload as string - return { - ...state, - popup: payload + return { + ...state, + popup: payload + } } - } - case 'HIDE_POPUP_MESSAGE': { - return { - ...state, - popup: '' + case 'HIDE_POPUP_MESSAGE': { + return { + ...state, + popup: '' + } } - } - case 'SET_FOCUS_ELEMENT': { - const payload = action.payload as { key: string, type: 'file' | 'folder' | 'gist' }[] + case 'SET_FOCUS_ELEMENT': { + const payload = action.payload as { + key: string + type: 'file' | 'folder' | 'gist' + }[] - return { - ...state, - focusElement: payload + return { + ...state, + focusElement: payload + } } - } - case 'REMOVE_FOCUS_ELEMENT': { - const payload: string = action.payload + case 'REMOVE_FOCUS_ELEMENT': { + const payload: string = action.payload - return { - ...state, - focusElement: state.focusElement.filter(element => element.key !== payload) + return { + ...state, + focusElement: state.focusElement.filter( + (element) => element.key !== payload + ) + } } - } - case 'SET_CONTEXT_MENU_ITEM': { - const payload = action.payload as action - - return { - ...state, - browser: { - ...state.browser, - contextMenu: addContextMenuItem(state, payload) - }, - localhost: { - ...state.localhost, - contextMenu: addContextMenuItem(state, payload) + case 'SET_CONTEXT_MENU_ITEM': { + const payload = action.payload as action + + return { + ...state, + browser: { + ...state.browser, + contextMenu: addContextMenuItem(state, payload) + }, + localhost: { + ...state.localhost, + contextMenu: addContextMenuItem(state, payload) + } } } - } - - case 'REMOVE_CONTEXT_MENU_ITEM': { - const payload = action.payload - return { - ...state, - browser: { - ...state.browser, - contextMenu: removeContextMenuItem(state, payload) - }, - localhost: { - ...state.localhost, - contextMenu: removeContextMenuItem(state, payload) + case 'REMOVE_CONTEXT_MENU_ITEM': { + const payload = action.payload + + return { + ...state, + browser: { + ...state.browser, + contextMenu: removeContextMenuItem(state, payload) + }, + localhost: { + ...state.localhost, + contextMenu: removeContextMenuItem(state, payload) + } } } - } - - case 'SET_EXPAND_PATH': { - const payload = action.payload as string[] - return { - ...state, - browser: { - ...state.browser, - expandPath: payload - }, - localhost: { - ...state.localhost, - expandPath: payload + case 'SET_EXPAND_PATH': { + const payload = action.payload as string[] + + return { + ...state, + browser: { + ...state.browser, + expandPath: payload + }, + localhost: { + ...state.localhost, + expandPath: payload + } } } - } - case 'LOAD_LOCALHOST_REQUEST': { - return { - ...state, - localhost: { - ...state.localhost, - isRequestingLocalhost: true, - isSuccessfulLocalhost: false, - error: null + case 'LOAD_LOCALHOST_REQUEST': { + return { + ...state, + localhost: { + ...state.localhost, + isRequestingLocalhost: true, + isSuccessfulLocalhost: false, + error: null + } } } - } - case 'LOAD_LOCALHOST_SUCCESS': { - return { - ...state, - localhost: { - ...state.localhost, - isRequestingLocalhost: false, - isSuccessfulLocalhost: true, - error: null + case 'LOAD_LOCALHOST_SUCCESS': { + return { + ...state, + localhost: { + ...state.localhost, + isRequestingLocalhost: false, + isSuccessfulLocalhost: true, + error: null + } } } - } - case 'LOAD_LOCALHOST_ERROR': { - const payload = action.payload as string + case 'LOAD_LOCALHOST_ERROR': { + const payload = action.payload as string - return { - ...state, - localhost: { - ...state.localhost, - isRequestingLocalhost: false, - isSuccessfulLocalhost: false, - error: payload + return { + ...state, + localhost: { + ...state.localhost, + isRequestingLocalhost: false, + isSuccessfulLocalhost: false, + error: payload + } } } - } - case 'CLONE_REPOSITORY_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingCloning: true, - isSuccessfulCloning: false + case 'CLONE_REPOSITORY_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingCloning: true, + isSuccessfulCloning: false + } } } - } - case 'CLONE_REPOSITORY_SUCCESS': { - return { - ...state, - browser: { - ...state.browser, - isRequestingCloning: false, - isSuccessfulCloning: true + case 'CLONE_REPOSITORY_SUCCESS': { + return { + ...state, + browser: { + ...state.browser, + isRequestingCloning: false, + isSuccessfulCloning: true + } } } - } - case 'CLONE_REPOSITORY_FAILED': { - return { - ...state, - browser: { - ...state.browser, - isRequestingCloning: false, - isSuccessfulCloning: false + case 'CLONE_REPOSITORY_FAILED': { + return { + ...state, + browser: { + ...state.browser, + isRequestingCloning: false, + isSuccessfulCloning: false + } } } - } - case 'FS_INITIALIZATION_COMPLETED': { - return { - ...state, - initializingFS: false + case 'FS_INITIALIZATION_COMPLETED': { + return { + ...state, + initializingFS: false + } } - } - case 'SET_FILE_DECORATION_SUCCESS': { - return { - ...state, - browser: { - ...state.browser, - fileState: action.payload + case 'SET_FILE_DECORATION_SUCCESS': { + return { + ...state, + browser: { + ...state.browser, + fileState: action.payload + } } } - } - case 'SET_CURRENT_WORKSPACE_BRANCHES': { - const payload: { remote: any, name: string }[] = action.payload - - return { - ...state, - browser: { - ...state.browser, - workspaces: state.browser.workspaces.map((workspace) => { - if (workspace.name === state.browser.currentWorkspace) workspace.branches = payload - return workspace - }) + case 'SET_CURRENT_WORKSPACE_BRANCHES': { + const payload: {remote: any; name: string}[] = action.payload + + return { + ...state, + browser: { + ...state.browser, + workspaces: state.browser.workspaces.map((workspace) => { + if (workspace.name === state.browser.currentWorkspace) + workspace.branches = payload + return workspace + }) + } } } - } - - case 'SET_CURRENT_WORKSPACE_CURRENT_BRANCH': { - const payload: string = action.payload - return { - ...state, - browser: { - ...state.browser, - workspaces: state.browser.workspaces.map((workspace) => { - if (workspace.name === state.browser.currentWorkspace) workspace.currentBranch = payload - return workspace - }) + case 'SET_CURRENT_WORKSPACE_CURRENT_BRANCH': { + const payload: string = action.payload + + return { + ...state, + browser: { + ...state.browser, + workspaces: state.browser.workspaces.map((workspace) => { + if (workspace.name === state.browser.currentWorkspace) + workspace.currentBranch = payload + return workspace + }) + } } } - } - - case 'SET_CURRENT_WORKSPACE_IS_GITREPO': { - const payload: boolean = action.payload - return { - ...state, - browser: { - ...state.browser, - workspaces: state.browser.workspaces.map((workspace) => { - if (workspace.name === state.browser.currentWorkspace) workspace.isGitRepo = payload - return workspace - }) + case 'SET_CURRENT_WORKSPACE_IS_GITREPO': { + const payload: boolean = action.payload + + return { + ...state, + browser: { + ...state.browser, + workspaces: state.browser.workspaces.map((workspace) => { + if (workspace.name === state.browser.currentWorkspace) + workspace.isGitRepo = payload + return workspace + }) + } } } - } - case 'SET_GIT_CONFIG' : { - const payload: { username: string, token: string, email: string } = action.payload - return { - ...state, - gitConfig: payload + case 'SET_GIT_CONFIG': { + const payload: {username: string; token: string; email: string} = + action.payload + return { + ...state, + gitConfig: payload + } } - } - - default: - throw new Error() + default: + throw new Error() } } -const fileAdded = (state: BrowserState, path: string): { [x: string]: Record } => { - let files = state.mode === 'browser' ? state.browser.files : state.localhost.files +const fileAdded = ( + state: BrowserState, + path: string +): {[x: string]: Record} => { + let files = + state.mode === 'browser' ? state.browser.files : state.localhost.files const _path = splitPath(state, path) - files = _.setWith(files, _path, { - path: path, - name: extractNameFromKey(path), - isDirectory: false, - type: 'file' - }, Object) + files = _.setWith( + files, + _path, + { + path: path, + name: extractNameFromKey(path), + isDirectory: false, + type: 'file' + }, + Object + ) return files } -const fileRemoved = (state: BrowserState, path: string): { [x: string]: Record } => { - const files = state.mode === 'browser' ? state.browser.files : state.localhost.files +const fileRemoved = ( + state: BrowserState, + path: string +): {[x: string]: Record} => { + const files = + state.mode === 'browser' ? state.browser.files : state.localhost.files const _path = splitPath(state, path) _.unset(files, _path) return files } -const removeInputField = (state: BrowserState, path: string): { [x: string]: Record } => { - let files = state.mode === 'browser' ? state.browser.files : state.localhost.files +const removeInputField = ( + state: BrowserState, + path: string +): {[x: string]: Record} => { + let files = + state.mode === 'browser' ? state.browser.files : state.localhost.files const root = state.mode === 'browser' ? ROOT_PATH : state.mode if (path === root) { @@ -767,35 +912,51 @@ const removeInputField = (state: BrowserState, path: string): { [x: string]: Rec const prevFiles = _.get(files, _path) if (prevFiles) { - prevFiles.child && prevFiles.child[path + '/' + 'blank'] && delete prevFiles.child[path + '/' + 'blank'] - files = _.setWith(files, _path, { - isDirectory: true, - path, - name: extractNameFromKey(path), - type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder', - child: prevFiles ? prevFiles.child : {} - }, Object) + prevFiles.child && + prevFiles.child[path + '/' + 'blank'] && + delete prevFiles.child[path + '/' + 'blank'] + files = _.setWith( + files, + _path, + { + isDirectory: true, + path, + name: extractNameFromKey(path), + type: + extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder', + child: prevFiles ? prevFiles.child : {} + }, + Object + ) } return files } // IDEA: Modify function to remove blank input field without fetching content -const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: string, type?: 'file' | 'folder' }, deletePath?: string): { [x: string]: Record } => { - if (!payload.fileTree) return state.mode === 'browser' ? state.browser.files : state[state.mode].files +const fetchDirectoryContent = ( + state: BrowserState, + payload: {fileTree; path: string; type?: 'file' | 'folder'}, + deletePath?: string +): {[x: string]: Record} => { + if (!payload.fileTree) + return state.mode === 'browser' + ? state.browser.files + : state[state.mode].files if (state.mode === 'browser') { if (payload.path === ROOT_PATH) { let files = normalize(payload.fileTree, ROOT_PATH, payload.type) files = _.merge(files, state.browser.files[ROOT_PATH]) if (deletePath) delete files[deletePath] - return { [ROOT_PATH]: files } + return {[ROOT_PATH]: files} } else { let files = state.browser.files const _path = splitPath(state, payload.path) let prevFiles = _.get(files, _path) if (!prevFiles) { - const object = {}; let o = object + const object = {} + let o = object for (const pa of _path) { o = o[pa] = {} } @@ -804,7 +965,10 @@ const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: s } if (prevFiles) { - prevFiles.child = _.merge(normalize(payload.fileTree, payload.path, payload.type), prevFiles.child) + prevFiles.child = _.merge( + normalize(payload.fileTree, payload.path, payload.type), + prevFiles.child + ) if (deletePath) { if (deletePath.endsWith('/blank')) delete prevFiles.child[deletePath] else { @@ -814,7 +978,13 @@ const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: s } files = _.setWith(files, _path, prevFiles, Object) } else if (payload.fileTree && payload.path) { - files = { [payload.path]: normalize(payload.fileTree, payload.path, payload.type) } + files = { + [payload.path]: normalize( + payload.fileTree, + payload.path, + payload.type + ) + } } return files } @@ -823,14 +993,17 @@ const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: s let files = normalize(payload.fileTree, ROOT_PATH, payload.type) files = _.merge(files, state.localhost.files[ROOT_PATH]) if (deletePath) delete files[deletePath] - return { [ROOT_PATH]: files } + return {[ROOT_PATH]: files} } else { let files = state.localhost.files const _path = splitPath(state, payload.path) const prevFiles = _.get(files, _path) if (prevFiles) { - prevFiles.child = _.merge(normalize(payload.fileTree, payload.path, payload.type), prevFiles.child) + prevFiles.child = _.merge( + normalize(payload.fileTree, payload.path, payload.type), + prevFiles.child + ) if (deletePath) { if (deletePath.endsWith('/blank')) delete prevFiles.child[deletePath] else { @@ -840,24 +1013,37 @@ const fetchDirectoryContent = (state: BrowserState, payload: { fileTree, path: s } files = _.setWith(files, _path, prevFiles, Object) } else { - files = { [payload.path]: normalize(payload.fileTree, payload.path, payload.type) } + files = { + [payload.path]: normalize( + payload.fileTree, + payload.path, + payload.type + ) + } } return files } } } -const fetchWorkspaceDirectoryContent = (state: BrowserState, payload: { fileTree, path: string }): { [x: string]: Record } => { +const fetchWorkspaceDirectoryContent = ( + state: BrowserState, + payload: {fileTree; path: string} +): {[x: string]: Record} => { const files = normalize(payload.fileTree, ROOT_PATH) - return { [ROOT_PATH]: files } + return {[ROOT_PATH]: files} } -const normalize = (filesList, directory?: string, newInputType?: 'folder' | 'file'): Record => { +const normalize = ( + filesList, + directory?: string, + newInputType?: 'folder' | 'file' +): Record => { const folders = {} const files = {} - Object.keys(filesList || {}).forEach(key => { + Object.keys(filesList || {}).forEach((key) => { key = key.replace(/^\/|\/$/g, '') // remove first and last slash let path = key path = path.replace(/^\/|\/$/g, '') // remove first and last slash @@ -867,7 +1053,8 @@ const normalize = (filesList, directory?: string, newInputType?: 'folder' | 'fil path, name: extractNameFromKey(path), isDirectory: filesList[key].isDirectory, - type: extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder' + type: + extractNameFromKey(path).indexOf('gist-') === 0 ? 'gist' : 'folder' } } else { files[extractNameFromKey(key)] = { @@ -904,24 +1091,35 @@ const normalize = (filesList, directory?: string, newInputType?: 'folder' | 'fil const splitPath = (state: BrowserState, path: string): string[] | string => { const root = ROOT_PATH - const pathArr: string[] = (path || '').split('/').filter(value => value) + const pathArr: string[] = (path || '').split('/').filter((value) => value) if (pathArr[0] !== root) pathArr.unshift(root) - const _path = pathArr.map((key, index) => index > 1 ? ['child', key] : key).reduce((acc: string[], cur) => { - return Array.isArray(cur) ? [...acc, ...cur] : [...acc, cur] - }, []) + const _path = pathArr + .map((key, index) => (index > 1 ? ['child', key] : key)) + .reduce((acc: string[], cur) => { + return Array.isArray(cur) ? [...acc, ...cur] : [...acc, cur] + }, []) return _path } -const addContextMenuItem = (state: BrowserState, item: action): { registeredMenuItems: action[], removedMenuItems: action[], error: string } => { +const addContextMenuItem = ( + state: BrowserState, + item: action +): { + registeredMenuItems: action[] + removedMenuItems: action[] + error: string +} => { let registeredItems = state[state.mode].contextMenu.registeredMenuItems let removedItems = state[state.mode].contextMenu.removedMenuItems let error = null - if (registeredItems.filter((o) => { - return o.id === item.id && o.name === item.name - }).length) { + if ( + registeredItems.filter((o) => { + return o.id === item.id && o.name === item.name + }).length + ) { error = `Action ${item.name} already exists on ${item.id}` return { registeredMenuItems: registeredItems, @@ -930,7 +1128,7 @@ const addContextMenuItem = (state: BrowserState, item: action): { registeredMenu } } registeredItems = [...registeredItems, item] - removedItems = removedItems.filter(menuItem => item.id !== menuItem.id) + removedItems = removedItems.filter((menuItem) => item.id !== menuItem.id) return { registeredMenuItems: registeredItems, removedMenuItems: removedItems, @@ -938,7 +1136,14 @@ const addContextMenuItem = (state: BrowserState, item: action): { registeredMenu } } -const removeContextMenuItem = (state: BrowserState, plugin): { registeredMenuItems: action[], removedMenuItems: action[], error: string } => { +const removeContextMenuItem = ( + state: BrowserState, + plugin +): { + registeredMenuItems: action[] + removedMenuItems: action[] + error: string +} => { let registeredItems = state[state.mode].contextMenu.registeredMenuItems const removedItems = state[state.mode].contextMenu.removedMenuItems const error = null From e8c1c55ac9ba0d037a1b356cf89091f51ddbbb10 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 15:04:11 +0100 Subject: [PATCH 27/73] testing formatting of workspace.ts --- libs/remix-ui/workspace/src/lib/reducers/workspace.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index 66170be1d2..936ec12e4d 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -1065,6 +1065,7 @@ const normalize = ( } } }) + // do sorting here. if (newInputType === 'folder') { const path = directory + '/blank' From f0a4eaf6feb68b6232b9fb3597311614e0d04314 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 15:26:02 +0100 Subject: [PATCH 28/73] remove pretty-quick and install lint-staged --- package.json | 2 +- yarn.lock | 322 ++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 254 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index b95b547635..986cd4295a 100644 --- a/package.json +++ b/package.json @@ -322,6 +322,7 @@ "js-base64": "^2.1.9", "js-beautify": "1.6.14", "lerna": "^3.22.1", + "lint-staged": "^13.2.3", "minixhr": "^4.0.0", "mkdirp": "^0.5.1", "mocha": "^8.0.1", @@ -337,7 +338,6 @@ "nyc": "^13.3.0", "onchange": "^3.2.1", "os-browserify": "^0.3.0", - "pretty-quick": "^3.1.3", "process": "^0.11.10", "react-refresh": "^0.14.0", "react-test-renderer": "^17.0.2", diff --git a/yarn.lock b/yarn.lock index 622cfda848..acfcdec195 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5754,7 +5754,7 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10" integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA== -"@types/minimatch@*", "@types/minimatch@^3.0.3": +"@types/minimatch@*": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== @@ -7170,6 +7170,11 @@ ansi-regex@^5.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +ansi-regex@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" + integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -7194,6 +7199,11 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +ansi-styles@^6.0.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + ansi-to-html@^0.7.2: version "0.7.2" resolved "https://registry.yarnpkg.com/ansi-to-html/-/ansi-to-html-0.7.2.tgz#a92c149e4184b571eb29a0135ca001a8e2d710cb" @@ -7380,11 +7390,6 @@ array-differ@^2.0.3: resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== -array-differ@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" - integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== - array-each@^1.0.0, array-each@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" @@ -7527,11 +7532,6 @@ arrify@^1.0.1, arrify@~1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== -arrify@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" - integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== - asap@^2.0.0, asap@~2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f" @@ -7590,6 +7590,11 @@ ast-types-flow@^0.0.7: resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" integrity sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag== +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + async-done@^1.2.0, async-done@^1.2.2: version "1.3.2" resolved "https://registry.yarnpkg.com/async-done/-/async-done-1.3.2.tgz#5e15aa729962a4b07414f528a88cdf18e0b290a2" @@ -8822,7 +8827,7 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.1, braces@~3.0.2: +braces@^3.0.1, braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -9573,6 +9578,11 @@ chai@^4.3.7: pathval "^1.1.1" type-detect "^4.0.5" +chalk@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" + integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== + chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" @@ -9593,14 +9603,6 @@ chalk@^2.0.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.3.2, chalk@^2.4.1, chalk@^2.4 escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" - integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -9914,6 +9916,22 @@ cli-table@^0.3.1: dependencies: colors "1.0.3" +cli-truncate@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-2.1.0.tgz#c39e28bf05edcde5be3b98992a22deed5a2b93c7" + integrity sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg== + dependencies: + slice-ansi "^3.0.0" + string-width "^4.2.0" + +cli-truncate@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-3.1.0.tgz#3f23ab12535e3d73e839bb43e73c9de487db1389" + integrity sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA== + dependencies: + slice-ansi "^5.0.0" + string-width "^5.0.0" + cli-usage@^0.1.1: version "0.1.10" resolved "https://registry.yarnpkg.com/cli-usage/-/cli-usage-0.1.10.tgz#2c9d30a3824b48d161580a8f8d5dfe53d66b00d2" @@ -10140,6 +10158,11 @@ colorette@^2.0.10, colorette@^2.0.14: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== +colorette@^2.0.19: + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== + colors-browserify@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/colors-browserify/-/colors-browserify-0.1.1.tgz#286cc80fb00d62a1271f99045ee07d031a9acb76" @@ -10217,6 +10240,11 @@ commander@3.0.2: resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== +commander@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + commander@^2.12.1, commander@^2.15.0, commander@^2.20.0, commander@^2.20.3, commander@^2.9.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -10813,7 +10841,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -11905,6 +11933,11 @@ each-props@^1.3.2: is-plain-object "^2.0.1" object.defaults "^1.1.0" +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + ecc-jsbn@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505" @@ -12873,21 +12906,6 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a" - integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA== - dependencies: - cross-spawn "^7.0.0" - get-stream "^5.0.0" - human-signals "^1.1.1" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.0" - onetime "^5.1.0" - signal-exit "^3.0.2" - strip-final-newline "^2.0.0" - execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -12903,6 +12921,21 @@ execa@^5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +execa@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" + integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.1" + human-signals "^4.3.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^3.0.7" + strip-final-newline "^3.0.0" + execr@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/execr/-/execr-1.0.1.tgz#79865e89a940f56f72be2dd6656ffffd7f2b7c8b" @@ -14176,7 +14209,7 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" -get-stream@^5.0.0, get-stream@^5.1.0: +get-stream@^5.1.0: version "5.2.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3" integrity sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA== @@ -15292,16 +15325,16 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" -human-signals@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" - integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== - human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +human-signals@^4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" + integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== + humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" @@ -15309,7 +15342,7 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^8.0.3: +husky@^8.0.0: version "8.0.3" resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== @@ -16055,6 +16088,11 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== +is-fullwidth-code-point@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88" + integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ== + is-function@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/is-function/-/is-function-1.0.2.tgz#4f097f30abf6efadac9833b17ca5dc03f8144e08" @@ -16314,6 +16352,11 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -17712,6 +17755,11 @@ lightercollective@^0.1.0: resolved "https://registry.yarnpkg.com/lightercollective/-/lightercollective-0.1.0.tgz#70df102c530dcb8d0ccabfe6175a8d00d5f61300" integrity sha512-J9tg5uraYoQKaWbmrzDDexbG6hHnMcWS1qLYgJSWE+mpA3U5OCSeMUhb+K55otgZJ34oFdR0ECvdIb3xuO5JOQ== +lilconfig@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" + integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== + lilconfig@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.4.tgz#f4507d043d7058b380b6a8f5cb7bcd4b34cee082" @@ -17732,6 +17780,39 @@ lines-and-columns@~2.0.3: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-2.0.3.tgz#b2f0badedb556b747020ab8ea7f0373e22efac1b" integrity sha512-cNOjgCnLB+FnvWWtyRTzmB3POJ+cXxTA81LoW7u8JdmhfXzriropYwpjShnz1QLLWsQwY7nIxoDmcPTwphDK9w== +lint-staged@^13.2.3: + version "13.2.3" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.2.3.tgz#f899aad6c093473467e9c9e316e3c2d8a28f87a7" + integrity sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg== + dependencies: + chalk "5.2.0" + cli-truncate "^3.1.0" + commander "^10.0.0" + debug "^4.3.4" + execa "^7.0.0" + lilconfig "2.1.0" + listr2 "^5.0.7" + micromatch "^4.0.5" + normalize-path "^3.0.0" + object-inspect "^1.12.3" + pidtree "^0.6.0" + string-argv "^0.3.1" + yaml "^2.2.2" + +listr2@^5.0.7: + version "5.0.8" + resolved "https://registry.yarnpkg.com/listr2/-/listr2-5.0.8.tgz#a9379ffeb4bd83a68931a65fb223a11510d6ba23" + integrity sha512-mC73LitKHj9w6v30nLNGPetZIlfpUniNSsxxrbaPcWOjDb92SHPzJPi/t+v1YC/lxKz/AJ9egOjww0qUuFxBpA== + dependencies: + cli-truncate "^2.1.0" + colorette "^2.0.19" + log-update "^4.0.0" + p-map "^4.0.0" + rfdc "^1.3.0" + rxjs "^7.8.0" + through "^2.3.8" + wrap-ansi "^7.0.0" + lit-element@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.3.2.tgz#9913bf220b85065f0e5f1bb8878cc44f36b50cfa" @@ -18107,6 +18188,16 @@ log-symbols@4.1.0, log-symbols@^4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" +log-update@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1" + integrity sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg== + dependencies: + ansi-escapes "^4.3.0" + cli-cursor "^3.1.0" + slice-ansi "^4.0.0" + wrap-ansi "^6.2.0" + logform@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/logform/-/logform-2.3.0.tgz#a3997a05985de2ebd325ae0d166dffc9c6fe6b57" @@ -19016,6 +19107,14 @@ micromatch@^4.0.0, micromatch@^4.0.2, micromatch@^4.0.4: braces "^3.0.1" picomatch "^2.2.3" +micromatch@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -19056,6 +19155,11 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +mimic-fn@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" + integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== + mimic-response@^1.0.0, mimic-response@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" @@ -19479,7 +19583,7 @@ move-concurrently@^1.0.1, move-concurrently@~1.0.1: rimraf "^2.5.4" run-queue "^1.0.3" -mri@^1.1.0, mri@^1.1.5: +mri@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== @@ -19654,17 +19758,6 @@ multimatch@^3.0.0: arrify "^1.0.1" minimatch "^3.0.4" -multimatch@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3" - integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ== - dependencies: - "@types/minimatch" "^3.0.3" - array-differ "^3.0.0" - array-union "^2.1.0" - arrify "^2.0.1" - minimatch "^3.0.4" - murmurhash3js-revisited@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz#6bd36e25de8f73394222adc6e41fa3fac08a5869" @@ -20334,13 +20427,20 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" -npm-run-path@^4.0.0, npm-run-path@^4.0.1: +npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== dependencies: path-key "^3.0.0" +npm-run-path@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" + integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== + dependencies: + path-key "^4.0.0" + npm-user-validate@~0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/npm-user-validate/-/npm-user-validate-0.1.5.tgz#52465d50c2d20294a57125b996baedbf56c5004b" @@ -20646,6 +20746,11 @@ object-inspect@^1.12.2, object-inspect@^1.9.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== +object-inspect@^1.12.3: + version "1.12.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" + integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== + object-is@^1.0.1, object-is@^1.1.4: version "1.1.5" resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac" @@ -20863,6 +20968,13 @@ onetime@^5.1.0, onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" +onetime@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" + integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== + dependencies: + mimic-fn "^4.0.0" + open@^8.0.9, open@^8.4.0: version "8.4.0" resolved "https://registry.yarnpkg.com/open/-/open-8.4.0.tgz#345321ae18f8138f82565a910fdc6b39e8c244f8" @@ -21473,6 +21585,11 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== +path-key@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" + integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== + path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" @@ -21562,7 +21679,7 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== -picomatch@^2.2.2: +picomatch@^2.2.2, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -21572,6 +21689,11 @@ pidtree@^0.3.0: resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== +pidtree@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c" + integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -22165,18 +22287,6 @@ pretty-ms@^2.1.0: parse-ms "^1.0.0" plur "^1.0.0" -pretty-quick@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.1.3.tgz#15281108c0ddf446675157ca40240099157b638e" - integrity sha512-kOCi2FJabvuh1as9enxYmrnBC6tVMoVOenMaBqRfsvBHB0cbpYHjdQEpSglpASDFEXVwplpcGR4CLEaisYAFcA== - dependencies: - chalk "^3.0.0" - execa "^4.0.0" - find-up "^4.1.0" - ignore "^5.1.4" - mri "^1.1.5" - multimatch "^4.0.0" - private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -23755,6 +23865,11 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== +rfdc@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" + integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== + rgbcolor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/rgbcolor/-/rgbcolor-1.0.1.tgz#d6505ecdb304a6595da26fa4b43307306775945d" @@ -23943,6 +24058,13 @@ rxjs@^6.4.0, rxjs@^6.5.4, rxjs@^6.6.3: dependencies: tslib "^1.9.0" +rxjs@^7.8.0: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + sade@^1.7.3: version "1.8.1" resolved "https://registry.yarnpkg.com/sade/-/sade-1.8.1.tgz#0a78e81d658d394887be57d2a409bf703a3b2701" @@ -24509,6 +24631,32 @@ slash@^4.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7" integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew== +slice-ansi@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-3.0.0.tgz#31ddc10930a1b7e0b67b08c96c2f49b77a789787" + integrity sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + +slice-ansi@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a" + integrity sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ== + dependencies: + ansi-styles "^6.0.0" + is-fullwidth-code-point "^4.0.0" + slide@^1.1.3, slide@^1.1.5, slide@^1.1.6, slide@~1.1.3, slide@~1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" @@ -25065,6 +25213,11 @@ strict-uri-encode@^2.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== +string-argv@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" + integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q== + string-hash@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b" @@ -25118,6 +25271,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^5.0.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + string.prototype.matchall@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz#8e6ecb0d8a1fb1fda470d81acecb2dba057a481d" @@ -25243,6 +25405,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^7.0.1: + version "7.1.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" + integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== + dependencies: + ansi-regex "^6.0.1" + strip-bom@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e" @@ -25270,6 +25439,11 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-final-newline@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" + integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== + strip-hex-prefix@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" @@ -26129,6 +26303,11 @@ tslib@^2.0.3, tslib@^2.3.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== +tslib@^2.1.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.1.tgz#fd8c9a0ff42590b25703c0acb3de3d3f4ede0410" + integrity sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig== + tslint@~6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.0.0.tgz#1c0148beac4779924216302f192cdaa153618310" @@ -27969,6 +28148,11 @@ yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== +yaml@^2.2.2: + version "2.3.1" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" + integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== + yargs-parser@20.2.4, yargs-parser@^20.2.2: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" From 34a261aaa53280daf84352bb1e4c35ecbd825fb7 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 15:26:14 +0100 Subject: [PATCH 29/73] remove redundant script --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 0da96d6baa..14aa362cd9 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npx pretty-quick --staged +#npx pretty-quick --staged From d61a736651c2a7067bc607030042b4e18747e667 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 15:50:49 +0100 Subject: [PATCH 30/73] switched over to lint-staged --- .husky/pre-commit | 2 +- .lintstagedrc.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .lintstagedrc.json diff --git a/.husky/pre-commit b/.husky/pre-commit index 14aa362cd9..5a182ef106 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -#npx pretty-quick --staged +yarn lint-staged diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000000..2bb8f13b60 --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,3 @@ +{ + "*.{tsx,ts,js,jsx,mjs,cjs}": ["prettier --write","eslint --fix"] +} From e82887bc202706ba428bcc8f5a87174adc46797c Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 2 Aug 2023 15:52:55 +0100 Subject: [PATCH 31/73] test --- .../workspace/src/lib/reducers/workspace.ts | 983 +++++++++--------- 1 file changed, 491 insertions(+), 492 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts index 936ec12e4d..1058dfb8a4 100644 --- a/libs/remix-ui/workspace/src/lib/reducers/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/reducers/workspace.ts @@ -123,186 +123,186 @@ export const browserInitialState: BrowserState = { export const browserReducer = (state = browserInitialState, action: Action) => { switch (action.type) { - case 'SET_CURRENT_WORKSPACE': { - const payload = action.payload as { + case 'SET_CURRENT_WORKSPACE': { + const payload = action.payload as { name: string isGitRepo: boolean branches?: {remote: any; name: string}[] currentBranch?: string } - const workspaces = state.browser.workspaces.find( - ({name}) => name === payload.name - ) - ? state.browser.workspaces - : [...state.browser.workspaces, action.payload] - - return { - ...state, - browser: { - ...state.browser, - currentWorkspace: payload.name, - workspaces: workspaces.filter((workspace) => workspace) - } + const workspaces = state.browser.workspaces.find( + ({name}) => name === payload.name + ) + ? state.browser.workspaces + : [...state.browser.workspaces, action.payload] + + return { + ...state, + browser: { + ...state.browser, + currentWorkspace: payload.name, + workspaces: workspaces.filter((workspace) => workspace) } } + } - case 'SET_WORKSPACES': { - const payload = action.payload as { + case 'SET_WORKSPACES': { + const payload = action.payload as { name: string isGitRepo: boolean branches?: {remote: any; name: string}[] currentBranch?: string }[] - return { - ...state, - browser: { - ...state.browser, - workspaces: payload.filter((workspace) => workspace) - } + return { + ...state, + browser: { + ...state.browser, + workspaces: payload.filter((workspace) => workspace) } } + } - case 'SET_MODE': { - const payload = action.payload as 'browser' | 'localhost' + case 'SET_MODE': { + const payload = action.payload as 'browser' | 'localhost' - return { - ...state, - mode: payload - } + return { + ...state, + mode: payload } + } - case 'FETCH_DIRECTORY_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingDirectory: state.mode === 'browser', - isSuccessfulDirectory: false, - error: null - }, - localhost: { - ...state.localhost, - isRequestingDirectory: state.mode === 'localhost', - isSuccessfulDirectory: false, - error: null - } + case 'FETCH_DIRECTORY_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingDirectory: state.mode === 'browser', + isSuccessfulDirectory: false, + error: null + }, + localhost: { + ...state.localhost, + isRequestingDirectory: state.mode === 'localhost', + isSuccessfulDirectory: false, + error: null } } + } - case 'FETCH_DIRECTORY_SUCCESS': { - const payload = action.payload as {path: string; fileTree} + case 'FETCH_DIRECTORY_SUCCESS': { + const payload = action.payload as {path: string; fileTree} - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files, - isRequestingDirectory: false, - isSuccessfulDirectory: true, - error: null - }, - localhost: { - ...state.localhost, - files: + isRequestingDirectory: false, + isSuccessfulDirectory: true, + error: null + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files, - isRequestingDirectory: false, - isSuccessfulDirectory: true, - error: null - } + isRequestingDirectory: false, + isSuccessfulDirectory: true, + error: null } } + } - case 'FETCH_DIRECTORY_ERROR': { - return { - ...state, - browser: { - ...state.browser, - isRequestingDirectory: false, - isSuccessfulDirectory: false, - error: state.mode === 'browser' ? action.payload : null - }, - localhost: { - ...state.localhost, - isRequestingDirectory: false, - isSuccessfulDirectory: false, - error: state.mode === 'localhost' ? action.payload : null - } + case 'FETCH_DIRECTORY_ERROR': { + return { + ...state, + browser: { + ...state.browser, + isRequestingDirectory: false, + isSuccessfulDirectory: false, + error: state.mode === 'browser' ? action.payload : null + }, + localhost: { + ...state.localhost, + isRequestingDirectory: false, + isSuccessfulDirectory: false, + error: state.mode === 'localhost' ? action.payload : null } } + } - case 'FETCH_WORKSPACE_DIRECTORY_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: state.mode === 'browser', - isSuccessfulWorkspace: false, - error: null - }, - localhost: { - ...state.localhost, - isRequestingWorkspace: state.mode === 'localhost', - isSuccessfulWorkspace: false, - error: null - } + case 'FETCH_WORKSPACE_DIRECTORY_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: state.mode === 'browser', + isSuccessfulWorkspace: false, + error: null + }, + localhost: { + ...state.localhost, + isRequestingWorkspace: state.mode === 'localhost', + isSuccessfulWorkspace: false, + error: null } } + } - case 'FETCH_WORKSPACE_DIRECTORY_SUCCESS': { - const payload = action.payload as {path: string; fileTree} + case 'FETCH_WORKSPACE_DIRECTORY_SUCCESS': { + const payload = action.payload as {path: string; fileTree} - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fetchWorkspaceDirectoryContent(state, payload) : state.browser.files, - isRequestingWorkspace: false, - isSuccessfulWorkspace: true, - error: null - }, - localhost: { - ...state.localhost, - files: + isRequestingWorkspace: false, + isSuccessfulWorkspace: true, + error: null + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fetchWorkspaceDirectoryContent(state, payload) : state.localhost.files, - isRequestingWorkspace: false, - isSuccessfulWorkspace: true, - error: null, - sharedFolder: null - } + isRequestingWorkspace: false, + isSuccessfulWorkspace: true, + error: null, + sharedFolder: null } } + } - case 'FETCH_WORKSPACE_DIRECTORY_ERROR': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: false, - isSuccessfulWorkspace: false, - error: state.mode === 'browser' ? action.payload : null - }, - localhost: { - ...state.localhost, - isRequestingWorkspace: false, - isSuccessfulWorkspace: false, - error: state.mode === 'localhost' ? action.payload : null - } + case 'FETCH_WORKSPACE_DIRECTORY_ERROR': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: false, + isSuccessfulWorkspace: false, + error: state.mode === 'browser' ? action.payload : null + }, + localhost: { + ...state.localhost, + isRequestingWorkspace: false, + isSuccessfulWorkspace: false, + error: state.mode === 'localhost' ? action.payload : null } } + } - case 'DISPLAY_NOTIFICATION': { - const payload = action.payload as { + case 'DISPLAY_NOTIFICATION': { + const payload = action.payload as { title: string message: string actionOk: () => void @@ -311,554 +311,554 @@ export const browserReducer = (state = browserInitialState, action: Action) => { labelCancel: string } - return { - ...state, - notification: { - title: payload.title, - message: payload.message, - actionOk: + return { + ...state, + notification: { + title: payload.title, + message: payload.message, + actionOk: payload.actionOk || browserInitialState.notification.actionOk, - actionCancel: + actionCancel: payload.actionCancel || browserInitialState.notification.actionCancel, - labelOk: payload.labelOk, - labelCancel: payload.labelCancel - } + labelOk: payload.labelOk, + labelCancel: payload.labelCancel } } + } - case 'HIDE_NOTIFICATION': { - return { - ...state, - notification: browserInitialState.notification - } + case 'HIDE_NOTIFICATION': { + return { + ...state, + notification: browserInitialState.notification } + } - case 'FILE_ADDED_SUCCESS': { - const payload = action.payload as string + case 'FILE_ADDED_SUCCESS': { + const payload = action.payload as string - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fileAdded(state, payload) : state.browser.files, - expandPath: + expandPath: state.mode === 'browser' ? [...new Set([...state.browser.expandPath, payload])] : state.browser.expandPath - }, - localhost: { - ...state.localhost, - files: + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fileAdded(state, payload) : state.localhost.files, - expandPath: + expandPath: state.mode === 'localhost' ? [...new Set([...state.localhost.expandPath, payload])] : state.localhost.expandPath - } } } + } - case 'FOLDER_ADDED_SUCCESS': { - const payload = action.payload as { + case 'FOLDER_ADDED_SUCCESS': { + const payload = action.payload as { path: string folderPath: string fileTree } - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files, - expandPath: + expandPath: state.mode === 'browser' ? [...new Set([...state.browser.expandPath, payload.folderPath])] : state.browser.expandPath - }, - localhost: { - ...state.localhost, - files: + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files, - expandPath: + expandPath: state.mode === 'localhost' ? [ - ...new Set([ - ...state.localhost.expandPath, - payload.folderPath - ]) - ] + ...new Set([ + ...state.localhost.expandPath, + payload.folderPath + ]) + ] : state.localhost.expandPath - } } } + } - case 'FILE_REMOVED_SUCCESS': { - const payload = action.payload as string + case 'FILE_REMOVED_SUCCESS': { + const payload = action.payload as string - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fileRemoved(state, payload) : state.browser.files, - expandPath: + expandPath: state.mode === 'browser' ? [...state.browser.expandPath.filter((path) => path !== payload)] : state.browser.expandPath - }, - localhost: { - ...state.localhost, - files: + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fileRemoved(state, payload) : state.localhost.files, - expandPath: + expandPath: state.mode === 'localhost' ? [...state.browser.expandPath.filter((path) => path !== payload)] : state.localhost.expandPath - } } } + } - case 'ROOT_FOLDER_CHANGED': { - const payload = action.payload as string - return { - ...state, - localhost: { - ...state.localhost, - sharedFolder: payload, - files: {} - } + case 'ROOT_FOLDER_CHANGED': { + const payload = action.payload as string + return { + ...state, + localhost: { + ...state.localhost, + sharedFolder: payload, + files: {} } } + } - case 'ADD_INPUT_FIELD': { - const payload = action.payload as { + case 'ADD_INPUT_FIELD': { + const payload = action.payload as { path: string fileTree type: 'file' | 'folder' } - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fetchDirectoryContent(state, payload) : state.browser.files - }, - localhost: { - ...state.localhost, - files: + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload) : state.localhost.files - }, - focusEdit: payload.path + '/' + 'blank' - } + }, + focusEdit: payload.path + '/' + 'blank' } + } - case 'REMOVE_INPUT_FIELD': { - const payload = action.payload as {path: string; fileTree} + case 'REMOVE_INPUT_FIELD': { + const payload = action.payload as {path: string; fileTree} - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? removeInputField(state, payload.path) : state.browser.files - }, - localhost: { - ...state.localhost, - files: + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? removeInputField(state, payload.path) : state.localhost.files - }, - focusEdit: null - } + }, + focusEdit: null } + } - case 'SET_READ_ONLY_MODE': { - const payload = action.payload as boolean + case 'SET_READ_ONLY_MODE': { + const payload = action.payload as boolean - return { - ...state, - readonly: payload - } + return { + ...state, + readonly: payload } + } - case 'FILE_RENAMED_SUCCESS': { - const payload = action.payload as { + case 'FILE_RENAMED_SUCCESS': { + const payload = action.payload as { path: string oldPath: string fileTree } - return { - ...state, - browser: { - ...state.browser, - files: + return { + ...state, + browser: { + ...state.browser, + files: state.mode === 'browser' ? fetchDirectoryContent(state, payload, payload.oldPath) : state.browser.files - }, - localhost: { - ...state.localhost, - files: + }, + localhost: { + ...state.localhost, + files: state.mode === 'localhost' ? fetchDirectoryContent(state, payload, payload.oldPath) : state.localhost.files - } } } + } - case 'CREATE_WORKSPACE_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: true, - isSuccessfulWorkspace: false, - error: null - } + case 'CREATE_WORKSPACE_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: true, + isSuccessfulWorkspace: false, + error: null } } + } - case 'CREATE_WORKSPACE_SUCCESS': { - const payload = action.payload as { + case 'CREATE_WORKSPACE_SUCCESS': { + const payload = action.payload as { name: string isGitRepo: boolean branches?: {remote: any; name: string}[] currentBranch?: string } - const workspaces = state.browser.workspaces.find( - ({name}) => name === payload.name - ) - ? state.browser.workspaces - : [...state.browser.workspaces, action.payload] - - return { - ...state, - browser: { - ...state.browser, - currentWorkspace: payload.name, - workspaces: workspaces.filter((workspace) => workspace), - isRequestingWorkspace: false, - isSuccessfulWorkspace: true, - error: null - } + const workspaces = state.browser.workspaces.find( + ({name}) => name === payload.name + ) + ? state.browser.workspaces + : [...state.browser.workspaces, action.payload] + + return { + ...state, + browser: { + ...state.browser, + currentWorkspace: payload.name, + workspaces: workspaces.filter((workspace) => workspace), + isRequestingWorkspace: false, + isSuccessfulWorkspace: true, + error: null } } + } - case 'CREATE_WORKSPACE_ERROR': { - return { - ...state, - browser: { - ...state.browser, - isRequestingWorkspace: false, - isSuccessfulWorkspace: false, - error: action.payload - } + case 'CREATE_WORKSPACE_ERROR': { + return { + ...state, + browser: { + ...state.browser, + isRequestingWorkspace: false, + isSuccessfulWorkspace: false, + error: action.payload } } + } - case 'RENAME_WORKSPACE': { - const payload = action.payload as {oldName: string; workspaceName: string} - let renamedWorkspace - const workspaces = state.browser.workspaces.filter( - ({name, isGitRepo, branches, currentBranch}) => { - if (name && name !== payload.oldName) { - return true - } else { - renamedWorkspace = { - name: payload.workspaceName, - isGitRepo, - branches, - currentBranch - } - return false + case 'RENAME_WORKSPACE': { + const payload = action.payload as {oldName: string; workspaceName: string} + let renamedWorkspace + const workspaces = state.browser.workspaces.filter( + ({name, isGitRepo, branches, currentBranch}) => { + if (name && name !== payload.oldName) { + return true + } else { + renamedWorkspace = { + name: payload.workspaceName, + isGitRepo, + branches, + currentBranch } + return false } - ) + } + ) - return { - ...state, - browser: { - ...state.browser, - currentWorkspace: payload.workspaceName, - workspaces: [...workspaces, renamedWorkspace], - expandPath: [] - } + return { + ...state, + browser: { + ...state.browser, + currentWorkspace: payload.workspaceName, + workspaces: [...workspaces, renamedWorkspace], + expandPath: [] } } + } - case 'DELETE_WORKSPACE': { - const payload = action.payload as string - const workspaces = state.browser.workspaces.filter( - ({name}) => name && name !== payload - ) + case 'DELETE_WORKSPACE': { + const payload = action.payload as string + const workspaces = state.browser.workspaces.filter( + ({name}) => name && name !== payload + ) - return { - ...state, - browser: { - ...state.browser, - workspaces: workspaces - } + return { + ...state, + browser: { + ...state.browser, + workspaces: workspaces } } + } - case 'DISPLAY_POPUP_MESSAGE': { - const payload = action.payload as string + case 'DISPLAY_POPUP_MESSAGE': { + const payload = action.payload as string - return { - ...state, - popup: payload - } + return { + ...state, + popup: payload } + } - case 'HIDE_POPUP_MESSAGE': { - return { - ...state, - popup: '' - } + case 'HIDE_POPUP_MESSAGE': { + return { + ...state, + popup: '' } + } - case 'SET_FOCUS_ELEMENT': { - const payload = action.payload as { + case 'SET_FOCUS_ELEMENT': { + const payload = action.payload as { key: string type: 'file' | 'folder' | 'gist' }[] - return { - ...state, - focusElement: payload - } + return { + ...state, + focusElement: payload } + } - case 'REMOVE_FOCUS_ELEMENT': { - const payload: string = action.payload + case 'REMOVE_FOCUS_ELEMENT': { + const payload: string = action.payload - return { - ...state, - focusElement: state.focusElement.filter( - (element) => element.key !== payload - ) - } + return { + ...state, + focusElement: state.focusElement.filter( + (element) => element.key !== payload + ) } + } - case 'SET_CONTEXT_MENU_ITEM': { - const payload = action.payload as action - - return { - ...state, - browser: { - ...state.browser, - contextMenu: addContextMenuItem(state, payload) - }, - localhost: { - ...state.localhost, - contextMenu: addContextMenuItem(state, payload) - } + case 'SET_CONTEXT_MENU_ITEM': { + const payload = action.payload as action + + return { + ...state, + browser: { + ...state.browser, + contextMenu: addContextMenuItem(state, payload) + }, + localhost: { + ...state.localhost, + contextMenu: addContextMenuItem(state, payload) } } + } - case 'REMOVE_CONTEXT_MENU_ITEM': { - const payload = action.payload - - return { - ...state, - browser: { - ...state.browser, - contextMenu: removeContextMenuItem(state, payload) - }, - localhost: { - ...state.localhost, - contextMenu: removeContextMenuItem(state, payload) - } + case 'REMOVE_CONTEXT_MENU_ITEM': { + const payload = action.payload + + return { + ...state, + browser: { + ...state.browser, + contextMenu: removeContextMenuItem(state, payload) + }, + localhost: { + ...state.localhost, + contextMenu: removeContextMenuItem(state, payload) } } + } - case 'SET_EXPAND_PATH': { - const payload = action.payload as string[] - - return { - ...state, - browser: { - ...state.browser, - expandPath: payload - }, - localhost: { - ...state.localhost, - expandPath: payload - } + case 'SET_EXPAND_PATH': { + const payload = action.payload as string[] + + return { + ...state, + browser: { + ...state.browser, + expandPath: payload + }, + localhost: { + ...state.localhost, + expandPath: payload } } + } - case 'LOAD_LOCALHOST_REQUEST': { - return { - ...state, - localhost: { - ...state.localhost, - isRequestingLocalhost: true, - isSuccessfulLocalhost: false, - error: null - } + case 'LOAD_LOCALHOST_REQUEST': { + return { + ...state, + localhost: { + ...state.localhost, + isRequestingLocalhost: true, + isSuccessfulLocalhost: false, + error: null } } + } - case 'LOAD_LOCALHOST_SUCCESS': { - return { - ...state, - localhost: { - ...state.localhost, - isRequestingLocalhost: false, - isSuccessfulLocalhost: true, - error: null - } + case 'LOAD_LOCALHOST_SUCCESS': { + return { + ...state, + localhost: { + ...state.localhost, + isRequestingLocalhost: false, + isSuccessfulLocalhost: true, + error: null } } + } - case 'LOAD_LOCALHOST_ERROR': { - const payload = action.payload as string + case 'LOAD_LOCALHOST_ERROR': { + const payload = action.payload as string - return { - ...state, - localhost: { - ...state.localhost, - isRequestingLocalhost: false, - isSuccessfulLocalhost: false, - error: payload - } + return { + ...state, + localhost: { + ...state.localhost, + isRequestingLocalhost: false, + isSuccessfulLocalhost: false, + error: payload } } + } - case 'CLONE_REPOSITORY_REQUEST': { - return { - ...state, - browser: { - ...state.browser, - isRequestingCloning: true, - isSuccessfulCloning: false - } + case 'CLONE_REPOSITORY_REQUEST': { + return { + ...state, + browser: { + ...state.browser, + isRequestingCloning: true, + isSuccessfulCloning: false } } + } - case 'CLONE_REPOSITORY_SUCCESS': { - return { - ...state, - browser: { - ...state.browser, - isRequestingCloning: false, - isSuccessfulCloning: true - } + case 'CLONE_REPOSITORY_SUCCESS': { + return { + ...state, + browser: { + ...state.browser, + isRequestingCloning: false, + isSuccessfulCloning: true } } + } - case 'CLONE_REPOSITORY_FAILED': { - return { - ...state, - browser: { - ...state.browser, - isRequestingCloning: false, - isSuccessfulCloning: false - } + case 'CLONE_REPOSITORY_FAILED': { + return { + ...state, + browser: { + ...state.browser, + isRequestingCloning: false, + isSuccessfulCloning: false } } + } - case 'FS_INITIALIZATION_COMPLETED': { - return { - ...state, - initializingFS: false - } + case 'FS_INITIALIZATION_COMPLETED': { + return { + ...state, + initializingFS: false } + } - case 'SET_FILE_DECORATION_SUCCESS': { - return { - ...state, - browser: { - ...state.browser, - fileState: action.payload - } + case 'SET_FILE_DECORATION_SUCCESS': { + return { + ...state, + browser: { + ...state.browser, + fileState: action.payload } } + } - case 'SET_CURRENT_WORKSPACE_BRANCHES': { - const payload: {remote: any; name: string}[] = action.payload - - return { - ...state, - browser: { - ...state.browser, - workspaces: state.browser.workspaces.map((workspace) => { - if (workspace.name === state.browser.currentWorkspace) - workspace.branches = payload - return workspace - }) - } + case 'SET_CURRENT_WORKSPACE_BRANCHES': { + const payload: {remote: any; name: string}[] = action.payload + + return { + ...state, + browser: { + ...state.browser, + workspaces: state.browser.workspaces.map((workspace) => { + if (workspace.name === state.browser.currentWorkspace) + workspace.branches = payload + return workspace + }) } } + } - case 'SET_CURRENT_WORKSPACE_CURRENT_BRANCH': { - const payload: string = action.payload - - return { - ...state, - browser: { - ...state.browser, - workspaces: state.browser.workspaces.map((workspace) => { - if (workspace.name === state.browser.currentWorkspace) - workspace.currentBranch = payload - return workspace - }) - } + case 'SET_CURRENT_WORKSPACE_CURRENT_BRANCH': { + const payload: string = action.payload + + return { + ...state, + browser: { + ...state.browser, + workspaces: state.browser.workspaces.map((workspace) => { + if (workspace.name === state.browser.currentWorkspace) + workspace.currentBranch = payload + return workspace + }) } } + } - case 'SET_CURRENT_WORKSPACE_IS_GITREPO': { - const payload: boolean = action.payload - - return { - ...state, - browser: { - ...state.browser, - workspaces: state.browser.workspaces.map((workspace) => { - if (workspace.name === state.browser.currentWorkspace) - workspace.isGitRepo = payload - return workspace - }) - } + case 'SET_CURRENT_WORKSPACE_IS_GITREPO': { + const payload: boolean = action.payload + + return { + ...state, + browser: { + ...state.browser, + workspaces: state.browser.workspaces.map((workspace) => { + if (workspace.name === state.browser.currentWorkspace) + workspace.isGitRepo = payload + return workspace + }) } } + } - case 'SET_GIT_CONFIG': { - const payload: {username: string; token: string; email: string} = + case 'SET_GIT_CONFIG': { + const payload: {username: string; token: string; email: string} = action.payload - return { - ...state, - gitConfig: payload - } + return { + ...state, + gitConfig: payload } + } - default: - throw new Error() + default: + throw new Error() } } @@ -1065,7 +1065,6 @@ const normalize = ( } } }) - // do sorting here. if (newInputType === 'folder') { const path = directory + '/blank' From 84d1fc447a01eddf9325761b1f0d07990400e6b4 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Wed, 2 Aug 2023 19:38:35 +0530 Subject: [PATCH 33/73] multiple quick fix for SPDX license --- .../src/lib/providers/codeActionProvider.ts | 54 +++++++++++++------ .../editor/src/lib/providers/quickfixes.ts | 17 +++--- 2 files changed, 49 insertions(+), 22 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 8ae1291fd4..aeb7b00fc3 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -104,23 +104,45 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return - actions.push({ - title: fix.title, - diagnostics: [error], - kind: "quickfix", - edit: { - edits: [ - { - resource: model.uri, - edit: { - range: fix.range || error, - text: msg || fix.message + if (Array.isArray(fix)) { + for (const element of fix) { + actions.push({ + title: element.title, + diagnostics: [error], + kind: "quickfix", + edit: { + edits: [ + { + resource: model.uri, + edit: { + range: element.range || error, + text: msg || element.message + } + } + ] + }, + isPreferred: true + }) + } + } else + actions.push({ + title: fix.title, + diagnostics: [error], + kind: "quickfix", + edit: { + edits: [ + { + resource: model.uri, + edit: { + range: fix.range || error, + text: msg || fix.message + } } - } - ] - }, - isPreferred: true - }) + ] + }, + isPreferred: true + }) + } } diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index 5eb8777076..ec11818965 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -1,13 +1,18 @@ export default { - "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: \" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": { - "id": 1, + "Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: \" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": [{ + "id": 1.1, + "nodeType": "SourceUnit", "title": "Add open-source license", - "message": "// SPDX-License-Identifier: GPL-3.0", - "nodeType": "SourceUnit" - }, + "message": "// SPDX-License-Identifier: GPL-3.0" + },{ + "id": 1.2, + "nodeType": "SourceUnit", + "title": "Add non-open-source license", + "message": "// SPDX-License-Identifier: UNLICENSED" + }], "Warning: Source file does not specify required compiler version! Consider adding" : { "id": 2, - "title": "Add pragma line", + "title": "Add Solidity pragma", "message": "pragma solidity ^0.*.*;", "nodeType": "PragmaDirective", "range": { From 64f20ef58b6abf992e6606f44d61259985d80ae2 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 3 Aug 2023 13:19:23 +0530 Subject: [PATCH 34/73] refactoring --- .../src/lib/providers/codeActionProvider.ts | 61 +++++++------------ 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index aeb7b00fc3..d47a7d065d 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -104,45 +104,10 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return - if (Array.isArray(fix)) { - for (const element of fix) { - actions.push({ - title: element.title, - diagnostics: [error], - kind: "quickfix", - edit: { - edits: [ - { - resource: model.uri, - edit: { - range: element.range || error, - text: msg || element.message - } - } - ] - }, - isPreferred: true - }) - } - } else - actions.push({ - title: fix.title, - diagnostics: [error], - kind: "quickfix", - edit: { - edits: [ - { - resource: model.uri, - edit: { - range: fix.range || error, - text: msg || fix.message - } - } - ] - }, - isPreferred: true - }) - + if (Array.isArray(fix)) + for (const element of fix) + this.addQuickFix(actions, error, model.uri, {title: element.title, range: element.range || error, text: msg || element.message}) + else this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range || error, text: msg || fix.message}) } } @@ -151,4 +116,22 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi dispose: () => {} } } + + addQuickFix(actions, error, uri, fixDetails) { + const {title, range, text} = fixDetails + actions.push({ + title, + diagnostics: [error], + kind: "quickfix", + edit: { + edits: [ + { + resource: uri, + edit: { range, text } + } + ] + }, + isPreferred: true + }) + } } \ No newline at end of file From 88e25a4b06b513e697398d31fc03eab2a075af11 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 3 Aug 2023 14:03:13 +0530 Subject: [PATCH 35/73] more refactoring by adding method --- .../src/lib/providers/codeActionProvider.ts | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index d47a7d065d..26b1a80c03 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -34,24 +34,9 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { const paramNodes = nodeAtPosition.parameters.parameters // If method has parameters - if (paramNodes.length) { - // Get last function parameter node - const lastParamNode = paramNodes[paramNodes.length - 1] - const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) - // Get end location of last function parameter, it returns end column of parameter name - const lastParamEndLoc = location.end - const lineContent = model.getLineContent(lastParamEndLoc.line + 1) - if (fix.id === 5 && lineContent.includes(' view ')) { - msg = lineContent.replace('view', 'pure') - } else - msg = lineContent.substring(0, lastParamEndLoc.column + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + 1, lineContent.length) - fix.range = { - startLineNumber: lastParamEndLoc.line + 1, - endLineNumber: lastParamEndLoc.line + 1, - startColumn: 0, - endColumn: error.startColumn + msg.length - } - } else { + if (paramNodes.length) + msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, true) + else { // If method has no parameters const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) const lineContent = model.getLineContent(location.start.line + 1) @@ -70,23 +55,9 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } else { const paramNodes = nodeAtPosition.parameters // If method has parameters - if (paramNodes.length) { - // Get last function parameter node - const lastParamNode = paramNodes[paramNodes.length - 1] - // Get end location of last function parameter, it returns start column of parameter name - const lastParamEndLoc = lastParamNode.loc.end - const lineContent = model.getLineContent(lastParamEndLoc.line) - if (fix.id === 5 && lineContent.includes(' view ')) { - msg = lineContent.replace('view', 'pure') - } else - msg = lineContent.substring(0, lastParamEndLoc.column + lastParamNode.name.length + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + lastParamNode.name.length + 1, lineContent.length) - fix.range = { - startLineNumber: lastParamEndLoc.line, - endLineNumber: lastParamEndLoc.line, - startColumn: 0, - endColumn: error.startColumn + msg.length - } - } else { + if (paramNodes.length) + msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, false) + else { const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) const i = lineContent.indexOf('()') if (fix.id === 5 && lineContent.includes(' view ')) { @@ -103,7 +74,6 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return - if (Array.isArray(fix)) for (const element of fix) this.addQuickFix(actions, error, model.uri, {title: element.title, range: element.range || error, text: msg || element.message}) @@ -134,4 +104,35 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi isPreferred: true }) } + + async fnWithParamsQFMsg(model, paramNodes, fix, error, isOldAST) { + // Get last function parameter node + const lastParamNode = paramNodes[paramNodes.length - 1] + let lastParamEndLoc, fixLineNumber, msg + if (isOldAST) { + const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) + // Get end location of last function parameter, it returns end column of parameter name + lastParamEndLoc = location.end + fixLineNumber = lastParamEndLoc.line + 1 + } else { + // Get end location of last function parameter, it returns start column of parameter name + lastParamEndLoc = lastParamNode.loc.end + fixLineNumber = lastParamEndLoc.line + } + const lineContent = model.getLineContent(fixLineNumber) + if (fix.id === 5 && lineContent.includes(' view ')) + msg = lineContent.replace('view', 'pure') + else if (isOldAST) + msg = lineContent.substring(0, lastParamEndLoc.column + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + 1, lineContent.length) + else + msg = lineContent.substring(0, lastParamEndLoc.column + lastParamNode.name.length + 2) + fix.message + lineContent.substring(lastParamEndLoc.column + lastParamNode.name.length + 1, lineContent.length) + + fix.range = { + startLineNumber: fixLineNumber, + endLineNumber: fixLineNumber, + startColumn: 0, + endColumn: error.startColumn + msg.length + } + return msg + } } \ No newline at end of file From 448ffe088f9fa643b30021760df41f68141f41cc Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 3 Aug 2023 19:42:24 +0530 Subject: [PATCH 36/73] mode refactoring --- .../src/lib/providers/codeActionProvider.ts | 66 ++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 26b1a80c03..e7621716f3 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -2,7 +2,6 @@ import { Monaco } from "@monaco-editor/react" import monaco from "../../types/monaco" import { EditorUIProps } from "../remix-ui-editor" import { default as fixes } from "./quickfixes" -import { monacoTypes } from "@remix-ui/editor" export class RemixCodeActionProvider implements monaco.languages.CodeActionProvider { props: EditorUIProps @@ -34,44 +33,13 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { const paramNodes = nodeAtPosition.parameters.parameters // If method has parameters - if (paramNodes.length) - msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, true) - else { - // If method has no parameters - const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) - const lineContent = model.getLineContent(location.start.line + 1) - const i = lineContent.indexOf('()') - if (fix.id === 5 && lineContent.includes(' view ')) { - msg = lineContent.replace('view', 'pure') - } else - msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) - fix.range = { - startLineNumber: location.start.line + 1, - endLineNumber: location.start.line + 1, - startColumn: 0, - endColumn: error.startColumn + msg.length - } - } + if (paramNodes.length) msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, true) + else msg = await this.fnWithoutParamsQFMsg(model, nodeAtPosition, fix, error, true) } else { const paramNodes = nodeAtPosition.parameters // If method has parameters - if (paramNodes.length) - msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, false) - else { - const lineContent = model.getLineContent(nodeAtPosition.loc.start.line) - const i = lineContent.indexOf('()') - if (fix.id === 5 && lineContent.includes(' view ')) { - msg = lineContent.replace('view', 'pure') - } else - msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) - fix.range = { - startLineNumber: nodeAtPosition.loc.start.line, - endLineNumber: nodeAtPosition.loc.start.line, - startColumn: 0, - endColumn: error.startColumn + msg.length - } - } - + if (paramNodes.length) msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, false) + else msg = await this.fnWithoutParamsQFMsg(model, nodeAtPosition, fix, error, false) } } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return if (Array.isArray(fix)) @@ -106,9 +74,9 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } async fnWithParamsQFMsg(model, paramNodes, fix, error, isOldAST) { + let lastParamEndLoc, fixLineNumber, msg // Get last function parameter node const lastParamNode = paramNodes[paramNodes.length - 1] - let lastParamEndLoc, fixLineNumber, msg if (isOldAST) { const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) // Get end location of last function parameter, it returns end column of parameter name @@ -135,4 +103,28 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } return msg } + + async fnWithoutParamsQFMsg(model, nodeAtPosition, fix, error, isOldAST) { + let fixLineNumber, msg + if (isOldAST) { + const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) + fixLineNumber = location.start.line + 1 + } else fixLineNumber = nodeAtPosition.loc.start.line + + const lineContent = model.getLineContent(fixLineNumber) + const i = lineContent.indexOf('()') + + if (fix.id === 5 && lineContent.includes(' view ')) { + msg = lineContent.replace('view', 'pure') + } else + msg = lineContent.substring(0, i + 3) + fix.message + lineContent.substring(i + 3, lineContent.length) + + fix.range = { + startLineNumber: fixLineNumber, + endLineNumber: fixLineNumber, + startColumn: 0, + endColumn: error.startColumn + msg.length + } + return msg + } } \ No newline at end of file From 596db380669a9a83b9e4181d29b71a34bf37b1a9 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 7 Aug 2023 13:10:25 +0530 Subject: [PATCH 37/73] method doc --- .../src/lib/providers/codeActionProvider.ts | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index e7621716f3..fec71b9114 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -33,13 +33,13 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { const paramNodes = nodeAtPosition.parameters.parameters // If method has parameters - if (paramNodes.length) msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, true) - else msg = await this.fnWithoutParamsQFMsg(model, nodeAtPosition, fix, error, true) + if (paramNodes.length) msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, true) + else msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, true) } else { const paramNodes = nodeAtPosition.parameters // If method has parameters - if (paramNodes.length) msg = await this.fnWithParamsQFMsg(model, paramNodes, fix, error, false) - else msg = await this.fnWithoutParamsQFMsg(model, nodeAtPosition, fix, error, false) + if (paramNodes.length) msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, false) + else msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, false) } } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return if (Array.isArray(fix)) @@ -55,8 +55,15 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } - addQuickFix(actions, error, uri, fixDetails) { - const {title, range, text} = fixDetails + /** + * Add quick fix to code actions + * @param actions code actions array + * @param error editor error object + * @param uri model URI + * @param fix details of quick fix to apply + */ + addQuickFix(actions, error, uri, fix) { + const {title, range, text} = fix actions.push({ title, diagnostics: [error], @@ -73,7 +80,16 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi }) } - async fnWithParamsQFMsg(model, paramNodes, fix, error, isOldAST) { + /** + * Returns message for various quick fixes related to a method with parameters + * @param model Model + * @param paramNodes function parameters AST nodes + * @param fix details of quick fix to apply + * @param error editor error object + * @param isOldAST true, if AST node contains legacy fields + * @returns message to be placed as quick fix + */ + async fixForMethodWithParams(model, paramNodes, fix, error, isOldAST): Promise { let lastParamEndLoc, fixLineNumber, msg // Get last function parameter node const lastParamNode = paramNodes[paramNodes.length - 1] @@ -104,7 +120,16 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi return msg } - async fnWithoutParamsQFMsg(model, nodeAtPosition, fix, error, isOldAST) { + /** + * Returns message for various quick fixes related to a method without parameters + * @param model Model + * @param paramNodes function parameters AST nodes + * @param fix details of quick fix to apply + * @param error editor error object + * @param isOldAST true, if AST node contains legacy fields + * @returns message to be placed as quick fix + */ + async fixForMethodWithoutParams(model, nodeAtPosition, fix, error, isOldAST): Promise { let fixLineNumber, msg if (isOldAST) { const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) From d4659c01877013310d58ff255e1102b604784ecf Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 7 Aug 2023 13:57:07 +0530 Subject: [PATCH 38/73] typings --- .../src/lib/providers/codeActionProvider.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index fec71b9114..b2a0bc727d 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -16,16 +16,16 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi range: monaco.Range /**Range*/, context: monaco.languages.CodeActionContext /**CodeActionContext*/, token: monaco.CancellationToken /**CancellationToken*/ - ) { - const actions = [] + ): Promise { + const actions: monaco.languages.CodeAction[] = [] for (const error of context.markers) { - let fix - let msg - const errStrings = Object.keys(fixes) - const errStr = errStrings.find(es => error.message.includes(es)) + let fix: Record + let msg: string + const errStrings: string[] = Object.keys(fixes) + const errStr:string = errStrings.find(es => error.message.includes(es)) if (errStr) { fix = fixes[errStr] - const cursorPosition = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) + const cursorPosition: number = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) // Check if a function is hovered if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { @@ -62,7 +62,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi * @param uri model URI * @param fix details of quick fix to apply */ - addQuickFix(actions, error, uri, fix) { + addQuickFix(actions: monaco.languages.CodeAction[], error: monaco.editor.IMarkerData, uri: monaco.Uri, fix: Record) { const {title, range, text} = fix actions.push({ title, @@ -89,12 +89,12 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi * @param isOldAST true, if AST node contains legacy fields * @returns message to be placed as quick fix */ - async fixForMethodWithParams(model, paramNodes, fix, error, isOldAST): Promise { - let lastParamEndLoc, fixLineNumber, msg + async fixForMethodWithParams(model: monaco.editor.ITextModel, paramNodes: Record[], fix: Record, error: monaco.editor.IMarkerData, isOldAST: boolean): Promise { + let lastParamEndLoc: Record, fixLineNumber: number, msg: string // Get last function parameter node - const lastParamNode = paramNodes[paramNodes.length - 1] + const lastParamNode: Record = paramNodes[paramNodes.length - 1] if (isOldAST) { - const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) + const location: Record = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', lastParamNode) // Get end location of last function parameter, it returns end column of parameter name lastParamEndLoc = location.end fixLineNumber = lastParamEndLoc.line + 1 @@ -103,7 +103,7 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi lastParamEndLoc = lastParamNode.loc.end fixLineNumber = lastParamEndLoc.line } - const lineContent = model.getLineContent(fixLineNumber) + const lineContent: string = model.getLineContent(fixLineNumber) if (fix.id === 5 && lineContent.includes(' view ')) msg = lineContent.replace('view', 'pure') else if (isOldAST) @@ -129,15 +129,15 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi * @param isOldAST true, if AST node contains legacy fields * @returns message to be placed as quick fix */ - async fixForMethodWithoutParams(model, nodeAtPosition, fix, error, isOldAST): Promise { - let fixLineNumber, msg + async fixForMethodWithoutParams(model: monaco.editor.ITextModel, nodeAtPosition: Record, fix: Record, error: monaco.editor.IMarkerData, isOldAST: boolean): Promise { + let fixLineNumber: number, msg: string if (isOldAST) { - const location = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) + const location: Record = await this.props.plugin.call('codeParser', 'getLineColumnOfNode', nodeAtPosition) fixLineNumber = location.start.line + 1 } else fixLineNumber = nodeAtPosition.loc.start.line - const lineContent = model.getLineContent(fixLineNumber) - const i = lineContent.indexOf('()') + const lineContent: string = model.getLineContent(fixLineNumber) + const i: number = lineContent.indexOf('()') if (fix.id === 5 && lineContent.includes(' view ')) { msg = lineContent.replace('view', 'pure') From dfb40243b274f047330ff5c72a4b70695e907d86 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 7 Aug 2023 11:46:34 +0200 Subject: [PATCH 39/73] fix stringify the memory (from Uint8Array to hex string) --- libs/remix-debug/src/trace/traceCache.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/remix-debug/src/trace/traceCache.ts b/libs/remix-debug/src/trace/traceCache.ts index 7c6f115277..2df82cf20c 100644 --- a/libs/remix-debug/src/trace/traceCache.ts +++ b/libs/remix-debug/src/trace/traceCache.ts @@ -106,7 +106,8 @@ export class TraceCache { const stack = trace[index].stack const offset = 2 * parseInt(toHexPaddedString(stack[stack.length - 2]), 16) const size = 2 * parseInt(toHexPaddedString(stack[stack.length - 3]), 16) - this.contractCreation[token] = '0x' + memory.join('').substr(offset, size) + const memoryHex = Buffer.from(memory).toString('hex') + this.contractCreation[token] = '0x' + memoryHex.substr(offset, size) } pushContractCreation (token, code) { From 51cc8e136ff4873e89244c13ed9cbf8e7d4eeae0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 7 Aug 2023 11:55:12 +0200 Subject: [PATCH 40/73] fix comparing bytecode --- libs/remix-lib/src/util.ts | 10 +++++++--- libs/remix-lib/test/util.ts | 10 ++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libs/remix-lib/src/util.ts b/libs/remix-lib/src/util.ts index 74317dee97..98a3640cbb 100644 --- a/libs/remix-lib/src/util.ts +++ b/libs/remix-lib/src/util.ts @@ -190,7 +190,7 @@ export function swarmHashExtractionPOC32 () { * @return {RegEx} */ export function cborEncodedValueExtraction () { - return /64697066735822([0-9a-f]{68})64736f6c6343([0-9a-f]{6})0033$/ + return /64697066735822[0-9a-f]{68}64736f6c6343([0-9a-f]{6})0033$/ } /** @@ -203,7 +203,9 @@ export function inputParametersExtraction () { } export function extractcborMetadata (value) { - return value.replace(cborEncodedValueExtraction(), '') + const cbor = value.match(cborEncodedValueExtraction()) + if (cbor && cbor[1]) value = value.replace(cbor[1], '') + return value } export function extractSwarmHash (value) { @@ -214,7 +216,9 @@ export function extractSwarmHash (value) { } export function extractinputParameters (value) { - return value.replace(inputParametersExtraction(), '') + const inputsParam = getinputParameters(value) + if (inputsParam) value = value.replace(inputsParam, '') + return value } export function getinputParameters (value) { diff --git a/libs/remix-lib/test/util.ts b/libs/remix-lib/test/util.ts index 2f4b63926a..413710f0a9 100644 --- a/libs/remix-lib/test/util.ts +++ b/libs/remix-lib/test/util.ts @@ -113,6 +113,16 @@ const uniswapQuote2 = `0x608060405234801561001057600080fd5b506004361061007d57600 const uniswapQuote1 = `0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063c45a01551161005b578063c45a0155146100d3578063cdca1753146100db578063f7729d43146100ee578063fa461e33146101015761007d565b80632f80bb1d1461008257806330d07f21146100ab5780634aa4a4fc146100be575b600080fd5b610095610090366004610e9e565b610116565b6040516100a29190611148565b60405180910390f35b6100956100b9366004610e30565b61017b565b6100c6610340565b6040516100a29190611084565b6100c6610364565b6100956100e9366004610e9e565b610388565b6100956100fc366004610e30565b6103d6565b61011461010f366004610f04565b610555565b005b60005b600061012484610660565b9050600080600061013487610668565b92509250925061014882848389600061017b565b955083156101605761015987610699565b965061016c565b85945050505050610175565b50505050610119565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff808616878216109083166101a65760008490555b6101b18787876106ce565b73ffffffffffffffffffffffffffffffffffffffff1663128acb0830836101d78861070c565b60000373ffffffffffffffffffffffffffffffffffffffff8816156101fc5787610222565b8561021b5773fffd8963efd1fc6a506488495d951d5263988d25610222565b6401000276a45b8b8b8e6040516020016102379392919061101e565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016102669594939291906110a5565b6040805180830381600087803b15801561027f57600080fd5b505af19250505080156102cd575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526102ca91810190610ee1565b60015b610333573d8080156102fb576040519150601f19603f3d011682016040523d82523d6000602084013e610300565b606091505b5073ffffffffffffffffffffffffffffffffffffffff841661032157600080555b61032a8161073e565b92505050610337565b5050505b95945050505050565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f98481565b60005b600061039684610660565b905060008060006103a687610668565b9250925092506103ba8383838960006103d6565b95508315610160576103cb87610699565b96505050505061038b565b600073ffffffffffffffffffffffffffffffffffffffff808616908716106103ff8787876106ce565b73ffffffffffffffffffffffffffffffffffffffff1663128acb0830836104258861070c565b73ffffffffffffffffffffffffffffffffffffffff881615610447578761046d565b856104665773fffd8963efd1fc6a506488495d951d5263988d2561046d565b6401000276a45b8c8b8d6040516020016104829392919061101e565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016104b19594939291906110a5565b6040805180830381600087803b1580156104ca57600080fd5b505af1925050508015610518575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261051591810190610ee1565b60015b610333573d808015610546576040519150601f19603f3d011682016040523d82523d6000602084013e61054b565b606091505b5061032a8161073e565b60008313806105645750600082135b61056d57600080fd5b600080600061057b84610668565b9250925092506105ad7f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9848484846107ef565b5060008060008089136105f3578573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610888a600003610628565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161089896000035b925092509250821561063f57604051818152602081fd5b6000541561065557600054811461065557600080fd5b604051828152602081fd5b516042111590565b600080806106768482610805565b9250610683846014610905565b9050610690846017610805565b91509193909250565b80516060906101759083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9016109f5565b60006107047f0000000000000000000000001f98431c8ad98523631ae4a59f267346ea31f9846106ff868686610bdc565b610c59565b949350505050565b60007f8000000000000000000000000000000000000000000000000000000000000000821061073a57600080fd5b5090565b600081516020146107db5760448251101561078e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078590611111565b60405180910390fd5b600482019150818060200190518101906107a89190610f52565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078591906110f7565b818060200190518101906101759190610fbc565b600061033785610800868686610bdc565b610d8f565b60008182601401101561087957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b81601401835110156108ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60008182600301101561097957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b81600301835110156109ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b60608182601f011015610a6957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015610ada57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b81830184511015610b4c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b606082158015610b6b5760405191506000825260208201604052610bd3565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015610ba4578051835260209283019201610b8c565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b610be4610dbf565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115610c1c579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1610610c9b57600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b6000610d9b8383610c59565b90503373ffffffffffffffffffffffffffffffffffffffff82161461017557600080fd5b604080516060810182526000808252602082018190529181019190915290565b600082601f830112610def578081fd5b8135610e02610dfd82611175565b611151565b818152846020838601011115610e16578283fd5b816020850160208301379081016020019190915292915050565b600080600080600060a08688031215610e47578081fd5b8535610e52816111e5565b94506020860135610e62816111e5565b9350604086013562ffffff81168114610e79578182fd5b9250606086013591506080860135610e90816111e5565b809150509295509295909350565b60008060408385031215610eb0578182fd5b823567ffffffffffffffff811115610ec6578283fd5b610ed285828601610ddf565b95602094909401359450505050565b60008060408385031215610ef3578182fd5b505080516020909101519092909150565b600080600060608486031215610f18578283fd5b8335925060208401359150604084013567ffffffffffffffff811115610f3c578182fd5b610f4886828701610ddf565b9150509250925092565b600060208284031215610f63578081fd5b815167ffffffffffffffff811115610f79578182fd5b8201601f81018413610f89578182fd5b8051610f97610dfd82611175565b818152856020838501011115610fab578384fd5b6103378260208301602086016111b5565b600060208284031215610fcd578081fd5b5051919050565b60008151808452610fec8160208601602086016111b5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a060808301526110ec60a0830184610fd4565b979650505050505050565b60006020825261110a6020830184610fd4565b9392505050565b60208082526010908201527f556e6578706563746564206572726f7200000000000000000000000000000000604082015260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561116d57fe5b604052919050565b600067ffffffffffffffff82111561118957fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b838110156111d05781810151838201526020016111b8565b838111156111df576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461120757600080fd5b5056fea164736f6c6343000706000a` +tape('util.compareByteCode which have input parameters', function (t) { + t.plan(1) + t.ok(util.compareByteCode(contractWithParameters, contractWithoutParameters), 'same contract but different parameters should still match "comparebytecode"') +}) + +const contractWithParameters = `0x608060405234801562000010575f80fd5b5060405162001756380380620017568339818101604052810190620000369190620001e7565b8160039081620000479190620004a1565b508060049081620000599190620004a1565b50505062000585565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620000c3826200007b565b810181811067ffffffffffffffff82111715620000e557620000e46200008b565b5b80604052505050565b5f620000f962000062565b9050620001078282620000b8565b919050565b5f67ffffffffffffffff8211156200012957620001286200008b565b5b62000134826200007b565b9050602081019050919050565b5f5b838110156200016057808201518184015260208101905062000143565b5f8484015250505050565b5f620001816200017b846200010c565b620000ee565b905082815260208101848484011115620001a0576200019f62000077565b5b620001ad84828562000141565b509392505050565b5f82601f830112620001cc57620001cb62000073565b5b8151620001de8482602086016200016b565b91505092915050565b5f80604083850312156200020057620001ff6200006b565b5b5f83015167ffffffffffffffff81111562000220576200021f6200006f565b5b6200022e85828601620001b5565b925050602083015167ffffffffffffffff8111156200025257620002516200006f565b5b6200026085828601620001b5565b9150509250929050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620002b957607f821691505b602082108103620002cf57620002ce62000274565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002f6565b6200033f8683620002f6565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f62000389620003836200037d8462000357565b62000360565b62000357565b9050919050565b5f819050919050565b620003a48362000369565b620003bc620003b38262000390565b84845462000302565b825550505050565b5f90565b620003d2620003c4565b620003df81848462000399565b505050565b5b818110156200040657620003fa5f82620003c8565b600181019050620003e5565b5050565b601f82111562000455576200041f81620002d5565b6200042a84620002e7565b810160208510156200043a578190505b620004526200044985620002e7565b830182620003e4565b50505b505050565b5f82821c905092915050565b5f620004775f19846008026200045a565b1980831691505092915050565b5f62000491838362000466565b9150826002028217905092915050565b620004ac826200026a565b67ffffffffffffffff811115620004c857620004c76200008b565b5b620004d48254620002a1565b620004e18282856200040a565b5f60209050601f83116001811462000517575f841562000502578287015190505b6200050e858262000484565b8655506200057d565b601f1984166200052786620002d5565b5f5b82811015620005505784890151825560018201915060208501945060208101905062000529565b868310156200057057848901516200056c601f89168262000466565b8355505b6001600288020188555050505b505050505050565b6111c380620005935f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c8063395093511161006f578063395093511461016557806370a082311461019557806395d89b41146101c5578063a457c2d7146101e3578063a9059cbb14610213578063dd62ed3e14610243576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b3610273565b6040516100c09190610add565b60405180910390f35b6100e360048036038101906100de9190610b8e565b610303565b6040516100f09190610be6565b60405180910390f35b610101610325565b60405161010e9190610c0e565b60405180910390f35b610131600480360381019061012c9190610c27565b61032e565b60405161013e9190610be6565b60405180910390f35b61014f61035c565b60405161015c9190610c92565b60405180910390f35b61017f600480360381019061017a9190610b8e565b610364565b60405161018c9190610be6565b60405180910390f35b6101af60048036038101906101aa9190610cab565b61039a565b6040516101bc9190610c0e565b60405180910390f35b6101cd6103df565b6040516101da9190610add565b60405180910390f35b6101fd60048036038101906101f89190610b8e565b61046f565b60405161020a9190610be6565b60405180910390f35b61022d60048036038101906102289190610b8e565b6104e4565b60405161023a9190610be6565b60405180910390f35b61025d60048036038101906102589190610cd6565b610506565b60405161026a9190610c0e565b60405180910390f35b60606003805461028290610d41565b80601f01602080910402602001604051908101604052809291908181526020018280546102ae90610d41565b80156102f95780601f106102d0576101008083540402835291602001916102f9565b820191905f5260205f20905b8154815290600101906020018083116102dc57829003601f168201915b5050505050905090565b5f8061030d610588565b905061031a81858561058f565b600191505092915050565b5f600254905090565b5f80610338610588565b9050610345858285610752565b6103508585856107dd565b60019150509392505050565b5f6012905090565b5f8061036e610588565b905061038f8185856103808589610506565b61038a9190610d9e565b61058f565b600191505092915050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6060600480546103ee90610d41565b80601f016020809104026020016040519081016040528092919081815260200182805461041a90610d41565b80156104655780601f1061043c57610100808354040283529160200191610465565b820191905f5260205f20905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b5f80610479610588565b90505f6104868286610506565b9050838110156104cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c290610e41565b60405180910390fd5b6104d8828686840361058f565b60019250505092915050565b5f806104ee610588565b90506104fb8185856107dd565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f490610ecf565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361066b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066290610f5d565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107459190610c0e565b60405180910390a3505050565b5f61075d8484610506565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d757818110156107c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c090610fc5565b60405180910390fd5b6107d6848484840361058f565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084290611053565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b0906110e1565b60405180910390fd5b6108c4838383610a49565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093e9061116f565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550815f808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a309190610c0e565b60405180910390a3610a43848484610a4e565b50505050565b505050565b505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a8a578082015181840152602081019050610a6f565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610aaf82610a53565b610ab98185610a5d565b9350610ac9818560208601610a6d565b610ad281610a95565b840191505092915050565b5f6020820190508181035f830152610af58184610aa5565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610b2a82610b01565b9050919050565b610b3a81610b20565b8114610b44575f80fd5b50565b5f81359050610b5581610b31565b92915050565b5f819050919050565b610b6d81610b5b565b8114610b77575f80fd5b50565b5f81359050610b8881610b64565b92915050565b5f8060408385031215610ba457610ba3610afd565b5b5f610bb185828601610b47565b9250506020610bc285828601610b7a565b9150509250929050565b5f8115159050919050565b610be081610bcc565b82525050565b5f602082019050610bf95f830184610bd7565b92915050565b610c0881610b5b565b82525050565b5f602082019050610c215f830184610bff565b92915050565b5f805f60608486031215610c3e57610c3d610afd565b5b5f610c4b86828701610b47565b9350506020610c5c86828701610b47565b9250506040610c6d86828701610b7a565b9150509250925092565b5f60ff82169050919050565b610c8c81610c77565b82525050565b5f602082019050610ca55f830184610c83565b92915050565b5f60208284031215610cc057610cbf610afd565b5b5f610ccd84828501610b47565b91505092915050565b5f8060408385031215610cec57610ceb610afd565b5b5f610cf985828601610b47565b9250506020610d0a85828601610b47565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610d5857607f821691505b602082108103610d6b57610d6a610d14565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610da882610b5b565b9150610db383610b5b565b9250828201905080821115610dcb57610dca610d71565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f775f8201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b5f610e2b602583610a5d565b9150610e3682610dd1565b604082019050919050565b5f6020820190508181035f830152610e5881610e1f565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f610eb9602483610a5d565b9150610ec482610e5f565b604082019050919050565b5f6020820190508181035f830152610ee681610ead565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f610f47602283610a5d565b9150610f5282610eed565b604082019050919050565b5f6020820190508181035f830152610f7481610f3b565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000005f82015250565b5f610faf601d83610a5d565b9150610fba82610f7b565b602082019050919050565b5f6020820190508181035f830152610fdc81610fa3565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61103d602583610a5d565b915061104882610fe3565b604082019050919050565b5f6020820190508181035f83015261106a81611031565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6110cb602383610a5d565b91506110d682611071565b604082019050919050565b5f6020820190508181035f8301526110f8816110bf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e74206578636565647320625f8201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b5f611159602683610a5d565b9150611164826110ff565b604082019050919050565b5f6020820190508181035f8301526111868161114d565b905091905056fea264697066735822122068e7088e2020b3a92aeb07338de801db3c8164bac57255e32c1c6a6614fdeabe64736f6c63430008150033000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017900000000000000000000000000000000000000000000000000000000000000` + +const contractWithoutParameters = `0x608060405234801562000010575f80fd5b5060405162001756380380620017568339818101604052810190620000369190620001e7565b8160039081620000479190620004a1565b508060049081620000599190620004a1565b50505062000585565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620000c3826200007b565b810181811067ffffffffffffffff82111715620000e557620000e46200008b565b5b80604052505050565b5f620000f962000062565b9050620001078282620000b8565b919050565b5f67ffffffffffffffff8211156200012957620001286200008b565b5b62000134826200007b565b9050602081019050919050565b5f5b838110156200016057808201518184015260208101905062000143565b5f8484015250505050565b5f620001816200017b846200010c565b620000ee565b905082815260208101848484011115620001a0576200019f62000077565b5b620001ad84828562000141565b509392505050565b5f82601f830112620001cc57620001cb62000073565b5b8151620001de8482602086016200016b565b91505092915050565b5f80604083850312156200020057620001ff6200006b565b5b5f83015167ffffffffffffffff81111562000220576200021f6200006f565b5b6200022e85828601620001b5565b925050602083015167ffffffffffffffff8111156200025257620002516200006f565b5b6200026085828601620001b5565b9150509250929050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620002b957607f821691505b602082108103620002cf57620002ce62000274565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002f6565b6200033f8683620002f6565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f62000389620003836200037d8462000357565b62000360565b62000357565b9050919050565b5f819050919050565b620003a48362000369565b620003bc620003b38262000390565b84845462000302565b825550505050565b5f90565b620003d2620003c4565b620003df81848462000399565b505050565b5b818110156200040657620003fa5f82620003c8565b600181019050620003e5565b5050565b601f82111562000455576200041f81620002d5565b6200042a84620002e7565b810160208510156200043a578190505b620004526200044985620002e7565b830182620003e4565b50505b505050565b5f82821c905092915050565b5f620004775f19846008026200045a565b1980831691505092915050565b5f62000491838362000466565b9150826002028217905092915050565b620004ac826200026a565b67ffffffffffffffff811115620004c857620004c76200008b565b5b620004d48254620002a1565b620004e18282856200040a565b5f60209050601f83116001811462000517575f841562000502578287015190505b6200050e858262000484565b8655506200057d565b601f1984166200052786620002d5565b5f5b82811015620005505784890151825560018201915060208501945060208101905062000529565b868310156200057057848901516200056c601f89168262000466565b8355505b6001600288020188555050505b505050505050565b6111c380620005935f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c8063395093511161006f578063395093511461016557806370a082311461019557806395d89b41146101c5578063a457c2d7146101e3578063a9059cbb14610213578063dd62ed3e14610243576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b3610273565b6040516100c09190610add565b60405180910390f35b6100e360048036038101906100de9190610b8e565b610303565b6040516100f09190610be6565b60405180910390f35b610101610325565b60405161010e9190610c0e565b60405180910390f35b610131600480360381019061012c9190610c27565b61032e565b60405161013e9190610be6565b60405180910390f35b61014f61035c565b60405161015c9190610c92565b60405180910390f35b61017f600480360381019061017a9190610b8e565b610364565b60405161018c9190610be6565b60405180910390f35b6101af60048036038101906101aa9190610cab565b61039a565b6040516101bc9190610c0e565b60405180910390f35b6101cd6103df565b6040516101da9190610add565b60405180910390f35b6101fd60048036038101906101f89190610b8e565b61046f565b60405161020a9190610be6565b60405180910390f35b61022d60048036038101906102289190610b8e565b6104e4565b60405161023a9190610be6565b60405180910390f35b61025d60048036038101906102589190610cd6565b610506565b60405161026a9190610c0e565b60405180910390f35b60606003805461028290610d41565b80601f01602080910402602001604051908101604052809291908181526020018280546102ae90610d41565b80156102f95780601f106102d0576101008083540402835291602001916102f9565b820191905f5260205f20905b8154815290600101906020018083116102dc57829003601f168201915b5050505050905090565b5f8061030d610588565b905061031a81858561058f565b600191505092915050565b5f600254905090565b5f80610338610588565b9050610345858285610752565b6103508585856107dd565b60019150509392505050565b5f6012905090565b5f8061036e610588565b905061038f8185856103808589610506565b61038a9190610d9e565b61058f565b600191505092915050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6060600480546103ee90610d41565b80601f016020809104026020016040519081016040528092919081815260200182805461041a90610d41565b80156104655780601f1061043c57610100808354040283529160200191610465565b820191905f5260205f20905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b5f80610479610588565b90505f6104868286610506565b9050838110156104cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c290610e41565b60405180910390fd5b6104d8828686840361058f565b60019250505092915050565b5f806104ee610588565b90506104fb8185856107dd565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f490610ecf565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361066b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066290610f5d565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107459190610c0e565b60405180910390a3505050565b5f61075d8484610506565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d757818110156107c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c090610fc5565b60405180910390fd5b6107d6848484840361058f565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084290611053565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b0906110e1565b60405180910390fd5b6108c4838383610a49565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093e9061116f565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550815f808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a309190610c0e565b60405180910390a3610a43848484610a4e565b50505050565b505050565b505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a8a578082015181840152602081019050610a6f565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610aaf82610a53565b610ab98185610a5d565b9350610ac9818560208601610a6d565b610ad281610a95565b840191505092915050565b5f6020820190508181035f830152610af58184610aa5565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610b2a82610b01565b9050919050565b610b3a81610b20565b8114610b44575f80fd5b50565b5f81359050610b5581610b31565b92915050565b5f819050919050565b610b6d81610b5b565b8114610b77575f80fd5b50565b5f81359050610b8881610b64565b92915050565b5f8060408385031215610ba457610ba3610afd565b5b5f610bb185828601610b47565b9250506020610bc285828601610b7a565b9150509250929050565b5f8115159050919050565b610be081610bcc565b82525050565b5f602082019050610bf95f830184610bd7565b92915050565b610c0881610b5b565b82525050565b5f602082019050610c215f830184610bff565b92915050565b5f805f60608486031215610c3e57610c3d610afd565b5b5f610c4b86828701610b47565b9350506020610c5c86828701610b47565b9250506040610c6d86828701610b7a565b9150509250925092565b5f60ff82169050919050565b610c8c81610c77565b82525050565b5f602082019050610ca55f830184610c83565b92915050565b5f60208284031215610cc057610cbf610afd565b5b5f610ccd84828501610b47565b91505092915050565b5f8060408385031215610cec57610ceb610afd565b5b5f610cf985828601610b47565b9250506020610d0a85828601610b47565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610d5857607f821691505b602082108103610d6b57610d6a610d14565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610da882610b5b565b9150610db383610b5b565b9250828201905080821115610dcb57610dca610d71565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f775f8201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b5f610e2b602583610a5d565b9150610e3682610dd1565b604082019050919050565b5f6020820190508181035f830152610e5881610e1f565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f610eb9602483610a5d565b9150610ec482610e5f565b604082019050919050565b5f6020820190508181035f830152610ee681610ead565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f610f47602283610a5d565b9150610f5282610eed565b604082019050919050565b5f6020820190508181035f830152610f7481610f3b565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000005f82015250565b5f610faf601d83610a5d565b9150610fba82610f7b565b602082019050919050565b5f6020820190508181035f830152610fdc81610fa3565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61103d602583610a5d565b915061104882610fe3565b604082019050919050565b5f6020820190508181035f83015261106a81611031565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6110cb602383610a5d565b91506110d682611071565b604082019050919050565b5f6020820190508181035f8301526110f8816110bf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e74206578636565647320625f8201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b5f611159602683610a5d565b9150611164826110ff565b604082019050919050565b5f6020820190508181035f8301526111868161114d565b905091905056fea264697066735822122068e7088e2020b3a92aeb07338de801db3c8164bac57255e32c1c6a6614fdeabe64736f6c63430008150033` + +contractWithParameters \ No newline at end of file From 7405a1fedd6ba5fab3785f201f822c20e4539169 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 7 Aug 2023 13:15:52 +0200 Subject: [PATCH 41/73] fix test --- libs/remix-debug/src/trace/traceCache.ts | 3 ++- libs/remix-lib/src/util.ts | 4 ++-- libs/remix-lib/test/util.ts | 7 +------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/remix-debug/src/trace/traceCache.ts b/libs/remix-debug/src/trace/traceCache.ts index 2df82cf20c..af578c2568 100644 --- a/libs/remix-debug/src/trace/traceCache.ts +++ b/libs/remix-debug/src/trace/traceCache.ts @@ -102,11 +102,12 @@ export class TraceCache { } pushContractCreationFromMemory (index, token, trace, lastMemoryChange) { + const toHexString = arr => Array.from(arr, i => (i as any).toString(16).padStart(2, "0")).join("") const memory = trace[lastMemoryChange].memory const stack = trace[index].stack const offset = 2 * parseInt(toHexPaddedString(stack[stack.length - 2]), 16) const size = 2 * parseInt(toHexPaddedString(stack[stack.length - 3]), 16) - const memoryHex = Buffer.from(memory).toString('hex') + const memoryHex = toHexString(memory) this.contractCreation[token] = '0x' + memoryHex.substr(offset, size) } diff --git a/libs/remix-lib/src/util.ts b/libs/remix-lib/src/util.ts index 98a3640cbb..f28d6c80c0 100644 --- a/libs/remix-lib/src/util.ts +++ b/libs/remix-lib/src/util.ts @@ -190,7 +190,7 @@ export function swarmHashExtractionPOC32 () { * @return {RegEx} */ export function cborEncodedValueExtraction () { - return /64697066735822[0-9a-f]{68}64736f6c6343([0-9a-f]{6})0033$/ + return /64697066735822([0-9a-f]{68})64736f6c6343([0-9a-f]{6})0033$/ } /** @@ -204,7 +204,7 @@ export function inputParametersExtraction () { export function extractcborMetadata (value) { const cbor = value.match(cborEncodedValueExtraction()) - if (cbor && cbor[1]) value = value.replace(cbor[1], '') + if (cbor && cbor[0]) value = value.replace(cbor[0], '') return value } diff --git a/libs/remix-lib/test/util.ts b/libs/remix-lib/test/util.ts index 413710f0a9..61f31e0a9d 100644 --- a/libs/remix-lib/test/util.ts +++ b/libs/remix-lib/test/util.ts @@ -120,9 +120,4 @@ tape('util.compareByteCode which have input parameters', function (t) { const contractWithParameters = `0x608060405234801562000010575f80fd5b5060405162001756380380620017568339818101604052810190620000369190620001e7565b8160039081620000479190620004a1565b508060049081620000599190620004a1565b50505062000585565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620000c3826200007b565b810181811067ffffffffffffffff82111715620000e557620000e46200008b565b5b80604052505050565b5f620000f962000062565b9050620001078282620000b8565b919050565b5f67ffffffffffffffff8211156200012957620001286200008b565b5b62000134826200007b565b9050602081019050919050565b5f5b838110156200016057808201518184015260208101905062000143565b5f8484015250505050565b5f620001816200017b846200010c565b620000ee565b905082815260208101848484011115620001a0576200019f62000077565b5b620001ad84828562000141565b509392505050565b5f82601f830112620001cc57620001cb62000073565b5b8151620001de8482602086016200016b565b91505092915050565b5f80604083850312156200020057620001ff6200006b565b5b5f83015167ffffffffffffffff81111562000220576200021f6200006f565b5b6200022e85828601620001b5565b925050602083015167ffffffffffffffff8111156200025257620002516200006f565b5b6200026085828601620001b5565b9150509250929050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620002b957607f821691505b602082108103620002cf57620002ce62000274565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002f6565b6200033f8683620002f6565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f62000389620003836200037d8462000357565b62000360565b62000357565b9050919050565b5f819050919050565b620003a48362000369565b620003bc620003b38262000390565b84845462000302565b825550505050565b5f90565b620003d2620003c4565b620003df81848462000399565b505050565b5b818110156200040657620003fa5f82620003c8565b600181019050620003e5565b5050565b601f82111562000455576200041f81620002d5565b6200042a84620002e7565b810160208510156200043a578190505b620004526200044985620002e7565b830182620003e4565b50505b505050565b5f82821c905092915050565b5f620004775f19846008026200045a565b1980831691505092915050565b5f62000491838362000466565b9150826002028217905092915050565b620004ac826200026a565b67ffffffffffffffff811115620004c857620004c76200008b565b5b620004d48254620002a1565b620004e18282856200040a565b5f60209050601f83116001811462000517575f841562000502578287015190505b6200050e858262000484565b8655506200057d565b601f1984166200052786620002d5565b5f5b82811015620005505784890151825560018201915060208501945060208101905062000529565b868310156200057057848901516200056c601f89168262000466565b8355505b6001600288020188555050505b505050505050565b6111c380620005935f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c8063395093511161006f578063395093511461016557806370a082311461019557806395d89b41146101c5578063a457c2d7146101e3578063a9059cbb14610213578063dd62ed3e14610243576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b3610273565b6040516100c09190610add565b60405180910390f35b6100e360048036038101906100de9190610b8e565b610303565b6040516100f09190610be6565b60405180910390f35b610101610325565b60405161010e9190610c0e565b60405180910390f35b610131600480360381019061012c9190610c27565b61032e565b60405161013e9190610be6565b60405180910390f35b61014f61035c565b60405161015c9190610c92565b60405180910390f35b61017f600480360381019061017a9190610b8e565b610364565b60405161018c9190610be6565b60405180910390f35b6101af60048036038101906101aa9190610cab565b61039a565b6040516101bc9190610c0e565b60405180910390f35b6101cd6103df565b6040516101da9190610add565b60405180910390f35b6101fd60048036038101906101f89190610b8e565b61046f565b60405161020a9190610be6565b60405180910390f35b61022d60048036038101906102289190610b8e565b6104e4565b60405161023a9190610be6565b60405180910390f35b61025d60048036038101906102589190610cd6565b610506565b60405161026a9190610c0e565b60405180910390f35b60606003805461028290610d41565b80601f01602080910402602001604051908101604052809291908181526020018280546102ae90610d41565b80156102f95780601f106102d0576101008083540402835291602001916102f9565b820191905f5260205f20905b8154815290600101906020018083116102dc57829003601f168201915b5050505050905090565b5f8061030d610588565b905061031a81858561058f565b600191505092915050565b5f600254905090565b5f80610338610588565b9050610345858285610752565b6103508585856107dd565b60019150509392505050565b5f6012905090565b5f8061036e610588565b905061038f8185856103808589610506565b61038a9190610d9e565b61058f565b600191505092915050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6060600480546103ee90610d41565b80601f016020809104026020016040519081016040528092919081815260200182805461041a90610d41565b80156104655780601f1061043c57610100808354040283529160200191610465565b820191905f5260205f20905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b5f80610479610588565b90505f6104868286610506565b9050838110156104cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c290610e41565b60405180910390fd5b6104d8828686840361058f565b60019250505092915050565b5f806104ee610588565b90506104fb8185856107dd565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f490610ecf565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361066b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066290610f5d565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107459190610c0e565b60405180910390a3505050565b5f61075d8484610506565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d757818110156107c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c090610fc5565b60405180910390fd5b6107d6848484840361058f565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084290611053565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b0906110e1565b60405180910390fd5b6108c4838383610a49565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093e9061116f565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550815f808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a309190610c0e565b60405180910390a3610a43848484610a4e565b50505050565b505050565b505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a8a578082015181840152602081019050610a6f565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610aaf82610a53565b610ab98185610a5d565b9350610ac9818560208601610a6d565b610ad281610a95565b840191505092915050565b5f6020820190508181035f830152610af58184610aa5565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610b2a82610b01565b9050919050565b610b3a81610b20565b8114610b44575f80fd5b50565b5f81359050610b5581610b31565b92915050565b5f819050919050565b610b6d81610b5b565b8114610b77575f80fd5b50565b5f81359050610b8881610b64565b92915050565b5f8060408385031215610ba457610ba3610afd565b5b5f610bb185828601610b47565b9250506020610bc285828601610b7a565b9150509250929050565b5f8115159050919050565b610be081610bcc565b82525050565b5f602082019050610bf95f830184610bd7565b92915050565b610c0881610b5b565b82525050565b5f602082019050610c215f830184610bff565b92915050565b5f805f60608486031215610c3e57610c3d610afd565b5b5f610c4b86828701610b47565b9350506020610c5c86828701610b47565b9250506040610c6d86828701610b7a565b9150509250925092565b5f60ff82169050919050565b610c8c81610c77565b82525050565b5f602082019050610ca55f830184610c83565b92915050565b5f60208284031215610cc057610cbf610afd565b5b5f610ccd84828501610b47565b91505092915050565b5f8060408385031215610cec57610ceb610afd565b5b5f610cf985828601610b47565b9250506020610d0a85828601610b47565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610d5857607f821691505b602082108103610d6b57610d6a610d14565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610da882610b5b565b9150610db383610b5b565b9250828201905080821115610dcb57610dca610d71565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f775f8201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b5f610e2b602583610a5d565b9150610e3682610dd1565b604082019050919050565b5f6020820190508181035f830152610e5881610e1f565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f610eb9602483610a5d565b9150610ec482610e5f565b604082019050919050565b5f6020820190508181035f830152610ee681610ead565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f610f47602283610a5d565b9150610f5282610eed565b604082019050919050565b5f6020820190508181035f830152610f7481610f3b565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000005f82015250565b5f610faf601d83610a5d565b9150610fba82610f7b565b602082019050919050565b5f6020820190508181035f830152610fdc81610fa3565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61103d602583610a5d565b915061104882610fe3565b604082019050919050565b5f6020820190508181035f83015261106a81611031565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6110cb602383610a5d565b91506110d682611071565b604082019050919050565b5f6020820190508181035f8301526110f8816110bf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e74206578636565647320625f8201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b5f611159602683610a5d565b9150611164826110ff565b604082019050919050565b5f6020820190508181035f8301526111868161114d565b905091905056fea264697066735822122068e7088e2020b3a92aeb07338de801db3c8164bac57255e32c1c6a6614fdeabe64736f6c63430008150033000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017900000000000000000000000000000000000000000000000000000000000000` -const contractWithoutParameters = `0x608060405234801562000010575f80fd5b5060405162001756380380620017568339818101604052810190620000369190620001e7565b8160039081620000479190620004a1565b508060049081620000599190620004a1565b50505062000585565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620000c3826200007b565b810181811067ffffffffffffffff82111715620000e557620000e46200008b565b5b80604052505050565b5f620000f962000062565b9050620001078282620000b8565b919050565b5f67ffffffffffffffff8211156200012957620001286200008b565b5b62000134826200007b565b9050602081019050919050565b5f5b838110156200016057808201518184015260208101905062000143565b5f8484015250505050565b5f620001816200017b846200010c565b620000ee565b905082815260208101848484011115620001a0576200019f62000077565b5b620001ad84828562000141565b509392505050565b5f82601f830112620001cc57620001cb62000073565b5b8151620001de8482602086016200016b565b91505092915050565b5f80604083850312156200020057620001ff6200006b565b5b5f83015167ffffffffffffffff81111562000220576200021f6200006f565b5b6200022e85828601620001b5565b925050602083015167ffffffffffffffff8111156200025257620002516200006f565b5b6200026085828601620001b5565b9150509250929050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620002b957607f821691505b602082108103620002cf57620002ce62000274565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002f6565b6200033f8683620002f6565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f62000389620003836200037d8462000357565b62000360565b62000357565b9050919050565b5f819050919050565b620003a48362000369565b620003bc620003b38262000390565b84845462000302565b825550505050565b5f90565b620003d2620003c4565b620003df81848462000399565b505050565b5b818110156200040657620003fa5f82620003c8565b600181019050620003e5565b5050565b601f82111562000455576200041f81620002d5565b6200042a84620002e7565b810160208510156200043a578190505b620004526200044985620002e7565b830182620003e4565b50505b505050565b5f82821c905092915050565b5f620004775f19846008026200045a565b1980831691505092915050565b5f62000491838362000466565b9150826002028217905092915050565b620004ac826200026a565b67ffffffffffffffff811115620004c857620004c76200008b565b5b620004d48254620002a1565b620004e18282856200040a565b5f60209050601f83116001811462000517575f841562000502578287015190505b6200050e858262000484565b8655506200057d565b601f1984166200052786620002d5565b5f5b82811015620005505784890151825560018201915060208501945060208101905062000529565b868310156200057057848901516200056c601f89168262000466565b8355505b6001600288020188555050505b505050505050565b6111c380620005935f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c8063395093511161006f578063395093511461016557806370a082311461019557806395d89b41146101c5578063a457c2d7146101e3578063a9059cbb14610213578063dd62ed3e14610243576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b3610273565b6040516100c09190610add565b60405180910390f35b6100e360048036038101906100de9190610b8e565b610303565b6040516100f09190610be6565b60405180910390f35b610101610325565b60405161010e9190610c0e565b60405180910390f35b610131600480360381019061012c9190610c27565b61032e565b60405161013e9190610be6565b60405180910390f35b61014f61035c565b60405161015c9190610c92565b60405180910390f35b61017f600480360381019061017a9190610b8e565b610364565b60405161018c9190610be6565b60405180910390f35b6101af60048036038101906101aa9190610cab565b61039a565b6040516101bc9190610c0e565b60405180910390f35b6101cd6103df565b6040516101da9190610add565b60405180910390f35b6101fd60048036038101906101f89190610b8e565b61046f565b60405161020a9190610be6565b60405180910390f35b61022d60048036038101906102289190610b8e565b6104e4565b60405161023a9190610be6565b60405180910390f35b61025d60048036038101906102589190610cd6565b610506565b60405161026a9190610c0e565b60405180910390f35b60606003805461028290610d41565b80601f01602080910402602001604051908101604052809291908181526020018280546102ae90610d41565b80156102f95780601f106102d0576101008083540402835291602001916102f9565b820191905f5260205f20905b8154815290600101906020018083116102dc57829003601f168201915b5050505050905090565b5f8061030d610588565b905061031a81858561058f565b600191505092915050565b5f600254905090565b5f80610338610588565b9050610345858285610752565b6103508585856107dd565b60019150509392505050565b5f6012905090565b5f8061036e610588565b905061038f8185856103808589610506565b61038a9190610d9e565b61058f565b600191505092915050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6060600480546103ee90610d41565b80601f016020809104026020016040519081016040528092919081815260200182805461041a90610d41565b80156104655780601f1061043c57610100808354040283529160200191610465565b820191905f5260205f20905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b5f80610479610588565b90505f6104868286610506565b9050838110156104cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c290610e41565b60405180910390fd5b6104d8828686840361058f565b60019250505092915050565b5f806104ee610588565b90506104fb8185856107dd565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f490610ecf565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361066b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066290610f5d565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107459190610c0e565b60405180910390a3505050565b5f61075d8484610506565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d757818110156107c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c090610fc5565b60405180910390fd5b6107d6848484840361058f565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084290611053565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b0906110e1565b60405180910390fd5b6108c4838383610a49565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093e9061116f565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550815f808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a309190610c0e565b60405180910390a3610a43848484610a4e565b50505050565b505050565b505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a8a578082015181840152602081019050610a6f565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610aaf82610a53565b610ab98185610a5d565b9350610ac9818560208601610a6d565b610ad281610a95565b840191505092915050565b5f6020820190508181035f830152610af58184610aa5565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610b2a82610b01565b9050919050565b610b3a81610b20565b8114610b44575f80fd5b50565b5f81359050610b5581610b31565b92915050565b5f819050919050565b610b6d81610b5b565b8114610b77575f80fd5b50565b5f81359050610b8881610b64565b92915050565b5f8060408385031215610ba457610ba3610afd565b5b5f610bb185828601610b47565b9250506020610bc285828601610b7a565b9150509250929050565b5f8115159050919050565b610be081610bcc565b82525050565b5f602082019050610bf95f830184610bd7565b92915050565b610c0881610b5b565b82525050565b5f602082019050610c215f830184610bff565b92915050565b5f805f60608486031215610c3e57610c3d610afd565b5b5f610c4b86828701610b47565b9350506020610c5c86828701610b47565b9250506040610c6d86828701610b7a565b9150509250925092565b5f60ff82169050919050565b610c8c81610c77565b82525050565b5f602082019050610ca55f830184610c83565b92915050565b5f60208284031215610cc057610cbf610afd565b5b5f610ccd84828501610b47565b91505092915050565b5f8060408385031215610cec57610ceb610afd565b5b5f610cf985828601610b47565b9250506020610d0a85828601610b47565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610d5857607f821691505b602082108103610d6b57610d6a610d14565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610da882610b5b565b9150610db383610b5b565b9250828201905080821115610dcb57610dca610d71565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f775f8201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b5f610e2b602583610a5d565b9150610e3682610dd1565b604082019050919050565b5f6020820190508181035f830152610e5881610e1f565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f610eb9602483610a5d565b9150610ec482610e5f565b604082019050919050565b5f6020820190508181035f830152610ee681610ead565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f610f47602283610a5d565b9150610f5282610eed565b604082019050919050565b5f6020820190508181035f830152610f7481610f3b565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000005f82015250565b5f610faf601d83610a5d565b9150610fba82610f7b565b602082019050919050565b5f6020820190508181035f830152610fdc81610fa3565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61103d602583610a5d565b915061104882610fe3565b604082019050919050565b5f6020820190508181035f83015261106a81611031565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6110cb602383610a5d565b91506110d682611071565b604082019050919050565b5f6020820190508181035f8301526110f8816110bf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e74206578636565647320625f8201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b5f611159602683610a5d565b9150611164826110ff565b604082019050919050565b5f6020820190508181035f8301526111868161114d565b905091905056fea264697066735822122068e7088e2020b3a92aeb07338de801db3c8164bac57255e32c1c6a6614fdeabe64736f6c63430008150033` - - - - -contractWithParameters \ No newline at end of file +const contractWithoutParameters = `0x608060405234801562000010575f80fd5b5060405162001756380380620017568339818101604052810190620000369190620001e7565b8160039081620000479190620004a1565b508060049081620000599190620004a1565b50505062000585565b5f604051905090565b5f80fd5b5f80fd5b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b620000c3826200007b565b810181811067ffffffffffffffff82111715620000e557620000e46200008b565b5b80604052505050565b5f620000f962000062565b9050620001078282620000b8565b919050565b5f67ffffffffffffffff8211156200012957620001286200008b565b5b62000134826200007b565b9050602081019050919050565b5f5b838110156200016057808201518184015260208101905062000143565b5f8484015250505050565b5f620001816200017b846200010c565b620000ee565b905082815260208101848484011115620001a0576200019f62000077565b5b620001ad84828562000141565b509392505050565b5f82601f830112620001cc57620001cb62000073565b5b8151620001de8482602086016200016b565b91505092915050565b5f80604083850312156200020057620001ff6200006b565b5b5f83015167ffffffffffffffff81111562000220576200021f6200006f565b5b6200022e85828601620001b5565b925050602083015167ffffffffffffffff8111156200025257620002516200006f565b5b6200026085828601620001b5565b9150509250929050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680620002b957607f821691505b602082108103620002cf57620002ce62000274565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f60088302620003337fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620002f6565b6200033f8683620002f6565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f62000389620003836200037d8462000357565b62000360565b62000357565b9050919050565b5f819050919050565b620003a48362000369565b620003bc620003b38262000390565b84845462000302565b825550505050565b5f90565b620003d2620003c4565b620003df81848462000399565b505050565b5b818110156200040657620003fa5f82620003c8565b600181019050620003e5565b5050565b601f82111562000455576200041f81620002d5565b6200042a84620002e7565b810160208510156200043a578190505b620004526200044985620002e7565b830182620003e4565b50505b505050565b5f82821c905092915050565b5f620004775f19846008026200045a565b1980831691505092915050565b5f62000491838362000466565b9150826002028217905092915050565b620004ac826200026a565b67ffffffffffffffff811115620004c857620004c76200008b565b5b620004d48254620002a1565b620004e18282856200040a565b5f60209050601f83116001811462000517575f841562000502578287015190505b6200050e858262000484565b8655506200057d565b601f1984166200052786620002d5565b5f5b82811015620005505784890151825560018201915060208501945060208101905062000529565b868310156200057057848901516200056c601f89168262000466565b8355505b6001600288020188555050505b505050505050565b6111c380620005935f395ff3fe608060405234801561000f575f80fd5b50600436106100a7575f3560e01c8063395093511161006f578063395093511461016557806370a082311461019557806395d89b41146101c5578063a457c2d7146101e3578063a9059cbb14610213578063dd62ed3e14610243576100a7565b806306fdde03146100ab578063095ea7b3146100c957806318160ddd146100f957806323b872dd14610117578063313ce56714610147575b5f80fd5b6100b3610273565b6040516100c09190610add565b60405180910390f35b6100e360048036038101906100de9190610b8e565b610303565b6040516100f09190610be6565b60405180910390f35b610101610325565b60405161010e9190610c0e565b60405180910390f35b610131600480360381019061012c9190610c27565b61032e565b60405161013e9190610be6565b60405180910390f35b61014f61035c565b60405161015c9190610c92565b60405180910390f35b61017f600480360381019061017a9190610b8e565b610364565b60405161018c9190610be6565b60405180910390f35b6101af60048036038101906101aa9190610cab565b61039a565b6040516101bc9190610c0e565b60405180910390f35b6101cd6103df565b6040516101da9190610add565b60405180910390f35b6101fd60048036038101906101f89190610b8e565b61046f565b60405161020a9190610be6565b60405180910390f35b61022d60048036038101906102289190610b8e565b6104e4565b60405161023a9190610be6565b60405180910390f35b61025d60048036038101906102589190610cd6565b610506565b60405161026a9190610c0e565b60405180910390f35b60606003805461028290610d41565b80601f01602080910402602001604051908101604052809291908181526020018280546102ae90610d41565b80156102f95780601f106102d0576101008083540402835291602001916102f9565b820191905f5260205f20905b8154815290600101906020018083116102dc57829003601f168201915b5050505050905090565b5f8061030d610588565b905061031a81858561058f565b600191505092915050565b5f600254905090565b5f80610338610588565b9050610345858285610752565b6103508585856107dd565b60019150509392505050565b5f6012905090565b5f8061036e610588565b905061038f8185856103808589610506565b61038a9190610d9e565b61058f565b600191505092915050565b5f805f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20549050919050565b6060600480546103ee90610d41565b80601f016020809104026020016040519081016040528092919081815260200182805461041a90610d41565b80156104655780601f1061043c57610100808354040283529160200191610465565b820191905f5260205f20905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b5f80610479610588565b90505f6104868286610506565b9050838110156104cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c290610e41565b60405180910390fd5b6104d8828686840361058f565b60019250505092915050565b5f806104ee610588565b90506104fb8185856107dd565b600191505092915050565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905092915050565b5f33905090565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036105fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f490610ecf565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361066b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066290610f5d565b60405180910390fd5b8060015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f20819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107459190610c0e565b60405180910390a3505050565b5f61075d8484610506565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107d757818110156107c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c090610fc5565b60405180910390fd5b6107d6848484840361058f565b5b50505050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084290611053565b60405180910390fd5b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b0906110e1565b60405180910390fd5b6108c4838383610a49565b5f805f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2054905081811015610947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161093e9061116f565b60405180910390fd5b8181035f808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2081905550815f808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f82825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a309190610c0e565b60405180910390a3610a43848484610a4e565b50505050565b505050565b505050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610a8a578082015181840152602081019050610a6f565b5f8484015250505050565b5f601f19601f8301169050919050565b5f610aaf82610a53565b610ab98185610a5d565b9350610ac9818560208601610a6d565b610ad281610a95565b840191505092915050565b5f6020820190508181035f830152610af58184610aa5565b905092915050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610b2a82610b01565b9050919050565b610b3a81610b20565b8114610b44575f80fd5b50565b5f81359050610b5581610b31565b92915050565b5f819050919050565b610b6d81610b5b565b8114610b77575f80fd5b50565b5f81359050610b8881610b64565b92915050565b5f8060408385031215610ba457610ba3610afd565b5b5f610bb185828601610b47565b9250506020610bc285828601610b7a565b9150509250929050565b5f8115159050919050565b610be081610bcc565b82525050565b5f602082019050610bf95f830184610bd7565b92915050565b610c0881610b5b565b82525050565b5f602082019050610c215f830184610bff565b92915050565b5f805f60608486031215610c3e57610c3d610afd565b5b5f610c4b86828701610b47565b9350506020610c5c86828701610b47565b9250506040610c6d86828701610b7a565b9150509250925092565b5f60ff82169050919050565b610c8c81610c77565b82525050565b5f602082019050610ca55f830184610c83565b92915050565b5f60208284031215610cc057610cbf610afd565b5b5f610ccd84828501610b47565b91505092915050565b5f8060408385031215610cec57610ceb610afd565b5b5f610cf985828601610b47565b9250506020610d0a85828601610b47565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680610d5857607f821691505b602082108103610d6b57610d6a610d14565b5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f610da882610b5b565b9150610db383610b5b565b9250828201905080821115610dcb57610dca610d71565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f775f8201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b5f610e2b602583610a5d565b9150610e3682610dd1565b604082019050919050565b5f6020820190508181035f830152610e5881610e1f565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f206164645f8201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b5f610eb9602483610a5d565b9150610ec482610e5f565b604082019050919050565b5f6020820190508181035f830152610ee681610ead565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f2061646472655f8201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b5f610f47602283610a5d565b9150610f5282610eed565b604082019050919050565b5f6020820190508181035f830152610f7481610f3b565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000005f82015250565b5f610faf601d83610a5d565b9150610fba82610f7b565b602082019050919050565b5f6020820190508181035f830152610fdc81610fa3565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f2061645f8201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b5f61103d602583610a5d565b915061104882610fe3565b604082019050919050565b5f6020820190508181035f83015261106a81611031565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f20616464725f8201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b5f6110cb602383610a5d565b91506110d682611071565b604082019050919050565b5f6020820190508181035f8301526110f8816110bf565b9050919050565b7f45524332303a207472616e7366657220616d6f756e74206578636565647320625f8201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b5f611159602683610a5d565b9150611164826110ff565b604082019050919050565b5f6020820190508181035f8301526111868161114d565b905091905056fea264697066735822122068e7088e2020b3a92aeb07338de801db3c8164bac57255e32c1c6a6614fdeabe64736f6c63430008150033` \ No newline at end of file From 80e4cb7a45a1fe67fd7ab2e1abafa357c836c834 Mon Sep 17 00:00:00 2001 From: drafish Date: Thu, 6 Jul 2023 13:34:51 +0800 Subject: [PATCH 42/73] fix issue 3888 --- .../run-tab/src/lib/actions/deploy.ts | 4 ++-- .../src/lib/actions/terminalAction.ts | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) 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 6872095571..7296cb0148 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/deploy.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/deploy.ts @@ -155,14 +155,14 @@ export const createInstance = async ( return terminalLogger(plugin, log) } - const finalCb = (error, contractObject, address) => { + const finalCb = async (error, contractObject, address) => { if (error) { const log = logBuilder(error) return terminalLogger(plugin, log) } addInstance(dispatch, { contractData: contractObject, address, name: contractObject.name }) - const data = plugin.compilersArtefacts.getCompilerAbstract(contractObject.contract.file) + const data = await plugin.compilersArtefacts.getCompilerAbstract(contractObject.contract.file) plugin.compilersArtefacts.addResolvedContract(addressToString(address), data) if (plugin.REACT_API.ipfsChecked) { diff --git a/libs/remix-ui/terminal/src/lib/actions/terminalAction.ts b/libs/remix-ui/terminal/src/lib/actions/terminalAction.ts index 87951d8a98..6b08bcd808 100644 --- a/libs/remix-ui/terminal/src/lib/actions/terminalAction.ts +++ b/libs/remix-ui/terminal/src/lib/actions/terminalAction.ts @@ -134,7 +134,24 @@ export const initListeningOnNetwork = (plugins, dispatch: React.Dispatch) = if (resolvedTransaction) { let compiledContracts = null - if (plugins._deps.compilersArtefacts.__last) { + try { + if (tx.to) { + compiledContracts = await plugins._deps.compilersArtefacts.get(tx.to).getContracts() + } + } catch (error) { + console.log(error) + } + + try { + const currentFile = plugins._deps.fileManager.getCurrentFile() + if (!compiledContracts && currentFile && currentFile.endsWith('.sol')) { + compiledContracts = await (await plugins._deps.compilersArtefacts.getCompilerAbstract(currentFile)).getContracts() + } + } catch (error) { + console.log(error) + } + + if (!compiledContracts && plugins._deps.compilersArtefacts.__last) { compiledContracts = await plugins._deps.compilersArtefacts.__last.getContracts() } await plugins.eventsDecoder.parseLogs(tx, resolvedTransaction.contractName, compiledContracts, async (error, logs) => { From 7d4cc56c51a6fa637ffaeed1244e18cad34050a8 Mon Sep 17 00:00:00 2001 From: drafish Date: Mon, 7 Aug 2023 18:53:10 +0800 Subject: [PATCH 43/73] add await for getCompilerAbstract in resolveContractAndAddInstance --- apps/remix-ide/src/app/udapp/run-tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/udapp/run-tab.js b/apps/remix-ide/src/app/udapp/run-tab.js index 49983f5e39..ec389b1db8 100644 --- a/apps/remix-ide/src/app/udapp/run-tab.js +++ b/apps/remix-ide/src/app/udapp/run-tab.js @@ -182,8 +182,8 @@ export class RunTab extends ViewPlugin { return this.call('fileManager', 'readFile', fileName) } - resolveContractAndAddInstance (contractObject, address) { - const data = this.compilersArtefacts.getCompilerAbstract(contractObject.contract.file) + async resolveContractAndAddInstance (contractObject, address) { + const data = await this.compilersArtefacts.getCompilerAbstract(contractObject.contract.file) this.compilersArtefacts.addResolvedContract(addressToString(address), data) this.addInstance(address, contractObject.abi, contractObject.name) From 89ac92a2c04e69ce40703177562f2895d74e5618 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 8 Aug 2023 15:10:24 +0530 Subject: [PATCH 44/73] quick fixes as array and refactoring --- .../src/lib/providers/codeActionProvider.ts | 47 +++++++++++++------ .../editor/src/lib/providers/quickfixes.ts | 16 +++---- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index b2a0bc727d..116ee42dd5 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -1,7 +1,7 @@ import { Monaco } from "@monaco-editor/react" import monaco from "../../types/monaco" import { EditorUIProps } from "../remix-ui-editor" -import { default as fixes } from "./quickfixes" +import { default as fixesList } from "./quickfixes" export class RemixCodeActionProvider implements monaco.languages.CodeActionProvider { props: EditorUIProps @@ -19,12 +19,12 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi ): Promise { const actions: monaco.languages.CodeAction[] = [] for (const error of context.markers) { - let fix: Record + let fixes: Record[] let msg: string - const errStrings: string[] = Object.keys(fixes) + const errStrings: string[] = Object.keys(fixesList) const errStr:string = errStrings.find(es => error.message.includes(es)) if (errStr) { - fix = fixes[errStr] + fixes = fixesList[errStr] const cursorPosition: number = this.props.editorAPI.getHoverPosition({lineNumber: error.startLineNumber, column: error.startColumn}) const nodeAtPosition = await this.props.plugin.call('codeParser', 'definitionAtPosition', cursorPosition) // Check if a function is hovered @@ -33,20 +33,39 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { const paramNodes = nodeAtPosition.parameters.parameters // If method has parameters - if (paramNodes.length) msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, true) - else msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, true) + if (paramNodes.length) { + for (const fix of fixes) { + msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, true) + this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) + } + } else { + for (const fix of fixes) { + msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, true) + this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) + } + } } else { const paramNodes = nodeAtPosition.parameters // If method has parameters - if (paramNodes.length) msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, false) - else msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, false) + if (paramNodes.length) { + for (const fix of fixes) { + msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, false) + this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) + } + } else { + for (const fix of fixes) { + msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, false) + this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) + } + } } - } else if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) return - if (Array.isArray(fix)) - for (const element of fix) - this.addQuickFix(actions, error, model.uri, {title: element.title, range: element.range || error, text: msg || element.message}) - else this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range || error, text: msg || fix.message}) - } + } else { + for (const fix of fixes) { + if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) continue + else this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range || error, text: fix.message}) + } + } + } } return { diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index ec11818965..24fb34c86b 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -10,7 +10,7 @@ export default { "title": "Add non-open-source license", "message": "// SPDX-License-Identifier: UNLICENSED" }], - "Warning: Source file does not specify required compiler version! Consider adding" : { + "Warning: Source file does not specify required compiler version! Consider adding" : [{ "id": 2, "title": "Add Solidity pragma", "message": "pragma solidity ^0.*.*;", @@ -21,23 +21,23 @@ export default { startColumn: 1, endColumn: 1 } - }, - "SyntaxError: No visibility specified. Did you intend to add \"public\"": { + }], + "SyntaxError: No visibility specified. Did you intend to add \"public\"": [{ "id": 3, "title": "Add visibility 'public'", "message": "public ", "nodeType": "FunctionDefinition" - }, - "Warning: Function state mutability can be restricted to view": { + }], + "Warning: Function state mutability can be restricted to view": [{ "id": 4, "title": "Add mutability 'view'", "message": "view ", "nodeType": "FunctionDefinition" - }, - "Warning: Function state mutability can be restricted to pure": { + }], + "Warning: Function state mutability can be restricted to pure": [{ "id": 5, "title": "Add mutability 'pure'", "message": "pure ", "nodeType": "FunctionDefinition" - } + }] } \ No newline at end of file From bf9a007422d24e79b999fbc7656ac64662d6b0b7 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 8 Aug 2023 18:05:12 +0530 Subject: [PATCH 45/73] fix linting --- .../editor/src/lib/providers/codeActionProvider.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 116ee42dd5..5a36fafbab 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -60,12 +60,12 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } } } else { - for (const fix of fixes) { - if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) continue - else this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range || error, text: fix.message}) - } + for (const fix of fixes) { + if (fix && nodeAtPosition && fix.nodeType !== nodeAtPosition.nodeType) continue + else this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range || error, text: fix.message}) } } + } } return { From e081a830d8cb686bd01bb7aa195fc744818142f3 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 8 Aug 2023 18:25:06 +0530 Subject: [PATCH 46/73] more refactoring --- .../src/lib/providers/codeActionProvider.ts | 48 ++++++------------- 1 file changed, 14 insertions(+), 34 deletions(-) diff --git a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts index 5a36fafbab..bfa34c586a 100644 --- a/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/codeActionProvider.ts @@ -12,15 +12,15 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi } async provideCodeActions ( - model: monaco.editor.ITextModel /**ITextModel*/, - range: monaco.Range /**Range*/, - context: monaco.languages.CodeActionContext /**CodeActionContext*/, - token: monaco.CancellationToken /**CancellationToken*/ + model: monaco.editor.ITextModel, + range: monaco.Range, + context: monaco.languages.CodeActionContext, + token: monaco.CancellationToken ): Promise { const actions: monaco.languages.CodeAction[] = [] for (const error of context.markers) { - let fixes: Record[] - let msg: string + let fixes: Record[], msg: string + let isOldAST: boolean = false const errStrings: string[] = Object.keys(fixesList) const errStr:string = errStrings.find(es => error.message.includes(es)) if (errStr) { @@ -30,34 +30,14 @@ export class RemixCodeActionProvider implements monaco.languages.CodeActionProvi // Check if a function is hovered if (nodeAtPosition && nodeAtPosition.nodeType === "FunctionDefinition") { // Identify type of AST node - if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) { - const paramNodes = nodeAtPosition.parameters.parameters - // If method has parameters - if (paramNodes.length) { - for (const fix of fixes) { - msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, true) - this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) - } - } else { - for (const fix of fixes) { - msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, true) - this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) - } - } - } else { - const paramNodes = nodeAtPosition.parameters - // If method has parameters - if (paramNodes.length) { - for (const fix of fixes) { - msg = await this.fixForMethodWithParams(model, paramNodes, fix, error, false) - this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) - } - } else { - for (const fix of fixes) { - msg = await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, false) - this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) - } - } + if (nodeAtPosition.parameters && !Array.isArray(nodeAtPosition.parameters) && Array.isArray(nodeAtPosition.parameters.parameters)) + isOldAST = true + const paramNodes = isOldAST ? nodeAtPosition.parameters.parameters : nodeAtPosition.parameters + for (const fix of fixes) { + msg = paramNodes.length + ? await this.fixForMethodWithParams(model, paramNodes, fix, error, isOldAST) + : await this.fixForMethodWithoutParams(model, nodeAtPosition, fix, error, isOldAST) + this.addQuickFix(actions, error, model.uri, {title: fix.title, range: fix.range, text: msg}) } } else { for (const fix of fixes) { From 6d97c7c1b7586cd91ef9f373820363b8116f8895 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 8 Aug 2023 18:29:14 +0530 Subject: [PATCH 47/73] multiple visibility options --- .../editor/src/lib/providers/quickfixes.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts index 24fb34c86b..023779a5f9 100644 --- a/libs/remix-ui/editor/src/lib/providers/quickfixes.ts +++ b/libs/remix-ui/editor/src/lib/providers/quickfixes.ts @@ -23,10 +23,25 @@ export default { } }], "SyntaxError: No visibility specified. Did you intend to add \"public\"": [{ - "id": 3, + "id": 3.1, "title": "Add visibility 'public'", "message": "public ", "nodeType": "FunctionDefinition" + },{ + "id": 3.2, + "title": "Add visibility 'private'", + "message": "private ", + "nodeType": "FunctionDefinition" + },{ + "id": 3.3, + "title": "Add visibility 'internal'", + "message": "internal ", + "nodeType": "FunctionDefinition" + },{ + "id": 3.4, + "title": "Add visibility 'external'", + "message": "external ", + "nodeType": "FunctionDefinition" }], "Warning: Function state mutability can be restricted to view": [{ "id": 4, From dd7097e7dbf7b65bfd8e76b5fc05e27185bea0d4 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Thu, 10 Aug 2023 08:14:10 +0200 Subject: [PATCH 48/73] Update home Solidity Description --- apps/remix-ide/src/app/tabs/locales/fr/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/fr/home.json b/apps/remix-ide/src/app/tabs/locales/fr/home.json index da7c37031e..8042b1bdfd 100644 --- a/apps/remix-ide/src/app/tabs/locales/fr/home.json +++ b/apps/remix-ide/src/app/tabs/locales/fr/home.json @@ -18,7 +18,7 @@ "home.betaTestingText2": "Help us beta test releases now and get a handle on new features!", "home.betaTestingMore": "Sign up", "home.featuredPlugins": "Featured Plugins", - "home.solidityPluginDesc": "Compile, test and analyse smart contract.", + "home.solidityPluginDesc": "Compile, test, and analyze smart contracts.", "home.starkNetPluginDesc": "Compile and deploy contracts with Cairo, a native language for StarkNet.", "home.solhintPluginDesc": "Solhint is an open source project for linting Solidity code.", "home.sourcifyPluginDesc": "Solidity contract and metadata verification service.", From 8ddae66aa8199c7e84edac8035b3419d8c3b02d4 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Thu, 10 Aug 2023 08:15:34 +0200 Subject: [PATCH 49/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/es/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/es/home.json b/apps/remix-ide/src/app/tabs/locales/es/home.json index da7c37031e..8042b1bdfd 100644 --- a/apps/remix-ide/src/app/tabs/locales/es/home.json +++ b/apps/remix-ide/src/app/tabs/locales/es/home.json @@ -18,7 +18,7 @@ "home.betaTestingText2": "Help us beta test releases now and get a handle on new features!", "home.betaTestingMore": "Sign up", "home.featuredPlugins": "Featured Plugins", - "home.solidityPluginDesc": "Compile, test and analyse smart contract.", + "home.solidityPluginDesc": "Compile, test, and analyze smart contracts.", "home.starkNetPluginDesc": "Compile and deploy contracts with Cairo, a native language for StarkNet.", "home.solhintPluginDesc": "Solhint is an open source project for linting Solidity code.", "home.sourcifyPluginDesc": "Solidity contract and metadata verification service.", From 944c6c889c6d1d8320877c05b47ae212e23c3609 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Thu, 10 Aug 2023 08:16:30 +0200 Subject: [PATCH 50/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/en/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/home.json b/apps/remix-ide/src/app/tabs/locales/en/home.json index 01984c1bf8..4705465988 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/home.json +++ b/apps/remix-ide/src/app/tabs/locales/en/home.json @@ -18,7 +18,7 @@ "home.betaTestingText2": "Help us beta test releases now and get a handle on new features!", "home.betaTestingMore": "Sign up", "home.featuredPlugins": "Featured Plugins", - "home.solidityPluginDesc": "Compile, test and analyse smart contract.", + "home.solidityPluginDesc": "Compile, test, and analyze smart contracts.", "home.cookbookDesc": "Find smart contracts, solidity libraries, and discover protocols.", "home.codeAnalyizerPluginDesc": "Analyze your code using Remix, Solhint and Slither.", "home.starkNetPluginDesc": "Compile and deploy contracts with Cairo, a native language for StarkNet.", From e60038ac4e715d874340b1b3ee95ab67136ad105 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 7 Jun 2023 22:47:58 +0200 Subject: [PATCH 51/73] fix gas estimate --- libs/remix-lib/src/execution/txRunnerWeb3.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index d5fce39b92..14505d6d41 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -107,7 +107,7 @@ export class TxRunnerWeb3 { console.log(errNetWork) return } - const txCopy = { ...tx, type: undefined, maxFeePerGas: undefined, gasPrice: undefined } + const txCopy = { ...tx, type: undefined, maxFeePerGas: undefined, gasPrice: undefined, gas: undefined } if (network && network.lastBlock) { if (network.lastBlock.baseFeePerGas) { // the sending stack (web3.js / metamask need to have the type defined) From 6167139cf9693410a1358912a33d786a60f42506 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 9 Jun 2023 22:53:05 +0200 Subject: [PATCH 52/73] Fix maxFeePerGas --- libs/remix-lib/src/execution/txRunnerWeb3.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-lib/src/execution/txRunnerWeb3.ts b/libs/remix-lib/src/execution/txRunnerWeb3.ts index 14505d6d41..ab754c0fef 100644 --- a/libs/remix-lib/src/execution/txRunnerWeb3.ts +++ b/libs/remix-lib/src/execution/txRunnerWeb3.ts @@ -107,13 +107,13 @@ export class TxRunnerWeb3 { console.log(errNetWork) return } - const txCopy = { ...tx, type: undefined, maxFeePerGas: undefined, gasPrice: undefined, gas: undefined } + const txCopy = { ...tx, type: undefined, maxFeePerGas: undefined, gasPrice: undefined } if (network && network.lastBlock) { if (network.lastBlock.baseFeePerGas) { // the sending stack (web3.js / metamask need to have the type defined) // this is to avoid the following issue: https://github.com/MetaMask/metamask-extension/issues/11824 txCopy.type = '0x2' - txCopy.maxFeePerGas = Math.ceil(network.lastBlock.baseFeePerGas + network.lastBlock.baseFeePerGas / 2) + txCopy.maxFeePerGas = Math.ceil(network.lastBlock.baseFeePerGas + network.lastBlock.baseFeePerGas / 3) } else { txCopy.type = '0x1' txCopy.gasPrice = network.lastBlock.baseFeePerGas From 00f71b9af2ba901c87b7ac2fb9df8805d923d128 Mon Sep 17 00:00:00 2001 From: Tyler Sehr Date: Sat, 5 Aug 2023 14:44:23 -0700 Subject: [PATCH 53/73] adjust Cookbook logo --- apps/remix-ide/src/assets/img/cookbook.webp | Bin 2680 -> 3220 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/apps/remix-ide/src/assets/img/cookbook.webp b/apps/remix-ide/src/assets/img/cookbook.webp index 4b831b59d4e7f4927d1406b75eea42aef5c39aeb..e3535bbdca922bb39d76c184a50eb5641ad28f88 100644 GIT binary patch literal 3220 zcmaKvXH-+o7KRVKixhz%LMQ>GgF&fEi9iq~A|0exX`z=$k)jk81f>KBMFf5nc0JH&()BThBB=gD# z0EHa@ph)_gv&#U0x)=c9n*N&;$^`)CXaJ}k`kVWECP-T!+kd8`Bt>#3(&=v(0RWR3 z0I&@M0KLUOW2EpuY6Fvoct~}5k(x8$4mbi}01kKp_J9P1Rb<~joRKnO zwdEc&s7kt7w3NZk-N62PpI_ioH%MZJ1JcD$22^}VWM&irIvl4Ge%!w9hck1+9FjN_d-iGUmw-ocao%8pgFz>?!T=Eu}?I8`^|iJvKxIgq7%Kh3A`SUwEU+ z)^cnOADQc~F+t=!z+!NT;fiK<^UyVuHFUs{RS64(`KHr4txM*HsU;3>pryr7>@{z= zcW^%r?CMe)8xp9;SUR-6OnbbP_7%)ZzqNEYNXC~ zuU8g;BGxeHZ6Esr$(k%}?E|=OtA(lP zZ+K_vlEu9IzWGIpvi1NKgkk7_^_)VGs}}^D6XpLnJV_pEC95*LQg);q{=@HPCq=m! zcXf%IP_nhf7)EPfW!3;jVRH3WZ5C0b5~Bt}<6X8|^7!4t%C<%K_HD?Ra%zUED+bee z7c!r&Rz|hNO^y>rqAW*eg}>)1DOJ8l1V<=LyR}Jud|9>PA7(wFL$`Z7+vTo8lZe8d zhuQ9E`LKI|l~pp|9i8W~;};~W-VWGww!Fx+(7ZKyGu$MAIb!dflk%{LC#cQh%6Dg> zEFB6y8_k%yah73E?coQP!0yw}L|G%418@oCxs$AMAf8kkZHaDR)>hl^OfEjjLx&7l z)NOkxZFy}zNk%o%d6t=6x_%Y?@wbY_;JI%Ff>RDV?Hf@v7&JvTJ^AlL0h@VNCcBn z6c}*HlD^56ZhzK}LT1N(ZF_k-IzG)*byoGG1*2s$SE=+n_58$oCYK&LVw|I8qQkX9N~%zz6uW-f+ytyiQbcM6R`jRWgp z;&5*5V{32p2v}w?U+At6`CBcuf^Y1U#?Ud%Pv-;y5GCEBV^W(YB?v4#5J~9@bqI>h zWn^;Y5E6w)8SjYx`k+WxDExjE9;wB|8{z|dzEDu40egn(tx{l79EaVCW4VpL>f-}8 zi0Y}8xuR$$CN^Vha!*e{q$f^BQ5AC5HG+4E$lJ$CnMs~<1Bc@}N8Kx{=9r<#>ul6# zZYBOgx4}x5Aj2d~7b!uT4AzNX`%$0uMxZYlT-gKS04c|+Mz3ciyzI;GYF7YcX8J(D znF#N05X}-J-Ubm`LB8P9hTTkv>K{8ksSqf=HzwAVIOM6&My2w~(KOZ8>><`ozPb3E zf3x`|#?eK93s0+UVR1~KbigJcNc8AiFIo1B@TPvqX^s6_o)YIaYlqLTdyNi-Bt7_$ z*viz6AguTuZHrl~AR`Rc3ju)v4PI$Z(zg-pK)N}RU?7`JEQ55#UUijte!V~-KmAQ} zt{Qc8b+iI-PA_~$*^qdC2mYDx6-u5Tx)`S0I*1f@O1weW9H!HiQT#i*W}=?j(2X9F zG7)+~>-Zzu!}Myp-SuI$YfGkK3q}DkkiE(g{XF#tG{)O7OQ!qn1$`U9v?1TtYoRli z8hu9o8zRjCNaQ09%}#T@V?Q^l5D0Qn>r>RCp*gm86nT=>X;&b6-&7(^VTwu4JTv^3 z+4Am*W*jp3<6T;*q5Q7Y8pQi6>jQAhhz{X!{sqyg$r7B)E7w?NJTP?--@G0VU;35K zEVLHSxSd3&;=(z~-y~i-Rsh+jMN;3W6DV^C*8h16bElK5^eh0JjP-kMf3PMhw1ejo zK$w0^U@C1K+-&f|X4goOWbVKcHk5UAl_2W0BsCFWkusv9d4F%QFeR6TgTV;v)_9Ge zyh1yU$r*TORg-am!BpG#MG`{dQ}5h4r_@46{pQfqosIT~P7N7nD??>trf}5+GZlM^ z`AKUx(Md}pr|T5ZPK>|`6%+v@o+ZJb8!7?UWW8m*RjddyGP8#iZ^>b>$$rhSsfhVq_0sd+W(x# zSATf*bw}mvCYf1o!^S;zG49_NciJts(e#jPw$Uy&8id?8{(DPbx}`hR9Z-5av3PM+ zGj4R|l=1y)IoNZJq+583%VFU?=5YZ|wJvzQeeqc8`G)r>kLXEVE8%G_@{oYIiAwe% z$HY9Gp~)<4Y048>QN0%4N=!TCbD&`98_<#D>3`;u#Zj>pL9nz$J5}_y2eBx2@p(U4 zGRuvI-T=jp>x-zOD17`bBm@F!O(D$K6gP1WuG_Mpka!r6dMqclr8!yFk=4sU}xoCtr;qF3MB*f`{F5r50BJ7kF=z02g z8HMVf-Fo4>w_HOmkb@rOoPk@FSnmkdgXTE)_@lVT74L4EGi|C3f4oiovm*ARy6aB? zZ2DQXY2%E#z{@TvoNUC$jNez&e|25X8DHDf;MdaI+B5q4UjHg{)5Y=v;)@JNIIs39 zZK6LRkk*mA@+#$vDlPg+UMlxXV@#OPREOT z?5KOM#8J{(Cua;=Rx*q3P-S+e+*4ByQAfhIXb%NYxLAAclaXr4Qe8FPw+ya>h?4Y- zS={y^EVE_#?1`WLoW8$`iKSgolB%~!3bBMURi=Xx5)ayIjln1IMLWv(+3;VNz-8it zy{o^drkWp9+w`IhgP_d?mmm|0u~!k0bg&0V0)3sjH!O+G(e;x>BP3sH{OQ^|YUCa+2y!+v<1EyV7tK z8=WE(y=5n5+w3(nRccr&IM*TxZ7cDg%T#Yb(hT&Y5^7P2?~IkvSY(-RGsU}_YIQp~ z(BV#ThSMDGV7pk`RNWN;Y;%eH#v#L8no3%iPeb6#;z!S0)rj&2V?c*Z%lBN|0Q?5!dpoihBLW z_5#)@N{?p=tudkVwrCRYh4j>z2i?Pp&b-t<0&Yr-+Kz^X26XQKZ7DdbL;cB=Qd3<` z)RUj%Dwxe~{0_M@BCtr^|jX9?vlMmaoRDA7^xYF`6#%(8&8E9zyT#RBC3R+}uV zZDhI3Zpy!e^7w?(z;5SAZv)*dp`fZ%(;odangN{}mg6YP$OIOmRP_c-TfKVqoH1Q0 z3IP9TTb6v!NT^y&^WK62V{i8_-6jg<@;y~lkNk#T2V8S=q1c0ROHsu?+Ng&T3snmUW>#s~nFgLTb(1 zwdc5-nCwCX@Ld)2h<8vyhjDPKZi>J!DgZt5EDrrymBgqKKw65yp}|`@IuH+m%6h2+ zUpG;@&H$&B4Q>hjyhCBobg^H4s>Cl*QCkBrF8CejU~3f$Y>xi*{(BaR_PbH=xDY~` zBftz-X+%;7yrdhzUqT4g05y9$7D8wrnmn)FV1>-O z0AvcGe%Qr>+6`LBEC+B*2%#vf??wO1DTG009Ka?agf#nrF)}~OA(-9ZSsej>6ha7} z0o>~imYhL2z$F0O6qNfV*rHP zluqvj0Am0=D{_qwLwo`7H7Z+%2LRm34M?=jlWr-%Pyp~quql@<#ti`eHX?veMO7mM z*#H3GoyICux;M}x2mvJ;R1@9_x%L6=9dA*f^Z?+TO=!1?f+}~|4TQL?rU2YRQml$% zPVfQFKcfh3g{&e%7bl^6e53%tEig92X0POrsgA?^+_EZ2Dnnu*@II(dXa`jj#Z7QF zFvu}pmJ{84!xMCRMzVJWiMq?dP)A6;Ij$rjq7p(~O7$WZ@eQF% z4c_%k$oGrwYNigzSKEJqa*sy+0N~CQj!N<;qeN%^Ic_}NJ5qU}|6mEWCh zUA~U1Ux6Dd3YiF?KVIIqd}5zw^*I~1>Eb$M?D7LQKLPC?XG5WJpEma{EKae1T%($( zRfUGR$H$g9TA-K9y(p6b@IxuH{J_5MF%}fA1IWDMS|b#2+&Z7R%TT36%_}1%B_+?N z01wN=5J?cVes=JRx1v}xKqm95?f{2ftcxNkg`%Ea6V8_tB@tpqxVt3oVLBEi^n^_2 zCIDU#b#GwUM^3zCh)i0fk1)5u*bEy=8wi=qaf12vr(9S?PKq69YgTGpbYx^?Y?3b9 zhSG;aCbNy8P5lX5fFW`+?Bu9%kjcyjbWCI=z3wl{dfy^tq0eT$}33PQhUogr- z24rpo(0@S+3=9VdCRxx!=47G&3n@@7Y%Ex0!3deXgf8<_Ak9%=uE5BG88T}N8m2&4 z0Q41XvS5YGR6t+SlHg5%$7KK*S+GH~9)Kw&B8hGa*UA7`WPySE0Zcxa22;XuG5{ut zGNZ$2Ux2^2-vhXXai%g-nc-5Q$A4+iHtZq;VBllpf8RT>V#Wy9mNiSNiR6VVH|jKS z!h%f~-ufGa7~wF%t7%Xu0alX%$j0;^=QmC2Rx=NA_)^UWFWP@Uz>27c?FE;mLD&t< zaJ{XQdRHONo~P;9%?DNx^htz8Bv|!C_`1A8l^S*&Fn<1O-g*5;u362!eERU7Eo+o; zkxqIdyx*F9bzP@zx%@FO#flD?5&iGsk)8O%#0+CL8T6SMI&Er-z%;E^n~|kAnHg3T;^*M& zROk_Qz-KdMX_FITBEy3GeLTSa?%sYup^>qPX_-bF$F1PWRA?MFWk^qo2@CXf2Pby- z4T?vOkp9X5I4x;>|^zxpR?LQpRi(j>sj_`cpgv|?QMdPRt%=C0gk$h>VA zUj5@46;w-wa1vMs!0%hzCbch3oHcI)&GOS90R{&}$#4i5YJHP+MgoUe-dI6?GVG#l zI~rh=+>v_gs=J{^$sMYP(yB^Nh6QDGJ2hbE=%tgtnD_j`+g84Or5PIx->b(3Et~7+ zzh2?()azB7>o(VYz3FT1UTgPi*XI7s{hNopI`M(o*IjnT{YSpu^u?ZkZoho9jT`J< z{_yluLyJ2r!C{e1oh5}7+vsDLXdzG3vUJsSGp*+>y+7{0q2rk%UQCBD!!f`~J8iVV mH?GrNwy0NW>KW@6-`FVuyelUmLcT8gs43E@Ku7)5677E3JrsTb From 7263881914971ce0fa4ea799ed9188e1634a8fd1 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 14:46:14 +0200 Subject: [PATCH 54/73] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 89f393cd6c..83cf99b897 100644 --- a/README.md +++ b/README.md @@ -66,10 +66,8 @@ git clone https://github.com/ethereum/remix-project.git * Build `remix-project`: ```bash cd remix-project -yarn install -yarn run build:libs // Build remix libs -nx build -nx serve +yarn +yarn run build ``` Open `http://127.0.0.1:8080` in your browser to load Remix IDE locally. From e0ce13dd9d6b4589f72345291ce859c72df5af84 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 9 Aug 2023 10:28:18 +0200 Subject: [PATCH 55/73] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 83cf99b897..64716e10e8 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,7 @@ git clone https://github.com/ethereum/remix-project.git cd remix-project yarn yarn run build +yarn serve ``` Open `http://127.0.0.1:8080` in your browser to load Remix IDE locally. From e8afd5c53d7dce21816a86dd71d29ef53e86195b Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Wed, 9 Aug 2023 11:59:34 +0200 Subject: [PATCH 56/73] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 64716e10e8..d2a0e3f634 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ git clone https://github.com/ethereum/remix-project.git ```bash cd remix-project yarn -yarn run build yarn serve ``` From d34a10c3ff5dc3f3036ac0a221b9553ab173d84b Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 11 Aug 2023 14:26:45 +0530 Subject: [PATCH 57/73] add instructions --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d2a0e3f634..e51158c244 100644 --- a/README.md +++ b/README.md @@ -63,12 +63,13 @@ yarn global add nx ```bash git clone https://github.com/ethereum/remix-project.git ``` -* Build `remix-project`: -```bash -cd remix-project -yarn -yarn serve -``` +* Build and Run `remix-project`: + +1. Move to project directory: `cd remix-project` +2. Install dependencies: `yarn install` or simply run `yarn` +3. Build Remix libraries: `yarn run build:libs` +3. Build Remix project: `yarn build` +4. Build and run project server: `yarn serve` Open `http://127.0.0.1:8080` in your browser to load Remix IDE locally. @@ -149,7 +150,7 @@ To run the Selenium tests via Nightwatch: - Install Selenium for the first time: `yarn run selenium-install` - Run a selenium server: `yarn run selenium` - - Build & Serve Remix: `nx serve` + - Build & Serve Remix: `yarn serve` - Run all the end-to-end tests: for Firefox: `yarn run nightwatch_local_firefox`, or From b20494c477165511f29605b9d98dd42b1f5b9a55 Mon Sep 17 00:00:00 2001 From: Aniket <30843294+Aniket-Engg@users.noreply.github.com> Date: Fri, 11 Aug 2023 14:51:13 +0530 Subject: [PATCH 58/73] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e51158c244..109d44caff 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,8 @@ git clone https://github.com/ethereum/remix-project.git 1. Move to project directory: `cd remix-project` 2. Install dependencies: `yarn install` or simply run `yarn` 3. Build Remix libraries: `yarn run build:libs` -3. Build Remix project: `yarn build` -4. Build and run project server: `yarn serve` +4. Build Remix project: `yarn build` +5. Build and run project server: `yarn serve`. Optionally, run `yarn serve:hot` to enable hot module reload for frontend updates. Open `http://127.0.0.1:8080` in your browser to load Remix IDE locally. From 1674a6bfe06a777baf7b4a2293733fafaeee6750 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 19:58:58 +0200 Subject: [PATCH 59/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/fr/home.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/fr/home.json b/apps/remix-ide/src/app/tabs/locales/fr/home.json index 8042b1bdfd..f11054c07c 100644 --- a/apps/remix-ide/src/app/tabs/locales/fr/home.json +++ b/apps/remix-ide/src/app/tabs/locales/fr/home.json @@ -6,9 +6,9 @@ "home.learnMore": "Learn more", "home.here": "here", "home.featured": "Featured", - "home.jumpIntoWeb3": "JUMP INTO WEB3", - "home.jumpIntoWeb3More": "More", - "home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.", + "home.jumpIntoWeb3": "WE NEED YOUR HELP", + "home.jumpIntoWeb3More": "Go to survey", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From 6175f4c6b27216e129315a53bce78e632cefc03d Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 20:01:39 +0200 Subject: [PATCH 60/73] Update homeTabFeatured.tsx --- libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx b/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx index c8de93004e..13a7f4fbb3 100644 --- a/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx +++ b/libs/remix-ui/home-tab/src/lib/components/homeTabFeatured.tsx @@ -47,7 +47,7 @@ function HomeTabFeatured() { className="remixui_home_text btn-sm btn-secondary mt-2 text-decoration-none mb-3" onClick={() => _paq.push(['trackEvent', 'hometab', 'featuredSection', 'jumpIntoWeb3'])} target="__blank" - href="https://remix-project.org" + href="https://us8.list-manage.com/survey?u=5a84beb6d688fe180c0da482a&id=1148d10f8c" > From 72df5da1839c05ed541b916ff3e79fb2be31219b Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 20:03:45 +0200 Subject: [PATCH 61/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/es/home.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/es/home.json b/apps/remix-ide/src/app/tabs/locales/es/home.json index 8042b1bdfd..44a6a87926 100644 --- a/apps/remix-ide/src/app/tabs/locales/es/home.json +++ b/apps/remix-ide/src/app/tabs/locales/es/home.json @@ -6,10 +6,9 @@ "home.learnMore": "Learn more", "home.here": "here", "home.featured": "Featured", - "home.jumpIntoWeb3": "JUMP INTO WEB3", - "home.jumpIntoWeb3More": "More", - "home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.", - "home.remixYouTube": "WATCH TO LEARN", + "home.jumpIntoWeb3": "WE NEED YOUR HELP", + "home.jumpIntoWeb3More": "Go to survey", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.","home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", "home.remixYouTubeText2": "Remix has a growing library of videos containing lots of tips for using the tool. Check them out and subscribe to get our latest uploads.", From d2b60f69cef5fa0f055d04628502d2a5884bdb0a Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 20:05:15 +0200 Subject: [PATCH 62/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/fr/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/fr/home.json b/apps/remix-ide/src/app/tabs/locales/fr/home.json index f11054c07c..5966290b70 100644 --- a/apps/remix-ide/src/app/tabs/locales/fr/home.json +++ b/apps/remix-ide/src/app/tabs/locales/fr/home.json @@ -8,7 +8,7 @@ "home.featured": "Featured", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.","home.remixYouTube": "WATCH TO LEARN", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From 013cdff5f2f78ba6134bc9efa592fdeb0d045e88 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 20:05:38 +0200 Subject: [PATCH 63/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/es/home.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/es/home.json b/apps/remix-ide/src/app/tabs/locales/es/home.json index 44a6a87926..f11054c07c 100644 --- a/apps/remix-ide/src/app/tabs/locales/es/home.json +++ b/apps/remix-ide/src/app/tabs/locales/es/home.json @@ -8,7 +8,8 @@ "home.featured": "Featured", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.","home.remixYouTube": "WATCH TO LEARN", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", + "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", "home.remixYouTubeText2": "Remix has a growing library of videos containing lots of tips for using the tool. Check them out and subscribe to get our latest uploads.", From ddd6f5e6ad58a6bc695527fea1aafe9578ae6ae1 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 20:07:23 +0200 Subject: [PATCH 64/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/zh/home.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/zh/home.json b/apps/remix-ide/src/app/tabs/locales/zh/home.json index ac00d8dce2..3665bc412c 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/home.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/home.json @@ -6,9 +6,9 @@ "home.learnMore": "了解更多", "home.here": "这里", "home.featured": "精选", - "home.jumpIntoWeb3": "迎接 WEB3", - "home.jumpIntoWeb3More": "More", - "home.jumpIntoWeb3Text": "Remix 项目是一个丰富的工具集,任何知识水平的用户都可以在这上面进行全周期的合约开发,并且可作为以太坊教学和实验的学习实验室。", + "home.jumpIntoWeb3": "WE NEED YOUR HELP", + "home.jumpIntoWeb3More": "Go to survey", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", "home.remixYouTube": "观看学习", "home.remixYouTubeText1": "来自 Remix 团队的视频小贴士", "home.remixYouTubeMore": "观看", From 3f8ea8eab573b927c5d2d6650258207a4d8981a1 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 7 Aug 2023 20:38:16 +0200 Subject: [PATCH 65/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/en/home.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/home.json b/apps/remix-ide/src/app/tabs/locales/en/home.json index 4705465988..38fd3b93e3 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/home.json +++ b/apps/remix-ide/src/app/tabs/locales/en/home.json @@ -6,9 +6,9 @@ "home.learnMore": "Learn more", "home.here": "here", "home.featured": "Featured", - "home.jumpIntoWeb3": "JUMP INTO WEB3", - "home.jumpIntoWeb3More": "More", - "home.jumpIntoWeb3Text": "Remix IDE is part of the Remix Project, a rich toolset that can be used for the entire journey of contract development by users of any knowledge level. Learn more on the Remix Project website.", + "home.jumpIntoWeb3": "WE NEED YOUR HELP", + "home.jumpIntoWeb3More": "Go to survey", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From dca2151d36f3c9fc56662adba5d2185c4c0979ce Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 11 Aug 2023 11:19:32 +0200 Subject: [PATCH 66/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/fr/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/fr/home.json b/apps/remix-ide/src/app/tabs/locales/fr/home.json index 5966290b70..f11054c07c 100644 --- a/apps/remix-ide/src/app/tabs/locales/fr/home.json +++ b/apps/remix-ide/src/app/tabs/locales/fr/home.json @@ -8,7 +8,7 @@ "home.featured": "Featured", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.","home.remixYouTube": "WATCH TO LEARN", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From 8516b2ee56035c920d8a87d3e9034930723cf60f Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 11 Aug 2023 11:20:14 +0200 Subject: [PATCH 67/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/en/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/en/home.json b/apps/remix-ide/src/app/tabs/locales/en/home.json index 38fd3b93e3..bd6389cb30 100644 --- a/apps/remix-ide/src/app/tabs/locales/en/home.json +++ b/apps/remix-ide/src/app/tabs/locales/en/home.json @@ -8,7 +8,7 @@ "home.featured": "Featured", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix experience with this one-minute survey.", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From d86d0c2a3da58bade96b26131a7c6620e7afc7b6 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 11 Aug 2023 11:20:44 +0200 Subject: [PATCH 68/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/es/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/es/home.json b/apps/remix-ide/src/app/tabs/locales/es/home.json index f11054c07c..802d22bef4 100644 --- a/apps/remix-ide/src/app/tabs/locales/es/home.json +++ b/apps/remix-ide/src/app/tabs/locales/es/home.json @@ -8,7 +8,7 @@ "home.featured": "Featured", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix experience with this one-minute survey.", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From ed7465c0139bc4d2f4133dfce988b71e669da138 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 11 Aug 2023 11:21:11 +0200 Subject: [PATCH 69/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/fr/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/fr/home.json b/apps/remix-ide/src/app/tabs/locales/fr/home.json index f11054c07c..802d22bef4 100644 --- a/apps/remix-ide/src/app/tabs/locales/fr/home.json +++ b/apps/remix-ide/src/app/tabs/locales/fr/home.json @@ -8,7 +8,7 @@ "home.featured": "Featured", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix experience with this one-minute survey.", "home.remixYouTube": "WATCH TO LEARN", "home.remixYouTubeText1": "Video Tips from the Remix Team", "home.remixYouTubeMore": "Watch", From e2b52010000b9c4af7db766b56fd4c033c48b743 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Fri, 11 Aug 2023 11:21:39 +0200 Subject: [PATCH 70/73] Update home.json --- apps/remix-ide/src/app/tabs/locales/zh/home.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/locales/zh/home.json b/apps/remix-ide/src/app/tabs/locales/zh/home.json index 3665bc412c..17ad8bb36c 100644 --- a/apps/remix-ide/src/app/tabs/locales/zh/home.json +++ b/apps/remix-ide/src/app/tabs/locales/zh/home.json @@ -8,7 +8,7 @@ "home.featured": "精选", "home.jumpIntoWeb3": "WE NEED YOUR HELP", "home.jumpIntoWeb3More": "Go to survey", - "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix UX with this one-minute survey.", + "home.jumpIntoWeb3Text": "Remixers... Have a spare moment? Please help us improve your Remix experience with this one-minute survey.", "home.remixYouTube": "观看学习", "home.remixYouTubeText1": "来自 Remix 团队的视频小贴士", "home.remixYouTubeMore": "观看", From 47dbe143f0f8e77d20247f166ace3baf3adb67aa Mon Sep 17 00:00:00 2001 From: drafish Date: Sat, 12 Aug 2023 13:10:30 +0800 Subject: [PATCH 71/73] fix issue 3985 --- libs/remix-ui/terminal/src/lib/components/RenderCall.tsx | 2 +- .../terminal/src/lib/components/RenderKnownTransactions.tsx | 2 +- .../terminal/src/lib/components/RenderUnknownTransactions.tsx | 2 +- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx b/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx index 5c39b8f32d..8b9d445ea9 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderCall.tsx @@ -15,7 +15,7 @@ const RenderCall = ({ tx, resolvedData, logs, index, plugin, showTableHash, txDe const debug = (event, tx) => { event.stopPropagation() if (tx.isCall && !tx.envMode.startsWith('vm')) { - modal('VM mode', 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', 'Ok', true, () => {}, 'Cancel', () => {}) + modal('VM mode', 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', 'Ok', false, () => {}, 'Cancel', () => {}) } else { plugin.event.trigger('debuggingRequested', [tx.hash]) } diff --git a/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx b/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx index e239b035d7..9a1453e15e 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderKnownTransactions.tsx @@ -11,7 +11,7 @@ const RenderKnownTransactions = ({ tx, receipt, resolvedData, logs, index, plugi const debug = (event, tx) => { event.stopPropagation() if (tx.isCall && !tx.envMode.startsWith('vm')) { - modal('VM mode', 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', 'Ok', true, () => {}, 'Cancel', () => {}) + modal('VM mode', 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', 'Ok', false, () => {}, 'Cancel', () => {}) } else { plugin.event.trigger('debuggingRequested', [tx.hash]) } diff --git a/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx b/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx index 4acf14ecbe..6aef5b8bc3 100644 --- a/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx +++ b/libs/remix-ui/terminal/src/lib/components/RenderUnknownTransactions.tsx @@ -8,7 +8,7 @@ const RenderUnKnownTransactions = ({ tx, receipt, index, plugin, showTableHash, const debug = (event, tx) => { event.stopPropagation() if (tx.isCall && !tx.envMode.startsWith('vm')) { - modal('VM mode', 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', 'Ok', true, () => {}, 'Cancel', () => {}) + modal('VM mode', 'Cannot debug this call. Debugging calls is only possible in Remix VM mode.', 'Ok', false, () => {}, 'Cancel', () => {}) } else { plugin.event.trigger('debuggingRequested', [tx.hash]) } 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 5aaf78ef45..0712c1b888 100644 --- a/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx +++ b/libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx @@ -371,7 +371,7 @@ export const RemixUiTerminal = (props: RemixUiTerminalProps) => { } const modal = (title: string, message: string, okLabel: string, hide: boolean, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { - setModalState(prevState => ({ ...prevState, message, okLabel, okFn, cancelLabel, cancelFn, hide })) + setModalState(prevState => ({ ...prevState, title, message, okLabel, okFn, cancelLabel, cancelFn, hide })) } const handleHideModal = () => { From c936191e2b0c0605eb69e9c795114574b197bb91 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 14 Aug 2023 14:26:50 +0530 Subject: [PATCH 72/73] added doc link for search plugin --- apps/remix-ide/src/app/tabs/search.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/tabs/search.tsx b/apps/remix-ide/src/app/tabs/search.tsx index e742281d3e..b809335981 100644 --- a/apps/remix-ide/src/app/tabs/search.tsx +++ b/apps/remix-ide/src/app/tabs/search.tsx @@ -11,7 +11,7 @@ const profile = { description: 'Find and replace in file explorer', kind: '', location: 'sidePanel', - documentation: '', + documentation: 'https://remix-ide.readthedocs.io/en/latest/search_in_fe.html', version: packageJson.version, maintainedBy: 'Remix' } From 64a510bb57ee3b13bc6504b5f58c3493e86a51e2 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 14 Aug 2023 09:53:45 +0200 Subject: [PATCH 73/73] Update remix-ui-workspace.tsx --- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 593fdf8736..51d0bb2254 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -680,7 +680,7 @@ export function Workspace () { handleContextMenu(e.pageX, e.pageY, ROOT_PATH, "workspace", 'workspace') } }> -
+
@@ -972,4 +972,4 @@ export function Workspace () { ) } -export default Workspace \ No newline at end of file +export default Workspace