unwanted changes removed

pull/2620/head
Seth Samuel 2 years ago
parent 919f4912e8
commit bdb23bb27b
  1. 13
      apps/etherscan/src/app/app.tsx
  2. 3
      apps/etherscan/src/app/components/HeaderWithSettings.tsx
  3. 13
      apps/etherscan/src/app/components/SubmitButton.tsx
  4. 8
      apps/etherscan/src/app/hooks/useLocalStorage.tsx
  5. 4
      apps/etherscan/src/app/routes.tsx
  6. 10
      apps/etherscan/src/app/utils/utilities.ts
  7. 4
      apps/etherscan/src/app/views/CaptureKeyView.tsx
  8. 4
      apps/etherscan/src/app/views/ErrorView.tsx
  9. 12
      apps/etherscan/src/app/views/VerifyView.tsx
  10. 125
      apps/remix-ide-e2e/src/tests/file_decorator.test.ts
  11. 2
      jest.config.js
  12. 2
      libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx
  13. 2
      libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-custom-icon.tsx
  14. 2
      libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-error-icon.tsx
  15. 6
      libs/remix-ui/file-decorators/src/lib/components/filedecorationicons/file-decoration-tooltip.tsx
  16. 6
      libs/remix-ui/file-decorators/src/lib/helper/index.tsx
  17. 5
      libs/remix-ui/file-decorators/src/lib/types/index.ts
  18. 136
      tsconfig.base.json

@ -43,20 +43,11 @@ const App = () => {
contractsRef.current = contracts
useEffect(() => {
<<<<<<< HEAD
=======
console.log("Remix Etherscan loading...")
>>>>>>> e02014ca4 (add etherscan plugin)
const client = new PluginClient()
createClient(client)
const loadClient = async () => {
await client.onload()
setClientInstance(client)
<<<<<<< HEAD
=======
console.log("Remix Etherscan Plugin has been loaded")
>>>>>>> e02014ca4 (add etherscan plugin)
client.on("solidity",
"compilationFinished",
(
@ -65,10 +56,6 @@ const App = () => {
languageVersion: string,
data: CompilationResult
) => {
<<<<<<< HEAD
=======
console.log("New compilation received")
>>>>>>> e02014ca4 (add etherscan plugin)
const newContractsNames = getNewContractNames(data)
const newContractsToSave: string[] = [

@ -18,10 +18,7 @@ interface IconProps {
const HomeIcon: React.FC<IconProps> = ({ from, themeType }: IconProps) => {
return (
<NavLink
<<<<<<< HEAD
data-id="home"
=======
>>>>>>> e02014ca4 (add etherscan plugin)
data-toggle="tooltip"
data-placement="top"
title="Home"

@ -3,26 +3,17 @@ import React from "react"
interface Props {
text: string
isSubmitting?: boolean
<<<<<<< HEAD
dataId?: string
=======
>>>>>>> e02014ca4 (add etherscan plugin)
}
export const SubmitButton: React.FC<Props> = ({
text,
<<<<<<< HEAD
dataId,
=======
>>>>>>> e02014ca4 (add etherscan plugin)
isSubmitting = false,
}) => {
return (
<button
<<<<<<< HEAD
data-id={dataId}
=======
>>>>>>> e02014ca4 (add etherscan plugin)
style={{ padding: "0.25rem 0.4rem", marginRight: "0.5em" }}
type="submit"
className="btn btn-primary"
@ -38,11 +29,7 @@ export const SubmitButton: React.FC<Props> = ({
aria-hidden="true"
style={{ marginRight: "0.3em" }}
/>
<<<<<<< HEAD
Verifying... Please wait
=======
Verifying...Please wait
>>>>>>> e02014ca4 (add etherscan plugin)
</div>
)}
</button>

@ -11,11 +11,7 @@ export function useLocalStorage(key: string, initialValue: any) {
return item ? JSON.parse(item) : initialValue
} catch (error) {
// If error also return initialValue
<<<<<<< HEAD
console.error(error)
=======
console.log(error)
>>>>>>> e02014ca4 (add etherscan plugin)
return initialValue
}
})
@ -33,11 +29,7 @@ export function useLocalStorage(key: string, initialValue: any) {
window.localStorage.setItem(key, JSON.stringify(valueToStore))
} catch (error) {
// A more advanced implementation would handle the error case
<<<<<<< HEAD
console.error(error)
=======
console.log(error)
>>>>>>> e02014ca4 (add etherscan plugin)
}
}

@ -1,10 +1,6 @@
import React from "react"
import {
<<<<<<< HEAD
HashRouter as Router,
=======
BrowserRouter as Router,
>>>>>>> e02014ca4 (add etherscan plugin)
Route,
Routes,
RouteProps,

@ -13,13 +13,7 @@ export const getNetworkName = async (client: RemixClient) => {
if (!network) {
throw new Error("no known network to verify against")
}
<<<<<<< HEAD
return network.name!.toLowerCase()
=======
const name = network.name!.toLowerCase()
// TODO : remove that when https://github.com/ethereum/remix-ide/issues/2017 is fixe
return name === "görli" ? "goerli" : name
>>>>>>> e02014ca4 (add etherscan plugin)
}
export const getReceiptStatus = async (
@ -33,10 +27,6 @@ export const getReceiptStatus = async (
const { result } = response.data
return result
} catch (error) {
<<<<<<< HEAD
console.error(error)
=======
console.log("Error", error)
>>>>>>> e02014ca4 (add etherscan plugin)
}
}

@ -48,11 +48,7 @@ export const CaptureKeyView: React.FC = () => {
</div>
<div>
<<<<<<< HEAD
<SubmitButton text="Save API key" dataId="save-api-key" />
=======
<SubmitButton text="Save API key" />
>>>>>>> e02014ca4 (add etherscan plugin)
</div>
</form>
)}

@ -21,11 +21,7 @@ export const ErrorView: React.FC = () => {
Please raise an issue:{" "}
<a
style={{ color: "red" }}
<<<<<<< HEAD
href="https://github.com/ethereum/remix-project/issues"
=======
href="https://github.com/machinalabs/remix-etherscan/issues"
>>>>>>> e02014ca4 (add etherscan plugin)
>
Here
</a>

@ -170,11 +170,7 @@ export const VerifyView: React.FC<Props> = ({
}
return result
} catch (error) {
<<<<<<< HEAD
console.error(error)
=======
console.log("Error, something wrong happened", error)
>>>>>>> e02014ca4 (add etherscan plugin)
setResults("Something wrong happened, try again")
}
}
@ -288,20 +284,12 @@ export const VerifyView: React.FC<Props> = ({
/>
</div>
<<<<<<< HEAD
<SubmitButton dataId="verify-contract" text="Verify Contract" isSubmitting={isSubmitting} />
=======
<SubmitButton text="Verify Contract" isSubmitting={isSubmitting} />
>>>>>>> e02014ca4 (add etherscan plugin)
</form>
)}
</Formik>
<<<<<<< HEAD
<div data-id="verify-result"
=======
<div
>>>>>>> e02014ca4 (add etherscan plugin)
style={{ marginTop: "2em", fontSize: "0.8em", textAlign: "center" }}
dangerouslySetInnerHTML={{ __html: results }}
/>

@ -0,0 +1,125 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'Test decorators with script': function (browser: NightwatchBrowser) {
browser
.openFile('contracts')
.openFile('contracts/2_Owner.sol')
.openFile('contracts/1_Storage.sol')
.openFile('contracts/3_Ballot.sol')
.addFile('scripts/decorators.ts', { content: testScriptSet })
.pause(2000)
.executeScriptInTerminal('remix.exeCurrent()')
.pause(4000)
.useXpath()
.waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2')
.waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', '2')
.waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-custom-contracts/2_Owner.sol"]', 'U')
.waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-custom-contracts/2_Owner.sol"]', 'U')
.waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-warning-contracts/1_Storage.sol"]', '2')
.waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-warning-contracts/1_Storage.sol"]', '2')
.waitForElementContainsText('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 'customtext')
.waitForElementContainsText('//*[@class="mainview"]//*[@data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 'customtext')
.moveToElement('//*[@id="fileExplorerView"]//*[@data-id="file-decoration-error-contracts/2_Owner.sol"]', 0, 0)
.waitForElementVisible('//*[@id="error-tooltip-contracts/2_Owner.sol"]')
.waitForElementContainsText('//*[@id="error-tooltip-contracts/2_Owner.sol"]', 'error on owner')
},
'clear ballot decorator': function (browser: NightwatchBrowser) {
browser
.useCss()
.addFile('scripts/clearballot.ts', { content: testScriptClearBallot })
.pause(2000)
.executeScriptInTerminal('remix.exeCurrent()')
.pause(4000)
.waitForElementNotPresent('[data-id="file-decoration-custom-contracts/3_Ballot.sol"]', 10000)
},
'clear all decorators': function (browser: NightwatchBrowser) {
browser
.addFile('scripts/clearall.ts', { content: testScriptClear })
.pause(2000)
.executeScriptInTerminal('remix.exeCurrent()')
.pause(4000)
.waitForElementNotPresent('[data-id="file-decoration-error-contracts/2_Owner.sol"]', 10000)
.waitForElementNotPresent('[data-id="file-decoration-warning-contracts/1_Storage.sol"]', 10000)
}
}
const testScriptSet = `
(async () => {
remix.call('fileDecorator' as any, 'clearFileDecorators')
let decorator: any = {
path: 'contracts/2_Owner.sol',
isDirectory: false,
fileStateType: 'ERROR',
fileStateLabelClass: 'text-danger',
fileStateIconClass: '',
fileStateIcon: '',
text: '2',
bubble: true,
comment: 'error on owner',
}
let decorator2: any = {
path: 'contracts/2_Owner.sol',
isDirectory: false,
fileStateType: 'CUSTOM',
fileStateLabelClass: 'text-success',
fileStateIconClass: 'text-success',
fileStateIcon: 'U',
text: '',
bubble: true,
comment: 'modified',
}
await remix.call('fileDecorator' as any, 'setFileDecorators', [decorator, decorator2])
decorator = {
path: 'contracts/1_Storage.sol',
isDirectory: false,
fileStateType: 'WARNING',
fileStateLabelClass: 'text-warning',
fileStateIconClass: '',
fileStateIcon: '',
text: '2',
bubble: true,
comment: 'warning on storage',
}
await remix.call('fileDecorator' as any, 'setFileDecorators', decorator)
decorator = {
path: 'contracts/3_Ballot.sol',
isDirectory: false,
fileStateType: 'CUSTOM',
fileStateLabelClass: '',
fileStateIconClass: '',
fileStateIcon: 'customtext',
text: 'with text',
bubble: true,
comment: 'custom comment',
}
await remix.call('fileDecorator' as any, 'setFileDecorators', decorator)
})()`
const testScriptClearBallot = `
(async () => {
await remix.call('fileDecorator' as any, 'clearFileDecorators', 'contracts/3_Ballot.sol')
})()`
const testScriptClear = `
(async () => {
await remix.call('fileDecorator' as any, 'clearAllFileDecorators')
})()`

@ -21,5 +21,5 @@ module.exports = {
"<rootDir>/../../dist/libs/remix-ws-templates/src/index.js"
,
"@remix-project/remixd": "<rootDir>/../../dist/libs/remixd/index.js"
},"projects":"<rootDir>/libs/remix-ui/drag-n-drop"
}
};

@ -18,7 +18,7 @@ export const GlobalVariables = ({ block, receipt, tx }) => {
'tx.origin': tx.from
}
if (block.baseFeePerGas) {
globals['block.basefee'] = (Web3.utils.toBN(block.baseFeePerGas)) + ` Wei (${block.baseFeePerGas})`
globals['block.basefee'] = Web3.utils.toBN(block.baseFeePerGas).toString(10) + ` Wei (${block.baseFeePerGas})`
}
return (

@ -5,7 +5,7 @@ import { fileDecoration } from '../../types'
const FileDecorationCustomIcon = (props: {
fileDecoration: fileDecoration
}) => {
return <><span className={`${props.fileDecoration.fileStateIconClass}pr-2`}>
return <><span data-id={`file-decoration-custom-${props.fileDecoration.path}`} className={`${props.fileDecoration.fileStateIconClass} pr-2`}>
{props.fileDecoration.fileStateIcon}
</span></>
}

@ -7,7 +7,7 @@ const FileDecorationErrorIcon = (props: {
fileDecoration: fileDecoration
}) => {
return <>
<span className={`${props.fileDecoration.fileStateIconClass} text-danger pr-2`}>{props.fileDecoration.text}</span>
<span data-id={`file-decoration-error-${props.fileDecoration.path}`} className={`${props.fileDecoration.fileStateIconClass} text-danger pr-2`}>{props.fileDecoration.text}</span>
</>
}

@ -9,9 +9,9 @@ const FileDecorationTooltip = (props: {
},
) => {
const getComments = function (fileDecoration: fileDecoration) {
if (fileDecoration.commment) {
const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment]
return commments.map((comment, index) => {
if (fileDecoration.comment) {
const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment]
return comments.map((comment, index) => {
return <div key={index}>{comment}<br></br></div>
})
}

@ -2,15 +2,9 @@ import React from "react"
import { fileDecoration } from "../types"
export const getComments = function (fileDecoration: fileDecoration) {
<<<<<<< HEAD
if(fileDecoration.comment){
const comments = Array.isArray(fileDecoration.comment) ? fileDecoration.comment : [fileDecoration.comment]
return comments.map((comment, index) => {
=======
if(fileDecoration.commment){
const commments = Array.isArray(fileDecoration.commment) ? fileDecoration.commment : [fileDecoration.commment]
return commments.map((comment, index) => {
>>>>>>> 43bc1038a (add test)
return <div key={index}>{comment}<br></br></div>
})
}

@ -14,11 +14,10 @@ export enum fileDecorationType {
fileStateIcon: string | HTMLDivElement | JSX.Element,
bubble: boolean,
text?: string,
comment?: string[] | string
owner: string,
owner?: string,
workspace?: any
tooltip?: string
commment?: string[] | string
comment?: string[] | string
}
export interface FileType {

@ -10,14 +10,8 @@
"importHelpers": true,
"target": "es2015",
"module": "commonjs",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"es2019",
"dom"
],
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "es2019", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
@ -28,120 +22,62 @@
"@remix-project/remix-astwalker": [
"dist/libs/remix-astwalker/src/index.js"
],
"@remix-project/remix-debug": [
"dist/libs/remix-debug/src/index.js"
],
"@remix-project/remix-lib": [
"dist/libs/remix-lib/src/index.js"
],
"@remix-project/remix-debug": ["dist/libs/remix-debug/src/index.js"],
"@remix-project/remix-lib": ["dist/libs/remix-lib/src/index.js"],
"@remix-project/remix-simulator": [
"dist/libs/remix-simulator/src/index.js"
],
"@remix-project/remix-solidity": [
"dist/libs/remix-solidity/src/index.js"
],
"@remix-project/remix-tests": [
"dist/libs/remix-tests/src/index.js"
],
"@remix-project/remix-tests": ["dist/libs/remix-tests/src/index.js"],
"@remix-project/remix-url-resolver": [
"dist/libs/remix-url-resolver/src/index.js"
],
"@remix-project/remix-ws-templates": [
"dist/libs/remix-ws-templates/src/index.js"
],
"@remixproject/debugger-plugin": [
"apps/debugger/src/index.ts"
],
"@remixproject/debugger-plugin": ["apps/debugger/src/index.ts"],
"@remixproject/solidity-compiler-plugin": [
"apps/solidity-compiler/src/index.ts"
],
"@remix-project/remixd": [
"dist/libs/remixd/index.js"
],
"@remix-ui/tree-view": [
"libs/remix-ui/tree-view/src/index.ts"
],
"@remix-ui/search": [
"libs/remix-ui/search/src/index.ts"
],
"@remix-ui/debugger-ui": [
"libs/remix-ui/debugger-ui/src/index.ts"
],
"@remix-ui/utils": [
"libs/remix-ui/utils/src/index.ts"
],
"@remix-ui/clipboard": [
"libs/remix-ui/clipboard/src/index.ts"
],
"@remix-project/remix-solidity-ts": [
"libs/remix-solidity/src/index.ts"
],
"@remix-project/remix-lib-ts": [
"libs/remix-lib/src/index.ts"
],
"@remix-ui/modal-dialog": [
"libs/remix-ui/modal-dialog/src/index.ts"
],
"@remix-ui/toaster": [
"libs/remix-ui/toaster/src/index.ts"
],
"@remix-ui/file-explorer": [
"libs/remix-ui/file-explorer/src/index.ts"
],
"@remix-ui/workspace": [
"libs/remix-ui/workspace/src/index.ts"
],
"@remix-project/remixd": ["dist/libs/remixd/index.js"],
"@remix-ui/tree-view": ["libs/remix-ui/tree-view/src/index.ts"],
"@remix-ui/search": ["libs/remix-ui/search/src/index.ts"],
"@remix-ui/debugger-ui": ["libs/remix-ui/debugger-ui/src/index.ts"],
"@remix-ui/utils": ["libs/remix-ui/utils/src/index.ts"],
"@remix-ui/clipboard": ["libs/remix-ui/clipboard/src/index.ts"],
"@remix-project/remix-solidity-ts": ["libs/remix-solidity/src/index.ts"],
"@remix-project/remix-lib-ts": ["libs/remix-lib/src/index.ts"],
"@remix-ui/modal-dialog": ["libs/remix-ui/modal-dialog/src/index.ts"],
"@remix-ui/toaster": ["libs/remix-ui/toaster/src/index.ts"],
"@remix-ui/file-explorer": ["libs/remix-ui/file-explorer/src/index.ts"],
"@remix-ui/workspace": ["libs/remix-ui/workspace/src/index.ts"],
"@remix-ui/static-analyser": [
"libs/remix-ui/static-analyser/src/index.ts"
],
"@remix-ui/checkbox": [
"libs/remix-ui/checkbox/src/index.ts"
],
"@remix-ui/settings": [
"libs/remix-ui/settings/src/index.ts"
],
"@remix-project/core-plugin": [
"libs/remix-core-plugin/src/index.ts"
],
"@remix-ui/checkbox": ["libs/remix-ui/checkbox/src/index.ts"],
"@remix-ui/settings": ["libs/remix-ui/settings/src/index.ts"],
"@remix-project/core-plugin": ["libs/remix-core-plugin/src/index.ts"],
"@remix-ui/solidity-compiler": [
"libs/remix-ui/solidity-compiler/src/index.ts"
],
"@remix-ui/publish-to-storage": [
"libs/remix-ui/publish-to-storage/src/index.ts"
],
"@remix-ui/renderer": [
"libs/remix-ui/renderer/src/index.ts"
],
"@remix-ui/terminal": [
"libs/remix-ui/terminal/src/index.ts"
],
"@remix-ui/plugin-manager": [
"libs/remix-ui/plugin-manager/src/index.ts"
],
"@remix-ui/home-tab": [
"libs/remix-ui/home-tab/src/index.ts"
],
"@remix-ui/editor": [
"libs/remix-ui/editor/src/index.ts"
],
"@remix-ui/tabs": [
"libs/remix-ui/tabs/src/index.ts"
],
"@remix-ui/helper": [
"libs/remix-ui/helper/src/index.ts"
],
"@remix-ui/app": [
"libs/remix-ui/app/src/index.ts"
],
"@remix-ui/renderer": ["libs/remix-ui/renderer/src/index.ts"],
"@remix-ui/terminal": ["libs/remix-ui/terminal/src/index.ts"],
"@remix-ui/plugin-manager": ["libs/remix-ui/plugin-manager/src/index.ts"],
"@remix-ui/home-tab": ["libs/remix-ui/home-tab/src/index.ts"],
"@remix-ui/editor": ["libs/remix-ui/editor/src/index.ts"],
"@remix-ui/tabs": ["libs/remix-ui/tabs/src/index.ts"],
"@remix-ui/helper": ["libs/remix-ui/helper/src/index.ts"],
"@remix-ui/app": ["libs/remix-ui/app/src/index.ts"],
"@remix-ui/vertical-icons-panel": [
"libs/remix-ui/vertical-icons-panel/src/index.ts"
],
"@remix-ui/theme-module": [
"libs/remix-ui/theme-module/src/index.ts"
],
"@remix-ui/panel": [
"libs/remix-ui/panel/src/index.ts"
],
"@remix-ui/theme-module": ["libs/remix-ui/theme-module/src/index.ts"],
"@remix-ui/panel": ["libs/remix-ui/panel/src/index.ts"],
"@remix-ui/editor-context-view": [
"libs/remix-ui/editor-context-view/src/index.ts"
],
@ -153,14 +89,8 @@
"libs/remix-ui/permission-handler/src/index.ts"
],
"@remix-ui/file-decorators": ["libs/remix-ui/file-decorators/src/index.ts"],
"@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"],
"@remix-ui/drag-n-drop": [
"libs/remix-ui/drag-n-drop/src/index.ts"
]
"@remix-ui/tooltip-popup": ["libs/remix-ui/tooltip-popup/src/index.ts"]
}
},
"exclude": [
"node_modules",
"tmp"
]
"exclude": ["node_modules", "tmp"]
}
Loading…
Cancel
Save