@ -4,6 +4,7 @@ var EventManager = require('./lib/eventManager')
var traceHelper = require ( './helpers/traceHelper' )
var traceHelper = require ( './helpers/traceHelper' )
var yo = require ( 'yo-yo' )
var yo = require ( 'yo-yo' )
var ui = require ( './helpers/ui' )
var ui = require ( './helpers/ui' )
var init = require ( './helpers/init' )
function TxBrowser ( _web3 ) {
function TxBrowser ( _web3 ) {
util . extend ( this , new EventManager ( ) )
util . extend ( this , new EventManager ( ) )
@ -31,6 +32,8 @@ TxBrowser.prototype.setDefaultValues = function () {
this . hash = ' - '
this . hash = ' - '
this . blockNumber = null
this . blockNumber = null
this . txNumber = '0xcda2b2835add61af54cf83bd076664d98d7908c6cd98d86423b3b48d8b8e51ff'
this . txNumber = '0xcda2b2835add61af54cf83bd076664d98d7908c6cd98d86423b3b48d8b8e51ff'
this . connectInfo = ''
this . checkWeb3 ( )
}
}
TxBrowser . prototype . submit = function ( ) {
TxBrowser . prototype . submit = function ( ) {
@ -66,6 +69,22 @@ TxBrowser.prototype.submit = function () {
yo . update ( this . view , this . render ( ) )
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 ) {
TxBrowser . prototype . updateBlockN = function ( ev ) {
this . blockNumber = ev . target . value
this . blockNumber = ev . target . value
}
}
@ -82,8 +101,12 @@ 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 ) } >
< input onchange = $ { function ( ) { self . updateBlockN ( arguments [ 0 ] ) } } type = 'text' placeholder = $ { 'Block number (default 1000110)' + this . blockNumber } > < / i n p u t >
< span > Node URL : < /span><input onkeyup=${function () { self.updateWeb3Url(arguments[0]) }} value=${this.web3.currentProvider ? this.web3.currentProvider.host : ' - none - '} type='text' / >
< input onchange = $ { function ( ) { self . updateTxN ( arguments [ 0 ] ) } } type = 'text' value = $ { this . txNumber } placeholder = $ { 'Transaction Number or hash (default 2) ' + this . txNumber } > < / i n p u t >
< span > $ { this . connectInfo } < / s p a n >
< 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 ( ) } } >
< button onclick = $ { function ( ) { self . submit ( ) } } >
Get
Get
< / b u t t o n >
< / b u t t o n >