planetmint-go/x/dao/keeper/query_get_reissuances.go
Julian Strobl 5b25d4cefc
Improve linter setup (#186)
* [linter] Add `musttag`

Enforce field tags in (un)marshaled structs.

* [linter] Add `nestif`

Reports deeply nested if statements.

* [linter] Add `noctx`

Finds sending http request without context.Context.

* [linter] Add `paralleltest`

Paralleltest detects missing usage of t.Parallel() method in your Go
test.

* [linter] Add `tagalign`

Check that struct tags are well aligned.

* [linter] Add `tagliatelle`

Checks the struct tags.

* [linter] Add `whitespace`

Tool for detection of leading and trailing whitespace.

* [paralleltest] Exclude files bc of data race in tests

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
2023-11-17 10:56:25 +01:00

28 lines
810 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) GetReissuances(goCtx context.Context, req *types.QueryGetReissuancesRequest) (*types.QueryGetReissuancesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "invalid request")
}
ctx := sdk.UnwrapSDKContext(goCtx)
reissuances := k.getReissuancesPage(ctx, req.Pagination.GetKey(),
req.Pagination.GetOffset(), req.Pagination.GetLimit(),
req.Pagination.GetCountTotal(), req.Pagination.GetReverse())
if reissuances != nil {
return &types.QueryGetReissuancesResponse{Reissuance: &reissuances[0]}, nil
}
return &types.QueryGetReissuancesResponse{}, nil
}