From a18bc70b85574b615863a8c7eaca88e4408e647c Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 17 Aug 2021 12:03:13 +0200 Subject: [PATCH] remove file provider dep --- apps/remix-ide/src/app/tabs/compile-tab.js | 9 +++++---- .../publish-to-storage/src/lib/publish-to-storage.tsx | 6 +++--- libs/remix-ui/publish-to-storage/src/lib/types/index.ts | 2 +- .../solidity-compiler/src/lib/contract-selection.tsx | 4 ++-- .../solidity-compiler/src/lib/solidity-compiler.tsx | 4 ++-- libs/remix-ui/solidity-compiler/src/lib/types/index.ts | 3 +-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index c97dc2f1f2..1efa35ffdb 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -54,10 +54,7 @@ class CompileTab extends ViewPlugin { } this.compileTabLogic = new CompileTabLogic(this, this.fileManager, - this.fileProvider, - this.contentImport, - this.setCompileErrors.bind(this) - ) + this.contentImport) this.compiler = this.compileTabLogic.compiler this.compileTabLogic.init() this.contractMap = {} @@ -200,6 +197,10 @@ class CompileTab extends ViewPlugin { return this.compileTabLogic.compiler.state.lastCompilationResult } + addExternalFile (fileName, content) { + this.fileProvider.addExternal(fileName, content) + } + /** * compile using @arg fileName. * The module UI will be updated accordingly to the new compilation result. diff --git a/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx b/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx index de14a65a2f..f34ab4393b 100644 --- a/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx +++ b/libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx @@ -5,7 +5,7 @@ import { publishToIPFS } from './publishToIPFS' import { publishToSwarm } from './publishOnSwarm' export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { - const { storage, fileProvider, fileManager, contract, resetStorage } = props + const { api, storage, fileManager, contract, resetStorage } = props const [state, setState] = useState({ modal: { title: '', @@ -29,7 +29,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) // triggered each time there's a new verified publish (means hash correspond) - fileProvider.addExternal('swarm/' + result.item.hash, result.item.content) + api.addExternalFile('swarm/' + result.item.hash, result.item.content) } catch (err) { let parseError = err try { @@ -43,7 +43,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => { modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded)) // triggered each time there's a new verified publish (means hash correspond) - fileProvider.addExternal('ipfs/' + result.item.hash, result.item.content) + api.addExternalFile('ipfs/' + result.item.hash, result.item.content) } catch (err) { modal('IPFS Publish Failed', publishMessageFailed(storage, err)) } diff --git a/libs/remix-ui/publish-to-storage/src/lib/types/index.ts b/libs/remix-ui/publish-to-storage/src/lib/types/index.ts index 928315c621..75b29bb1ba 100644 --- a/libs/remix-ui/publish-to-storage/src/lib/types/index.ts +++ b/libs/remix-ui/publish-to-storage/src/lib/types/index.ts @@ -1,6 +1,6 @@ export interface RemixUiPublishToStorageProps { + api: any, storage: string, - fileProvider: any, fileManager: any, contract: any, resetStorage: () => void diff --git a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx index 489707b28e..41ebb0ece8 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx @@ -7,7 +7,7 @@ import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line import './css/style.css' export const ContractSelection = (props: ContractSelectionProps) => { - const { contractMap, fileProvider, fileManager, contractsDetails, modal } = props + const { api, contractMap, fileManager, contractsDetails, modal } = props const [contractList, setContractList] = useState([]) const [selectedContract, setSelectedContract] = useState('') const [storage, setStorage] = useState(null) @@ -234,7 +234,7 @@ export const ContractSelection = (props: ContractSelectionProps) => { No Contract Compiled Yet } - + ) } diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index 9f2a147ae6..764a728f9f 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -9,7 +9,7 @@ import { Renderer } from '@remix-ui/renderer' // eslint-disable-line import './css/style.css' export const SolidityCompiler = (props: SolidityCompilerProps) => { - const { plugin, plugin: { compileTabLogic, fileProvider, fileManager, contractsDetails, contractMap, compileErrors, isHardHatProject, setHardHatCompilation, configurationSettings } } = props + const { plugin, plugin: { compileTabLogic, fileManager, contractsDetails, contractMap, compileErrors, isHardHatProject, setHardHatCompilation, configurationSettings } } = props const [state, setState] = useState({ contractsDetails: {}, eventHandlers: {}, @@ -80,7 +80,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { <>
- +
{ compileErrors.error && } diff --git a/libs/remix-ui/solidity-compiler/src/lib/types/index.ts b/libs/remix-ui/solidity-compiler/src/lib/types/index.ts index 3e7bba0757..fedaaab6e1 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/types/index.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/types/index.ts @@ -7,7 +7,6 @@ export interface SolidityCompilerProps { isHardHatProject: boolean, compileTabLogic: any, contractsDetails: Record, - fileProvider: any, fileManager: any, contentImport: any, call: (...args) => void @@ -32,11 +31,11 @@ export interface CompilerContainerProps { configurationSettings: ConfigurationSettings } export interface ContractSelectionProps { + api: any, contractMap: { file: string } | Record, fileManager: any, - fileProvider: any, modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, contractsDetails: Record }