cosmos-sdk/client/tx/root.go

25 lines
679 B
Go
Raw Normal View History

package tx
import (
2018-03-09 01:15:56 -08:00
"github.com/gorilla/mux"
"github.com/spf13/cobra"
2018-03-02 01:24:07 -08:00
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
)
// AddCommands adds a number of tx-query related subcommands
func AddCommands(cmd *cobra.Command, cdc *codec.Codec) {
cmd.AddCommand(
2018-04-18 21:49:24 -07:00
SearchTxCmd(cdc),
QueryTxCmd(cdc),
)
}
2018-03-09 01:15:56 -08:00
2018-04-18 21:49:24 -07:00
// register REST routes
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
2018-08-06 11:11:30 -07:00
r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/txs", SearchTxRequestHandlerFn(cliCtx, cdc)).Methods("GET")
2018-09-27 07:06:40 -07:00
r.HandleFunc("/txs", BroadcastTxRequest(cliCtx, cdc)).Methods("POST")
2018-03-09 01:15:56 -08:00
}