-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 Bank.getAllHolders(denom) grpc/api #9393
Comments
Would you be willing to open a PR for this? For performance it would need to be paginated |
@aaronc I appreciate the confidence. Unfortunately I am just acting as a user of these APIs at this time. I don't feel comfortable enough to make this change. |
@aaronc can you point me to docs or resources on how to actually add a gRPC query please? |
This is what we've got: https://docs.cosmos.network/v0.42/building-modules/query-services.html#implementation-of-a-module-query-service. I think it could be improved for sure (cc @ryanchristo). You can see examples for other query methods in bank. |
Is it worth creating a denom - address reverse index for this? (i.e. |
Yes, I think that idea makes sense. Then we could just prefix scan on |
Exactly, it is extra storage and gas to make that work, but it would be kind of nice. We probably don't need to store the actually balance under that reverse key so it only needs to be set once per denom/address pair and then deleted when the balance goes to zero. If we do it, it will need a migration. |
Why would this need a migration and how would that look like? Is this worth the change? |
See example here for 0.42->0.43 store migrations.
For now #9533 is non-breaking, so let's merge that into 0.43. The denom++address index is a nice-to-have for me, we can create a separate issue for it, and include it in 0.44 (with a 0.43->0.44 store migration). |
Could you create an issue for that @AmauryM ? I'd like to put it on the roadmap for the next release. It's also desirable if bank is used for storing NFTs. |
# Description Adds a new gRPC method, `DenomOwners`, to the `x/bank` module. This method queries for all account addresses that own a particular token denomination (paginated). _Naming subject to change based on reviews._ closes: #9393 --- ### 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 - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [ ] 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... - [x] 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 - [x] confirmed all author checklist items have been addressed - [x] reviewed state machine logic - [x] reviewed API design and naming - [x] reviewed documentation is accurate - [x] reviewed tests and test coverage - [ ] manually tested (if applicable)
Summary
It would be nice to retrieve a list of holders for a particular denom.
Problem Definition
We are currently doing this very specifically for our marker module, but it would be very helpful to have this available on a regular denom as well. Pass in a denom name, and spit out a paginated list of account holders with balances.
Proposal
Following this example:
add somethings similar within the bank module.
For Admin Use
The text was updated successfully, but these errors were encountered: