@ -10,7 +10,7 @@ function UniversalDApp (contracts, options) {
this . options = options || { } ;
this . $el = $ ( '<div class="udapp" />' ) ;
this . contracts = contracts ;
this . renderOutputModifier = options . renderOutputModifier || function ( name , content ) { return content ; } ;
this . renderOutputModifier = options . renderOutputModifier || function ( name , content ) { return content ; } ;
this . web3 = options . web3 ;
if ( ! this . web3 ) {
@ -40,7 +40,7 @@ UniversalDApp.prototype.addAccount = function (privateKey, balance) {
var address = ethJSUtil . privateToAddress ( privateKey ) ;
// FIXME: we don't care about the callback, but we should still make this proper
this . vm . stateManager . putAccountBalance ( address , balance || 'f00000000000000001' , function cb ( ) { } ) ;
this . vm . stateManager . putAccountBalance ( address , balance || 'f00000000000000001' , function cb ( ) { } ) ;
this . accounts [ '0x' + address . toString ( 'hex' ) ] = { privateKey : privateKey , nonce : 0 } ;
}
@ -82,65 +82,65 @@ UniversalDApp.prototype.getBalance = function (address, cb) {
UniversalDApp . prototype . render = function ( ) {
if ( this . contracts . length === 0 ) {
this . $el . append ( this . getABIInputForm ( ) ) ;
this . $el . append ( this . getABIInputForm ( ) ) ;
} else {
for ( var c in this . contracts ) {
var $contractEl = $ ( '<div class="contract"/>' ) ;
if ( this . contracts [ c ] . address ) {
this . getInstanceInterface ( this . contracts [ c ] , this . contracts [ c ] . address , $contractEl ) ;
this . getInstanceInterface ( this . contracts [ c ] , this . contracts [ c ] . address , $contractEl ) ;
} else {
var $title = $ ( '<span class="title"/>' ) . text ( this . contracts [ c ] . name ) ;
var $title = $ ( '<span class="title"/>' ) . text ( this . contracts [ c ] . name ) ;
if ( this . contracts [ c ] . bytecode ) {
$title . append ( $ ( '<div class="size"/>' ) . text ( ( this . contracts [ c ] . bytecode . length / 2 ) + ' bytes' ) ) ;
}
$contractEl . append ( $title ) . append ( this . getCreateInterface ( $contractEl , this . contracts [ c ] ) ) ;
$contractEl . append ( $title ) . append ( this . getCreateInterface ( $contractEl , this . contracts [ c ] ) ) ;
}
this . $el . append ( this . renderOutputModifier ( this . contracts [ c ] . name , $contractEl ) ) ;
}
}
var $legend = $ ( '<div class="legend" />' )
. append ( $ ( '<div class="attach"/>' ) . text ( 'Attach' ) )
. append ( $ ( '<div class="transact"/>' ) . text ( 'Transact' ) )
. append ( $ ( '<div class="call"/>' ) . text ( 'Call' ) ) ;
. append ( $ ( '<div class="attach"/>' ) . text ( 'Attach' ) )
. append ( $ ( '<div class="transact"/>' ) . text ( 'Transact' ) )
. append ( $ ( '<div class="call"/>' ) . text ( 'Call' ) ) ;
this . $el . append ( $ ( '<div class="poweredBy" />' )
. html ( '<a href="http://github.com/d11e9/universal-dapp">Universal ÐApp</a> powered by The Blockchain' ) ) ;
this . $el . append ( $ ( '<div class="poweredBy" />' )
. html ( '<a href="http://github.com/d11e9/universal-dapp">Universal ÐApp</a> powered by The Blockchain' ) ) ;
this . $el . append ( $legend ) ;
this . $el . append ( $legend ) ;
return this . $el ;
} ;
UniversalDApp . prototype . getContractByName = function ( contractName ) {
UniversalDApp . prototype . getContractByName = function ( contractName ) {
for ( var c in this . contracts )
if ( this . contracts [ c ] . name === contractName )
return this . contracts [ c ] ;
return null ;
} ;
UniversalDApp . prototype . getABIInputForm = function ( cb ) {
UniversalDApp . prototype . getABIInputForm = function ( cb ) {
var self = this ;
var $el = $ ( '<div class="udapp-setup" />' ) ;
var $jsonInput = $ ( '<textarea class="json" placeholder=\'[ { "name": name, "bytecode": bytecode, "interface": abi }, { ... } ]\'/>' ) ;
var $createButton = $ ( '<button class="udapp-create"/>' ) . text ( 'Create a Universal ÐApp' ) ;
$createButton . click ( function ( ev ) {
var contracts = $ . parseJSON ( $jsonInput . val ( ) ) ;
$createButton . click ( function ( ev ) {
var contracts = $ . parseJSON ( $jsonInput . val ( ) ) ;
if ( cb ) {
var err = null ;
var dapp = null ;
try {
dapp = new UniversalDApp ( contracts , self . options ) ;
} catch ( e ) {
dapp = new UniversalDApp ( contracts , self . options ) ;
} catch ( e ) {
err = e ;
}
cb ( err , dapp ) ;
cb ( err , dapp ) ;
} else {
self . contracts = contracts ;
self . $el . empty ( ) . append ( self . render ( ) ) ;
self . $el . empty ( ) . append ( self . render ( ) ) ;
}
} ) ;
$el . append ( $jsonInput ) . append ( $createButton ) ;
$el . append ( $jsonInput ) . append ( $createButton ) ;
return $el ;
} ;
@ -150,21 +150,21 @@ UniversalDApp.prototype.getCreateInterface = function ($container, contract) {
var $createInterface = $ ( '<div class="create"/>' ) ;
if ( this . options . removable ) {
var $close = $ ( '<div class="udapp-close" />' ) ;
$close . click ( function ( ) { self . $el . remove ( ) ; } ) ;
$createInterface . append ( $close ) ;
$close . click ( function ( ) { self . $el . remove ( ) ; } ) ;
$createInterface . append ( $close ) ;
}
var $newButton = this . getInstanceInterface ( contract ) ;
var $atButton = $ ( '<button class="atAddress"/>' ) . text ( 'At Address' ) . click ( function ( ) { self . clickContractAt ( self , $container . find ( '.createContract' ) , contract ) ; } ) ;
$createInterface . append ( $atButton ) . append ( $newButton ) ;
var $newButton = this . getInstanceInterface ( contract ) ;
var $atButton = $ ( '<button class="atAddress"/>' ) . text ( 'At Address' ) . click ( function ( ) { self . clickContractAt ( self , $container . find ( '.createContract' ) , contract ) ; } ) ;
$createInterface . append ( $atButton ) . append ( $newButton ) ;
return $createInterface ;
} ;
UniversalDApp . prototype . getInstanceInterface = function ( contract , address , $target ) {
var self = this ;
var abi = JSON . parse ( contract . interface ) . sort ( function ( a , b ) {
var abi = JSON . parse ( contract . interface ) . sort ( function ( a , b ) {
if ( a . name > b . name ) return - 1 ;
else return 1 ;
} ) . sort ( function ( a , b ) {
} ) . sort ( function ( a , b ) {
if ( a . constant === true ) return - 1 ;
else return 1 ;
} ) ;
@ -172,50 +172,50 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
var funABI = this . getConstructorInterface ( abi ) ;
var $createInterface = $ ( '<div class="createContract"/>' ) ;
var appendFunctions = function ( address , $el ) {
var appendFunctions = function ( address , $el ) {
var $instance = $ ( '<div class="instance"/>' ) ;
if ( self . options . removable _instances ) {
var $close = $ ( '<div class="udapp-close" />' ) ;
$close . click ( function ( ) { $instance . remove ( ) ; } ) ;
$instance . append ( $close ) ;
$close . click ( function ( ) { $instance . remove ( ) ; } ) ;
$instance . append ( $close ) ;
}
var context = self . options . vm ? 'memory' : 'blockchain' ;
var $title = $ ( '<span class="title"/>' ) . text ( contract . name + ' at ' + ( self . options . vm ? '0x' : '' ) + address . toString ( 'hex' ) + ' (' + context + ')' ) ;
$title . click ( function ( ) {
var $title = $ ( '<span class="title"/>' ) . text ( contract . name + ' at ' + ( self . options . vm ? '0x' : '' ) + address . toString ( 'hex' ) + ' (' + context + ')' ) ;
$title . click ( function ( ) {
$instance . toggleClass ( 'hide' ) ;
} ) ;
var $events = $ ( '<div class="events"/>' ) ;
var parseLogs = function ( err , response ) {
var parseLogs = function ( err , response ) {
if ( err )
return ;
var $event = $ ( '<div class="event" />' ) ;
var $close = $ ( '<div class="udapp-close" />' ) ;
$close . click ( function ( ) { $event . remove ( ) ; } ) ;
$close . click ( function ( ) { $event . remove ( ) ; } ) ;
$event . append ( $ ( '<span class="name"/>' ) . text ( response . event ) )
. append ( $ ( '<span class="args" />' ) . text ( JSON . stringify ( response . args , null , 2 ) ) )
. append ( $close ) ;
$event . append ( $ ( '<span class="name"/>' ) . text ( response . event ) )
. append ( $ ( '<span class="args" />' ) . text ( JSON . stringify ( response . args , null , 2 ) ) )
. append ( $close ) ;
$events . append ( $event ) ;
$events . append ( $event ) ;
} ;
if ( self . options . vm ) {
if ( self . options . vm ) {
// FIXME: support indexed events
var eventABI = { } ;
$ . each ( abi , function ( i , funABI ) {
$ . each ( abi , function ( i , funABI ) {
if ( funABI . type !== 'event' ) return ;
var hash = ethJSABI . eventID ( funABI . name , funABI . inputs . map ( function ( item ) { return item . type ; } ) ) ;
var hash = ethJSABI . eventID ( funABI . name , funABI . inputs . map ( function ( item ) { return item . type ; } ) ) ;
eventABI [ hash . toString ( 'hex' ) ] = { event : funABI . name , inputs : funABI . inputs } ;
} ) ;
self . vm . on ( 'afterTx' , function ( response ) {
self . vm . on ( 'afterTx' , function ( response ) {
for ( var i in response . vm . logs ) {
// [address, topics, mem]
var log = response . vm . logs [ i ] ;
@ -240,36 +240,36 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
var eventFilter = web3contract . at ( address ) . allEvents ( ) ;
eventFilter . watch ( parseLogs ) ;
}
$instance . append ( $title ) ;
$instance . append ( $title ) ;
// Add the fallback function
$instance . append ( self . getCallButton ( {
abi : { constant : false , inputs : [ ] , name : '(fallback)' , outputs : [ ] , type : 'function' } ,
encode : function ( args ) {
abi : { constant : false , inputs : [ ] , name : '(fallback)' , outputs : [ ] , type : 'function' } ,
encode : function ( args ) {
return '' ;
} ,
address : address
} ) ) ;
$ . each ( abi , function ( i , funABI ) {
$ . each ( abi , function ( i , funABI ) {
if ( funABI . type !== 'function' ) return ;
// @todo getData cannot be used with overloaded functions
$instance . append ( self . getCallButton ( {
abi : funABI ,
encode : function ( args ) {
encode : function ( args ) {
var obj = web3contract . at ( '0x00' ) [ funABI . name ] ;
return obj . getData . apply ( obj , args ) ;
} ,
address : address
} ) ) ;
} ) ;
( $el || $createInterface ) . append ( $instance . append ( $events ) ) ;
( $el || $createInterface ) . append ( $instance . append ( $events ) ) ;
} ;
if ( ! address || ! $target ) {
$createInterface . append ( this . getCallButton ( {
$createInterface . append ( this . getCallButton ( {
abi : funABI ,
encode : function ( args ) {
encode : function ( args ) {
var obj = web3contract . new ;
return obj . getData . apply ( obj , args ) ;
} ,
@ -278,14 +278,14 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
appendFunctions : appendFunctions
} ) ) ;
} else {
appendFunctions ( address , $target ) ;
appendFunctions ( address , $target ) ;
}
return $createInterface ;
} ;
UniversalDApp . prototype . getConstructorInterface = function ( abi ) {
var funABI = { 'name' : '' , 'inputs' : [ ] , 'type' : 'constructor' , 'outputs' : [ ] } ;
UniversalDApp . prototype . getConstructorInterface = function ( abi ) {
var funABI = { 'name' : '' , 'inputs' : [ ] , 'type' : 'constructor' , 'outputs' : [ ] } ;
for ( var i = 0 ; i < abi . length ; i ++ )
if ( abi [ i ] . type === 'constructor' ) {
funABI . inputs = abi [ i ] . inputs || [ ] ;
@ -294,15 +294,15 @@ UniversalDApp.prototype.getConstructorInterface = function(abi) {
return funABI ;
} ;
UniversalDApp . prototype . getCallButton = function ( args ) {
UniversalDApp . prototype . getCallButton = function ( args ) {
var self = this ;
// args.abi, args.encode, args.bytecode [constr only], args.address [fun only]
// args.contractName [constr only], args.appendFunctions [constr only]
var isConstructor = args . bytecode !== undefined ;
var lookupOnly = ( args . abi . constant && ! isConstructor ) ;
var lookupOnly = ( args . abi . constant && ! isConstructor ) ;
var inputs = '' ;
$ . each ( args . abi . inputs , function ( i , inp ) {
$ . each ( args . abi . inputs , function ( i , inp ) {
if ( inputs !== '' ) inputs += ', ' ;
inputs += inp . type + ' ' + inp . name ;
} ) ;
@ -310,10 +310,10 @@ UniversalDApp.prototype.getCallButton = function(args) {
var $outputOverride = $ ( '<div class="value" />' ) ;
var outputSpan = $ ( '<div class="output"/>' ) ;
var getReturnOutput = function ( result ) {
var getReturnOutput = function ( result ) {
var returnName = lookupOnly ? 'Value' : 'Result' ;
var returnCls = lookupOnly ? 'value' : 'returned' ;
return $ ( '<div class="' + returnCls + '">' ) . html ( '<strong>' + returnName + ':</strong> ' + JSON . stringify ( result , null , 2 ) ) ;
return $ ( '<div class="' + returnCls + '">' ) . html ( '<strong>' + returnName + ':</strong> ' + JSON . stringify ( result , null , 2 ) ) ;
} ;
var getGasUsedOutput = function ( result , vmResult ) {
@ -321,12 +321,12 @@ UniversalDApp.prototype.getCallButton = function(args) {
var caveat = lookupOnly ? '<em>(<span class="caveat" title="Cost only applies when called by a contract">caveat</span>)</em>' : '' ;
if ( result . gasUsed ) {
var gas = result . gasUsed . toString ( 10 ) ;
$gasUsed . html ( '<strong>Transaction cost:</strong> ' + gas + ' gas. ' + caveat ) ;
$gasUsed . html ( '<strong>Transaction cost:</strong> ' + gas + ' gas. ' + caveat ) ;
}
if ( vmResult . gasUsed ) {
var $callGasUsed = $ ( '<div class="gasUsed">' ) ;
var gas = vmResult . gasUsed . toString ( 10 ) ;
$callGasUsed . append ( '<strong>Execution cost:</strong> ' + gas + ' gas.' ) ;
$callGasUsed . append ( '<strong>Execution cost:</strong> ' + gas + ' gas.' ) ;
$gasUsed . append ( $callGasUsed ) ;
}
return $gasUsed ;
@ -345,28 +345,28 @@ UniversalDApp.prototype.getCallButton = function(args) {
return $ ( '<div class="decoded">' ) . html ( '<strong>Decoded:</strong> ' ) . append ( $decoded ) ;
} ;
var getOutput = function ( ) {
var getOutput = function ( ) {
var $result = $ ( '<div class="result" />' ) ;
var $close = $ ( '<div class="udapp-close" />' ) ;
$close . click ( function ( ) { $result . remove ( ) ; } ) ;
$result . append ( $close ) ;
$close . click ( function ( ) { $result . remove ( ) ; } ) ;
$result . append ( $close ) ;
return $result ;
} ;
var clearOutput = function ( $result ) {
var clearOutput = function ( $result ) {
$ ( ':not(.udapp-close)' , $result ) . remove ( ) ;
} ;
var replaceOutput = function ( $result , message ) {
var replaceOutput = function ( $result , message ) {
clearOutput ( $result ) ;
$result . append ( message ) ;
} ;
var handleCallButtonClick = function ( ev , $result ) {
var handleCallButtonClick = function ( ev , $result ) {
if ( ! $result ) {
$result = getOutput ( ) ;
if ( lookupOnly && ! inputs . length )
$outputOverride . empty ( ) . append ( $result ) ;
$outputOverride . empty ( ) . append ( $result ) ;
else
outputSpan . append ( $result ) ;
outputSpan . append ( $result ) ;
}
var funArgs = '' ;
@ -380,7 +380,7 @@ UniversalDApp.prototype.getCallButton = function(args) {
if ( ! isConstructor || funArgs . length > 0 ) {
try {
data = args . encode ( funArgs ) ;
} catch ( e ) {
} catch ( e ) {
replaceOutput ( $result , $ ( '<span/>' ) . text ( 'Error encoding arguments: ' + e ) ) ;
return ;
}
@ -395,7 +395,7 @@ UniversalDApp.prototype.getCallButton = function(args) {
if ( args . bytecode . indexOf ( '_' ) >= 0 ) {
replaceOutput ( $result , $ ( '<span>Deploying and linking required libraries...</span>' ) ) ;
if ( self . options . vm )
self . linkBytecode ( args . contractName , function ( err , bytecode ) {
self . linkBytecode ( args . contractName , function ( err , bytecode ) {
if ( err )
replaceOutput ( $result , $ ( '<span/>' ) . text ( 'Error deploying required libraries: ' + err ) ) ;
else {
@ -410,7 +410,7 @@ UniversalDApp.prototype.getCallButton = function(args) {
data = args . bytecode + data ;
}
self . runTx ( data , args , function ( err , result ) {
self . runTx ( data , args , function ( err , result ) {
if ( err ) {
replaceOutput ( $result , $ ( '<span/>' ) . text ( err ) . addClass ( 'error' ) ) ;
} else if ( self . options . vm && result . vm . exception && result . vm . exceptionError ) {
@ -420,7 +420,7 @@ UniversalDApp.prototype.getCallButton = function(args) {
} else if ( self . options . vm && isConstructor ) {
replaceOutput ( $result , getGasUsedOutput ( result , result . vm ) ) ;
args . appendFunctions ( result . createdAddress ) ;
} else if ( self . options . vm ) {
} else if ( self . options . vm ) {
var outputObj = '0x' + result . vm . return . toString ( 'hex' ) ;
clearOutput ( $result ) ;
$result . append ( getReturnOutput ( outputObj ) ) . append ( getGasUsedOutput ( result , result . vm ) ) ;
@ -457,16 +457,16 @@ UniversalDApp.prototype.getCallButton = function(args) {
} else {
function tryTillResponse ( txhash , done ) {
this . web3 . eth . getTransactionReceipt ( result , testResult ) ;
this . web3 . eth . getTransactionReceipt ( result , testResult ) ;
function testResult ( err , address ) {
if ( ! err && ! address ) {
setTimeout ( function ( ) { tryTillResponse ( txhash , done ) ; } , 500 ) ;
} else done ( err , address ) ;
setTimeout ( function ( ) { tryTillResponse ( txhash , done ) ; } , 500 ) ;
} else done ( err , address ) ;
}
}
tryTillResponse ( result , function ( err , result ) {
tryTillResponse ( result , function ( err , result ) {
if ( err ) replaceOutput ( $result , $ ( '<span/>' ) . text ( err ) . addClass ( 'error' ) ) ;
else if ( isConstructor ) {
$result . html ( '' ) ;
@ -482,10 +482,10 @@ UniversalDApp.prototype.getCallButton = function(args) {
} ;
var button = $ ( '<button />' )
. addClass ( 'call' )
. addClass ( 'call' )
. attr ( 'title' , args . abi . name )
. text ( args . bytecode ? 'Create' : args . abi . name )
. click ( handleCallButtonClick ) ;
. click ( handleCallButtonClick ) ;
if ( lookupOnly && ! inputs . length ) {
handleCallButtonClick ( ) ;
@ -493,15 +493,15 @@ UniversalDApp.prototype.getCallButton = function(args) {
var $contractProperty = $ ( '<div class="contractProperty"/>' ) ;
$contractProperty
. toggleClass ( 'constant' , ! isConstructor && args . abi . constant )
. toggleClass ( 'hasArgs' , args . abi . inputs . length > 0 )
. toggleClass ( 'constructor' , isConstructor )
. toggleClass ( 'constant' , ! isConstructor && args . abi . constant )
. toggleClass ( 'hasArgs' , args . abi . inputs . length > 0 )
. toggleClass ( 'constructor' , isConstructor )
. append ( button )
. append ( ( lookupOnly && ! inputs . length ) ? $outputOverride : inputField ) ;
. append ( ( lookupOnly && ! inputs . length ) ? $outputOverride : inputField ) ;
return $contractProperty . append ( outputSpan ) ;
} ;
UniversalDApp . prototype . linkBytecode = function ( contractName , cb ) {
UniversalDApp . prototype . linkBytecode = function ( contractName , cb ) {
var bytecode = this . getContractByName ( contractName ) . bytecode ;
if ( bytecode . indexOf ( '_' ) < 0 )
return cb ( null , bytecode ) ;
@ -512,7 +512,7 @@ UniversalDApp.prototype.linkBytecode = function(contractName, cb) {
if ( ! this . getContractByName ( libraryName ) )
return cb ( 'Library ' + libraryName + ' not found.' ) ;
var self = this ;
this . deployLibrary ( libraryName , function ( err , address ) {
this . deployLibrary ( libraryName , function ( err , address ) {
if ( err ) return cb ( err ) ;
var libLabel = '__' + libraryName + Array ( 39 - libraryName . length ) . join ( '_' ) ;
var hexAddress = address . toString ( 'hex' ) ;
@ -525,18 +525,18 @@ UniversalDApp.prototype.linkBytecode = function(contractName, cb) {
} ) ;
} ;
UniversalDApp . prototype . deployLibrary = function ( contractName , cb ) {
UniversalDApp . prototype . deployLibrary = function ( contractName , cb ) {
if ( this . getContractByName ( contractName ) . address )
return cb ( null , this . getContractByName ( contractName ) . address ) ;
var self = this ;
var bytecode = this . getContractByName ( contractName ) . bytecode ;
if ( bytecode . indexOf ( '_' ) >= 0 )
this . linkBytecode ( contractName , function ( err , bytecode ) {
this . linkBytecode ( contractName , function ( err , bytecode ) {
if ( err ) cb ( err ) ;
else self . deployLibrary ( contractName , cb ) ;
} ) ;
else {
this . runTx ( bytecode , { abi : { constant : false } , bytecode : bytecode } , function ( err , result ) {
this . runTx ( bytecode , { abi : { constant : false } , bytecode : bytecode } , function ( err , result ) {
if ( err ) return cb ( err ) ;
self . getContractByName ( contractName ) . address = result . createdAddress ;
cb ( err , result . createdAddress ) ;
@ -544,12 +544,12 @@ UniversalDApp.prototype.deployLibrary = function(contractName, cb) {
}
} ;
UniversalDApp . prototype . clickContractAt = function ( self , $output , contract ) {
var address = prompt ( 'What Address is this contract at in the Blockchain? ie: 0xdeadbeaf...' ) ;
self . getInstanceInterface ( contract , address , $output ) ;
UniversalDApp . prototype . clickContractAt = function ( self , $output , contract ) {
var address = prompt ( 'What Address is this contract at in the Blockchain? ie: 0xdeadbeaf...' ) ;
self . getInstanceInterface ( contract , address , $output ) ;
} ;
UniversalDApp . prototype . runTx = function ( data , args , cb ) {
UniversalDApp . prototype . runTx = function ( data , args , cb ) {
var self = this ;
var to = args . address ;
var constant = args . abi . constant ;
@ -578,12 +578,12 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
value : value
} ;
if ( constant && ! isConstructor ) {
this . web3 . eth . call ( tx , cb ) ;
this . web3 . eth . call ( tx , cb ) ;
} else {
this . web3 . eth . estimateGas ( tx , function ( err , resp ) {
this . web3 . eth . estimateGas ( tx , function ( err , resp ) {
tx . gas = resp ;
if ( ! err ) self . web3 . eth . sendTransaction ( tx , cb ) ;
else cb ( err , resp ) ;
if ( ! err ) self . web3 . eth . sendTransaction ( tx , cb ) ;
else cb ( err , resp ) ;
} ) ;
}
} else {
@ -593,7 +593,7 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
tx = new EthJSTX ( {
nonce : new Buffer ( [ account . nonce ++ ] ) , //@todo count beyond 255
gasPrice : 1 ,
gasLimit : 3000000000 , //plenty
gasLimit : 3000000000 , // plenty
to : to ,
value : new this . BN ( value , 10 ) ,
data : new Buffer ( data . slice ( 2 ) , 'hex' )
@ -609,7 +609,7 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
} ) ;
this . vm . runTx ( { block : block , tx : tx , skipBalance : true , skipNonce : true , enableHomestead : true } , cb ) ;
} catch ( e ) {
cb ( e , null ) ;
cb ( e , null ) ;
}
}
} ;