cosmos-sdk/client/tx/root.go

25 lines
679 B
Go

package tx
import (
"github.com/gorilla/mux"
"github.com/spf13/cobra"
"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(
SearchTxCmd(cdc),
QueryTxCmd(cdc),
)
}
// register REST routes
func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, cdc *codec.Codec) {
r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(cdc, cliCtx)).Methods("GET")
r.HandleFunc("/txs", SearchTxRequestHandlerFn(cliCtx, cdc)).Methods("GET")
r.HandleFunc("/txs", BroadcastTxRequest(cliCtx, cdc)).Methods("POST")
}