Merge branch 'develop' into encoding

Conflicts:
	dist/web3-light.js.map
	dist/web3-light.min.js
	dist/web3.js.map
	dist/web3.min.js
This commit is contained in:
Marek Kotewicz 2015-05-05 11:38:58 +02:00
commit 8a9c9c56d1
16 changed files with 134 additions and 40 deletions

View File

@ -1,7 +1,7 @@
{
"name": "web3",
"namespace": "ethereum",
"version": "0.3.3",
"version": "0.3.4",
"description": "Ethereum Compatible JavaScript API",
"main": [
"./dist/web3.js",

21
dist/web3-light.js vendored
View File

@ -1383,7 +1383,7 @@ module.exports = {
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
module.exports={
"version": "0.3.3"
"version": "0.3.4"
}
},{}],10:[function(require,module,exports){
@ -1785,7 +1785,7 @@ module.exports = {
/**
* Web3
*
*
* @module web3
*/
@ -1839,16 +1839,16 @@ var uncleCountCall = function (args) {
/// @returns an array of objects describing web3.eth api methods
var getBalance = new Method({
name: 'getBalance',
call: 'eth_getBalance',
name: 'getBalance',
call: 'eth_getBalance',
params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter
});
var getStorageAt = new Method({
name: 'getStorageAt',
call: 'eth_getStorageAt',
name: 'getStorageAt',
call: 'eth_getStorageAt',
params: 3,
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
});
@ -1861,7 +1861,7 @@ var getCode = new Method({
});
var getBlock = new Method({
name: 'getBlock',
name: 'getBlock',
call: blockCall,
params: 2,
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
@ -1986,6 +1986,11 @@ var properties = [
name: 'mining',
getter: 'eth_mining'
}),
new Property({
name: 'hashrate',
getter: 'eth_hashrate',
outputFormatter: utils.toDecimal
}),
new Property({
name: 'gasPrice',
getter: 'eth_gasPrice',
@ -2107,7 +2112,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
['fromBlock', 'toBlock'].filter(function (f) {
return options[f] !== undefined;
}).forEach(function (f) {
result[f] = utils.toHex(options[f]);
result[f] = formatters.inputBlockNumberFormatter(options[f]);
});
result.topics = [];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

21
dist/web3.js vendored
View File

@ -1383,7 +1383,7 @@ module.exports = {
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
module.exports={
"version": "0.3.3"
"version": "0.3.4"
}
},{}],10:[function(require,module,exports){
@ -1785,7 +1785,7 @@ module.exports = {
/**
* Web3
*
*
* @module web3
*/
@ -1839,16 +1839,16 @@ var uncleCountCall = function (args) {
/// @returns an array of objects describing web3.eth api methods
var getBalance = new Method({
name: 'getBalance',
call: 'eth_getBalance',
name: 'getBalance',
call: 'eth_getBalance',
params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter
});
var getStorageAt = new Method({
name: 'getStorageAt',
call: 'eth_getStorageAt',
name: 'getStorageAt',
call: 'eth_getStorageAt',
params: 3,
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
});
@ -1861,7 +1861,7 @@ var getCode = new Method({
});
var getBlock = new Method({
name: 'getBlock',
name: 'getBlock',
call: blockCall,
params: 2,
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
@ -1986,6 +1986,11 @@ var properties = [
name: 'mining',
getter: 'eth_mining'
}),
new Property({
name: 'hashrate',
getter: 'eth_hashrate',
outputFormatter: utils.toDecimal
}),
new Property({
name: 'gasPrice',
getter: 'eth_gasPrice',
@ -2107,7 +2112,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
['fromBlock', 'toBlock'].filter(function (f) {
return options[f] !== undefined;
}).forEach(function (f) {
result[f] = utils.toHex(options[f]);
result[f] = formatters.inputBlockNumberFormatter(options[f]);
});
result.topics = [];

8
dist/web3.js.map vendored

File diff suppressed because one or more lines are too long

4
dist/web3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -45,7 +45,7 @@
var contract;
var update = function (err, x) {
document.getElementById('result').innerText = JSON.stringify(x, null, 2);
document.getElementById('result').textContent = JSON.stringify(x, null, 2);
};
var createContract = function () {

View File

@ -1,3 +1,3 @@
{
"version": "0.3.3"
"version": "0.3.4"
}

View File

@ -23,7 +23,7 @@
/**
* Web3
*
*
* @module web3
*/
@ -77,16 +77,16 @@ var uncleCountCall = function (args) {
/// @returns an array of objects describing web3.eth api methods
var getBalance = new Method({
name: 'getBalance',
call: 'eth_getBalance',
name: 'getBalance',
call: 'eth_getBalance',
params: 2,
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
outputFormatter: formatters.outputBigNumberFormatter
});
var getStorageAt = new Method({
name: 'getStorageAt',
call: 'eth_getStorageAt',
name: 'getStorageAt',
call: 'eth_getStorageAt',
params: 3,
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
});
@ -99,7 +99,7 @@ var getCode = new Method({
});
var getBlock = new Method({
name: 'getBlock',
name: 'getBlock',
call: blockCall,
params: 2,
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
@ -224,6 +224,11 @@ var properties = [
name: 'mining',
getter: 'eth_mining'
}),
new Property({
name: 'hashrate',
getter: 'eth_hashrate',
outputFormatter: utils.toDecimal
}),
new Property({
name: 'gasPrice',
getter: 'eth_gasPrice',

View File

@ -96,7 +96,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
['fromBlock', 'toBlock'].filter(function (f) {
return options[f] !== undefined;
}).forEach(function (f) {
result[f] = utils.toHex(options[f]);
result[f] = formatters.inputBlockNumberFormatter(options[f]);
});
result.topics = [];

View File

@ -1,7 +1,7 @@
/* jshint ignore:start */
Package.describe({
name: 'ethereum:web3',
version: '0.3.3',
version: '0.3.4',
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.

View File

@ -1,7 +1,7 @@
{
"name": "web3",
"namespace": "ethereum",
"version": "0.3.3",
"version": "0.3.4",
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC",
"main": "./index.js",
"directories": {

View File

@ -119,6 +119,32 @@ var tests = [{
]
}
}, {
abi: {
name: 'event1',
inputs: [{
type: 'int',
name: 'a',
indexed: true
}]
},
indexed: {
a: 1
},
options: {
fromBlock: 'latest',
toBlock: 'pending'
},
expected: {
address: address,
fromBlock: 'latest',
toBlock: 'pending',
topics: [
signature,
'0x0000000000000000000000000000000000000000000000000000000000000001'
]
}
},
{
abi: {
name: 'event1',
inputs: [{

View File

@ -21,6 +21,21 @@ var tests = [{
result: '0xf',
formattedResult: '0xf',
call: 'eth_newFilter'
},{
args: [{
fromBlock: 'latest',
toBlock: 'latest',
address: '0x47d33b27bb249a2dbab4c0612bf9caf4c1950855'
}],
formattedArgs: [{
fromBlock: 'latest',
toBlock: 'latest',
address: '0x47d33b27bb249a2dbab4c0612bf9caf4c1950855',
topics: []
}],
result: '0xf',
formattedResult: '0xf',
call: 'eth_newFilter'
},{
args: ['pending'],
formattedArgs: ['pending'],

38
test/web3.eth.hashRate.js Normal file
View File

@ -0,0 +1,38 @@
var chai = require('chai');
var assert = chai.assert;
var web3 = require('../index');
var FakeHttpProvider = require('./helpers/FakeHttpProvider');
var method = 'hashrate';
var tests = [{
result: '0x788a8',
formattedResult: 493736,
call: 'eth_'+ method
}];
describe('web3.eth', function () {
describe(method, function () {
tests.forEach(function (test, index) {
it('property test: ' + index, function () {
// given
var provider = new FakeHttpProvider();
web3.setProvider(provider);
provider.injectResult(test.result);
provider.injectValidation(function (payload) {
assert.equal(payload.jsonrpc, '2.0');
assert.equal(payload.method, test.call);
assert.deepEqual(payload.params, []);
});
// when
var result = web3.eth[method];
// then
assert.strictEqual(test.formattedResult, result);
});
});
});
});