Sort the contract addresses on queries

This commit is contained in:
Ethan Frey 2020-02-09 21:59:20 +01:00
parent a7e8464a19
commit cb148f0d13
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package keeper
import (
"encoding/json"
"sort"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -72,6 +73,7 @@ func queryContractList(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([
addrs = append(addrs, addr.String())
return false
})
sort.Strings(addrs)
bz, err := json.MarshalIndent(addrs, "", " ")
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error())