diff --git a/CHANGELOG.md b/CHANGELOG.md index ed21119f5ac61..aaf6c79069d61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,7 +56,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking Changes * (client/tx) [\#9421](https://github.com/cosmos/cosmos-sdk/pull/9421/) `BuildUnsignedTx`, `BuildSimTx`, `PrintUnsignedStdTx` functions are moved to the Tx Factory as methods. - + +### Client Breaking Changes +* [\#10041](https://github.com/cosmos/cosmos-sdk/pull/10041) Remove broadcast & encode legacy REST endpoints. Please see the [REST Endpoints Migration guide](https://docs.cosmos.network/master/migrations/rest.html) to migrate to the new REST endpoints. + ## [v0.43.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.43.0) - 2021-08-10 ### Features diff --git a/x/auth/client/rest/rest.go b/x/auth/client/rest/rest.go new file mode 100644 index 0000000000000..03b7564acef00 --- /dev/null +++ b/x/auth/client/rest/rest.go @@ -0,0 +1,34 @@ +package rest + +import ( + "github.com/gorilla/mux" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/rest" +) + +// REST query and parameter values +const ( + MethodGet = "GET" +) + +// RegisterRoutes registers the auth module REST routes. +func RegisterRoutes(clientCtx client.Context, rtr *mux.Router, storeName string) { + r := rest.WithHTTPDeprecationHeaders(rtr) + r.HandleFunc( + "/auth/accounts/{address}", QueryAccountRequestHandlerFn(storeName, clientCtx), + ).Methods(MethodGet) + + r.HandleFunc( + "/auth/params", + queryParamsHandler(clientCtx), + ).Methods(MethodGet) +} + +// RegisterTxRoutes registers all transaction routes on the provided router. +func RegisterTxRoutes(clientCtx client.Context, rtr *mux.Router) { + r := rest.WithHTTPDeprecationHeaders(rtr) + r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(clientCtx)).Methods("GET") + r.HandleFunc("/txs", QueryTxsRequestHandlerFn(clientCtx)).Methods("GET") + r.HandleFunc("/txs/decode", DecodeTxRequestHandlerFn(clientCtx)).Methods("POST") +}