Skip to content

Commit

Permalink
Merge branch 'blockFilterProposal' of https://github.com/ethereum/eth…
Browse files Browse the repository at this point in the history
…ereum.js into develop

Conflicts:
	dist/web3-light.js.map
	dist/web3-light.min.js
	dist/web3.js.map
	dist/web3.min.js
  • Loading branch information
debris committed May 11, 2015
2 parents e908439 + 3af8e27 commit 9812b01
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 18 deletions.
15 changes: 14 additions & 1 deletion dist/web3-light.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/web3-light.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3-light.min.js

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion dist/web3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/web3.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3.min.js

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion lib/web3/watches.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ var Method = require('./method');
/// @returns an array of objects describing web3.eth.filter api methods
var eth = function () {
var newFilterCall = function (args) {
return typeof args[0] === 'string' ? 'eth_newBlockFilter' : 'eth_newFilter';
var type = args[0];

switch(type) {
case 'latest':
args.pop();
this.params = 0;
return 'eth_newBlockFilter';
case 'pending':
args.pop();
this.params = 0;
return 'eth_newPendingTransactionFilter';
default:
return 'eth_newFilter';
}
};

var newFilter = new Method({
Expand Down
21 changes: 16 additions & 5 deletions test/polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@ var utils = require('../lib/utils/utils');

var tests = [{
protocol: 'eth',
args: ['pending'],
args: ['latest'],
firstResult: 1,
firstPayload: {
method: "eth_newBlockFilter",
params: [
"pending"
]
params: []
},
secondResult: ['0x1234'],
secondPayload: {
method: "eth_getFilterChanges"
}
},
{
protocol: 'eth',
args: ['pending'],
firstResult: 1,
firstPayload: {
method: "eth_newPendingTransactionFilter",
params: []
},
secondResult: [null],
secondResult: ['0x1234'],
secondPayload: {
method: "eth_getFilterChanges"
}
Expand Down
10 changes: 8 additions & 2 deletions test/web3.eth.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ var tests = [{
formattedResult: '0xf',
call: 'eth_newFilter'
},{
args: ['pending'],
formattedArgs: ['pending'],
args: ['latest'],
formattedArgs: [],
result: '0xf',
formattedResult: '0xf',
call: 'eth_newBlockFilter'
},{
args: ['pending'],
formattedArgs: [],
result: '0xf',
formattedResult: '0xf',
call: 'eth_newPendingTransactionFilter'
}];

describe('web3.eth', function () {
Expand Down

0 comments on commit 9812b01

Please sign in to comment.