Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
49c62946
Commit
49c62946
authored
Aug 26, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better org of types
parent
5a22644c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
60 deletions
+56
-60
compile-tab.js
apps/remix-ide/src/app/tabs/compile-tab.js
+2
-1
compiler.ts
apps/solidity-compiler/src/app/compiler.ts
+2
-1
index.ts
libs/remix-lib/src/index.ts
+7
-14
ICompilerApi.ts
libs/remix-lib/src/types/ICompilerApi.ts
+42
-0
compiler-container.tsx
...remix-ui/solidity-compiler/src/lib/compiler-container.tsx
+2
-1
index.ts
libs/remix-ui/solidity-compiler/src/lib/types/index.ts
+1
-43
No files found.
apps/remix-ide/src/app/tabs/compile-tab.js
View file @
49c62946
...
...
@@ -4,6 +4,7 @@ import ReactDOM from 'react-dom'
import
{
SolidityCompiler
,
CompileTab
as
CompileTabLogic
,
parseContracts
}
from
'@remix-ui/solidity-compiler'
// eslint-disable-line
import
{
CompilerApiMixin
}
from
'@remixproject/solidity-compiler-plugin'
import
{
ViewPlugin
}
from
'@remixproject/engine-web'
import
{
ICompilerApi
}
from
'@remix-project/remix-lib-ts'
import
*
as
packageJson
from
'../../../../../package.json'
const
EventEmitter
=
require
(
'events'
)
...
...
@@ -32,7 +33,7 @@ const profile = {
// - events: ['compilationFinished'],
// - methods: ['getCompilationResult']
class
CompileTab
extends
CompilerApiMixin
(
ViewPlugin
)
{
class
CompileTab
extends
CompilerApiMixin
(
ViewPlugin
)
{
// implements ICompilerApi
constructor
()
{
super
(
profile
)
this
.
initCompilerApi
()
...
...
apps/solidity-compiler/src/app/compiler.ts
View file @
49c62946
import
{
PluginClient
}
from
"@remixproject/plugin"
;
import
{
createClient
}
from
"@remixproject/plugin-webview"
;
import
{
CompilerApiMixin
}
from
'./compiler-api'
import
{
ICompilerApi
}
from
'@remix-project/remix-lib-ts'
const
profile
=
{
name
:
'solidity'
,
...
...
@@ -23,7 +24,7 @@ export interface ConfigurationSettings {
runs
:
string
}
export
class
CompilerClientApi
extends
CompilerApiMixin
(
PluginClient
)
{
export
class
CompilerClientApi
extends
CompilerApiMixin
(
PluginClient
)
implements
ICompilerApi
{
// interface matches libs/remix-ui/solidity-compiler/types/index.ts : ICompilerApi
currentFile
:
string
contractMap
:
{
...
...
libs/remix-lib/src/index.ts
View file @
49c62946
...
...
@@ -18,25 +18,19 @@ import * as typeConversion from './execution/typeConversion'
import
{
TxRunnerVM
}
from
'./execution/txRunnerVM'
import
{
TxRunnerWeb3
}
from
'./execution/txRunnerWeb3'
import
*
as
txResultHelper
from
'./helpers/txResultHelper'
export
{
ICompilerApi
,
ConfigurationSettings
}
from
'./types/ICompilerApi'
export
=
modules
()
function
modules
()
{
return
{
EventManager
:
EventManager
,
helpers
:
{
const
helpers
=
{
ui
:
uiHelper
,
compiler
:
compilerHelper
,
txResultHelper
},
vm
:
{
}
const
vm
=
{
Web3Providers
:
Web3Providers
,
DummyProvider
:
DummyProvider
,
Web3VMProvider
:
Web3VmProvider
},
Storage
:
Storage
,
util
:
util
,
execution
:
{
}
const
execution
=
{
EventsDecoder
:
EventsDecoder
,
txExecution
:
txExecution
,
txHelper
:
txHelper
,
...
...
@@ -48,6 +42,5 @@ function modules () {
typeConversion
:
typeConversion
,
LogsManager
,
forkAt
}
}
}
export
{
EventManager
,
helpers
,
vm
,
Storage
,
util
,
execution
}
libs/remix-lib/src/types/ICompilerApi.ts
0 → 100644
View file @
49c62946
export
interface
ICompilerApi
{
currentFile
:
string
contractMap
:
{
file
:
string
}
|
Record
<
string
,
any
>
compileErrors
:
any
compileTabLogic
:
any
contractsDetails
:
Record
<
string
,
any
>
configurationSettings
:
ConfigurationSettings
setHardHatCompilation
:
(
value
:
boolean
)
=>
void
getParameters
:
()
=>
any
setParameters
:
(
params
)
=>
void
getConfiguration
:
(
value
:
string
)
=>
string
setConfiguration
:
(
name
:
string
,
value
:
string
)
=>
void
getFileManagerMode
:
()
=>
string
setCompilerConfig
:
(
settings
:
any
)
=>
void
getCompilationResult
:
()
=>
any
onCurrentFileChanged
:
(
fileName
:
string
)
=>
void
onResetResults
:
()
=>
void
,
onSetWorkspace
:
(
workspace
:
any
)
=>
void
onNoFileSelected
:
()
=>
void
onCompilationFinished
:
(
contractsDetails
:
any
,
contractMap
:
any
)
=>
void
onSessionSwitched
:
()
=>
void
onContentChanged
:
()
=>
void
fileExists
:
(
file
:
string
)
=>
Promise
<
boolean
>
writeFile
:
(
file
:
string
,
content
:
string
)
=>
Promise
<
void
>
readFile
:
(
file
:
string
)
=>
Promise
<
string
>
open
:
(
file
:
string
)
=>
void
}
export
interface
ConfigurationSettings
{
version
:
string
,
evmVersion
:
string
,
language
:
string
,
optimize
:
boolean
,
runs
:
string
}
\ No newline at end of file
libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
View file @
49c62946
import
React
,
{
useEffect
,
useState
,
useRef
,
useReducer
}
from
'react'
// eslint-disable-line
import
semver
from
'semver'
import
{
CompilerContainerProps
,
ConfigurationSettings
}
from
'./types'
import
{
CompilerContainerProps
}
from
'./types'
import
{
ConfigurationSettings
}
from
'@remix-project/remix-lib-ts'
import
*
as
helper
from
'../../../../../apps/remix-ide/src/lib/helper'
import
{
canUseWorker
,
baseURLBin
,
baseURLWasm
,
urlFromVersion
,
pathToURL
,
promisedMiniXhr
}
from
'@remix-project/remix-solidity'
import
{
compilerReducer
,
compilerInitialState
}
from
'./reducers/compiler'
...
...
libs/remix-ui/solidity-compiler/src/lib/types/index.ts
View file @
49c62946
import
{
ICompilerApi
,
ConfigurationSettings
}
from
'@remix-project/remix-lib-ts'
export
type
onCurrentFileChanged
=
(
fileName
:
string
)
=>
void
export
interface
SolidityCompilerProps
{
plugin
:
ICompilerApi
}
export
interface
ICompilerApi
{
currentFile
:
string
contractMap
:
{
file
:
string
}
|
Record
<
string
,
any
>
compileErrors
:
any
compileTabLogic
:
any
contractsDetails
:
Record
<
string
,
any
>
configurationSettings
:
ConfigurationSettings
setHardHatCompilation
:
(
value
:
boolean
)
=>
void
getParameters
:
()
=>
any
setParameters
:
(
params
)
=>
void
getConfiguration
:
(
value
:
string
)
=>
string
setConfiguration
:
(
name
:
string
,
value
:
string
)
=>
void
getFileManagerMode
:
()
=>
string
setCompilerConfig
:
(
settings
:
any
)
=>
void
getCompilationResult
:
()
=>
any
onCurrentFileChanged
:
(
fileName
:
string
)
=>
void
onResetResults
:
()
=>
void
,
onSetWorkspace
:
(
isLocalhost
:
boolean
)
=>
void
onNoFileSelected
:
()
=>
void
onCompilationFinished
:
(
contractsDetails
:
any
,
contractMap
:
any
)
=>
void
onSessionSwitched
:
()
=>
void
onContentChanged
:
()
=>
void
fileExists
:
(
file
:
string
)
=>
Promise
<
boolean
>
writeFile
:
(
file
:
string
,
content
:
string
)
=>
Promise
<
void
>
readFile
:
(
file
:
string
)
=>
Promise
<
string
>
open
:
(
file
:
string
)
=>
void
}
export
interface
CompilerContainerProps
{
api
:
any
,
compileTabLogic
:
any
,
...
...
@@ -56,11 +23,3 @@ export interface ContractSelectionProps {
modal
:
(
title
:
string
,
message
:
string
|
JSX
.
Element
,
okLabel
:
string
,
okFn
:
()
=>
void
,
cancelLabel
?:
string
,
cancelFn
?:
()
=>
void
)
=>
void
,
contractsDetails
:
Record
<
string
,
any
>
}
\ No newline at end of file
export
interface
ConfigurationSettings
{
version
:
string
,
evmVersion
:
string
,
language
:
string
,
optimize
:
boolean
,
runs
:
string
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment