From 2bdb6577faf564498f3f53ba4f5516908bef3c30 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Tue, 22 Oct 2024 12:11:15 +0200 Subject: [PATCH 01/20] enforcing suggestion on editor --- apps/remix-ide/src/app/plugins/remixAIPlugin.tsx | 6 +++--- apps/remix-ide/src/assets/list.json | 16 ++++++++++++++-- .../src/inferencers/remote/remoteInference.ts | 6 +++--- .../lib/providers/inlineCompletionProvider.ts | 13 ++++++++++--- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx index 312352cb46..8bc1427204 100644 --- a/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx +++ b/apps/remix-ide/src/app/plugins/remixAIPlugin.tsx @@ -87,11 +87,11 @@ export class RemixAIPlugin extends Plugin { } } - async code_completion(prompt: string): Promise { + async code_completion(prompt: string, promptAfter: string): Promise { if (this.isOnDesktop) { - return await this.call(this.remixDesktopPluginName, 'code_completion', prompt) + return await this.call(this.remixDesktopPluginName, 'code_completion', prompt, promptAfter) } else { - return await this.remoteInferencer.code_completion(prompt) + return await this.remoteInferencer.code_completion(prompt, promptAfter) } } diff --git a/apps/remix-ide/src/assets/list.json b/apps/remix-ide/src/assets/list.json index 82f8fe17bb..6a47e64612 100644 --- a/apps/remix-ide/src/assets/list.json +++ b/apps/remix-ide/src/assets/list.json @@ -1033,9 +1033,21 @@ "urls": [ "dweb:/ipfs/QmVTALD1WUQwRvEL19jgwrEFyBJMQmy9z32zvT6TAtYPY1" ] + }, + { + "path": "soljson-v0.8.28+commit.7893614a.js", + "version": "0.8.28", + "build": "commit.7893614a", + "longVersion": "0.8.28+commit.7893614a", + "keccak256": "0x8e01bd0cafb8a8bab060453637101a88e4ab6d41c32645a26eaca541fb169c8e", + "sha256": "0x72ef580a6ec5943130028e5294313f24e9435520acc89f8c9dbfd0139d9ae146", + "urls": [ + "dweb:/ipfs/QmVtdNYdUC4aX6Uk5LrxDT55B7NgGLnLcA2wTecF5xUbSS" + ] } ], "releases": { + "0.8.28": "soljson-v0.8.28+commit.7893614a.js", "0.8.27": "soljson-v0.8.27+commit.40a35a09.js", "0.8.26": "soljson-v0.8.26+commit.8a97fa7a.js", "0.8.25": "soljson-v0.8.25+commit.b61c2a91.js", @@ -1131,5 +1143,5 @@ "0.4.0": "soljson-v0.4.0+commit.acd334c9.js", "0.3.6": "soljson-v0.3.6+commit.3fc68da5.js" }, - "latestRelease": "0.8.27" -} \ No newline at end of file + "latestRelease": "0.8.28" +} diff --git a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts index 0c37cf751a..1c148bce22 100644 --- a/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts +++ b/libs/remix-ai-core/src/inferencers/remote/remoteInference.ts @@ -103,10 +103,10 @@ export class RemoteInferencer implements ICompletions { } } - async code_completion(prompt, options:IParams=null): Promise { + async code_completion(prompt, promptAfter, options:IParams=null): Promise { const payload = !options? - { "data": [prompt, "code_completion", "", false, 30, 0.9, 0.90, 50]} : - { "data": [prompt, "code_completion", "", options.stream_result, + { "data": [prompt, "code_completion", promptAfter, false, 30, 0.9, 0.90, 50]} : + { "data": [prompt, "code_completion", promptAfter, options.stream_result, options.max_new_tokens, options.temperature, options.top_p, options.top_k] } diff --git a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts index 79f995dd6e..37aaebd60b 100644 --- a/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts +++ b/libs/remix-ui/editor/src/lib/providers/inlineCompletionProvider.ts @@ -1,5 +1,6 @@ /* eslint-disable no-control-regex */ import { EditorUIProps, monacoTypes } from '@remix-ui/editor'; +import * as monaco from 'monaco-editor'; const _paq = (window._paq = window._paq || []) export class RemixInLineCompletionProvider implements monacoTypes.languages.InlineCompletionsProvider { @@ -81,10 +82,12 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli const data = await this.props.plugin.call('remixAI', 'code_insertion', word, word_after) this.task = 'code_generation' + _paq.push(['trackEvent', 'ai', 'remixAI', 'code_generation']) const parsedData = data.trimStart() //JSON.parse(data).trimStart() const item: monacoTypes.languages.InlineCompletion = { - insertText: parsedData + insertText: parsedData, + range: new monaco.Range(position.lineNumber, position.column, position.lineNumber, position.column) }; this.currentCompletion.text = parsedData this.currentCompletion.item = item @@ -116,11 +119,13 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli // Code insertion try { const output = await this.props.plugin.call('remixAI', 'code_insertion', word, word_after) + _paq.push(['trackEvent', 'ai', 'remixAI', 'code_insertion']) const generatedText = output // no need to clean it. should already be this.task = 'code_insertion' const item: monacoTypes.languages.InlineCompletion = { - insertText: generatedText + insertText: generatedText, + range: new monaco.Range(position.lineNumber, position.column, position.lineNumber, position.column) }; this.currentCompletion.text = generatedText this.currentCompletion.item = item @@ -138,7 +143,8 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli try { // Code completion this.task = 'code_completion' - const output = await this.props.plugin.call('remixAI', 'code_completion', word) + const output = await this.props.plugin.call('remixAI', 'code_completion', word, word_after) + _paq.push(['trackEvent', 'ai', 'remixAI', 'code_completion']) const generatedText = output let clean = generatedText @@ -150,6 +156,7 @@ export class RemixInLineCompletionProvider implements monacoTypes.languages.Inli const item: monacoTypes.languages.InlineCompletion = { insertText: clean, + range: new monaco.Range(position.lineNumber, position.column, position.lineNumber, position.column) }; this.currentCompletion.text = clean this.currentCompletion.item = item From 440e2487c144743c9e17df9bf94cf988f3cad5b1 Mon Sep 17 00:00:00 2001 From: STetsing <41009393+STetsing@users.noreply.github.com> Date: Tue, 22 Oct 2024 13:02:28 +0200 Subject: [PATCH 02/20] revert list.json --- apps/remix-ide/src/assets/list.json | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide/src/assets/list.json b/apps/remix-ide/src/assets/list.json index 6a47e64612..82f8fe17bb 100644 --- a/apps/remix-ide/src/assets/list.json +++ b/apps/remix-ide/src/assets/list.json @@ -1033,21 +1033,9 @@ "urls": [ "dweb:/ipfs/QmVTALD1WUQwRvEL19jgwrEFyBJMQmy9z32zvT6TAtYPY1" ] - }, - { - "path": "soljson-v0.8.28+commit.7893614a.js", - "version": "0.8.28", - "build": "commit.7893614a", - "longVersion": "0.8.28+commit.7893614a", - "keccak256": "0x8e01bd0cafb8a8bab060453637101a88e4ab6d41c32645a26eaca541fb169c8e", - "sha256": "0x72ef580a6ec5943130028e5294313f24e9435520acc89f8c9dbfd0139d9ae146", - "urls": [ - "dweb:/ipfs/QmVtdNYdUC4aX6Uk5LrxDT55B7NgGLnLcA2wTecF5xUbSS" - ] } ], "releases": { - "0.8.28": "soljson-v0.8.28+commit.7893614a.js", "0.8.27": "soljson-v0.8.27+commit.40a35a09.js", "0.8.26": "soljson-v0.8.26+commit.8a97fa7a.js", "0.8.25": "soljson-v0.8.25+commit.b61c2a91.js", @@ -1143,5 +1131,5 @@ "0.4.0": "soljson-v0.4.0+commit.acd334c9.js", "0.3.6": "soljson-v0.3.6+commit.3fc68da5.js" }, - "latestRelease": "0.8.28" -} + "latestRelease": "0.8.27" +} \ No newline at end of file From 36aeb501f260faac1ee4fd3f90f8a4d61de3a1fd Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Tue, 22 Oct 2024 14:00:44 +0200 Subject: [PATCH 03/20] Update remixGuide.tsx added maintained by remix --- apps/remix-ide/src/app/plugins/remixGuide.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/remix-ide/src/app/plugins/remixGuide.tsx b/apps/remix-ide/src/app/plugins/remixGuide.tsx index 354779df39..65780d0f6b 100644 --- a/apps/remix-ide/src/app/plugins/remixGuide.tsx +++ b/apps/remix-ide/src/app/plugins/remixGuide.tsx @@ -16,6 +16,7 @@ const profile = { displayName: 'Remix Guide', description: 'Learn remix with videos', location: 'mainPanel', + maintainedBy: 'remix', events: [] } From 1af9b990691786da6fce5be41b277de6c75230b3 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 22 Oct 2024 17:38:33 +0530 Subject: [PATCH 04/20] Added v0.56.0 highlights --- releaseDetails.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/releaseDetails.json b/releaseDetails.json index 15b21653c2..b183fa0caa 100644 --- a/releaseDetails.json +++ b/releaseDetails.json @@ -1,13 +1,15 @@ { - "version": "v0.54.0", + "version": "v0.56.0", "title": "RELEASE HIGHLIGHTS", - "highlight1": "Login to GitHub from 'File Explorer'", - "highlight2": "Added Cookbook workspace templates", - "highlight3": "Added 'sendRawTransaction' API to remix-simulator", + "highlight1": "Added new 'Contract Verification' plugin to verify contract on multiple platforms", + "highlight2": "Added new 'Remix Guide' plugin to learn using Remix IDE using videos", + "highlight3": "Added support for message signing using EIP712", "highlight4": "", "more": "Read More", - "moreLink": "https://medium.com/remix-ide/remix-release-v0-54-0-021575d54849?source=friends_link&sk=e3960ba90994b63993987b007ee3ac63" + "moreLink": "https://medium.com/remix-ide/remix-release-v0-56-0-574a5774f94c?source=friends_link&sk=af46111d5a9976306e5770ccc468ae28" } + + \ No newline at end of file From b908a1ad574933c4445b156fe113a55abd560ff1 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 16 Oct 2024 17:21:48 +0200 Subject: [PATCH 05/20] navbar ui --- apps/contract-verification/src/app/App.css | 4 + .../src/app/components/NavMenu.tsx | 5 +- apps/etherscan/.babelrc | 9 - apps/etherscan/.browserslistrc | 16 -- apps/etherscan/.eslintrc | 3 - apps/etherscan/.eslintrc.json | 34 --- apps/etherscan/project.json | 69 ----- apps/etherscan/src/app/App.css | 7 - apps/etherscan/src/app/AppContext.tsx | 25 -- .../src/app/EtherscanPluginClient.ts | 70 ------ apps/etherscan/src/app/app.tsx | 136 ---------- .../src/app/components/HeaderWithSettings.tsx | 81 ------ .../src/app/components/SubmitButton.tsx | 34 --- apps/etherscan/src/app/components/index.ts | 2 - .../src/app/hooks/useLocalStorage.tsx | 36 --- apps/etherscan/src/app/layouts/Default.tsx | 17 -- apps/etherscan/src/app/layouts/index.ts | 1 - apps/etherscan/src/app/routes.tsx | 37 --- apps/etherscan/src/app/types/Receipt.ts | 9 - apps/etherscan/src/app/types/ThemeType.ts | 1 - apps/etherscan/src/app/types/index.ts | 2 - apps/etherscan/src/app/utils/index.ts | 1 - apps/etherscan/src/app/utils/networks.ts | 46 ---- apps/etherscan/src/app/utils/scripts.ts | 30 --- apps/etherscan/src/app/utils/utilities.ts | 69 ----- apps/etherscan/src/app/utils/verify.ts | 206 --------------- .../src/app/views/CaptureKeyView.tsx | 63 ----- apps/etherscan/src/app/views/ErrorView.tsx | 16 -- apps/etherscan/src/app/views/HomeView.tsx | 31 --- apps/etherscan/src/app/views/ReceiptsView.tsx | 170 ------------- apps/etherscan/src/app/views/VerifyView.tsx | 235 ------------------ apps/etherscan/src/app/views/index.ts | 4 - apps/etherscan/src/assets/.gitkeep | 0 .../src/environments/environment.prod.ts | 3 - .../etherscan/src/environments/environment.ts | 6 - apps/etherscan/src/favicon.ico | Bin 15086 -> 0 bytes apps/etherscan/src/index.html | 17 -- apps/etherscan/src/main.tsx | 14 -- apps/etherscan/src/polyfills.ts | 7 - apps/etherscan/src/profile.json | 16 -- apps/etherscan/src/styles.css | 1 - apps/etherscan/tsconfig.app.json | 22 -- apps/etherscan/tsconfig.json | 16 -- apps/etherscan/webpack.config.js | 90 ------- apps/remix-ide/project.json | 2 +- apps/remix-ide/src/assets/list.json | 16 +- 46 files changed, 23 insertions(+), 1656 deletions(-) delete mode 100644 apps/etherscan/.babelrc delete mode 100644 apps/etherscan/.browserslistrc delete mode 100644 apps/etherscan/.eslintrc delete mode 100644 apps/etherscan/.eslintrc.json delete mode 100644 apps/etherscan/project.json delete mode 100644 apps/etherscan/src/app/App.css delete mode 100644 apps/etherscan/src/app/AppContext.tsx delete mode 100644 apps/etherscan/src/app/EtherscanPluginClient.ts delete mode 100644 apps/etherscan/src/app/app.tsx delete mode 100644 apps/etherscan/src/app/components/HeaderWithSettings.tsx delete mode 100644 apps/etherscan/src/app/components/SubmitButton.tsx delete mode 100644 apps/etherscan/src/app/components/index.ts delete mode 100644 apps/etherscan/src/app/hooks/useLocalStorage.tsx delete mode 100644 apps/etherscan/src/app/layouts/Default.tsx delete mode 100644 apps/etherscan/src/app/layouts/index.ts delete mode 100644 apps/etherscan/src/app/routes.tsx delete mode 100644 apps/etherscan/src/app/types/Receipt.ts delete mode 100644 apps/etherscan/src/app/types/ThemeType.ts delete mode 100644 apps/etherscan/src/app/types/index.ts delete mode 100644 apps/etherscan/src/app/utils/index.ts delete mode 100644 apps/etherscan/src/app/utils/networks.ts delete mode 100644 apps/etherscan/src/app/utils/scripts.ts delete mode 100644 apps/etherscan/src/app/utils/utilities.ts delete mode 100644 apps/etherscan/src/app/utils/verify.ts delete mode 100644 apps/etherscan/src/app/views/CaptureKeyView.tsx delete mode 100644 apps/etherscan/src/app/views/ErrorView.tsx delete mode 100644 apps/etherscan/src/app/views/HomeView.tsx delete mode 100644 apps/etherscan/src/app/views/ReceiptsView.tsx delete mode 100644 apps/etherscan/src/app/views/VerifyView.tsx delete mode 100644 apps/etherscan/src/app/views/index.ts delete mode 100644 apps/etherscan/src/assets/.gitkeep delete mode 100644 apps/etherscan/src/environments/environment.prod.ts delete mode 100644 apps/etherscan/src/environments/environment.ts delete mode 100644 apps/etherscan/src/favicon.ico delete mode 100644 apps/etherscan/src/index.html delete mode 100644 apps/etherscan/src/main.tsx delete mode 100644 apps/etherscan/src/polyfills.ts delete mode 100644 apps/etherscan/src/profile.json delete mode 100644 apps/etherscan/src/styles.css delete mode 100644 apps/etherscan/tsconfig.app.json delete mode 100644 apps/etherscan/tsconfig.json delete mode 100644 apps/etherscan/webpack.config.js diff --git a/apps/contract-verification/src/app/App.css b/apps/contract-verification/src/app/App.css index 0ff37a0e7e..b7df871af4 100644 --- a/apps/contract-verification/src/app/App.css +++ b/apps/contract-verification/src/app/App.css @@ -6,5 +6,9 @@ body { margin: 0; } +a:focus { + background-color: transparent !important; +} + .fa-arrow-up-right-from-square::before { content: "\f08e"; } .fa-xmark::before { content: "\f00d"; } diff --git a/apps/contract-verification/src/app/components/NavMenu.tsx b/apps/contract-verification/src/app/components/NavMenu.tsx index ab17429191..73e40d4bff 100644 --- a/apps/contract-verification/src/app/components/NavMenu.tsx +++ b/apps/contract-verification/src/app/components/NavMenu.tsx @@ -9,7 +9,10 @@ interface NavItemProps { const NavItem: React.FC = ({ to, icon, title }) => { return ( - 'text-decoration-none d-flex flex-column justify-content-center py-2 px-1 small ' + (isActive ? 'bg-light' : 'bg-transparent')}> + 'text-decoration-none d-flex flex-column justify-content-center py-2 px-2 small ' + (isActive ? 'bg-transparent' : 'bg-dark')} + > {icon} {title} diff --git a/apps/etherscan/.babelrc b/apps/etherscan/.babelrc deleted file mode 100644 index e37036ce66..0000000000 --- a/apps/etherscan/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": ["@babel/preset-env", ["@babel/preset-react", - {"runtime": "automatic"} - ]], - "plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-runtime", "@babel/plugin-proposal-nullish-coalescing-operator"], - "ignore": [ - "**/node_modules/**" - ] -} \ No newline at end of file diff --git a/apps/etherscan/.browserslistrc b/apps/etherscan/.browserslistrc deleted file mode 100644 index f1d12df4fa..0000000000 --- a/apps/etherscan/.browserslistrc +++ /dev/null @@ -1,16 +0,0 @@ -# This file is used by: -# 1. autoprefixer to adjust CSS to support the below specified browsers -# 2. babel preset-env to adjust included polyfills -# -# For additional information regarding the format and rule options, please see: -# https://github.com/browserslist/browserslist#queries -# -# If you need to support different browsers in production, you may tweak the list below. - -last 1 Chrome version -last 1 Firefox version -last 2 Edge major versions -last 2 Safari major version -last 2 iOS major versions -Firefox ESR -not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/apps/etherscan/.eslintrc b/apps/etherscan/.eslintrc deleted file mode 100644 index 2d85f9fa66..0000000000 --- a/apps/etherscan/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../.eslintrc.json", -} \ No newline at end of file diff --git a/apps/etherscan/.eslintrc.json b/apps/etherscan/.eslintrc.json deleted file mode 100644 index a92d0f887a..0000000000 --- a/apps/etherscan/.eslintrc.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "extends": [ - "plugin:@nrwl/nx/react", - "../../.eslintrc.json" - ], - "ignorePatterns": [ - "!**/*" - ], - "overrides": [ - { - "files": [ - "*.ts", - "*.tsx", - "*.js", - "*.jsx" - ], - "rules": {} - }, - { - "files": [ - "*.ts", - "*.tsx" - ], - "rules": {} - }, - { - "files": [ - "*.js", - "*.jsx" - ], - "rules": {} - } - ] -} \ No newline at end of file diff --git a/apps/etherscan/project.json b/apps/etherscan/project.json deleted file mode 100644 index 6803ffe20b..0000000000 --- a/apps/etherscan/project.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "etherscan", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/etherscan/src", - "projectType": "application", - "targets": { - "build": { - "executor": "@nrwl/webpack:webpack", - "outputs": ["{options.outputPath}"], - "defaultConfiguration": "development", - "options": { - "compiler": "babel", - "outputPath": "dist/apps/etherscan", - "index": "apps/etherscan/src/index.html", - "baseHref": "./", - "main": "apps/etherscan/src/main.tsx", - "polyfills": "apps/etherscan/src/polyfills.ts", - "tsConfig": "apps/etherscan/tsconfig.app.json", - "assets": [ - "apps/etherscan/src/favicon.ico", - "apps/etherscan/src/assets", - "apps/etherscan/src/profile.json" - ], - "styles": ["apps/etherscan/src/styles.css"], - "scripts": [], - "webpackConfig": "apps/etherscan/webpack.config.js" - }, - "configurations": { - "development": { - }, - "production": { - "fileReplacements": [ - { - "replace": "apps/etherscan/src/environments/environment.ts", - "with": "apps/etherscan/src/environments/environment.prod.ts" - } - ] - } - } - }, - "lint": { - "executor": "@nrwl/linter:eslint", - "outputs": ["{options.outputFile}"], - "options": { - "lintFilePatterns": ["apps/etherscan/**/*.ts"], - "eslintConfig": "apps/etherscan/.eslintrc" - } - }, - "serve": { - "executor": "@nrwl/webpack:dev-server", - "defaultConfiguration": "development", - "options": { - "buildTarget": "etherscan:build", - "hmr": true, - "baseHref": "/" - }, - "configurations": { - "development": { - "buildTarget": "etherscan:build:development", - "port": 5003 - }, - "production": { - "buildTarget": "etherscan:build:production" - } - } - } - }, - "tags": [] -} diff --git a/apps/etherscan/src/app/App.css b/apps/etherscan/src/app/App.css deleted file mode 100644 index 74a89ee342..0000000000 --- a/apps/etherscan/src/app/App.css +++ /dev/null @@ -1,7 +0,0 @@ -body { - margin: 0; -} - -#root { - padding: 8px 14px; -} \ No newline at end of file diff --git a/apps/etherscan/src/app/AppContext.tsx b/apps/etherscan/src/app/AppContext.tsx deleted file mode 100644 index 69d967534d..0000000000 --- a/apps/etherscan/src/app/AppContext.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react' -import {PluginClient} from '@remixproject/plugin' - -import {Receipt, ThemeType} from './types' - -export const AppContext = React.createContext({ - apiKey: '', - setAPIKey: (value: string) => { - console.log('Set API Key from Context') - }, - clientInstance: {} as PluginClient, - receipts: [] as Receipt[], - setReceipts: (receipts: Receipt[]) => { - console.log('Calling Set Receipts') - }, - contracts: [] as string[], - setContracts: (contracts: string[]) => { - console.log('Calling Set Contract Names') - }, - themeType: 'dark' as ThemeType, - setThemeType: (themeType: ThemeType) => { - console.log('Calling Set Theme Type') - }, - networkName: '' -}) diff --git a/apps/etherscan/src/app/EtherscanPluginClient.ts b/apps/etherscan/src/app/EtherscanPluginClient.ts deleted file mode 100644 index 3d1bf22d94..0000000000 --- a/apps/etherscan/src/app/EtherscanPluginClient.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { PluginClient } from '@remixproject/plugin' -import { createClient } from '@remixproject/plugin-webview' -import { verify, EtherScanReturn } from './utils/verify' -import { getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus } from './utils' -import EventManager from 'events' - -export class EtherscanPluginClient extends PluginClient { - public internalEvents: EventManager - - constructor() { - super() - this.internalEvents = new EventManager() - createClient(this) - this.onload() - } - - onActivation(): void { - this.internalEvents.emit('etherscan_activated') - } - - async verify( - apiKey: string, - contractAddress: string, - contractArguments: string, - contractName: string, - compilationResultParam: any, - chainRef?: number | string, - isProxyContract?: boolean, - expectedImplAddress?: string - ) { - const result = await verify( - apiKey, - contractAddress, - contractArguments, - contractName, - compilationResultParam, - chainRef, - isProxyContract, - expectedImplAddress, - this, - (value: EtherScanReturn) => {}, - (value: string) => {} - ) - return result - } - - async receiptStatus(receiptGuid: string, apiKey: string, isProxyContract: boolean) { - try { - const { network, networkId } = await getNetworkName(this) - if (network === 'vm') { - throw new Error('Cannot check the receipt status in the selected network') - } - const etherscanApi = getEtherScanApi(networkId) - let receiptStatus - - if (isProxyContract) receiptStatus = await getProxyContractReceiptStatus(receiptGuid, apiKey, etherscanApi) - else receiptStatus = await getReceiptStatus(receiptGuid, apiKey, etherscanApi) - return { - message: receiptStatus.result, - succeed: receiptStatus.status === '0' ? false : true - } - } catch (e: any) { - return { - status: 'error', - message: e.message, - succeed: false - } - } - } -} diff --git a/apps/etherscan/src/app/app.tsx b/apps/etherscan/src/app/app.tsx deleted file mode 100644 index bf553d8319..0000000000 --- a/apps/etherscan/src/app/app.tsx +++ /dev/null @@ -1,136 +0,0 @@ -import React, {useState, useEffect, useRef} from 'react' - -import {CompilationFileSources, CompilationResult} from '@remixproject/plugin-api' - -import { EtherscanPluginClient } from './EtherscanPluginClient' - -import {AppContext} from './AppContext' -import {DisplayRoutes} from './routes' - -import {useLocalStorage} from './hooks/useLocalStorage' - -import {getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus} from './utils' -import {Receipt, ThemeType} from './types' - -import './App.css' - -export const getNewContractNames = (compilationResult: CompilationResult) => { - const compiledContracts = compilationResult.contracts - let result: string[] = [] - - for (const file of Object.keys(compiledContracts)) { - const newContractNames = Object.keys(compiledContracts[file]) - - result = [...result, ...newContractNames] - } - - return result -} - -const plugin = new EtherscanPluginClient() - -const App = () => { - const [apiKey, setAPIKey] = useLocalStorage('apiKey', '') - const [receipts, setReceipts] = useLocalStorage('receipts', []) - const [contracts, setContracts] = useState([]) - const [themeType, setThemeType] = useState('dark') - const [networkName, setNetworkName] = useState('Loading...') - const timer = useRef(null) - const contractsRef = useRef(contracts) - - contractsRef.current = contracts - - const setListeners = () => { - plugin.on('solidity', 'compilationFinished', (fileName: string, source: CompilationFileSources, languageVersion: string, data: CompilationResult) => { - const newContractsNames = getNewContractNames(data) - - const newContractsToSave: string[] = [...contractsRef.current, ...newContractsNames] - - const uniqueContracts: string[] = [...new Set(newContractsToSave)] - - setContracts(uniqueContracts) - }) - plugin.on('blockchain' as any, 'networkStatus', (result) => { - setNetworkName(`${result.network.name} ${result.network.id !== '-' ? `(Chain id: ${result.network.id})` : '(Not supported)'}`) - }) - // @ts-ignore - plugin.call('blockchain', 'getCurrentNetworkStatus').then((result: any) => setNetworkName(`${result.network.name} ${result.network.id !== '-' ? `(Chain id: ${result.network.id})` : '(Not supported)'}`)) - - } - - useEffect(() => { - plugin.onload(() => { - setListeners() - }) - }, []) - - useEffect(() => { - let receiptsNotVerified: Receipt[] = receipts.filter((item: Receipt) => item.status === 'Pending in queue' || item.status === 'Max rate limit reached') - - if (receiptsNotVerified.length > 0) { - if (timer.current) { - clearInterval(timer.current) - timer.current = null - } - timer.current = setInterval(async () => { - const {network, networkId} = await getNetworkName(plugin) - - if (!plugin) return - if (network === 'vm') return - let newReceipts = receipts - - for (const item of receiptsNotVerified) { - await new Promise((r) => setTimeout(r, 500)) // avoid api rate limit exceed. - let status - if (item.isProxyContract) { - status = await getProxyContractReceiptStatus(item.guid, apiKey, getEtherScanApi(networkId)) - if (status.status === '1') { - status.message = status.result - status.result = 'Successfully Updated' - } - } else status = await getReceiptStatus(item.guid, apiKey, getEtherScanApi(networkId)) - if (status.result === 'Pass - Verified' || status.result === 'Already Verified' || status.result === 'Successfully Updated') { - newReceipts = newReceipts.map((currentReceipt: Receipt) => { - if (currentReceipt.guid === item.guid) { - const res = { - ...currentReceipt, - status: status.result - } - if (currentReceipt.isProxyContract) res.message = status.message - return res - } - return currentReceipt - }) - } - } - receiptsNotVerified = newReceipts.filter((item: Receipt) => item.status === 'Pending in queue' || item.status === 'Max rate limit reached') - if (timer.current && receiptsNotVerified.length === 0) { - clearInterval(timer.current) - timer.current = null - } - setReceipts(newReceipts) - }, 10000) - } - }, [receipts]) - - return ( - - { plugin && } - - ) -} - -export default App diff --git a/apps/etherscan/src/app/components/HeaderWithSettings.tsx b/apps/etherscan/src/app/components/HeaderWithSettings.tsx deleted file mode 100644 index 5818b2bc7e..0000000000 --- a/apps/etherscan/src/app/components/HeaderWithSettings.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react' - -import {NavLink} from 'react-router-dom' -import {CustomTooltip} from '@remix-ui/helper' -import {AppContext} from '../AppContext' - -interface Props { - title?: string - from: string -} - -interface IconProps { - from: string -} - -const HomeIcon = ({from}: IconProps) => { - return ( - (isActive ? 'border border-secondary shadow-none btn p-1 m-0' : 'border-0 shadow-none btn p-1 m-0')} - style={({isActive}) => (!isActive ? {width: '1.8rem', filter: 'contrast(0.5)'} : {width: '1.8rem'})} - state={from} - > - - - - - ) -} - -const ReceiptsIcon = ({from}: IconProps) => { - return ( - (isActive ? 'border border-secondary shadow-none btn p-1 m-0' : 'border-0 shadow-none btn p-1 m-0')} - style={({isActive}) => (!isActive ? {width: '1.8rem', filter: 'contrast(0.5)'} : {width: '1.8rem'})} - state={from} - > - - - - - ) -} - -const SettingsIcon = ({from}: IconProps) => { - return ( - (isActive ? 'border border-secondary shadow-none btn p-1 m-0' : 'border-0 shadow-none btn p-1 m-0')} - style={({isActive}) => (!isActive ? {width: '1.8rem', filter: 'contrast(0.5)'} : {width: '1.8rem'})} - state={from} - > - - - - - ) -} - -export const HeaderWithSettings = ({title = '', from}) => { - return ( -
-
{title}
-
- - - -
-
- ) -} diff --git a/apps/etherscan/src/app/components/SubmitButton.tsx b/apps/etherscan/src/app/components/SubmitButton.tsx deleted file mode 100644 index 9f4bed6200..0000000000 --- a/apps/etherscan/src/app/components/SubmitButton.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' -import {CustomTooltip} from '@remix-ui/helper' - -interface Props { - text: string - isSubmitting?: boolean - dataId?: string - disable?: boolean -} - -export const SubmitButton = ({text, dataId, isSubmitting = false, disable = true}) => { - return ( -
- -
- ) -} diff --git a/apps/etherscan/src/app/components/index.ts b/apps/etherscan/src/app/components/index.ts deleted file mode 100644 index c52e3712f0..0000000000 --- a/apps/etherscan/src/app/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { HeaderWithSettings } from "./HeaderWithSettings" -export { SubmitButton } from "./SubmitButton" diff --git a/apps/etherscan/src/app/hooks/useLocalStorage.tsx b/apps/etherscan/src/app/hooks/useLocalStorage.tsx deleted file mode 100644 index 85d30c849d..0000000000 --- a/apps/etherscan/src/app/hooks/useLocalStorage.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import {useState} from 'react' - -export function useLocalStorage(key: string, initialValue: any) { - // State to store our value - // Pass initial state function to useState so logic is only executed once - const [storedValue, setStoredValue] = useState(() => { - try { - // Get from local storage by key - const item = window.localStorage.getItem(key) - // Parse stored json or if none return initialValue - return item ? JSON.parse(item) : initialValue - } catch (error) { - // If error also return initialValue - console.error(error) - return initialValue - } - }) - - // Return a wrapped version of useState's setter function that ... - // ... persists the new value to localStorage. - const setValue = (value: any) => { - try { - // Allow value to be a function so we have same API as useState - const valueToStore = value instanceof Function ? value(storedValue) : value - // Save state - setStoredValue(valueToStore) - // Save to local storage - window.localStorage.setItem(key, JSON.stringify(valueToStore)) - } catch (error) { - // A more advanced implementation would handle the error case - console.error(error) - } - } - - return [storedValue, setValue] -} diff --git a/apps/etherscan/src/app/layouts/Default.tsx b/apps/etherscan/src/app/layouts/Default.tsx deleted file mode 100644 index fa9a1111e5..0000000000 --- a/apps/etherscan/src/app/layouts/Default.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React, {PropsWithChildren} from 'react' - -import {HeaderWithSettings} from '../components' - -interface Props { - from: string - title?: string -} - -export const DefaultLayout = ({children, from, title}) => { - return ( -
- - {children} -
- ) -} diff --git a/apps/etherscan/src/app/layouts/index.ts b/apps/etherscan/src/app/layouts/index.ts deleted file mode 100644 index 9b8e6166d5..0000000000 --- a/apps/etherscan/src/app/layouts/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { DefaultLayout } from "./Default" diff --git a/apps/etherscan/src/app/routes.tsx b/apps/etherscan/src/app/routes.tsx deleted file mode 100644 index 165b5ae5a7..0000000000 --- a/apps/etherscan/src/app/routes.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' -import {HashRouter as Router, Route, Routes, RouteProps} from 'react-router-dom' - -import {ErrorView, HomeView, ReceiptsView, CaptureKeyView} from './views' -import {DefaultLayout} from './layouts' - -export const DisplayRoutes = () => ( - - - - - - } - /> - } /> - - - - } - /> - - - - } - /> - - -) diff --git a/apps/etherscan/src/app/types/Receipt.ts b/apps/etherscan/src/app/types/Receipt.ts deleted file mode 100644 index 2dd501651d..0000000000 --- a/apps/etherscan/src/app/types/Receipt.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type ReceiptStatus = "Pending in queue" | "Pass - Verified" | "Already Verified" | "Max rate limit reached" | "Successfully Updated" - -export interface Receipt { - guid: string - status: ReceiptStatus - isProxyContract: boolean - message?: string - succeed?: boolean -} diff --git a/apps/etherscan/src/app/types/ThemeType.ts b/apps/etherscan/src/app/types/ThemeType.ts deleted file mode 100644 index 13b3710cd0..0000000000 --- a/apps/etherscan/src/app/types/ThemeType.ts +++ /dev/null @@ -1 +0,0 @@ -export type ThemeType = "dark" | "light" diff --git a/apps/etherscan/src/app/types/index.ts b/apps/etherscan/src/app/types/index.ts deleted file mode 100644 index 1a8733d6ff..0000000000 --- a/apps/etherscan/src/app/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./Receipt" -export * from "./ThemeType" diff --git a/apps/etherscan/src/app/utils/index.ts b/apps/etherscan/src/app/utils/index.ts deleted file mode 100644 index b23d52e6e0..0000000000 --- a/apps/etherscan/src/app/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./utilities" diff --git a/apps/etherscan/src/app/utils/networks.ts b/apps/etherscan/src/app/utils/networks.ts deleted file mode 100644 index 9971c8e1c5..0000000000 --- a/apps/etherscan/src/app/utils/networks.ts +++ /dev/null @@ -1,46 +0,0 @@ -export const scanAPIurls = { - // all mainnet - 1: 'https://api.etherscan.io/api', - 56: 'https://api.bscscan.com/api', - 137: 'https://api.polygonscan.com/api', - 250: 'https://api.ftmscan.com/api', - 42161: 'https://api.arbiscan.io/api', - 43114: 'https://api.snowtrace.io/api', - 1285: 'https://api-moonriver.moonscan.io/api', - 1284: 'https://api-moonbeam.moonscan.io/api', - 25: 'https://api.cronoscan.com/api', - 199: 'https://api.bttcscan.com/api', - 10: 'https://api-optimistic.etherscan.io/api', - 42220: 'https://api.celoscan.io/api', - 288: 'https://api.bobascan.com/api', - 100: 'https://api.gnosisscan.io/api', - 1101: 'https://api-zkevm.polygonscan.com/api', - 59144: 'https://api.lineascan.build/api', - 8453: 'https://api.basescan.org/api', - 534352: 'https://api.scrollscan.com/api', - 1116: 'https://openapi.coredao.org/api', - - // all testnet - 17000: 'https://api-holesky.etherscan.io/api', - 11155111: 'https://api-sepolia.etherscan.io/api', - 97: 'https://api-testnet.bscscan.com/api', - 80001: 'https://api-testnet.polygonscan.com/api', - 80002: 'https://api-amoy.polygonscan.com/api', - 4002: 'https://api-testnet.ftmscan.com/api', - 421611: 'https://api-testnet.arbiscan.io/api', - 42170: 'https://api-nova.arbiscan.io/api', - 43113: 'https://api-testnet.snowtrace.io/api', - 1287: 'https://api-moonbase.moonscan.io/api', - 338: 'https://api-testnet.cronoscan.com/api', - 1028: 'https://api-testnet.bttcscan.com/api', - 420: 'https://api-goerli-optimistic.etherscan.io/api', - 44787: 'https://api-alfajores.celoscan.io/api', - 2888: 'https://api-testnet.bobascan.com/api', - 84531: 'https://api-goerli.basescan.org/api', - 84532: "https://api-sepolia.basescan.org/api", - 1442: 'https://api-testnet-zkevm.polygonscan.com/api', - 2442: 'https://api-cardona-zkevm.polygonscan.com/api', - 59140: 'https://api-testnet.lineascan.build/api', - 534351: 'https://api-sepolia.scrollscan.com/api', - 1115: 'https://api.test.btcs.network/api', -} diff --git a/apps/etherscan/src/app/utils/scripts.ts b/apps/etherscan/src/app/utils/scripts.ts deleted file mode 100644 index 0d204d8d55..0000000000 --- a/apps/etherscan/src/app/utils/scripts.ts +++ /dev/null @@ -1,30 +0,0 @@ -export const verifyScript = ` -/** - * @param {string} apikey - etherscan api key - * @param {string} contractAddress - Address of the contract to verify - * @param {string} contractArguments - Parameters used in the contract constructor during the initial deployment. It should be the hex encoded value - * @param {string} contractName - Name of the contract - * @param {string} contractFile - File where the contract is located - * @param {number | string} chainRef - Network chain id or API URL (optional) - * @param {boolean} isProxyContract - true, if contract is a proxy contract (optional) - * @param {string} expectedImplAddress - Implementation contract address, in case of proxy contract verification (optional) - * @returns {{ guid, status, message, succeed }} verification result - */ -export const verify = async (apikey: string, contractAddress: string, contractArguments: string, contractName: string, contractFile: string, chainRef?: number | string, isProxyContract?: boolean, expectedImplAddress?: string) => { - const compilationResultParam = await remix.call('compilerArtefacts' as any, 'getCompilerAbstract', contractFile) - console.log('verifying.. ' + contractName) - // update apiKey and chainRef to verify contract on multiple networks - return await remix.call('etherscan' as any, 'verify', apikey, contractAddress, contractArguments, contractName, compilationResultParam, chainRef, isProxyContract, expectedImplAddress) -}` - -export const receiptGuidScript = ` -/** - * @param {string} apikey - etherscan api key - * @param {string} guid - receipt id - * @param {boolean} isProxyContract - true, if contract is a proxy contract (optional) - * @returns {{ status, message, succeed }} receiptStatus - */ -export const receiptStatus = async (apikey: string, guid: string, isProxyContract?: boolean) => { - return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey, isProxyContract) -} -` \ No newline at end of file diff --git a/apps/etherscan/src/app/utils/utilities.ts b/apps/etherscan/src/app/utils/utilities.ts deleted file mode 100644 index 048b6e2335..0000000000 --- a/apps/etherscan/src/app/utils/utilities.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { PluginClient } from "@remixproject/plugin" -import axios from 'axios' -import { scanAPIurls } from "./networks" -type RemixClient = PluginClient - -/* - status: 0=Error, 1=Pass - message: OK, NOTOK - result: explanation -*/ -export type receiptStatus = { - result: string - message: string - status: string -} - -export const getEtherScanApi = (networkId: any) => { - if (!(networkId in scanAPIurls)) { - throw new Error("no known network to verify against") - } - const apiUrl = (scanAPIurls as any)[networkId] - return apiUrl -} - -export const getNetworkName = async (client: RemixClient) => { - const network = await client.call("network", "detectNetwork") - if (!network) { - throw new Error("no known network to verify against") - } - return { network: network.name!.toLowerCase(), networkId: network.id } -} - -export const getReceiptStatus = async ( - receiptGuid: string, - apiKey: string, - etherscanApi: string -): Promise => { - const params = `guid=${receiptGuid}&module=contract&action=checkverifystatus&apiKey=${apiKey}` - try { - const response = await axios.get(`${etherscanApi}?${params}`) - const { result, message, status } = response.data - return { - result, - message, - status, - } - } catch (error) { - console.error(error) - } -} - -export const getProxyContractReceiptStatus = async ( - receiptGuid: string, - apiKey: string, - etherscanApi: string -): Promise => { - const params = `guid=${receiptGuid}&module=contract&action=checkproxyverification&apiKey=${apiKey}` - try { - const response = await axios.get(`${etherscanApi}?${params}`) - const { result, message, status } = response.data - return { - result, - message, - status, - } - } catch (error) { - console.error(error) - } -} diff --git a/apps/etherscan/src/app/utils/verify.ts b/apps/etherscan/src/app/utils/verify.ts deleted file mode 100644 index 41b74c0e2e..0000000000 --- a/apps/etherscan/src/app/utils/verify.ts +++ /dev/null @@ -1,206 +0,0 @@ -import { getNetworkName, getEtherScanApi, getReceiptStatus, getProxyContractReceiptStatus } from "../utils" -import { CompilationResult } from "@remixproject/plugin-api" -import { CompilerAbstract } from '@remix-project/remix-solidity' -import axios from 'axios' -import { PluginClient } from "@remixproject/plugin" - -const resetAfter10Seconds = (client: PluginClient, setResults: (value: string) => void) => { - setTimeout(() => { - client.emit("statusChanged", { key: "none" }) - setResults("") - }, 10000) -} - -export type EtherScanReturn = { - guid: any, - status: any, -} -export const verify = async ( - apiKeyParam: string, - contractAddress: string, - contractArgumentsParam: string, - contractName: string, - compilationResultParam: CompilerAbstract, - chainRef: number | string, - isProxyContract: boolean, - expectedImplAddress: string, - client: PluginClient, - onVerifiedContract: (value: EtherScanReturn) => void, - setResults: (value: string) => void -) => { - let networkChainId - let etherscanApi - if (chainRef) { - if (typeof chainRef === 'number') { - networkChainId = chainRef - etherscanApi = getEtherScanApi(networkChainId) - } else if (typeof chainRef === 'string') etherscanApi = chainRef - } else { - const { network, networkId } = await getNetworkName(client) - if (network === "vm") { - return { - succeed: false, - message: "Cannot verify in the selected network" - } - } else { - networkChainId = networkId - etherscanApi = getEtherScanApi(networkChainId) - } - } - - try { - const contractMetadata = getContractMetadata( - // cast from the remix-plugin interface to the solidity one. Should be fixed when remix-plugin move to the remix-project repository - compilationResultParam.data as unknown as CompilationResult, - contractName - ) - - if (!contractMetadata) { - return { - succeed: false, - message: "Please recompile contract" - } - } - - const contractMetadataParsed = JSON.parse(contractMetadata) - - const fileName = getContractFileName( - // cast from the remix-plugin interface to the solidity one. Should be fixed when remix-plugin move to the remix-project repository - compilationResultParam.data as unknown as CompilationResult, - contractName - ) - - const jsonInput = { - language: 'Solidity', - sources: compilationResultParam.source.sources, - settings: { - optimizer: { - enabled: contractMetadataParsed.settings.optimizer.enabled, - runs: contractMetadataParsed.settings.optimizer.runs - } - } - } - - const data: { [key: string]: string | any } = { - apikey: apiKeyParam, // A valid API-Key is required - module: "contract", // Do not change - action: "verifysourcecode", // Do not change - codeformat: "solidity-standard-json-input", - sourceCode: JSON.stringify(jsonInput), - contractname: fileName + ':' + contractName, - compilerversion: `v${contractMetadataParsed.compiler.version}`, // see http://etherscan.io/solcversions for list of support versions - constructorArguements: contractArgumentsParam ? contractArgumentsParam.replace('0x', '') : '', // if applicable - } - - if (isProxyContract) { - data.action = "verifyproxycontract" - data.expectedimplementation = expectedImplAddress - data.address = contractAddress - } else { - data.contractaddress = contractAddress - } - - const body = new FormData() - Object.keys(data).forEach((key) => body.append(key, data[key])) - - client.emit("statusChanged", { - key: "loading", - type: "info", - title: "Verifying ...", - }) - const response = await axios.post(etherscanApi, body) - const { message, result, status } = await response.data - - if (message === "OK" && status === "1") { - resetAfter10Seconds(client, setResults) - let receiptStatus - if (isProxyContract) { - receiptStatus = await getProxyContractReceiptStatus( - result, - apiKeyParam, - etherscanApi - ) - if (receiptStatus.status === '1') { - receiptStatus.message = receiptStatus.result - receiptStatus.result = 'Successfully Updated' - } - } else receiptStatus = await getReceiptStatus( - result, - apiKeyParam, - etherscanApi - ) - - const returnValue = { - guid: result, - status: receiptStatus.result, - message: `Verification request submitted successfully. Use this receipt GUID ${result} to track the status of your submission`, - succeed: true, - isProxyContract - } - onVerifiedContract(returnValue) - return returnValue - } else if (message === "NOTOK") { - client.emit("statusChanged", { - key: "failed", - type: "error", - title: result, - }) - const returnValue = { - message: result, - succeed: false, - isProxyContract - } - resetAfter10Seconds(client, setResults) - return returnValue - } - return { - message: 'unknown reason ' + result, - succeed: false - } - } catch (error: any) { - console.error(error) - setResults("Something wrong happened, try again") - return { - message: error.message, - succeed: false - } - } -} - -export const getContractFileName = ( - compilationResult: CompilationResult, - contractName: string -) => { - const compiledContracts = compilationResult.contracts - let fileName = "" - - for (const file of Object.keys(compiledContracts)) { - for (const contract of Object.keys(compiledContracts[file])) { - if (contract === contractName) { - fileName = file - break - } - } - } - return fileName -} - -export const getContractMetadata = ( - compilationResult: CompilationResult, - contractName: string -) => { - const compiledContracts = compilationResult.contracts - let contractMetadata = "" - - for (const file of Object.keys(compiledContracts)) { - for (const contract of Object.keys(compiledContracts[file])) { - if (contract === contractName) { - contractMetadata = compiledContracts[file][contract].metadata - if (contractMetadata) { - break - } - } - } - } - return contractMetadata -} diff --git a/apps/etherscan/src/app/views/CaptureKeyView.tsx b/apps/etherscan/src/app/views/CaptureKeyView.tsx deleted file mode 100644 index d2f860ca05..0000000000 --- a/apps/etherscan/src/app/views/CaptureKeyView.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React, {useState, useEffect} from 'react' - -import {Formik, ErrorMessage, Field} from 'formik' -import {useNavigate, useLocation} from 'react-router-dom' - -import {AppContext} from '../AppContext' -import {SubmitButton} from '../components' - -export const CaptureKeyView = () => { - const location = useLocation() - const navigate = useNavigate() - const [msg, setMsg] = useState('') - const context = React.useContext(AppContext) - - useEffect(() => { - if (!context.apiKey) setMsg('Please provide a 34 or 32 character API key to continue') - }, [context.apiKey]) - - return ( -
- { - const errors = {} as any - if (!values.apiKey) { - errors.apiKey = 'Required' - } else if (values.apiKey.length !== 34 && values.apiKey.length !== 32) { - errors.apiKey = 'API key should be 34 or 32 characters long' - } - return errors - }} - onSubmit={(values) => { - const apiKey = values.apiKey - if (apiKey.length === 34 || apiKey.length === 32) { - context.setAPIKey(values.apiKey) - navigate(location && location.state ? location.state : '/') - } - }} - > - {({errors, touched, handleSubmit}) => ( -
-
- - - -
- -
- -
-
- )} -
- -
-
- ) -} diff --git a/apps/etherscan/src/app/views/ErrorView.tsx b/apps/etherscan/src/app/views/ErrorView.tsx deleted file mode 100644 index 90ee41e62a..0000000000 --- a/apps/etherscan/src/app/views/ErrorView.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react' - -export const ErrorView = () => { - return ( -
- Error page -
Sorry, something unexpected happened.
-
- Please raise an issue:{' '} - - Here - -
-
- ) -} diff --git a/apps/etherscan/src/app/views/HomeView.tsx b/apps/etherscan/src/app/views/HomeView.tsx deleted file mode 100644 index d0cda503d6..0000000000 --- a/apps/etherscan/src/app/views/HomeView.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react' - -import {Navigate} from 'react-router-dom' - -import {AppContext} from '../AppContext' -import {Receipt} from '../types' - -import {VerifyView} from './VerifyView' - -export const HomeView = () => { - const context = React.useContext(AppContext) - - return !context.apiKey ? ( - - ) : ( - { - const newReceipts = [...context.receipts, receipt] - context.setReceipts(newReceipts) - }} - networkName={context.networkName} - /> - ) -} diff --git a/apps/etherscan/src/app/views/ReceiptsView.tsx b/apps/etherscan/src/app/views/ReceiptsView.tsx deleted file mode 100644 index 9a2c345462..0000000000 --- a/apps/etherscan/src/app/views/ReceiptsView.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import React, {useState} from 'react' - -import {Formik, ErrorMessage, Field} from 'formik' -import {getEtherScanApi, getNetworkName, getReceiptStatus, getProxyContractReceiptStatus} from '../utils' -import {Receipt} from '../types' -import {AppContext} from '../AppContext' -import {SubmitButton} from '../components' -import {Navigate} from 'react-router-dom' -import {Button} from 'react-bootstrap' -import {CustomTooltip} from '@remix-ui/helper' - -interface FormValues { - receiptGuid: string -} - -export const ReceiptsView = () => { - const [results, setResults] = useState({succeed: false, message: ''}) - const [isProxyContractReceipt, setIsProxyContractReceipt] = useState(false) - const context = React.useContext(AppContext) - - const onGetReceiptStatus = async (values: FormValues, clientInstance: any, apiKey: string) => { - try { - const {network, networkId} = await getNetworkName(clientInstance) - if (network === 'vm') { - setResults({ - succeed: false, - message: 'Cannot verify in the selected network' - }) - return - } - const etherscanApi = getEtherScanApi(networkId) - let result - if (isProxyContractReceipt) { - result = await getProxyContractReceiptStatus(values.receiptGuid, apiKey, etherscanApi) - if (result.status === '1') { - result.message = result.result - result.result = 'Successfully Updated' - } - } else result = await getReceiptStatus(values.receiptGuid, apiKey, etherscanApi) - setResults({ - succeed: result.status === '1' ? true : false, - message: result.result || (result.status === '0' ? 'Verification failed' : result.message) - }) - } catch (error: any) { - setResults({ - succeed: false, - message: error.message - }) - } - } - - return !context.apiKey ? ( - - ) : ( -
- { - const errors = {} as any - if (!values.receiptGuid) { - errors.receiptGuid = 'Required' - } - return errors - }} - onSubmit={(values) => onGetReceiptStatus(values, context.clientInstance, context.apiKey)} - > - {({errors, touched, handleSubmit, handleChange}) => ( -
-
- - - -
- -
- { - handleChange(e) - if (e.target.checked) setIsProxyContractReceipt(true) - else setIsProxyContractReceipt(false) - }} - /> - -
- - - )} -
- -
- - -
- - - -
- ) -} - -const ReceiptsTable = ({receipts}) => { - return ( -
-
Receipts
- - - - - - - - - {receipts && - receipts.length > 0 && - receipts.map((item: Receipt, index) => { - return ( - - - - - ) - })} - -
StatusGUID
- {item.status} - {item.status === 'Successfully Updated' && ( - - - - )} - {item.guid}
-
- ) -} diff --git a/apps/etherscan/src/app/views/VerifyView.tsx b/apps/etherscan/src/app/views/VerifyView.tsx deleted file mode 100644 index e8f4011072..0000000000 --- a/apps/etherscan/src/app/views/VerifyView.tsx +++ /dev/null @@ -1,235 +0,0 @@ -import React, {useEffect, useRef, useState} from 'react' -import { Web3 } from 'web3' - -import {PluginClient} from '@remixproject/plugin' -import {CustomTooltip} from '@remix-ui/helper' -import {Formik, ErrorMessage, Field} from 'formik' - -import {SubmitButton} from '../components' -import {Receipt} from '../types' -import {verify} from '../utils/verify' -import {etherscanScripts} from '@remix-project/remix-ws-templates' - -interface Props { - client: PluginClient - apiKey: string - onVerifiedContract: (receipt: Receipt) => void - contracts: string[], - networkName: string -} - -interface FormValues { - contractName: string - contractAddress: string - expectedImplAddress?: string -} - -export const VerifyView = ({apiKey, client, contracts, onVerifiedContract, networkName}) => { - const [results, setResults] = useState('') - const [selectedContract, setSelectedContract] = useState('') - const [showConstructorArgs, setShowConstructorArgs] = useState(false) - const [isProxyContract, setIsProxyContract] = useState(false) - const [constructorInputs, setConstructorInputs] = useState([]) - const verificationResult = useRef({}) - - useEffect(() => { - if (contracts.includes(selectedContract)) updateConsFields(selectedContract) - }, [contracts]) - - const updateConsFields = (contractName) => { - client.call('compilerArtefacts' as any, 'getArtefactsByContractName', contractName).then((result) => { - const {artefact} = result - if (artefact && artefact.abi && artefact.abi[0] && artefact.abi[0].type && artefact.abi[0].type === 'constructor' && artefact.abi[0].inputs.length > 0) { - setConstructorInputs(artefact.abi[0].inputs) - setShowConstructorArgs(true) - } else { - setConstructorInputs([]) - setShowConstructorArgs(false) - } - }) - } - - const onVerifyContract = async (values: FormValues) => { - const compilationResult = (await client.call('solidity', 'getCompilationResult')) as any - - if (!compilationResult) { - throw new Error('no compilation result available') - } - - const constructorValues = [] - for (const key in values) { - if (key.startsWith('contractArgValue')) constructorValues.push(values[key]) - } - const web3 = new Web3() - const constructorTypes = constructorInputs.map((e) => e.type) - let contractArguments = web3.eth.abi.encodeParameters(constructorTypes, constructorValues) - contractArguments = contractArguments.replace('0x', '') - - verificationResult.current = await verify( - apiKey, - values.contractAddress, - contractArguments, - values.contractName, - compilationResult, - null, - isProxyContract, - values.expectedImplAddress, - client, - onVerifiedContract, - setResults - ) - setResults(verificationResult.current['message']) - } - - return ( -
- { - const errors = {} as any - if (!values.contractName) { - errors.contractName = 'Required' - } - if (!values.contractAddress) { - errors.contractAddress = 'Required' - } - if (values.contractAddress.trim() === '' || !values.contractAddress.startsWith('0x') || values.contractAddress.length !== 42) { - errors.contractAddress = 'Please enter a valid contract address' - } - return errors - }} - onSubmit={(values) => onVerifyContract(values)} - > - {({errors, touched, handleSubmit, handleChange, isSubmitting}) => { - return ( -
-
- - - - -
-
- - { - handleChange(e) - setSelectedContract(e.target.value) - updateConsFields(e.target.value) - }} - > - - {contracts.map((item) => ( - - ))} - - -
-
- - {constructorInputs.map((item, index) => { - return ( -
- - - - -
- ) - })} -
-
- - - -
- { - handleChange(e) - if (e.target.checked) setIsProxyContract(true) - else setIsProxyContract(false) - }} - /> - -
-
-
- - - - - - -
- -
- - - - - ) - }} -
-
- {/*
- View Receipts -
*/} -
- ) -} diff --git a/apps/etherscan/src/app/views/index.ts b/apps/etherscan/src/app/views/index.ts deleted file mode 100644 index c483228ece..0000000000 --- a/apps/etherscan/src/app/views/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { HomeView } from "./HomeView" -export { ErrorView } from "./ErrorView" -export { ReceiptsView } from "./ReceiptsView" -export { CaptureKeyView } from "./CaptureKeyView" diff --git a/apps/etherscan/src/assets/.gitkeep b/apps/etherscan/src/assets/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/apps/etherscan/src/environments/environment.prod.ts b/apps/etherscan/src/environments/environment.prod.ts deleted file mode 100644 index 3612073bc3..0000000000 --- a/apps/etherscan/src/environments/environment.prod.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const environment = { - production: true -}; diff --git a/apps/etherscan/src/environments/environment.ts b/apps/etherscan/src/environments/environment.ts deleted file mode 100644 index d9370e924b..0000000000 --- a/apps/etherscan/src/environments/environment.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file can be replaced during build by using the `fileReplacements` array. -// When building for production, this file is replaced with `environment.prod.ts`. - -export const environment = { - production: false -}; diff --git a/apps/etherscan/src/favicon.ico b/apps/etherscan/src/favicon.ico deleted file mode 100644 index 317ebcb2336e0833a22dddf0ab287849f26fda57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmeI332;U^%p|z7g|#(P)qFEA@4f!_@qOK2 z_lJl}!lhL!VT_U|uN7%8B2iKH??xhDa;*`g{yjTFWHvXn;2s{4R7kH|pKGdy(7z!K zgftM+Ku7~24TLlh(!g)gz|foI94G^t2^IO$uvX$3(OR0<_5L2sB)lMAMy|+`xodJ{ z_Uh_1m)~h?a;2W{dmhM;u!YGo=)OdmId_B<%^V^{ovI@y`7^g1_V9G}*f# zNzAtvou}I!W1#{M^@ROc(BZ! z+F!!_aR&Px3_reO(EW+TwlW~tv*2zr?iP7(d~a~yA|@*a89IUke+c472NXM0wiX{- zl`UrZC^1XYyf%1u)-Y)jj9;MZ!SLfd2Hl?o|80Su%Z?To_=^g_Jt0oa#CT*tjx>BI z16wec&AOWNK<#i0Qd=1O$fymLRoUR*%;h@*@v7}wApDl^w*h}!sYq%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T$~#@rldvN3S1rEpU$;XgxVny7mki3 z-Hh|jUCHrUXuLr!)`w>wgO0N%KTB-1di>cj(x3Bav`7v z3G7EIbU$z>`Nad7Rk_&OT-W{;qg)-GXV-aJT#(ozdmnA~Rq3GQ_3mby(>q6Ocb-RgTUhTN)))x>m&eD;$J5Bg zo&DhY36Yg=J=$Z>t}RJ>o|@hAcwWzN#r(WJ52^g$lh^!63@hh+dR$&_dEGu&^CR*< z!oFqSqO@>xZ*nC2oiOd0eS*F^IL~W-rsrO`J`ej{=ou_q^_(<$&-3f^J z&L^MSYWIe{&pYq&9eGaArA~*kA - - - - Etherscan - - - - - - - -
- - - diff --git a/apps/etherscan/src/main.tsx b/apps/etherscan/src/main.tsx deleted file mode 100644 index 077b7ac8f4..0000000000 --- a/apps/etherscan/src/main.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -import * as ReactDOM from 'react-dom' -import { createRoot } from 'react-dom/client'; -import App from './app/app' - - -const container = document.getElementById('root'); - -if (container) { - createRoot(container).render( - - ); -} - diff --git a/apps/etherscan/src/polyfills.ts b/apps/etherscan/src/polyfills.ts deleted file mode 100644 index 2adf3d05b6..0000000000 --- a/apps/etherscan/src/polyfills.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Polyfill stable language features. These imports will be optimized by `@babel/preset-env`. - * - * See: https://github.com/zloirock/core-js#babel - */ -import 'core-js/stable'; -import 'regenerator-runtime/runtime'; diff --git a/apps/etherscan/src/profile.json b/apps/etherscan/src/profile.json deleted file mode 100644 index f1432cae88..0000000000 --- a/apps/etherscan/src/profile.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "etherscan", - "displayName": "Contract verification - Etherscan", - "description": "Verify Solidity contract code using Etherscan, BscScan, PolygonScan etc. APIs", - "version": "0.1.0", - "events": [], - "methods": ["verify", "receiptStatus"], - "kind": "none", - "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHsAAAB7CAYAAABUx/9/AAAABmJLR0QAA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RrT12rqYx+eYHh40nLQ9TesV0sayHWNe1RlmyqiNhm07/ujabM0qdfUzXpTmOyhDvMrk2fv9ma1hVz3iU29ztSWO7Am910F066ClmUZfN9XdofK9/1JzbWy5dIoilSAjuVyiSiKpF5L5WriMjQd1BrseR6iKJoksr7nUbbhUAiBJEmQpiniOB7lNgMZT4x2+hA6dZfWmyZ1fV0I0bpLtL4Gq4boOM7+GFN9q6/q8j8QmqQtM04gOgAAAABJRU5ErkJggg==", - "location": "sidePanel", - "url": "https://ipfs-cluster.ethdevops.io/ipfs/QmQsZbBSYCVBVpz2mVRbPRVTrcz59oJEpuuoxiT9otu3mh", - "repo": "https://github.com/ethereum/remix-project/tree/master/apps/etherscan", - "documentation": "https://remix-ide.readthedocs.io/en/latest/contract_verification.html#etherscan", - "maintainedBy": "Remix", - "authorContact": "remix@ethereum.org" -} \ No newline at end of file diff --git a/apps/etherscan/src/styles.css b/apps/etherscan/src/styles.css deleted file mode 100644 index 90d4ee0072..0000000000 --- a/apps/etherscan/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -/* You can add global styles to this file, and also import other style files */ diff --git a/apps/etherscan/tsconfig.app.json b/apps/etherscan/tsconfig.app.json deleted file mode 100644 index 252904bb73..0000000000 --- a/apps/etherscan/tsconfig.app.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": ["node"] - }, - "files": [ - "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", - "../../node_modules/@nrwl/react/typings/image.d.ts" - ], - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx" - ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] -} diff --git a/apps/etherscan/tsconfig.json b/apps/etherscan/tsconfig.json deleted file mode 100644 index 5aab5e7911..0000000000 --- a/apps/etherscan/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - }, - "files": [], - "include": [], - "references": [ - { - "path": "./tsconfig.app.json" - } - ] -} diff --git a/apps/etherscan/webpack.config.js b/apps/etherscan/webpack.config.js deleted file mode 100644 index 5564f25b94..0000000000 --- a/apps/etherscan/webpack.config.js +++ /dev/null @@ -1,90 +0,0 @@ -const {composePlugins, withNx} = require('@nrwl/webpack') -const webpack = require('webpack') -const TerserPlugin = require('terser-webpack-plugin') -const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') - -const versionData = { - timestamp: Date.now(), - mode: process.env.NODE_ENV === 'production' ? 'production' : 'development' -} -// Nx plugins for webpack. -module.exports = composePlugins(withNx(), (config) => { - // Update the webpack config as needed here. - // e.g. `config.plugins.push(new MyPlugin())` - - // add fallback for node modules - config.resolve.fallback = { - ...config.resolve.fallback, - crypto: require.resolve('crypto-browserify'), - stream: require.resolve('stream-browserify'), - path: require.resolve('path-browserify'), - http: require.resolve('stream-http'), - https: require.resolve('https-browserify'), - constants: require.resolve('constants-browserify'), - os: false, //require.resolve("os-browserify/browser"), - timers: false, // require.resolve("timers-browserify"), - zlib: require.resolve('browserify-zlib'), - fs: false, - module: false, - tls: false, - net: false, - readline: false, - child_process: false, - buffer: require.resolve('buffer/'), - vm: require.resolve('vm-browserify') - } - - // add externals - config.externals = { - ...config.externals, - solc: 'solc' - } - - // add public path - config.output.publicPath = '/' - - // set filename - config.output.filename = `[name].plugin-etherscan.${versionData.timestamp}.js` - config.output.chunkFilename = `[name].plugin-etherscan.${versionData.timestamp}.js` - - // add copy & provide plugin - config.plugins.push( - new webpack.ProvidePlugin({ - Buffer: ['buffer', 'Buffer'], - url: ['url', 'URL'], - process: 'process/browser' - }) - ) - - // souce-map loader - config.module.rules.push({ - test: /\.js$/, - use: ['source-map-loader'], - enforce: 'pre' - }) - - config.ignoreWarnings = [/Failed to parse source map/] // ignore source-map-loader warnings - - // set minimizer - config.optimization.minimizer = [ - new TerserPlugin({ - parallel: true, - terserOptions: { - ecma: 2015, - compress: false, - mangle: false, - format: { - comments: false - } - }, - extractComments: false - }), - new CssMinimizerPlugin() - ] - - config.watchOptions = { - ignored: /node_modules/ - } - - return config -}) diff --git a/apps/remix-ide/project.json b/apps/remix-ide/project.json index d53fdd6e33..a0f749c399 100644 --- a/apps/remix-ide/project.json +++ b/apps/remix-ide/project.json @@ -3,7 +3,7 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/remix-ide/src", "projectType": "application", - "implicitDependencies": ["doc-gen", "doc-viewer", "etherscan", "contract-verification", "vyper", "solhint", "walletconnect", "circuit-compiler", "learneth", "quick-dapp", "remix-dapp"], + "implicitDependencies": ["doc-gen", "doc-viewer", "contract-verification", "vyper", "solhint", "walletconnect", "circuit-compiler", "learneth", "quick-dapp", "remix-dapp"], "targets": { "build": { "executor": "@nrwl/webpack:webpack", diff --git a/apps/remix-ide/src/assets/list.json b/apps/remix-ide/src/assets/list.json index 82f8fe17bb..6a47e64612 100644 --- a/apps/remix-ide/src/assets/list.json +++ b/apps/remix-ide/src/assets/list.json @@ -1033,9 +1033,21 @@ "urls": [ "dweb:/ipfs/QmVTALD1WUQwRvEL19jgwrEFyBJMQmy9z32zvT6TAtYPY1" ] + }, + { + "path": "soljson-v0.8.28+commit.7893614a.js", + "version": "0.8.28", + "build": "commit.7893614a", + "longVersion": "0.8.28+commit.7893614a", + "keccak256": "0x8e01bd0cafb8a8bab060453637101a88e4ab6d41c32645a26eaca541fb169c8e", + "sha256": "0x72ef580a6ec5943130028e5294313f24e9435520acc89f8c9dbfd0139d9ae146", + "urls": [ + "dweb:/ipfs/QmVtdNYdUC4aX6Uk5LrxDT55B7NgGLnLcA2wTecF5xUbSS" + ] } ], "releases": { + "0.8.28": "soljson-v0.8.28+commit.7893614a.js", "0.8.27": "soljson-v0.8.27+commit.40a35a09.js", "0.8.26": "soljson-v0.8.26+commit.8a97fa7a.js", "0.8.25": "soljson-v0.8.25+commit.b61c2a91.js", @@ -1131,5 +1143,5 @@ "0.4.0": "soljson-v0.4.0+commit.acd334c9.js", "0.3.6": "soljson-v0.3.6+commit.3fc68da5.js" }, - "latestRelease": "0.8.27" -} \ No newline at end of file + "latestRelease": "0.8.28" +} From bbe2bff0667007eaa78e9e4c4e60aaf22b652883 Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 21 Oct 2024 17:32:48 +0200 Subject: [PATCH 06/20] fixing buid --- .../src/app/components/ContractDropdown.tsx | 7 +- .../src/app/components/NavMenu.tsx | 3 +- .../src/app/views/LookupView.tsx | 23 ++++-- .../src/app/views/VerifyView.tsx | 77 +++++++++++++++---- apps/contract-verification/src/profile.json | 2 +- apps/remix-ide/src/app/plugins/matomo.ts | 2 +- 6 files changed, 86 insertions(+), 28 deletions(-) diff --git a/apps/contract-verification/src/app/components/ContractDropdown.tsx b/apps/contract-verification/src/app/components/ContractDropdown.tsx index 99a1363cf1..b307aad1e4 100644 --- a/apps/contract-verification/src/app/components/ContractDropdown.tsx +++ b/apps/contract-verification/src/app/components/ContractDropdown.tsx @@ -43,7 +43,12 @@ export const ContractDropdown: React.FC = ({ label, id, s return (
- {hasContracts ? ( Object.keys(compilationOutput).map((compilationTriggerFileName) => ( diff --git a/apps/contract-verification/src/app/components/NavMenu.tsx b/apps/contract-verification/src/app/components/NavMenu.tsx index 73e40d4bff..8cc9099ca9 100644 --- a/apps/contract-verification/src/app/components/NavMenu.tsx +++ b/apps/contract-verification/src/app/components/NavMenu.tsx @@ -23,12 +23,11 @@ const NavItem: React.FC = ({ to, icon, title }) => { export const NavMenu = () => { return ( -
) diff --git a/apps/contract-verification/src/app/views/VerifyView.tsx b/apps/contract-verification/src/app/views/VerifyView.tsx index ff76b31a5b..20a0022d47 100644 --- a/apps/contract-verification/src/app/views/VerifyView.tsx +++ b/apps/contract-verification/src/app/views/VerifyView.tsx @@ -13,7 +13,7 @@ import { VerifyFormContext } from '../VerifyFormContext' import { useSourcifySupported } from '../hooks/useSourcifySupported' export const VerifyView = () => { - const { compilationOutput, setSubmittedContracts, settings } = useContext(AppContext) + const { compilationOutput, setSubmittedContracts, settings, clientInstance } = useContext(AppContext) const { selectedChain, setSelectedChain, contractAddress, setContractAddress, contractAddressError, setContractAddressError, selectedContract, setSelectedContract, proxyAddress, setProxyAddress, proxyAddressError, setProxyAddressError, abiEncodedConstructorArgs, setAbiEncodedConstructorArgs, abiEncodingError, setAbiEncodingError } = useContext(VerifyFormContext) const [enabledVerifiers, setEnabledVerifiers] = useState>>({}) const [hasProxy, setHasProxy] = useState(!!proxyAddress) @@ -41,9 +41,14 @@ export const VerifyView = () => { setEnabledVerifiers({ ...enabledVerifiers, [verifierId]: checked }) } + + const sendToMatomo = async (eventAction: string, eventName: string) => { + await clientInstance.call("matomo" as any, 'track', ['trackEvent', 'ContractVerification', eventAction, eventName]); + } + const handleVerify = async (e) => { e.preventDefault() - + const { triggerFilePath, filePath, contractName } = selectedContract const compilerAbstract = compilationOutput[triggerFilePath] if (!compilerAbstract) { @@ -63,6 +68,9 @@ export const VerifyView = () => { name: verifierId as VerifierIdentifier, } receipts.push({ verifierInfo, status: 'pending', contractId, isProxyReceipt: false, failedChecks: 0 }) + if (enabledVerifiers.Blockscout) await sendToMatomo('verify', "verifyWith: Blockscout On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Etherscan) await sendToMatomo('verify', "verifyWithEtherscan On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) + if (enabledVerifiers.Sourcify) await sendToMatomo('verify', "verifyWithSourcify On: " + selectedChain + " IsProxy: " + (hasProxy && !proxyAddress)) } const newSubmittedContract: SubmittedContract = { @@ -173,13 +181,24 @@ export const VerifyView = () => { return (
- - - - - - {selectedContract && } - + + + + + {selectedContract && }
setHasProxy(e.target.checked)} /> @@ -187,7 +206,14 @@ export const VerifyView = () => { The deployed contract is behind a proxy
- {hasProxy && } + {hasProxy && }
@@ -198,9 +224,19 @@ export const VerifyView = () => { return (
- handleVerifierCheckboxClick(verifierId, e.target.checked)} disabled={disabledVerifier} /> - -
@@ -227,10 +263,17 @@ export const VerifyView = () => { ) })}
- - + + + ) } diff --git a/apps/contract-verification/src/profile.json b/apps/contract-verification/src/profile.json index 6ac25db04a..f56f684c71 100644 --- a/apps/contract-verification/src/profile.json +++ b/apps/contract-verification/src/profile.json @@ -13,4 +13,4 @@ "documentation": "https://remix-ide.readthedocs.io/en/latest/contract_verification.html", "maintainedBy": "Remix", "authorContact": "remix@ethereum.org" -} \ No newline at end of file +} diff --git a/apps/remix-ide/src/app/plugins/matomo.ts b/apps/remix-ide/src/app/plugins/matomo.ts index 8aa8f61f70..e6af25655c 100644 --- a/apps/remix-ide/src/app/plugins/matomo.ts +++ b/apps/remix-ide/src/app/plugins/matomo.ts @@ -11,7 +11,7 @@ const profile = { version: '1.0.0' } -const allowedPlugins = ['LearnEth', 'etherscan', 'vyper', 'circuit-compiler', 'doc-gen', 'doc-viewer', 'solhint', 'walletconnect', 'scriptRunner', 'dgit'] +const allowedPlugins = ['LearnEth', 'etherscan', 'vyper', 'circuit-compiler', 'doc-gen', 'doc-viewer', 'solhint', 'walletconnect', 'scriptRunner', 'dgit', 'contract-verification'] export class Matomo extends Plugin { From 6ef6113cd16716dd4b0073536f686ce28d1cd1e8 Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 22 Oct 2024 13:06:32 +0200 Subject: [PATCH 07/20] updated the filter in plugin manager to include description --- .../components/plugin-manager-component.js | 3 +-- .../InactivePluginCardContainer.tsx | 7 +++++- libs/remix-ui/plugin-manager/src/types.d.ts | 22 +++++++++---------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide/src/app/components/plugin-manager-component.js b/apps/remix-ide/src/app/components/plugin-manager-component.js index d658915f1b..816d9c1c11 100644 --- a/apps/remix-ide/src/app/components/plugin-manager-component.js +++ b/apps/remix-ide/src/app/components/plugin-manager-component.js @@ -105,8 +105,7 @@ class PluginManagerComponent extends ViewPlugin { getAndFilterPlugins = (filter) => { this.filter = typeof filter === 'string' ? filter.toLowerCase() : this.filter - - const isFiltered = (profile) => (profile.displayName ? profile.displayName : profile.name).toLowerCase().includes(this.filter) + const isFiltered = (profile) => (profile.displayName + profile.name + profile.description).toLowerCase().includes(this.filter) const isNotRequired = (profile) => !this.appManager.isRequired(profile.name) const isNotDependent = (profile) => !this.appManager.isDependent(profile.name) const isNotHome = (profile) => profile.name !== 'home' diff --git a/libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx b/libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx index d3c219dd5e..61814b89a2 100644 --- a/libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx +++ b/libs/remix-ui/plugin-manager/src/lib/components/InactivePluginCardContainer.tsx @@ -29,7 +29,12 @@ function InactivePluginCardContainer({ pluginComponent }: InactivePluginCardCont ) : null} {pluginComponent.inactivePlugins && pluginComponent.inactivePlugins.map((profile, idx) => { - return + return })} ) diff --git a/libs/remix-ui/plugin-manager/src/types.d.ts b/libs/remix-ui/plugin-manager/src/types.d.ts index 5b6910c3ce..e7a0b10496 100644 --- a/libs/remix-ui/plugin-manager/src/types.d.ts +++ b/libs/remix-ui/plugin-manager/src/types.d.ts @@ -103,9 +103,9 @@ declare class LocalPlugin { * @returns {Promise<{api: any, profile: any}>} A promise with the new plugin profile */ open(plugins: any[]): Promise<{ - api: any - profile: any - }> + api: any + profile: any + }> profile: any /** @@ -113,21 +113,21 @@ declare class LocalPlugin { */ create(): any updateName({ target }: { - target: any - }): void + target: any + }): void updateUrl({ target }: { - target: any - }): void + target: any + }): void updateDisplayName({ target }: { - target: any - }): void + target: any + }): void updateProfile(key: any, e: any): void updateMethods({ target }: { - target: any - }): void + target: any + }): void /** The form to create a local plugin */ form(): any From 0974b9d146ec20c34fdf79d522ecf42ff8c0373a Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 22 Oct 2024 13:30:41 +0200 Subject: [PATCH 08/20] smaller nav tbns --- apps/contract-verification/src/app/components/NavMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/contract-verification/src/app/components/NavMenu.tsx b/apps/contract-verification/src/app/components/NavMenu.tsx index 8cc9099ca9..0c88fc86a2 100644 --- a/apps/contract-verification/src/app/components/NavMenu.tsx +++ b/apps/contract-verification/src/app/components/NavMenu.tsx @@ -11,7 +11,7 @@ const NavItem: React.FC = ({ to, icon, title }) => { return ( 'text-decoration-none d-flex flex-column justify-content-center py-2 px-2 small ' + (isActive ? 'bg-transparent' : 'bg-dark')} + className={({ isActive }) => 'text-decoration-none d-flex flex-column justify-content-center py-2 small ' + (isActive ? 'bg-transparent' : 'bg-dark')} > {icon} From 8b124483b489e8e75f1e5ce31b4ba72c6511dd2f Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 22 Oct 2024 14:51:02 +0200 Subject: [PATCH 09/20] navbar colors for dark theme --- apps/contract-verification/src/app/App.css | 2 +- apps/contract-verification/src/app/components/NavMenu.tsx | 6 +++--- apps/contract-verification/src/app/layouts/Default.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/contract-verification/src/app/App.css b/apps/contract-verification/src/app/App.css index b7df871af4..e036149047 100644 --- a/apps/contract-verification/src/app/App.css +++ b/apps/contract-verification/src/app/App.css @@ -7,7 +7,7 @@ body { } a:focus { - background-color: transparent !important; + background-color: var(bg-light) !important; } .fa-arrow-up-right-from-square::before { content: "\f08e"; } diff --git a/apps/contract-verification/src/app/components/NavMenu.tsx b/apps/contract-verification/src/app/components/NavMenu.tsx index 0c88fc86a2..914e0f917a 100644 --- a/apps/contract-verification/src/app/components/NavMenu.tsx +++ b/apps/contract-verification/src/app/components/NavMenu.tsx @@ -11,9 +11,9 @@ const NavItem: React.FC = ({ to, icon, title }) => { return ( 'text-decoration-none d-flex flex-column justify-content-center py-2 small ' + (isActive ? 'bg-transparent' : 'bg-dark')} + className={({ isActive }) => 'text-decoration-none d-flex px-1 flex-column justify-content-center small ' + (isActive ? "bg-light" : "bg-transparent")} > - + {icon} {title} @@ -23,7 +23,7 @@ const NavItem: React.FC = ({ to, icon, title }) => { export const NavMenu = () => { return ( -