cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.2k stars 3.59k forks source link

REST Account/Balance query duplicated logic #4090

Closed MarinX closed 5 years ago

MarinX commented 5 years ago

Summary

In x/auth/client/rest/query.go we have 2 REST methods which are the same except the response.

Problem Definition

The first REST method /auth/accounts/{address} has a handler QueryAccountRequestHandlerFn, which returns the account.

The second REST method /bank/balances/{address} has a handler QueryBalancesRequestHandlerFn, which returns account coins.

Both methods do the same validation, querying and error checking. Only difference is the response (account or account coins)

Proposal

For Admin Use

MarinX commented 5 years ago

Related conversation #4065

alexanderbez commented 5 years ago

Thanks @MarinX. I'm thinking do we even need two endpoints? Why not just have an account query endpoint? That'll have the balance anyway.

fedekunze commented 5 years ago

++ agree with @alexanderbez here

alexanderbez commented 5 years ago

Closing. Has been already addressed by @fedekunze :)