irisnet/irishub

query txs does not output json

helder-moreira opened this issue ยท 8 comments

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":[]}

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

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

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

@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.

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.

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

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

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

It has been fixed