-
Notifications
You must be signed in to change notification settings - Fork 21
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
update go-events.md #214
base: staging
Are you sure you want to change the base?
update go-events.md #214
Conversation
update go-events.md
So far so good, can we additionally add some golang and js examples of polling and watching events? |
I just create a new method
|
Ref PR: loomnetwork/go-loom#383 |
added go and js examples
updating the go example
Good work so far! It'd be better if you could include a full code snippet that compiles, so change the example to: package main
import (
"encoding/json"
"github.com/loomnetwork/go-loom/client"
)
type MyEvent struct {
Owner string
Method string
Addr []byte
}
func main() {
rpcClient := client.NewDAppChainRPCClient("default", "http://plasma.dappchains.com:80/rpc", "http://plasma.dappchains.com:80/query")
fromBlock := uint64(5216300)
toBlock := uint64(5216320)
result, err := rpcClient.GetContractEvents(fromBlock, toBlock, "")
if err != nil {
panic(err)
}
for _, event := range result.Events {
var decodedEvent MyEvent
if err := json.Unmarshal(event.EncodedBody, &decodedEvent); err != nil {
panic(err)
}
}
} 2 things:
|
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.
Change as per above comment
updated the go example
Updated the example.
|
@pathornteng Could you help? |
Not super high priority but when we get a chance lets see if we can fix this |
update go-events.md