Skip to content

Commit

Permalink
fixed event from and toBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Apr 28, 2015
1 parent 3b799d1 commit e9ec708
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/web3-light.js

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

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion dist/web3.js

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

2 changes: 1 addition & 1 deletion 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.

2 changes: 1 addition & 1 deletion example/event_inc.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion lib/web3/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
26 changes: 26 additions & 0 deletions test/event.encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [{
Expand Down
15 changes: 15 additions & 0 deletions test/web3.eth.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit e9ec708

Please sign in to comment.