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
874eb299
Commit
874eb299
authored
Dec 26, 2018
by
Iuri Matias
Committed by
yann300
Jan 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup settings
parent
6a8c58cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
settings.js
src/app/tabs/runTab/settings.js
+23
-27
No files found.
src/app/tabs/runTab/settings.js
View file @
874eb299
...
...
@@ -181,15 +181,23 @@ class SettingsUI {
},
()
=>
{})
},
(
error
,
address
)
=>
{
if
(
!
error
)
{
addTooltip
(
`account
${
address
}
created`
)
}
else
{
addTooltip
(
'Cannot create an account: '
+
error
)
if
(
error
)
{
return
addTooltip
(
'Cannot create an account: '
+
error
)
}
addTooltip
(
`account
${
address
}
created`
)
}
)
}
alertSignedData
(
error
,
hash
,
signedData
)
{
if
(
error
&&
error
.
message
!==
''
)
{
console
.
log
(
error
)
addTooltip
(
error
.
message
)
}
else
{
modalDialogCustom
.
alert
(
yo
`<div><b>hash:</b>
${
hash
}
<br><b>signature:</b>
${
signedData
}
</div>`
)
}
}
signMessage
(
event
)
{
this
.
parentSelf
.
_deps
.
udapp
.
getAccounts
((
err
,
accounts
)
=>
{
if
(
err
)
{
addTooltip
(
`Cannot get account list:
${
err
}
`
)
}
...
...
@@ -198,14 +206,6 @@ class SettingsUI {
var
account
=
$txOrigin
.
selectedOptions
[
0
].
value
var
isVM
=
executionContext
.
isVM
()
var
isInjected
=
executionContext
.
getProvider
()
===
'injected'
function
alertSignedData
(
error
,
hash
,
signedData
)
{
if
(
error
&&
error
.
message
!==
''
)
{
console
.
log
(
error
)
addTooltip
(
error
.
message
)
}
else
{
modalDialogCustom
.
alert
(
yo
`<div><b>hash:</b>
${
hash
}
<br><b>signature:</b>
${
signedData
}
</div>`
)
}
}
if
(
isVM
)
{
modalDialogCustom
.
promptMulti
(
signMessageDialog
,
(
message
)
=>
{
const
personalMsg
=
ethJSUtil
.
hashPersonalMessage
(
Buffer
.
from
(
message
))
...
...
@@ -213,7 +213,7 @@ class SettingsUI {
try
{
var
rsv
=
ethJSUtil
.
ecsign
(
personalMsg
,
privKey
)
var
signedData
=
ethJSUtil
.
toRpcSig
(
rsv
.
v
,
rsv
.
r
,
rsv
.
s
)
alertSignedData
(
null
,
'0x'
+
personalMsg
.
toString
(
'hex'
),
signedData
)
this
.
alertSignedData
(
null
,
'0x'
+
personalMsg
.
toString
(
'hex'
),
signedData
)
}
catch
(
e
)
{
addTooltip
(
e
.
message
)
return
...
...
@@ -224,7 +224,7 @@ class SettingsUI {
const
hashedMsg
=
executionContext
.
web3
().
sha3
(
message
)
try
{
executionContext
.
web3
().
eth
.
sign
(
account
,
hashedMsg
,
(
error
,
signedData
)
=>
{
alertSignedData
(
error
,
hashedMsg
,
signedData
)
this
.
alertSignedData
(
error
,
hashedMsg
,
signedData
)
})
}
catch
(
e
)
{
addTooltip
(
e
.
message
)
...
...
@@ -239,7 +239,7 @@ class SettingsUI {
try
{
var
personal
=
new
Personal
(
executionContext
.
web3
().
currentProvider
)
personal
.
sign
(
hashedMsg
,
account
,
passphrase
,
(
error
,
signedData
)
=>
{
alertSignedData
(
error
,
hashedMsg
,
signedData
)
this
.
alertSignedData
(
error
,
hashedMsg
,
signedData
)
})
}
catch
(
e
)
{
addTooltip
(
e
.
message
)
...
...
@@ -252,12 +252,11 @@ class SettingsUI {
})
}
// TODO: cb param doesn't seem to be used
updateNetwork
(
cb
)
{
updateNetwork
()
{
let
self
=
this
var
networkcallid
=
0
networkcallid
++
(
function
(
callid
)
{
(
(
callid
)
=>
{
executionContext
.
detectNetwork
((
err
,
{
id
,
name
}
=
{})
=>
{
if
(
networkcallid
>
callid
)
return
networkcallid
++
...
...
@@ -267,8 +266,6 @@ class SettingsUI {
}
else
{
self
.
netUI
.
innerHTML
=
`<i class="
${
css
.
networkItem
}
fa fa-plug" aria-hidden="true"></i>
${
name
}
(
${
id
||
'-'
}
)`
}
// TODO: cb param doesn't seem to be used
if
(
cb
)
cb
(
err
,
{
id
,
name
})
})
})(
networkcallid
)
}
...
...
@@ -279,7 +276,7 @@ var accountListCallId = 0
var
loadedAccounts
=
{}
function
fillAccountsList
(
container
,
self
)
{
accountListCallId
++
(
function
(
callid
)
{
(
(
callid
)
=>
{
var
txOrigin
=
container
.
querySelector
(
'#txorigin'
)
self
.
_deps
.
udapp
.
getAccounts
((
err
,
accounts
)
=>
{
if
(
accountListCallId
>
callid
)
return
...
...
@@ -305,12 +302,11 @@ function fillAccountsList (container, self) {
function
updateAccountBalances
(
container
,
self
)
{
var
accounts
=
$
(
container
.
querySelector
(
'#txorigin'
)).
children
(
'option'
)
accounts
.
each
(
function
(
index
,
value
)
{
(
function
(
acc
)
{
self
.
_deps
.
udapp
.
getBalanceInEther
(
accounts
[
acc
].
value
,
function
(
err
,
res
)
{
if
(
!
err
)
{
accounts
[
acc
].
innerText
=
helper
.
shortenAddress
(
accounts
[
acc
].
value
,
res
)
}
accounts
.
each
((
index
,
value
)
=>
{
((
acc
)
=>
{
self
.
_deps
.
udapp
.
getBalanceInEther
(
accounts
[
acc
].
value
,
(
err
,
res
)
=>
{
if
(
err
)
return
accounts
[
acc
].
innerText
=
helper
.
shortenAddress
(
accounts
[
acc
].
value
,
res
)
})
})(
index
)
})
...
...
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