Added use strict to all files.

This commit is contained in:
ricmoo 2016-07-25 03:55:16 -04:00
parent 401dd5162d
commit fa0d54966d
6 changed files with 22 additions and 8 deletions

@ -1,3 +1,5 @@
'use strict';
var rlp = require('rlp');
var Contract = require('./lib/contract.js');

@ -1,3 +1,5 @@
'use strict';
var utils = require('./utils.js');
// Creates property that is immutable
@ -291,6 +293,8 @@ function Interface(abi) {
var methods = [], events = [];
abi.forEach(function(method) {
var func = null;
switch (method.type) {
case 'function':
methods.push(method.name);
@ -372,6 +376,7 @@ function Interface(abi) {
})();
break;
}
utils.defineProperty(this, method.name, func);
}, this);
@ -452,12 +457,12 @@ var allowedTransactionKeys = {
data: true, from: true, gasLimit: true, gasPrice:true, to: true, value: true
}
function Contract(web3, wallet, contractAddress, interface) {
function Contract(web3, wallet, contractAddress, contractInterface) {
utils.defineProperty(this, 'web3', web3);
utils.defineProperty(this, 'wallet', wallet);
utils.defineProperty(this, 'contractAddress', contractAddress);
utils.defineProperty(this, 'interface', interface);
utils.defineProperty(this, 'interface', contractInterface);
function getWeb3Promise(method) {
var params = Array.prototype.slice.call(arguments, 1);
@ -522,7 +527,7 @@ function Contract(web3, wallet, contractAddress, interface) {
var transaction = {}
var params = Array.prototype.slice.call(arguments);
if (params.length == interface[method].inputs.length + 1) {
if (params.length == contractInterface[method].inputs.length + 1) {
transaction = params.pop();
if (typeof(transaction) !== 'object') {
throw new Error('invalid transaction overrides');
@ -534,7 +539,7 @@ function Contract(web3, wallet, contractAddress, interface) {
}
}
var call = interface[method].apply(interface, params);
var call = contractInterface[method].apply(contractInterface, params);
switch (call.type) {
case 'call':
['data', 'gasLimit', 'gasPrice', 'to', 'value'].forEach(function(key) {
@ -605,12 +610,12 @@ function Contract(web3, wallet, contractAddress, interface) {
};
}
interface.methods.forEach(function(method) {
contractInterface.methods.forEach(function(method) {
utils.defineProperty(this, method, runMethod(method));
}, this);
interface.events.forEach(function(method) {
var call = interface[method].apply(interface, []);
contractInterface.events.forEach(function(method) {
var call = contractInterface[method].apply(contractInterface, []);
Object.defineProperty(self, 'on' + call.name.toLowerCase(), {
enumerable: true,
get: function() {

@ -1,3 +1,5 @@
'use strict';
var aes = require('aes-js');
var pbkdf2 = require('pbkdf2');
var scrypt = require('scrypt-js');

@ -1,3 +1,5 @@
'use strict';
var elliptic = require('elliptic');
var utils = require('./utils.js');
@ -89,7 +91,7 @@ var ibanChecksum = (function() {
expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
}
checksum = String(98 - (parseInt(expanded, 10) % 97));
var checksum = String(98 - (parseInt(expanded, 10) % 97));
while (checksum.length < 2) { checksum = '0' + checksum; }
return checksum;

@ -1,3 +1,4 @@
'use strict';
var BN = require('../node_modules/elliptic/node_modules/bn.js/lib/bn.js');
var hash = require('../node_modules/elliptic/node_modules/hash.js/lib/hash.js');

@ -1,3 +1,5 @@
'use strict';
var rlp = require('rlp');
var Contract = require('./contract.js');