From 3dd01f4858cd8c9d81cc7b81f0b439aac997d244 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Mon, 21 Aug 2023 13:47:46 +0100 Subject: [PATCH] adjust printWidth in prettier config --- .prettierrc.json | 1 + apps/etherscan/src/app/RemixPlugin.tsx | 31 +- apps/etherscan/src/app/app.tsx | 75 +-- .../src/app/components/HeaderWithSettings.tsx | 54 +- .../src/app/components/SubmitButton.tsx | 26 +- .../src/app/hooks/useLocalStorage.tsx | 3 +- apps/etherscan/src/app/layouts/Default.tsx | 6 +- .../src/app/views/CaptureKeyView.tsx | 25 +- apps/etherscan/src/app/views/ErrorView.tsx | 12 +- apps/etherscan/src/app/views/ReceiptsView.tsx | 91 +-- apps/etherscan/src/app/views/VerifyView.tsx | 181 +----- apps/remix-ide-e2e/nightwatch.ts | 13 +- .../src/local-plugin/src/app/app.tsx | 25 +- apps/remix-ide/background.js | 9 +- .../src/app/components/main-panel.tsx | 5 +- apps/remix-ide/src/app/components/preload.tsx | 87 +-- .../src/app/components/side-panel.tsx | 12 +- .../src/app/components/vertical-icons.tsx | 35 +- .../src/app/plugins/contractFlattener.tsx | 32 +- .../src/app/plugins/notification.tsx | 11 +- .../src/app/plugins/parser/code-parser.tsx | 204 ++---- .../app/plugins/permission-handler-plugin.tsx | 75 +-- .../src/app/plugins/remixd-handle.tsx | 64 +- .../src/app/plugins/solidity-script.tsx | 11 +- .../src/app/plugins/solidity-umlgen.tsx | 158 ++--- .../src/app/providers/abstract-provider.tsx | 16 +- .../app/providers/custom-vm-fork-provider.tsx | 19 +- .../app/providers/external-http-provider.tsx | 33 +- .../src/app/providers/hardhat-provider.tsx | 8 +- .../app/providers/injected-L2-provider.tsx | 16 +- .../providers/injected-provider-default.tsx | 13 +- .../src/app/providers/injected-provider.tsx | 34 +- .../providers/mainnet-vm-fork-provider.tsx | 3 +- .../src/app/providers/vm-provider.tsx | 25 +- apps/remix-ide/src/blockchain/blockchain.tsx | 469 +++----------- apps/remix-ide/webpack.config.js | 19 +- apps/solidity-compiler/webpack.config.js | 5 +- apps/vyper/src/app/app.tsx | 49 +- .../src/app/components/CompilerButton.tsx | 30 +- apps/vyper/src/app/components/LocalUrl.tsx | 11 +- apps/vyper/src/app/components/VyperResult.tsx | 12 +- apps/vyper/src/app/components/WarnRemote.tsx | 5 +- apps/vyper/src/app/utils/compiler.tsx | 22 +- apps/vyper/src/app/utils/remix-client.tsx | 39 +- apps/walletconnect/src/app/app.tsx | 8 +- .../walletconnect/src/app/walletConnectUI.tsx | 6 +- apps/walletconnect/webpack.config.js | 4 +- libs/remix-debug/test.ts | 16 +- .../remix-app/components/dragbar/dragbar.tsx | 21 +- .../remix-app/components/modals/dialogs.tsx | 6 +- .../remix-app/components/modals/matomo.tsx | 31 +- .../components/modals/modal-wrapper.tsx | 26 +- .../components/modals/origin-warning.tsx | 11 +- .../lib/remix-app/components/splashscreen.tsx | 12 +- .../app/src/lib/remix-app/context/context.tsx | 16 +- .../src/lib/remix-app/context/provider.tsx | 36 +- .../app/src/lib/remix-app/remix-app.tsx | 32 +- .../checkbox/src/lib/remix-ui-checkbox.tsx | 40 +- .../copy-to-clipboard/copy-to-clipboard.tsx | 23 +- .../debugger-ui/src/hooks/extract-data.tsx | 29 +- .../lib/button-navigator/button-navigator.tsx | 66 +- .../debugger-ui/src/lib/debugger-ui.tsx | 254 ++------ .../src/lib/step-manager/step-manager.tsx | 6 +- .../src/lib/tx-browser/tx-browser.tsx | 20 +- .../src/lib/vm-debugger/assembly-items.tsx | 62 +- .../src/lib/vm-debugger/dropdown-panel.tsx | 100 +-- .../lib/vm-debugger/full-storages-changes.tsx | 5 +- .../src/lib/vm-debugger/global-variables.tsx | 11 +- .../src/lib/vm-debugger/memory-panel.tsx | 7 +- .../src/lib/vm-debugger/solidity-locals.tsx | 19 +- .../src/lib/vm-debugger/solidity-state.tsx | 20 +- .../src/lib/vm-debugger/stack-panel.tsx | 7 +- .../src/lib/vm-debugger/step-detail.tsx | 7 +- .../src/lib/vm-debugger/storage-panel.tsx | 6 +- .../src/lib/vm-debugger/vm-debugger-head.tsx | 39 +- .../src/lib/vm-debugger/vm-debugger.tsx | 32 +- .../drag-n-drop/src/lib/drag-n-drop.tsx | 9 +- .../editor/src/lib/remix-ui-editor.tsx | 425 +++--------- .../lib/components/file-decoration-icon.tsx | 46 +- .../file-decoration-custom-icon.tsx | 5 +- .../file-decoration-error-icon.tsx | 5 +- .../file-decoration-tooltip.tsx | 16 +- .../file-decoration-warning-icon.tsx | 5 +- .../file-decorators/src/lib/helper/index.tsx | 4 +- .../src/lib/components/custom-dropdown.tsx | 38 +- .../src/lib/components/custom-tooltip.tsx | 26 +- .../helper/src/lib/components/web3Dialog.tsx | 33 +- .../helper/src/lib/helper-components.tsx | 60 +- .../src/lib/components/customNavButtons.tsx | 20 +- .../src/lib/components/homeTabFeatured.tsx | 70 +- .../lib/components/homeTabFeaturedPlugins.tsx | 42 +- .../src/lib/components/homeTabFile.tsx | 74 +-- .../src/lib/components/homeTabGetStarted.tsx | 29 +- .../src/lib/components/homeTabLearn.tsx | 67 +- .../src/lib/components/homeTabScamAlert.tsx | 13 +- .../src/lib/components/homeTabTitle.tsx | 63 +- .../src/lib/components/pluginButton.tsx | 34 +- .../src/lib/components/workspaceTemplate.tsx | 11 +- .../home-tab/src/lib/remix-ui-home-tab.tsx | 12 +- .../src/lib/remix-ui-locale-module.tsx | 15 +- .../src/lib/remix-ui-modal-dialog.tsx | 41 +- .../panel/src/lib/dragbar/dragbar.tsx | 13 +- .../panel/src/lib/main/main-panel.tsx | 23 +- .../panel/src/lib/plugins/panel-header.tsx | 63 +- .../panel/src/lib/plugins/panel-plugin.tsx | 7 +- .../panel/src/lib/plugins/remix-ui-panel.tsx | 7 +- .../src/lib/permission-dialog.tsx | 51 +- .../src/lib/components/ActivePluginCard.tsx | 83 +-- .../components/ActivePluginCardContainer.tsx | 18 +- .../src/lib/components/InactivePluginCard.tsx | 79 +-- .../InactivePluginCardContainer.tsx | 30 +- .../src/lib/components/LocalPluginForm.tsx | 73 +-- .../src/lib/components/moduleHeading.tsx | 10 +- .../lib/components/permissionsSettings.tsx | 149 ++--- .../src/lib/components/rootView.tsx | 17 +- .../src/lib/remix-ui-plugin-manager.tsx | 24 +- .../src/lib/publish-to-storage.tsx | 46 +- .../src/lib/publishOnSwarm.tsx | 41 +- .../src/lib/publishToIPFS.tsx | 21 +- libs/remix-ui/renderer/src/lib/renderer.tsx | 35 +- .../run-tab/src/lib/components/account.tsx | 85 +-- .../src/lib/components/contractDropdownUI.tsx | 230 ++----- .../src/lib/components/contractGUI.tsx | 313 ++------- .../src/lib/components/deployButton.tsx | 17 +- .../src/lib/components/deployInput.tsx | 24 +- .../src/lib/components/environment.tsx | 51 +- .../run-tab/src/lib/components/gasPrice.tsx | 15 +- .../lib/components/instanceContainerUI.tsx | 21 +- .../run-tab/src/lib/components/mainnet.tsx | 83 +-- .../src/lib/components/multiDeployInput.tsx | 16 +- .../run-tab/src/lib/components/network.tsx | 4 +- .../src/lib/components/recorderCardUI.tsx | 82 +-- .../run-tab/src/lib/components/settingsUI.tsx | 13 +- .../src/lib/components/universalDappUI.tsx | 193 ++---- .../run-tab/src/lib/components/value.tsx | 14 +- libs/remix-ui/run-tab/src/lib/run-tab.tsx | 58 +- .../search/src/lib/components/Find.tsx | 22 +- .../src/lib/components/FindContainer.tsx | 11 +- .../src/lib/components/OverWriteCheck.tsx | 13 +- .../search/src/lib/components/Replace.tsx | 7 +- .../search/src/lib/components/StopSearch.tsx | 5 +- .../search/src/lib/components/Undo.tsx | 33 +- .../lib/components/results/ResultFileName.tsx | 16 +- .../src/lib/components/results/ResultItem.tsx | 32 +- .../lib/components/results/ResultSummary.tsx | 31 +- .../src/lib/components/results/Results.tsx | 5 +- .../search/src/lib/context/context.tsx | 104 +-- .../settings/src/lib/etherscan-settings.tsx | 17 +- .../settings/src/lib/github-settings.tsx | 34 +- .../settings/src/lib/remix-ui-settings.tsx | 259 ++------ .../src/lib/compiler-container.tsx | 481 +++----------- .../src/lib/contract-selection.tsx | 176 +---- .../src/lib/solidity-compiler.tsx | 62 +- .../src/lib/components/UmlDownload.tsx | 58 +- .../src/lib/solidity-uml-gen.tsx | 43 +- .../src/lib/solidity-unit-testing.tsx | 424 +++--------- .../src/lib/Button/StaticAnalyserButton.tsx | 34 +- .../static-analyser/src/lib/ErrorRenderer.tsx | 27 +- .../src/lib/components/BasicTitle.tsx | 21 +- .../src/lib/remix-ui-static-analyser.tsx | 458 +++---------- libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx | 137 +--- .../src/lib/components/ChechTxStatus.tsx | 19 +- .../terminal/src/lib/components/Context.tsx | 14 +- .../src/lib/components/RenderCall.tsx | 45 +- .../components/RenderKnownTransactions.tsx | 42 +- .../components/RenderUnknownTransactions.tsx | 22 +- .../terminal/src/lib/components/Table.tsx | 183 +----- .../terminal/src/lib/remix-ui-terminal.tsx | 377 ++--------- .../terminal/src/lib/terminalWelcome.tsx | 4 +- .../src/lib/remix-ui-theme-module.tsx | 15 +- libs/remix-ui/toaster/src/lib/toaster.tsx | 25 +- .../tooltip-popup/src/lib/tooltip-popup.tsx | 4 +- .../src/lib/tree-view-item/tree-view-item.tsx | 30 +- .../src/lib/components/Badge.tsx | 44 +- .../src/lib/components/BasicLogo.tsx | 17 +- .../src/lib/components/Chevron.tsx | 8 +- .../src/lib/components/Icon.tsx | 52 +- .../src/lib/components/IconList.tsx | 21 +- .../src/lib/remix-ui-vertical-icons-panel.tsx | 63 +- .../src/lib/vertical-icons-context-menu.tsx | 36 +- .../components/file-explorer-context-menu.tsx | 174 +---- .../src/lib/components/file-explorer-menu.tsx | 69 +- .../src/lib/components/file-explorer.tsx | 115 +--- .../src/lib/components/file-label.tsx | 15 +- .../src/lib/components/file-render.tsx | 81 +-- .../src/lib/components/upload-file.tsx | 10 +- .../components/workspace-hamburger-item.tsx | 49 +- .../lib/components/workspace-hamburger.tsx | 20 +- .../src/lib/providers/FileSystemProvider.tsx | 74 +-- .../workspace/src/lib/remix-ui-workspace.tsx | 605 ++++-------------- 190 files changed, 2137 insertions(+), 8830 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index d7840d1dca..38fb48dc5d 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,6 +1,7 @@ { "tabWidth": 2, "useTabs": false, + "printWidth": 180, "semi": false, "singleQuote": true, "quoteProps": "consistent", diff --git a/apps/etherscan/src/app/RemixPlugin.tsx b/apps/etherscan/src/app/RemixPlugin.tsx index 6c02917229..59967c5e41 100644 --- a/apps/etherscan/src/app/RemixPlugin.tsx +++ b/apps/etherscan/src/app/RemixPlugin.tsx @@ -1,11 +1,6 @@ import {PluginClient} from '@remixproject/plugin' import {verify, EtherScanReturn} from './utils/verify' -import { - getReceiptStatus, - getEtherScanApi, - getNetworkName, - getProxyContractReceiptStatus -} from './utils' +import {getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus} from './utils' export class RemixClient extends PluginClient { loaded() { @@ -38,33 +33,17 @@ export class RemixClient extends PluginClient { return result } - async receiptStatus( - receiptGuid: string, - apiKey: string, - isProxyContract: boolean - ) { + 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' - ) + 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 - ) + 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 diff --git a/apps/etherscan/src/app/app.tsx b/apps/etherscan/src/app/app.tsx index baaa452278..972413f7f2 100644 --- a/apps/etherscan/src/app/app.tsx +++ b/apps/etherscan/src/app/app.tsx @@ -1,9 +1,6 @@ import React, {useState, useEffect, useRef} from 'react' -import { - CompilationFileSources, - CompilationResult -} from '@remixproject/plugin-api' +import {CompilationFileSources, CompilationResult} from '@remixproject/plugin-api' import {RemixClient} from './RemixPlugin' import {createClient} from '@remixproject/plugin-webview' @@ -13,12 +10,7 @@ import {DisplayRoutes} from './routes' import {useLocalStorage} from './hooks/useLocalStorage' -import { - getReceiptStatus, - getEtherScanApi, - getNetworkName, - getProxyContractReceiptStatus -} from './utils' +import {getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus} from './utils' import {Receipt, ThemeType} from './types' import './App.css' @@ -54,27 +46,15 @@ const App = () => { const loadClient = async () => { await client.onload() setClientInstance(client) - client.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) - } - ) + client.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) + }) //const currentTheme = await client.call("theme", "currentTheme") //setThemeType(currentTheme.quality) @@ -88,10 +68,7 @@ const App = () => { useEffect(() => { let receiptsNotVerified: Receipt[] = receipts.filter((item: Receipt) => { - return ( - item.status === 'Pending in queue' || - item.status === 'Max rate limit reached' - ) + return item.status === 'Pending in queue' || item.status === 'Max rate limit reached' }) if (receiptsNotVerified.length > 0) { @@ -100,9 +77,7 @@ const App = () => { timer.current = null } timer.current = setInterval(async () => { - const {network, networkId} = await getNetworkName( - clientInstanceRef.current - ) + const {network, networkId} = await getNetworkName(clientInstanceRef.current) if (!clientInstanceRef.current) { return } @@ -115,26 +90,13 @@ const App = () => { 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) - ) + 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' - ) { + } 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 = { @@ -149,10 +111,7 @@ const App = () => { } } receiptsNotVerified = newReceipts.filter((item: Receipt) => { - return ( - item.status === 'Pending in queue' || - item.status === 'Max rate limit reached' - ) + return item.status === 'Pending in queue' || item.status === 'Max rate limit reached' }) if (timer.current && receiptsNotVerified.length === 0) { clearInterval(timer.current) diff --git a/apps/etherscan/src/app/components/HeaderWithSettings.tsx b/apps/etherscan/src/app/components/HeaderWithSettings.tsx index e321287114..8f302dd596 100644 --- a/apps/etherscan/src/app/components/HeaderWithSettings.tsx +++ b/apps/etherscan/src/app/components/HeaderWithSettings.tsx @@ -20,23 +20,11 @@ const HomeIcon: React.FC = ({from}: IconProps) => { to={{ pathname: '/' }} - className={({isActive}) => - 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'} - } + className={({isActive}) => (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} > - + @@ -50,23 +38,11 @@ const ReceiptsIcon: React.FC = ({from}: IconProps) => { to={{ pathname: '/receipts' }} - className={({isActive}) => - 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'} - } + className={({isActive}) => (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} > - + @@ -80,23 +56,11 @@ const SettingsIcon: React.FC = ({from}: IconProps) => { to={{ pathname: '/settings' }} - className={({isActive}) => - 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'} - } + className={({isActive}) => (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} > - + diff --git a/apps/etherscan/src/app/components/SubmitButton.tsx b/apps/etherscan/src/app/components/SubmitButton.tsx index 2364168935..080fafc708 100644 --- a/apps/etherscan/src/app/components/SubmitButton.tsx +++ b/apps/etherscan/src/app/components/SubmitButton.tsx @@ -8,26 +8,12 @@ interface Props { disable?: boolean } -export const SubmitButton: React.FC = ({ - text, - dataId, - isSubmitting = false, - disable = true -}) => { +export const SubmitButton: React.FC = ({text, dataId, isSubmitting = false, disable = true}) => { return (
-
{ handleChange(e) @@ -188,9 +141,7 @@ export const VerifyView: React.FC = ({ }} > {contracts.map((item) => ( ))} - +
-
+
{constructorInputs.map((item, index) => { return (
- - - + + +
) @@ -243,20 +167,12 @@ export const VerifyView: React.FC = ({
- +
= ({ else setIsProxyContract(false) }} /> -
-
- +
+ - + - - + +
= ({ } />
- + ) diff --git a/apps/remix-ide/background.js b/apps/remix-ide/background.js index 40f75068b2..5bffa0da9e 100644 --- a/apps/remix-ide/background.js +++ b/apps/remix-ide/background.js @@ -4,10 +4,7 @@ chrome.browserAction.onClicked.addListener(function (tab) { chrome.storage.sync.set({'chrome-app-sync': true}) - chrome.tabs.create( - {url: chrome.extension.getURL('index.html')}, - function (tab) { - // tab opened - } - ) + chrome.tabs.create({url: chrome.extension.getURL('index.html')}, function (tab) { + // tab opened + }) }) diff --git a/apps/remix-ide/src/app/components/main-panel.tsx b/apps/remix-ide/src/app/components/main-panel.tsx index ed4a4b637e..15311a6173 100644 --- a/apps/remix-ide/src/app/components/main-panel.tsx +++ b/apps/remix-ide/src/app/components/main-panel.tsx @@ -60,10 +60,7 @@ export class MainPanel extends AbstractPanel { render() { return ( -
+
) diff --git a/apps/remix-ide/src/app/components/preload.tsx b/apps/remix-ide/src/app/components/preload.tsx index a3d7180283..ec9be4597a 100644 --- a/apps/remix-ide/src/app/components/preload.tsx +++ b/apps/remix-ide/src/app/components/preload.tsx @@ -5,10 +5,7 @@ import * as packageJson from '../../../../../package.json' import {fileSystem, fileSystems} from '../files/fileSystem' import {indexedDBFileSystem} from '../files/filesystems/indexedDB' import {localStorageFS} from '../files/filesystems/localStorage' -import { - fileSystemUtility, - migrationTestData -} from '../files/filesystems/fileSystemUtility' +import {fileSystemUtility, migrationTestData} from '../files/filesystems/fileSystemUtility' import './styles/preload.css' const _paq = (window._paq = window._paq || []) @@ -21,19 +18,13 @@ export const Preload = () => { const localStorageFileSystem = useRef(new localStorageFS()) // url parameters to e2e test the fallbacks and error warnings const testmigrationFallback = useRef( - window.location.hash.includes('e2e_testmigration_fallback=true') && - window.location.host === '127.0.0.1:8080' && - window.location.protocol === 'http:' + window.location.hash.includes('e2e_testmigration_fallback=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:' ) const testmigrationResult = useRef( - window.location.hash.includes('e2e_testmigration=true') && - window.location.host === '127.0.0.1:8080' && - window.location.protocol === 'http:' + window.location.hash.includes('e2e_testmigration=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:' ) const testBlockStorage = useRef( - window.location.hash.includes('e2e_testblock_storage=true') && - window.location.host === '127.0.0.1:8080' && - window.location.protocol === 'http:' + window.location.hash.includes('e2e_testblock_storage=true') && window.location.host === '127.0.0.1:8080' && window.location.protocol === 'http:' ) function loadAppComponent() { @@ -59,33 +50,21 @@ export const Preload = () => { const downloadBackup = async () => { setShowDownloader(false) const fsUtility = new fileSystemUtility() - await fsUtility.downloadBackup( - remixFileSystems.current.fileSystems['localstorage'] - ) + await fsUtility.downloadBackup(remixFileSystems.current.fileSystems['localstorage']) await migrateAndLoad() } const migrateAndLoad = async () => { setShowDownloader(false) const fsUtility = new fileSystemUtility() - const migrationResult = await fsUtility.migrate( - localStorageFileSystem.current, - remixIndexedDB.current - ) - _paq.push([ - 'trackEvent', - 'Migrate', - 'result', - migrationResult ? 'success' : 'fail' - ]) + const migrationResult = await fsUtility.migrate(localStorageFileSystem.current, remixIndexedDB.current) + _paq.push(['trackEvent', 'Migrate', 'result', migrationResult ? 'success' : 'fail']) await setFileSystems() } const setFileSystems = async () => { const fsLoaded = await remixFileSystems.current.setFileSystem([ - testmigrationFallback.current || testBlockStorage.current - ? null - : remixIndexedDB.current, + testmigrationFallback.current || testBlockStorage.current ? null : remixIndexedDB.current, testBlockStorage.current ? null : localStorageFileSystem.current ]) if (fsLoaded) { @@ -101,36 +80,18 @@ export const Preload = () => { const testmigration = async () => { if (testmigrationResult.current) { const fsUtility = new fileSystemUtility() - fsUtility.populateWorkspace( - migrationTestData, - remixFileSystems.current.fileSystems['localstorage'].fs - ) + fsUtility.populateWorkspace(migrationTestData, remixFileSystems.current.fileSystems['localstorage'].fs) } } useEffect(() => { async function loadStorage() { - ;(await remixFileSystems.current.addFileSystem(remixIndexedDB.current)) || - _paq.push(['trackEvent', 'Storage', 'error', 'indexedDB not supported']) - ;(await remixFileSystems.current.addFileSystem( - localStorageFileSystem.current - )) || - _paq.push([ - 'trackEvent', - 'Storage', - 'error', - 'localstorage not supported' - ]) + ;(await remixFileSystems.current.addFileSystem(remixIndexedDB.current)) || _paq.push(['trackEvent', 'Storage', 'error', 'indexedDB not supported']) + ;(await remixFileSystems.current.addFileSystem(localStorageFileSystem.current)) || _paq.push(['trackEvent', 'Storage', 'error', 'localstorage not supported']) await testmigration() - remixIndexedDB.current.loaded && - (await remixIndexedDB.current.checkWorkspaces()) - localStorageFileSystem.current.loaded && - (await localStorageFileSystem.current.checkWorkspaces()) - remixIndexedDB.current.loaded && - (remixIndexedDB.current.hasWorkSpaces || - !localStorageFileSystem.current.hasWorkSpaces - ? await setFileSystems() - : setShowDownloader(true)) + remixIndexedDB.current.loaded && (await remixIndexedDB.current.checkWorkspaces()) + localStorageFileSystem.current.loaded && (await localStorageFileSystem.current.checkWorkspaces()) + remixIndexedDB.current.loaded && (remixIndexedDB.current.hasWorkSpaces || !localStorageFileSystem.current.hasWorkSpaces ? await setFileSystems() : setShowDownloader(true)) !remixIndexedDB.current.loaded && (await setFileSystems()) } loadStorage() @@ -149,9 +110,7 @@ export const Preload = () => {
{!supported ? (
- Your browser does not support any of the filesystems required by - Remix. Either change the settings in your browser or use a supported - browser. + Your browser does not support any of the filesystems required by Remix. Either change the settings in your browser or use a supported browser.
) : null} {error ? ( @@ -164,8 +123,7 @@ export const Preload = () => {

- Firefox: CTRL + SHIFT + R or CTRL + F5

- MacOS:

- Chrome & FireFox: CMD + SHIFT + R or SHIFT + - Reload Button

+ MacOS:

- Chrome & FireFox: CMD + SHIFT + R or SHIFT + Reload Button

Linux:

- Chrome & FireFox: CTRL + SHIFT + R

@@ -174,11 +132,9 @@ export const Preload = () => { ) : null} {showDownloader ? (
- This app will be updated now. Please download a backup of your files - now to make sure you don't lose your work. + This app will be updated now. Please download a backup of your files now to make sure you don't lose your work.

- You don't need to do anything else, your files will be available - when the app loads. + You don't need to do anything else, your files will be available when the app loads.
{ await downloadBackup() @@ -210,12 +166,7 @@ export const Preload = () => { } const logo = ( - + diff --git a/apps/remix-ide/src/app/components/side-panel.tsx b/apps/remix-ide/src/app/components/side-panel.tsx index 50e1dac0dc..6ea715f420 100644 --- a/apps/remix-ide/src/app/components/side-panel.tsx +++ b/apps/remix-ide/src/app/components/side-panel.tsx @@ -56,8 +56,7 @@ export class SidePanel extends AbstractPanel { } removeView(profile) { - if (this.plugins[profile.name].active) - this.call('menuicons', 'select', 'filePanel') + if (this.plugins[profile.name].active) this.call('menuicons', 'select', 'filePanel') super.removeView(profile) this.emit('pluginDisabled', profile.name) this.call('menuicons', 'unlinkContent', profile) @@ -94,14 +93,7 @@ export class SidePanel extends AbstractPanel { } updateComponent(state: any) { - return ( - - } - plugins={state.plugins} - /> - ) + return } plugins={state.plugins} /> } renderComponent() { diff --git a/apps/remix-ide/src/app/components/vertical-icons.tsx b/apps/remix-ide/src/app/components/vertical-icons.tsx index 2e4b67a852..f43a5505c3 100644 --- a/apps/remix-ide/src/app/components/vertical-icons.tsx +++ b/apps/remix-ide/src/app/components/vertical-icons.tsx @@ -3,10 +3,7 @@ import React from 'react' import packageJson from '../../../../../package.json' import {Plugin} from '@remixproject/engine' import {EventEmitter} from 'events' -import { - IconRecord, - RemixUiVerticalIconsPanel -} from '@remix-ui/vertical-icons-panel' +import {IconRecord, RemixUiVerticalIconsPanel} from '@remix-ui/vertical-icons-panel' import {Profile} from '@remixproject/plugin-utils' import {PluginViewWrapper} from '@remix-ui/helper' @@ -32,16 +29,7 @@ export class VerticalIcons extends Plugin { } renderComponent() { - const fixedOrder = [ - 'filePanel', - 'search', - 'solidity', - 'udapp', - 'debugger', - 'solidityStaticAnalysis', - 'solidityUnitTesting', - 'pluginManager' - ] + const fixedOrder = ['filePanel', 'search', 'solidity', 'udapp', 'debugger', 'solidityStaticAnalysis', 'solidityUnitTesting', 'pluginManager'] const divived = Object.values(this.icons) .map((value) => { @@ -57,10 +45,7 @@ export class VerticalIcons extends Plugin { const required = divived .filter((value) => value.isRequired) .sort((a, b) => { - return ( - fixedOrder.indexOf(a.profile.name) - - fixedOrder.indexOf(b.profile.name) - ) + return fixedOrder.indexOf(a.profile.name) - fixedOrder.indexOf(b.profile.name) }) const sorted: IconRecord[] = [ @@ -97,12 +82,7 @@ export class VerticalIcons extends Plugin { this.icons[profile.name] = { profile: profile, active: false, - canbeDeactivated: await this.call( - 'manager', - 'canDeactivate', - this.profile, - profile - ), + canbeDeactivated: await this.call('manager', 'canDeactivate', this.profile, profile), timestamp: Date.now() } this.renderComponent() @@ -139,12 +119,7 @@ export class VerticalIcons extends Plugin { } updateComponent(state: any) { - return ( - - ) + return } render() { diff --git a/apps/remix-ide/src/app/plugins/contractFlattener.tsx b/apps/remix-ide/src/app/plugins/contractFlattener.tsx index 18c1336e54..2c3640bcd9 100644 --- a/apps/remix-ide/src/app/plugins/contractFlattener.tsx +++ b/apps/remix-ide/src/app/plugins/contractFlattener.tsx @@ -1,11 +1,7 @@ import React from 'react' import {Plugin} from '@remixproject/engine' import {customAction} from '@remixproject/plugin-api' -import { - concatSourceFiles, - getDependencyGraph, - normalizeContractPath -} from '@remix-ui/solidity-compiler' +import {concatSourceFiles, getDependencyGraph, normalizeContractPath} from '@remix-ui/solidity-compiler' const _paq = (window._paq = window._paq || []) @@ -25,18 +21,14 @@ export class ContractFlattener extends Plugin { } onActivation(): void { - this.on( - 'solidity', - 'compilationFinished', - async (file, source, languageVersion, data, input, version) => { - if (data.sources && Object.keys(data.sources).length > 1) { - if (this.triggerFlattenContract) { - this.triggerFlattenContract = false - await this.flattenContract(source, file, data) - } + this.on('solidity', 'compilationFinished', async (file, source, languageVersion, data, input, version) => { + if (data.sources && Object.keys(data.sources).length > 1) { + if (this.triggerFlattenContract) { + this.triggerFlattenContract = false + await this.flattenContract(source, file, data) } } - ) + }) _paq.push(['trackEvent', 'plugin', 'activated', 'contractFlattener']) } @@ -55,11 +47,7 @@ export class ContractFlattener extends Plugin { * Takes the flattened result, writes it to a file and returns the result. * @returns {Promise} */ - async flattenContract( - source: {sources: any; target: string}, - filePath: string, - data: {contracts: any; sources: any} - ): Promise { + async flattenContract(source: {sources: any; target: string}, filePath: string, data: {contracts: any; sources: any}): Promise { const appendage = '_flattened.sol' const normalized = normalizeContractPath(filePath) const path = `${normalized[normalized.length - 2]}${appendage}` @@ -70,9 +58,7 @@ export class ContractFlattener extends Plugin { let sources try { dependencyGraph = getDependencyGraph(ast, filePath) - sorted = dependencyGraph.isEmpty() - ? [filePath] - : dependencyGraph.sort().reverse() + sorted = dependencyGraph.isEmpty() ? [filePath] : dependencyGraph.sort().reverse() sources = source.sources result = concatSourceFiles(sorted, sources) } catch (err) { diff --git a/apps/remix-ide/src/app/plugins/notification.tsx b/apps/remix-ide/src/app/plugins/notification.tsx index 7d790aaf68..ca2b27437a 100644 --- a/apps/remix-ide/src/app/plugins/notification.tsx +++ b/apps/remix-ide/src/app/plugins/notification.tsx @@ -1,9 +1,5 @@ import {Plugin} from '@remixproject/engine' -import { - LibraryProfile, - MethodApi, - StatusEvents -} from '@remixproject/plugin-utils' +import {LibraryProfile, MethodApi, StatusEvents} from '@remixproject/plugin-utils' import {AppModal} from '@remix-ui/app' import {AlertModal} from '@remix-ui/app' import {dispatchModalInterface} from '@remix-ui/app' @@ -24,10 +20,7 @@ const profile: LibraryProfile = { methods: ['modal', 'alert', 'toast'] } -export class NotificationPlugin - extends Plugin - implements MethodApi -{ +export class NotificationPlugin extends Plugin implements MethodApi { dispatcher: dispatchModalInterface constructor() { super(profile) diff --git a/apps/remix-ide/src/app/plugins/parser/code-parser.tsx b/apps/remix-ide/src/app/plugins/parser/code-parser.tsx index f9d46bb7bf..2a38f35bf1 100644 --- a/apps/remix-ide/src/app/plugins/parser/code-parser.tsx +++ b/apps/remix-ide/src/app/plugins/parser/code-parser.tsx @@ -6,9 +6,7 @@ import {CompilationResult} from '@remix-project/remix-solidity' import CodeParserGasService from './services/code-parser-gas-service' import CodeParserCompiler from './services/code-parser-compiler' import CodeParserAntlrService from './services/code-parser-antlr-service' -import CodeParserImports, { - CodeParserImportsData -} from './services/code-parser-imports' +import CodeParserImports, {CodeParserImportsData} from './services/code-parser-imports' import React from 'react' import {Profile} from '@remixproject/plugin-utils' import { @@ -138,32 +136,15 @@ export class CodeParser extends Plugin { } async handleChangeEvents() { - const completionSettings = await this.call( - 'config', - 'getAppParameter', - 'auto-completion' - ) + const completionSettings = await this.call('config', 'getAppParameter', 'auto-completion') if (completionSettings) { this.antlrService.enableWorker() } else { this.antlrService.disableWorker() } - const showGasSettings = await this.call( - 'config', - 'getAppParameter', - 'show-gas' - ) - const showErrorSettings = await this.call( - 'config', - 'getAppParameter', - 'display-errors' - ) - if ( - showGasSettings || - showErrorSettings || - completionSettings || - this.debuggerIsOn - ) { + const showGasSettings = await this.call('config', 'getAppParameter', 'show-gas') + const showErrorSettings = await this.call('config', 'getAppParameter', 'display-errors') + if (showGasSettings || showErrorSettings || completionSettings || this.debuggerIsOn) { await this.compilerService.compile() } } @@ -175,15 +156,10 @@ export class CodeParser extends Plugin { this.importService = new CodeParserImports(this) this.parseSolidity = this.antlrService.parseSolidity.bind(this.antlrService) - this.getLastNodeInLine = this.antlrService.getLastNodeInLine.bind( - this.antlrService - ) + this.getLastNodeInLine = this.antlrService.getLastNodeInLine.bind(this.antlrService) this.listAstNodes = this.antlrService.listAstNodes.bind(this.antlrService) - this.getANTLRBlockAtPosition = - this.antlrService.getANTLRBlockAtPosition.bind(this.antlrService) - this.setCurrentFileAST = this.antlrService.setCurrentFileAST.bind( - this.antlrService - ) + this.getANTLRBlockAtPosition = this.antlrService.getANTLRBlockAtPosition.bind(this.antlrService) + this.setCurrentFileAST = this.antlrService.setCurrentFileAST.bind(this.antlrService) this.getImports = this.importService.getImports.bind(this.importService) this.on('editor', 'didChangeFile', async (file) => { @@ -205,11 +181,7 @@ export class CodeParser extends Plugin { this.on('fileManager', 'currentFileChanged', async () => { await this.call('editor', 'discardLineTexts') - const completionSettings = await this.call( - 'config', - 'getAppParameter', - 'auto-completion' - ) + const completionSettings = await this.call('config', 'getAppParameter', 'auto-completion') if (completionSettings) { this.antlrService.setCurrentFileAST() } @@ -271,11 +243,7 @@ export class CodeParser extends Plugin { _buildIndex(compilationResult: CompilationResult, source) { if (compilationResult && compilationResult.sources) { const callback = (node: genericASTNode) => { - if ( - node && - 'referencedDeclaration' in node && - node.referencedDeclaration - ) { + if (node && 'referencedDeclaration' in node && node.referencedDeclaration) { if (!this.nodeIndex.declarations[node.referencedDeclaration]) { this.nodeIndex.declarations[node.referencedDeclaration] = [] } @@ -305,32 +273,14 @@ export class CodeParser extends Plugin { return '(' + params.toString() + ')' } - _flatNodeList( - contractNode: ContractDefinitionAstNode, - fileName: string, - inScope: boolean, - compilatioResult: any - ) { + _flatNodeList(contractNode: ContractDefinitionAstNode, fileName: string, inScope: boolean, compilatioResult: any) { const index = {} const contractName: string = contractNode.name const callback = (node) => { - if ( - inScope && - node.scope !== contractNode.id && - !( - node.nodeType === 'EnumDefinition' || - node.nodeType === 'EventDefinition' || - node.nodeType === 'ModifierDefinition' - ) - ) + if (inScope && node.scope !== contractNode.id && !(node.nodeType === 'EnumDefinition' || node.nodeType === 'EventDefinition' || node.nodeType === 'ModifierDefinition')) return if (inScope) node.isClassNode = true - node.gasEstimate = this._getContractGasEstimate( - node, - contractName, - fileName, - compilatioResult - ) + node.gasEstimate = this._getContractGasEstimate(node, contractName, fileName, compilatioResult) node.functionName = node.name + this._getInputParams(node) node.contractName = contractName node.contractId = contractNode.id @@ -340,33 +290,16 @@ export class CodeParser extends Plugin { return index } - _extractFileNodes( - fileName: string, - compilationResult: lastCompilationResult - ) { - if ( - compilationResult && - compilationResult.data.sources && - compilationResult.data.sources[fileName] - ) { + _extractFileNodes(fileName: string, compilationResult: lastCompilationResult) { + if (compilationResult && compilationResult.data.sources && compilationResult.data.sources[fileName]) { const source = compilationResult.data.sources[fileName] const nodesByContract: any = {} nodesByContract.imports = {} nodesByContract.contracts = {} this.astWalker.walkFull(source.ast, async (node) => { if (node.nodeType === 'ContractDefinition') { - const flatNodes = this._flatNodeList( - node, - fileName, - false, - compilationResult - ) - node.gasEstimate = this._getContractGasEstimate( - node, - node.name, - fileName, - compilationResult - ) + const flatNodes = this._flatNodeList(node, fileName, false, compilationResult) + node.gasEstimate = this._getContractGasEstimate(node, node.name, fileName, compilationResult) nodesByContract.contracts[node.name] = { contractDefinition: node, contractNodes: flatNodes @@ -382,11 +315,7 @@ export class CodeParser extends Plugin { node.contractId = (baseContract as any).id node.isBaseNode = true baseNodes[node.id] = node - if ( - (node.scope && node.scope === baseContract.id) || - node.nodeType === 'EnumDefinition' || - node.nodeType === 'EventDefinition' - ) { + if ((node.scope && node.scope === baseContract.id) || node.nodeType === 'EnumDefinition' || node.nodeType === 'EventDefinition') { baseNodesWithBaseContractScope[node.id] = node } if (node.members) { @@ -402,10 +331,8 @@ export class CodeParser extends Plugin { } } nodesByContract.contracts[node.name].baseNodes = baseNodes - nodesByContract.contracts[node.name].baseNodesWithBaseContractScope = - baseNodesWithBaseContractScope - nodesByContract.contracts[node.name].contractScopeNodes = - this._flatNodeList(node, fileName, true, compilationResult) + nodesByContract.contracts[node.name].baseNodesWithBaseContractScope = baseNodesWithBaseContractScope + nodesByContract.contracts[node.name].contractScopeNodes = this._flatNodeList(node, fileName, true, compilationResult) } if (node.nodeType === 'ImportDirective') { const imported = await this.resolveImports(node, {}) @@ -422,15 +349,8 @@ export class CodeParser extends Plugin { } } - _getContractGasEstimate( - node: ContractDefinitionAstNode | FunctionDefinitionAstNode, - contractName: string, - fileName: string, - compilationResult: lastCompilationResult - ) { - const contracts = - compilationResult.data.contracts && - compilationResult.data.contracts[this.currentFile] + _getContractGasEstimate(node: ContractDefinitionAstNode | FunctionDefinitionAstNode, contractName: string, fileName: string, compilationResult: lastCompilationResult) { + const contracts = compilationResult.data.contracts && compilationResult.data.contracts[this.currentFile] for (const name in contracts) { if (name === contractName) { const contract = contracts[name] @@ -444,21 +364,15 @@ export class CodeParser extends Plugin { const fn = fnName + this._getInputParams(node) if (visibility === 'public' || visibility === 'external') { - executionCost = - estimationObj === null ? '-' : estimationObj.external[fn] + executionCost = estimationObj === null ? '-' : estimationObj.external[fn] } else if (visibility === 'private' || visibility === 'internal') { - executionCost = - estimationObj === null ? '-' : estimationObj.internal[fn] + executionCost = estimationObj === null ? '-' : estimationObj.internal[fn] } return {executionCost} } else { return { - creationCost: - estimationObj === null ? '-' : estimationObj.creation.totalCost, - codeDepositCost: - estimationObj === null - ? '-' - : estimationObj.creation.codeDepositCost + creationCost: estimationObj === null ? '-' : estimationObj.creation.totalCost, + codeDepositCost: estimationObj === null ? '-' : estimationObj.creation.codeDepositCost } } } @@ -472,25 +386,14 @@ export class CodeParser extends Plugin { * @param type * @returns */ - async nodesAtPosition( - position: number, - type = '' - ): Promise { + async nodesAtPosition(position: number, type = ''): Promise { let lastCompilationResult = this.compilerAbstract if (this.debuggerIsOn) { - lastCompilationResult = await this.call( - 'compilerArtefacts', - 'get', - '__last' - ) + lastCompilationResult = await this.call('compilerArtefacts', 'get', '__last') this.currentFile = await this.call('fileManager', 'file') } if (!lastCompilationResult) return [] - const urlFromPath = await this.call( - 'fileManager', - 'getUrlFromPath', - this.currentFile - ) + const urlFromPath = await this.call('fileManager', 'getUrlFromPath', this.currentFile) if ( lastCompilationResult && lastCompilationResult.languageversion.indexOf('soljson') === 0 && @@ -501,8 +404,7 @@ export class CodeParser extends Plugin { const nodes: genericASTNode[] = sourceMappingDecoder.nodesAtPosition( type, position, - lastCompilationResult.data.sources[this.currentFile] || - lastCompilationResult.data.sources[urlFromPath.file] + lastCompilationResult.data.sources[this.currentFile] || lastCompilationResult.data.sources[urlFromPath.file] ) return nodes } @@ -528,8 +430,7 @@ export class CodeParser extends Plugin { * @returns */ async getDeclaration(id: number) { - if (this.nodeIndex.declarations && this.nodeIndex.declarations[id]) - return this.nodeIndex.declarations[id] + if (this.nodeIndex.declarations && this.nodeIndex.declarations[id]) return this.nodeIndex.declarations[id] } /** @@ -603,11 +504,7 @@ export class CodeParser extends Plugin { if (!nodeDefinition) nodeDefinition = node } } - if ( - nodeDefinition && - nodeDefinition.type && - nodeDefinition.type === 'Identifier' - ) { + if (nodeDefinition && nodeDefinition.type && nodeDefinition.type === 'Identifier') { const nodeForIdentifier = await this.findIdentifier(nodeDefinition) if (nodeForIdentifier) nodeDefinition = nodeForIdentifier } @@ -621,21 +518,15 @@ export class CodeParser extends Plugin { this.nodeIndex.nodesPerFile && this.nodeIndex.nodesPerFile[this.currentFile] && this.nodeIndex.nodesPerFile[this.currentFile].contracts[contractName] && - this.nodeIndex.nodesPerFile[this.currentFile].contracts[contractName] - .contractNodes + this.nodeIndex.nodesPerFile[this.currentFile].contracts[contractName].contractNodes ) { - return this.nodeIndex.nodesPerFile[this.currentFile].contracts[ - contractName - ] + return this.nodeIndex.nodesPerFile[this.currentFile].contracts[contractName] } return false } async getCurrentFileNodes() { - if ( - this.nodeIndex.nodesPerFile && - this.nodeIndex.nodesPerFile[this.currentFile] - ) { + if (this.nodeIndex.nodesPerFile && this.nodeIndex.nodesPerFile[this.currentFile]) { return this.nodeIndex.nodesPerFile[this.currentFile] } return false @@ -750,9 +641,7 @@ export class CodeParser extends Plugin { const position = await this.positionOfDefinition(node) if (this.compilerAbstract && this.compilerAbstract.source && position) { const fileName = this.compilerAbstract.getSourceName(position.file) - return lineColumn - ? `${fileName} ${lineColumn.start.line}:${lineColumn.start.column}` - : null + return lineColumn ? `${fileName} ${lineColumn.start.line}:${lineColumn.start.column}` : null } return '' } @@ -771,13 +660,8 @@ export class CodeParser extends Plugin { async getLineColumnOfPosition(position: any) { if (position) { const fileName = this.compilerAbstract.getSourceName(position.file) - const lineBreaks = sourceMappingDecoder.getLinebreakPositions( - this.compilerAbstract.source.sources[fileName].content - ) - const lineColumn = sourceMappingDecoder.convertOffsetToLineColumn( - position, - lineBreaks - ) + const lineBreaks = sourceMappingDecoder.getLinebreakPositions(this.compilerAbstract.source.sources[fileName].content) + const lineColumn = sourceMappingDecoder.convertOffsetToLineColumn(position, lineBreaks) return lineColumn } } @@ -788,11 +672,7 @@ export class CodeParser extends Plugin { * @returns */ async getNodeDocumentation(node: genericASTNode) { - if ( - 'documentation' in node && - node.documentation && - (node.documentation as any).text - ) { + if ('documentation' in node && node.documentation && (node.documentation as any).text) { let text = '' ;(node.documentation as any).text.split('\n').forEach((line) => { text += `${line.trim()}\n` @@ -807,8 +687,7 @@ export class CodeParser extends Plugin { * @returns */ async getVariableDeclaration(node: any) { - const nodeVisibility = - node.visibility && node.visibility.length ? node.visibility + ' ' : '' + const nodeVisibility = node.visibility && node.visibility.length ? node.visibility + ' ' : '' const nodeName = node.name && node.name.length ? node.name : '' if (node.typeDescriptions && node.typeDescriptions.typeString) { return `${node.typeDescriptions.typeString} ${nodeVisibility}${nodeName}` @@ -829,8 +708,7 @@ export class CodeParser extends Plugin { * @returns */ async getFunctionParamaters(node: any) { - const localParam = - (node.parameters && node.parameters.parameters) || node.parameters + const localParam = (node.parameters && node.parameters.parameters) || node.parameters if (localParam) { const params = [] for (const param of localParam) { diff --git a/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx b/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx index 169388d16a..a77a210277 100644 --- a/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx +++ b/apps/remix-ide/src/app/plugins/permission-handler-plugin.tsx @@ -2,10 +2,7 @@ import React from 'react' // eslint-disable-line import {FormattedMessage} from 'react-intl' import {Plugin} from '@remixproject/engine' import {AppModal} from '@remix-ui/app' -import { - PermissionHandlerDialog, - PermissionHandlerValue -} from '@remix-ui/permission-handler' +import {PermissionHandlerDialog, PermissionHandlerValue} from '@remix-ui/permission-handler' import {Profile} from '@remixproject/plugin-utils' const profile = { @@ -49,21 +46,11 @@ export class PermissionHandlerPlugin extends Plugin { } } - switchMode( - from: Profile, - to: Profile, - method: string, - set: boolean, - sensitiveCall: boolean - ) { + switchMode(from: Profile, to: Profile, method: string, set: boolean, sensitiveCall: boolean) { if (sensitiveCall) { - set - ? (this.sessionPermissions[to.name][method][from.name] = {}) - : delete this.sessionPermissions[to.name][method][from.name] + set ? (this.sessionPermissions[to.name][method][from.name] = {}) : delete this.sessionPermissions[to.name][method][from.name] } else { - set - ? (this.permissions[to.name][method][from.name] = {}) - : delete this.permissions[to.name][method][from.name] + set ? (this.permissions[to.name][method][from.name] = {}) : delete this.permissions[to.name][method][from.name] } } @@ -74,9 +61,7 @@ export class PermissionHandlerPlugin extends Plugin { } notAllowWarning(from: Profile, to: Profile, method: string) { - return `${ - from.displayName || from.name - } is not allowed to call ${method} method of ${to.displayName || to.name}.` + return `${from.displayName || from.name} is not allowed to call ${method} method of ${to.displayName || to.name}.` } async getTheme() { @@ -91,33 +76,20 @@ export class PermissionHandlerPlugin extends Plugin { * @param {string} message from the caller plugin to add more details if needed * @returns {Promise} */ - async askPermission( - from: Profile, - to: Profile, - method: string, - message: string, - sensitiveCall: boolean - ) { + async askPermission(from: Profile, to: Profile, method: string, message: string, sensitiveCall: boolean) { try { if (sensitiveCall) { - if (!this.sessionPermissions[to.name]) - this.sessionPermissions[to.name] = {} - if (!this.sessionPermissions[to.name][method]) - this.sessionPermissions[to.name][method] = {} - if (!this.sessionPermissions[to.name][method][from.name]) - return this.openPermission(from, to, method, message, sensitiveCall) + if (!this.sessionPermissions[to.name]) this.sessionPermissions[to.name] = {} + if (!this.sessionPermissions[to.name][method]) this.sessionPermissions[to.name][method] = {} + if (!this.sessionPermissions[to.name][method][from.name]) return this.openPermission(from, to, method, message, sensitiveCall) } else { this.permissions = this._getFromLocal() if (!this.permissions[to.name]) this.permissions[to.name] = {} - if (!this.permissions[to.name][method]) - this.permissions[to.name][method] = {} - if (!this.permissions[to.name][method][from.name]) - return this.openPermission(from, to, method, message, sensitiveCall) + if (!this.permissions[to.name][method]) this.permissions[to.name][method] = {} + if (!this.permissions[to.name][method][from.name]) return this.openPermission(from, to, method, message, sensitiveCall) } - const {allow, hash} = sensitiveCall - ? this.sessionPermissions[to.name][method][from.name] - : this.permissions[to.name][method][from.name] + const {allow, hash} = sensitiveCall ? this.sessionPermissions[to.name][method][from.name] : this.permissions[to.name][method][from.name] if (!allow) { const warning = this.notAllowWarning(from, to, method) this.call('notification', 'toast', warning) @@ -131,13 +103,7 @@ export class PermissionHandlerPlugin extends Plugin { } } - async openPermission( - from: Profile, - to: Profile, - method: string, - message: string, - sensitiveCall: boolean - ) { + async openPermission(from: Profile, to: Profile, method: string, message: string, sensitiveCall: boolean) { let remember if (sensitiveCall) { remember = this.sessionPermissions[to.name][method][from.name] @@ -154,19 +120,8 @@ export class PermissionHandlerPlugin extends Plugin { } const modal: AppModal = { id: 'PermissionHandler', - title: ( - - ), - message: ( - - ), + title: , + message: , okLabel: , cancelLabel: } diff --git a/apps/remix-ide/src/app/plugins/remixd-handle.tsx b/apps/remix-ide/src/app/plugins/remixd-handle.tsx index 33d289b0a7..f74c22bf24 100644 --- a/apps/remix-ide/src/app/plugins/remixd-handle.tsx +++ b/apps/remix-ide/src/app/plugins/remixd-handle.tsx @@ -14,19 +14,7 @@ const profile = { name: 'remixd', displayName: 'RemixD', url: 'ws://127.0.0.1:65520', - methods: [ - 'folderIsReadOnly', - 'resolveDirectory', - 'get', - 'exists', - 'isFile', - 'set', - 'rename', - 'remove', - 'isDirectory', - 'list', - 'createDir' - ], + methods: ['folderIsReadOnly', 'resolveDirectory', 'get', 'exists', 'isFile', 'set', 'rename', 'remove', 'isDirectory', 'list', 'createDir'], events: [], description: 'Using Remixd daemon, allow to access file system', kind: 'other', @@ -96,8 +84,7 @@ export class RemixdHandle extends WebsocketPlugin { console.log(error) const alert: AlertModal = { id: 'connectionAlert', - message: - 'Cannot connect to the remixd daemon. Please make sure you have the remixd running in the background.' + message: 'Cannot connect to the remixd daemon. Please make sure you have the remixd running in the background.' } this.call('notification', 'alert', alert) this.canceled() @@ -108,20 +95,14 @@ export class RemixdHandle extends WebsocketPlugin { clearInterval(intervalId) const alert: AlertModal = { id: 'connectionAlert', - message: - 'Connection to remixd terminated. Please make sure remixd is still running in the background.' + message: 'Connection to remixd terminated. Please make sure remixd is still running in the background.' } this.call('notification', 'alert', alert) this.canceled() } }, 3000) this.localhostProvider.init(() => { - this.call( - 'filePanel', - 'setWorkspace', - {name: LOCALHOST, isLocalhost: true}, - true - ) + this.call('filePanel', 'setWorkspace', {name: LOCALHOST, isLocalhost: true}, true) }) for (const plugin of this.dependentPlugins) { await this.appManager.activatePlugin(plugin) @@ -173,27 +154,20 @@ export class RemixdHandle extends WebsocketPlugin { function remixdDialog() { const commandText = 'remixd' - const fullCommandText = - 'remixd -s -u ' + const fullCommandText = 'remixd -s -u ' return ( <>
Access your local file system from Remix IDE using{' '} - + Remixd NPM package .
Remixd{' '} - + documentation . @@ -204,10 +178,8 @@ function remixdDialog() { {commandText}
- The remixd command without options uses the terminal's current - directory as the shared directory and the shared Remix domain can only - be https://remix.ethereum.org, https://remix-alpha.ethereum.org, or - https://remix-beta.ethereum.org + The remixd command without options uses the terminal's current directory as the shared directory and the shared Remix domain can only be https://remix.ethereum.org, + https://remix-alpha.ethereum.org, or https://remix-beta.ethereum.org
Example command with flags:
@@ -215,26 +187,16 @@ function remixdDialog() {
For info about ports, see{' '} - + Remixd ports usage
-
- This feature is still in Alpha. We recommend to keep a backup of the - shared folder. -
+
This feature is still in Alpha. We recommend to keep a backup of the shared folder.
- Before using, make sure remixd version is latest i.e.{' '} - v{remixdVersion} + Before using, make sure remixd version is latest i.e. v{remixdVersion}

- + Read here how to update it
diff --git a/apps/remix-ide/src/app/plugins/solidity-script.tsx b/apps/remix-ide/src/app/plugins/solidity-script.tsx index dccc59c6c5..a19ca834df 100644 --- a/apps/remix-ide/src/app/plugins/solidity-script.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-script.tsx @@ -19,11 +19,7 @@ export class SolidityScript extends Plugin { async execute(path: string, functionName: string = 'run') { _paq.push(['trackEvent', 'SolidityScript', 'execute', 'script']) - this.call( - 'terminal', - 'log', - `Running free function '${functionName}' from ${path}...` - ) + this.call('terminal', 'log', `Running free function '${functionName}' from ${path}...`) let content = await this.call('fileManager', 'readFile', path) const params = await this.call('solidity', 'getCompilerParameters') @@ -99,10 +95,7 @@ export class SolidityScript extends Plugin { // which in turn uses util.format: https://nodejs.org/dist/latest-v12.x/docs/api/util.html#util_util_format_format_args // For example: console.log("Name: %s, Age: %d", remix, 6) will log 'Name: remix, Age: 6' // We check first arg to determine if 'util.format' is needed - if ( - typeof log[0] === 'string' && - (log[0].includes('%s') || log[0].includes('%d')) - ) { + if (typeof log[0] === 'string' && (log[0].includes('%s') || log[0].includes('%d'))) { formattedLog = format(log[0], ...log.slice(1)) } else { formattedLog = log.join(' ') diff --git a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx index fc19289c4a..ebbb7b9bb2 100644 --- a/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx +++ b/apps/remix-ide/src/app/plugins/solidity-umlgen.tsx @@ -3,11 +3,7 @@ import {ViewPlugin} from '@remixproject/engine-web' import React from 'react' // eslint-disable-next-line @nrwl/nx/enforce-module-boundaries import {RemixUiSolidityUmlGen} from '@remix-ui/solidity-uml-gen' -import { - ISolidityUmlGen, - ThemeQualityType, - ThemeSummary -} from 'libs/remix-ui/solidity-uml-gen/src/types' +import {ISolidityUmlGen, ThemeQualityType, ThemeSummary} from 'libs/remix-ui/solidity-uml-gen/src/types' import {RemixAppManager} from 'libs/remix-ui/plugin-manager/src/types' import {normalizeContractPath} from 'libs/remix-ui/solidity-compiler/src/lib/logic/flattenerUtilities' import {convertAST2UmlClasses} from 'sol2uml/lib/converterAST2Classes' @@ -22,8 +18,7 @@ const _paq = (window._paq = window._paq || []) const profile = { name: 'solidityumlgen', displayName: 'Solidity UML Generator', - description: - 'Generates UML diagram in svg format from last compiled contract', + description: 'Generates UML diagram in svg format from last compiled contract', location: 'mainPanel', methods: ['showUmlDiagram', 'generateUml', 'generateCustomAction'], events: [] @@ -67,55 +62,43 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen { onActivation(): void { this.handleThemeChange() - this.on( - 'solidity', - 'compilationFinished', - async (file: string, source, languageVersion, data, input, version) => { - if (!this.triggerGenerateUml) return - this.triggerGenerateUml = false - const currentTheme: ThemeQualityType = await this.call( - 'theme', - 'currentTheme' - ) - this.currentlySelectedTheme = currentTheme.quality - this.themeName = currentTheme.name - let result = '' - const normalized = normalizeContractPath(file) - this.currentFile = normalized[normalized.length - 1] - try { - if (data.sources && Object.keys(data.sources).length > 1) { - // we should flatten first as there are multiple asts - result = await this.flattenContract(source, file, data) - } - const ast = - result.length > 1 - ? parser.parse(result) - : parser.parse(source.sources[file].content) - this.umlClasses = convertAST2UmlClasses(ast, this.currentFile) - let umlDot = '' - this.activeTheme = await this.call('theme', 'currentTheme') - umlDot = convertUmlClasses2Dot(this.umlClasses, false, { - backColor: this.activeTheme.backgroundColor, - textColor: this.activeTheme.textColor, - shapeColor: this.activeTheme.shapeColor, - fillColor: this.activeTheme.fillColor - }) - const payload = vizRenderStringSync(umlDot) - this.updatedSvg = payload - _paq.push(['trackEvent', 'solidityumlgen', 'umlgenerated']) - this.renderComponent() - await this.call('tabs', 'focus', 'solidityumlgen') - } catch (error) { - console.log('error', error) + this.on('solidity', 'compilationFinished', async (file: string, source, languageVersion, data, input, version) => { + if (!this.triggerGenerateUml) return + this.triggerGenerateUml = false + const currentTheme: ThemeQualityType = await this.call('theme', 'currentTheme') + this.currentlySelectedTheme = currentTheme.quality + this.themeName = currentTheme.name + let result = '' + const normalized = normalizeContractPath(file) + this.currentFile = normalized[normalized.length - 1] + try { + if (data.sources && Object.keys(data.sources).length > 1) { + // we should flatten first as there are multiple asts + result = await this.flattenContract(source, file, data) } + const ast = result.length > 1 ? parser.parse(result) : parser.parse(source.sources[file].content) + this.umlClasses = convertAST2UmlClasses(ast, this.currentFile) + let umlDot = '' + this.activeTheme = await this.call('theme', 'currentTheme') + umlDot = convertUmlClasses2Dot(this.umlClasses, false, { + backColor: this.activeTheme.backgroundColor, + textColor: this.activeTheme.textColor, + shapeColor: this.activeTheme.shapeColor, + fillColor: this.activeTheme.fillColor + }) + const payload = vizRenderStringSync(umlDot) + this.updatedSvg = payload + _paq.push(['trackEvent', 'solidityumlgen', 'umlgenerated']) + this.renderComponent() + await this.call('tabs', 'focus', 'solidityumlgen') + } catch (error) { + console.log('error', error) } - ) + }) } getThemeCssVariables(cssVars: string) { - return window - .getComputedStyle(document.documentElement) - .getPropertyValue(cssVars) + return window.getComputedStyle(document.documentElement).getPropertyValue(cssVars) } private handleThemeChange() { @@ -160,13 +143,7 @@ export class SolidityUmlGen extends ViewPlugin implements ISolidityUmlGen { * @returns {Promise} */ async flattenContract(source: any, filePath: string, data: any) { - const result = await this.call( - 'contractflattener', - 'flattenContract', - source, - filePath, - data - ) + const result = await this.call('contractflattener', 'flattenContract', source, filePath, data) return result } @@ -231,12 +208,7 @@ interface Sol2umlClassOptions extends ClassOptions { import {dirname} from 'path' import {convertClass2Dot} from 'sol2uml/lib/converterClass2Dot' -import { - Association, - ClassStereotype, - ReferenceType, - UmlClass -} from 'sol2uml/lib/umlClass' +import {Association, ClassStereotype, ReferenceType, UmlClass} from 'sol2uml/lib/umlClass' import {findAssociatedClass} from 'sol2uml/lib/associations' // const debug = require('debug')('sol2uml') @@ -249,11 +221,7 @@ import {findAssociatedClass} from 'sol2uml/lib/associations' * @param classOptions command line options for the `class` command * @return dotString Graphviz's DOT format for defining nodes, edges and clusters. */ -export function convertUmlClasses2Dot( - umlClasses: UmlClass[], - clusterFolders: boolean = false, - classOptions: Sol2umlClassOptions = {} -): string { +export function convertUmlClasses2Dot(umlClasses: UmlClass[], clusterFolders: boolean = false, classOptions: Sol2umlClassOptions = {}): string { let dotString: string = ` digraph UmlClassDiagram { rankdir=BT @@ -318,10 +286,7 @@ function sortUmlClassesByCodePath(umlClasses: UmlClass[]): UmlClass[] { }) } -export function addAssociationsToDot( - umlClasses: UmlClass[], - classOptions: ClassOptions = {} -): string { +export function addAssociationsToDot(umlClasses: UmlClass[], classOptions: ClassOptions = {}): string { let dotString: string = '' // for each class @@ -351,18 +316,9 @@ export function addAssociationsToDot( // for each association in that class for (const association of Object.values(sourceUmlClass.associations)) { - const targetUmlClass = findAssociatedClass( - association, - sourceUmlClass, - umlClasses - ) + const targetUmlClass = findAssociatedClass(association, sourceUmlClass, umlClasses) if (targetUmlClass) { - dotString += addAssociationToDot( - sourceUmlClass, - targetUmlClass, - association, - classOptions - ) + dotString += addAssociationToDot(sourceUmlClass, targetUmlClass, association, classOptions) } } } @@ -370,41 +326,23 @@ export function addAssociationsToDot( return dotString } -function addAssociationToDot( - sourceUmlClass: UmlClass, - targetUmlClass: UmlClass, - association: Association, - classOptions: ClassOptions = {} -): string { +function addAssociationToDot(sourceUmlClass: UmlClass, targetUmlClass: UmlClass, association: Association, classOptions: ClassOptions = {}): string { // do not include library or interface associations if hidden // Or associations to Structs, Enums or Constants if they are hidden if ( - (classOptions.hideLibraries && - (sourceUmlClass.stereotype === ClassStereotype.Library || - targetUmlClass.stereotype === ClassStereotype.Library)) || - (classOptions.hideInterfaces && - (targetUmlClass.stereotype === ClassStereotype.Interface || - sourceUmlClass.stereotype === ClassStereotype.Interface)) || - (classOptions.hideAbstracts && - (targetUmlClass.stereotype === ClassStereotype.Abstract || - sourceUmlClass.stereotype === ClassStereotype.Abstract)) || - (classOptions.hideStructs && - targetUmlClass.stereotype === ClassStereotype.Struct) || - (classOptions.hideEnums && - targetUmlClass.stereotype === ClassStereotype.Enum) || - (classOptions.hideConstants && - targetUmlClass.stereotype === ClassStereotype.Constant) + (classOptions.hideLibraries && (sourceUmlClass.stereotype === ClassStereotype.Library || targetUmlClass.stereotype === ClassStereotype.Library)) || + (classOptions.hideInterfaces && (targetUmlClass.stereotype === ClassStereotype.Interface || sourceUmlClass.stereotype === ClassStereotype.Interface)) || + (classOptions.hideAbstracts && (targetUmlClass.stereotype === ClassStereotype.Abstract || sourceUmlClass.stereotype === ClassStereotype.Abstract)) || + (classOptions.hideStructs && targetUmlClass.stereotype === ClassStereotype.Struct) || + (classOptions.hideEnums && targetUmlClass.stereotype === ClassStereotype.Enum) || + (classOptions.hideConstants && targetUmlClass.stereotype === ClassStereotype.Constant) ) { return '' } let dotString = `\n${sourceUmlClass.id} -> ${targetUmlClass.id} [` - if ( - association.referenceType == ReferenceType.Memory || - (association.realization && - targetUmlClass.stereotype === ClassStereotype.Interface) - ) { + if (association.referenceType == ReferenceType.Memory || (association.realization && targetUmlClass.stereotype === ClassStereotype.Interface)) { dotString += 'style=dashed, ' } diff --git a/apps/remix-ide/src/app/providers/abstract-provider.tsx b/apps/remix-ide/src/app/providers/abstract-provider.tsx index 4b4272ee89..97682642a3 100644 --- a/apps/remix-ide/src/app/providers/abstract-provider.tsx +++ b/apps/remix-ide/src/app/providers/abstract-provider.tsx @@ -70,8 +70,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider { } else { return { valid: false, - message: - 'the provided value should contain the protocol ( e.g starts with http:// or https:// )' + message: 'the provided value should contain the protocol ( e.g starts with http:// or https:// )' } } }, @@ -119,22 +118,13 @@ export abstract class AbstractProvider extends Plugin implements IProvider { return } - private async sendAsyncInternal( - data: JsonDataRequest, - resolve: SuccessRequest, - reject: RejectRequest - ): Promise { + private async sendAsyncInternal(data: JsonDataRequest, resolve: SuccessRequest, reject: RejectRequest): Promise { if (this.provider) { try { const result = await this.provider.send(data.method, data.params) resolve({jsonrpc: '2.0', result, id: data.id}) } catch (error) { - if ( - error && - error.message && - error.message.includes('net_version') && - error.message.includes('SERVER_ERROR') - ) { + if (error && error.message && error.message.includes('net_version') && error.message.includes('SERVER_ERROR')) { this.switchAway(true) } reject(error) diff --git a/apps/remix-ide/src/app/providers/custom-vm-fork-provider.tsx b/apps/remix-ide/src/app/providers/custom-vm-fork-provider.tsx index 6b2e4cec91..700456f2ba 100644 --- a/apps/remix-ide/src/app/providers/custom-vm-fork-provider.tsx +++ b/apps/remix-ide/src/app/providers/custom-vm-fork-provider.tsx @@ -32,18 +32,10 @@ export class CustomForkVMProvider extends BasicVMProvider { const body = () => { return (
- - Please provide information about the custom fork. If the node URL is - not provided, the VM will start with an empty state. - + Please provide information about the custom fork. If the node URL is not provided, the VM will start with an empty state.
- +
@@ -58,12 +50,7 @@ export class CustomForkVMProvider extends BasicVMProvider {
- {Object.keys(Hardfork).map((value, index) => { return (
) } diff --git a/apps/walletconnect/webpack.config.js b/apps/walletconnect/webpack.config.js index 80c3c94308..3a3693c88a 100644 --- a/apps/walletconnect/webpack.config.js +++ b/apps/walletconnect/webpack.config.js @@ -50,9 +50,7 @@ module.exports = composePlugins(withNx(), (config) => { // set the define plugin to load the WALLET_CONNECT_PROJECT_ID config.plugins.push( new webpack.DefinePlugin({ - WALLET_CONNECT_PROJECT_ID: JSON.stringify( - process.env.WALLET_CONNECT_PROJECT_ID - ) + WALLET_CONNECT_PROJECT_ID: JSON.stringify(process.env.WALLET_CONNECT_PROJECT_ID) }) ) diff --git a/libs/remix-debug/test.ts b/libs/remix-debug/test.ts index 917b3fb61c..7ccb8bcc0f 100644 --- a/libs/remix-debug/test.ts +++ b/libs/remix-debug/test.ts @@ -19,17 +19,7 @@ const inputJson = { outputSelection: { '*': { '': ['ast'], - '*': [ - 'abi', - 'metadata', - 'devdoc', - 'userdoc', - 'evm.legacyAssembly', - 'evm.bytecode', - 'evm.deployedBytecode', - 'evm.methodIdentifiers', - 'evm.gasEstimates' - ] + '*': ['abi', 'metadata', 'devdoc', 'userdoc', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates'] } } } @@ -43,9 +33,7 @@ console.dir(inputJson) console.log('compiling...') -const compilationData = JSON.parse( - solc.compileStandardWrapper(JSON.stringify(inputJson)) -) +const compilationData = JSON.parse(solc.compileStandardWrapper(JSON.stringify(inputJson))) console.dir(Object.keys(compilationData)) const compilation = {} compilation['data'] = compilationData diff --git a/libs/remix-ui/app/src/lib/remix-app/components/dragbar/dragbar.tsx b/libs/remix-ui/app/src/lib/remix-app/components/dragbar/dragbar.tsx index c9d34471be..46b7f851c2 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/dragbar/dragbar.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/dragbar/dragbar.tsx @@ -19,9 +19,7 @@ const DragBar = (props: IRemixDragBarUi) => { const nodeRef = React.useRef(null) // fix for strictmode useEffect(() => { - setDragBarPosX( - offset + (props.hidden ? 0 : props.refObject.current.offsetWidth) - ) + setDragBarPosX(offset + (props.hidden ? 0 : props.refObject.current.offsetWidth)) }, [props.hidden, offset]) useEffect(() => { @@ -49,9 +47,7 @@ const DragBar = (props: IRemixDragBarUi) => { const handleResize = () => { if (!props.refObject.current) return setOffSet(props.refObject.current.offsetLeft) - setDragBarPosX( - props.refObject.current.offsetLeft + props.refObject.current.offsetWidth - ) + setDragBarPosX(props.refObject.current.offsetLeft + props.refObject.current.offsetWidth) } useEffect(() => { @@ -81,17 +77,8 @@ const DragBar = (props: IRemixDragBarUi) => { return ( <>
- -
+ +
) diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/dialogs.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/dialogs.tsx index 4dcfa322e8..052b8661b3 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/dialogs.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/dialogs.tsx @@ -10,11 +10,7 @@ const AppDialogs = () => { return ( <> - + ) } diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx index 8b2f00d4fc..86777b5a6c 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx @@ -21,36 +21,20 @@ const MatomoDialog = (props) => { Matomo - , an open source data analytics platform is being used to improve - Remix IDE. + , an open source data analytics platform is being used to improve Remix IDE.

+

We realize that our users have sensitive information in their code and that their privacy - your privacy - must be protected.

- We realize that our users have sensitive information in their code and - that their privacy - your privacy - must be protected. -

-

- All data collected through Matomo is stored on our own server - no - data is ever given to third parties. Our analytics reports are public:{' '} - + All data collected through Matomo is stored on our own server - no data is ever given to third parties. Our analytics reports are public:{' '} + take a look .

-

- We do not collect nor store any personally identifiable information - (PII). -

+

We do not collect nor store any personally identifiable information (PII).

For more info, see:{' '} - + Matomo Analyitcs on Remix iDE . @@ -84,8 +68,7 @@ const MatomoDialog = (props) => { const handleModalOkClick = async () => { _paq.push(['forgetUserOptOut']) // @TODO remove next line when https://github.com/matomo-org/matomo/commit/9e10a150585522ca30ecdd275007a882a70c6df5 is used - document.cookie = - 'mtm_consent_removed=; expires=Thu, 01 Jan 1970 00:00:01 GMT;' + document.cookie = 'mtm_consent_removed=; expires=Thu, 01 Jan 1970 00:00:01 GMT;' settings.updateMatomoAnalyticsChoice(true) appManager.call('walkthrough', 'start') setVisible(false) diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx index 69e0901c30..07b974d3fe 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/modal-wrapper.tsx @@ -1,9 +1,5 @@ import React, {useEffect, useRef, useState} from 'react' -import { - ModalDialog, - ModalDialogProps, - ValidationResult -} from '@remix-ui/modal-dialog' +import {ModalDialog, ModalDialogProps, ValidationResult} from '@remix-ui/modal-dialog' import {ModalTypes} from '../../types' interface ModalWrapperProps extends ModalDialogProps { @@ -34,10 +30,11 @@ const ModalWrapper = (props: ModalWrapperProps) => { } else if (formRef.current) { props.okFn ? props.okFn(getFormData()) : props.resolve(getFormData()) } else if (ref.current) { - // @ts-ignore: Object is possibly 'null'. props.okFn - ? props.okFn(ref.current.value) - : props.resolve(ref.current.value) + ? // @ts-ignore: Object is possibly 'null'. + props.okFn(ref.current.value) + : // @ts-ignore: Object is possibly 'null'. + props.resolve(ref.current.value) } } @@ -62,10 +59,7 @@ const ModalWrapper = (props: ModalWrapperProps) => { } } - const createModalMessage = ( - defaultValue: string, - validation: ValidationResult - ) => { + const createModalMessage = (defaultValue: string, validation: ValidationResult) => { return ( <> {props.message} @@ -77,9 +71,7 @@ const ModalWrapper = (props: ModalWrapperProps) => { ref={ref} className="form-control" /> - {validation && !validation.valid && ( - {validation.message} - )} + {validation && !validation.valid && {validation.message}} ) } @@ -99,9 +91,7 @@ const ModalWrapper = (props: ModalWrapperProps) => {

{props.message}
- {validation && !validation.valid && ( - {validation.message} - )} + {validation && !validation.valid && {validation.message}} ) } diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/origin-warning.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/origin-warning.tsx index e5f34d3971..f36e5f0938 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/origin-warning.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/origin-warning.tsx @@ -9,17 +9,12 @@ const OriginWarning = () => { useEffect(() => { // check the origin and warn message if (window.location.hostname === 'yann300.github.io') { - setContent( - 'This UNSTABLE ALPHA branch of Remix has been moved to http://ethereum.github.io/remix-live-alpha.' - ) + setContent('This UNSTABLE ALPHA branch of Remix has been moved to http://ethereum.github.io/remix-live-alpha.') } else if ( window.location.hostname === 'remix-alpha.ethereum.org' || - (window.location.hostname === 'ethereum.github.io' && - window.location.pathname.indexOf('/remix-live-alpha') === 0) + (window.location.hostname === 'ethereum.github.io' && window.location.pathname.indexOf('/remix-live-alpha') === 0) ) { - setContent( - 'Welcome to the Remix alpha instance. Please use it to try out latest features. But use preferably https://remix.ethereum.org for any production work.' - ) + setContent('Welcome to the Remix alpha instance. Please use it to try out latest features. But use preferably https://remix.ethereum.org for any production work.') } else if ( window.location.protocol.indexOf('http') === 0 && window.location.hostname !== 'remix.ethereum.org' && diff --git a/libs/remix-ui/app/src/lib/remix-app/components/splashscreen.tsx b/libs/remix-ui/app/src/lib/remix-app/components/splashscreen.tsx index ed382ec8ab..4f013c4761 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/splashscreen.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/splashscreen.tsx @@ -4,16 +4,8 @@ const RemixSplashScreen = (props) => { return ( <> {' '} -
- +
+ diff --git a/libs/remix-ui/app/src/lib/remix-app/context/context.tsx b/libs/remix-ui/app/src/lib/remix-app/context/context.tsx index ec0f105b51..1dae1787f1 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/context.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/context.tsx @@ -12,14 +12,12 @@ export interface dispatchModalInterface { handleToaster: () => void } -export const dispatchModalContext = React.createContext( - { - modal: (data: AppModal) => {}, - toast: (message: string | JSX.Element) => {}, - alert: (data: AlertModal) => {}, - handleHideModal: () => {}, - handleToaster: () => {} - } -) +export const dispatchModalContext = React.createContext({ + modal: (data: AppModal) => {}, + toast: (message: string | JSX.Element) => {}, + alert: (data: AlertModal) => {}, + handleHideModal: () => {}, + handleToaster: () => {} +}) export const modalContext = React.createContext(ModalInitialState) diff --git a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx index 7e04805a87..c267e50e7c 100644 --- a/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/context/provider.tsx @@ -6,15 +6,8 @@ import {ModalInitialState} from '../state/modals' import {ModalTypes} from '../types' import {AppContext, dispatchModalContext, modalContext} from './context' -export const ModalProvider = ({ - children = [], - reducer = modalReducer, - initialState = ModalInitialState -} = {}) => { - const [{modals, toasters, focusModal, focusToaster}, dispatch] = useReducer( - reducer, - initialState - ) +export const ModalProvider = ({children = [], reducer = modalReducer, initialState = ModalInitialState} = {}) => { + const [{modals, toasters, focusModal, focusToaster}, dispatch] = useReducer(reducer, initialState) const onNextFn = async () => { dispatch({ @@ -23,20 +16,7 @@ export const ModalProvider = ({ } const modal = (modalData: AppModal) => { - const { - id, - title, - message, - validationFn, - okLabel, - okFn, - cancelLabel, - cancelFn, - modalType, - defaultValue, - hideFn, - data - } = modalData + const {id, title, message, validationFn, okLabel, okFn, cancelLabel, cancelFn, modalType, defaultValue, hideFn, data} = modalData return new Promise((resolve, reject) => { dispatch({ type: modalActionTypes.setModal, @@ -94,14 +74,8 @@ export const ModalProvider = ({ } return ( - - - {children} - + + {children} ) } diff --git a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx index ee608d91aa..55e09ccfe6 100644 --- a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx @@ -87,25 +87,11 @@ const RemixApp = (props: IRemixAppUi) => { -
-
+
+
{props.app.menuicons.render()}
-
+
{props.app.sidePanel.render()}
{ hidden={hideSidePanel} setHideStatus={setHideSidePanel} > -
+
- +
diff --git a/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx b/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx index d47d566726..1722ffe42e 100644 --- a/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx +++ b/libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx @@ -40,11 +40,7 @@ export const RemixUiCheckbox = ({ tooltipPlacement = 'right' }: RemixUiCheckboxProps) => { const childJSXWithTooltip = ( - +
- -