2024-02-01 04:48:40 +00:00
|
|
|
package keeper
|
|
|
|
|
2024-02-02 09:39:10 +00:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"git.vdb.to/cerc-io/laconic2d/x/bond"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TODO: Add remaining query methods
|
|
|
|
|
2024-02-01 04:48:40 +00:00
|
|
|
type queryServer struct {
|
|
|
|
k Keeper
|
|
|
|
}
|
|
|
|
|
2024-02-02 09:39:10 +00:00
|
|
|
var _ bond.QueryServer = queryServer{}
|
2024-02-01 04:48:40 +00:00
|
|
|
|
|
|
|
// NewQueryServerImpl returns an implementation of the module QueryServer.
|
2024-02-02 09:39:10 +00:00
|
|
|
func NewQueryServerImpl(k Keeper) bond.QueryServer {
|
|
|
|
return queryServer{k}
|
|
|
|
}
|
2024-02-01 04:48:40 +00:00
|
|
|
|
2024-02-02 09:39:10 +00:00
|
|
|
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
|
|
|
|
}
|