-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add GetContractEvent to DAppChainRPCClient #383
Conversation
func (c *DAppChainRPCClient) GetContractEvents(fromBlock, toBlock uint64) (ptypes.ContractEventsResult, error) { | ||
params := map[string]interface{}{ | ||
"fromBlock": strconv.FormatUint(fromBlock, 10), | ||
"toBlock": strconv.FormatUint(toBlock, 10), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also need contract
as another parameter since contractevents
has it. It can be blank string if we don't want to filter by contract name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need another method to query the block height to really get rid of those JSONRPC client that we're currently using.
func (c *DAppChainRPCClient) GetBlockHeight() (uint64, error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contract
parameter does not work though. I think we need to have a fix for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. The name might be mapped incorrectly in loomchain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add
GetContractEvents
method toDAppChainRPCClient
. This method returns the list of events from a specified block range.uint64
andint64
are converted to json string according to https://developers.google.com/protocol-buffers/docs/proto3#json. This causesjson.Unmarshal
fail to unmarshal json back to Go struct. So we need to have customjsontag
for int64/uint64 fields.