Add a command to get auction module params

This commit is contained in:
Prathamesh Musale 2024-02-12 10:29:48 +05:30
parent 6e72f58616
commit d445811e80
3 changed files with 19 additions and 2 deletions

View File

@ -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 &params, nil
}

View File

@ -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

View File

@ -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{},
},
{