Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some events are decoded as null #4

Closed
hayeah opened this issue Jan 16, 2018 · 4 comments
Closed

some events are decoded as null #4

hayeah opened this issue Jan 16, 2018 · 4 comments

Comments

@hayeah
Copy link
Collaborator

hayeah commented Jan 16, 2018

see: #2 (comment)

@pplam
Copy link

pplam commented Jan 16, 2018

The case is, I have two contracts, i.e. ContractA and ContractB. When I call methodA of ContractA, methodA calls methodB of ContractB, then all events triggered in methodB are logged to ContractA(doesn't logged to ContractB as ethereum). And all these events are deceded to null.

@hayeah
Copy link
Collaborator Author

hayeah commented Jan 19, 2018

hmmmm... ok. I don't really have a nice API in mind to handle this case automatically. Maybe you could suggest one.

To fix this problem manually, you can consider merging ContractA and ContractB's ABI arrays:

new Contract(rpc, {
   address: "...",
   senderAddress: "...",
   abi: contractA.abi.concat(contractB.abi)
})

you could also add only ContractB's events:

new Contract(rpc, {
   address: "...",
   senderAddress: "...",
   abi: contractA.abi.concat(contractB.abi.filter(def => def.type === "event"))
})

@hayeah
Copy link
Collaborator Author

hayeah commented Jan 26, 2018

@pplam hi, this issue is resolved in version 1.7.1

A new API is created so that Contract instances are configured with a log decoder that can parse all known event types.

For details, see: https://qtumproject.github.io/qtumjs-doc/#contract

This version introduced minor backward incompatible changes with 1.6.*. The only user-visible change should be that the hexadecimal output are now all consistently without the 0x prefix.

@hayeah hayeah closed this as completed Jan 26, 2018
@pplam
Copy link

pplam commented Feb 7, 2018

Good job, congratulate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants