From d445811e808fc9c91188329e247f00fb90f62146 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Mon, 12 Feb 2024 10:29:48 +0530 Subject: [PATCH] Add a command to get auction module params --- x/auction/keeper/keeper.go | 10 ++++++++++ x/auction/keeper/query_server.go | 9 ++++++++- x/auction/module/autocli.go | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index 7e6c59b3..dd9cd183 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -173,3 +173,13 @@ func (k Keeper) CommitBid(ctx sdk.Context, msg auctiontypes.MsgCommitBid) (*auct func (k Keeper) RevealBid(ctx sdk.Context, msg auctiontypes.MsgRevealBid) (*auctiontypes.Auction, error) { panic("unimplemented") } + +// GetParams gets the auction module's parameters. +func (k Keeper) GetParams(ctx sdk.Context) (*auctiontypes.Params, error) { + params, err := k.Params.Get(ctx) + if err != nil { + return nil, err + } + + return ¶ms, nil +} diff --git a/x/auction/keeper/query_server.go b/x/auction/keeper/query_server.go index 5c388e0d..65a8ac55 100644 --- a/x/auction/keeper/query_server.go +++ b/x/auction/keeper/query_server.go @@ -22,7 +22,14 @@ func NewQueryServerImpl(k Keeper) auctiontypes.QueryServer { // Params implements the params query command func (qs queryServer) Params(c context.Context, req *auctiontypes.QueryParamsRequest) (*auctiontypes.QueryParamsResponse, error) { - panic("unimplemented") + ctx := sdk.UnwrapSDKContext(c) + + params, err := qs.k.GetParams(ctx) + if err != nil { + return nil, err + } + + return &auctiontypes.QueryParamsResponse{Params: params}, nil } // Auctions queries all auctions diff --git a/x/auction/module/autocli.go b/x/auction/module/autocli.go index 99a6e16e..e81d26ee 100644 --- a/x/auction/module/autocli.go +++ b/x/auction/module/autocli.go @@ -18,7 +18,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { { RpcMethod: "Params", Use: "params", - Short: "Get the current bond parameters", + Short: "Get the current auction parameters", PositionalArgs: []*autocliv1.PositionalArgDescriptor{}, }, {