cosmos-sdk/client/tx/root.go

30 lines
750 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/wire"
)
2018-02-28 17:57:38 -08:00
// type used to pass around the provided cdc
type commander struct {
cdc *wire.Codec
}
// 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) {
cmdr := commander{cdc}
cmd.AddCommand(
2018-02-28 17:57:38 -08:00
SearchTxCmd(cmdr),
QueryTxCmd(cmdr),
)
}
2018-03-09 01:15:56 -08:00
func RegisterRoutes(r *mux.Router, cdc *wire.Codec) {
2018-03-14 08:18:47 -07:00
// r.HandleFunc("/txs", SearchTxRequestHandler(cdc)).Methods("GET")
2018-03-09 01:15:56 -08:00
r.HandleFunc("/txs/{hash}", QueryTxRequestHandler(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
}