remove file provider dep

pull/1487/head
yann300 3 years ago
parent 552a9d6d14
commit a18bc70b85
  1. 9
      apps/remix-ide/src/app/tabs/compile-tab.js
  2. 6
      libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx
  3. 2
      libs/remix-ui/publish-to-storage/src/lib/types/index.ts
  4. 4
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx
  5. 4
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  6. 3
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -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.

@ -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))
}

@ -1,6 +1,6 @@
export interface RemixUiPublishToStorageProps {
api: any,
storage: string,
fileProvider: any,
fileManager: any,
contract: any,
resetStorage: () => void

@ -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) => {
<span className="mt-2 mx-3 w-100 alert alert-warning" role="alert">No Contract Compiled Yet</span>
</article></section>
}
<PublishToStorage storage={storage} fileManager={fileManager} fileProvider={fileProvider} contract={contractsDetails[selectedContract]} resetStorage={resetStorage} />
<PublishToStorage api={api} storage={storage} fileManager={fileManager} contract={contractsDetails[selectedContract]} resetStorage={resetStorage} />
</>
)
}

@ -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) => {
<>
<div id="compileTabView">
<CompilerContainer api={plugin} compileTabLogic={compileTabLogic} tooltip={toast} modal={modal} compiledFileName={currentFile} setHardHatCompilation={setHardHatCompilation.bind(plugin)} updateCurrentVersion={updateCurrentVersion} isHardHatProject={isHardHatProject} configurationSettings={configurationSettings} />
<ContractSelection contractMap={contractMap} fileProvider={fileProvider} fileManager={fileManager} contractsDetails={contractsDetails} modal={modal} />
<ContractSelection api={plugin} contractMap={contractMap} fileManager={fileManager} contractsDetails={contractsDetails} modal={modal} />
<div className="remixui_errorBlobs p-4" data-id="compiledErrors">
<span data-id={`compilationFinishedWith_${currentVersion}`}></span>
{ compileErrors.error && <Renderer message={compileErrors.error.formattedMessage || compileErrors.error} plugin={plugin} opt={{ type: compileErrors.error.severity || 'error', errorType: compileErrors.error.type }} fileManager={fileManager} /> }

@ -7,7 +7,6 @@ export interface SolidityCompilerProps {
isHardHatProject: boolean,
compileTabLogic: any,
contractsDetails: Record<string, any>,
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<string, any>,
fileManager: any,
fileProvider: any,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
contractsDetails: Record<string, any>
}

Loading…
Cancel
Save