web3
Advanced tools
Comparing version 0.15.1 to 0.15.2
{ | ||
"name": "web3", | ||
"namespace": "ethereum", | ||
"version": "0.15.1", | ||
"version": "0.15.2", | ||
"description": "Ethereum Compatible JavaScript API", | ||
@@ -6,0 +6,0 @@ "main": [ |
@@ -140,3 +140,3 @@ /* | ||
/** | ||
* Should be called to get hex representation (prefixed by 0x) of utf8 string | ||
* Should be called to get hex representation (prefixed by 0x) of utf8 a string | ||
* | ||
@@ -143,0 +143,0 @@ * @method fromUtf8 |
{ | ||
"version": "0.15.1" | ||
"version": "0.15.2" | ||
} |
@@ -17,3 +17,3 @@ /* | ||
*/ | ||
/** | ||
/** | ||
* @file contract.js | ||
@@ -80,3 +80,3 @@ * @author Marek Kotewicz <marek@ethdev.com> | ||
All.attachToContract(contract); | ||
events.map(function (json) { | ||
@@ -109,3 +109,3 @@ return new SolidityEvent(contract._eth._requestManager, json, contract.address); | ||
if (count > 50) { | ||
filter.stopWatching(); | ||
@@ -130,3 +130,3 @@ callbackFired = true; | ||
return; | ||
filter.stopWatching(); | ||
@@ -173,2 +173,58 @@ callbackFired = true; | ||
/** | ||
* 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); | ||
@@ -188,58 +244,4 @@ }; | ||
/** | ||
* 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; | ||
}; | ||
/** | ||
@@ -257,10 +259,10 @@ * Should be called to get access to existing contract on a blockchain | ||
// 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; | ||
@@ -304,2 +306,1 @@ }; | ||
module.exports = ContractFactory; | ||
@@ -56,3 +56,3 @@ /* | ||
return options; | ||
} | ||
} | ||
@@ -67,10 +67,10 @@ options = options || {}; | ||
// lazy load | ||
return { | ||
topics: options.topics, | ||
from: options.from, | ||
to: options.to, | ||
address: options.address, | ||
fromBlock: formatters.inputBlockNumberFormatter(options.fromBlock), | ||
toBlock: formatters.inputBlockNumberFormatter(options.toBlock) | ||
}; | ||
toBlock: formatters.inputBlockNumberFormatter(options.toBlock) | ||
}; | ||
}; | ||
@@ -83,3 +83,3 @@ | ||
@param {Object} self | ||
@param {funciton} | ||
@param {funciton} | ||
*/ | ||
@@ -174,3 +174,3 @@ var getLogsAtStart = function(self, callback){ | ||
// start to watch immediately | ||
if(callback) { | ||
if(typeof callback === 'function') { | ||
return self.watch(callback); | ||
@@ -177,0 +177,0 @@ } |
@@ -212,3 +212,3 @@ /* | ||
post.payload = utils.toHex(post.payload); | ||
// post.payload = utils.toHex(post.payload); | ||
post.ttl = utils.fromDecimal(post.ttl); | ||
@@ -225,3 +225,4 @@ post.workToProve = utils.fromDecimal(post.workToProve); | ||
post.topics = post.topics.map(function(topic){ | ||
return utils.fromUtf8(topic); | ||
// convert only if not hex | ||
return (topic.indexOf('0x') === 0) ? topic : utils.fromUtf8(topic); | ||
}); | ||
@@ -245,8 +246,8 @@ | ||
post.workProved = utils.toDecimal(post.workProved); | ||
post.payloadRaw = post.payload; | ||
post.payload = utils.toUtf8(post.payload); | ||
// post.payloadRaw = post.payload; | ||
// post.payload = utils.toAscii(post.payload); | ||
if (utils.isJson(post.payload)) { | ||
post.payload = JSON.parse(post.payload); | ||
} | ||
// if (utils.isJson(post.payload)) { | ||
// post.payload = JSON.parse(post.payload); | ||
// } | ||
@@ -258,3 +259,3 @@ // format the following options | ||
post.topics = post.topics.map(function(topic){ | ||
return utils.toUtf8(topic); | ||
return utils.toAscii(topic); | ||
}); | ||
@@ -261,0 +262,0 @@ |
@@ -109,3 +109,3 @@ /* | ||
_this.lastChunkTimeout = setTimeout(function(){ | ||
_this.timeout(); | ||
_this._timeout(); | ||
throw errors.InvalidResponse(data); | ||
@@ -112,0 +112,0 @@ }, 1000 * 15); |
@@ -205,2 +205,9 @@ /* | ||
var sign = new Method({ | ||
name: 'sign', | ||
call: 'eth_sign', | ||
params: 2, | ||
inputFormatter: [formatters.inputAddressFormatter, null] | ||
}); | ||
var call = new Method({ | ||
@@ -268,2 +275,3 @@ name: 'call', | ||
sendTransaction, | ||
sign, | ||
compileSolidity, | ||
@@ -270,0 +278,0 @@ compileLLL, |
@@ -84,3 +84,4 @@ /* | ||
var proto = { | ||
get: this.buildGet() | ||
get: this.buildGet(), | ||
enumerable: true | ||
}; | ||
@@ -87,0 +88,0 @@ |
/* 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', | ||
@@ -6,0 +6,0 @@ git: 'https://github.com/ethereum/ethereum.js', |
{ | ||
"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", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
@@ -24,3 +24,3 @@ # Migration 0.13.0 -> 0.14.0 | ||
You need to run a local ethrereum node to use this library. | ||
You need to run a local Ethereum node to use this library. | ||
@@ -27,0 +27,0 @@ [Documentation](https://github.com/ethereum/wiki/wiki/JavaScript-API) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
3973801
225
45325