mirror of https://github.com/status-im/web3.js.git
fixed timeout issue
This commit is contained in:
parent
bc45b70e96
commit
dc12e9b6cb
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "web3",
|
||||
"namespace": "ethereum",
|
||||
"version": "0.15.1",
|
||||
"version": "0.15.2",
|
||||
"description": "Ethereum Compatible JavaScript API",
|
||||
"main": [
|
||||
"./dist/web3.js",
|
||||
|
|
|
@ -2405,7 +2405,7 @@ module.exports = {
|
|||
|
||||
},{"bignumber.js":"bignumber.js","utf8":83}],21:[function(require,module,exports){
|
||||
module.exports={
|
||||
"version": "0.15.1"
|
||||
"version": "0.15.2"
|
||||
}
|
||||
|
||||
},{}],22:[function(require,module,exports){
|
||||
|
@ -2723,7 +2723,7 @@ module.exports = Batch;
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
/**
|
||||
* @file contract.js
|
||||
* @author Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2014
|
||||
|
@ -2785,7 +2785,7 @@ var addEventsToContract = function (contract) {
|
|||
|
||||
var All = new AllEvents(contract._eth._requestManager, events, contract.address);
|
||||
All.attachToContract(contract);
|
||||
|
||||
|
||||
events.map(function (json) {
|
||||
return new SolidityEvent(contract._eth._requestManager, json, contract.address);
|
||||
}).forEach(function (e) {
|
||||
|
@ -2813,7 +2813,7 @@ var checkForContractAddress = function(contract, callback){
|
|||
|
||||
// stop watching after 50 blocks (timeout)
|
||||
if (count > 50) {
|
||||
|
||||
|
||||
filter.stopWatching();
|
||||
callbackFired = true;
|
||||
|
||||
|
@ -2833,7 +2833,7 @@ var checkForContractAddress = function(contract, callback){
|
|||
|
||||
if(callbackFired || !code)
|
||||
return;
|
||||
|
||||
|
||||
filter.stopWatching();
|
||||
callbackFired = true;
|
||||
|
||||
|
@ -2875,6 +2875,62 @@ var ContractFactory = function (eth, abi) {
|
|||
this.eth = eth;
|
||||
this.abi = abi;
|
||||
|
||||
/**
|
||||
* Should be called to create new contract on a blockchain
|
||||
*
|
||||
* @method new
|
||||
* @param {Any} contract constructor param1 (optional)
|
||||
* @param {Any} contract constructor param2 (optional)
|
||||
* @param {Object} contract transaction object (required)
|
||||
* @param {Function} callback
|
||||
* @returns {Contract} returns contract instance
|
||||
*/
|
||||
this.new = function () {
|
||||
var contract = new Contract(this.eth, this.abi);
|
||||
|
||||
// parse arguments
|
||||
var options = {}; // required!
|
||||
var callback;
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (utils.isFunction(args[args.length - 1])) {
|
||||
callback = args.pop();
|
||||
}
|
||||
|
||||
var last = args[args.length - 1];
|
||||
if (utils.isObject(last) && !utils.isArray(last)) {
|
||||
options = args.pop();
|
||||
}
|
||||
|
||||
var bytes = encodeConstructorParams(this.abi, args);
|
||||
options.data += bytes;
|
||||
|
||||
if (callback) {
|
||||
|
||||
// wait for the contract address adn check if the code was deployed
|
||||
this.eth.sendTransaction(options, function (err, hash) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
|
||||
// call callback for the first time
|
||||
callback(null, contract);
|
||||
|
||||
checkForContractAddress(contract, callback);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var hash = this.eth.sendTransaction(options);
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
checkForContractAddress(contract);
|
||||
}
|
||||
|
||||
return contract;
|
||||
};
|
||||
|
||||
this.new.getData = this.getData.bind(this);
|
||||
};
|
||||
|
||||
|
@ -2889,61 +2945,7 @@ var ContractFactory = function (eth, abi) {
|
|||
//return new ContractFactory(abi);
|
||||
//};
|
||||
|
||||
/**
|
||||
* Should be called to create new contract on a blockchain
|
||||
*
|
||||
* @method new
|
||||
* @param {Any} contract constructor param1 (optional)
|
||||
* @param {Any} contract constructor param2 (optional)
|
||||
* @param {Object} contract transaction object (required)
|
||||
* @param {Function} callback
|
||||
* @returns {Contract} returns contract instance
|
||||
*/
|
||||
ContractFactory.prototype.new = function () {
|
||||
var contract = new Contract(this.eth, this.abi);
|
||||
|
||||
// parse arguments
|
||||
var options = {}; // required!
|
||||
var callback;
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (utils.isFunction(args[args.length - 1])) {
|
||||
callback = args.pop();
|
||||
}
|
||||
|
||||
var last = args[args.length - 1];
|
||||
if (utils.isObject(last) && !utils.isArray(last)) {
|
||||
options = args.pop();
|
||||
}
|
||||
|
||||
var bytes = encodeConstructorParams(this.abi, args);
|
||||
options.data += bytes;
|
||||
|
||||
if (callback) {
|
||||
|
||||
// wait for the contract address adn check if the code was deployed
|
||||
this.eth.sendTransaction(options, function (err, hash) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
|
||||
// call callback for the first time
|
||||
callback(null, contract);
|
||||
|
||||
checkForContractAddress(contract, callback);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var hash = this.eth.sendTransaction(options);
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
checkForContractAddress(contract);
|
||||
}
|
||||
|
||||
return contract;
|
||||
};
|
||||
|
||||
/**
|
||||
* Should be called to get access to existing contract on a blockchain
|
||||
|
@ -2957,14 +2959,14 @@ ContractFactory.prototype.new = function () {
|
|||
ContractFactory.prototype.at = function (address, callback) {
|
||||
var contract = new Contract(this.eth, this.abi, address);
|
||||
|
||||
// this functions are not part of prototype,
|
||||
// this functions are not part of prototype,
|
||||
// because we dont want to spoil the interface
|
||||
addFunctionsToContract(contract);
|
||||
addEventsToContract(contract);
|
||||
|
||||
|
||||
if (callback) {
|
||||
callback(null, contract);
|
||||
}
|
||||
}
|
||||
return contract;
|
||||
};
|
||||
|
||||
|
@ -3004,7 +3006,6 @@ var Contract = function (eth, abi, address) {
|
|||
|
||||
module.exports = ContractFactory;
|
||||
|
||||
|
||||
},{"../solidity/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of web3.js.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2405,7 +2405,7 @@ module.exports = {
|
|||
|
||||
},{"bignumber.js":"bignumber.js","utf8":83}],21:[function(require,module,exports){
|
||||
module.exports={
|
||||
"version": "0.15.1"
|
||||
"version": "0.15.2"
|
||||
}
|
||||
|
||||
},{}],22:[function(require,module,exports){
|
||||
|
@ -2723,7 +2723,7 @@ module.exports = Batch;
|
|||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
/**
|
||||
* @file contract.js
|
||||
* @author Marek Kotewicz <marek@ethdev.com>
|
||||
* @date 2014
|
||||
|
@ -2785,7 +2785,7 @@ var addEventsToContract = function (contract) {
|
|||
|
||||
var All = new AllEvents(contract._eth._requestManager, events, contract.address);
|
||||
All.attachToContract(contract);
|
||||
|
||||
|
||||
events.map(function (json) {
|
||||
return new SolidityEvent(contract._eth._requestManager, json, contract.address);
|
||||
}).forEach(function (e) {
|
||||
|
@ -2813,7 +2813,7 @@ var checkForContractAddress = function(contract, callback){
|
|||
|
||||
// stop watching after 50 blocks (timeout)
|
||||
if (count > 50) {
|
||||
|
||||
|
||||
filter.stopWatching();
|
||||
callbackFired = true;
|
||||
|
||||
|
@ -2833,7 +2833,7 @@ var checkForContractAddress = function(contract, callback){
|
|||
|
||||
if(callbackFired || !code)
|
||||
return;
|
||||
|
||||
|
||||
filter.stopWatching();
|
||||
callbackFired = true;
|
||||
|
||||
|
@ -2875,6 +2875,62 @@ var ContractFactory = function (eth, abi) {
|
|||
this.eth = eth;
|
||||
this.abi = abi;
|
||||
|
||||
/**
|
||||
* Should be called to create new contract on a blockchain
|
||||
*
|
||||
* @method new
|
||||
* @param {Any} contract constructor param1 (optional)
|
||||
* @param {Any} contract constructor param2 (optional)
|
||||
* @param {Object} contract transaction object (required)
|
||||
* @param {Function} callback
|
||||
* @returns {Contract} returns contract instance
|
||||
*/
|
||||
this.new = function () {
|
||||
var contract = new Contract(this.eth, this.abi);
|
||||
|
||||
// parse arguments
|
||||
var options = {}; // required!
|
||||
var callback;
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (utils.isFunction(args[args.length - 1])) {
|
||||
callback = args.pop();
|
||||
}
|
||||
|
||||
var last = args[args.length - 1];
|
||||
if (utils.isObject(last) && !utils.isArray(last)) {
|
||||
options = args.pop();
|
||||
}
|
||||
|
||||
var bytes = encodeConstructorParams(this.abi, args);
|
||||
options.data += bytes;
|
||||
|
||||
if (callback) {
|
||||
|
||||
// wait for the contract address adn check if the code was deployed
|
||||
this.eth.sendTransaction(options, function (err, hash) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
|
||||
// call callback for the first time
|
||||
callback(null, contract);
|
||||
|
||||
checkForContractAddress(contract, callback);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var hash = this.eth.sendTransaction(options);
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
checkForContractAddress(contract);
|
||||
}
|
||||
|
||||
return contract;
|
||||
};
|
||||
|
||||
this.new.getData = this.getData.bind(this);
|
||||
};
|
||||
|
||||
|
@ -2889,61 +2945,7 @@ var ContractFactory = function (eth, abi) {
|
|||
//return new ContractFactory(abi);
|
||||
//};
|
||||
|
||||
/**
|
||||
* Should be called to create new contract on a blockchain
|
||||
*
|
||||
* @method new
|
||||
* @param {Any} contract constructor param1 (optional)
|
||||
* @param {Any} contract constructor param2 (optional)
|
||||
* @param {Object} contract transaction object (required)
|
||||
* @param {Function} callback
|
||||
* @returns {Contract} returns contract instance
|
||||
*/
|
||||
ContractFactory.prototype.new = function () {
|
||||
var contract = new Contract(this.eth, this.abi);
|
||||
|
||||
// parse arguments
|
||||
var options = {}; // required!
|
||||
var callback;
|
||||
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (utils.isFunction(args[args.length - 1])) {
|
||||
callback = args.pop();
|
||||
}
|
||||
|
||||
var last = args[args.length - 1];
|
||||
if (utils.isObject(last) && !utils.isArray(last)) {
|
||||
options = args.pop();
|
||||
}
|
||||
|
||||
var bytes = encodeConstructorParams(this.abi, args);
|
||||
options.data += bytes;
|
||||
|
||||
if (callback) {
|
||||
|
||||
// wait for the contract address adn check if the code was deployed
|
||||
this.eth.sendTransaction(options, function (err, hash) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
|
||||
// call callback for the first time
|
||||
callback(null, contract);
|
||||
|
||||
checkForContractAddress(contract, callback);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var hash = this.eth.sendTransaction(options);
|
||||
// add the transaction hash
|
||||
contract.transactionHash = hash;
|
||||
checkForContractAddress(contract);
|
||||
}
|
||||
|
||||
return contract;
|
||||
};
|
||||
|
||||
/**
|
||||
* Should be called to get access to existing contract on a blockchain
|
||||
|
@ -2957,14 +2959,14 @@ ContractFactory.prototype.new = function () {
|
|||
ContractFactory.prototype.at = function (address, callback) {
|
||||
var contract = new Contract(this.eth, this.abi, address);
|
||||
|
||||
// this functions are not part of prototype,
|
||||
// this functions are not part of prototype,
|
||||
// because we dont want to spoil the interface
|
||||
addFunctionsToContract(contract);
|
||||
addEventsToContract(contract);
|
||||
|
||||
|
||||
if (callback) {
|
||||
callback(null, contract);
|
||||
}
|
||||
}
|
||||
return contract;
|
||||
};
|
||||
|
||||
|
@ -3004,7 +3006,6 @@ var Contract = function (eth, abi, address) {
|
|||
|
||||
module.exports = ContractFactory;
|
||||
|
||||
|
||||
},{"../solidity/coder":7,"../utils/utils":20,"./allevents":23,"./event":27,"./function":31}],26:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of web3.js.
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "0.15.1"
|
||||
"version": "0.15.2"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* jshint ignore:start */
|
||||
Package.describe({
|
||||
name: 'ethereum:web3',
|
||||
version: '0.15.1',
|
||||
version: '0.15.2',
|
||||
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC',
|
||||
git: 'https://github.com/ethereum/ethereum.js',
|
||||
// By default, Meteor will default to using README.md for documentation.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "web3",
|
||||
"namespace": "ethereum",
|
||||
"version": "0.15.1",
|
||||
"version": "0.15.2",
|
||||
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC",
|
||||
"main": "./index.js",
|
||||
"directories": {
|
||||
|
|
Loading…
Reference in New Issue