-
Notifications
You must be signed in to change notification settings - Fork 7
/
rest.go
31 lines (26 loc) · 1.59 KB
/
rest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package rest
import (
"github.com/gorilla/mux"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
)
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
registerQueryRoutes(cliCtx, r, cdc)
registerTXRoutes(cliCtx, r, cdc)
}
func registerQueryRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
r.HandleFunc("/market/trading-pairs/{stock}/{money}", queryMarketHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/market/orderbook/{stock}/{money}", queryOrdersInMarketHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/market/exist-trading-pairs", queryMarketsHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/market/orders/{order-id}", queryOrderInfoHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/market/orders/account/{address}", queryUserOrderListHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/market/parameters", queryParamsHandlerFn(cliCtx)).Methods("GET")
}
func registerTXRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
r.HandleFunc("/market/gte-orders", createGTEOrderHandlerFn(cdc, cliCtx)).Methods("POST")
r.HandleFunc("/market/trading-pairs", createMarketHandlerFn(cdc, cliCtx)).Methods("POST")
r.HandleFunc("/market/ioc-orders", createIOCOrderHandlerFn(cdc, cliCtx)).Methods("POST")
r.HandleFunc("/market/cancel-order", cancelOrderHandlerFn(cdc, cliCtx)).Methods("POST")
r.HandleFunc("/market/cancel-trading-pair", cancelMarketHandlerFn(cdc, cliCtx)).Methods("POST")
r.HandleFunc("/market/price-precision", modifyTradingPairPricePrecision(cdc, cliCtx)).Methods("POST")
}