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
8a2e46fc
Commit
8a2e46fc
authored
Jul 06, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better error message if no connection to web3
parent
3d4e5c0a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
22 deletions
+28
-22
TxBrowser.js
src/TxBrowser.js
+18
-9
index.js
src/index.js
+2
-3
init.js
test-browser/init.js
+8
-10
No files found.
src/TxBrowser.js
View file @
8a2e46fc
...
@@ -33,7 +33,7 @@ TxBrowser.prototype.setDefaultValues = function () {
...
@@ -33,7 +33,7 @@ TxBrowser.prototype.setDefaultValues = function () {
this
.
blockNumber
=
null
this
.
blockNumber
=
null
this
.
txNumber
=
'0xcda2b2835add61af54cf83bd076664d98d7908c6cd98d86423b3b48d8b8e51ff'
this
.
txNumber
=
'0xcda2b2835add61af54cf83bd076664d98d7908c6cd98d86423b3b48d8b8e51ff'
this
.
connectInfo
=
''
this
.
connectInfo
=
''
this
.
checkWeb3
(
)
this
.
updateWeb3Url
(
this
.
web3
.
currentProvider
.
host
)
}
}
TxBrowser
.
prototype
.
submit
=
function
()
{
TxBrowser
.
prototype
.
submit
=
function
()
{
...
@@ -70,18 +70,27 @@ TxBrowser.prototype.submit = function () {
...
@@ -70,18 +70,27 @@ TxBrowser.prototype.submit = function () {
yo
.
update
(
this
.
view
,
this
.
render
())
yo
.
update
(
this
.
view
,
this
.
render
())
}
}
TxBrowser
.
prototype
.
updateWeb3Url
=
function
(
ev
)
{
TxBrowser
.
prototype
.
updateWeb3Url
=
function
(
newhost
)
{
init
.
setProvider
(
this
.
web3
,
ev
.
target
.
value
)
init
.
setProvider
(
this
.
web3
,
newhost
)
this
.
checkWeb3
()
var
self
=
this
yo
.
update
(
this
.
view
,
this
.
render
())
this
.
checkWeb3
(
function
(
error
,
block
)
{
if
(
!
error
)
{
self
.
connectInfo
=
'Connected to '
+
self
.
web3
.
currentProvider
.
host
+
'. Current block number: '
+
block
}
else
{
self
.
connectInfo
=
'Unable to connect to '
+
self
.
web3
.
currentProvider
.
host
+
'. '
+
error
.
message
}
yo
.
update
(
self
.
view
,
self
.
render
())
})
}
}
TxBrowser
.
prototype
.
checkWeb3
=
function
()
{
TxBrowser
.
prototype
.
checkWeb3
=
function
(
callback
)
{
try
{
try
{
this
.
connectInfo
=
'Connected to '
+
this
.
web3
.
currentProvider
.
host
this
.
web3
.
eth
.
getBlockNumber
(
function
(
error
,
block
)
{
callback
(
error
,
block
)
})
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
e
)
this
.
connectInfo
=
e
.
message
callback
(
e
.
message
,
null
)
}
}
}
}
...
@@ -101,7 +110,7 @@ TxBrowser.prototype.init = function (ev) {
...
@@ -101,7 +110,7 @@ TxBrowser.prototype.init = function (ev) {
TxBrowser
.
prototype
.
render
=
function
()
{
TxBrowser
.
prototype
.
render
=
function
()
{
var
self
=
this
var
self
=
this
var
view
=
yo
`<div style=
${
ui
.
formatCss
(
style
.
container
)}
>
var
view
=
yo
`<div style=
${
ui
.
formatCss
(
style
.
container
)}
>
<span>Node URL: </span><input onkeyup=
${
function
()
{
self
.
updateWeb3Url
(
arguments
[
0
])
}
} value=
${
this
.
web3
.
currentProvider
?
this
.
web3
.
currentProvider
.
host
:
' - none - '
}
type='text' />
<span>Node URL: </span><input onkeyup=
${
function
()
{
self
.
updateWeb3Url
(
arguments
[
0
]
.
target
.
value
)
}
} value=
${
this
.
web3
.
currentProvider
?
this
.
web3
.
currentProvider
.
host
:
' - none - '
}
type='text' />
<span>
${
this
.
connectInfo
}
</span>
<span>
${
this
.
connectInfo
}
</span>
<br />
<br />
<br />
<br />
...
...
src/index.js
View file @
8a2e46fc
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
var
Debugger
=
require
(
'./Ethdebugger'
)
var
Debugger
=
require
(
'./Ethdebugger'
)
function
init
()
{
function
init
()
{
var
container
=
document
.
getElementById
(
'app'
)
var
container
=
document
.
getElementById
(
'app'
)
window
.
vmdebugger
=
new
Debugger
()
container
.
vmdebugger
=
new
Debugger
()
container
.
appendChild
(
window
.
vmdebugger
.
render
())
container
.
appendChild
(
container
.
vmdebugger
.
render
())
}
}
init
()
init
()
test-browser/init.js
View file @
8a2e46fc
...
@@ -14,9 +14,9 @@ function injectScript (file, browser, callback) {
...
@@ -14,9 +14,9 @@ function injectScript (file, browser, callback) {
init
.
readFile
(
file
,
function
(
error
,
result
)
{
init
.
readFile
(
file
,
function
(
error
,
result
)
{
if
(
!
error
)
{
if
(
!
error
)
{
browser
.
execute
(
function
(
data
)
{
browser
.
execute
(
function
(
data
)
{
// var vmdebugger = window.vmdebugger //
document.getElementById('app').vmdebugger
var
vmdebugger
=
document
.
getElementById
(
'app'
).
vmdebugger
data
=
JSON
.
parse
(
data
)
data
=
JSON
.
parse
(
data
)
window
.
vmdebugger
.
web3
.
eth
.
getCode
=
function
(
address
,
callback
)
{
vmdebugger
.
web3
.
eth
.
getCode
=
function
(
address
,
callback
)
{
if
(
callback
)
{
if
(
callback
)
{
callback
(
null
,
data
.
testCodes
[
address
])
callback
(
null
,
data
.
testCodes
[
address
])
}
else
{
}
else
{
...
@@ -24,15 +24,15 @@ function injectScript (file, browser, callback) {
...
@@ -24,15 +24,15 @@ function injectScript (file, browser, callback) {
}
}
}
}
window
.
vmdebugger
.
web3
.
debug
.
traceTransaction
=
function
(
txHash
,
options
,
callback
)
{
vmdebugger
.
web3
.
debug
.
traceTransaction
=
function
(
txHash
,
options
,
callback
)
{
callback
(
null
,
data
.
testTraces
[
txHash
])
callback
(
null
,
data
.
testTraces
[
txHash
])
}
}
window
.
vmdebugger
.
web3
.
debug
.
storageAt
=
function
(
blockNumber
,
txIndex
,
address
,
callback
)
{
vmdebugger
.
web3
.
debug
.
storageAt
=
function
(
blockNumber
,
txIndex
,
address
,
callback
)
{
callback
(
null
,
{})
callback
(
null
,
{})
}
}
window
.
vmdebugger
.
web3
.
eth
.
getTransaction
=
function
(
txHash
,
callback
)
{
vmdebugger
.
web3
.
eth
.
getTransaction
=
function
(
txHash
,
callback
)
{
if
(
callback
)
{
if
(
callback
)
{
callback
(
null
,
data
.
testTxs
[
txHash
])
callback
(
null
,
data
.
testTxs
[
txHash
])
}
else
{
}
else
{
...
@@ -40,7 +40,7 @@ function injectScript (file, browser, callback) {
...
@@ -40,7 +40,7 @@ function injectScript (file, browser, callback) {
}
}
}
}
window
.
vmdebugger
.
web3
.
eth
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
callback
)
{
vmdebugger
.
web3
.
eth
.
getTransactionFromBlock
=
function
(
blockNumber
,
txIndex
,
callback
)
{
if
(
callback
)
{
if
(
callback
)
{
callback
(
null
,
data
.
testTxsByBlock
[
blockNumber
+
'-'
+
txIndex
])
callback
(
null
,
data
.
testTxsByBlock
[
blockNumber
+
'-'
+
txIndex
])
}
else
{
}
else
{
...
@@ -48,11 +48,9 @@ function injectScript (file, browser, callback) {
...
@@ -48,11 +48,9 @@ function injectScript (file, browser, callback) {
}
}
}
}
window
.
vmdebugger
.
web3
.
eth
.
getBlockNumber
=
function
(
callback
)
{
callback
(
'web3 modified
testing purposes :)'
)
}
vmdebugger
.
web3
.
eth
.
getBlockNumber
=
function
(
callback
)
{
callback
(
null
,
'web3 modified for
testing purposes :)'
)
}
window
.
vmdebugger
.
web3
.
eth
.
getBlockNumber
(
function
(
r
)
{
vmdebugger
.
web3
.
currentProvider
=
{
host
:
'web3 modified for testing purposes :)'
}
console
.
log
(
'rrrr'
+
r
)
})
},
[
result
],
function
()
{
},
[
result
],
function
()
{
callback
()
callback
()
})
})
...
...
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