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

query txs does not output json #2628

Closed
helder-moreira opened this issue Jun 8, 2021 · 8 comments
Closed

query txs does not output json #2628

helder-moreira opened this issue Jun 8, 2021 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@helder-moreira
Copy link

Describe the bug
Querying transactions does not output result in JSON. Not even when log_format flag is specifically set to json.

To Reproduce
Steps to reproduce the behavior:
Run:

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json
count: "0"
limit: "1000"
page_number: "1"
page_total: "0"
total_count: "0"
txs: []

Expected behavior
The expected output of the above command would be:

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json
{"total_count":"0","count":"0","page_number":"1","page_total":"0","limit":"1000","txs":[]}
@helder-moreira helder-moreira added the bug Something isn't working label Jun 8, 2021
@dreamer-zq
Copy link
Contributor

dreamer-zq commented Jun 15, 2021

Describe the bug
Querying transactions does not output result in JSON. Not even when log_format flag is specifically set to json.

To Reproduce
Steps to reproduce the behavior:
Run:

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json
count: "0"
limit: "1000"
page_number: "1"
page_total: "0"
total_count: "0"
txs: []

Expected behavior
The expected output of the above command would be:

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json
{"total_count":"0","count":"0","page_number":"1","page_total":"0","limit":"1000","txs":[]}

iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json --output json

@helder-moreira
Copy link
Author

Describe the bug
Querying transactions does not output result in JSON. Not even when log_format flag is specifically set to json.
To Reproduce
Steps to reproduce the behavior:
Run:

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json
count: "0"
limit: "1000"
page_number: "1"
page_total: "0"
total_count: "0"
txs: []

Expected behavior
The expected output of the above command would be:

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json
{"total_count":"0","count":"0","page_number":"1","page_total":"0","limit":"1000","txs":[]}

iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --log_format=json --output json

$ iris query txs --events "message.sender=iaa13y0rlww8922m0lw5sedt6f9gcv5edczga9j4qc&transfer.recipient=iaa1jv703yqry42ea4fprmjeccwl6xnk5t4ylwh6gv" --page 1 --limit 1000 --output json
Error: unknown flag: --output
Usage:
  iris query txs [flags]

Flags:
      --events string            list of transaction events in the form of {eventType}.{eventAttribute}={value}
  -h, --help                     help for txs
      --keyring-backend string   Select keyring's backend (os|file|kwallet|pass|test) (default "os")
      --limit int                Query number of transactions results per page returned (default 30)
  -n, --node string              Node to connect to (default "tcp://localhost:26657")
      --page int                 Query a specific page of paginated results (default 1)

Global Flags:
      --chain-id string     The network chain ID
      --home string         directory for config and data (default "/home/ubuntu/.iris")
      --log_format string   The logging format (json|plain) (default "plain")
      --log_level string    The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
      --trace               print out full stack trace on errors

@chengwenxi
Copy link
Contributor

@helder-moreira Thanks for your report! It's a bug and should fix in cosmos-sdk.

@helder-moreira
Copy link
Author

@helder-moreira Thanks for your report! It's a bug and should fix in cosmos-sdk.

Thanks 🙏 Not on cosmos-sdk though, I am working with several chains using cosmos-sdk and none of them has this issue.

@chengwenxi
Copy link
Contributor

chengwenxi commented Jun 18, 2021

Because we have handled the output for token unit conversion if -output json is not specified. And the query txs command doesn't add this flag as other query commands.

@chengwenxi
Copy link
Contributor

@helder-moreira Refer cosmos/cosmos-sdk#9540, we will fix it in the next cosmos-sdk upgrade.

@zhangyelong
Copy link
Contributor

@dreamer-zq Can you confirm if this is fixed in v1.2 ?

@dreamer-zq
Copy link
Contributor

@dreamer-zq Can you confirm if this is fixed in v1.2 ?

It has been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Status: Done
Development

No branches or pull requests

6 participants