mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-07 06:36:42 +00:00
26 lines
712 B
Go
26 lines
712 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
func (k Keeper) GetDistribution(goCtx context.Context, req *types.QueryGetDistributionRequest) (*types.QueryGetDistributionResponse, error) {
|
|
if req == nil {
|
|
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
|
}
|
|
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
|
|
distribution, found := k.LookupDistributionOrder(ctx, req.GetLastPopHeight())
|
|
if !found {
|
|
return nil, status.Error(codes.NotFound, "distribution not found")
|
|
}
|
|
|
|
return &types.QueryGetDistributionResponse{Distribution: &distribution}, nil
|
|
}
|