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:
commit
8a9c9c56d1
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "web3",
|
"name": "web3",
|
||||||
"namespace": "ethereum",
|
"namespace": "ethereum",
|
||||||
"version": "0.3.3",
|
"version": "0.3.4",
|
||||||
"description": "Ethereum Compatible JavaScript API",
|
"description": "Ethereum Compatible JavaScript API",
|
||||||
"main": [
|
"main": [
|
||||||
"./dist/web3.js",
|
"./dist/web3.js",
|
||||||
|
|
|
@ -1383,7 +1383,7 @@ module.exports = {
|
||||||
|
|
||||||
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
|
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
|
||||||
module.exports={
|
module.exports={
|
||||||
"version": "0.3.3"
|
"version": "0.3.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
},{}],10:[function(require,module,exports){
|
},{}],10:[function(require,module,exports){
|
||||||
|
@ -1785,7 +1785,7 @@ module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web3
|
* Web3
|
||||||
*
|
*
|
||||||
* @module web3
|
* @module web3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1839,16 +1839,16 @@ var uncleCountCall = function (args) {
|
||||||
/// @returns an array of objects describing web3.eth api methods
|
/// @returns an array of objects describing web3.eth api methods
|
||||||
|
|
||||||
var getBalance = new Method({
|
var getBalance = new Method({
|
||||||
name: 'getBalance',
|
name: 'getBalance',
|
||||||
call: 'eth_getBalance',
|
call: 'eth_getBalance',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
||||||
outputFormatter: formatters.outputBigNumberFormatter
|
outputFormatter: formatters.outputBigNumberFormatter
|
||||||
});
|
});
|
||||||
|
|
||||||
var getStorageAt = new Method({
|
var getStorageAt = new Method({
|
||||||
name: 'getStorageAt',
|
name: 'getStorageAt',
|
||||||
call: 'eth_getStorageAt',
|
call: 'eth_getStorageAt',
|
||||||
params: 3,
|
params: 3,
|
||||||
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
@ -1861,7 +1861,7 @@ var getCode = new Method({
|
||||||
});
|
});
|
||||||
|
|
||||||
var getBlock = new Method({
|
var getBlock = new Method({
|
||||||
name: 'getBlock',
|
name: 'getBlock',
|
||||||
call: blockCall,
|
call: blockCall,
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
|
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
|
||||||
|
@ -1986,6 +1986,11 @@ var properties = [
|
||||||
name: 'mining',
|
name: 'mining',
|
||||||
getter: 'eth_mining'
|
getter: 'eth_mining'
|
||||||
}),
|
}),
|
||||||
|
new Property({
|
||||||
|
name: 'hashrate',
|
||||||
|
getter: 'eth_hashrate',
|
||||||
|
outputFormatter: utils.toDecimal
|
||||||
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'gasPrice',
|
name: 'gasPrice',
|
||||||
getter: 'eth_gasPrice',
|
getter: 'eth_gasPrice',
|
||||||
|
@ -2107,7 +2112,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
|
||||||
['fromBlock', 'toBlock'].filter(function (f) {
|
['fromBlock', 'toBlock'].filter(function (f) {
|
||||||
return options[f] !== undefined;
|
return options[f] !== undefined;
|
||||||
}).forEach(function (f) {
|
}).forEach(function (f) {
|
||||||
result[f] = utils.toHex(options[f]);
|
result[f] = formatters.inputBlockNumberFormatter(options[f]);
|
||||||
});
|
});
|
||||||
|
|
||||||
result.topics = [];
|
result.topics = [];
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1383,7 +1383,7 @@ module.exports = {
|
||||||
|
|
||||||
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
|
},{"bignumber.js":"bignumber.js"}],9:[function(require,module,exports){
|
||||||
module.exports={
|
module.exports={
|
||||||
"version": "0.3.3"
|
"version": "0.3.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
},{}],10:[function(require,module,exports){
|
},{}],10:[function(require,module,exports){
|
||||||
|
@ -1785,7 +1785,7 @@ module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web3
|
* Web3
|
||||||
*
|
*
|
||||||
* @module web3
|
* @module web3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1839,16 +1839,16 @@ var uncleCountCall = function (args) {
|
||||||
/// @returns an array of objects describing web3.eth api methods
|
/// @returns an array of objects describing web3.eth api methods
|
||||||
|
|
||||||
var getBalance = new Method({
|
var getBalance = new Method({
|
||||||
name: 'getBalance',
|
name: 'getBalance',
|
||||||
call: 'eth_getBalance',
|
call: 'eth_getBalance',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
||||||
outputFormatter: formatters.outputBigNumberFormatter
|
outputFormatter: formatters.outputBigNumberFormatter
|
||||||
});
|
});
|
||||||
|
|
||||||
var getStorageAt = new Method({
|
var getStorageAt = new Method({
|
||||||
name: 'getStorageAt',
|
name: 'getStorageAt',
|
||||||
call: 'eth_getStorageAt',
|
call: 'eth_getStorageAt',
|
||||||
params: 3,
|
params: 3,
|
||||||
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
@ -1861,7 +1861,7 @@ var getCode = new Method({
|
||||||
});
|
});
|
||||||
|
|
||||||
var getBlock = new Method({
|
var getBlock = new Method({
|
||||||
name: 'getBlock',
|
name: 'getBlock',
|
||||||
call: blockCall,
|
call: blockCall,
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
|
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
|
||||||
|
@ -1986,6 +1986,11 @@ var properties = [
|
||||||
name: 'mining',
|
name: 'mining',
|
||||||
getter: 'eth_mining'
|
getter: 'eth_mining'
|
||||||
}),
|
}),
|
||||||
|
new Property({
|
||||||
|
name: 'hashrate',
|
||||||
|
getter: 'eth_hashrate',
|
||||||
|
outputFormatter: utils.toDecimal
|
||||||
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'gasPrice',
|
name: 'gasPrice',
|
||||||
getter: 'eth_gasPrice',
|
getter: 'eth_gasPrice',
|
||||||
|
@ -2107,7 +2112,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
|
||||||
['fromBlock', 'toBlock'].filter(function (f) {
|
['fromBlock', 'toBlock'].filter(function (f) {
|
||||||
return options[f] !== undefined;
|
return options[f] !== undefined;
|
||||||
}).forEach(function (f) {
|
}).forEach(function (f) {
|
||||||
result[f] = utils.toHex(options[f]);
|
result[f] = formatters.inputBlockNumberFormatter(options[f]);
|
||||||
});
|
});
|
||||||
|
|
||||||
result.topics = [];
|
result.topics = [];
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -45,7 +45,7 @@
|
||||||
var contract;
|
var contract;
|
||||||
|
|
||||||
var update = function (err, x) {
|
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 () {
|
var createContract = function () {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"version": "0.3.3"
|
"version": "0.3.4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web3
|
* Web3
|
||||||
*
|
*
|
||||||
* @module web3
|
* @module web3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -77,16 +77,16 @@ var uncleCountCall = function (args) {
|
||||||
/// @returns an array of objects describing web3.eth api methods
|
/// @returns an array of objects describing web3.eth api methods
|
||||||
|
|
||||||
var getBalance = new Method({
|
var getBalance = new Method({
|
||||||
name: 'getBalance',
|
name: 'getBalance',
|
||||||
call: 'eth_getBalance',
|
call: 'eth_getBalance',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],
|
||||||
outputFormatter: formatters.outputBigNumberFormatter
|
outputFormatter: formatters.outputBigNumberFormatter
|
||||||
});
|
});
|
||||||
|
|
||||||
var getStorageAt = new Method({
|
var getStorageAt = new Method({
|
||||||
name: 'getStorageAt',
|
name: 'getStorageAt',
|
||||||
call: 'eth_getStorageAt',
|
call: 'eth_getStorageAt',
|
||||||
params: 3,
|
params: 3,
|
||||||
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
@ -99,7 +99,7 @@ var getCode = new Method({
|
||||||
});
|
});
|
||||||
|
|
||||||
var getBlock = new Method({
|
var getBlock = new Method({
|
||||||
name: 'getBlock',
|
name: 'getBlock',
|
||||||
call: blockCall,
|
call: blockCall,
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
|
inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],
|
||||||
|
@ -224,6 +224,11 @@ var properties = [
|
||||||
name: 'mining',
|
name: 'mining',
|
||||||
getter: 'eth_mining'
|
getter: 'eth_mining'
|
||||||
}),
|
}),
|
||||||
|
new Property({
|
||||||
|
name: 'hashrate',
|
||||||
|
getter: 'eth_hashrate',
|
||||||
|
outputFormatter: utils.toDecimal
|
||||||
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'gasPrice',
|
name: 'gasPrice',
|
||||||
getter: 'eth_gasPrice',
|
getter: 'eth_gasPrice',
|
||||||
|
|
|
@ -96,7 +96,7 @@ SolidityEvent.prototype.encode = function (indexed, options) {
|
||||||
['fromBlock', 'toBlock'].filter(function (f) {
|
['fromBlock', 'toBlock'].filter(function (f) {
|
||||||
return options[f] !== undefined;
|
return options[f] !== undefined;
|
||||||
}).forEach(function (f) {
|
}).forEach(function (f) {
|
||||||
result[f] = utils.toHex(options[f]);
|
result[f] = formatters.inputBlockNumberFormatter(options[f]);
|
||||||
});
|
});
|
||||||
|
|
||||||
result.topics = [];
|
result.topics = [];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* jshint ignore:start */
|
/* jshint ignore:start */
|
||||||
Package.describe({
|
Package.describe({
|
||||||
name: 'ethereum:web3',
|
name: 'ethereum:web3',
|
||||||
version: '0.3.3',
|
version: '0.3.4',
|
||||||
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC',
|
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC',
|
||||||
git: 'https://github.com/ethereum/ethereum.js',
|
git: 'https://github.com/ethereum/ethereum.js',
|
||||||
// By default, Meteor will default to using README.md for documentation.
|
// By default, Meteor will default to using README.md for documentation.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "web3",
|
"name": "web3",
|
||||||
"namespace": "ethereum",
|
"namespace": "ethereum",
|
||||||
"version": "0.3.3",
|
"version": "0.3.4",
|
||||||
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC",
|
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
|
@ -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: {
|
abi: {
|
||||||
name: 'event1',
|
name: 'event1',
|
||||||
inputs: [{
|
inputs: [{
|
||||||
|
|
|
@ -21,6 +21,21 @@ var tests = [{
|
||||||
result: '0xf',
|
result: '0xf',
|
||||||
formattedResult: '0xf',
|
formattedResult: '0xf',
|
||||||
call: 'eth_newFilter'
|
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'],
|
args: ['pending'],
|
||||||
formattedArgs: ['pending'],
|
formattedArgs: ['pending'],
|
||||||
|
|
|
@ -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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue