From a3f43f0a51a265167006e6b052f5b547baefbba2 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 26 May 2016 19:22:35 +0100 Subject: [PATCH] Define undefined/redefined variables --- src/app.js | 6 +++--- src/app/compiler.js | 1 + src/app/renderer.js | 7 ++++--- src/universal-dapp.js | 12 +++++++----- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/app.js b/src/app.js index 3018ecc870..44be0388ed 100644 --- a/src/app.js +++ b/src/app.js @@ -241,9 +241,9 @@ var run = function() { return $('
  • '+name+'
  • '); } - $filesWrapper = $('.files-wrapper'); - $scrollerRight = $('.scroller-right'); - $scrollerLeft = $('.scroller-left'); + var $filesWrapper = $('.files-wrapper'); + var $scrollerRight = $('.scroller-right'); + var $scrollerLeft = $('.scroller-left'); function widthOfList (){ var itemsWidth = 0; diff --git a/src/app/compiler.js b/src/app/compiler.js index 6d6fc42ed6..e5a1b209a9 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -161,6 +161,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update } var importRegex = /^\s*import\s*[\'\"]([^\'\"]+)[\'\"];/g; var reloop = false; + var githubMatch; do { reloop = false; for (var fileName in files) { diff --git a/src/app/renderer.js b/src/app/renderer.js index 90640a9286..b3a8700b5b 100644 --- a/src/app/renderer.js +++ b/src/app/renderer.js @@ -121,7 +121,7 @@ function Renderer(web3, editor, compiler, updateFiles) { var $contractOutput = dapp.render(); - $txOrigin = $('#txorigin'); + var $txOrigin = $('#txorigin'); function renderAccounts(err, accounts) { if (err) @@ -188,13 +188,14 @@ function Renderer(web3, editor, compiler, updateFiles) { var formatGasEstimates = function(data) { var gasToText = function(g) { return g === null ? 'unknown' : g; } var text = ''; + var fun; if ('creation' in data) text += 'Creation: ' + gasToText(data.creation[0]) + ' + ' + gasToText(data.creation[1]) + '\n'; text += 'External:\n'; - for (var fun in data.external) + for (fun in data.external) text += ' ' + fun + ': ' + gasToText(data.external[fun]) + '\n'; text += 'Internal:\n'; - for (var fun in data.internal) + for (fun in data.internal) text += ' ' + fun + ': ' + gasToText(data.internal[fun]) + '\n'; return text; }; diff --git a/src/universal-dapp.js b/src/universal-dapp.js index f44695b801..0122aab6fb 100644 --- a/src/universal-dapp.js +++ b/src/universal-dapp.js @@ -97,7 +97,7 @@ UniversalDApp.prototype.render = function () { this.$el.append(this.renderOutputModifier(this.contracts[c].name, $contractEl)); } } - $legend = $('
    ') + var $legend = $('
    ') .append( $('
    ').text('Attach') ) .append( $('
    ').text('Transact') ) .append( $('
    ').text('Call') ); @@ -183,13 +183,14 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar $instance.toggleClass('hide'); }); - $events = $('
    '); + var $events = $('
    '); var parseLogs = function(err,response) { if (err) return; - $event = $('
    '); + var $event = $('
    '); + var $close = $('
    '); $close.click( function(){ $event.remove(); } ); @@ -562,8 +563,9 @@ UniversalDApp.prototype.runTx = function( data, args, cb) { } } + var tx; if (!this.vm) { - var tx = { + tx = { from: self.options.getAddress ? self.options.getAddress() : web3.eth.accounts[0], to: to, data: data, @@ -583,7 +585,7 @@ UniversalDApp.prototype.runTx = function( data, args, cb) { try { var address = this.options.getAddress ? this.options.getAddress() : this.getAccounts()[0]; var account = this.accounts[address]; - var tx = new EthJSTX({ + tx = new EthJSTX({ nonce: new Buffer([account.nonce++]), //@todo count beyond 255 gasPrice: 1, gasLimit: 3000000000, //plenty