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
a9eeebcb
Commit
a9eeebcb
authored
Aug 26, 2021
by
yann300
Committed by
davidzagi93@gmail.com
Sep 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better org of types
parent
02f16494
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
77 deletions
+75
-77
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
+24
-31
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
+3
-43
No files found.
apps/remix-ide/src/app/tabs/compile-tab.js
View file @
a9eeebcb
...
...
@@ -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 @
a9eeebcb
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 @
a9eeebcb
...
...
@@ -18,36 +18,29 @@ 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
:
{
ui
:
uiHelper
,
compiler
:
compilerHelper
,
txResultHelper
},
vm
:
{
Web3Providers
:
Web3Providers
,
DummyProvider
:
DummyProvider
,
Web3VMProvider
:
Web3VmProvider
},
Storage
:
Storage
,
util
:
util
,
execution
:
{
EventsDecoder
:
EventsDecoder
,
txExecution
:
txExecution
,
txHelper
:
txHelper
,
txFormat
:
txFormat
,
txListener
:
TxListener
,
TxRunner
:
TxRunner
,
TxRunnerWeb3
:
TxRunnerWeb3
,
TxRunnerVM
:
TxRunnerVM
,
typeConversion
:
typeConversion
,
LogsManager
,
forkAt
}
}
const
helpers
=
{
ui
:
uiHelper
,
compiler
:
compilerHelper
,
txResultHelper
}
const
vm
=
{
Web3Providers
:
Web3Providers
,
DummyProvider
:
DummyProvider
,
Web3VMProvider
:
Web3VmProvider
}
const
execution
=
{
EventsDecoder
:
EventsDecoder
,
txExecution
:
txExecution
,
txHelper
:
txHelper
,
txFormat
:
txFormat
,
txListener
:
TxListener
,
TxRunner
:
TxRunner
,
TxRunnerWeb3
:
TxRunnerWeb3
,
TxRunnerVM
:
TxRunnerVM
,
typeConversion
:
typeConversion
,
LogsManager
,
forkAt
}
export
{
EventManager
,
helpers
,
vm
,
Storage
,
util
,
execution
}
libs/remix-lib/src/types/ICompilerApi.ts
0 → 100644
View file @
a9eeebcb
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 @
a9eeebcb
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 @
a9eeebcb
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
,
...
...
@@ -55,12 +22,4 @@ export interface ContractSelectionProps {
}
|
Record
<
string
,
any
>
,
modal
:
(
title
:
string
,
message
:
string
|
JSX
.
Element
,
okLabel
:
string
,
okFn
:
()
=>
void
,
cancelLabel
?:
string
,
cancelFn
?:
()
=>
void
)
=>
void
,
contractsDetails
:
Record
<
string
,
any
>
}
export
interface
ConfigurationSettings
{
version
:
string
,
evmVersion
:
string
,
language
:
string
,
optimize
:
boolean
,
runs
:
string
}
}
\ No newline at end of file
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