0g-chain/x/community/client/proposal_handler.go
Robert Pirtle f0731ceb0e
Setup CLI for x/community lend proposals (#1427)
* add tx for CommunityPoolLendDepositProposal

* add cli cmd for CommunityPoolWithdrawProposal
2022-12-12 17:10:36 -08:00

36 lines
1.0 KiB
Go

package client
import (
"net/http"
"github.com/cosmos/cosmos-sdk/client"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
govrest "github.com/cosmos/cosmos-sdk/x/gov/client/rest"
"github.com/kava-labs/kava/x/community/client/cli"
"github.com/kava-labs/kava/x/community/types"
)
// community-pool deposit/withdraw lend proposal handlers
var (
LendDepositProposalHandler = govclient.NewProposalHandler(
cli.NewCmdSubmitCommunityPoolLendDepositProposal,
notImplementedRestHandler(types.ProposalTypeCommunityPoolLendDeposit),
)
LendWithdrawProposalHandler = govclient.NewProposalHandler(
cli.NewCmdSubmitCommunityPoolLendWithdrawProposal,
notImplementedRestHandler(types.ProposalTypeCommunityPoolLendDeposit),
)
)
func notImplementedRestHandler(subRoute string) govclient.RESTHandlerFn {
return func(ctx client.Context) govrest.ProposalRESTHandler {
return govrest.ProposalRESTHandler{
SubRoute: subRoute,
Handler: func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Unimplemented", http.StatusNotImplemented)
},
}
}
}