From 67542867d9d414beaa689f59c4fae80b14a94698 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 5 Oct 2016 13:17:25 +0200 Subject: [PATCH 1/2] fix horrible event address issue --- js/src/api/contract/contract.js | 1 - js/src/api/contract/contract.spec.js | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/js/src/api/contract/contract.js b/js/src/api/contract/contract.js index 4402898f03d..40caa764334 100644 --- a/js/src/api/contract/contract.js +++ b/js/src/api/contract/contract.js @@ -147,7 +147,6 @@ export default class Contract { const decoded = event.decodeLog(log.topics, log.data); log.params = {}; - log.address = decoded.address; log.event = event.name; decoded.params.forEach((param) => { diff --git a/js/src/api/contract/contract.spec.js b/js/src/api/contract/contract.spec.js index 2c97eed185b..7ac3e099c9d 100644 --- a/js/src/api/contract/contract.spec.js +++ b/js/src/api/contract/contract.spec.js @@ -171,7 +171,7 @@ describe('api/contract/Contract', () => { const log = decoded.logs[0]; expect(log.event).to.equal('Message'); - expect(log.address).to.equal('0xfa64203C044691aA57251aF95f4b48d85eC00Dd5'); + expect(log.address).to.equal('0x22bff18ec62281850546a664bb63a5c06ac5f76c'); expect(log.params).to.deep.equal({ at: new BigNumber('1457965151'), message: 'post(message)', @@ -457,7 +457,7 @@ describe('api/contract/Contract', () => { transactionIndex: '0x0' }]; const parsed = [{ - address: '0xfa64203C044691aA57251aF95f4b48d85eC00Dd5', + address: '0x22bfF18ec62281850546a664bb63a5C06AC5F76C', blockHash: '0xa9280530a3b47bee2fc80f2862fd56502ae075350571d724d6442ea4c597347b', blockNumber: new BigNumber(20429), data: '0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063cf90d3f0410092fc0fca41846f5962239791950000000000000000000000000000000000000000000000000000000056e6c85f0000000000000000000000000000000000000000000000000001000000004fcd00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000d706f7374286d6573736167652900000000000000000000000000000000000000', From 0d8cfd9360f3a9698f73fa77d515838dbde18ae0 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 5 Oct 2016 13:23:14 +0200 Subject: [PATCH 2/2] rwork display of events slightly --- js/src/dapps/basiccoin/Deploy/Event/event.js | 8 ++++---- js/src/dapps/basiccoin/Transfer/Event/event.js | 8 ++++---- js/src/dapps/basiccoin/services.js | 15 ++++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/js/src/dapps/basiccoin/Deploy/Event/event.js b/js/src/dapps/basiccoin/Deploy/Event/event.js index e11b21258f6..9b524f9284b 100644 --- a/js/src/dapps/basiccoin/Deploy/Event/event.js +++ b/js/src/dapps/basiccoin/Deploy/Event/event.js @@ -55,14 +55,14 @@ export default class Event extends Component {
{ isPending ? 'Pending' : event.blockNumber.toFormat() }
{ event.event } - - { this.renderAddress(event.params.owner) } -
{ this.renderHash(event.transactionHash) }
-
{ isPending ? '' : coin.tla }
{ isPending ? '' : coin.name }
+ + { this.renderAddress(event.params.owner) } +
{ this.renderHash(event.transactionHash) }
+ { isPending || !coin.isGlobal ? '' : 'global' } ); diff --git a/js/src/dapps/basiccoin/Transfer/Event/event.js b/js/src/dapps/basiccoin/Transfer/Event/event.js index 2e74fd8ea38..03f88f1e881 100644 --- a/js/src/dapps/basiccoin/Transfer/Event/event.js +++ b/js/src/dapps/basiccoin/Transfer/Event/event.js @@ -54,6 +54,10 @@ export default class Event extends Component {
{ isPending ? 'Pending' : event.blockNumber.toFormat() }
{ event.event } + +
{ isPending ? '' : token.coin.tla }
+
{ isPending ? '' : token.coin.name }
+ { this.renderAddress(event.params.from) } @@ -65,10 +69,6 @@ export default class Event extends Component { { this.renderAddress(event.params.to) } - -
{ isPending ? '' : token && token.coin.tla }
-
{ isPending ? '' : token && token.coin.name }
- ); } diff --git a/js/src/dapps/basiccoin/services.js b/js/src/dapps/basiccoin/services.js index acb967506b7..60705aef91a 100644 --- a/js/src/dapps/basiccoin/services.js +++ b/js/src/dapps/basiccoin/services.js @@ -31,15 +31,16 @@ export function subscribeEvents (addresses, callback) { const subscriptionId = nextSubscriptionId++; const contract = api.newContract(abis.eip20); const event = contract.events.filter((evt) => evt.name === 'Transfer'); + const options = { + address: addresses, + fromBlock: 0, + toBlock: 'pending', + limit: 50, + topics: [event.signature] + }; return api.eth - .newFilter({ - address: addresses, - fromBlock: 0, - toBlock: 'pending', - limit: 50, - topics: [event.signature] - }) + .newFilter(options) .then((filterId) => { subscriptions[subscriptionId] = { subscriptionId, filterId, addresses, callback, contract };