Closed
Description
opened on May 25, 2021
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:
func (k Keeper) GetAllMarkerHolders(ctx sdk.Context, denom string) []types.Balance {
var results []types.Balance
k.bankKeeper.IterateAllBalances(ctx, func(addr sdk.AccAddress, coin sdk.Coin) (stop bool) {
if coin.Denom == denom && !coin.Amount.IsZero() {
results = append(results,
types.Balance{
Address: addr.String(),
Coins: sdk.NewCoins(coin),
})
}
return false // do not stop iterating
})
return results
}
add somethings similar within the bank module.
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned
Activity