Merge pull request #48 from ethereum/patch/undefined-variables

Define undefined/redefined variables
pull/1/head
chriseth 9 years ago
commit 246f9217e4
  1. 6
      src/app.js
  2. 1
      src/app/compiler.js
  3. 7
      src/app/renderer.js
  4. 12
      src/universal-dapp.js

@ -241,9 +241,9 @@ var run = function() {
return $('<li class="file"><span class="name">'+name+'</span><span class="remove"><i class="fa fa-close"></i></span></li>'); return $('<li class="file"><span class="name">'+name+'</span><span class="remove"><i class="fa fa-close"></i></span></li>');
} }
$filesWrapper = $('.files-wrapper'); var $filesWrapper = $('.files-wrapper');
$scrollerRight = $('.scroller-right'); var $scrollerRight = $('.scroller-right');
$scrollerLeft = $('.scroller-left'); var $scrollerLeft = $('.scroller-left');
function widthOfList (){ function widthOfList (){
var itemsWidth = 0; var itemsWidth = 0;

@ -161,6 +161,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
} }
var importRegex = /^\s*import\s*[\'\"]([^\'\"]+)[\'\"];/g; var importRegex = /^\s*import\s*[\'\"]([^\'\"]+)[\'\"];/g;
var reloop = false; var reloop = false;
var githubMatch;
do { do {
reloop = false; reloop = false;
for (var fileName in files) { for (var fileName in files) {

@ -121,7 +121,7 @@ function Renderer(web3, editor, compiler, updateFiles) {
var $contractOutput = dapp.render(); var $contractOutput = dapp.render();
$txOrigin = $('#txorigin'); var $txOrigin = $('#txorigin');
function renderAccounts(err, accounts) { function renderAccounts(err, accounts) {
if (err) if (err)
@ -188,13 +188,14 @@ function Renderer(web3, editor, compiler, updateFiles) {
var formatGasEstimates = function(data) { var formatGasEstimates = function(data) {
var gasToText = function(g) { return g === null ? 'unknown' : g; } var gasToText = function(g) { return g === null ? 'unknown' : g; }
var text = ''; var text = '';
var fun;
if ('creation' in data) if ('creation' in data)
text += 'Creation: ' + gasToText(data.creation[0]) + ' + ' + gasToText(data.creation[1]) + '\n'; text += 'Creation: ' + gasToText(data.creation[0]) + ' + ' + gasToText(data.creation[1]) + '\n';
text += 'External:\n'; text += 'External:\n';
for (var fun in data.external) for (fun in data.external)
text += ' ' + fun + ': ' + gasToText(data.external[fun]) + '\n'; text += ' ' + fun + ': ' + gasToText(data.external[fun]) + '\n';
text += 'Internal:\n'; text += 'Internal:\n';
for (var fun in data.internal) for (fun in data.internal)
text += ' ' + fun + ': ' + gasToText(data.internal[fun]) + '\n'; text += ' ' + fun + ': ' + gasToText(data.internal[fun]) + '\n';
return text; return text;
}; };

@ -97,7 +97,7 @@ UniversalDApp.prototype.render = function () {
this.$el.append(this.renderOutputModifier(this.contracts[c].name, $contractEl)); this.$el.append(this.renderOutputModifier(this.contracts[c].name, $contractEl));
} }
} }
$legend = $('<div class="legend" />') var $legend = $('<div class="legend" />')
.append( $('<div class="attach"/>').text('Attach') ) .append( $('<div class="attach"/>').text('Attach') )
.append( $('<div class="transact"/>').text('Transact') ) .append( $('<div class="transact"/>').text('Transact') )
.append( $('<div class="call"/>').text('Call') ); .append( $('<div class="call"/>').text('Call') );
@ -183,13 +183,14 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
$instance.toggleClass('hide'); $instance.toggleClass('hide');
}); });
$events = $('<div class="events"/>'); var $events = $('<div class="events"/>');
var parseLogs = function(err,response) { var parseLogs = function(err,response) {
if (err) if (err)
return; return;
$event = $('<div class="event" />'); var $event = $('<div class="event" />');
var $close = $('<div class="udapp-close" />'); var $close = $('<div class="udapp-close" />');
$close.click( function(){ $event.remove(); } ); $close.click( function(){ $event.remove(); } );
@ -562,8 +563,9 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
} }
} }
var tx;
if (!this.vm) { if (!this.vm) {
var tx = { tx = {
from: self.options.getAddress ? self.options.getAddress() : web3.eth.accounts[0], from: self.options.getAddress ? self.options.getAddress() : web3.eth.accounts[0],
to: to, to: to,
data: data, data: data,
@ -583,7 +585,7 @@ UniversalDApp.prototype.runTx = function( data, args, cb) {
try { try {
var address = this.options.getAddress ? this.options.getAddress() : this.getAccounts()[0]; var address = this.options.getAddress ? this.options.getAddress() : this.getAccounts()[0];
var account = this.accounts[address]; var account = this.accounts[address];
var tx = new EthJSTX({ tx = new EthJSTX({
nonce: new Buffer([account.nonce++]), //@todo count beyond 255 nonce: new Buffer([account.nonce++]), //@todo count beyond 255
gasPrice: 1, gasPrice: 1,
gasLimit: 3000000000, //plenty gasLimit: 3000000000, //plenty

Loading…
Cancel
Save