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
e65f3559
Commit
e65f3559
authored
Dec 27, 2019
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use blockchain module instead of executio ncontext for cmd interpreter
parent
e7bc017d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
12 deletions
+18
-12
app.js
src/app.js
+1
-1
main-view.js
src/app/panels/main-view.js
+4
-2
terminal.js
src/app/panels/terminal.js
+5
-4
blockchain.js
src/app/tabs/runTab/model/blockchain.js
+3
-0
cmdInterpreterAPI.js
src/lib/cmdInterpreterAPI.js
+5
-5
No files found.
src/app.js
View file @
e65f3559
...
@@ -255,7 +255,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
...
@@ -255,7 +255,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// LAYOUT & SYSTEM VIEWS
// LAYOUT & SYSTEM VIEWS
const
appPanel
=
new
MainPanel
()
const
appPanel
=
new
MainPanel
()
const
mainview
=
new
MainView
(
editor
,
appPanel
,
fileManager
,
appManager
,
txlistener
,
eventsDecoder
,
executionContext
)
const
mainview
=
new
MainView
(
editor
,
appPanel
,
fileManager
,
appManager
,
txlistener
,
eventsDecoder
,
executionContext
,
blockchain
)
registry
.
put
({
api
:
mainview
,
name
:
'mainview'
})
registry
.
put
({
api
:
mainview
,
name
:
'mainview'
})
appManager
.
register
([
appManager
.
register
([
...
...
src/app/panels/main-view.js
View file @
e65f3559
...
@@ -20,7 +20,7 @@ var css = csjs`
...
@@ -20,7 +20,7 @@ var css = csjs`
`
`
export
class
MainView
{
export
class
MainView
{
constructor
(
editor
,
mainPanel
,
fileManager
,
appManager
,
txListener
,
eventsDecoder
,
executionContext
)
{
constructor
(
editor
,
mainPanel
,
fileManager
,
appManager
,
txListener
,
eventsDecoder
,
executionContext
,
blockchain
)
{
var
self
=
this
var
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
_view
=
{}
self
.
_view
=
{}
...
@@ -32,6 +32,7 @@ export class MainView {
...
@@ -32,6 +32,7 @@ export class MainView {
self
.
txListener
=
txListener
self
.
txListener
=
txListener
self
.
eventsDecoder
=
eventsDecoder
self
.
eventsDecoder
=
eventsDecoder
self
.
executionContext
=
executionContext
self
.
executionContext
=
executionContext
self
.
blockchain
=
blockchain
this
.
appManager
=
appManager
this
.
appManager
=
appManager
this
.
init
()
this
.
init
()
}
}
...
@@ -101,7 +102,8 @@ export class MainView {
...
@@ -101,7 +102,8 @@ export class MainView {
appManager
:
this
.
appManager
,
appManager
:
this
.
appManager
,
eventsDecoder
:
this
.
eventsDecoder
,
eventsDecoder
:
this
.
eventsDecoder
,
txListener
:
this
.
txListener
,
txListener
:
this
.
txListener
,
executionContext
:
this
.
executionContext
executionContext
:
this
.
executionContext
,
blockchain
:
this
.
blockchain
},
},
{
{
getPosition
:
(
event
)
=>
{
getPosition
:
(
event
)
=>
{
...
...
src/app/panels/terminal.js
View file @
e65f3559
...
@@ -42,6 +42,7 @@ class Terminal extends Plugin {
...
@@ -42,6 +42,7 @@ class Terminal extends Plugin {
var
self
=
this
var
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
executionContext
=
opts
.
executionContext
self
.
executionContext
=
opts
.
executionContext
self
.
blockchain
=
opts
.
blockchain
self
.
_api
=
api
self
.
_api
=
api
self
.
_opts
=
opts
self
.
_opts
=
opts
self
.
data
=
{
self
.
data
=
{
...
@@ -52,7 +53,7 @@ class Terminal extends Plugin {
...
@@ -52,7 +53,7 @@ class Terminal extends Plugin {
}
}
self
.
_view
=
{
el
:
null
,
bar
:
null
,
input
:
null
,
term
:
null
,
journal
:
null
,
cli
:
null
}
self
.
_view
=
{
el
:
null
,
bar
:
null
,
input
:
null
,
term
:
null
,
journal
:
null
,
cli
:
null
}
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
cmdInterpreter
=
new
CommandInterpreterAPI
(
this
,
null
,
self
.
executionContext
)
self
.
_components
.
cmdInterpreter
=
new
CommandInterpreterAPI
(
this
,
null
,
self
.
blockchain
)
self
.
_components
.
autoCompletePopup
=
new
AutoCompletePopup
(
self
.
_opts
)
self
.
_components
.
autoCompletePopup
=
new
AutoCompletePopup
(
self
.
_opts
)
self
.
_components
.
autoCompletePopup
.
event
.
register
(
'handleSelect'
,
function
(
input
)
{
self
.
_components
.
autoCompletePopup
.
event
.
register
(
'handleSelect'
,
function
(
input
)
{
let
textList
=
self
.
_view
.
input
.
innerText
.
split
(
' '
)
let
textList
=
self
.
_view
.
input
.
innerText
.
split
(
' '
)
...
@@ -668,7 +669,7 @@ class Terminal extends Plugin {
...
@@ -668,7 +669,7 @@ class Terminal extends Plugin {
return
done
(
null
,
'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.'
)
return
done
(
null
,
'This type of command has been deprecated and is not functionning anymore. Please run remix.help() to list available commands.'
)
}
}
var
self
=
this
var
self
=
this
var
context
=
domTerminalFeatures
(
self
,
scopedCommands
,
self
.
executionContext
)
var
context
=
domTerminalFeatures
(
self
,
scopedCommands
,
self
.
blockchain
)
try
{
try
{
var
cmds
=
vm
.
createContext
(
Object
.
assign
(
self
.
_jsSandboxContext
,
context
,
self
.
_jsSandboxRegistered
))
var
cmds
=
vm
.
createContext
(
Object
.
assign
(
self
.
_jsSandboxContext
,
context
,
self
.
_jsSandboxRegistered
))
var
result
=
vm
.
runInContext
(
script
,
cmds
)
var
result
=
vm
.
runInContext
(
script
,
cmds
)
...
@@ -680,12 +681,12 @@ class Terminal extends Plugin {
...
@@ -680,12 +681,12 @@ class Terminal extends Plugin {
}
}
}
}
function
domTerminalFeatures
(
self
,
scopedCommands
,
executionContext
)
{
function
domTerminalFeatures
(
self
,
scopedCommands
,
blockchain
)
{
return
{
return
{
swarmgw
,
swarmgw
,
ethers
,
ethers
,
remix
:
self
.
_components
.
cmdInterpreter
,
remix
:
self
.
_components
.
cmdInterpreter
,
web3
:
new
Web3
(
executionContext
.
web3
().
currentProvider
),
web3
:
new
Web3
(
blockchain
.
web3
().
currentProvider
),
console
:
{
console
:
{
log
:
function
()
{
scopedCommands
.
log
.
apply
(
scopedCommands
,
arguments
)
},
log
:
function
()
{
scopedCommands
.
log
.
apply
(
scopedCommands
,
arguments
)
},
info
:
function
()
{
scopedCommands
.
info
.
apply
(
scopedCommands
,
arguments
)
},
info
:
function
()
{
scopedCommands
.
info
.
apply
(
scopedCommands
,
arguments
)
},
...
...
src/app/tabs/runTab/model/blockchain.js
View file @
e65f3559
...
@@ -244,6 +244,9 @@ class Blockchain {
...
@@ -244,6 +244,9 @@ class Blockchain {
}
}
}
}
web3
()
{
return
this
.
executionContext
.
web3
()
}
}
}
module
.
exports
=
Blockchain
module
.
exports
=
Blockchain
src/lib/cmdInterpreterAPI.js
View file @
e65f3559
...
@@ -14,10 +14,10 @@ var solidityTypeFormatter = require('../app/tabs/debugger/debuggerUI/vmDebugger/
...
@@ -14,10 +14,10 @@ var solidityTypeFormatter = require('../app/tabs/debugger/debuggerUI/vmDebugger/
var
GistHandler
=
require
(
'./gist-handler'
)
var
GistHandler
=
require
(
'./gist-handler'
)
class
CmdInterpreterAPI
{
class
CmdInterpreterAPI
{
constructor
(
terminal
,
localRegistry
,
executionContext
)
{
constructor
(
terminal
,
localRegistry
,
blockchain
)
{
const
self
=
this
const
self
=
this
self
.
event
=
new
EventManager
()
self
.
event
=
new
EventManager
()
self
.
executionContext
=
executionContext
self
.
blockchain
=
blockchain
self
.
_components
=
{}
self
.
_components
=
{}
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_components
.
registry
=
localRegistry
||
globalRegistry
self
.
_components
.
terminal
=
terminal
self
.
_components
.
terminal
=
terminal
...
@@ -62,14 +62,14 @@ class CmdInterpreterAPI {
...
@@ -62,14 +62,14 @@ class CmdInterpreterAPI {
debug
(
hash
,
cb
)
{
debug
(
hash
,
cb
)
{
var
self
=
this
var
self
=
this
delete
self
.
d
delete
self
.
d
self
.
executionContext
.
web3
().
eth
.
getTransaction
(
hash
,
(
error
,
tx
)
=>
{
self
.
blockchain
.
web3
().
eth
.
getTransaction
(
hash
,
(
error
,
tx
)
=>
{
if
(
error
)
return
cb
(
error
)
if
(
error
)
return
cb
(
error
)
var
debugSession
=
new
RemixDebug
({
var
debugSession
=
new
RemixDebug
({
compilationResult
:
()
=>
{
compilationResult
:
()
=>
{
return
self
.
_deps
.
compilersArtefacts
[
'__last'
].
getData
()
return
self
.
_deps
.
compilersArtefacts
[
'__last'
].
getData
()
}
}
})
})
debugSession
.
addProvider
(
'web3'
,
self
.
executionContext
.
web3
())
debugSession
.
addProvider
(
'web3'
,
self
.
blockchain
.
web3
())
debugSession
.
switchProvider
(
'web3'
)
debugSession
.
switchProvider
(
'web3'
)
debugSession
.
debug
(
tx
)
debugSession
.
debug
(
tx
)
self
.
d
=
debugSession
self
.
d
=
debugSession
...
@@ -180,7 +180,7 @@ class CmdInterpreterAPI {
...
@@ -180,7 +180,7 @@ class CmdInterpreterAPI {
})
})
}
}
setproviderurl
(
url
,
cb
)
{
setproviderurl
(
url
,
cb
)
{
this
.
executionContext
.
setProviderFromEndpoint
(
url
,
'web3'
,
(
error
)
=>
{
this
.
blockchain
.
setProviderFromEndpoint
(
url
,
'web3'
,
(
error
)
=>
{
if
(
error
)
toolTip
(
error
)
if
(
error
)
toolTip
(
error
)
if
(
cb
)
cb
()
if
(
cb
)
cb
()
})
})
...
...
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