Skip to content

Commit

Permalink
fix: remove legacy REST endpoints for broadcast & encode (v0.44.x) (c…
Browse files Browse the repository at this point in the history
…osmos#10041)

* fix: remove legacy REST endpoints for broadcast & encode

* add changelog

* update changelog

* fix amino tx marshaling test

* try to fix x/auth/client/rest tests

* changing tx broadcast request type

* remove auth client/rest_test.go

Co-authored-by: Robert Zaremba <robert@zaremba.ch>
  • Loading branch information
2 people authored and Eengineer1 committed Aug 25, 2022
1 parent 97c27e9 commit 0ca32ca
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions x/auth/client/rest/rest.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit 0ca32ca

Please sign in to comment.