forked from cerc-io/laconicd
Add registry module commands to set and get records (#5)
Reviewed-on: deep-stack/laconic2d#5 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
@@ -3,7 +3,8 @@ package module
|
||||
import (
|
||||
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
||||
"cosmossdk.io/client/v2/autocli"
|
||||
// registryv1 "git.vdb.to/cerc-io/laconic2d/api/cerc/registry/v1"
|
||||
|
||||
registryv1 "git.vdb.to/cerc-io/laconic2d/api/cerc/registry/v1"
|
||||
)
|
||||
|
||||
var _ autocli.HasAutoCLIConfig = AppModule{}
|
||||
@@ -11,7 +12,35 @@ var _ autocli.HasAutoCLIConfig = AppModule{}
|
||||
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
||||
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
||||
return &autocliv1.ModuleOptions{
|
||||
Query: nil,
|
||||
Tx: nil,
|
||||
Query: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: registryv1.Query_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
||||
{
|
||||
RpcMethod: "Params",
|
||||
Use: "params",
|
||||
Short: "Get the current registry parameters",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{},
|
||||
},
|
||||
{
|
||||
RpcMethod: "Records",
|
||||
Use: "list",
|
||||
Short: "List records",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{},
|
||||
},
|
||||
{
|
||||
RpcMethod: "GetRecord",
|
||||
Use: "get [record-id]",
|
||||
Short: "Get record info by record id",
|
||||
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
|
||||
{ProtoField: "id"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Tx: &autocliv1.ServiceCommandDescriptor{
|
||||
Service: registryv1.Msg_ServiceDesc.ServiceName,
|
||||
RpcCommandOptions: []*autocliv1.RpcCommandOptions{},
|
||||
EnhanceCustomCommand: true, // Allow additional manual commands
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
@@ -15,6 +16,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
|
||||
registrytypes "git.vdb.to/cerc-io/laconic2d/x/registry"
|
||||
"git.vdb.to/cerc-io/laconic2d/x/registry/client/cli"
|
||||
"git.vdb.to/cerc-io/laconic2d/x/registry/keeper"
|
||||
)
|
||||
|
||||
@@ -115,8 +117,8 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
|
||||
// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries.
|
||||
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
// Register servers
|
||||
// registrytypes.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
// registrytypes.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
|
||||
registrytypes.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
|
||||
registrytypes.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
|
||||
}
|
||||
|
||||
// appmodule.HasEndBlocker
|
||||
@@ -124,3 +126,8 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
|
||||
func (am AppModule) EndBlock(ctx context.Context) error {
|
||||
return EndBlocker(ctx, am.keeper)
|
||||
}
|
||||
|
||||
// Get the root tx command of this module
|
||||
func (AppModule) GetTxCmd() *cobra.Command {
|
||||
return cli.GetTxCmd()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user