cosmos-sdk/client/tx/root.go

26 lines
742 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"
2018-03-02 01:24:07 -08:00
"github.com/cosmos/cosmos-sdk/wire"
)
// AddCommands adds a number of tx-query related subcommands
2018-02-28 17:57:38 -08:00
func AddCommands(cmd *cobra.Command, cdc *wire.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(ctx context.CoreContext, r *mux.Router, cdc *wire.Codec) {
2018-04-25 13:32:22 -07:00
r.HandleFunc("/txs/{hash}", QueryTxRequestHandlerFn(cdc, ctx)).Methods("GET")
r.HandleFunc("/txs", SearchTxRequestHandlerFn(ctx, cdc)).Methods("GET")
2018-03-14 05:01:55 -07:00
// r.HandleFunc("/txs/sign", SignTxRequstHandler).Methods("POST")
// r.HandleFunc("/txs/broadcast", BroadcastTxRequestHandler).Methods("POST")
2018-03-09 01:15:56 -08:00
}