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
043050a3
Commit
043050a3
authored
Jun 27, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- node url update
parent
ea29683c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
TxBrowser.js
src/TxBrowser.js
+25
-2
init.js
src/helpers/init.js
+4
-0
No files found.
src/TxBrowser.js
View file @
043050a3
...
...
@@ -4,6 +4,7 @@ var EventManager = require('./lib/eventManager')
var
traceHelper
=
require
(
'./helpers/traceHelper'
)
var
yo
=
require
(
'yo-yo'
)
var
ui
=
require
(
'./helpers/ui'
)
var
init
=
require
(
'./helpers/init'
)
function
TxBrowser
(
_web3
)
{
util
.
extend
(
this
,
new
EventManager
())
...
...
@@ -31,6 +32,8 @@ TxBrowser.prototype.setDefaultValues = function () {
this
.
hash
=
' - '
this
.
blockNumber
=
null
this
.
txNumber
=
'0xcda2b2835add61af54cf83bd076664d98d7908c6cd98d86423b3b48d8b8e51ff'
this
.
connectInfo
=
''
this
.
checkWeb3
()
}
TxBrowser
.
prototype
.
submit
=
function
()
{
...
...
@@ -66,6 +69,22 @@ TxBrowser.prototype.submit = function () {
yo
.
update
(
this
.
view
,
this
.
render
())
}
TxBrowser
.
prototype
.
updateWeb3Url
=
function
(
ev
)
{
init
.
setProvider
(
this
.
web3
,
ev
.
target
.
value
)
this
.
checkWeb3
()
yo
.
update
(
this
.
view
,
this
.
render
())
}
TxBrowser
.
prototype
.
checkWeb3
=
function
()
{
try
{
console
.
log
(
'block '
+
this
.
web3
.
eth
.
blockNumber
)
this
.
connectInfo
=
'Connected to '
+
this
.
web3
.
currentProvider
.
host
}
catch
(
e
)
{
console
.
log
(
e
)
this
.
connectInfo
=
e
.
message
}
}
TxBrowser
.
prototype
.
updateBlockN
=
function
(
ev
)
{
this
.
blockNumber
=
ev
.
target
.
value
}
...
...
@@ -82,8 +101,12 @@ TxBrowser.prototype.init = function (ev) {
TxBrowser
.
prototype
.
render
=
function
()
{
var
self
=
this
var
view
=
yo
`<div style=
${
ui
.
formatCss
(
style
.
container
)}
>
<input onchange=
${
function
()
{
self
.
updateBlockN
(
arguments
[
0
])
}
} type='text' placeholder=
${
'Block number (default 1000110)'
+
this
.
blockNumber
}
></input>
<input onchange=
${
function
()
{
self
.
updateTxN
(
arguments
[
0
])
}
} type='text' value=
${
this
.
txNumber
}
placeholder=
${
'Transaction Number or hash (default 2) '
+
this
.
txNumber
}
></input>
<span>Node URL: </span><input onkeyup=
${
function
()
{
self
.
updateWeb3Url
(
arguments
[
0
])
}
} value=
${
this
.
web3
.
currentProvider
?
this
.
web3
.
currentProvider
.
host
:
' - none - '
}
type='text' />
<span>
${
this
.
connectInfo
}
</span>
<br />
<br />
<input onkeyup=
${
function
()
{
self
.
updateBlockN
(
arguments
[
0
])
}
} type='text' placeholder=
${
'Block number (default 1000110)'
+
this
.
blockNumber
}
/>
<input onkeyup=
${
function
()
{
self
.
updateTxN
(
arguments
[
0
])
}
} type='text' value=
${
this
.
txNumber
}
placeholder=
${
'Transaction Number or hash (default 2) '
+
this
.
txNumber
}
/>
<button onclick=
${
function
()
{
self
.
submit
()
}
}>
Get
</button>
...
...
src/helpers/init.js
View file @
043050a3
...
...
@@ -8,5 +8,9 @@ module.exports = {
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
))
Web3Admin
.
extend
(
web3
)
return
web3
},
setProvider
:
function
(
web3
,
url
)
{
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
url
))
}
}
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