Skip to content
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

Return account queries with height #4536

Merged
merged 4 commits into from
Jun 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion x/auth/client/rest/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
)

// AccountWithQueryHeight wraps the embedded Account
// with the height it was queried at
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// with the height it was queried at
// with the height it was queried at.

type AccountWithQueryHeight struct {
types.Account
Height int64 `json:"height"`
}

// register REST routes
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) {
r.HandleFunc(
Expand Down Expand Up @@ -64,7 +71,12 @@ func QueryAccountRequestHandlerFn(
return
}

rest.PostProcessResponse(w, cliCtx, account)
if cliCtx.Height > 0 {
fedekunze marked this conversation as resolved.
Show resolved Hide resolved
accountWithHeight := AccountWithQueryHeight{account, cliCtx.Height}
rest.PostProcessResponse(w, cliCtx, accountWithHeight)
} else {
rest.PostProcessResponse(w, cliCtx, account)
}
}
}

Expand Down