corvidd/x/bond/keeper/query_server.go
prathamesh0 e511051f3e
Add commands to create and list bonds (#3)
* Add message service with a create bond command

* Add query proto file with bonds list query

* Remove legacy amino coded registration

* Add bond to auth module config

* Use collections package for bond module state
2024-02-02 15:09:10 +05:30

33 lines
670 B
Go

package keeper
import (
"context"
"git.vdb.to/cerc-io/laconic2d/x/bond"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// TODO: Add remaining query methods
type queryServer struct {
k Keeper
}
var _ bond.QueryServer = queryServer{}
// NewQueryServerImpl returns an implementation of the module QueryServer.
func NewQueryServerImpl(k Keeper) bond.QueryServer {
return queryServer{k}
}
func (qs queryServer) Bonds(c context.Context, _ *bond.QueryGetBondsRequest) (*bond.QueryGetBondsResponse, error) {
ctx := sdk.UnwrapSDKContext(c)
resp, err := qs.k.ListBonds(ctx)
if err != nil {
return nil, err
}
return &bond.QueryGetBondsResponse{Bonds: resp}, nil
}