Implement query in onboarding module to list the registered participants (#4)

* Implement query to list participants

* Remove unnecessary comments
This commit is contained in:
Isha Venikar
2024-07-16 09:25:39 +05:30
committed by nabarun
parent a21e9ea387
commit 582c83543c
9 changed files with 2247 additions and 49 deletions
+13 -3
View File
@@ -9,7 +9,17 @@ import (
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
return &autocliv1.ModuleOptions{
Query: nil,
Query: &autocliv1.ServiceCommandDescriptor{
Service: onboardingv1.Query_ServiceDesc.ServiceName,
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
{
RpcMethod: "Participants",
Use: "list",
Short: "List participants",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{},
},
},
},
// TODO: Use JSON file for input
Tx: &autocliv1.ServiceCommandDescriptor{
Service: onboardingv1.Msg_ServiceDesc.ServiceName,
@@ -19,8 +29,8 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
Use: "enroll",
Short: "Enroll a testnet validator",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "ethPayload"},
{ProtoField: "ethSignature"},
{ProtoField: "eth_payload"},
{ProtoField: "eth_signature"},
{ProtoField: "message"},
},
},
+5 -6
View File
@@ -1,6 +1,7 @@
package module
import (
"context"
"encoding/json"
"fmt"
@@ -52,10 +53,9 @@ func (AppModule) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the onboarding module.
func (AppModule) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) {
// TODO: Implement
// if err := onboarding.RegisterQueryHandlerClient(context.Background(), mux, onboarding.NewQueryClient(clientCtx)); err != nil {
// panic(err)
// }
if err := onboarding.RegisterQueryHandlerClient(context.Background(), mux, onboarding.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}
// RegisterInterfaces registers interfaces and implementations of the onboarding module.
@@ -68,10 +68,9 @@ func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
// TODO: Implement
// Register servers
onboarding.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
// onboarding.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
onboarding.RegisterQueryServer(cfg.QueryServer(), keeper.NewQueryServerImpl(am.keeper))
// Register in place module state migration migrations
// m := keeper.NewMigrator(am.keeper)