This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Getting error when decoding event with indexed fields. #30
Comments
Okay, so it's possible events here have been altered.
I'll take a deeper look tomorrow. Thanks!
…Sent from my iPhone
On May 13, 2018, at 4:41 AM, cryptodungeonsdev ***@***.***> wrote:
Hi! I'm using Ganache 1.0.1 and ethjs 0.4.0.
This is how use watcher:
this.FightFinished = Contracts.zoneContract.FightFinished(
{ toBlock: 'latest', player: Client.activeAccount }
)
this.FightFinished.new()
this.FightFinished.watch(r => {
})
I believe this was outlined at ethjs/ethjs-abi#15
But no response at all, i'll try get response here instead.
Log from watch:
Error: [ethjs-filter] while decoding filter change event data from RPC '[{"logIndex":"2","transactionIndex":"0","transactionHash":"0x2823403d01f35e4d04a2316c72c9a9906160cafa447099644c6af0c48c18261e","blockHash":"0x745dd38108efe3469825dcbc9986a27717ccee25c95cae8cb338886eb73aa639","blockNumber":"92","address":"0xb57e97e510c60673412307547142e7492cd2cb1f","data":"0x0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","topics":["0x79b7b95e80b1a19a31c1a9cdfdbc01f323ac30aef005dd716b3474f8d4b72c68","0x000000000000000000000000e91d5216f69648ce919442e2c426cf48738f4101"],"type":"mined"}]': TypeError: Cannot read property 'slice' of undefined
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks, would be awesome, this problem doesn't allow to continue some parts of development. |
Yeah, very strange. And have you tried just polling eth getLogs and decoding the results with ethjs abi?
…Sent from my iPhone
On May 14, 2018, at 4:20 AM, cryptodungeonsdev ***@***.***> wrote:
Thanks, would be awesome, this problem doesn't allow to continue some parts of development.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
No, i will try |
Yes, it worked! |
Amazing! I should really make that an easier method for all this
…Sent from my iPhone
On May 14, 2018, at 12:36 PM, cryptodungeonsdev ***@***.***> wrote:
Yes, it worked!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
That is great, but how to listen for new Logs? |
So, I usually just run a polling loop.
Checkout ethjs-extras (a rouge library I wrote) for more details.
NPM:
https://www.npmjs.com/package/ethjs-extras
Github:
https://github.com/SilentCicero/ethjs-extras
Contract Code:
```
const {
Eth,
EthContract,
onAccount,
onReceipt,
onBlock,
call,
} = require('ethjs-extras'); // or import..
// setup a light contract object, use solidity spec and or abi spec. const
simpleStore = new EthContract({ network: 'rinkeby', address: '
0x01a528451419d562a6752318a6fb71898fa5d840', methods: [ 'SimpleStore(address
_master)', 'set()', 'Set(uint256 _value)', 'master():(address)', '
get():(uint256)', ], }); // contract methods, promise only simpleStore.get
().then(console.log).catch(console.log); // using shorthand notation
simpleStore.master.call().then(console.log).catch(console.log); // using
.call() notation simpleStore.onEvent(console.log); // polls for events,
receives, decodes and fires callback <-------------------------- simpleStore
.getLogs({ fromBlock: 0 }).then(console.log).catch(console.log);
```
Event Polling I do here (every block):
https://github.com/SilentCicero/ethjs-extras/blob/master/src/index.js#L190
hope this helps, sorry swamped with work!
…On Wed, May 16, 2018 at 2:49 AM, cryptodungeonsdev ***@***.*** > wrote:
@SilentCicero <https://github.com/SilentCicero>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#30 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AJWhXqoupnzYq186oPWrUo6YO5bXdADZks5ty8vwgaJpZM4T8tvH>
.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi! I'm using Ganache 1.0.1 and ethjs 0.4.0.
Here how i use watcher:
I believe this was outlined at https://github.com/ethjs/ethjs-abi/issues/15
But no response at all, i'll try get response here instead.
Log from watch:
Error: [ethjs-filter] while decoding filter change event data from RPC '[{"logIndex":"2","transactionIndex":"0","transactionHash":"0x2823403d01f35e4d04a2316c72c9a9906160cafa447099644c6af0c48c18261e","blockHash":"0x745dd38108efe3469825dcbc9986a27717ccee25c95cae8cb338886eb73aa639","blockNumber":"92","address":"0xb57e97e510c60673412307547142e7492cd2cb1f","data":"0x0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","topics":["0x79b7b95e80b1a19a31c1a9cdfdbc01f323ac30aef005dd716b3474f8d4b72c68","0x000000000000000000000000e91d5216f69648ce919442e2c426cf48738f4101"],"type":"mined"}]': TypeError: Cannot read property 'slice' of undefined
The text was updated successfully, but these errors were encountered: