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
14258792
Commit
14258792
authored
Oct 27, 2016
by
Alex Beregszaszi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make getValue/getGasLimit/getAddress async
parent
3974f9aa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
18 deletions
+33
-18
renderer.js
src/app/renderer.js
+12
-4
universal-dapp.js
src/universal-dapp.js
+21
-14
No files found.
src/app/renderer.js
View file @
14258792
...
@@ -113,14 +113,22 @@ Renderer.prototype.contracts = function (data, source) {
...
@@ -113,14 +113,22 @@ Renderer.prototype.contracts = function (data, source) {
return
source
.
sources
[
currentFile
]
return
source
.
sources
[
currentFile
]
}
}
var
getAddress
=
function
()
{
return
$
(
'#txorigin'
).
val
()
}
var
getAddress
=
function
(
cb
)
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
}
var
getValue
=
function
()
{
var
getValue
=
function
(
cb
)
{
try
{
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
return
self
.
executionContext
.
web3
().
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
))
cb
(
null
,
self
.
executionContext
.
web3
().
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
)))
}
catch
(
e
)
{
cb
(
e
)
}
}
}
var
getGasLimit
=
function
()
{
return
$
(
'#gasLimit'
).
val
()
}
var
getGasLimit
=
function
(
cb
)
{
cb
(
null
,
$
(
'#gasLimit'
).
val
())
}
this
.
udapp
.
reset
(
udappContracts
,
getAddress
,
getValue
,
getGasLimit
,
renderOutputModifier
)
this
.
udapp
.
reset
(
udappContracts
,
getAddress
,
getValue
,
getGasLimit
,
renderOutputModifier
)
...
...
src/universal-dapp.js
View file @
14258792
...
@@ -690,14 +690,15 @@ UniversalDApp.prototype.runTx = function (args, cb) {
...
@@ -690,14 +690,15 @@ UniversalDApp.prototype.runTx = function (args, cb) {
function
(
callback
)
{
function
(
callback
)
{
tx
.
gasLimit
=
3000000
tx
.
gasLimit
=
3000000
// NOTE: getGasLimit should be async
if
(
self
.
getGasLimit
)
{
if
(
self
.
getGasLimit
)
{
try
{
self
.
getGasLimit
(
function
(
err
,
ret
)
{
tx
.
gasLimit
=
self
.
getGasLimit
()
if
(
err
)
{
callback
()
return
callback
(
err
)
}
catch
(
e
)
{
callback
(
e
)
}
}
tx
.
gasLimit
=
ret
callback
()
})
}
else
{
}
else
{
callback
()
callback
()
}
}
...
@@ -706,24 +707,30 @@ UniversalDApp.prototype.runTx = function (args, cb) {
...
@@ -706,24 +707,30 @@ UniversalDApp.prototype.runTx = function (args, cb) {
function
(
callback
)
{
function
(
callback
)
{
tx
.
value
=
0
tx
.
value
=
0
// NOTE: getValue should be async
if
(
self
.
getValue
)
{
if
(
self
.
getValue
)
{
try
{
self
.
getValue
(
function
(
err
,
ret
)
{
tx
.
value
=
self
.
getValue
()
if
(
err
)
{
callback
()
return
callback
(
err
)
}
catch
(
e
)
{
callback
(
e
)
}
}
tx
.
value
=
ret
callback
()
})
}
else
{
}
else
{
callback
()
callback
()
}
}
},
},
// query address
// query address
function
(
callback
)
{
function
(
callback
)
{
// NOTE: getAddress should be async
if
(
self
.
getAddress
)
{
if
(
self
.
getAddress
)
{
tx
.
from
=
self
.
getAddress
()
self
.
getAddress
(
function
(
err
,
ret
)
{
if
(
err
)
{
return
callback
(
err
)
}
tx
.
from
=
ret
callback
()
callback
()
})
}
else
{
}
else
{
self
.
getAccounts
(
function
(
err
,
ret
)
{
self
.
getAccounts
(
function
(
err
,
ret
)
{
if
(
err
)
{
if
(
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