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
cf9fb489
Commit
cf9fb489
authored
Feb 14, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove executionContext dependecy from renderer
parent
b4957dc2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
39 deletions
+28
-39
app.js
src/app.js
+17
-6
renderer.js
src/app/renderer.js
+2
-20
universal-dapp.js
src/universal-dapp.js
+9
-13
No files found.
src/app.js
View file @
cf9fb489
...
...
@@ -503,9 +503,20 @@ var run = function () {
}
}
var
ethToolAPI
=
{
toWei
:
(
value
,
unit
)
=>
{
return
executionContext
.
web3
().
toWei
(
value
,
unit
)
var
transactionContextAPI
=
{
getAddress
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
},
getValue
:
(
cb
)
=>
{
try
{
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
cb
(
null
,
executionContext
.
web3
().
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
)))
}
catch
(
e
)
{
cb
(
e
)
}
},
getGasLimit
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#gasLimit'
).
val
())
}
}
...
...
@@ -558,8 +569,8 @@ var run = function () {
},
transactionDebugger
)
var
udappAPI
=
{
reset
:
(
udappContracts
,
getAddress
,
getValue
,
getGasLimit
,
renderOutputModifier
)
=>
{
udapp
.
reset
(
udappContracts
,
getAddress
,
getValue
,
getGasLimit
,
renderOutputModifier
)
reset
:
(
udappContracts
,
renderOutputModifier
)
=>
{
udapp
.
reset
(
udappContracts
,
transactionContextAPI
,
renderOutputModifier
)
},
render
:
()
=>
{
return
udapp
.
render
()
...
...
@@ -592,7 +603,7 @@ var run = function () {
return
''
}
}
var
renderer
=
new
Renderer
(
editorAPIRenderer
,
udappAPI
,
ethToolAPI
,
formalVerification
.
event
,
compiler
.
event
)
// eslint-disable-line
var
renderer
=
new
Renderer
(
editorAPIRenderer
,
udappAPI
,
formalVerification
.
event
,
compiler
.
event
)
// eslint-disable-line
var
rendererAPI
=
{
renderItem
:
(
label
,
warningContainer
,
type
)
=>
{
return
renderer
.
error
(
label
,
warningContainer
,
type
)
...
...
src/app/renderer.js
View file @
cf9fb489
...
...
@@ -4,10 +4,9 @@ var $ = require('jquery')
var
utils
=
require
(
'./utils'
)
function
Renderer
(
editorAPI
,
udappAPI
,
ethToolAPI
,
formalVerificationEvent
,
compilerEvent
)
{
function
Renderer
(
editorAPI
,
udappAPI
,
formalVerificationEvent
,
compilerEvent
)
{
this
.
editorAPI
=
editorAPI
this
.
udappAPI
=
udappAPI
this
.
ethToolAPI
=
ethToolAPI
var
self
=
this
formalVerificationEvent
.
register
(
'compilationFinished'
,
this
,
function
(
success
,
message
,
container
,
options
)
{
if
(
!
success
)
{
...
...
@@ -283,24 +282,7 @@ Renderer.prototype.contracts = function (data, source) {
return
$contractOutput
}
var
getAddress
=
function
(
cb
)
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
}
var
getValue
=
function
(
cb
)
{
try
{
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
cb
(
null
,
self
.
ethToolAPI
.
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
)))
}
catch
(
e
)
{
cb
(
e
)
}
}
var
getGasLimit
=
function
(
cb
)
{
cb
(
null
,
$
(
'#gasLimit'
).
val
())
}
this
.
udappAPI
.
reset
(
udappContracts
,
getAddress
,
getValue
,
getGasLimit
,
renderOutputModifier
)
this
.
udappAPI
.
reset
(
udappContracts
,
renderOutputModifier
)
var
$contractOutput
=
this
.
udappAPI
.
render
()
...
...
src/universal-dapp.js
View file @
cf9fb489
...
...
@@ -21,9 +21,7 @@ function UniversalDApp (executionContext, options, txdebugger) {
self
.
$el
=
$
(
'<div class="udapp" />'
)
self
.
personalMode
=
self
.
options
.
personalMode
||
false
self
.
contracts
self
.
getAddress
self
.
getValue
self
.
getGasLimit
self
.
transactionContextAPI
self
.
txdebugger
=
txdebugger
// temporary: will not be needed anymore when we'll add memory support to the VM
var
defaultRenderOutputModifier
=
function
(
name
,
content
)
{
return
content
}
self
.
renderOutputModifier
=
defaultRenderOutputModifier
...
...
@@ -39,12 +37,10 @@ function UniversalDApp (executionContext, options, txdebugger) {
})
}
UniversalDApp
.
prototype
.
reset
=
function
(
contracts
,
getAddress
,
getValue
,
getGasLimit
,
renderer
)
{
UniversalDApp
.
prototype
.
reset
=
function
(
contracts
,
transactionContextAPI
,
renderer
)
{
this
.
$el
.
empty
()
this
.
contracts
=
contracts
this
.
getAddress
=
getAddress
this
.
getValue
=
getValue
this
.
getGasLimit
=
getGasLimit
this
.
transactionContextAPI
=
transactionContextAPI
this
.
renderOutputModifier
=
renderer
this
.
accounts
=
{}
if
(
this
.
executionContext
.
isVM
())
{
...
...
@@ -734,8 +730,8 @@ UniversalDApp.prototype.runTx = function (args, cb) {
function
(
callback
)
{
tx
.
gasLimit
=
3000000
if
(
self
.
getGasLimit
)
{
self
.
getGasLimit
(
function
(
err
,
ret
)
{
if
(
self
.
transactionContextAPI
.
getGasLimit
)
{
self
.
transactionContextAPI
.
getGasLimit
(
function
(
err
,
ret
)
{
if
(
err
)
{
return
callback
(
err
)
}
...
...
@@ -751,8 +747,8 @@ UniversalDApp.prototype.runTx = function (args, cb) {
function
(
callback
)
{
tx
.
value
=
0
if
(
self
.
getValue
)
{
self
.
getValue
(
function
(
err
,
ret
)
{
if
(
self
.
transactionContextAPI
.
getValue
)
{
self
.
transactionContextAPI
.
getValue
(
function
(
err
,
ret
)
{
if
(
err
)
{
return
callback
(
err
)
}
...
...
@@ -766,8 +762,8 @@ UniversalDApp.prototype.runTx = function (args, cb) {
},
// query address
function
(
callback
)
{
if
(
self
.
getAddress
)
{
self
.
getAddress
(
function
(
err
,
ret
)
{
if
(
self
.
transactionContextAPI
.
getAddress
)
{
self
.
transactionContextAPI
.
getAddress
(
function
(
err
,
ret
)
{
if
(
err
)
{
return
callback
(
err
)
}
...
...
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