mirror of https://github.com/ethereum/go-ethereum
parent
61e8ae2f7b
commit
842b8cf323
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,16 @@ |
|||||||
|
|
||||||
|
var abi = require('./abi'); |
||||||
|
|
||||||
|
var implementationOfEvent = function (event, address, signature) { |
||||||
|
|
||||||
|
return function (options) { |
||||||
|
var o = options || {}; |
||||||
|
o.address = o.address || address; |
||||||
|
o.topics = o.topics || []; |
||||||
|
o.topics.push(signature); |
||||||
|
return o; |
||||||
|
}; |
||||||
|
}; |
||||||
|
|
||||||
|
module.exports = implementationOfEvent; |
||||||
|
|
@ -0,0 +1,25 @@ |
|||||||
|
var assert = require('assert'); |
||||||
|
var event = require('../lib/event.js'); |
||||||
|
|
||||||
|
describe('event', function () { |
||||||
|
it('should create filter input object from given', function () { |
||||||
|
|
||||||
|
// given
|
||||||
|
var address = '0x012345';
|
||||||
|
var signature = '0x987654'; |
||||||
|
var e = { |
||||||
|
name: 'test', |
||||||
|
type: 'event', |
||||||
|
}; |
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event(e, address, signature); |
||||||
|
var result = impl(); |
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.address, address);
|
||||||
|
assert.equal(result.topics.length, 1); |
||||||
|
assert.equal(result.topics[0], signature); |
||||||
|
|
||||||
|
}); |
||||||
|
}); |
Loading…
Reference in new issue