Merge branch 'ethdoc-plugin' of https://github.com/ethereum/remix-project into testethdoc

pull/3542/head
filip mertens 2 years ago
commit f4413dc7a2
  1. 4
      apps/remix-ide-e2e/src/commands/verifyContracts.ts
  2. 3
      libs/remix-ui/editor/src/lib/remix-ui-editor.tsx
  3. 1
      libs/remix-ui/editor/src/lib/syntaxes/solidity.ts
  4. 3
      libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx
  5. 1
      libs/remix-ui/modal-dialog/src/lib/types/index.ts
  6. 14
      libs/remix-ui/renderer/src/lib/renderer.css
  7. 5
      libs/remix-ui/renderer/src/lib/renderer.tsx
  8. 2
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  9. 10
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx
  10. 7
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  11. 4
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts
  12. 17
      libs/remix-ui/workspace/src/lib/utils/constants.ts

@ -31,7 +31,7 @@ function verifyContracts (browser: NightwatchBrowser, compiledContractNames: str
.click('*[data-id="treeViewDivtreeViewItemcompiler"]') .click('*[data-id="treeViewDivtreeViewItemcompiler"]')
.waitForElementVisible('*[data-id="treeViewLiversion"]') .waitForElementVisible('*[data-id="treeViewLiversion"]')
.assert.containsText('*[data-id="treeViewLiversion"]', `${opts.version}`) .assert.containsText('*[data-id="treeViewLiversion"]', `${opts.version}`)
.click('[data-id="workspacesModalDialog-modal-footer-ok-react"]') .click('[data-id="workspacesModalDialog-modal-footer-cancel-react"]')
.perform(() => { .perform(() => {
done() done()
callback() callback()
@ -49,7 +49,7 @@ function verifyContracts (browser: NightwatchBrowser, compiledContractNames: str
.click('*[data-id="treeViewDivtreeViewItemoptimizer"]') .click('*[data-id="treeViewDivtreeViewItemoptimizer"]')
.waitForElementVisible('*[data-id="treeViewDivruns"]') .waitForElementVisible('*[data-id="treeViewDivruns"]')
.assert.containsText('*[data-id="treeViewDivruns"]', `${opts.runs}`) .assert.containsText('*[data-id="treeViewDivruns"]', `${opts.runs}`)
.click('[data-id="workspacesModalDialog-modal-footer-ok-react"]') .click('[data-id="workspacesModalDialog-modal-footer-cancel-react"]')
.perform(() => { .perform(() => {
done() done()
callback() callback()

@ -12,8 +12,6 @@ import { monacoTypes } from '@remix-ui/editor';
import './remix-ui-editor.css' import './remix-ui-editor.css'
import { loadTypes } from './web-types' import { loadTypes } from './web-types'
import { RemixHoverProvider } from './providers/hoverProvider' import { RemixHoverProvider } from './providers/hoverProvider'
import { RemixReferenceProvider } from './providers/referenceProvider' import { RemixReferenceProvider } from './providers/referenceProvider'
import { RemixCompletionProvider } from './providers/completionProvider' import { RemixCompletionProvider } from './providers/completionProvider'
@ -262,6 +260,7 @@ export const EditorUI = (props: EditorUIProps) => {
{ token: 'keyword.continue', foreground: warningColor }, { token: 'keyword.continue', foreground: warningColor },
{ token: 'keyword.while', foreground: warningColor }, { token: 'keyword.while', foreground: warningColor },
{ token: 'keyword.do', foreground: warningColor }, { token: 'keyword.do', foreground: warningColor },
{ token: 'keyword.delete', foreground: warningColor },
{ token: 'keyword.if', foreground: yellowColor }, { token: 'keyword.if', foreground: yellowColor },
{ token: 'keyword.else', foreground: yellowColor }, { token: 'keyword.else', foreground: yellowColor },

@ -1266,6 +1266,7 @@ export const solidityTokensProvider = {
'constant', 'constant',
'fallback', 'fallback',
'receive', 'receive',
'delete',
'if', 'if',
'else', 'else',
'for', 'for',

@ -103,7 +103,8 @@ export const ModalDialog = (props: ModalDialogProps) => {
onClick={() => { onClick={() => {
if (props.validation && !props.validation.valid) return if (props.validation && !props.validation.valid) return
if (props.okFn) props.okFn() if (props.okFn) props.okFn()
handleHide() if (props.donotHideOnOkClick) calledHideFunctionOnce.current = false
else handleHide()
}} }}
> >
{props.okLabel ? props.okLabel : 'OK'} {props.okLabel ? props.okLabel : 'OK'}

@ -13,6 +13,7 @@ export interface ModalDialogProps {
message?: string | JSX.Element, message?: string | JSX.Element,
okLabel?: string | JSX.Element, okLabel?: string | JSX.Element,
okFn?: (value?:any) => void, okFn?: (value?:any) => void,
donotHideOnOkClick?: boolean,
cancelLabel?: string | JSX.Element, cancelLabel?: string | JSX.Element,
cancelFn?: () => void, cancelFn?: () => void,
modalClass?: string, modalClass?: string,

@ -37,12 +37,10 @@
padding: 0.5em; padding: 0.5em;
} }
.remixui_sol.error { .remixui_sol.success a,
} .remixui_sol.error a,
.remixui_sol.warning a {
.remixui_sol.warning { position: absolute;
} bottom: 0;
right: 0;
.remixui_sol.success {
/* background-color: // styles.rightPanel.message_Success_BackgroundColor; */
} }

@ -1,4 +1,5 @@
import React, { useEffect, useState } from 'react' //eslint-disable-line import React, { useEffect, useState } from 'react' //eslint-disable-line
import { CopyToClipboard } from '@remix-ui/clipboard'
import { helper } from '@remix-project/remix-solidity' import { helper } from '@remix-project/remix-solidity'
import './renderer.css' import './renderer.css'
interface RendererProps { interface RendererProps {
@ -77,7 +78,9 @@ export const Renderer = ({ message, opt = {}, plugin }: RendererProps) => {
<div className="close" data-id="renderer" onClick={handleClose}> <div className="close" data-id="renderer" onClick={handleClose}>
<i className="fas fa-times"></i> <i className="fas fa-times"></i>
</div> </div>
</div>) <CopyToClipboard content={messageText} className={` p-0 m-0 far fa-copy ${classList}`} direction={"top"} />
</div>
)
} }
</> </>
) )

@ -281,6 +281,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
'New configuration file', `The file "${configFilePathInput.current.value}" you entered does not exist. Do you want to create a new one?`, 'New configuration file', `The file "${configFilePathInput.current.value}" you entered does not exist. Do you want to create a new one?`,
'Create', 'Create',
async () => await createNewConfigFile(), async () => await createNewConfigFile(),
false,
'Cancel', 'Cancel',
() => { () => {
setShowFilePathInput(false) setShowFilePathInput(false)
@ -580,6 +581,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
promptMessage('URL'), promptMessage('URL'),
'OK', 'OK',
addCustomCompiler, addCustomCompiler,
false,
'Cancel', 'Cancel',
() => {} () => {}
) )

@ -4,9 +4,11 @@ import { ContractSelectionProps } from './types'
import { PublishToStorage } from '@remix-ui/publish-to-storage' // eslint-disable-line import { PublishToStorage } from '@remix-ui/publish-to-storage' // eslint-disable-line
import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-disable-line import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-disable-line
import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line
import { saveAs } from 'file-saver'
import './css/style.css' import './css/style.css'
import { CustomTooltip } from '@remix-ui/helper' import { CustomTooltip } from '@remix-ui/helper'
const _paq = window._paq = window._paq || []
export const ContractSelection = (props: ContractSelectionProps) => { export const ContractSelection = (props: ContractSelectionProps) => {
const { api, compiledFileName, contractsDetails, contractList, compilerInput, modal } = props const { api, compiledFileName, contractsDetails, contractList, compilerInput, modal } = props
@ -141,6 +143,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
} }
const details = () => { const details = () => {
_paq.push(['trackEvent', 'compiler', 'compilerDetails', 'display'])
if (!selectedContract) throw new Error('No contract compiled yet') if (!selectedContract) throw new Error('No contract compiled yet')
const help = { const help = {
@ -183,8 +186,11 @@ export const ContractSelection = (props: ContractSelectionProps) => {
} }
</TreeView> </TreeView>
</div> </div>
const downloadFn = () => {
modal(selectedContract, log, 'Close', null) _paq.push(['trackEvent', 'compiler', 'compilerDetails', 'download'])
saveAs(new Blob([JSON.stringify(contractProperties, null, '\t')]), `${selectedContract}_compData.json`)
}
modal(selectedContract, log, 'Download', downloadFn, true, 'Close', null)
} }
const copyBytecode = () => { const copyBytecode = () => {

@ -27,6 +27,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
message: null, message: null,
okLabel: '', okLabel: '',
okFn: () => { }, okFn: () => { },
donotHideOnOkClick: false,
cancelLabel: '', cancelLabel: '',
cancelFn: () => { }, cancelFn: () => { },
handleHide: null handleHide: null
@ -131,7 +132,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
api.setCompilerParameters({ version: value }) api.setCompilerParameters({ version: value })
} }
const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, donotHideOnOkClick: boolean, cancelLabel?: string, cancelFn?: () => void) => {
await setState(prevState => { await setState(prevState => {
return { return {
...prevState, ...prevState,
@ -142,6 +143,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
title, title,
okLabel, okLabel,
okFn, okFn,
donotHideOnOkClick,
cancelLabel, cancelLabel,
cancelFn cancelFn
} }
@ -190,7 +192,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
<> <>
<span data-id={`compilationFinishedWith_${currentVersion}`}></span> <span data-id={`compilationFinishedWith_${currentVersion}`}></span>
{compileErrors[currentFile].error && <Renderer message={compileErrors[currentFile].error.formattedMessage || compileErrors[currentFile].error} plugin={api} opt={{ type: compileErrors[currentFile].error.severity || 'error', errorType: compileErrors[currentFile].error.type }} />} {compileErrors[currentFile].error && <Renderer message={compileErrors[currentFile].error.formattedMessage || compileErrors[currentFile].error} plugin={api} opt={{ type: compileErrors[currentFile].error.severity || 'error', errorType: compileErrors[currentFile].error.type }} />}
{compileErrors[currentFile].error && (compileErrors[currentFile].error.mode === 'panic') && modal('Error', panicMessage(compileErrors[currentFile].error.formattedMessage), 'Close', null)} {compileErrors[currentFile].error && (compileErrors[currentFile].error.mode === 'panic') && modal('Error', panicMessage(compileErrors[currentFile].error.formattedMessage), 'Close', null, false)}
{compileErrors[currentFile].errors && compileErrors[currentFile].errors.length && compileErrors[currentFile].errors.map((err, index) => { {compileErrors[currentFile].errors && compileErrors[currentFile].errors.length && compileErrors[currentFile].errors.map((err, index) => {
if (hideWarnings) { if (hideWarnings) {
if (err.severity !== 'warning') { if (err.severity !== 'warning') {
@ -212,6 +214,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
hide={state.modal.hide} hide={state.modal.hide}
okLabel={state.modal.okLabel} okLabel={state.modal.okLabel}
okFn={state.modal.okFn} okFn={state.modal.okFn}
donotHideOnOkClick={state.modal.donotHideOnOkClick}
cancelLabel={state.modal.cancelLabel} cancelLabel={state.modal.cancelLabel}
cancelFn={state.modal.cancelFn} cancelFn={state.modal.cancelFn}
handleHide={handleHideModal}> handleHide={handleHideModal}>

@ -14,7 +14,7 @@ export interface CompilerContainerProps {
isFoundryProject: boolean, isFoundryProject: boolean,
workspaceName: string, workspaceName: string,
tooltip: (message: string | JSX.Element) => void, tooltip: (message: string | JSX.Element) => void,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, donotHideOnOkClick?: boolean, cancelLabel?: string, cancelFn?: () => void) => void,
compiledFileName: string, compiledFileName: string,
updateCurrentVersion: any, updateCurrentVersion: any,
configurationSettings: ConfigurationSettings, configurationSettings: ConfigurationSettings,
@ -26,7 +26,7 @@ export interface ContractSelectionProps {
compiledFileName: string, compiledFileName: string,
contractList: { file: string, name: string }[], contractList: { file: string, name: string }[],
compilerInput: Record<string, any> compilerInput: Record<string, any>
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, donotHideOnOkClick?: boolean, cancelLabel?: string, cancelFn?: () => void) => void,
contractsDetails: Record<string, any> contractsDetails: Record<string, any>
} }

@ -11,10 +11,17 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run SUT Action - name: Run SUT Action
uses: EthereumRemix/sol-test@v1 uses: EthereumRemix/sol-test@v1.1
with: with:
test-path: 'tests' test-path: 'tests'
compiler-version: '0.8.15' compiler-version: '0.8.15'
// evm-version: 'paris'
// optimize: true
// optimizer-runs: 200
// node-url: 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
// block-number: 'latest'
// hard-fork: 'merge'
` `
export const tsSolTestYml = ` export const tsSolTestYml = `
name: Running Mocha Chai Solidity Unit Tests name: Running Mocha Chai Solidity Unit Tests
@ -28,11 +35,17 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run Mocha Chai Unit Test Action - name: Run Mocha Chai Unit Test Action
uses: EthereumRemix/ts-sol-test@v1.2 uses: EthereumRemix/ts-sol-test@v1.3.1
with: with:
test-path: 'tests' test-path: 'tests'
contract-path: 'contracts' contract-path: 'contracts'
compiler-version: '0.8.7' compiler-version: '0.8.7'
// evm-version: 'paris'
// optimize: true
// optimizer-runs: 200
// node-url: 'https://mainnet.infura.io/v3/08b2a484451e4635a28b3d8234f24332'
// block-number: 'latest'
// hard-fork: 'merge'
` `
export const slitherYml = ` export const slitherYml = `
name: Slither Analysis name: Slither Analysis

Loading…
Cancel
Save