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
f4bd8939
Commit
f4bd8939
authored
Oct 09, 2018
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
listen to providerChanged and update web3 object
parent
332cee0a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
40 deletions
+49
-40
debuggerUI.js
src/app/debugger/debuggerUI.js
+49
-40
No files found.
src/app/debugger/debuggerUI.js
View file @
f4bd8939
...
...
@@ -2,7 +2,6 @@ var TxBrowser = require('./debuggerUI/TxBrowser')
var
StepManagerUI
=
require
(
'./debuggerUI/StepManager'
)
var
VmDebugger
=
require
(
'./debuggerUI/VmDebugger'
)
//var Debugger = require('./debugger/debugger')
var
Debugger
=
require
(
'remix-debug'
).
TransactionDebugger
var
SourceHighlighter
=
require
(
'../editor/sourceHighlighter'
)
...
...
@@ -33,28 +32,13 @@ var css = csjs`
class
ContextManager
{
constructor
()
{
this
.
web3
=
executionContext
.
web3
()
this
.
executionContext
=
executionContext
this
.
web3
=
this
.
executionContext
.
web3
()
this
.
event
=
new
EventManager
()
}
}
class
DebuggerUI
{
constructor
(
container
)
{
this
.
registry
=
globalRegistry
this
.
event
=
new
EventManager
()
this
.
executionContext
=
executionContext
this
.
debugger
=
new
Debugger
({
web3
:
executionContext
.
web3
(),
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compiler
:
this
.
registry
.
get
(
'compiler'
).
api
,
compilersArtefacts
:
this
.
registry
.
get
(
'compilersartefacts'
).
api
})
initProviders
()
{
this
.
web3Providers
=
new
Web3Providers
()
this
.
executionContext
=
this
.
executionContext
this
.
addProvider
(
'DUMMYWEB3'
,
new
DummyProvider
())
this
.
switchProvider
(
'DUMMYWEB3'
)
...
...
@@ -62,25 +46,11 @@ class DebuggerUI {
this
.
addProvider
(
'injected'
,
this
.
executionContext
.
internalWeb3
())
this
.
addProvider
(
'web3'
,
this
.
executionContext
.
internalWeb3
())
this
.
switchProvider
(
this
.
executionContext
.
getProvider
())
this
.
isActive
=
false
this
.
sourceHighlighter
=
new
SourceHighlighter
()
this
.
startTxBrowser
()
this
.
stepManager
=
null
this
.
statusMessage
=
''
this
.
view
container
.
appendChild
(
this
.
render
())
this
.
setEditor
()
this
.
listenToEvents
()
}
getWeb3
()
{
return
this
.
web3
}
addProvider
(
type
,
obj
)
{
this
.
web3Providers
.
addProvider
(
type
,
obj
)
...
...
@@ -93,22 +63,61 @@ class DebuggerUI {
if
(
error
)
{
console
.
log
(
'provider '
+
type
+
' not defined'
)
}
else
{
self
.
debugger
.
updateWeb3
(
obj
)
self
.
web3
=
obj
self
.
executionContext
.
detectNetwork
((
error
,
network
)
=>
{
if
(
error
||
!
network
)
{
self
.
debugger
.
debugger
.
updateWeb3
(
obj
)
self
.
web3
=
obj
}
else
{
var
webDebugNode
=
init
.
web3DebugNode
(
network
.
name
)
self
.
debugger
.
updateWeb3
(
!
webDebugNode
?
obj
:
webDebugNode
)
self
.
web3
=
(
!
webDebugNode
?
obj
:
webDebugNode
)
}
self
.
event
.
trigger
(
'providerChanged'
,
[
type
,
self
.
web3
])
})
self
.
event
.
trigger
(
'providerChanged'
,
[
type
])
self
.
event
.
trigger
(
'providerChanged'
,
[
type
,
self
.
web3
])
}
})
}
}
class
DebuggerUI
{
constructor
(
container
)
{
this
.
registry
=
globalRegistry
this
.
event
=
new
EventManager
()
this
.
executionContext
=
executionContext
this
.
contextManager
=
new
ContextManager
()
this
.
debugger
=
new
Debugger
({
web3
:
this
.
contextManager
.
getWeb3
(),
offsetToLineColumnConverter
:
this
.
registry
.
get
(
'offsettolinecolumnconverter'
).
api
,
compiler
:
this
.
registry
.
get
(
'compiler'
).
api
})
this
.
contextManager
.
initProviders
()
this
.
contextManager
.
event
.
register
(
'providerChanged'
,
()
=>
{
this
.
debugger
.
updateWeb3
(
this
.
contextManager
.
getWeb3
())
})
this
.
isActive
=
false
this
.
sourceHighlighter
=
new
SourceHighlighter
()
this
.
startTxBrowser
()
this
.
stepManager
=
null
this
.
statusMessage
=
''
this
.
view
container
.
appendChild
(
this
.
render
())
this
.
setEditor
()
this
.
listenToEvents
()
}
setEditor
()
{
const
self
=
this
...
...
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