fixed contract deploy

This commit is contained in:
Fabian Vogelsteller 2015-07-07 19:46:26 +02:00
parent dbb976acf4
commit 3b941cfd43
10 changed files with 42 additions and 129 deletions

26
dist/web3-light.js vendored
View File

@ -1605,9 +1605,9 @@ var utils = require('../utils/utils');
var Filter = require('./filter');
var watches = require('./watches');
var AllSolidityEvents = function (json, address) {
var AllSolidityEvents = function (json, contract) {
this._json = json;
this._address = address;
this._contract = contract;
};
AllSolidityEvents.prototype.encode = function (options) {
@ -1621,7 +1621,7 @@ AllSolidityEvents.prototype.encode = function (options) {
});
result.topics = [null, null, null, null, null]; // match all topics
result.address = this._address;
result.address = this._contract.address;
return result;
};
@ -1640,7 +1640,7 @@ AllSolidityEvents.prototype.decode = function (data) {
return data;
}
var event = new SolidityEvent(match, this._address);
var event = new SolidityEvent(match, this._contract);
return event.decode(data);
};
@ -1781,7 +1781,7 @@ var addFunctionsToContract = function (contract, abi) {
abi.filter(function (json) {
return json.type === 'function';
}).map(function (json) {
return new SolidityFunction(json, contract.address);
return new SolidityFunction(json, contract);
}).forEach(function (f) {
f.attachToContract(contract);
});
@ -1799,11 +1799,11 @@ var addEventsToContract = function (contract, abi) {
return json.type === 'event';
});
var All = new AllEvents(events, contract.address);
var All = new AllEvents(events, contract);
All.attachToContract(contract);
events.map(function (json) {
return new SolidityEvent(json, contract.address);
return new SolidityEvent(json, contract);
}).forEach(function (e) {
e.attachToContract(contract);
});
@ -2392,10 +2392,10 @@ var watches = require('./watches');
/**
* This prototype should be used to create event filters
*/
var SolidityEvent = function (json, address) {
var SolidityEvent = function (json, contract) {
this._params = json.inputs;
this._name = utils.transformToFullName(json);
this._address = address;
this._contract = contract;
this._anonymous = json.anonymous;
};
@ -2466,7 +2466,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
result.topics = [];
if (!this._anonymous) {
result.address = this._address;
result.address = this._contract.address;
result.topics.push('0x' + this.signature());
}
@ -3056,7 +3056,7 @@ var sha3 = require('../utils/sha3');
/**
* This prototype should be used to call/sendTransaction to solidity functions
*/
var SolidityFunction = function (json, address) {
var SolidityFunction = function (json, contract) {
this._inputTypes = json.inputs.map(function (i) {
return i.type;
});
@ -3065,7 +3065,7 @@ var SolidityFunction = function (json, address) {
});
this._constant = json.constant;
this._name = utils.transformToFullName(json);
this._address = address;
this._contract = contract;
};
SolidityFunction.prototype.extractCallback = function (args) {
@ -3092,7 +3092,7 @@ SolidityFunction.prototype.toPayload = function (args) {
if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {
options = args[args.length - 1];
}
options.to = this._address;
options.to = this._contract.address;
options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);
return options;
};

File diff suppressed because one or more lines are too long

26
dist/web3.js vendored
View File

@ -1605,9 +1605,9 @@ var utils = require('../utils/utils');
var Filter = require('./filter');
var watches = require('./watches');
var AllSolidityEvents = function (json, address) {
var AllSolidityEvents = function (json, contract) {
this._json = json;
this._address = address;
this._contract = contract;
};
AllSolidityEvents.prototype.encode = function (options) {
@ -1621,7 +1621,7 @@ AllSolidityEvents.prototype.encode = function (options) {
});
result.topics = [null, null, null, null, null]; // match all topics
result.address = this._address;
result.address = this._contract.address;
return result;
};
@ -1640,7 +1640,7 @@ AllSolidityEvents.prototype.decode = function (data) {
return data;
}
var event = new SolidityEvent(match, this._address);
var event = new SolidityEvent(match, this._contract);
return event.decode(data);
};
@ -1781,7 +1781,7 @@ var addFunctionsToContract = function (contract, abi) {
abi.filter(function (json) {
return json.type === 'function';
}).map(function (json) {
return new SolidityFunction(json, contract.address);
return new SolidityFunction(json, contract);
}).forEach(function (f) {
f.attachToContract(contract);
});
@ -1799,11 +1799,11 @@ var addEventsToContract = function (contract, abi) {
return json.type === 'event';
});
var All = new AllEvents(events, contract.address);
var All = new AllEvents(events, contract);
All.attachToContract(contract);
events.map(function (json) {
return new SolidityEvent(json, contract.address);
return new SolidityEvent(json, contract);
}).forEach(function (e) {
e.attachToContract(contract);
});
@ -2392,10 +2392,10 @@ var watches = require('./watches');
/**
* This prototype should be used to create event filters
*/
var SolidityEvent = function (json, address) {
var SolidityEvent = function (json, contract) {
this._params = json.inputs;
this._name = utils.transformToFullName(json);
this._address = address;
this._contract = contract;
this._anonymous = json.anonymous;
};
@ -2466,7 +2466,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
result.topics = [];
if (!this._anonymous) {
result.address = this._address;
result.address = this._contract.address;
result.topics.push('0x' + this.signature());
}
@ -3056,7 +3056,7 @@ var sha3 = require('../utils/sha3');
/**
* This prototype should be used to call/sendTransaction to solidity functions
*/
var SolidityFunction = function (json, address) {
var SolidityFunction = function (json, contract) {
this._inputTypes = json.inputs.map(function (i) {
return i.type;
});
@ -3065,7 +3065,7 @@ var SolidityFunction = function (json, address) {
});
this._constant = json.constant;
this._name = utils.transformToFullName(json);
this._address = address;
this._contract = contract;
};
SolidityFunction.prototype.extractCallback = function (args) {
@ -3092,7 +3092,7 @@ SolidityFunction.prototype.toPayload = function (args) {
if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {
options = args[args.length - 1];
}
options.to = this._address;
options.to = this._contract.address;
options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);
return options;
};

87
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -27,9 +27,9 @@ var utils = require('../utils/utils');
var Filter = require('./filter');
var watches = require('./watches');
var AllSolidityEvents = function (json, address) {
var AllSolidityEvents = function (json, contract) {
this._json = json;
this._address = address;
this._contract = contract;
};
AllSolidityEvents.prototype.encode = function (options) {
@ -43,7 +43,7 @@ AllSolidityEvents.prototype.encode = function (options) {
});
result.topics = [null, null, null, null, null]; // match all topics
result.address = this._address;
result.address = this._contract.address;
return result;
};
@ -62,7 +62,7 @@ AllSolidityEvents.prototype.decode = function (data) {
return data;
}
var event = new SolidityEvent(match, this._address);
var event = new SolidityEvent(match, this._contract);
return event.decode(data);
};

View File

@ -57,7 +57,7 @@ var addFunctionsToContract = function (contract, abi) {
abi.filter(function (json) {
return json.type === 'function';
}).map(function (json) {
return new SolidityFunction(json, contract.address);
return new SolidityFunction(json, contract);
}).forEach(function (f) {
f.attachToContract(contract);
});
@ -75,11 +75,11 @@ var addEventsToContract = function (contract, abi) {
return json.type === 'event';
});
var All = new AllEvents(events, contract.address);
var All = new AllEvents(events, contract);
All.attachToContract(contract);
events.map(function (json) {
return new SolidityEvent(json, contract.address);
return new SolidityEvent(json, contract);
}).forEach(function (e) {
e.attachToContract(contract);
});

View File

@ -30,10 +30,10 @@ var watches = require('./watches');
/**
* This prototype should be used to create event filters
*/
var SolidityEvent = function (json, address) {
var SolidityEvent = function (json, contract) {
this._params = json.inputs;
this._name = utils.transformToFullName(json);
this._address = address;
this._contract = contract;
this._anonymous = json.anonymous;
};
@ -104,7 +104,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
result.topics = [];
if (!this._anonymous) {
result.address = this._address;
result.address = this._contract.address;
result.topics.push('0x' + this.signature());
}

View File

@ -29,7 +29,7 @@ var sha3 = require('../utils/sha3');
/**
* This prototype should be used to call/sendTransaction to solidity functions
*/
var SolidityFunction = function (json, address) {
var SolidityFunction = function (json, contract) {
this._inputTypes = json.inputs.map(function (i) {
return i.type;
});
@ -38,7 +38,7 @@ var SolidityFunction = function (json, address) {
});
this._constant = json.constant;
this._name = utils.transformToFullName(json);
this._address = address;
this._contract = contract;
};
SolidityFunction.prototype.extractCallback = function (args) {
@ -65,7 +65,7 @@ SolidityFunction.prototype.toPayload = function (args) {
if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {
options = args[args.length - 1];
}
options.to = this._address;
options.to = this._contract.address;
options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);
return options;
};

View File

@ -218,7 +218,7 @@ describe('lib/web3/event', function () {
describe('encode', function () {
tests.forEach(function (test, index) {
it('test no: ' + index, function () {
var event = new SolidityEvent(test.abi, address);
var event = new SolidityEvent(test.abi, {address: address});
event.signature = function () { // inject signature
return signature.slice(2);
};