address Chris' comments
This commit is contained in:
parent
14154f71be
commit
7cf5da2f72
|
@ -32,7 +32,7 @@ func SearchTxCmd(cdc *codec.Codec) *cobra.Command {
|
||||||
Long: strings.TrimSpace(`
|
Long: strings.TrimSpace(`
|
||||||
Search for transactions that match exactly the given tags. For example:
|
Search for transactions that match exactly the given tags. For example:
|
||||||
|
|
||||||
$ gaiacli query txs --tags <tag1>:<value1>&<tag2>:<value2>
|
$ gaiacli query txs --tags '<tag1>:<value1>&<tag2>:<value2>'
|
||||||
`),
|
`),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
tagsStr := viper.GetString(flagTags)
|
tagsStr := viper.GetString(flagTags)
|
||||||
|
@ -48,7 +48,10 @@ $ gaiacli query txs --tags <tag1>:<value1>&<tag2>:<value2>
|
||||||
for _, tag := range tags {
|
for _, tag := range tags {
|
||||||
if !strings.Contains(tag, ":") {
|
if !strings.Contains(tag, ":") {
|
||||||
return fmt.Errorf("%s should be of the format <key>:<value>", tagsStr)
|
return fmt.Errorf("%s should be of the format <key>:<value>", tagsStr)
|
||||||
|
} else if strings.Count(tag, ":") > 1 {
|
||||||
|
return fmt.Errorf("%s should only contain one <key>:<value> pair", tagsStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
keyValue := strings.Split(tag, ":")
|
keyValue := strings.Split(tag, ":")
|
||||||
tag = fmt.Sprintf("%s='%s'", keyValue[0], keyValue[1])
|
tag = fmt.Sprintf("%s='%s'", keyValue[0], keyValue[1])
|
||||||
tmTags = append(tmTags, tag)
|
tmTags = append(tmTags, tag)
|
||||||
|
|
|
@ -193,8 +193,18 @@ gaiacli tx broadcast --node=<node> signedSendTx.json
|
||||||
|
|
||||||
You can use the transaction search command to query for transactions that match a specific set of `tags`, which are added on every transaction.
|
You can use the transaction search command to query for transactions that match a specific set of `tags`, which are added on every transaction.
|
||||||
|
|
||||||
|
Each tag is conformed by a key-value pair in the form of `<tag>:<value>`. Tags can also be combined to query for a more specific result using the `&` symbol.
|
||||||
|
|
||||||
|
The command for querying transactions using a `tag` is the following:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gaiacli query txs --tags=<tag1>:<value1>&<tag2>:<value2>
|
gaiacli query txs --tags='<tag>:<value>'
|
||||||
|
```
|
||||||
|
|
||||||
|
And for using multiple `tags`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gaiacli query txs --tags='<tag1>:<value1>&<tag2>:<value2>'
|
||||||
```
|
```
|
||||||
|
|
||||||
::: tip Note
|
::: tip Note
|
||||||
|
|
Loading…
Reference in New Issue