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

Add events #19

Merged
merged 3 commits into from
Feb 23, 2021
Merged

Add events #19

merged 3 commits into from
Feb 23, 2021

Conversation

Kay-Zee
Copy link
Member

@Kay-Zee Kay-Zee commented Dec 29, 2020

Closes #18

Description

Adds new events sub command that


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@Kay-Zee Kay-Zee added the Feature A new user feature or a new package API label Dec 29, 2020
@Kay-Zee Kay-Zee requested a review from a team December 29, 2020 22:46
@Kay-Zee Kay-Zee self-assigned this Dec 29, 2020
@Kay-Zee Kay-Zee removed the request for review from a team December 29, 2020 22:46
Copy link
Contributor

@janezpodhostnik janezpodhostnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition. I had one question.

flow/result.go Outdated
for _, blockEvent := range events {
fmt.Printf("Events for Block %s:", blockEvent.BlockID)
for i, blockEvent := range events {
fmt.Printf("Events for Block %s (%d):", blockEvent.BlockID, startHeight+uint64(i))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the number in parenthesis represent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the height of the block. better to label?

@vishalchangrani vishalchangrani self-requested a review January 4, 2021 16:45
@Kay-Zee
Copy link
Member Author

Kay-Zee commented Feb 4, 2021

Example usage:

flow events get A.1654653399040a61.FlowToken.TokensDeposited 11559500 11559600

@joshuahannan
Copy link
Member

Could you add a events help indication that shows the correct format of an event definition in case people don't know to use A.1654653399040a61.FlowToken.TokensDeposited. Like if they get it wrong, it shows the correct format?

Copy link
Member

@turbolent turbolent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

var conf Config

var Cmd = &cobra.Command{
Use: "get <event_name> <block_height_range_start> <optional:block_height_range_end|latest>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use "type ID" instead of "name", as someone might assume it's possible to just specify e.g AccountCreated.

Also, maybe make it clearer that latest here is a literal, not a variable like block_height_range_start and block_height_range_end

Suggested change
Use: "get <event_name> <block_height_range_start> <optional:block_height_range_end|latest>",
Use: "get <event_type_id> <block_height_range_start> <optional:block_height_range_end|'latest'>",

@turbolent
Copy link
Member

@Kay-Zee Maybe add your example as Example to the Command (https://github.com/spf13/cobra/blob/master/command.go#L64)

@Kay-Zee Kay-Zee merged commit c047b61 into master Feb 23, 2021
@Kay-Zee Kay-Zee deleted the kan/#18-add-events-sub-command branch February 23, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature A new user feature or a new package API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request events for block range
5 participants