Merge pull request #186 from ethereum/eventFilterFix

fixed event from and toBlock
This commit is contained in:
Marek Kotewicz 2015-04-29 09:04:40 +02:00
commit 539ef7bdcf
10 changed files with 51 additions and 10 deletions

2
dist/web3-light.js vendored
View File

@ -2118,7 +2118,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

2
dist/web3.js vendored
View File

@ -2118,7 +2118,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 = [];

2
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 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 () {

View File

@ -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 = [];

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: { abi: {
name: 'event1', name: 'event1',
inputs: [{ inputs: [{

View File

@ -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'],