github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/gov/client/proposal_handler.go (about)

     1  package client
     2  
     3  import (
     4  	interfacetypes "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec/types"
     5  	"github.com/spf13/cobra"
     6  
     7  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/client/context"
     8  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
     9  	"github.com/fibonacci-chain/fbc/x/gov/client/rest"
    10  )
    11  
    12  // function to create the rest handler
    13  type RESTHandlerFn func(context.CLIContext) rest.ProposalRESTHandler
    14  
    15  // function to create the cli handler
    16  type CLIHandlerFn func(proxy *codec.CodecProxy, reg interfacetypes.InterfaceRegistry) *cobra.Command
    17  
    18  // The combined type for a proposal handler for both cli and rest
    19  type ProposalHandler struct {
    20  	CLIHandler  CLIHandlerFn
    21  	RESTHandler RESTHandlerFn
    22  }
    23  
    24  // NewProposalHandler creates a new ProposalHandler object
    25  func NewProposalHandler(cliHandler CLIHandlerFn, restHandler RESTHandlerFn) ProposalHandler {
    26  	return ProposalHandler{
    27  		CLIHandler:  cliHandler,
    28  		RESTHandler: restHandler,
    29  	}
    30  }