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
9449a02f
Commit
9449a02f
authored
Dec 31, 2019
by
Iuri Matias
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move reset and init methods to blockchain class
parent
433cedb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
36 deletions
+38
-36
blockchain.js
src/app/tabs/runTab/model/blockchain.js
+10
-0
run-tab.js
src/app/udapp/run-tab.js
+28
-36
No files found.
src/app/tabs/runTab/model/blockchain.js
View file @
9449a02f
...
...
@@ -310,6 +310,16 @@ class Blockchain {
return
(
this
.
executionContext
.
isVM
()
?
'memory'
:
'blockchain'
)
}
// NOTE: the config is only needed because exectuionContext.init does
// if config.get('settings/always-use-vm'), we can simplify this later
resetAndInit
(
config
,
transactionContext
)
{
this
.
udapp
.
resetAPI
(
transactionContext
)
this
.
executionContext
.
init
(
config
)
this
.
executionContext
.
stopListenOnLastBlock
()
this
.
executionContext
.
listenOnLastBlock
()
this
.
udapp
.
resetEnvironment
()
}
}
module
.
exports
=
Blockchain
src/app/udapp/run-tab.js
View file @
9449a02f
...
...
@@ -48,37 +48,6 @@ export class RunTab extends LibraryPlugin {
this
.
networkModule
=
networkModule
}
onActivationInternal
()
{
this
.
udappUI
=
new
UniversalDAppUI
(
this
.
blockchain
,
this
.
logCallback
)
this
.
udapp
.
resetAPI
({
getAddress
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
},
getValue
:
(
cb
)
=>
{
try
{
const
number
=
document
.
querySelector
(
'#value'
).
value
const
select
=
document
.
getElementById
(
'unit'
)
const
index
=
select
.
selectedIndex
const
selectedUnit
=
select
.
querySelectorAll
(
'option'
)[
index
].
dataset
.
unit
let
unit
=
'ether'
// default
if
([
'ether'
,
'finney'
,
'gwei'
,
'wei'
].
indexOf
(
selectedUnit
)
>=
0
)
{
unit
=
selectedUnit
}
cb
(
null
,
Web3
.
utils
.
toWei
(
number
,
unit
))
}
catch
(
e
)
{
cb
(
e
)
}
},
getGasLimit
:
(
cb
)
=>
{
try
{
cb
(
null
,
'0x'
+
new
ethJSUtil
.
BN
(
$
(
'#gasLimit'
).
val
(),
10
).
toString
(
16
))
}
catch
(
e
)
{
cb
(
e
.
message
)
}
}
})
}
renderContainer
()
{
this
.
container
=
yo
`<div class="
${
css
.
runTabView
}
py-0 px-2" id="runTabView" ></div>`
...
...
@@ -200,11 +169,34 @@ export class RunTab extends LibraryPlugin {
}
render
()
{
this
.
onActivationInternal
()
this
.
executionContext
.
init
(
this
.
config
)
this
.
executionContext
.
stopListenOnLastBlock
()
this
.
executionContext
.
listenOnLastBlock
()
this
.
udapp
.
resetEnvironment
()
this
.
udappUI
=
new
UniversalDAppUI
(
this
.
blockchain
,
this
.
logCallback
)
this
.
blockchain
.
resetAndInit
(
this
.
config
,
{
getAddress
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
},
getValue
:
(
cb
)
=>
{
try
{
const
number
=
document
.
querySelector
(
'#value'
).
value
const
select
=
document
.
getElementById
(
'unit'
)
const
index
=
select
.
selectedIndex
const
selectedUnit
=
select
.
querySelectorAll
(
'option'
)[
index
].
dataset
.
unit
let
unit
=
'ether'
// default
if
([
'ether'
,
'finney'
,
'gwei'
,
'wei'
].
indexOf
(
selectedUnit
)
>=
0
)
{
unit
=
selectedUnit
}
cb
(
null
,
Web3
.
utils
.
toWei
(
number
,
unit
))
}
catch
(
e
)
{
cb
(
e
)
}
},
getGasLimit
:
(
cb
)
=>
{
try
{
cb
(
null
,
'0x'
+
new
ethJSUtil
.
BN
(
$
(
'#gasLimit'
).
val
(),
10
).
toString
(
16
))
}
catch
(
e
)
{
cb
(
e
.
message
)
}
}
})
this
.
renderInstanceContainer
()
this
.
renderSettings
()
this
.
renderDropdown
(
this
.
udappUI
,
this
.
fileManager
,
this
.
compilersArtefacts
,
this
.
config
,
this
.
editor
,
this
.
logCallback
)
...
...
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