cosmos-sdk/x/feegrant/spec/05_client.md
Julien Robert 58597139fa
docs: Improve markdownlint configuration (#11104)
## Description

Closes: #9404



---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
2022-02-10 12:07:01 +00:00

3.1 KiB

Client

CLI

A user can query and interact with the feegrant module using the CLI.

Query

The query commands allow users to query feegrant state.

simd query feegrant --help

grant

The grant command allows users to query a grant for a given granter-grantee pair.

simd query feegrant grant [granter] [grantee] [flags]

Example:

simd query feegrant grant cosmos1.. cosmos1..

Example Output:

allowance:
  '@type': /cosmos.feegrant.v1beta1.BasicAllowance
  expiration: null
  spend_limit:
  - amount: "100"
    denom: stake
grantee: cosmos1..
granter: cosmos1..

grants

The grants command allows users to query all grants for a given grantee.

simd query feegrant grants [grantee] [flags]

Example:

simd query feegrant grants cosmos1..

Example Output:

allowances:
- allowance:
    '@type': /cosmos.feegrant.v1beta1.BasicAllowance
    expiration: null
    spend_limit:
    - amount: "100"
      denom: stake
  grantee: cosmos1..
  granter: cosmos1..
pagination:
  next_key: null
  total: "0"

Transactions

The tx commands allow users to interact with the feegrant module.

simd tx feegrant --help

grant

The grant command allows users to grant fee allowances to another account. The fee allowance can have an expiration date, a total spend limit, and/or a periodic spend limit.

simd tx feegrant grant [granter] [grantee] [flags]

Example (one-time spend limit):

simd tx feegrant grant cosmos1.. cosmos1.. --spend-limit 100stake

Example (periodic spend limit):

simd tx feegrant grant cosmos1.. cosmos1.. --period 3600 --period-limit 10stake

revoke

The revoke command allows users to revoke a granted fee allowance.

simd tx feegrant revoke [granter] [grantee] [flags]

Example:

simd tx feegrant revoke cosmos1.. cosmos1..

gRPC

A user can query the feegrant module using gRPC endpoints.

Allowance

The Allowance endpoint allows users to query a granted fee allowance.

cosmos.feegrant.v1beta1.Query/Allowance

Example:

grpcurl -plaintext \
    -d '{"grantee":"cosmos1..","granter":"cosmos1.."}' \
    localhost:9090 \
    cosmos.feegrant.v1beta1.Query/Allowance

Example Output:

{
  "allowance": {
    "granter": "cosmos1..",
    "grantee": "cosmos1..",
    "allowance": {"@type":"/cosmos.feegrant.v1beta1.BasicAllowance","spendLimit":[{"denom":"stake","amount":"100"}]}
  }
}

Allowances

The Allowances endpoint allows users to query all granted fee allowances for a given grantee.

cosmos.feegrant.v1beta1.Query/Allowances

Example:

grpcurl -plaintext \
    -d '{"address":"cosmos1.."}' \
    localhost:9090 \
    cosmos.feegrant.v1beta1.Query/Allowances

Example Output:

{
  "allowances": [
    {
      "granter": "cosmos1..",
      "grantee": "cosmos1..",
      "allowance": {"@type":"/cosmos.feegrant.v1beta1.BasicAllowance","spendLimit":[{"denom":"stake","amount":"100"}]}
    }
  ],
  "pagination": {
    "total": "1"
  }
}